Module mathcomp.reals.reals
From HB Require Import structures.From mathcomp Require Import boot order algebra.
#[warning="-warn-library-file-internal-analysis"]
From mathcomp Require Import unstable.
From mathcomp Require Import boolp classical_sets contra set_interval.
Declare Scope real_scope.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Delimit Scope real_scope with real.
Local Open Scope classical_set_scope.
Local Open Scope ring_scope.
Section subr_image.
Variable RSource code : numDomainType.
Implicit Types (E : set R) (x : R).
Lemma has_ub_lbNUsed by
- mathcomp.analysis.realfun
- mathcomp.analysis.sequences
Source code ESource code : has_ubound E <-> has_lbound (-%R @` E).
Proof.
Lemma has_lbound0Used by
- mathcomp.analysis.normedtype_theory.normed_module
Source code : has_lbound (@set0 R)
Proof.
Lemma has_ubound0Used by
- mathcomp.analysis.normedtype_theory.normed_module
Source code : has_ubound (@set0 R)
Proof.
Lemma ubound0Source code : ubound (@set0 R) = setT.
Proof.
Lemma lboundTSource code : lbound [set: R] = set0.
Proof.
End subr_image.
Section has_bound_lemmas.
Variable RSource code : realDomainType.
Implicit Types E : set R.
Implicit Types x : R.
Lemma has_ub_image_normUsed by
- mathcomp.analysis.sequences
Source code ESource code : has_ubound (Num.norm @` E) -> has_ubound E.
Proof.
Lemma has_inf_supNUsed by
- mathcomp.analysis.real_measure.lebesgue_measure
- mathcomp.analysis.sequences
Source code ESource code : has_sup (-%R @` E) <-> has_inf E.
Proof.
Lemma has_supPnUsed by
- mathcomp.experimental_reals.realsum
Source code {ESource code} : E !=set0 ->
~ has_sup E <-> (forall xSource code, exists2 ySource code, E y & x < y).
Proof.
End has_bound_lemmas.
HBSource code.mixinSource code RecordSource code ArchimedeanField_isRealSource code RSource code &Source code NumSource code.ArchiRealField R := {
sup_upper_bound_subdef : forall ESource code : set R,
has_sup E -> ubound E (supremum 0 E) ;
sup_adherent_subdef : forall (ESource code : set R) (epsSource code : R),
0 < eps -> has_sup E -> exists2 eSource code : R, E e & (supremum 0 E - eps) < e
}.
#[shortSource code(type=realTypeSource code)]Source code
HBSource code.structureSource code DefinitionSource code RealSource code :=Source code {RSource code of ArchimedeanField_isReal R
& Num.ArchiRealField R & Num.RealClosedField R}.
Bind Scope ring_scope with Real.sort.
Definition sup
Used by
- mathcomp.analysis.real_measure.lebesgue_measure
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.realfun
- mathcomp.analysis.elementary_functions.trigonometry_functions
- mathcomp.analysis.ereal
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.derive
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.complete_normed_module
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.analysis.normedtype_theory.normed_module
- mathcomp.reals.real_interval
- mathcomp.experimental_reals.realsum
- mathcomp.experimental_reals.realseq
Source code {RSource code : realType} := @supremum _ R 0.
Definition inf
Used by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.real_measure.lebesgue_measure
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.realfun
- mathcomp.analysis.ereal
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.analysis.normedtype_theory.normed_module
- mathcomp.reals.real_interval
- mathcomp.experimental_reals.distr
Source code {RSource code : realType} (ESource code : set R) := - sup (-%R @` E).
Lemma sup_upper_boundUsed by
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.realfun
- mathcomp.analysis.ereal
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.derive
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.complete_normed_module
- mathcomp.experimental_reals.realsum
- mathcomp.experimental_reals.realseq
Source code {RSource code : realType} (ESource code : set R):
has_sup E -> ubound E (sup E).
Proof.
Lemma sup_adherentUsed by
- mathcomp.analysis.realfun
- mathcomp.analysis.derive
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.experimental_reals.realsum
- mathcomp.experimental_reals.realseq
Source code {RSource code : realType} (ESource code : set R) (epsSource code : R) : 0 < eps ->
has_sup E -> exists2 eSource code : R, E e & (sup E - eps) < e.
Proof.
Section IsInt.
Context {RSource code : realFieldType}.
Definition Rint_pred
Source code := fun xSource code : R => `[< exists zSource code, x == z%:~R >].
Arguments Rint_pred _ /.
Definition Rint
sup : forall {R : realType}, set R -> R sup is not universe polymorphic Arguments sup {R} A%_classical_set_scope sup is transparent Expands to: Constant mathcomp.reals.reals.sup Declared in library mathcomp.reals.reals, line 135, characters 11-14
Source code := [qualify a xSource code | Rint_pred x].
Lemma Rint_defSource code xSource code : (x \is a Rint) = (`[< exists zSource code, x == z%:~R >]).
Proof.
Lemma RintPSource code xSource code : reflect (exists zSource code, x = z%:~R) (x \in Rint).
Lemma RintCSource code zSource code : z%:~R \is a Rint.
Proof.
Lemma Rint0Source code : 0 \is a Rint.
Lemma Rint1Used by
- mathcomp.analysis.real_measure.measurable_realfun
Source code : 1 \is a Rint.
Hint Resolve Rint0 Rint1 RintC : core.
Lemma Rint_subring_closedSource code : subring_closed Rint.
Proof.
HBSource code.instanceSource code DefinitionSource code _Source code :=Source code GRingSource code.isSubringClosed.Build R Rint_pred
Rint_subring_closed.
Lemma Rint_ler_addr1Source code (xSource code ySource code : R) : x \is a Rint -> y \is a Rint ->
(x + 1 <= y) = (x < y).
Proof.
Lemma Rint_ltr_addr1Used by
- mathcomp.analysis.real_measure.measurable_realfun
Source code (xSource code ySource code : R) : x \is a Rint -> y \is a Rint ->
(x < y + 1) = (x <= y).
Proof.
End IsInt.
Arguments Rint_pred _ _ /.
Section ToInt.
Context {RSource code : realType}.
Implicit Types x y : R.
Definition Rtoint
inf : forall {R : realType}, set R -> R inf is not universe polymorphic Arguments inf {R} E%_classical_set_scope inf is transparent Expands to: Constant mathcomp.reals.reals.inf Declared in library mathcomp.reals.reals, line 136, characters 11-14
Source code (xSource code : R) : int :=
if insub x : {? xSource code | x \is a Rint} is Some Px then
xchoose (asboolP _ (tagged Px))
else 0.
Lemma RtointKSource code (xSource code : R): x \is a Rint -> (Rtoint x)%:~R = x.
Proof.
Lemma RtointzSource code (zSource code : int): Rtoint z%:~R = z.
Lemma RtointnSource code (nSource code : nat): Rtoint n%:R = n%:~R.
Lemma inj_RtointSource code : {in Rint &, injective Rtoint}.
Lemma RtointNSource code xSource code : x \is a Rint -> Rtoint (- x) = - Rtoint x.
End ToInt.
Section RealDerivedOps.
Variable RSource code : realType.
Implicit Types x y : R.
Definition floor_set
Rint_pred : forall {R : realFieldType}, R -> bool Rint_pred is not universe polymorphic Arguments Rint_pred {R} x%_ring_scope / The reduction tactics unfold Rint_pred when applied to 2 arguments Rint_pred is transparent Expands to: Constant mathcomp.reals.reals.Rint_pred Declared in library mathcomp.reals.reals, line 151, characters 11-20
Source code xSource code := [set ySource code : R | (y \is a Rint) && (y <= x)].
Definition Rfloor
Rint : forall {R : realFieldType}, qualifier 1 R Rint is not universe polymorphic Arguments Rint {R} Rint is transparent Expands to: Constant mathcomp.reals.reals.Rint Declared in library mathcomp.reals.reals, line 153, characters 11-15
Source code xSource code : R := (Num.floor x)%:~R.
Definition range1
Rtoint : forall {R : realType}, R -> int Rtoint is not universe polymorphic Arguments Rtoint {R} x%_ring_scope Rtoint is transparent Expands to: Constant mathcomp.reals.reals.Rtoint Declared in library mathcomp.reals.reals, line 206, characters 11-17
Source code (xSource code : R) := [set ySource code | x <= y < x + 1].
Definition Rceil
floor_set : forall [R : realType], R -> set R floor_set is not universe polymorphic Arguments floor_set [R] x%_ring_scope _ floor_set is transparent Expands to: Constant mathcomp.reals.reals.floor_set Declared in library mathcomp.reals.reals, line 240, characters 11-20
Source code xSource code : R := (Num.ceil x)%:~R.
End RealDerivedOps.
Section RealLemmas.
Context {RSource code : realType}.
Implicit Types (A B : set R) (r : R).
Lemma sup_outUsed by
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.experimental_reals.realsum
Source code ASource code : ~ has_sup A -> sup A = 0
Proof.
Lemma sup0Used by
- mathcomp.analysis.normedtype_theory.normed_module
Source code : sup (@set0 R) = 0
Proof.
Lemma sup1Used by
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.experimental_reals.realsum
Source code rSource code : sup [set r] = r
Proof.
Lemma ub_le_supUsed by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.realfun
- mathcomp.analysis.ereal
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.normed_module
- mathcomp.reals.real_interval
Source code {ASource code} : has_ubound A -> ubound A (sup A).
Proof.
by apply/ubP/sup_upper_bound=> //; split; first by exists x.
Qed.
Lemma sup_ub_strictUsed by
- mathcomp.analysis.normedtype_theory.normed_module
Source code ASource code : has_ubound A ->
~ A (sup A) -> A `<=` [set rSource code | r < sup A].
Proof.
Lemma sup_totalSource code {ASource code} rSource code : has_sup A -> down A r \/ sup A <= r.
Proof.
Lemma ge_supUsed by
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.elementary_functions.trigonometry_functions
- mathcomp.analysis.ereal
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.complete_normed_module
- mathcomp.analysis.normedtype_theory.normed_module
- mathcomp.reals.real_interval
- mathcomp.experimental_reals.distr
- mathcomp.experimental_reals.realsum
Source code {ASource code} rSource code : A !=set0 -> (ubound A) r -> sup A <= r.
Proof.
have Dz: 2%:R * z = r + y by rewrite mulrC divfK// pnatr_eq0.
have ubA : has_sup A by split => //; exists r.
have [/downP [t At lezt] | leyz] := sup_total z ubA.
rewrite -(lerD2l r) -Dz -mulr2n -[leRHS]mulr_natl.
rewrite ler_pM2l ?ltr0Sn //; apply/(le_trans lezt).
by move/ubP : leAr; exact.
rewrite -(lerD2r y) -Dz -mulr2n -[leLHS]mulr_natl.
by rewrite ler_pM2l ?ltr0Sn.
Qed.
Lemma sup_setUUsed by
- mathcomp.reals.real_interval
Source code ASource code BSource code : has_sup B ->
(forall aSource code bSource code, A a -> B b -> a <= b) -> sup (A `|` B) = sup B.
Proof.
- apply: ge_sup => [|x [Ax|]]; first by apply: subset_nonempty B0 => ?; right.
by case: B0 => b Bb; rewrite (le_trans (AB _ _ Ax Bb))// ub_le_sup//; exists l.
- by move=> Bx; rewrite ub_le_sup //; exists l.
- apply: ge_sup => // b Bb; apply: ub_le_sup; last by right.
by exists l => x [Ax|Bx]; [rewrite (le_trans (AB _ _ Ax Bb)) // Bl|exact: Bl].
Qed.
Lemma sup_gtUsed by
- mathcomp.analysis.ereal
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.normed_module
Source code ASource code rSource code : A !=set0 ->
(r < sup A -> exists2 ySource code, A y & r < y)%R.
Proof.
Section SupInterchange.
Context {XSource code YSource code : Type} (SSource code : X -> Y -> R).
Implicit Types (x : X) (y : Y).
Let rowSource code xSource code := range (S x).
Let colSource code ySource code := range (S ^~ y).
Let rowsSource code := range (sup \o row).
Let colsSource code := range (sup \o col).
Lemma interchange_supSource code : (forall xSource code, has_sup (row x)) -> has_sup rows ->
sup rows = sup cols.
Proof.
have col_nonempty y : col y !=set0.
by case: rows_sup => -[_ [x _ _]] _; eexists; exact/imageT.
have col_bound u : ubound (col u) (sup rows).
move=> r [t _ <-]; apply: le_trans.
- have /sup_upper_bound := row_sup t.
by apply; exists u.
- have /sup_upper_bound := rows_sup.
by apply; exists t.
have col_le_rows y : sup (col y) <= sup rows.
by apply: ge_sup; [exact: col_nonempty|exact: col_bound].
have cols_sup : has_sup cols.
split.
- case: rows_sup => -[_ [x _ _]] _.
case: (row_sup x) => -[_ [y _ _]] _.
by exists (sup (col y)), y.
- by exists (sup rows) => _ [y _ <-]; exact: col_le_rows.
apply/eqP; rewrite eq_le; apply/andP; split.
- apply: ge_sup; first by case: rows_sup.
move=> _ [x _ <-].
apply: ge_sup; first by case: (row_sup x).
move=> _ [y _ <-]; apply: le_trans.
suff col_y_sup : has_sup (col y).
move: col_y_sup => /sup_upper_bound.
by apply; exists x.
split; first exact: col_nonempty.
by exists (sup rows).
move: cols_sup => /sup_upper_bound.
by apply; exists y.
- apply: ge_sup; first by case: cols_sup.
by move=> _ [y _ <-]; exact: col_le_rows.
Qed.
End SupInterchange.
End RealLemmas.
#[deprecated(since="mathcomp-analysis 1.14.0", note="Renamed `ub_le_sup`.")]
Notation sup_uboundSource code := ub_le_sup (only parsing).
#[deprecated(since="mathcomp-analysis 1.14.0", note="Renamed `ge_sup`.")]
Notation sup_le_ubSource code := ge_sup (only parsing).
#[deprecated(since="1.17.0", note="use `interchange_sup` instead")]
Notation __admitted__interchange_supSource code := interchange_sup (only parsing).
Section sup_sum.
Context {RSource code : realType}.
Lemma sup_sumEUsed by
- mathcomp.analysis.realfun
Source code (ASource code BSource code : set R) :
has_sup A -> has_sup B -> sup [set x + y | xSource code in A & ySource code in B] = sup A + sup B.
Proof.
have ABsup : has_sup [set x + y | xSource code in A & ySource code in B].
split; first by exists (a + b), a => //; exists b.
case: ubA ubB => p up [q uq]; exists (p + q) => ? [r Ar [s Bs] <-].
by apply: lerD; [exact: up | exact: uq].
apply: le_anti; apply/andP; split.
apply: ge_sup; first by case: ABsup.
by move=> ? [p Ap [q Bq] <-]; apply: lerD; exact: ub_le_sup.
rewrite leNgt -subr_gt0; apply/negP.
set eps := (_ + _ - _) => epos.
have e2pos : 0 < eps / 2%:R by rewrite divr_gt0// ltr0n.
have [r Ar supBr] := sup_adherent e2pos supA.
have [s Bs supAs] := sup_adherent e2pos supB.
have := ltrD supBr supAs.
rewrite -addrACA -opprD -splitr subKr; apply/negP; rewrite -leNgt.
by apply: sup_upper_bound => //; exists r => //; exists s.
Qed.
Lemma inf_sumEUsed by
- mathcomp.analysis.topology_theory.edist
- mathcomp.analysis.normedtype_theory.tvs
Source code (ASource code BSource code : set R) :
has_inf A -> has_inf B -> inf [set x + y | xSource code in A & ySource code in B] = inf A + inf B.
Proof.
rewrite [X in - sup X = _](_ : _ =
[set x + y | xSource code in [set - x | xSource code in A ] & ySource code in [set - x | xSource code in B]]); last first.
by rewrite sup_sumE // -opprD.
rewrite eqEsubset; split => /= t [] /= x []a Aa.
case => b Bb <- <-; exists (- a); first by exists a.
by exists (- b); [exists b|rewrite opprD].
move=> <- [y] [b Bb] <- <-; exists (a + b); last by rewrite opprD.
by exists a => //; exists b.
Qed.
End sup_sum.
Section InfTheory.
Variables (RSource code : realType).
Implicit Types E : set R.
Implicit Types x : R.
Lemma inf_adherentUsed by
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.num_normedtype
Source code ESource code (epsSource code : R) : 0 < eps ->
has_inf E -> exists2 eSource code, E e & e < inf E + eps.
Proof.
exists (- e); first by case: NEx => x Ex <-{}; rewrite opprK.
by rewrite ltrNl -mulN1r mulrDr !mulN1r opprK.
Qed.
Lemma inf_outUsed by
- mathcomp.analysis.normedtype_theory.num_normedtype
Source code ESource code : ~ has_inf E -> inf E = 0.
Proof.
exact/has_inf_supN.
Qed.
Lemma inf0Used by
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.normed_module
Source code : inf (@set0 R) = 0.
Proof.
Lemma inf1Used by
- mathcomp.analysis.normedtype_theory.num_normedtype
Source code xSource code : inf [set x] = x.
Proof.
Lemma ge_infUsed by
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.topology_theory.edist
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.normed_module
Source code ESource code : has_lbound E -> lbound E (inf E).
Proof.
Lemma inf_lb_strictUsed by
- mathcomp.analysis.normedtype_theory.normed_module
Source code ESource code : has_lbound E ->
~ E (inf E) -> E `<=` [set rSource code | inf E < r].
Proof.
Lemma lb_le_infUsed by
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
- mathcomp.analysis.topology_theory.edist
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
Source code ESource code xSource code : nonempty E -> (lbound E) x -> x <= inf E.
Lemma has_infPnSource code ESource code : nonempty E ->
~ has_inf E <-> (forall xSource code, exists2 ySource code, E y & y < x).
Proof.
Lemma inf_setUSource code (ASource code BSource code : set R) : has_inf A ->
(forall aSource code bSource code, A a -> B b -> a <= b) -> inf (A `|` B) = inf A.
Proof.
rewrite image_setU setUC sup_setU //; first exact/has_inf_supN.
by move=> _ _ [] b Bb <-{} [] a Aa <-{}; rewrite lerNl opprK; apply AB.
Qed.
Lemma inf_ltUsed by
- mathcomp.analysis.sequences
- mathcomp.analysis.normedtype_theory.tvs
- mathcomp.analysis.normedtype_theory.normed_module
Source code (SSource code : set R) (xSource code : R) : S !=set0 ->
(inf S < x -> exists2 ySource code, S y & y < x)%R.
Proof.
End InfTheory.
#[deprecated(since="mathcomp-analysis 1.14.0", note="Renamed `ge_inf`.")]
Notation inf_lboundSource code := ge_inf (only parsing).
Section FloorTheory.
Variable RSource code : realType.
Implicit Types (x y : R) (i : int).
Lemma has_sup_floor_setSource code xSource code : has_sup (floor_set x).
Proof.
rewrite /floor_set/mkset rpredN rpred_int /= lerNl.
case: (ger0P (-x)) => [/archi_boundP/ltW//|].
by move/ltW/le_trans; apply; rewrite ler0z.
apply/ubP=> y /andP[_] /le_trans; apply.
case: (ger0P x)=> [/archi_boundP/ltW|] //.
by move/ltW/le_trans; apply; rewrite ler0z.
Qed.
Lemma sup_in_floor_setSource code xSource code : (floor_set x) (sup (floor_set x)).
Proof.
have /sup_upper_bound /ubP /(_ _ Fy) := has_sup_floor_set x.
rewrite le_eqVlt=> /orP[/eqP<-//| lt_yFx].
rewrite ltrBlDr -ltrBlDl => lt1_FxBy.
pose e := sup (floor_set x) - y; have := has_sup_floor_set x.
move/sup_adherent=> -/(_ e) []; first by rewrite subr_gt0.
move=> z Fz; rewrite /= subKr => lt_yz.
have /sup_upper_bound /ubP /(_ _ Fz) := has_sup_floor_set x.
rewrite -(lerD2r (-y)) => /le_lt_trans /(_ lt1_FxBy).
case/andP: Fy Fz lt_yz=> /RintP[yi -> _].
case/andP=> /RintP[zi -> _]; rewrite -rmorphB /= ltrz1 ltr_int.
rewrite lt_neqAle => /andP[ne_yz le_yz].
rewrite -[_-_]gez0_abs ?subr_ge0 // ltz_nat ltnS leqn0.
by rewrite absz_eq0 subr_eq0 eq_sym (negbTE ne_yz).
Qed.
Lemma isint_RfloorSource code xSource code : Rfloor x \is a Rint.
Lemma RfloorESource code xSource code : Rfloor x = (Num.floor x)%:~R.
Proof.
Lemma mem_rg1_floorSource code xSource code : (range1 (Num.floor x)%:~R) x.
Proof.
Lemma mem_rg1_RfloorSource code xSource code : (range1 (Rfloor x)) x.
Proof.
Lemma Rfloor_leSource code xSource code : Rfloor x <= x.
Proof.
Lemma lt_succ_RfloorSource code xSource code : x < Rfloor x + 1.
Proof.
Lemma range1z_injSource code xSource code i1Source code i2Source code : (range1 i1%:~R) x -> (range1 i2%:~R) x -> i1 = i2.
Proof.
Lemma range1rrSource code xSource code : (range1 x) x.
Lemma range1zPSource code iSource code xSource code : Rfloor x = i%:~R <-> (range1 i%:~R) x.
Proof.
Lemma Rfloor_natzSource code iSource code : Rfloor i%:~R = i%:~R :> R.
Lemma Rfloor0Source code : Rfloor 0 = 0 :> R
Lemma Rfloor1Source code : Rfloor 1 = 1 :> R
Lemma le_RfloorSource code : {homo (@Rfloor R) : xSource code ySource code / x <= y}.
Lemma Rfloor_ge_intSource code xSource code (iSource code : int) : (i%:~R <= x)= (i%:~R <= Rfloor x).
Proof.
Lemma Rfloor_lt_intSource code xSource code (iSource code : int) : (x < i%:~R) = (Rfloor x < i%:~R).
Proof.
Lemma Rfloor_le0Source code xSource code : x <= 0 -> Rfloor x <= 0.
Lemma Rfloor_lt0Source code xSource code : x < 0 -> Rfloor x < 0.
Proof.
Lemma ltr_add_invrUsed by
- mathcomp.analysis.probability_theory.random_variable
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.topology_theory.compact
- mathcomp.reals.real_interval
Source code ySource code xSource code : y < x -> exists kSource code, y + k.+1%:R^-1 < x.
Proof.
End FloorTheory.
Section CeilTheory.
Variable RSource code : realType.
Implicit Types x y : R.
Lemma isint_RceilSource code xSource code : Rceil x \is a Rint.
Lemma Rceil0Source code : Rceil 0 = 0 :> R.
Lemma Rceil_geSource code xSource code : x <= Rceil x.
Lemma le_RceilSource code : {homo (@Rceil R) : xSource code ySource code / x <= y}.
Lemma Rceil_ge0Source code xSource code : 0 <= x -> 0 <= Rceil x.
Lemma RceilESource code xSource code : Rceil x = (Num.ceil x)%:~R.
Proof.
End CeilTheory.
Section Sup.
Context {RSource code : realType}.
Implicit Types A B : set R.
Lemma le_downSource code ASource code : A `<=` down A.
Proof.
Lemma downKSource code ASource code : down (down A) = down A.
Proof.
Lemma has_sup_downSource code ASource code : has_sup (down A) <-> has_sup A.
Proof.
case: nzA => x /downP[y yS le_xy]; split; first by exists y.
case: nzubA=> u /ubP ubA; exists u; apply/ubP=> z zS.
by apply/ubA; apply/downP; exists z.
case: nzA => x xA; split; first by exists x; apply/le_down.
case: nzubA => u /ubP ubA; exists u; apply/ubP=> y /downP [].
by move=> z zA /le_trans; apply; apply/ubA.
Qed.
Lemma sup_leUsed by
- mathcomp.experimental_reals.realsum
Source code ASource code BSource code : A `<=` down B -> nonempty A -> has_sup B ->
sup A <= sup B.
Proof.
split=> //; case: hs_B => _ [x ubx].
exists x; apply/ubP=> y /le_AB /downP[z zB le_yz].
by apply/(le_trans le_yz); move/ubP: ubx; apply.
rewrite leNgt -subr_gt0; apply/negP => lt_sup.
case: (sup_adherent lt_sup hs_A )=> x /le_AB xdB.
rewrite subKr => lt_Bx; case/downP: xdB => z zB.
move/(lt_le_trans lt_Bx); rewrite ltNge.
by move/ubP : (sup_upper_bound hs_B) => ->.
Qed.
Lemma inf_leUsed by
- mathcomp.analysis.functional_analysis.hahn_banach_theorem
Source code ASource code BSource code : -%R @` B `<=` down (-%R @` A) -> nonempty B -> has_inf A ->
inf A <= inf B.
Proof.
Lemma supSUsed by
- mathcomp.analysis.real_measure.lebesgue_measure
- mathcomp.analysis.real_measure.lebesgue_stieltjes_measure
- mathcomp.analysis.realfun
- mathcomp.analysis.elementary_functions.trigonometry_functions
- mathcomp.analysis.ereal
- mathcomp.analysis.sequences
Source code ASource code BSource code : A !=set0 -> has_sup B -> A `<=` B -> sup A <= sup B.
Proof.
Lemma infSUsed by
- mathcomp.analysis.real_measure.lebesgue_stieltjes_measure
- mathcomp.analysis.normedtype_theory.tvs
Source code ASource code BSource code : has_inf A -> B !=set0 -> B `<=` A -> inf A <= inf B.
Proof.
[exact/nonemptyN|exact/has_inf_supN|exact/image_subset].
Qed.
Lemma le_supPSource code ASource code xSource code : has_sup A -> sup A <= x <-> ubound A x.
Proof.
Lemma gt_supSource code ASource code xSource code : has_sup A -> sup A < x -> forall ySource code, A y -> y < x.
Proof.
Lemma sup_downSource code ASource code : sup (down A) = sup A.
Proof.
Lemma lt_sup_imfsetUsed by
- mathcomp.experimental_reals.realsum
Source code {TSource code : Type} (FSource code : T -> R) lSource code :
has_sup [set ySource code | exists xSource code, y = F x] ->
l < sup [set ySource code | exists xSource code, y = F x] ->
exists2 xSource code, l < F x & F x <= sup [set ySource code | exists xSource code, y = F x].
Proof.
move=> /sup_adherent/(_ hs)[_ [x ->]]; rewrite subKr=> lt_lFx.
by exists x => //; move/ubP : (sup_upper_bound hs) => -> //; exists x.
Qed.
Lemma lt_inf_imfsetSource code {TSource code : Type} (FSource code : T -> R) lSource code :
has_inf [set ySource code | exists xSource code, y = F x] ->
inf [set ySource code | exists xSource code, y = F x] < l ->
exists2 xSource code, F x < l & inf [set ySource code | exists xSource code, y = F x] <= F x.
Proof.
move=> /inf_adherent/(_ hs)[_ [x ->]]; rewrite addrC subrK => ltFxl.
by exists x => //; rewrite (ge_inf hs.2)//; exists x.
Qed.
Proof.
Lemma inf_ge0Source code ASource code : (forall xSource code, A x -> 0 <= x) -> 0 <= inf A.
Proof.
Lemma has_sup_wpZlSource code ASource code (aSource code : R) : 0 <= a -> has_sup A ->
has_sup [set a * x | xSource code in A ].
Proof.
Lemma gt0_has_supZlSource code ASource code (aSource code : R) : 0 < a -> has_sup [set a * x | xSource code in A ] ->
has_sup A.
Proof.
by exists (b / a) => y Ay; rewrite ler_pdivlMr// mulrC ub//; exists y.
Qed.
Lemma ge0_supZlSource code ASource code (aSource code : R) : 0 <= a -> sup [set a * x | xSource code in A ] = a * sup A.
Proof.
have [->|A0] := eqVneq A set0; first by rewrite image_set0 sup0 mulr0.
suff -> : [set 0 * x | xSource code in A] = [set 0] by rewrite sup1 mul0r.
under eq_fun do rewrite mul0r.
by rewrite set_cst (negbTE A0).
have [->|A0] := eqVneq A set0; first by rewrite image_set0 sup0 mulr0.
have [[[x Ax] ubA]|not_ex_sup] := pselect (has_sup A); last first.
rewrite !sup_out ?mulr0//.
by apply: contra_not not_ex_sup; exact: gt0_has_supZl.
apply/eqP; rewrite eq_le; apply/andP; split.
apply: ge_sup; first by exists (a * x), x.
by move=> _ [x0 Axo <-]; rewrite ler_pM2l// ub_le_sup.
rewrite -ler_pdivlMl// ge_sup//; first exact/set0P.
move=> x0 Ax0; rewrite ler_pdivlMl// ub_le_sup//; last by exists x0.
have [x1 ubx1] := ubA.
by exists (a * x1) => _ [x2 Ax2 <-]; rewrite ler_pM2l// ubx1.
Qed.
Lemma ge0_infZlUsed by
- mathcomp.analysis.normedtype_theory.tvs
Source code ASource code (aSource code : R) : 0 <= a -> inf [set a * x | xSource code in A] = a * inf A.
Proof.
Lemma inf_posUsed by
- mathcomp.analysis.normedtype_theory.tvs
Source code : inf [set rSource code : R | 0 < r] = 0.
Proof.
Lemma has_sup_MnSource code ASource code nSource code : has_sup A -> has_sup [set x *+n | xSource code in A].
Proof.
Lemma sup_MnSource code ASource code nSource code : sup [set x *+n | xSource code in A ] = sup A *+ n.
Proof.
End Sup.
#[deprecated(since="mathcomp-analysis 1.14.0", note="Renamed `inf_le`.")]
Notation le_infSource code := inf_le (only parsing).
#[deprecated(since="mathcomp-analysis 1.14.0", note="Renamed `sup_le`.")]
Notation le_supSource code := sup_le (only parsing).
Lemma int_lbound_has_minimumSource code (BSource code : set int) iSource code : B !=set0 -> lbound B i ->
exists jSource code, B j /\ forall kSource code, B k -> j <= k.
Proof.
by exists `|i0 - i|%N; rewrite gez0_abs // subr_ge0; exact: lbBi.
elim: n i lbBi i0in => [i lbBi /eqP|n ih i lbBi i0in1].
by rewrite subr_eq0 => /eqP i0i; exists i0; split =>// k Bk; rewrite i0i lbBi.
have i0i1n : i0 - (i + 1) = n by rewrite opprD addrA i0in1 -addn1 PoszD addrK.
have [?|/not_forallP] := pselect (lbound B (i + 1)); first exact: (ih (i + 1)).
move=> /contrapT[x /not_implyP[Bx i1x]]; exists x; split => // k Bk.
rewrite (le_trans _ (lbBi _ Bk)) //.
by move/negP : i1x; rewrite -ltNge ltzD1.
Qed.
Lemma nat_has_minimumUsed by
- mathcomp.analysis.sequences
Source code (ASource code : set nat) : A !=set0 ->
exists jSource code, A j /\ forall kSource code, A k -> (j <= k)%N.
Proof.
pose B : set int := [set x%:~R | xSource code in A].
have B0 : B !=set0 by apply: image_nonempty.
have: lbound B 0 by move=> _ [b0 Bb0 <-]; rewrite ler0z.
move/(int_lbound_has_minimum B0) => [_ [[i Ai <-]]] Bi.
exists i; split=> // k Bk.
by have := Bi k%:~R; rewrite ler_int; apply; exists k.
Qed.
Section rat_in_itvoo.
Let bound_divSource code (RSource code : archiRealFieldType) (xSource code ySource code : R) : nat :=
if y < 0 then 0%N else Num.bound (y / x).
Let archi_bound_divPSource code (RSource code : archiRealFieldType) (xSource code ySource code : R) :
0 < x -> y < x *+ bound_div x y.
Proof.
rewrite /bound_div (ltNge y 0) y0/= -mulr_natl -ltr_pdivrMr//.
by rewrite archi_boundP// (divr_ge0 _(ltW _)).
Qed.
Lemma rat_in_itvooUsed by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.topology_theory.num_topology
- mathcomp.analysis.normedtype_theory.num_normedtype
- mathcomp.analysis.normedtype_theory.normed_module
Source code (RSource code : archiRealFieldType) (xSource code ySource code : R) :
x < y -> exists qSource code, ratr q \in `]x, y[.
Proof.
move=> /(archi_bound_divP 1); set n := bound_div _ _ => nyx.
have [m1 m1nx] : exists m1Source code, m1.+1%:~R > x *+ n.
have := archi_bound_divP (x *+ n) ltr01; set p := bound_div _ _ => nxp.
have [x0|x0] := ltP 0 x.
exists p.-1; rewrite prednK // lt0n; apply: contraPN nxp => /eqP ->.
by apply/negP; rewrite -leNgt mulrn_wge0 // ltW.
by exists 0%N; rewrite (le_lt_trans _ ltr01) // mulrn_wle0.
have [m2 m2nx] : exists m2Source code, m2.+1%:~R > - x *+ n.
have := archi_bound_divP (- x *+ n) ltr01; set p := bound_div _ _ => nxp.
have [x0|x0] := ltP 0 x.
by exists O; rewrite (le_lt_trans _ ltr01) // nmulrn_rle0// oppr_lt0.
exists p.-1; rewrite prednK // -(ltr_nat R) (le_lt_trans _ nxp) //.
by rewrite mulrn_wge0 // oppr_ge0.
have : exists mSource code, -(m2.+1 : int) <= m <= m1.+1 /\ m%:~R - 1 <= x *+ n < m%:~R.
have m2m1 : - (m2.+1 : int) < m1.+1.
by rewrite -(ltr_int R) (lt_trans _ m1nx)// rmorphN /= ltrNl // -mulNrn.
pose B := [set mSource code : int | m%:~R > x *+ n].
have m1B : B m1.+1 by [].
have m2B : lbound B (- m2.+1%:~R).
move=> i; rewrite /B /= -(opprK (x *+ n)) -ltrNl -mulNrn => nxi.
rewrite -(mulN1r m2.+1%:~R) mulN1r -lerNl.
by have := lt_trans nxi m2nx; rewrite intz -mulrNz ltr_int => /ltW.
have [m [Bm infB]] := int_lbound_has_minimum (ex_intro _ _ m1B) m2B.
have mN1B : ~ B (m - 1).
by move=> /infB; apply/negP; rewrite -ltNge ltrBlDr ltzD1.
exists m; (split; [apply/andP; split|apply/andP; split]) => //.
- by move: m2B; rewrite /lbound /= => /(_ _ Bm); rewrite intz.
- exact: infB.
- by rewrite leNgt; apply/negP; rewrite /B /= intrD in mN1B.
move=> [m [/andP[m2m mm1] /andP[mnx nxm]]].
have [/andP[a b] c] : x *+ n < m%:~R <= 1 + x *+ n /\ 1 + x *+ n < y *+ n.
(split; [apply/andP; split|]) => //; first by rewrite -lerBlDl.
by move: nyx; rewrite mulrnDl -ltrBrDr mulNrn.
have n_gt0 : n != 0%N by apply: contraTN nyx => /eqP ->; rewrite mulr0n ltr10.
exists (m%:Q / n%:Q); rewrite in_itv /= fmorph_div/= ratr_nat ratr_int.
rewrite ltr_pdivlMr ?ltr_pdivrMr ?ltr0n ?lt0n// !mulr_natr nxm/=.
apply: (le_lt_trans b c).
Qed.
End rat_in_itvoo.
Section rational.
Context {RSource code : realType}.
Definition rational
Rfloor : forall [R : realType], R -> R Rfloor is not universe polymorphic Arguments Rfloor [R] x%_ring_scope Rfloor is transparent Expands to: Constant mathcomp.reals.reals.Rfloor Declared in library mathcomp.reals.reals, line 242, characters 11-17 range1 : forall [R : realType], R -> set R range1 is not universe polymorphic Arguments range1 [R] x%_ring_scope _ range1 is transparent Expands to: Constant mathcomp.reals.reals.range1 Declared in library mathcomp.reals.reals, line 244, characters 11-17 Rceil : forall [R : realType], R -> R Rceil is not universe polymorphic Arguments Rceil [R] x%_ring_scope Rceil is transparent Expands to: Constant mathcomp.reals.reals.Rceil Declared in library mathcomp.reals.reals, line 246, characters 11-16
Used by
- mathcomp.analysis.pi_irrational
- mathcomp.analysis.borel_hierarchy
Source code : set R := ratr @` [set: rat].
Lemma rationalPUsed by
- mathcomp.analysis.pi_irrational
Source code (rSource code : R) :
rational r <-> exists (aSource code : int) (bSource code : nat), r = a%:~R / b%:R.
Proof.
Definition irrational
rational : forall {R : realType}, set R rational is not universe polymorphic Arguments rational {R} _ rational is transparent Expands to: Constant mathcomp.reals.reals.rational Declared in library mathcomp.reals.reals, line 872, characters 11-19
Used by
- mathcomp.analysis.borel_hierarchy
Source code : set R := ~` rational.
Lemma irrationalEUsed by
- mathcomp.analysis.borel_hierarchy
Source code : irrational = \bigcap_(qSource code : rat) ~` (ratr @` [set q]).
Proof.
by apply: (rE q Logic.I) => /=; exists q.
by apply: contra_not rE => -[_ -> <-{r}]; exists q.
Qed.
End rational.