Module mathcomp.reals_stdlib.Rstruct
From Stdlib Require Import ZArith Rdefinitions Raxioms RIneq Rbasic_fun Zwf.From Stdlib Require Import Epsilon FunctionalExtensionality Ranalysis1 Rsqrt_def.
From Stdlib Require Import Rtrigo1 Reals.
From HB Require Import structures.
From mathcomp Require Import boot order ssralg poly ssrnum archimedean.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Local Open Scope R_scope.
Lemma
Source code
Proof.
- by right=> r1Er2; case: (Rlt_irrefl r1); rewrite {2}r1Er2.
- by left.
by right=> r1Er2; case: (Rlt_irrefl r1); rewrite {1}r1Er2.
Qed.
Definition
Source code
if Req_EM_T r1 r2 is left _ then true else false.
Lemma
Source code
Source code
Source code
Source code
Source code
Fact
Source code
Proof.
Definition
Source code
let := epsilon inhR P in if P x then Some x else None.
Fact
Source code
Fact
Source code
(exists : R, P x) -> exists , pickR P n.
Proof.
Fact
Source code
Proof.
Source code
.
Source code
Source code
Source code
Fact
Source code
Proof.
Source code
.
Source code
Source code
Source code
RplusA Rplus_comm Rplus_0_l Rplus_opp_l.
Fact
Source code
Proof.
Fact
Source code
Source code
.
Source code
Source code
Source code
RmultA Rmult_1_l Rmult_1_r Rmult_plus_distr_r Rmult_plus_distr_l R1_neq_0.
Source code
.
Source code
Source code
Source code
Import Monoid.
.
Source code
Source code
Source code
RplusA Rplus_comm Rplus_0_l.
.
Source code
Source code
Source code
RmultA Rmult_comm Rmult_1_l.
.
Source code
Source code
Source code
.
Source code
Source code
Source code
Rmult_plus_distr_r Rmult_plus_distr_l.
Definition
pickR : pred R -> nat -> option R pickR is not universe polymorphic Arguments pickR P n%_nat_scope pickR is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.pickR Declared in library mathcomp.reals_stdlib.Rstruct, line 71, characters 11-16
Source code
Lemma
Source code
Proof.
Section Rinvx.
Let
Source code
Let
Source code
Let
Source code
Proof.
rewrite /GRing.inv /GRing.mul /= /Rinvx eqxx /=.
rewrite RinvImpl.Rinv_def; case: Req_appart_dec => //.
by move=> /[dup] -[] /Rlt_irrefl.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
End Rinvx.
#[deprecated(since="mathcomp-analysis 1.9.0", note="To be removed. Use GRing.inv instead.")]
Definition
unit_R : RbaseSymbolsImpl_R__canonical__eqtype_Equality -> bool unit_R is not universe polymorphic Arguments unit_R r unit_R is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.unit_R Declared in library mathcomp.reals_stdlib.Rstruct, line 123, characters 11-17
Source code
Source code
.
Source code
Source code
Source code
RmultRinv RinvRmult intro_unit_R Rinv_out.
Lemma
Source code
Proof.
Source code
.
Source code
Source code
Source code
R_idomainMixin.
Lemma
Source code
Proof.
Source code
Source code
Source code
Definition
Rinvx : R -> R Rinvx is not universe polymorphic Arguments Rinvx _%_R_scope Rinvx is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.Rinvx Declared in library mathcomp.reals_stdlib.Rstruct, line 164, characters 11-16
Source code
Definition
Rleb : R -> R -> bool Rleb is not universe polymorphic Arguments Rleb (r1 r2)%_R_scope Rleb is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.Rleb Declared in library mathcomp.reals_stdlib.Rstruct, line 182, characters 11-15
Source code
Definition
Rltb : R -> R -> bool Rltb is not universe polymorphic Arguments Rltb (r1 r2)%_R_scope Rltb is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.Rltb Declared in library mathcomp.reals_stdlib.Rstruct, line 183, characters 11-15
Source code
Definition
Rgeb : R -> R -> bool Rgeb is not universe polymorphic Arguments Rgeb (r1 r2)%_R_scope Rgeb is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.Rgeb Declared in library mathcomp.reals_stdlib.Rstruct, line 184, characters 11-15
Source code
Lemma
Source code
Lemma
Source code
Proof.
Section ssreal_struct.
Local Open Scope R_scope.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
apply: Rminus_le; rewrite -Ropp_minus_distr.
apply/Rge_le/Ropp_0_le_ge_contravar.
by rewrite -H; apply: Rabs_pos.
apply/eqP/Rabs_pos_eq.
rewrite -Ropp_minus_distr.
by apply/Ropp_0_ge_le_contravar/Rle_ge.
Qed.
Lemma
Source code
Proof.
case/andP=> /eqP H /RlebP/Rle_not_gt H2.
by case: (Rtotal_order x y)=> // [][] // /esym.
move=> H; apply/andP; split; [apply/eqP|apply/RlebP].
exact: Rgt_not_eq.
exact: Rlt_le.
Qed.
.
Source code
Source code
Source code
Rleb_norm_add addr_Rgtb0 Rnorm0_eq0 Rleb_leVge RnormM Rleb_def Rltb_def.
Lemma
Source code
Proof.
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
.
Source code
Source code
Source code
Lemma
Source code
Proof.
have [Hx1 Hx2] := archimed x.
have Hz ( : Z) : z = (z - 1 + 1)%Z by rewrite Zplus_comm Zplus_minus.
have Zabs_nat_Zopp z : Z.abs_nat (- z)%Z = Z.abs_nat z by case: z.
apply/RltbP/Rabs_def1.
apply: (Rlt_trans _ ((Z.abs_nat (up x))%:R)%R); last first.
rewrite -[((Z.abs_nat _)%:R)%R]Rplus_0_r mulrnDr.
by apply/Rplus_lt_compat_l/Rlt_0_2.
apply: (Rlt_le_trans _ (IZR (up x)))=> //.
elim/(well_founded_ind (Zwf_well_founded 0)): (up x) => z IHz.
case: (Z_lt_le_dec 0 z) => [zp | zn].
rewrite [z]Hz plus_IZR Zabs_nat_Zplus //; first exact: Zlt_0_le_0_pred.
rewrite plusE mulrnDr.
apply/Rplus_le_compat_r/IHz; split; first exact: Zlt_le_weak.
exact: Zlt_pred.
apply: (Rle_trans _ (IZR 0)); first exact: IZR_le.
by apply/RlebP/(ler0n R (Z.abs_nat z)).
apply: (Rlt_le_trans _ (IZR (up x) - 1)).
apply: Ropp_lt_cancel; rewrite Ropp_involutive.
rewrite Ropp_minus_distr /Rminus -opp_IZR -{2}(Z.opp_involutive (up x)).
elim/(well_founded_ind (Zwf_well_founded 0)): (- up x)%Z => z IHz .
case: (Z_lt_le_dec 0 z) => [zp | zn].
rewrite [z]Hz Zabs_nat_Zopp plus_IZR.
rewrite Zabs_nat_Zplus //; first exact: Zlt_0_le_0_pred.
rewrite plusE -Rplus_assoc -addnA [(_ + 2)%N]addnC addnA mulrnDr.
apply: Rplus_lt_compat_r; rewrite -Zabs_nat_Zopp.
apply: IHz; split; first exact: Zlt_le_weak.
exact: Zlt_pred.
apply: (Rle_lt_trans _ 1).
rewrite -{2}[1]Rplus_0_r; apply: Rplus_le_compat_l.
by rewrite -/(IZR 0); apply: IZR_le.
rewrite mulrnDr; apply: (Rlt_le_trans _ 2).
by rewrite -{1}[1]Rplus_0_r; apply/Rplus_lt_compat_l/Rlt_0_1.
rewrite -[2]Rplus_0_l; apply: Rplus_le_compat_r.
by apply/RlebP/(ler0n R (Z.abs_nat _)).
apply: Rminus_le.
rewrite /Rminus Rplus_assoc [- _ + _]Rplus_comm -Rplus_assoc -!/(Rminus _ _).
exact: Rle_minus.
Qed.
.
Source code
Source code
Source code
Rarchimedean_axiom.
Lemma
Source code
Proof.
have [y [Hy1 Hy2]]:= Hf x eps Heps.
by exists y; split=> // z; rewrite -!Hfg; exact: Hy2.
Qed.
Lemma
Source code
(forall , P i -> continuity (F i)) ->
continuity (fun => (\sum_( | P i) ((F i) x)))%R.
Proof.
set f:= fun _ => _.
have Hf: (fun => 0) =1 f by move=> x; rewrite /f big_nil.
by apply: (continuity_eq Hf); exact: continuity_const.
set f := fun _ => _.
case Hpa: (P a).
have Hf: (fun => F a x + \sum_( <- l | P i) F i x)%R =1 f.
by move=> x; rewrite /f big_cons Hpa.
apply: (continuity_eq Hf); apply: continuity_plus=> //.
exact: H.
have Hf: (fun => \sum_( <- l | P i) F i x)%R =1 f.
by move=> x; rewrite /f big_cons Hpa.
exact: (continuity_eq Hf).
Qed.
Lemma
Source code
Proof.
set g:= fun _ => _.
have Hg: (fun => f x * f x ^+ n)%R =1 g.
by move=> x; rewrite /g exprS.
by apply: (continuity_eq Hg); exact: continuity_mult.
Qed.
Lemma
Source code
Proof.
case Hpa: ((p.[a])%R == 0%R).
by move=> ? _ ; exists a=> //; rewrite lexx le_eqVlt.
case Hpb: ((p.[b])%R == 0%R).
by move=> ? _; exists b=> //; rewrite lexx le_eqVlt andbT.
have [->|Hab] := eqVneq a b.
by move=> _; rewrite eq_sym Hpb (ltNge 0) /=; case/andP=> /ltW ->.
rewrite eq_sym Hpb /=; clear=> /RltbP Hab /andP[/RltbP Hpa /RltbP Hpb].
suff Hcp : continuity (fun => (p.[x])%R).
have [z [[Hza Hzb] /eqP Hz2]]:= IVT _ a b Hcp Hab Hpa Hpb.
by exists z=> //; apply/andP; split; apply/RlebP.
rewrite -[p]coefK poly_def.
set f := fun _ => _.
have Hf: (fun : R => \sum_( < size p) (p`_i * x^+i))%R =1 f.
move=> x; rewrite /f horner_sum.
by apply: eq_bigr=> i _; rewrite hornerZ hornerXn.
apply: (continuity_eq Hf); apply: continuity_sum=> i _.
apply:continuity_scal; apply: continuity_exp=> x esp Hesp.
by exists esp; split=> // y [].
Qed.
.
Source code
Source code
Source code
End ssreal_struct.
Arguments RleP {x y}.
Arguments RltP {x y}.
Local Open Scope ring_scope.
From mathcomp Require Import boolp classical_sets.
From mathcomp Require Import reals.
Section ssreal_struct_contd.
Implicit Type E : set R.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
exists x; split; first by rewrite -is_upper_boundE; apply: E1.
by move=> y; rewrite -is_upper_boundE => /E2/RleP.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
have [s [Es sE]] := Rcondcomplete hsE.
split => x Ex; first by apply/ge_supremum_Nmem=> //; exact: Rsupremums_neq0.
rewrite /supremum (negbTE E0); case: xgetP => /=.
by move=> _ -> [_ EsE]; apply/EsE.
by have [y Ey /(_ y)] := Rsupremums_neq0 hsE.
Qed.
Lemma
Source code
Source code
has_sup E -> exists2 , E e & (supremum x0 E - eps) < e.
Proof.
Lemma
Source code
Proof.
.
Source code
Source code
Source code
(@Rsup_ub (0 : R)) (real_sup_adherent 0).
Implicit Types (x y : R) (m n : nat).
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Source code
Proof.
Source code
Proof.
Let
Source code
Proof.
Lemma
Source code
Proof.
have RxE : Rx = Rbasic_fun.Rcase_abs x by [].
rewrite /R_sqrt.sqrt -RxE.
move: RxE; case: Rbasic_fun.Rcase_abs => x0 RxE.
by rewrite RxE ler0_sqrtr//; exact/ltW/RltP.
by rewrite /Rx -/(R_sqrt.sqrt _) ge0_RsqrtE //; exact/RleP/Rge_le.
Qed.
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Definition
Source code
INRE, R0E, R1E, Pos_to_natE, IZRposE, RsqrtE, RpowE, RmaxE, RminE,
RabsE, RdistE, sum_f_R0E, factE).
Section bigmaxr.
Context { : realDomainType}.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
Definition
RealsE : (forall x y : R, (x + y)%R = (x + y)%R) * (forall x y : R, (x - y)%R = (x - y)%R) * (forall x y : R, (x * y)%R = (x * y)%R) * (forall x : R, (- x)%R = (- x)%R) * (forall x : R, (/ x)%R = x^-1%R) * (forall x y : R, (x / y)%R = (x / y)%R) * (forall n : nat, INR n = n%:R%R) * (0%R = 0%R) * (1%R = 1%R) * (forall p : positive, Pos.to_nat p = nat_of_pos p) * (forall p : positive, IZR (Z.pos p) = INR (nat_of_pos p)) * (forall x : R, sqrt x = Num.ExtraDef.sqrtr x) * (forall (x : R) (n : nat), (x ^ n)%R = (x ^+ n)%R) * (forall x y : R, Rmax x y = Num.max x y) * (forall x y : R, Rmin x y = Num.min x y) * (forall x : R, Rabs x = `|x|%R) * (forall x y : R, Rdist x y = `|x - y|%R) * (forall (f : nat -> R) (n : nat), sum_f_R0 f n = (\sum_(0 <= k < n.+1) f k)%R) * (forall n : nat, fact n = n`!) RealsE is not universe polymorphic RealsE is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.RealsE Declared in library mathcomp.reals_stdlib.Rstruct, line 554, characters 11-17
Source code
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
Proof.
rewrite (_ : bigmaxr _ _ = if s isn't h :: t then r else \big[Num.max/h]_( <- s) i).
#[warning="-deprecated"]
by case: s => //=; rewrite /bigmaxr big_nil.
#[warning="-deprecated"]
case: s => // ? t; rewrite big_cons /bigmaxr.
by elim: t => //= [|? ? <-]; [rewrite big_nil maxxx | rewrite big_cons maxCA].
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
Lemma
Source code
Num.max x (\big[Num.max/y]_( <- y :: s) i).
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
bigmaxr x0 (x :: y :: lr) = Num.max x (bigmaxr x0 (y :: lr)).
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(i < size s)%N -> (nth x0 s i) <= (bigmaxr x0 s).
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
bigmaxr (x0 + x) (map (fun : R => y + x) lr) = (bigmaxr x0 lr) + x.
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
Proof.
rewrite /bigmaxr; case: lr => // h t _.
elim: t => //= [|h' t IH] in h *; first by rewrite big_cons big_nil inE maxxx.
#[warning="-deprecated"]
rewrite big_cons bigrmax_dflt inE eq_le; case: lerP => /=.
- by rewrite le_max lexx.
- by rewrite lt_max ltxx => ?; rewrite max_r ?IH // ltW.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
0 <= k -> bigmaxr 0 (map (fun => k * x i) s) = k * bigmaxr 0 (map x s).
Proof.
#[warning="-deprecated"]
by rewrite bigmaxr_nil mulr0.
#[warning="-deprecated"]
by rewrite !bigmaxr_un.
#[warning="-deprecated"]
by rewrite bigmaxr_cons {}ih bigmaxr_cons maxr_pMr.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(0 < size lr)%N -> (index (bigmaxr x0 lr) lr < size lr)%N.
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(0 < size lr)%N ->
reflect (forall , (i < size lr)%N -> (nth x0 lr i) <= x) ((bigmaxr x0 lr) <= x).
Proof.
#[warning="-deprecated"]
by apply: (le_trans _ le_x); apply: bigmaxr_ler.
#[warning="-deprecated"]
by move/(nthP x0): (bigmaxr_mem x0 lr_size) => [i i_size <-]; apply: H.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(0 < size lr)%N ->
reflect (forall , (i < size lr)%N -> (nth x0 lr i) < x) ((bigmaxr x0 lr) < x).
Proof.
#[warning="-deprecated"]
by apply: le_lt_trans lt_x; apply: bigmaxr_ler.
#[warning="-deprecated"]
by move/(nthP x0): (bigmaxr_mem x0 lr_size) => [i i_size <-]; apply: H.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(x \in lr /\ forall , (i < size lr) %N -> (nth x0 lr i) <= x) -> (bigmaxr x0 lr = x).
Proof.
#[warning="-deprecated"]
by apply/bigmaxr_lerP => //; apply: (leq_trans _ j_size).
#[warning="-deprecated"]
by rewrite -j_nth (bigmaxr_ler _ j_size).
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
uniq lr -> forall , (i < size lr)%N ->
(nth x0 lr i) <= (bigmaxr x0 lr) ?= iff (i == index (bigmaxr x0 lr) lr).
Proof.
move=> lr_uniq i i_size; rewrite /Num.leif (bigmaxr_ler _ i_size).
#[warning="-deprecated"]
rewrite -(nth_uniq x0 i_size (bigmaxr_index _ (leq_trans _ i_size)) lr_uniq) //.
rewrite nth_index //.
#[warning="-deprecated"]
by apply: bigmaxr_mem; apply: (leq_trans _ i_size).
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Definition
bigmaxr : forall {R : realDomainType}, R -> seq R -> R bigmaxr is not universe polymorphic Arguments bigmaxr {R} r%_ring_scope s%_seq_scope bigmaxr is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.bigmaxr Declared in library mathcomp.reals_stdlib.Rstruct, line 563, characters 11-18
Source code
bigmaxr (f ord0) (codom f).
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(f i) <= (bmaxrf f).
Proof.
move: (@bigmaxr_ler (f ord0) (codom f) (nat_of_ord i)).
#[warning="-deprecated"]
rewrite /bmaxrf size_codom card_ord => H; move: (ltn_ord i); move/H.
suff -> : nth (f ord0) (codom f) i = f i; first by [].
by rewrite /codom (nth_map ord0) ?size_enum_ord // nth_ord_enum.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
(index (bmaxrf f) (codom f) < n.+1)%N.
Proof.
rewrite /bmaxrf.
rewrite [in X in (_ < X)%N](_ : n.+1 = size (codom f)).
by rewrite size_codom card_ord.
#[warning="-deprecated"]
by apply: bigmaxr_index; rewrite size_codom card_ord.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Definition
bmaxrf : forall {R : realDomainType} [n : nat], {ffun 'I_n.+1 -> R} -> R bmaxrf is not universe polymorphic Arguments bmaxrf {R} [n]%_nat_scope f bmaxrf is transparent Expands to: Constant mathcomp.reals_stdlib.Rstruct.bmaxrf Declared in library mathcomp.reals_stdlib.Rstruct, line 733, characters 11-17
Source code
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
Lemma
Source code
Source code
Proof.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
f (index_bmaxrf f) = bmaxrf f.
Proof.
move: (bmaxrf_index f).
rewrite -[X in _ (_ < X)%N]card_ord -(size_codom f) index_mem.
move/(nth_index (f ord0)) => <-; rewrite (nth_map ord0).
#[warning="-deprecated"]
by rewrite size_enum_ord; apply: bmaxrf_index.
#[warning="-deprecated"]
by rewrite (ordnat (bmaxrf_index _)) /index_bmaxrf nth_ord_enum.
Qed.
#[deprecated(note="To be removed. Use order.v's bigmax/min lemmas instead.")]
#[warning="-deprecated"]
Lemma
Source code
injective f -> forall ,
(f i) <= (bmaxrf f) ?= iff (i == index_bmaxrf f).
Proof.
by move=> inj_f i; rewrite /Num.leif bmaxrf_ler -(inj_eq inj_f) eq_index_bmaxrf.
Qed.
End bigmaxr.
End ssreal_struct_contd.