Module mathcomp.analysis.numfun
From HB Require Import structures.From mathcomp Require Import boot order ssralg ssrnum ssrint interval.
From mathcomp Require Import interval_inference finmap.
#[warning="-warn-library-file-internal-analysis"]
From mathcomp Require Import unstable.
From mathcomp Require Import mathcomp_extra boolp classical_sets fsbigop.
From mathcomp Require Import functions cardinality set_interval reals ereal.
From mathcomp Require Import topology normedtype sequences.
Reserved Notation "{ 'nnfun' aT >-> T }"
(at level 0, format "{ 'nnfun' aT >-> T }").
Reserved Notation "[ 'nnfun' 'of' f ]"
(at level 0, format "[ 'nnfun' 'of' f ]").
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Import numFieldTopology.Exports.
Local Open Scope classical_set_scope.
Local Open Scope ring_scope.
Lemma
Source code
{in `[a, b] &, nondecreasing_fun f} <->
{in `[a, b] &, nonincreasing_fun (\- f)}.
Proof.
Lemma
Source code
{in `[a, b] &, nonincreasing_fun f} <->
{in `[a, b] &, nondecreasing_fun (\- f)}.
Proof.
Section interval_partition_porderType.
Context {} { : porderType d}.
Implicit Type (a b : T) (s : seq T).
a, b itv_partition : forall {d : Order.disp_t} {T : porderType d}, T -> T -> seq T -> Prop itv_partition is not universe polymorphic Arguments itv_partition {d T} a b s%_seq_scope itv_partition is transparent Expands to: Constant mathcomp.analysis.numfun.itv_partition Declared in library mathcomp.analysis.numfun, line 78, characters 11-24
Source code
Lemma
Source code
Proof.
Lemma
Source code
itv_partition a b (x :: s) -> itv_partition x b s.
Proof.
Lemma
Source code
Proof.
Lemma
Source code
(size s > 0)%N -> itv_partition a b s -> (a < b)%O.
Proof.
by rewrite andbT => -[ax /eqP <-].
move=> [] /andP[ax /andP[xy] ht /eqP tb].
by rewrite (lt_trans ax)// ih// /itv_partition /= xy/= tb.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
itv_partition a b s -> itv_partition b c t -> itv_partition a c (s ++ t).
Proof.
Lemma
Source code
Source code
nth def (a :: s) (size s) = b.
Proof.
Lemma
Source code
itv_partition a b s -> (a <= nth b (a :: s) m)%O.
Proof.
Lemma
Source code
itv_partition a b s -> (nth b (a :: s) m <= b)%O.
Proof.
by move=> [//|a h t /= nt] H; rewrite ih//; exact: itv_partition_cons H.
Qed.
Lemma
Source code
{in `[a, b] &, nondecreasing_fun f} -> itv_partition a b s ->
let : nat -> T := f \o nth b (a :: s) in
forall , (k < size s)%N -> (F k <= F k.+1)%O.
Proof.
have [_] := nondecreasing_seqP F; apply => m n mn; rewrite /F/=.
have [ms|ms] := ltnP m (size s).+1; last first.
rewrite nth_default//.
have [|ns] := ltnP n (size s).+1; last by rewrite nth_default.
by move=> /(leq_ltn_trans mn); rewrite ltnS leqNgt ms.
have [ns|ns] := ltnP n (size s).+1; last first.
rewrite [in leRHS]nth_default//=; apply/ndf/itv_partition_nth_le => //.
by rewrite in_itv/= itv_partition_nth_le// andbT itv_partition_nth_ge.
by rewrite in_itv/= lexx andbT; exact: (itv_partition_le abs).
move: abs; rewrite /itv_partition => -[] sa sab.
move: mn; rewrite leq_eqVlt => /predU1P[->//|mn].
apply/ndf/ltW/sorted_ltn_nth => //=; last exact: lt_trans.
by rewrite in_itv/= itv_partition_nth_le// andbT itv_partition_nth_ge.
by rewrite in_itv/= itv_partition_nth_le// andbT itv_partition_nth_ge.
Qed.
a, b and c, returns a partition of a, c itv_partitionL : forall {d : Order.disp_t} {T : porderType d}, seq T -> T -> seq T itv_partitionL is not universe polymorphic Arguments itv_partitionL {d T} s%_seq_scope c itv_partitionL is transparent Expands to: Constant mathcomp.analysis.numfun.itv_partitionL Declared in library mathcomp.analysis.numfun, line 164, characters 11-25
Source code
a, b and c, returns a partition of c, b itv_partitionR : forall {d : Order.disp_t} {T : porderType d}, seq T -> T -> seq T itv_partitionR is not universe polymorphic Arguments itv_partitionR {d T} s%_seq_scope c itv_partitionR is transparent Expands to: Constant mathcomp.analysis.numfun.itv_partitionR Declared in library mathcomp.analysis.numfun, line 167, characters 11-25
Source code
End interval_partition_porderType.
Section interval_partition_orderType.
Context {} { : orderType d}.
Implicit Type (a b : T) (s : seq T).
Lemma
Source code
itv_partition a c (itv_partitionL s c).
Proof.
rewrite /itv_partitionL rcons_path/=; apply/andP; split.
by apply: path_filter => //; exact: lt_trans.
exact: (last_filterP [pred | (x < c)%O]).
by rewrite /itv_partitionL last_rcons.
Qed.
Lemma
Source code
itv_partition c b (itv_partitionR s c).
Proof.
move: sa; rewrite lt_path_sortedE => /andP[allas ss].
rewrite lt_path_sortedE filter_all/=.
by apply: sorted_filter => //; exact: lt_trans.
exact/eqP/(path_lt_last_filter ac).
Qed.
Lemma
Source code
s = itv_partitionL s c ++ itv_partitionR s c.
Proof.
rewrite inE => /predU1P[->{c}/=|ct].
rewrite ltxx /itv_partitionL /= ltxx /itv_partitionR/= path_lt_filter0//=.
by rewrite path_lt_filterT.
rewrite /itv_partitionL/=; case: ifPn => [hc|].
by rewrite ltNge (ltW hc)/= /= [in LHS](ih _ _ ct)//; exact: path_sorted ht.
rewrite -leNgt le_eqVlt => /predU1P[ch|ch].
by rewrite ch ltxx path_lt_filter0//= /itv_partitionR path_lt_filterT.
move: ht; rewrite lt_path_sortedE => /andP[/allP/(_ _ ct)].
by move=> /lt_trans-/(_ _ ch); rewrite ltxx.
Qed.
Lemma
Source code
s = [seq <- s | (x < c)%O] ++ itv_partitionR s c.
Proof.
rewrite inE negb_or => /andP[]; rewrite neq_lt => /orP[ch|ch] ct.
rewrite ch ltNge (ltW ch)/= path_lt_filter0/= /itv_partitionR.
exact: path_lt_head ht.
by rewrite path_lt_filterT//; exact: path_lt_head ht.
by rewrite ch/= ltNge (ltW ch)/= -ih//; exact: path_sorted ht.
Qed.
End interval_partition_orderType.
Section interval_partition_numDomainType.
Context { : numDomainType}.
Implicit Type (a b : R) (s : seq R).
Lemma
Source code
{in `[a, b] &, nonincreasing_fun f} -> itv_partition a b s ->
let : nat -> R := f \o nth b (a :: s) in
forall , (k < size s)%N -> (F k.+1 <= F k)%O.
Proof.
exact: (nondecreasing_fun_itv_partition ndNf abs).
Qed.
Lemma
Source code
itv_partition (- b) (- a) (rev (belast (- a) (map -%R s))).
Proof.
End interval_partition_numDomainType.
Section variation_numDomainType.
Context { : numDomainType}.
Implicit Types (a b : R) (f g : R -> R).
Definition
variation : forall {R : numDomainType}, R -> R -> (R -> R) -> seq R -> {| Num.POrderZmodule.sort := R; Num.POrderZmodule.class := {| Num.POrderZmodule.choice_hasChoice_mixin := Num.NumDomain.class R; Num.POrderZmodule.eqtype_hasDecEq_mixin := Num.NumDomain.class R; Num.POrderZmodule.Order_isDuallyPreorder_mixin := Num.NumDomain.class R; Num.POrderZmodule.Order_Preorder_isDuallyPOrder_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasOpp_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasZero_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasAdd_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseZmoduleNmodule_isZmodule_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseAddUMagma_isAddUMagma_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseAddMagma_isAddMagma_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_AddMagma_isAddSemigroup_mixin := Num.NumDomain.class R |} |} variation is not universe polymorphic Arguments variation {R} (a b)%_ring_scope f%_function_scope s%_seq_scope variation is transparent Expands to: Constant mathcomp.analysis.numfun.variation Declared in library mathcomp.analysis.numfun, line 253, characters 11-20
Source code
\sum_(0 <= < size s) `|F n.+1 - F n|%R.
Lemma
Source code
variation a b f s = \sum_( <- zip s (a :: s)) `|f x.1 - f x.2|.
Proof.
by rewrite /itv_partition /= => -[_ /eqP <-]; rewrite /variation/= !big_nil.
rewrite /itv_partition /variation => -[]/= /andP[ah ht] /eqP htb.
rewrite big_nat_recl//= big_cons/=; congr +%R.
have /ih : itv_partition h b t by split => //; exact/eqP.
by rewrite /variation => ->; rewrite !big_seq; apply/eq_bigr => r rt.
Qed.
Lemma
Source code
variation a b f s = \sum_( <- s) `|f x - f (prev (locked (a :: s)) x)|.
Proof.
apply: eq_bigr => i /andP[_ si]; congr (`| _ - f _ |).
rewrite -lock.
rewrite prev_nth inE gt_eqF.
rewrite -[a]/(nth b (a :: s) 0) -[ltRHS]/(nth b (a :: s) i.+1).
exact: lt_sorted_ltn_nth.
rewrite orFb mem_nth// index_uniq//.
by apply: (sorted_uniq lt_trans) => //; apply: path_sorted sa.
by apply: set_nth_default => /=; rewrite ltnS ltnW.
Qed.
Lemma
Source code
variation a b f s =
\sum_( <- belast a s) `|f (next (locked (a :: s)) x) - f x|.
Proof.
rewrite size_belast; apply: eq_bigr => i /andP[_ si].
congr (`| f _ - f _ |); last first.
by rewrite lastI -cats1 nth_cat size_belast// si.
rewrite -lock next_nth.
rewrite {1}lastI mem_rcons inE mem_nth ?size_belast// orbT.
rewrite lastI -cats1 index_cat mem_nth ?size_belast//.
rewrite index_uniq ?size_belast//; last exact: set_nth_default.
have /lt_sorted_uniq : sorted <%R (a :: s) by [].
by rewrite lastI rcons_uniq => /andP[].
Qed.
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
variation a b (f \+ g)%R s <= variation a b f s + variation a b g s.
Proof.
Lemma
Source code
itv_partition a b s -> variation a b f s = f b - f a.
Proof.
transitivity (\sum_(0 <= < size s) (F n.+1 - F n)).
rewrite !big_nat; apply: eq_bigr => k; rewrite leq0n/= => ks.
by rewrite ger0_norm// subr_ge0; exact: nondecreasing_fun_itv_partition.
by rewrite telescope_sumr// /F/= (itv_partition_nth_size _ abs).
Qed.
Lemma
Source code
itv_partition a b s -> variation a b f s = f a - f b.
Proof.
by rewrite opprK addrC => <-; rewrite variationN.
Qed.
Lemma
Source code
itv_partition a c s -> itv_partition c b t ->
variation a b f (s ++ t) = variation a c f s + variation c b f t.
Proof.
by move=> /itv_partitionxx ->; rewrite variation_nil add0r.
rewrite le_eqVlt => /predU1P[<-{b}|cb].
by move=> ? /itv_partitionxx ->; rewrite variation_nil addr0 cats0.
move=> acs cbt; rewrite /variation /= [in LHS]/index_iota subn0 size_cat.
rewrite iotaD add0n big_cat/= -[in X in X + _ = _](subn0 (size s)); congr +%R.
rewrite -/(index_iota 0 (size s)) 2!big_nat.
apply: eq_bigr => k /[!leq0n] /= ks.
rewrite nth_cat ks -cat_cons nth_cat /= ltnS (ltnW ks).
by rewrite !(set_nth_default b c)//= ltnS ltnW.
rewrite -[in LHS](addnK (size s) (size t)).
rewrite -/(index_iota (size s) (size t + size s)).
rewrite -{1}[in LHS](add0n (size s)) big_addn addnK 2!big_nat; apply: eq_bigr.
move=> k /[!leq0n]/= kt.
rewrite nth_cat {1}(addnC k) -ltn_subRL subnn ltn0 addnK.
case: k kt => [t0 /=|k kt].
rewrite add0n -cat_cons nth_cat/= ltnS leqnn -last_nth.
by case: acs => _ /eqP ->.
rewrite addSnnS (addnC k) -cat_cons nth_cat/= -ltn_subRL subnn ltn0.
by rewrite -(addnC k) addnK.
Qed.
Lemma
Source code
Proof.
by rewrite variation_nil /variation/= big_nat_recl//= big_nil addr0.
rewrite /variation/= !big_nat_recl//= addrA lerD2r.
by rewrite -(subrKA (f x)) addrC ler_normD.
Qed.
Lemma
Source code
variation a b f s =
variation (- b) (- a) (f \o -%R) (rev (belast (- a) (map -%R s))).
Proof.
rewrite size_rev size_map size_belast 2!big_nat.
apply: eq_bigr => k; rewrite leq0n /= => ks.
rewrite nth_rev ?size_map ?size_belast// [in RHS]distrC.
rewrite (nth_map a).
by rewrite size_belast ltn_subLR// addSn ltnS leq_addl.
rewrite opprK -rev_rcons nth_rev ?size_rcons ?size_map ?size_belast 1?ltnW//.
rewrite subSn// -map_rcons (nth_map b) ?size_rcons ?size_belast.
by rewrite ltnS ltn_subLR// addSn ltnS leq_addl.
rewrite opprK nth_rcons size_belast -subSn// subSS.
rewrite (ltn_subLR _ (ltnW ks)) if_same.
case: k => [|k] in ks *.
rewrite add0n ltnn subn1 (_ : nth b s _ = b).
case: abl ks => _.
elim/last_ind : s => // h t _; rewrite last_rcons => /eqP -> _.
by rewrite nth_rcons size_rcons ltnn eqxx.
rewrite (_ : nth b (a :: s) _ = nth a (belast a s) (size s).-1)//.
case: abl ks => _.
elim/last_ind : s => // h t _; rewrite last_rcons => /eqP -> _.
rewrite belast_rcons size_rcons/= -rcons_cons nth_rcons/= ltnS leqnn.
exact: set_nth_default.
rewrite addSn ltnS leq_addl//; congr (`| f _ - f _ |).
elim/last_ind : s ks {abl} => // h t _; rewrite size_rcons ltnS => kh.
rewrite belast_rcons nth_rcons subSS ltn_subLR//.
by rewrite addSn ltnS leq_addl// subSn.
elim/last_ind : s ks {abl} => // h t _; rewrite size_rcons ltnS => kh.
rewrite belast_rcons subSS -rcons_cons nth_rcons /= ltn_subLR//.
rewrite addnS ltnS leq_addl; apply: set_nth_default => //.
by rewrite /= ltnS leq_subLR leq_addl.
Qed.
Lemma
Source code
variation a b f (rev (belast b (map -%R s))) =
variation (- b) (- a) (f \o -%R) s.
Proof.
End variation_numDomainType.
#[deprecated(since="mathcomp-analysis 1.12.0", note="use `variation_cat` instead")]
Notation
Source code
Section variation_realDomainType.
Context { : realDomainType}.
Implicit Types (a b : R) (f g : R -> R).
Lemma
Source code
itv_partition a b s ->
variation a b f s <= variation a b f (itv_partitionL s c ++ itv_partitionR s c).
Proof.
by rewrite -in_itv_partition//; case: abs => /path_sorted.
rewrite /itv_partitionL [in leLHS](notin_itv_partition _ cl)//.
by apply: path_sorted; case: abs => + _; exact.
rewrite -notin_itv_partition//.
by apply: path_sorted; case: abs => /= + _; exact.
rewrite !variation_zip//.
by apply: itv_partition_cat;
[exact: (itv_partitionLP _ bc)|exact: (itv_partitionRP ac)].
rewrite [in leLHS](notin_itv_partition _ cl).
by apply: path_sorted; case: abs => + _; exact.
set L := [seq <- s | x < c].
rewrite -cats1 -catA.
move: L => L.
set B := itv_partitionR s c.
move: B => B.
elim/last_ind : L => [|L0 L1 _].
rewrite !cat0s /=; case: B => [|B0 B1].
by rewrite big_nil big_cons/= big_nil addr0.
by rewrite !big_cons/= addrA lerD// -(subrKA (f c)) [leRHS]addrC ler_normD.
rewrite -cats1.
rewrite (_ : a :: _ ++ B = (a :: L0) ++ [:: L1] ++ B)//.
by rewrite -!catA -cat_cons.
rewrite zip_cat; first by rewrite cats1 size_rcons.
rewrite (_ : a :: _ ++ _ ++ B = (a :: L0) ++ [:: L1] ++ [:: c] ++ B).
by rewrite -!catA -cat_cons.
rewrite zip_cat; first by rewrite cats1 size_rcons.
rewrite !big_cat lerD//.
case: B => [|B0 B1].
by rewrite /= big_nil big_cons big_nil addr0.
rewrite -cat1s zip_cat// catA.
rewrite (_ : [:: L1] ++ _ ++ B1 = ([:: L1] ++ [:: c]) ++ [:: B0] ++ B1).
by rewrite catA.
rewrite zip_cat// !big_cat lerD//= !big_cons !big_nil !addr0/= [leRHS]addrC.
by rewrite (le_trans _ (ler_normD _ _))// subrKA.
Qed.
Lemma
Source code
itv_partition a b s -> itv_partition a b t ->
subseq s t ->
variation a b f s <= variation a b f t.
Proof.
by rewrite variation_nil // variation_ge0.
move=> /[dup] /itv_partition_cons itvxb /[dup] /itv_partition_le wb itvxt.
move=> /[dup] /itv_partition_cons itvas itvws /=.
have ab : a <= b by exact: (itv_partition_le itvas).
have wa : w < a by case: itvws => /= /andP[].
have waW : w <= a := ltW wa.
case: ifPn => [|] nXA.
move/eqP : nXA itvxt itvxb => -> itvat itvt /= ta.
rewrite -[_ :: t]cat1s -[_ :: s]cat1s.
rewrite ?(@variation_cat _ a)//; [exact: itv_partition1..|].
by rewrite lerD// IH.
move=> xts; rewrite -[_ :: s]cat1s (@variation_cat _ a) => //.
exact: itv_partition1.
have [y [s' s'E]] : exists , s = y :: s'.
by case: {itvas itvws IH} s xts => // y s' ?; exists y, s'.
apply: (@le_trans _ _ (variation w b f s)).
rewrite IH//.
case: itvws => /= /andP[_]; rewrite s'E /= => /andP[ay ys' lyb].
by split => //; rewrite (path_lt_head wa)//= ys' andbT.
by rewrite -variation_cat//; [exact: itv_partition1 | exact: le_variation].
Qed.
End variation_realDomainType.
Section bounded_variation.
Context { : numDomainType}.
Implicit Type (a b : R) (f : R -> R).
Definition
variations : forall {R : numDomainType}, R -> R -> (R -> R) -> set {| Num.POrderZmodule.sort := R; Num.POrderZmodule.class := {| Num.POrderZmodule.choice_hasChoice_mixin := Num.NumDomain.class R; Num.POrderZmodule.eqtype_hasDecEq_mixin := Num.NumDomain.class R; Num.POrderZmodule.Order_isDuallyPreorder_mixin := Num.NumDomain.class R; Num.POrderZmodule.Order_Preorder_isDuallyPOrder_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasOpp_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasZero_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_hasAdd_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseZmoduleNmodule_isZmodule_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseAddUMagma_isAddUMagma_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_BaseAddMagma_isAddMagma_mixin := Num.NumDomain.class R; Num.POrderZmodule.Algebra_AddMagma_isAddSemigroup_mixin := Num.NumDomain.class R |} |} variations is not universe polymorphic Arguments variations {R} (a b)%_ring_scope f%_function_scope _ variations is transparent Expands to: Constant mathcomp.analysis.numfun.variations Declared in library mathcomp.analysis.numfun, line 496, characters 11-21
Source code
Lemma
Source code
variations a b f (variation a b f s).
Proof.
Lemma
Source code
Lemma
Source code
Proof.
by rewrite variationN; exact: variations_variation.
by rewrite -variationN => <-; exact: variations_variation.
Qed.
Lemma
Source code
Proof.
Definition
bounded_variation : forall {R : numDomainType}, R -> R -> (R -> R) -> Prop bounded_variation is not universe polymorphic Arguments bounded_variation {R} (a b)%_ring_scope f%_function_scope bounded_variation is transparent Expands to: Constant mathcomp.analysis.numfun.bounded_variation Declared in library mathcomp.analysis.numfun, line 522, characters 11-28
Source code
Notation := bounded_variation.
Lemma
Source code
Proof.
Lemma
Source code
BV a b f -> BV a b g -> BV a b (f \+ g).
Proof.
apply: le_trans; first exact: variation_le.
rewrite lerD//.
- by apply: abfr; exact: variations_variation.
- by apply: abgs; exact: variations_variation.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
rewrite le_eqVlt => /predU1P[<-{b}//|cb].
move=> [x Hx]; exists x => _ [s acs] <-.
rewrite (@le_trans _ _ (variation a b f (rcons s b)))//; last first.
apply/Hx/variations_variation; case: acs => sa /eqP asc.
by rewrite /itv_partition rcons_path last_rcons sa/= asc.
rewrite {2}/variation size_rcons -[leLHS]addr0 big_nat_recr//= lerD//.
rewrite /variation !big_nat ler_sum// => k; rewrite leq0n /= => ks.
rewrite nth_rcons// ks -cats1 -cat_cons nth_cat /= ltnS (ltnW ks).
by rewrite //= ltnS ltnW.
Qed.
Lemma
Source code
Proof.
rewrite le_eqVlt => /predU1P[<-{b} ?|cb]; first exact: bounded_variationxx.
move=> [x Hx]; exists x => _ [s cbs] <-.
rewrite (@le_trans _ _ (variation a b f (c :: s)))//; last first.
apply/Hx/variations_variation; case: cbs => cs csb.
by rewrite /itv_partition/= ac/= cs.
by rewrite {2}/variation/= -[leLHS]add0r big_nat_recl//= lerD.
Qed.
Lemma
Source code
variations (- b) (- a) (f \o -%R) = variations a b f.
Proof.
eexists; last exact: variation_rev_opp.
by move/itv_partition_rev : bas; rewrite !opprK.
eexists; last by exact/esym/variation_opp_rev.
exact: itv_partition_rev abs.
Qed.
Lemma
Source code
{in `[a, b] &, {homo f : / x <= y}} -> BV a b f.
Proof.
by rewrite nondecreasing_variation// eqxx.
Qed.
End bounded_variation.
.
Source code
Source code
Source code
Source code
Source code
fun_ge0 : forall , (0 <= f x)%R
}.
.
Source code
Source code
Source code
Notation
Source code
Notation
Source code
#[global] Hint Extern 0 (is_true (0 <= _)) => solve [apply: fun_ge0] : core.
Section fimfun_bin.
Context ( : Type) ( : numDomainType).
Variables : {fimfun T >-> R}.
Lemma
Source code
Proof.
Source code
Source code
Source code
End fimfun_bin.
Reserved Notation "f ^\+" (at level 1, format "f ^\+").
Reserved Notation "f ^\-" (at level 1, format "f ^\-").
Section restrict_lemmas.
Context { : Type} { : numFieldType}.
Implicit Types (f g : aT -> rT) (D : set aT).
Lemma
Source code
Proof.
Lemma
Source code
(forall , D x -> 0 <= f x) -> forall , 0 <= (f \_ D) x.
Lemma
Source code
(forall , D x -> f x <= g x) -> forall , (f \_ D) x <= (g \_ D) x.
Lemma
Source code
End restrict_lemmas.
Lemma
Source code
(forall , D x -> (0 <= f x)%E) -> forall , (0 <= (f \_ D) x)%E.
Lemma
Source code
(forall , D x -> f x <= g x)%E -> forall , ((f \_ D) x <= (g \_ D) x)%E.
Lemma
Source code
(forall , E x -> 0 <= f x)%E ->
D `<=` E -> forall , ((f \_ D) x <= (f \_ E) x)%E.
Proof.
Section erestrict_lemmas.
Local Open Scope ereal_scope.
Variables ( : Type) ( : realDomainType) ( : set T).
Implicit Types (f g : T -> \bar R) (r : R).
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
(fun => k%:E * f x) \_ D = (fun => k%:E * (f \_ D) x).
End erestrict_lemmas.
Section funrposneg.
Local Open Scope ring_scope.
Definition
funrpos : forall [T : Type] [R : realDomainType], (T -> R) -> T -> R funrpos is not universe polymorphic Arguments funrpos [T]%_type_scope [R] f%_function_scope x funrpos is transparent Expands to: Constant mathcomp.analysis.numfun.funrpos Declared in library mathcomp.analysis.numfun, line 678, characters 11-18
Source code
fun => Num.max (f x) 0.
Definition
funrneg : forall [T : Type] [R : realDomainType], (T -> R) -> T -> join_Num_POrderZmodule_between_Algebra_BaseZmodule_and_Order_Preorder R funrneg is not universe polymorphic Arguments funrneg [T]%_type_scope [R] f%_function_scope x funrneg is transparent Expands to: Constant mathcomp.analysis.numfun.funrneg Declared in library mathcomp.analysis.numfun, line 680, characters 11-18
Source code
fun => Num.max (- f x) 0.
End funrposneg.
Notation
Source code
Notation
Source code
Section funrposneg_lemmas.
Local Open Scope ring_scope.
Variables ( : Type) ( : realDomainType) ( : set T).
Implicit Types (f g : T -> R) (r : R).
Lemma
Source code
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
(fun => r * f x)^\+ = (fun => r * (f^\+ x)).
Lemma
Source code
(fun => r * f x)^\- = (fun => r * (f^\- x)).
Lemma
Source code
(fun => r * f x)^\+ = (fun => - r * (f^\- x)).
Proof.
Lemma
Source code
(fun => r * f x)^\- = (fun => - r * (f^\+ x)).
Proof.
Lemma
Source code
Proof.
- rewrite ler0_norm// /funrpos /funrneg.
move/max_idPr : (fx0) => ->; rewrite add0r.
by move: fx0; rewrite -{1}oppr0 lerNr => /max_idPl ->.
- rewrite ger0_norm// /funrpos /funrneg; move/max_idPl : (fx0) => ->.
by move: fx0; rewrite -{1}oppr0 lerNl => /max_idPr ->; rewrite addr0.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
{in D, forall , f x <= g x} -> {in D, forall , f^\+ x <= g^\+ x}.
Proof.
Lemma
Source code
{in D, forall , f x <= g x} -> {in D, forall , g^\- x <= f^\- x}.
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Proof.
by apply/eq_funrpos=> y /=; rewrite mulrN.
Qed.
Lemma
Source code
(fun => (n x)%:R * f x)^\+ x = (n x)%:R * f^\+ x.
Lemma
Source code
(fun => (n x)%:R * f x)^\- x = (n x)%:R * f^\- x.
Proof.
Lemma
Source code
Proof.
End funrposneg_lemmas.
#[global]
Hint Extern 0 (is_true (0%R <= _ ^\+ _)%R) => solve [apply: funrpos_ge0] : core.
#[global]
Hint Extern 0 (is_true (0%R <= _ ^\- _)%R) => solve [apply: funrneg_ge0] : core.
funepos_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (f x) 0%R) funepos_unlock_subterm is not universe polymorphic funepos_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funepos_unlock_subterm Declared in library mathcomp.analysis.numfun, line 841, characters 0-95
Source code
funepos_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (f x) 0%R) funepos_unlock_subterm is not universe polymorphic funepos_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funepos_unlock_subterm Declared in library mathcomp.analysis.numfun, line 841, characters 0-95
Source code
funepos_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (f x) 0%R) funepos_unlock_subterm is not universe polymorphic funepos_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funepos_unlock_subterm Declared in library mathcomp.analysis.numfun, line 841, characters 0-95
Source code
funepos_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (f x) 0%R) funepos_unlock_subterm is not universe polymorphic funepos_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funepos_unlock_subterm Declared in library mathcomp.analysis.numfun, line 841, characters 0-95
Source code
funepos_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (f x) 0%R) funepos_unlock_subterm is not universe polymorphic funepos_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funepos_unlock_subterm Declared in library mathcomp.analysis.numfun, line 841, characters 0-95
Source code
fun => maxe (f x) 0.
funeneg_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (- f x)%E 0%R) funeneg_unlock_subterm is not universe polymorphic funeneg_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funeneg_unlock_subterm Declared in library mathcomp.analysis.numfun, line 844, characters 0-102
Source code
funeneg_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (- f x)%E 0%R) funeneg_unlock_subterm is not universe polymorphic funeneg_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funeneg_unlock_subterm Declared in library mathcomp.analysis.numfun, line 844, characters 0-102
Source code
funeneg_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (- f x)%E 0%R) funeneg_unlock_subterm is not universe polymorphic funeneg_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funeneg_unlock_subterm Declared in library mathcomp.analysis.numfun, line 844, characters 0-102
Source code
funeneg_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (- f x)%E 0%R) funeneg_unlock_subterm is not universe polymorphic funeneg_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funeneg_unlock_subterm Declared in library mathcomp.analysis.numfun, line 844, characters 0-102
Source code
funeneg_unlock_subterm : unlockable (fun (T : Type) (R : realDomainType) (f : T -> \bar R) (x : T) => Order.Def.max (- f x)%E 0%R) funeneg_unlock_subterm is not universe polymorphic funeneg_unlock_subterm is transparent Expands to: Constant mathcomp.analysis.numfun.funeneg_unlock_subterm Declared in library mathcomp.analysis.numfun, line 844, characters 0-102
Source code
fun => maxe (oppe (f x)) 0.
Notation
Source code
Notation
Source code
Section funposneg_lemmas.
Local Open Scope ereal_scope.
Variables ( : Type) ( : realDomainType) ( : set T).
Implicit Types (f g : T -> \bar R) (h : U -> T) (r : R).
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
(fun => r%:E * f x)^\+ = (fun => r%:E * (f^\+ x)).
Lemma
Source code
(fun => r%:E * f x)^\- = (fun => r%:E * (f^\- x)).
Lemma
Source code
(fun => r%:E * f x)^\+ = (fun => - r%:E * (f^\- x)).
Proof.
Lemma
Source code
(fun => r%:E * f x)^\- = (fun => - r%:E * (f^\+ x)).
Proof.
Lemma
Source code
Proof.
- rewrite lee0_abs// funeposE funenegE.
move/max_idPr : (fx0) => ->; rewrite add0e.
by move: fx0; rewrite -{1}oppe0 leeNr => /max_idPl ->.
- rewrite gee0_abs// funeposE funenegE; move/max_idPl : (fx0) => ->.
by move: fx0; rewrite -{1}oppe0 leeNl => /max_idPr ->; rewrite adde0.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
#[deprecated(since="mathcomp-analysis 1.15.0", note="use `funeposBneg` instead")]
Lemma
Source code
Proof.
Lemma
Source code
Proof.
by rewrite -[in RHS](funeposBneg f) -[in RHS](funeposBneg g).
Qed.
Lemma
Source code
{in D, forall , f x <= g x} -> {in D, forall , f^\+ x <= g^\+ x}.
Proof.
Lemma
Source code
{in D, forall , f x <= g x} -> {in D, forall , g^\- x <= f^\- x}.
Proof.
Lemma
Source code
Lemma
Source code
End funposneg_lemmas.
#[deprecated(since="mathcomp-analysis 1.15.0", note="use `-funeDB` instead")]
Notation
Source code
#[global]
Hint Extern 0 (is_true (0%R <= _ ^\+ _)%E) => solve [apply: funepos_ge0] : core.
#[global]
Hint Extern 0 (is_true (0%R <= _ ^\- _)%E) => solve [apply: funeneg_ge0] : core.
Section funrpos_funepos_lemmas.
Context { : Type} { : realDomainType}.
Lemma
Source code
Lemma
Source code
End funrpos_funepos_lemmas.
Definition
indic : forall {T : Type} {R : pzRingType}, set T -> T -> R indic is not universe polymorphic Arguments indic {T}%_type_scope {R} A%_classical_set_scope x indic is transparent Expands to: Constant mathcomp.analysis.numfun.indic Declared in library mathcomp.analysis.numfun, line 1013, characters 11-16
Source code
Reserved Notation "'\1_' A" (at level 8, A at level 2, format "'\1_' A") .
Notation
Source code
Lemma
Source code
Itv.spec (@Itv.num_sem R) (Itv.Real `[0, 1]%Z) (indic A x).
Proof.
Canonical
indic_inum : forall {T : Type} {R : numDomainType}, set T -> T -> {i01 R} indic_inum is not universe polymorphic Arguments indic_inum {T}%_type_scope {R} A%_classical_set_scope x indic_inum is transparent Expands to: Constant mathcomp.analysis.numfun.indic_inum Declared in library mathcomp.analysis.numfun, line 1025, characters 10-20
Source code
Itv.mk (@num_spec_indic T R A x).
Section indic_ringType.
Context ( : Type) ( : pzRingType).
Implicit Types A D : set T.
Lemma
Source code
Proof.
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
Lemma
Source code
\1_D @` A = (if A `\` D != set0 then [set 0] else set0) `|`
(if A `&` D != set0 then [set 1 : R] else set0).
Proof.
by rewrite /indic; case: (boolP (t \in D)); rewrite ?(inE, notin_setE) => Dt;
[right|left]; rewrite ifT//=; apply/set0P; exists t.
by move=> []; case: ifPn; rewrite ?negbK// => /set0P[t [At Dt]] ->;
exists t => //; case: (boolP (t \in D)); rewrite ?(inE, notin_setE).
Qed.
Lemma
Source code
\1_D @^-1` B = if 1 \in B then (if 0 \in B then setT else D)
else (if 0 \in B then ~` D else set0).
Proof.
case: ifPn => B1; case: ifPn => B0 //=.
- have [|] := boolP (x \in D); first by rewrite inE.
by rewrite notin_setE in B0.
- have [|] := boolP (x \in D); last by rewrite notin_setE.
by rewrite notin_setE in B1.
- by have [xD|xD] := boolP (x \in D);
[rewrite notin_setE in B1|rewrite notin_setE in B0].
- by have [xD|xD] := boolP (x \in D); [rewrite inE in B1|rewrite inE in B0].
- have [xD|] := boolP (x \in D); last by rewrite notin_setE.
by rewrite inE in B1.
- have [|xD] := boolP (x \in D); first by rewrite inE.
by rewrite inE in B0.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
f x = \sum_( \in range f) (y * \1_(f @^-1` [set y]) x).
Proof.
Lemma
Source code
( := fset_set (f @` setT)) :
forall , f x = \sum_( < #|`s|) (s`_i * \1_(f @^-1` [set s`_i]) x).
Proof.
End indic_ringType.
Lemma
Source code
trivIset [set: nat] A ->
(\1_(\bigcup_ A n) t)%:E = (\sum_(0 <= <oo) (\1_(A n) t)%:E)%E :> \bar R.
Proof.
have [At|At] := eqVneq (\1_(\bigcup_ A n) t) (1%R : R).
- move: (At) => /eqP; rewrite pnatr_eq1 eqb1 => /asboolP[i _] Ait.
rewrite At (@nneseriesD1 _ _ i)//.
rewrite indicE mem_set// eseries0 ?adde0// => j _/= ji.
rewrite indicE memNset// => Ajt.
move/trivIsetP : tA => /(_ j i Logic.I Logic.I ji).
by apply/eqP/set0P; exists t.
- have {}At : \1_(\bigcup_ A n) t = 0%R :> R.
by apply/eqP; move: At; rewrite pnatr_eq1 eqb1 pnatr_eq0 eqb0.
move: (At) => /eqP; rewrite pnatr_eq0 eqb0 notin_setE => AtC.
rewrite At eseries0// => j _ _.
by rewrite indicE memNset// => Ajt; apply: AtC; exists j.
Qed.
Lemma
Source code
f \_ D = (f \* \1_D)%R.
Proof.
Lemma
Source code
(f \_ D = f \* (EFin \o \1_D))%E.
Proof.
Lemma
Source code
xsection A x = (fun => (\1_A (x, y) : R)) @^-1` [set 1].
Proof.
Lemma
Source code
ysection A y = (fun => (\1_A (x, y) : R)) @^-1` [set 1].
Proof.
Lemma
Source code
[bounded \1_A x : R^o | in A].
Lemma
Source code
\1_A = (1 : T -> R) \_ A.
Lemma
Source code
((\1_E : T -> R) \_ A) = \1_(E `&` A).
Proof.
Lemma
Source code
x \in (ball 0 k : set R^o) ->
\1_(ball 0 k : set R^o) y @[ --> x] --> (\1_(ball 0 k) x : R).
Proof.
rewrite !indicE xB/= mem_set//=; last by rewrite subrr normr0// ltW.
near: t.
rewrite inE /ball /= sub0r normrN in xB.
exists ((k - `|x|)/2) => /=; first by rewrite divr_gt0// subr_gt0.
rewrite /ball_/= => z /= h; rewrite /ball/= sub0r normrN.
rewrite -(subrK x z) (le_lt_trans (ler_normD _ _))//.
rewrite -ltrBrDr distrC (lt_le_trans h)//.
by rewrite ler_pdivrMr//= ler_pMr// ?subr_gt0// ler1n.
Unshelve. all: by end_near. Qed.
Section ring.
Context ( : Type) ( : pzRingType).
Lemma
Source code
Proof.
by move=> fA gA; exact: (finite_image11 (fun => x * y)).
Qed.
.
Source code
Source code
Source code
.
Source code
Source code
Source code
Implicit Types f g : {fimfun aT >-> rT}.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
Lemma
Source code
(\sum_( <- r | P i) f i) x = \sum_( <- r | P i) f i x.
Proof.
Lemma
Source code
Lemma
Source code
Proof.
.
Source code
Source code
Source code
Definition
indic_fimfun : forall {aT : Type} {rT : pzRingType}, set aT -> {fimfun aT >-> rT} indic_fimfun is not universe polymorphic Arguments indic_fimfun {aT}%_type_scope {rT} X%_classical_set_scope indic_fimfun is transparent Expands to: Constant mathcomp.analysis.numfun.indic_fimfun Declared in library mathcomp.analysis.numfun, line 1222, characters 11-23
Source code
.
Source code
Source code
Source code
Definition
scale_fimfun : forall [aT : Type] [rT : pzRingType], rT -> {fimfun aT >-> rT} -> {fimfun aT >-> rT} scale_fimfun is not universe polymorphic Arguments scale_fimfun [aT]%_type_scope [rT] k%_ring_scope f scale_fimfun is transparent Expands to: Constant mathcomp.analysis.numfun.scale_fimfun Declared in library mathcomp.analysis.numfun, line 1226, characters 11-23
Source code
End ring.
Arguments indic_fimfun {aT rT} _.
Notation
Source code
(GRing.SubPzRing_isSubComPzRing.Build _ _ U)
(format "[ 'SubPzRing_isSubComPzRing' 'of' U 'by' <: ]")
: form_scope.
Section comring.
Context ( : Type) ( : comPzRingType).
.
Source code
Source code
[SubPzRing_isSubComPzRing of {fimfun aT >-> rT} by <:].
Implicit Types (f g : {fimfun aT >-> rT}).
.
Source code
Source code
Source code
End comring.
.
Source code
Source code
Source code
Source code
Source code
{ fimfunE : exists ( : seq R) ( : R -> set T),
forall , f x = \sum_( <- r) (y * \1_(A_ y) x) }.
.
Source code
Source code
Source code
Lemma
Source code
Proof.
suff -> : f = \sum_( <- r) cst_fimfun y * indic_fimfun (A_ y) by [].
by apply/funext=> x; rewrite fE fimfun_sum.
Qed.
Source code
Source code
Source code
.
Source code
Section Tietze.
Context { : topologicalType} { : realType}.
Hypothesis
Source code
Lemma
Source code
closed A -> closed B -> A `&` B = set0 -> x < y ->
exists : X -> R, [/\ continuous f,
f @` A `<=` [set x], f @` B `<=` [set y] & range f `<=` `[x, y]].
Proof.
have /(@uniform_separatorP _ R)[f [cf f01 f0 f1]] := urysohn_ext R _ _ cA cB A0.
pose g : X -> R := line_path x y \o f; exists g; split; rewrite /g /=.
move=> t; apply: continuous_comp; first exact: cf.
apply: (@continuousD R R^o).
apply: continuousM; last exact: cst_continuous.
by apply: (@continuousB _ R^o) => //; exact: cst_continuous.
by apply: continuousM => //; exact: cst_continuous.
- by rewrite -image_comp => z /= [? /f0 -> <-]; rewrite line_path0.
- by rewrite -image_comp => z /= [? /f1 -> <-]; rewrite line_path1.
- rewrite -image_comp; apply: (subset_trans (image_subset _ f01)).
by rewrite range_line_path.
Qed.
Context ( : set X).
Hypothesis
Source code
Local Lemma
Source code
0 < M -> {within A, continuous f} ->
(forall , A x -> `|f x| <= M) ->
exists : X -> R, [/\ continuous g,
(forall , A x -> `|f x - g x| <= 2/3 * M) &
(forall , `|g x| <= 1/3 * M)].
Proof.
have [] := @urysohn_ext_itv (A `&` f @^-1` `]-oo, -(1/3) * M%:num])
(A `&` f @^-1` `[1/3 * M%:num,+oo[) (-(1/3) * M%:num) (1/3 * M%:num).
- by rewrite closed_setSI//; exact: preimage_closed.
- by rewrite closed_setSI//; apply: preimage_closed => //; exact: interval_closed.
- rewrite setIACA -preimage_setI eqEsubset; split => z // [_ []].
rewrite !set_itvE/= => /[swap] /le_trans /[apply].
by rewrite leNgt mulNr gtrN// mulr_gt0// divr_gt0.
- by rewrite mulNr gtrN// mulr_gt0//.
move=> g [ctsg gL3 gR3 grng]; exists g; split => //; first last.
by move=> x; rewrite ler_norml -mulNr; apply: grng; exists x.
move=> x Ax; have := fA1 _ Ax; rewrite 2!ler_norml => /andP[Mfx fxM].
have [xL|xL] := leP (f x) (-(1/3) * M%:num).
have: [set g x | in A `&` f@^-1` `]-oo, -(1/3) * M%:num]] (g x) by exists x.
move/gL3=> ->; rewrite !mulNr opprK; apply/andP; split.
by rewrite -lerBlDr -opprD -2!mulrDl natr1 divff// mul1r.
rewrite -lerBrDr -2!mulrBl -(@natrB _ 2 1)// (le_trans xL)//.
by rewrite ler_pM2r// ltW// gtrN// divr_gt0.
have [xR|xR] := lerP (1/3 * M%:num) (f x).
have : [set g x | in A `&` f@^-1` `[1/3 * M%:num, +oo[] (g x).
by exists x => //; split => //; rewrite /= in_itv //= xR.
move/gR3 => ->; apply/andP; split.
rewrite lerBrDl -2!mulrBl (le_trans _ xR)// ler_pM2r//.
by rewrite ler_wpM2r ?invr_ge0 ?ler0n// lerBlDl natr1 ler1n.
by rewrite lerBlDl -2!mulrDl nat1r divff ?mul1r.
have /andP[ng3 pg3] : -(1/3) * M%:num <= g x <= 1/3 * M%:num.
by apply: grng; exists x.
rewrite ?(intrD _ 1 1) !mulrDl; apply/andP; split.
by rewrite opprD lerB// -mulNr ltW.
by rewrite (lerD (ltW _))// lerNl -mulNr.
Qed.
Let
Source code
{ : X -> R^o | {within A, continuous f} -> 0 < M ->
(forall , A x -> `|f x| <= M) -> [/\ continuous g,
forall , A x -> `|f x - g x| <= 2/3 * M :>R
& forall , `|g x| <= 1/3 * M ]}.
Proof.
Let
Source code
Source code
0 < M -> {within A, continuous f} -> (forall , A x -> `|f x| <= M) ->
exists , [/\ {in A, f =1 g}, continuous g & forall , `|g x| <= M].
Proof.
have MN0 n : 0 < M2d3 n by rewrite /M2d3 /geometric /mk_sequence.
pose f_ := fix F :=
if n is n.+1 then F n - projT1 (tietze_step (F n) (M2d3 n)) else f.
pose g_ := projT1 (tietze_step (f_ n) (M2d3 n)).
have fgE n : f_ n - f_ n.+1 = g_ n by rewrite /= opprB addrC subrK.
have twothirds1 : `|2/3| < 1 :> R.
by rewrite gtr0_norm//= ltr_pdivrMr// mul1r ltr_nat.
have f_geo n : {within A, continuous f_ n} /\
(forall , A x -> `|f_ n x| <= geometric M%:num (2/3) n).
elim: n => [|n [ctsN bdN]]; first by split=> //= x ?; rewrite expr0 mulr1 fbd.
have [cg bdNS bd2] := projT2 (tietze_step (f_ n) _) ctsN (MN0 n) bdN.
split=> [x|]; first by apply: cvgB; [exact:ctsN|exact/continuous_subspaceT/cg].
by move=> x Ax; rewrite (le_trans (bdNS _ Ax))// /M2d3/= mulrCA -exprS.
have g_cts n : continuous (g_ n).
by have [? ?] := f_geo n; case: (projT2 (tietze_step (f_ n) _) _ (MN0 n)).
have g_bd n : forall , `|g_ n x| <= geometric ((1/3) * M%:num) (2/3) n.
have [ctsN bdfN] := f_geo n; rewrite /geometric /= -[_ * M%:num * _]mulrA.
by have [_ _] := projT2 (tietze_step (f_ n) _) ctsN (MN0 n) bdfN.
pose h_ : nat -> arrow_uniform_type X R^o := @series {uniform X -> _} g_.
have cvgh' : cvg (h_ @ \oo).
apply/cauchy_cvgP/cauchy_ballP => eps epos; near_simpl.
suff : \forall & \near \oo, (x' <= x)%N -> ball (h_ x) eps (h_ x').
move=>/[dup]; rewrite {1}near_swap; apply: filter_app2; near=> n m.
by have /orP[mn /(_ mn)/ball_sym + _| ? _] := leq_total n m; apply.
near=> n m; move=> /= MN; rewrite /ball /= /h_ => t; rewrite /ball /=.
rewrite -[X in `|X|]/((series g_ n - series g_ m) t) sub_series MN fct_sumE.
rewrite (le_lt_trans (ler_norm_sum _ _ _))//.
rewrite (le_lt_trans (ler_sum _ (fun _ => g_bd i t)))// -mulr_sumr.
rewrite -(subnKC MN) geometric_partial_tail.
pose L := (1/3) * M%:num * ((2/3) ^+ m / (1 - (2/3))).
apply: (@le_lt_trans _ _ L); first by rewrite ler_pM2l // geometric_le_lim.
rewrite /L onem_twothirds.
rewrite [_ ^+ _ * _ ^-1]mulrC mulrA -[x in x < _]ger0_norm; first by [].
near: m; near_simpl; move: eps epos.
by apply: (cvgr0_norm_lt (fun _ => _ : R^o)); exact: cvg_geometric.
have cvgh : {uniform, h_ @ \oo --> lim (h_ @ \oo)}.
by move=> ?; rewrite /= uniform_nbhsT; exact: cvgh'.
exists (lim (h_ @ \oo)); split.
- move=> t /set_mem At; have /pointwise_cvgP/(_ t)/(cvg_lim (@Rhausdorff _)) :=
[elaborate pointwise_uniform_cvg _ cvgh].
rewrite -fmap_comp /comp /h_ => <-; apply/esym/(@cvg_lim _ (@Rhausdorff R)).
apply: (@cvg_zero R R^o); apply: norm_cvg0; under eq_fun => n.
rewrite distrC /series /cst /= -mulN1r fct_sumE mulr_sumr.
under [fun _ : nat => _]eq_fun => ? do rewrite mulN1r -fgE opprB.
rewrite telescope_sumr //= subrKC.
over.
apply/norm_cvg0P/cvgr0Pnorm_lt => eps epos.
have /(_ _ epos) := @cvgr0_norm_lt R _ _ _ eventually_filter (_ : nat -> R^o)
(cvg_geometric M%:num twothirds1).
apply: filter_app; near_simpl; apply: nearW => n /le_lt_trans; apply.
by rewrite (le_trans ((f_geo n).2 _ _)) // ler_norm.
- apply: (@uniform_limit_continuous X _ (h_ @ \oo) (lim (h_ @ \oo))) =>//.
near_simpl; apply: nearW; elim.
by rewrite /h_ /series /= big_geq// => ?; exact: cst_continuous.
move=> n; rewrite /h_ /series /= big_nat_recr /= // => IH t.
by apply: continuousD; [exact: IH|exact: g_cts].
- move=> t.
have /pointwise_cvgP/(_ t)/(cvg_lim (@Rhausdorff _)) :=
[elaborate pointwise_uniform_cvg _ cvgh].
rewrite -fmap_comp /comp /h_ => <-.
under [fun _ : nat => _]eq_fun => ? do rewrite /series /= fct_sumE.
have cvg_gt : cvgn [normed series (g_^~ t)].
apply: (series_le_cvg _ _ (g_bd ^~ t) (is_cvg_geometric_series _)) => //.
by move=> n; rewrite mulr_ge0.
rewrite (le_trans (lim_series_norm _))//; apply: le_trans.
exact/(lim_series_le cvg_gt _ (g_bd ^~ t))/is_cvg_geometric_series.
rewrite (cvg_lim _ (cvg_geometric_series _))//; first exact: Rhausdorff.
by rewrite onem_twothirds mulrAC divff mul1r.
Unshelve. all: by end_near. Qed.
End Tietze.