aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2017-04-27 21:30:53 +0200
committerGravatar Maxime Dénès <mail@maximedenes.fr>2017-04-27 21:30:53 +0200
commit0a255f51809e8d29a7239bfbd9fe57a8b2b41705 (patch)
tree9f9b9515dc1bdddf17ab8746a7a061d23d6b15ca
parentcc12397b32785b06ed892e8ad420cfe253842141 (diff)
parentf5c81ac1bcae7c40d5e89229647c06c97b5ddc85 (diff)
Merge PR#414: Some more theory on powerRZ.
-rw-r--r--theories/Reals/Rfunctions.v98
-rw-r--r--theories/Reals/Rpower.v14
2 files changed, 112 insertions, 0 deletions
diff --git a/theories/Reals/Rfunctions.v b/theories/Reals/Rfunctions.v
index 99acdd0a1..653fac8d9 100644
--- a/theories/Reals/Rfunctions.v
+++ b/theories/Reals/Rfunctions.v
@@ -532,6 +532,36 @@ Qed.
(*******************************)
(*i Due to L.Thery i*)
+Section PowerRZ.
+
+Local Coercion Z_of_nat : nat >-> Z.
+
+(* the following section should probably be somewhere else, but not sure where *)
+Section Z_compl.
+
+Local Open Scope Z_scope.
+
+(* Provides a way to reason directly on Z in terms of nats instead of positive *)
+Inductive Z_spec (x : Z) : Z -> Type :=
+| ZintNull : x = 0 -> Z_spec x 0
+| ZintPos (n : nat) : x = n -> Z_spec x n
+| ZintNeg (n : nat) : x = - n -> Z_spec x (- n).
+
+Lemma intP (x : Z) : Z_spec x x.
+Proof.
+ destruct x as [|p|p].
+ - now apply ZintNull.
+ - rewrite <-positive_nat_Z at 2.
+ apply ZintPos.
+ now rewrite positive_nat_Z.
+ - rewrite <-Pos2Z.opp_pos.
+ rewrite <-positive_nat_Z at 2.
+ apply ZintNeg.
+ now rewrite positive_nat_Z.
+Qed.
+
+End Z_compl.
+
Definition powerRZ (x:R) (n:Z) :=
match n with
| Z0 => 1
@@ -658,6 +688,74 @@ Proof.
auto with real.
Qed.
+Local Open Scope Z_scope.
+
+Lemma pow_powerRZ (r : R) (n : nat) :
+ (r ^ n)%R = powerRZ r (Z_of_nat n).
+Proof.
+ induction n; [easy|simpl].
+ now rewrite SuccNat2Pos.id_succ.
+Qed.
+
+Lemma powerRZ_ind (P : Z -> R -> R -> Prop) :
+ (forall x, P 0 x 1%R) ->
+ (forall x n, P (Z.of_nat n) x (x ^ n)%R) ->
+ (forall x n, P ((-(Z.of_nat n))%Z) x (Rinv (x ^ n))) ->
+ forall x (m : Z), P m x (powerRZ x m)%R.
+Proof.
+ intros ? ? ? x m.
+ destruct (intP m) as [n Hm| n Hm|n Hm].
+ - easy.
+ - now rewrite <- pow_powerRZ.
+ - unfold powerRZ.
+ destruct n as [|n]; [ easy |].
+ rewrite Nat2Z.inj_succ, <- Zpos_P_of_succ_nat, Pos2Z.opp_pos.
+ now rewrite <- Pos2Z.opp_pos, <- positive_nat_Z.
+Qed.
+
+Lemma powerRZ_inv x alpha : (x <> 0)%R -> powerRZ (/ x) alpha = Rinv (powerRZ x alpha).
+Proof.
+ intros; destruct (intP alpha).
+ - now simpl; rewrite Rinv_1.
+ - now rewrite <-!pow_powerRZ, ?Rinv_pow, ?pow_powerRZ.
+ - unfold powerRZ.
+ destruct (- n).
+ + now rewrite Rinv_1.
+ + now rewrite Rinv_pow.
+ + now rewrite <-Rinv_pow.
+Qed.
+
+Lemma powerRZ_neg x : forall alpha, x <> R0 -> powerRZ x (- alpha) = powerRZ (/ x) alpha.
+Proof.
+ intros [|n|n] H ; simpl.
+ - easy.
+ - now rewrite Rinv_pow.
+ - rewrite Rinv_pow by now apply Rinv_neq_0_compat.
+ now rewrite Rinv_involutive.
+Qed.
+
+Lemma powerRZ_mult_distr :
+ forall m x y, ((0 <= m)%Z \/ (x * y <> 0)%R) ->
+ (powerRZ (x*y) m = powerRZ x m * powerRZ y m)%R.
+Proof.
+ intros m x0 y0 Hmxy.
+ destruct (intP m) as [ | | n Hm ].
+ - now simpl; rewrite Rmult_1_l.
+ - now rewrite <- !pow_powerRZ, Rpow_mult_distr.
+ - destruct Hmxy as [H|H].
+ + assert(m = 0) as -> by now omega.
+ now rewrite <- Hm, Rmult_1_l.
+ + assert(x0 <> 0)%R by now intros ->; apply H; rewrite Rmult_0_l.
+ assert(y0 <> 0)%R by now intros ->; apply H; rewrite Rmult_0_r.
+ rewrite !powerRZ_neg by assumption.
+ rewrite Rinv_mult_distr by assumption.
+ now rewrite <- !pow_powerRZ, Rpow_mult_distr.
+Qed.
+
+End PowerRZ.
+
+Local Infix "^Z" := powerRZ (at level 30, right associativity) : R_scope.
+
(*******************************)
(* For easy interface *)
(*******************************)
diff --git a/theories/Reals/Rpower.v b/theories/Reals/Rpower.v
index b8040bb4f..0e0246cbf 100644
--- a/theories/Reals/Rpower.v
+++ b/theories/Reals/Rpower.v
@@ -473,6 +473,20 @@ Proof.
apply exp_Ropp.
Qed.
+Lemma powerRZ_Rpower x z : (0 < x)%R -> powerRZ x z = Rpower x (IZR z).
+Proof.
+ intros Hx.
+ assert (x <> 0)%R
+ by now intros Habs; rewrite Habs in Hx; apply (Rlt_irrefl 0).
+ destruct (intP z).
+ - now rewrite Rpower_O.
+ - rewrite <- pow_powerRZ, <- Rpower_pow by assumption.
+ now rewrite INR_IZR_INZ.
+ - rewrite opp_IZR, Rpower_Ropp.
+ rewrite powerRZ_neg, powerRZ_inv by assumption.
+ now rewrite <- pow_powerRZ, <- INR_IZR_INZ, Rpower_pow.
+Qed.
+
Theorem Rle_Rpower :
forall e n m:R, 1 < e -> 0 <= n -> n <= m -> e ^R n <= e ^R m.
Proof.