Module mathcomp.analysis.exp
From mathcomp Require Import boot order ssralg ssrint ssrnum matrix.From mathcomp Require Import interval rat interval_inference.
#[warning="-warn-library-file-internal-analysis"]
From mathcomp Require Import unstable.
From mathcomp Require Import boolp classical_sets functions.
From mathcomp Require Import reals convex ereal topology tvs normedtype landau.
From mathcomp Require Import sequences derive realfun.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Import numFieldNormedType.Exports.
Local Open Scope classical_set_scope.
Local Open Scope ring_scope.
Reserved Notation "x '`^?' ( r +? s )"
(format "x '`^?' ( r +? s )", r at next level, at level 11) .
Lemma normr_nnegSource code (RSource code : numDomainType) (xSource code : R) : `|x| \is Num.nneg.
Proof.
solve [apply: normr_nneg] : core.
Section PseriesDiff.
Context {RSource code : realType}.
Definition pseries
pseries : forall {R : realType}, (nat -> R) -> R -> (join_GRing_PzRing_between_GRing_PzSemiRing_and_Algebra_Zmodule R) ^nat pseries is not universe polymorphic Arguments pseries {R} f%_function_scope x%_ring_scope _ pseries is transparent Expands to: Constant mathcomp.analysis.exp.pseries Declared in library mathcomp.analysis.exp, line 60, characters 11-18
Used by
- mathcomp.analysis.probability_theory.poisson_distribution
- mathcomp.analysis.elementary_functions.trigonometry_functions
Source code fSource code (xSource code : R) := [series f i * x ^+ i]_iSource code.
Fact is_cvg_pseries_inside_normSource code fSource code (xSource code zSource code : R) :
cvgn (pseries f x) -> `|z| < `|x| ->
cvgn (pseries (fun iSource code => `|f i|) z).
Proof.
have Kzxn n : 0 <= `|K + 1| * `|z ^+ n| / `|x ^+ n| by rewrite !mulr_ge0.
apply: normed_cvg.
apply: series_squeeze_is_cvgn Kzxn _ _ => [//=| /= n|].
rewrite (_ : `|_ * _| = `|f n * x ^+ n| * `|z ^+ n| / `|x ^+ n|).
rewrite !normrM normr_id mulrAC mulfK // normr_eq0 expf_eq0 andbC.
by case: ltrgt0P zLx; rewrite //= normr_lt0.
do! (apply: ler_pM || apply: mulr_ge0 || rewrite invr_ge0) => //.
by apply Kf => //; rewrite (lt_le_trans _ (ler_norm _))// ltrDl.
have F : `|z / x| < 1.
by rewrite normrM normfV ltr_pdivrMr ?mul1r // (le_lt_trans _ zLx).
rewrite (_ : (fun _ => _) = geometric `|K + 1| `|z / x|).
by apply/funext => i /=; rewrite normrM exprMn mulrA normfV !normrX exprVn.
by apply: is_cvg_geometric_series; rewrite normr_id.
Qed.
Fact is_cvg_pseries_insideSource code fSource code (xSource code zSource code : R) :
cvgn (pseries f x) -> `|z| < `|x| -> cvgn (pseries f z).
Proof.
apply: normed_cvg; rewrite /normed_series_of /=.
rewrite (_ : (fun _ => _) = (fun iSource code => `|f i| * `|z| ^+ i)).
by apply/funext => i; rewrite normrM normrX.
by apply: is_cvg_pseries_inside_norm Cx _; rewrite normr_id.
Qed.
Definition pseries_diffs
pseries_diffs : forall {R : realType}, (nat -> R) -> nat -> R pseries_diffs is not universe polymorphic Arguments pseries_diffs {R} f%_function_scope i%_nat_scope pseries_diffs is transparent Expands to: Constant mathcomp.analysis.exp.pseries_diffs Declared in library mathcomp.analysis.exp, line 92, characters 11-24
Used by
- mathcomp.analysis.elementary_functions.trigonometry_functions
Source code (fSource code : nat -> R) iSource code := i.+1%:R * f i.+1.
Lemma pseries_diffsNUsed by
- mathcomp.analysis.elementary_functions.trigonometry_functions
Source code (fSource code : nat -> R) : pseries_diffs (- f) = -(pseries_diffs f).
Proof.
Lemma pseries_diffs_inv_factSource code :
pseries_diffs (fun nSource code => (n`!%:R)^-1) = (fun nSource code => (n`!%:R)^-1 : R).
Lemma pseries_diffs_sumESource code nSource code fSource code xSource code :
\sum_(0 <= iSource code < n) pseries_diffs f i * x ^+ i =
(\sum_(0 <= iSource code < n) i%:R * f i * x ^+ i.-1) + n%:R * f n * x ^+ n.-1.
Proof.
under eq_bigr do unfold pseries_diffs.
by rewrite big_nat_recr //= big_nat_recl //= !mul0r add0r.
Qed.
Lemma pseries_diffs_equivSource code fSource code xSource code :
let sSource code iSource code := i%:R * f i * x ^+ i.-1 in
cvgn (pseries (pseries_diffs f) x) ->
series s @ \oo --> limn (pseries (pseries_diffs f) x).
Proof.
rewrite /pseries/= [X in X @ \oo --> _]/series /=.
rewrite [X in X @ \oo --> _](_ : _ = (fun nSource code => \sum_(0 <= iSource code < n)
pseries_diffs f i * x ^+ i - n%:R * f n * x ^+ n.-1)).
by rewrite funeqE => n; rewrite pseries_diffs_sumE addrK.
by apply: cvgB => //; rewrite -cvg_shiftS; exact: cvg_series_cvg_0.
Qed.
Lemma is_cvg_pseries_diffs_equivSource code fSource code xSource code :
cvgn (pseries (pseries_diffs f) x) ->
cvgn ([series i%:R * f i * x ^+ i.-1]_iSource code).
Proof.
Let pseries_diffs_P1Source code mSource code (zSource code hSource code : R) :
\sum_(0 <= iSource code < m) ((h + z) ^+ (m - i) * z ^+ i - z ^+ m) =
\sum_(0 <= iSource code < m) z ^+ i * ((h + z) ^+ (m - i) - z ^+ (m - i)).
Proof.
Let pseries_diffs_P2Source code nSource code (zSource code hSource code : R) :
h != 0 ->
((h + z) ^+ n - (z ^+ n)) / h - n%:R * z ^+ n.-1 =
h * \sum_(0 <= iSource code < n.-1) z ^+ i *
\sum_(0 <= jSource code < n.-1 - i) (h + z) ^+ j * z ^+ (n.-2 - i - j).
Proof.
rewrite mulrBr mulrC divfK //.
case: n => [|n]; first by rewrite !expr0 !(mul0r, mulr0, subrr, big_geq).
rewrite subrXX addrK -mulrBr; congr (_ * _).
rewrite -(big_mkord xpredT (fun iSource code => (h + z) ^+ (n - i) * z ^+ i)).
rewrite big_nat_recr //= subnn expr0 -addrA -mulrBl -nat1r opprD addNKr mulNr.
rewrite mulr_natl -[in X in _ *+ X](subn0 n) -sumr_const_nat -sumrB.
rewrite pseries_diffs_P1 mulr_sumr !big_mkord; apply: eq_bigr => i _.
rewrite mulrCA; congr (_ * _).
rewrite subrXX addrK big_nat_rev /= big_mkord; congr (_ * _).
by apply: eq_bigr => k _; rewrite -!predn_sub subKn // -subnS.
Qed.
Let pseries_diffs_P3Source code (zSource code hSource code : R) nSource code KSource code :
h != 0 -> `|z| <= K -> `|h + z| <= K ->
`|((h +z) ^+ n - z ^+ n) / h - n%:R * z ^+ n.-1|
<= n%:R * n.-1%:R * K ^+ n.-2 * `|h|.
Proof.
rewrite pseries_diffs_P2// normrM mulrC.
rewrite ler_pM2r ?normr_gt0//.
rewrite (le_trans (ler_norm_sum _ _ _))//.
rewrite -mulrA mulrC -mulrA mulr_natl -[X in _ *+ X]subn0 -sumr_const_nat.
apply ler_sum_nat => i /=.
case: n => //= n ni.
rewrite normrM.
pose d := (n.-1 - i)%N.
rewrite -[(n - i)%N]prednK ?subn_gt0// predn_sub -/d.
rewrite -(subnK (_ : i <= n.-1)%N) -/d.
by rewrite -ltnS prednK// (leq_ltn_trans _ ni).
rewrite addnC exprD mulrAC -mulrA.
apply: ler_pM => //.
by rewrite normrX lerXn2r// qualifE/= (le_trans _ zLK).
apply: le_trans (_ : d.+1%:R * K ^+ d <= _); last first.
rewrite ler_wpM2r //; first by rewrite exprn_ge0 // (le_trans _ zLK).
by rewrite ler_nat ltnS /d -subn1 -subnDA leq_subr.
rewrite (le_trans (ler_norm_sum _ _ _))//.
rewrite mulr_natl -[X in _ *+ X]subn0 -sumr_const_nat ler_sum_nat//= => j jd1.
rewrite -[in leRHS](subnK (_ : j <= d)%N) -1?ltnS // addnC exprD normrM.
by rewrite ler_pM// normrX lerXn2r// qualifE/= (le_trans _ zLK).
Qed.
Lemma pseries_snd_diffsUsed by
- mathcomp.analysis.elementary_functions.trigonometry_functions
Source code (cSource code : R^nat) KSource code xSource code :
cvgn (pseries c K) ->
cvgn (pseries (pseries_diffs c) K) ->
cvgn (pseries (pseries_diffs (pseries_diffs c)) K) ->
`|x| < `|K| ->
is_derive x (1 : R)
(fun xSource code => limn (pseries c x))
(limn (pseries (pseries_diffs c) x)).
Proof.
set s := (fun nSource code : nat => _); set (f := fun x0Source code => _).
suff hfxs : h^-1 *: (f (h + x) - f x) @[hSource code --> 0^'] --> limn (series s).
have F : f^`() x = limn (series s) by apply: cvg_lim hfxs.
have Df : derivable f x 1.
move: hfxs; rewrite /derivable [X in X @ 0^'](_ : _ =
(fun hSource code => h^-1 *: (f (h%:A + x) - f x))) /=.
by apply/funext => i //=; rewrite [i%:A]mulr1.
by move=> /(cvg_lim _) -> //.
by constructor; [exact: Df|rewrite -derive1E].
pose sx := fun nSource code : nat => c n * x ^+ n.
have Csx : cvgn (pseries c x) by apply: is_cvg_pseries_inside Ck _.
pose shx := fun hSource code (nSource code : nat) => c n * (h + x) ^+ n.
suff Cc : limn (h^-1 *: (series (shx h - sx))) @[hSource code --> 0^'] --> limn (series s).
apply: cvg_sub0 Cc.
apply/cvgrPdist_lt => eps eps_gt0 /=.
near=> h; rewrite sub0r normrN /=.
rewrite (le_lt_trans _ eps_gt0)//.
rewrite normr_le0 subr_eq0 -/sx -/(shx _); apply/eqP.
suff Cshx' : cvgn (series (shx h)).
rewrite limZl_tmp; first exact/is_cvg_seriesB/Csx.
by rewrite lim_seriesB; [|exact: Csx|].
apply: is_cvg_pseries_inside Ck _.
rewrite (le_lt_trans (ler_normD _ _))// -(subrK `|x| `|K|) ltrD2r.
near: h.
apply/nbhs_ballP => /=; exists ((`|K| - `|x|) /2%:R) => /=.
by rewrite divr_gt0 // subr_gt0.
move=> t; rewrite /ball /= sub0r normrN => H tNZ.
rewrite (lt_le_trans H)// ler_pdivrMr // mulr2n mulrDr mulr1.
by rewrite ler_wpDr // subr_ge0 ltW.
apply: cvg_zero => /=.
suff Cc : limn
(series (fun nSource code => c n * (((h + x) ^+ n - x ^+ n) / h - n%:R * x ^+ n.-1)))
@[hSource code --> 0^'] --> 0.
apply: cvg_sub0 Cc.
apply/cvgrPdist_lt => eps eps_gt0 /=.
near=> h; rewrite sub0r normrN /=.
rewrite (le_lt_trans _ eps_gt0)// normr_le0 subr_eq0; apply/eqP.
have Cs : cvgn (series s) by apply: is_cvg_pseries_inside CdK _.
have Cs1 := is_cvg_pseries_diffs_equiv Cs.
have Fs1 := pseries_diffs_equiv Cs.
set s1 := (fun iSource code => _) in Cs1.
have Cshx : cvgn (series (shx h)).
apply: is_cvg_pseries_inside Ck _.
rewrite (le_lt_trans (ler_normD _ _))// -(subrK `|x| `|K|) ltrD2r.
near: h.
apply/nbhs_ballP => /=; exists ((`|K| - `|x|) / 2%:R) => /=.
by rewrite divr_gt0 // subr_gt0.
move=> t; rewrite /ball /= sub0r normrN => H tNZ.
rewrite (lt_le_trans H)// ler_pdivrMr // mulr2n mulrDr mulr1.
by rewrite ler_wpDr // subr_ge0 ltW.
have C1 := is_cvg_seriesB Cshx Csx.
have Ckf := @is_cvg_seriesZ _ _ h^-1 C1.
have Cu : (series (h^-1 *: (shx h - sx)) - series s1) x0 @[x0Source code --> \oo] -->
limn (series (h^-1 *: (shx h - sx))) - limn (series s).
exact: cvgB Ckf Fs1.
set w := (fun nSource code : nat => _ in RHS).
have -> : w = h^-1 *: (shx h - sx) - s1.
apply: funext => i; rewrite !fctE.
rewrite /w /shx /sx /s1 /= mulrBr; congr (_ - _); last first.
by rewrite mulrCA !mulrA.
by rewrite -mulrBr [RHS]mulrCA [_^-1 * _]mulrC.
rewrite [X in X h = _]/+%R /= [X in _ + X h = _]/-%R /=.
have -> : series (h^-1 *: (shx h - sx) - s1) =
series (h^-1 *: (shx h - sx)) - (series s1).
by apply/funext => i; rewrite /series /= sumrB.
have -> : h^-1 *: series (shx h - sx) = series (h^-1 *: (shx h - sx)).
by apply/funext => i; rewrite /series /= -scaler_sumr.
exact/esym/cvg_lim.
pose r := (`|x| + `|K|) / 2.
have xLr : `|x| < r by rewrite ltr_pdivlMr // mulrDr mulr1 ltrD2l.
have rLx : r < `|K| by rewrite ltr_pdivrMr // mulrDr mulr1 ltrD2r.
have r_gt0 : 0 < r by apply: le_lt_trans xLr.
have rNZ : r != 0by case: ltrgt0P r_gt0.
apply: (@lim_cvg_to_0_linear _
(fun nSource code => `|c n| * n%:R * (n.-1)%:R * r ^+ n.-2)
(fun hSource code nSource code => c n * (((h + x) ^+ n - x ^+ n) / h - n%:R * x ^+ n.-1))
(r - `|x|)); first by rewrite subr_gt0.
- have : cvgn ([series `|pseries_diffs (pseries_diffs c) n| * r ^+ n]_nSource code).
apply: is_cvg_pseries_inside_norm CddK _.
by rewrite ger0_norm // ltW // (le_lt_trans _ xLr).
have -> : (fun nSource code => `|pseries_diffs (pseries_diffs c) n| * r ^+ n) =
(fun nSource code => pseries_diffs (pseries_diffs
(fun mSource code => `|c m|)) n * r ^+ n).
apply/funext => i.
by rewrite /pseries_diffs !normrM !mulrA ger0_norm // ger0_norm.
move=> /is_cvg_pseries_diffs_equiv.
rewrite /pseries_diffs.
have -> : (fun nSource code => n%:R * ((n.+1)%:R * `|c n.+1|) * r ^+ n.-1) =
(fun nSource code => pseries_diffs
(fun mSource code => (m.-1)%:R * `|c m| * r^-1) n * r ^+ n).
apply/funext => n.
rewrite /pseries_diffs /= mulrA.
case: n => [|n /=]; first by rewrite !(mul0r, mulr0).
by rewrite [_%:R *_]mulrC !mulrA -[RHS]mulrA exprS mulKf.
move/is_cvg_pseries_diffs_equiv.
have ->// : (fun nSource code => n%:R * (n.-1%:R * `|c n| / r) * r ^+ n.-1) =
(fun nSource code => `|c n| * n%:R * n.-1%:R * r ^+ n.-2).
apply/funext => [] [|[|i]]; rewrite ?(mul0r, mulr0) //=.
rewrite mulrA -mulrA exprS mulKf// !mulrA; congr (_ * _).
by rewrite mulrC mulrA.
- move=> h /andP[h_gt0 hLrBx] n.
rewrite normrM -!mulrA ler_wpM2l //.
rewrite (le_trans (pseries_diffs_P3 _ _ (ltW xLr) _))// ?mulrA -?normr_gt0//.
by rewrite (le_trans (ler_normD _ _))// -(subrK `|x| r) lerD2r ltW.
Unshelve. all: by end_near.
Qed.
End PseriesDiff.
Section expR.
Context {RSource code : realType}.
Implicit Types x : R.
Lemma expR0Used by
- mathcomp.analysis.probability_theory.exponential_distribution
- mathcomp.analysis.probability_theory.normal_distribution
- mathcomp.analysis.gauss_integral
Source code : expR 0 = 1 :> R.
Proof.
near=> m; rewrite -[m]prednK; first by near: m.
rewrite -addn1 series_addn series_exp_coeff0 big_add1 big1 ?addr0//.
by move=> i _; rewrite /exp_coeff /= expr0n mul0r.
Unshelve. all: by end_near. Qed.
Lemma expR_ge1DxnSource code xSource code nSource code : 0 <= x -> 1 + x ^+ n.+1 / n.+1`!%:R <= expR x.
Proof.
pose f nSource code (xSource code : R) iSource code := (i == 0)%:R + x ^+ n / n`!%:R *+ (i == n).
have F m : (n.+1 < m)%N ->
\sum_(0 <= iSource code < m) (f n.+1 x i) = 1 + x ^+ n.+1 / n.+1`!%:R.
move=> n1m.
rewrite (@big_cat_nat _ _ _ n.+2)//= big_nat_recr// big_nat_recl//=.
rewrite big_nat_cond big1 ?addr0.
by move=> i /[!andbT] /[!leq0n]/= ni; rewrite /f/= lt_eqF//= add0r.
rewrite big_nat_cond big1 ?addr0.
move=> i /[!andbT] /andP[ni mi]; rewrite /f !gtn_eqF//= ?add0r//.
exact: ltn_trans ni.
by rewrite /f/= add0r mulr0n addr0 eqxx 2!mulr1n.
rewrite [leLHS](_ : _ = limn (series (f n.+1 x))).
by apply/esym/(@lim_near_cst R^o) => //; near=> k; apply: F; near: k.
apply: ler_lim; first by apply: is_cvg_near_cst; near=> k; apply: F; near: k.
exact: is_cvg_series_exp_coeff.
near=> k; apply: ler_sum => -[|[|i]] _; rewrite /f /exp_coeff/= ?add0r.
- by rewrite !(mulr0n, expr0, addr0, divr1).
- case: n F; first by rewrite !(mulr0n, mulr1n, expr0, addr0, add0r, divr1).
by move=> n F; rewrite mulr0n expr1 divr1.
- rewrite eqSS; case: eqP => [->|_]; rewrite ?mulr1n//.
by rewrite mulr0n divr_ge0// exprn_ge0.
Unshelve. all: by end_near. Qed.
Lemma exp_coeffESource code xSource code : exp_coeff x = fun nSource code => (fun nSource code => (n`!%:R)^-1) n * x ^+ n.
Import GRing.Theory.
Local Open Scope ring_scope.
Lemma expREUsed by
- mathcomp.analysis.probability_theory.poisson_distribution
Source code :
expR = fun xSource code => limn (pseries (fun nSource code => (fun nSource code => (n`!%:R)^-1) n) x).
Proof.
Global Instance is_derive_expRSource code xSource code : is_derive x 1 expR (expR x).
Proof.
rewrite expRE /= /pseries (_ : (fun _ => _) = s1).
by apply/funext => i; rewrite /s1 pseries_diffs_inv_fact.
apply: (@pseries_snd_diffs _ _ (`|x| + 1)); rewrite /pseries.
- by rewrite -exp_coeffE; apply: is_cvg_series_exp_coeff.
- rewrite (_ : (fun _ => _) = exp_coeff (`|x| + 1)).
by apply/funext => i; rewrite pseries_diffs_inv_fact exp_coeffE.
exact: is_cvg_series_exp_coeff.
- rewrite (_ : (fun _ => _) = exp_coeff (`|x| + 1)).
by apply/funext => i; rewrite !pseries_diffs_inv_fact exp_coeffE.
exact: is_cvg_series_exp_coeff.
by rewrite [ltRHS]ger0_norm// addrC -subr_gt0 addrK.
Qed.
Lemma derivable_expRSource code xSource code : derivable expR x 1.
Proof.
Lemma derive_expRUsed by
- mathcomp.analysis.probability_theory.exponential_distribution
- mathcomp.analysis.gauss_integral
Source code : 'D_1 expR = expR :> (R -> R).
Proof.
Lemma continuous_expRUsed by
- mathcomp.analysis.probability_theory.exponential_distribution
- mathcomp.analysis.probability_theory.normal_distribution
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.gauss_integral
Source code : continuous (@expR R).
Proof.
Lemma expRxDyMexpxSource code xSource code ySource code : expR (x + y) * expR (- x) = expR y.
Proof.
Lemma expRxMexpNx_1Source code xSource code : expR x * expR (- x) = 1.
Proof.
Lemma pexpR_gt1Source code xSource code : 0 < x -> 1 < expR x.
Proof.
Lemma expR_gt0Used by
- mathcomp.analysis.probability_theory.poisson_distribution
- mathcomp.analysis.probability_theory.random_variable
- mathcomp.analysis.probability_theory.normal_distribution
Source code xSource code : 0 < expR x.
Proof.
Lemma expR_ge0Used by
- mathcomp.analysis.probability_theory.exponential_distribution
- mathcomp.analysis.probability_theory.random_variable
- mathcomp.analysis.probability_theory.normal_distribution
- mathcomp.analysis.gauss_integral
Source code xSource code : 0 <= expR x
Lemma norm_expRSource code : Num.norm \o expR = (expR : R -> R).
Lemma expR_eq0Source code xSource code : (expR x == 0) = false.
Lemma expRNUsed by
- mathcomp.analysis.probability_theory.poisson_distribution
- mathcomp.analysis.probability_theory.random_variable
Source code xSource code : expR (- x) = (expR x)^-1.
Proof.
Lemma expRDUsed by
- mathcomp.analysis.probability_theory.normal_distribution
- mathcomp.analysis.gauss_integral
Source code xSource code ySource code : expR (x + y) = expR x * expR y.
Proof.
Lemma expR_sumSource code TSource code sSource code (PSource code : pred T) (fSource code : T -> R) :
expR (\sum_(iSource code <- s | P i) f i) = \prod_(iSource code <- s | P i) expR (f i).
Lemma expRM_natlSource code nSource code xSource code : expR (n%:R * x) = expR x ^+ n.
Proof.
Lemma expRM_natrSource code nSource code xSource code : expR (x * n%:R) = expR x ^+ n.
Proof.
Lemma expR_gt1Source code xSource code : (1 < expR x) = (0 < x).
Proof.
Lemma expR_lt1Source code xSource code : (expR x < 1) = (x < 0).
Proof.
Lemma expR_le1Source code xSource code : (expR x <= 1) = (x <= 0).
Proof.
Lemma expRBSource code xSource code ySource code : expR (x - y) = expR x / expR y.
Lemma ltr_expRSource code : {mono (@expR R) : xSource code ySource code / x < y}.
Proof.
Lemma ler_expRUsed by
- mathcomp.analysis.probability_theory.random_variable
- mathcomp.analysis.probability_theory.normal_distribution
- mathcomp.analysis.gauss_integral
Source code : {mono (@expR R) : xSource code ySource code / x <= y}.
Proof.
Lemma expR_gt1DxSource code xSource code : x != 0 -> 1 + x < expR x.
Proof.
- have [?|_] := leP x (-1).
by rewrite (@le_lt_trans _ _ 0) ?expR_gt0// -lerBrDl sub0r.
have [] := @MVT R expR expR _ _ x0 (fun xSource code _ => is_derive_expR x).
exact/continuous_subspaceT/continuous_expR.
move=> c; rewrite in_itv/= => /andP[xc c0].
rewrite expR0 sub0r => /eqP; rewrite subr_eq addrC -subr_eq => /eqP <-.
by rewrite mulrN opprK ltrD2l ltr_nMl// -expR0 ltr_expR.
- have [] := @MVT R expR expR _ _ x0 (fun xSource code _ => is_derive_expR x).
exact/continuous_subspaceT/continuous_expR.
move=> c; rewrite in_itv/= => /andP[c0 cx].
rewrite subr0 expR0 => /eqP /[!subr_eq] /eqP ->.
by rewrite addrC ltrD2r ltr_pMl// -expR0 ltr_expR.
Qed.
Lemma expR_ge1DxSource code xSource code : 1 + x <= expR x.
Proof.
Lemma cvgr_expRUsed by
- mathcomp.analysis.probability_theory.exponential_distribution
- mathcomp.analysis.gauss_integral
Source code : @expR R (- x) @[xSource code --> +oo] --> 0.
Proof.
Lemma cvgn_expRSource code : @expR R (- n%:R) @[nSource code --> \oo] --> 0%R.
Proof.
Lemma cvgy_expRSource code : @expR R @ +oo --> +oo.
Proof.
Lemma cvgNy_expRSource code : @expR R @ -oo --> 0.
Proof.
Lemma expR_injSource code : injective (@expR R).
Proof.
Lemma expR_total_gt1Source code xSource code :
1 <= x -> exists ySource code, [/\ 0 <= y, 1 + y <= x & expR y = x].
Proof.
have [x1 x1Ix| |x1 _ /eqP] := @IVT _ (fun ySource code => expR y - x) _ _ 0 x_ge0.
- apply: continuousB => // y1; last exact: cst_continuous.
by apply/continuous_subspaceT=> ?; exact: continuous_expR.
- rewrite expR0; have [_| |] := ltrgtP (1 - x) (expR x - x).
+ by rewrite subr_le0 x_ge1 subr_ge0 (le_trans _ (expR_ge1Dx _)) ?lerDr.
+ by rewrite ltrD2r expR_lt1 ltNge x_ge0.
+ rewrite subr_le0 x_ge1 => -> /=; rewrite subr_ge0.
by rewrite (le_trans _ (expR_ge1Dx _)) ?lerDr.
- rewrite subr_eq0 => /eqP x1_x; exists x1; split => //.
+ by rewrite -ler_expR expR0 x1_x.
+ by rewrite -x1_x expR_ge1Dx // -ler_expR x1_x expR0.
Qed.
Lemma expR_totalSource code xSource code : 0 < x -> exists ySource code, expR y = x.
Proof.
by exists y.
have /expR_total_gt1[y [H1y H2y H3y]] : 1 <= x^-1 by rewrite ltW // !invf_cp1.
by exists (-y); rewrite expRN H3y invrK.
Qed.
Local Open Scope convex_scope.
Lemma convex_expRSource code (tSource code : {i01 R}) (aSource code bSource code : R^o) :
expR (a <| t |> b) <= (expR a : R^o) <| t |> (expR b : R^o).
Proof.
- apply: second_derivative_convex => //.
+ by move=> x axb; rewrite derive_expR derive_val expR_ge0.
+ exact/cvg_at_left_filter/continuous_expR.
+ exact/cvg_at_right_filter/continuous_expR.
+ by move=> z zab; rewrite derive_expR; exact: derivable_expR.
- rewrite convC [leRHS]convC; apply: second_derivative_convex => //.
+ by move=> x axb; rewrite derive_expR derive_val expR_ge0.
+ exact/cvg_at_left_filter/continuous_expR.
+ exact/cvg_at_right_filter/continuous_expR.
+ by move=> z zab; rewrite derive_expR; exact: derivable_expR.
Qed.
Definition expR_itv_boundl
expR_itv_boundl : itv_bound int -> interval_itv_bound__canonical__Order_Preorder ssrint_int__canonical__Order_POrder expR_itv_boundl is not universe polymorphic Arguments expR_itv_boundl b expR_itv_boundl is transparent Expands to: Constant mathcomp.analysis.exp.expR_itv_boundl Declared in library mathcomp.analysis.exp, line 578, characters 11-26
Source code bSource code :=
Order.max (BRight 0%Z) (IntItv.add_boundl b (BLeft 1)).
Definition expR_itv_boundr
expR_itv_boundr : itv_bound int -> itv_bound int expR_itv_boundr is not universe polymorphic Arguments expR_itv_boundr b expR_itv_boundr is transparent Expands to: Constant mathcomp.analysis.exp.expR_itv_boundr Declared in library mathcomp.analysis.exp, line 581, characters 11-26
Source code bSource code :=
match b with
| BSide _ (Negz _) => BLeft 1%Z
| BSide b 0%Z => BSide b 1%Z
| _ => +oo%O
end.
Definition expR_itv
expR_itv : Itv.t -> Itv.t expR_itv is not universe polymorphic Arguments expR_itv i expR_itv is transparent Expands to: Constant mathcomp.analysis.exp.expR_itv Declared in library mathcomp.analysis.exp, line 588, characters 11-19
Source code iSource code :=
match i with
| Itv.Top => Itv.Real `[0%Z, +oo[
| Itv.Real (Interval l u) =>
Itv.Real (Interval (expR_itv_boundl l) (expR_itv_boundr u))
end.
Lemma num_spec_expRSource code (iSource code : Itv.t) (xSource code : Itv.def (@Itv.num_sem R) i)
(rSource code := expR_itv i) :
Itv.spec (@Itv.num_sem R) r (expR x%:num).
Proof.
by apply/and3P; rewrite ?num_real// bnd_simp expR_ge0.
case: x => [x /=/and3P[xr lx xu]]; apply/and3P; split; [exact: num_real| | ].
- rewrite Instances.num_itv_bound_max maxEge.
case: ifP; rewrite ?bnd_simp ?expR_gt0// => _.
apply: le_trans (Instances.num_itv_add_boundl lx _) _; first exact: lexx.
by rewrite bnd_simp addrC expR_ge1Dx.
- case: u xu => [[] [[|//] | u] |//]; rewrite !bnd_simp.
+ by rewrite expR_lt1.
+ by rewrite expR_lt1 => /lt_trans; apply.
+ by rewrite expR_le1.
+ by rewrite expR_lt1 => /le_lt_trans; apply.
Qed.
Canonical expR_inum
expR_inum : forall {R : realType} [i : Itv.t], Itv.def (Itv.num_sem (R:=R)) i -> Itv.def (Itv.num_sem (R:=R)) (expR_itv i) expR_inum is not universe polymorphic Arguments expR_inum {R} [i] x expR_inum is transparent Expands to: Constant mathcomp.analysis.exp.expR_inum Declared in library mathcomp.analysis.exp, line 613, characters 10-19
Source code (iSource code : Itv.t) (xSource code : Itv.def (@Itv.num_sem R) i) :=
Itv.mk (num_spec_expR x).
End expR.
Section expeR.
Context {RSource code : realType}.
Implicit Types (x y : \bar R) (r s : R).
Local Open Scope ereal_scope.
Definition expeR
expeR : forall {R : realType}, \bar R -> \bar R expeR is not universe polymorphic Arguments expeR {R} x%_ereal_scope expeR is transparent Expands to: Constant mathcomp.analysis.exp.expeR Declared in library mathcomp.analysis.exp, line 624, characters 11-16
Source code xSource code :=
match x with | r%:E => (expR r)%:E | +oo => +oo | -oo => 0 end.
Lemma expeR0Source code : expeR 0 = 1
Proof.
Lemma expeR_ge0Source code xSource code : 0 <= expeR x.
Lemma expeR_gt0Source code xSource code : -oo < x -> 0 < expeR x.
Lemma expeR_eq0Source code xSource code : (expeR x == 0) = (x == -oo).
Lemma expeR_eqySource code xSource code : (expeR x == +oo) = (x == +oo).
Proof.
Lemma expeRDSource code xSource code ySource code : expeR (x + y) = expeR x * expeR y.
Proof.
Lemma expeR_ge1DxSource code xSource code : 1 + x <= expeR x.
Proof.
Lemma lte_expeRSource code : {mono expeR : xSource code ySource code / x < y}.
Proof.
Lemma lee_expeRSource code : {mono expeR : xSource code ySource code / x <= y}.
Proof.
Lemma expeR_injSource code : injective expeR.
Proof.
Lemma expeR_totalSource code xSource code : 0 <= x -> exists ySource code, expeR y = x.
Proof.
End expeR.
#[deprecated(since="mathcomp-analysis 1.13.0", note="renamed `lte_expeR`")]
Notation ltr_expeRSource code := lte_expeR (only parsing).
#[deprecated(since="mathcomp-analysis 1.13.0", note="renamed `lee_expeR`")]
Notation ler_expeRSource code := lee_expeR (only parsing).
Section Ln.
Context {RSource code : realType}.
Implicit Types x : R.
Notation expSource code := (@expR R).
Definition ln
ln : forall {R : realType}, R -> R ln is not universe polymorphic Arguments ln {R} x%_ring_scope ln is transparent Expands to: Constant mathcomp.analysis.exp.ln Declared in library mathcomp.analysis.exp, line 701, characters 11-13
Used by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis_stdlib.Rstruct_topology
Source code xSource code : R := [get ySource code | exp y == x ].
Fact ln0Used by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis_stdlib.Rstruct_topology
Source code xSource code : x <= 0 -> ln x = 0.
Proof.
Lemma expRKUsed by
- mathcomp.analysis_stdlib.Rstruct_topology
Source code : cancel exp ln.
Lemma lnKSource code : {in Num.pos, cancel ln exp}.
Proof.
Lemma lnK_eqSource code xSource code : (exp (ln x) == x) = (0 < x).
Lemma ln1Source code : ln 1 = 0.
Lemma lnMSource code : {in Num.pos &, {morph ln : xSource code ySource code / x * y >-> x + y}}.
Proof.
Lemma ln_injSource code : {in Num.pos &, injective ln}.
Lemma lnVSource code : {in Num.pos, {morph ln : xSource code / x ^-1 >-> - x}}.
Proof.
Lemma ln_divSource code : {in Num.pos &, {morph ln : xSource code ySource code / x / y >-> x - y}}.
Lemma ltr_lnSource code : {in Num.pos &, {mono ln : xSource code ySource code / x < y}}.
Lemma ler_lnSource code : {in Num.pos &, {mono ln : xSource code ySource code / x <= y}}.
Lemma lnXnSource code nSource code xSource code : 0 < x -> ln (x ^+ n) = ln x *+ n.
Proof.
Lemma le_ln1DxSource code xSource code : -1 < x -> ln (1 + x) <= x.
Proof.
Lemma ln_sublinearSource code xSource code : 0 < x -> ln x < x.
Proof.
Lemma ln_ge0Source code xSource code : 1 <= x -> 0 <= ln x.
Proof.
Lemma ln_lt0Source code xSource code : 0 < x < 1 -> ln x < 0.
Lemma ln_gt0Source code xSource code : 1 < x -> 0 < ln x.
Lemma ln_le0Source code xSource code : x <= 1 -> ln x <= 0.
Lemma ln_eq0Source code xSource code : 0 < x -> (ln x == 0) = (x == 1).
Proof.
Lemma continuous_lnUsed by
- mathcomp.analysis.real_measure.measurable_realfun
Source code xSource code : 0 < x -> {for x, continuous ln}.
Proof.
apply: nbhs_singleton (near_can_continuous _ _); near=> z; first exact: expRK.
by apply: continuous_expR.
Unshelve. all: by end_near. Qed.
Global Instance is_derive1_lnSource code (xSource code : R) : 0 < x -> is_derive x 1 ln x^-1.
Proof.
apply: (@is_derive_inverse R expR); first by near=> z; apply: expRK.
by near=>z; apply: continuous_expR.
by rewrite lnK // lt0r_neq0.
Unshelve. all: by end_near. Qed.
Local Open Scope convex_scope.
Lemma concave_lnSource code (tSource code : {i01 R}) (aSource code bSource code : R^o) : 0 < a -> 0 < b ->
(ln a : R^o) <| t |> (ln b : R^o) <= ln (a <| t |> b).
Proof.
Lemma lnNySource code : ln x @[xSource code --> 0^'+] --> -oo.
Proof.
Lemma lnySource code : ln @ +oo --> +oo.
Proof.
End Ln.
Section PowR.
Context {RSource code : realType}.
Implicit Types a x y z r : R.
Definition powR
powR : forall {R : realType}, R -> R -> R powR is not universe polymorphic Arguments powR {R} (a x)%_ring_scope powR is transparent Expands to: Constant mathcomp.analysis.exp.powR Declared in library mathcomp.analysis.exp, line 843, characters 11-15
Used by
- mathcomp.analysis.real_measure.measurable_realfun
- mathcomp.analysis.hoelder
- mathcomp.analysis.lebesgue_integral_theory.measurable_fun_approximation
Source code aSource code xSource code := if a == 0 then (x == 0)%:R else expR (x * ln a).
Local Notation "a `^ x"Source code := (powR a x).
Lemma expRMSource code xSource code ySource code : expR (x * y) = (expR x) `^ y.
Lemma powR_ge0Used by
- mathcomp.analysis.hoelder
Source code aSource code xSource code : 0 <= a `^ x.
Lemma powR_gt0Source code aSource code xSource code : 0 < a -> 0 < a `^ x.
Lemma gt0_powRSource code aSource code xSource code : 0 < x -> 0 <= a -> 0 < a `^ x -> 0 < a.
Proof.
Lemma powR0Used by
- mathcomp.analysis.hoelder
Source code xSource code : x != 0 -> 0 `^ x = 0.
Lemma powRr1Used by
- mathcomp.analysis.hoelder
Source code aSource code : 0 <= a -> a `^ 1 = a.
Proof.
Lemma powRr0Source code aSource code : a `^ 0 = 1.
Lemma powR1Used by
- mathcomp.analysis.hoelder
Source code : powR 1 = fun=> 1.
Lemma powR_eq0Source code xSource code pSource code : (x `^ p == 0) = (x == 0) && (p != 0).
Proof.
Lemma powR_eq0_eq0Source code xSource code pSource code : x `^ p = 0 -> x = 0.
Lemma ger_powRSource code aSource code : 0 < a <= 1 -> {homo powR a : xSource code ySource code /~ y <= x}.
Lemma ler_powRSource code aSource code : 1 <= a -> {homo powR a : xSource code ySource code / x <= y}.
Proof.
Lemma powR_injectiveSource code rSource code : 0 < r -> {in Num.nneg &, injective (powR ^~ r)}.
Proof.
by case: ifPn => [/eqP ->//|_ /eqP]; rewrite (gt_eqF r0) eq_sym expR_eq0.
case: ifPn => [/eqP -> /eqP|yneq0]; first by rewrite (gt_eqF r0) expR_eq0.
by move/expR_inj/mulfI => /(_ (negbT (gt_eqF r0))); apply: ln_inj;
rewrite posrE lt_neqAle eq_sym (xneq0,yneq0).
Qed.
Lemma ler1_powRSource code aSource code rSource code : 1 <= a -> r <= 1 -> a >= a `^ r.
Lemma le1r_powRSource code aSource code rSource code : 1 <= a -> 1 <= r -> a <= a `^ r.
Lemma ger1_powRSource code aSource code rSource code : 0 < a <= 1 -> r <= 1 -> a <= a `^ r.
Lemma ge1r_powRSource code aSource code rSource code : 0 < a <= 1 -> 1 <= r -> a >= a `^ r.
Lemma ge0_ler_powRUsed by
- mathcomp.analysis.hoelder
Source code rSource code : 0 <= r ->
{in Num.nneg &, {homo powR ^~ r : xSource code ySource code / x <= y >-> x <= y}}.
Proof.
move=> a0 x y; rewrite 2!nnegrE !le_eqVlt => /predU1P[<-|x0].
move=> /predU1P[<- _|y0 _]; first by rewrite eqxx.
by rewrite !powR0 ?(gt_eqF a0)// powR_gt0 ?orbT.
move=> /predU1P[<-|y0]; first by rewrite gt_eqF//= ltNge (ltW x0).
move=> /predU1P[->//|xy]; first by rewrite eqxx.
by apply/orP; right; rewrite /powR !gt_eqF// ltr_expR ltr_pM2l// ltr_ln.
Qed.
Lemma gt0_ltr_powRSource code rSource code : 0 < r ->
{in Num.nneg &, {homo powR ^~ r : xSource code ySource code / x < y >-> x < y}}.
Proof.
rewrite le_eqVlt => /orP[/eqP/(powR_injective r0 x0 y0)/eqP|//].
by rewrite lt_eqF.
Qed.
Lemma powRMUsed by
- mathcomp.analysis.hoelder
Source code xSource code ySource code rSource code : 0 <= x -> 0 <= y -> (x * y) `^ r = x `^ r * y `^ r.
Proof.
Lemma ge1r_powRZUsed by
- mathcomp.analysis.hoelder
Source code xSource code ySource code rSource code : 0 < x <= 1 -> 0 <= y -> 1 <= r ->
(x * y) `^ r <= x * (y `^ r).
Proof.
Lemma le1r_powRZSource code xSource code ySource code rSource code : x >= 1 -> 0 <= y -> 1 <= r ->
(x * y) `^ r >= x * (y `^ r).
Proof.
Lemma powRrMUsed by
- mathcomp.analysis.hoelder
Source code xSource code ySource code zSource code : x `^ (y * z) = (x `^ y) `^ z.
Proof.
Lemma powRACUsed by
- mathcomp.analysis.hoelder
Source code xSource code ySource code zSource code : (x `^ y) `^ z = (x `^ z) `^ y.
Lemma powRDUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code sSource code : (r + s == 0) ==> (x != 0) -> x `^ (r + s) = x `^ r * x `^ s.
Proof.
Lemma mulr_powRB1Used by
- mathcomp.analysis.hoelder
Source code xSource code pSource code : 0 <= x -> 0 < p -> x * x `^ (p - 1) = x `^ p.
Proof.
Lemma powRNSource code xSource code rSource code : x `^ (- r) = (x `^ r)^-1.
Proof.
Lemma powRBSource code xSource code rSource code sSource code : (r == s) ==> (x != 0) -> x `^ (r - s) = x `^ r / x `^ s.
Lemma powR_mulrnUsed by
- mathcomp.analysis.hoelder
Source code aSource code nSource code : 0 <= a -> a `^ n%:R = a ^+ n.
Proof.
Lemma powR_inv1Used by
- mathcomp.analysis.hoelder
Source code aSource code : 0 <= a -> a `^ (-1) = a ^-1.
Lemma powR_invnSource code aSource code nSource code : 0 <= a -> a `^ (- n%:R) = a ^- n.
Proof.
Lemma powR_intmulSource code aSource code (zSource code : int) : 0 <= a -> a `^ z%:~R = a ^ z.
Proof.
Lemma ln_powRSource code aSource code xSource code : ln (a `^ x) = x * ln a.
Proof.
Lemma powR12_sqrtSource code aSource code : 0 <= a -> a `^ (2^-1) = Num.sqrt a.
Proof.
by rewrite powR0 ?invr_eq0 ?pnatr_eq0// sqrtr0.
have /eqP : (a `^ (2^-1)) ^+ 2 = (Num.sqrt a) ^+ 2.
rewrite sqr_sqrtr; first exact: ltW.
by rewrite /powR gt_eqF// -expRM_natl mulVKf// lnK.
rewrite eqf_sqr => /predU1P[//|/eqP h].
have : 0 < a `^ 2^-1 by exact: powR_gt0.
by rewrite h oppr_gt0 ltNge sqrtr_ge0.
Qed.
Lemma norm_powRUsed by
- mathcomp.analysis.hoelder
Source code aSource code xSource code : 0 <= a -> `|a `^ x| = `|a| `^ x.
Proof.
Lemma lt0_norm_powRSource code aSource code xSource code : a < 0 -> `|a `^ x| = 1.
Proof.
Lemma conjugate_powRUsed by
- mathcomp.analysis.hoelder
Source code aSource code bSource code pSource code qSource code : 0 <= a -> 0 <= b ->
0 < p -> 0 < q -> p^-1 + q^-1 = 1 ->
a * b <= a `^ p / p + b `^ q / q.
Proof.
by rewrite mul0r powR0 ?gt_eqF// mul0r add0r divr_ge0 ?powR_ge0 ?ltW.
rewrite le_eqVlt => /predU1P[<-|b0] p0 q0 pq.
by rewrite mulr0 powR0 ?gt_eqF// mul0r addr0 divr_ge0 ?powR_ge0 ?ltW.
have iq1 : q^-1 <= 1 by rewrite -pq ler_wpDl// invr_ge0 ltW.
have ap0 : (0 < a `^ p)%R by rewrite powR_gt0.
have bq0 : (0 < b `^ q)%R by rewrite powR_gt0.
have pq' : (p^-1 = 1 - q^-1)%R by rewrite -pq addrK.
have qp' : (q^-1 = 1 - p^-1)%R by rewrite -pq -addrA subrKC.
have := @concave_ln _ (Itv01 (eqbRL (invr_ge0 _) (ltW q0)) iq1) _ _ bq0 ap0.
rewrite 2!(convC (Itv01 _ _)) !convRE/= /onem -pq' -[_ <= ln _]ler_expR expRD.
rewrite 2!ln_powR mulrCA mulVKf ?gt_eqF// -qp' mulrCA mulVKf ?gt_eqF//.
by rewrite 2![_^-1 * _]mulrC 3?lnK ?posrE// addr_gt0// mulr_gt0// ?invr_gt0.
Qed.
Definition powR_itv
powR_itv : Itv.t -> Itv.t powR_itv is not universe polymorphic Arguments powR_itv i powR_itv is transparent Expands to: Constant mathcomp.analysis.exp.powR_itv Declared in library mathcomp.analysis.exp, line 1075, characters 11-19
Source code iSource code :=
match i with
| Itv.Top => Itv.Real `]-oo, +oo[
| Itv.Real (Interval l u) =>
Itv.Real (Interval (IntItv.keep_pos_bound l) +oo%O)
end.
Lemma num_spec_powRSource code (iSource code : Itv.t) (xSource code : Itv.def (@Itv.num_sem R) i) pSource code
(rSource code := powR_itv i) :
Itv.spec (@Itv.num_sem R) r (powR x%:num p).
Proof.
case: x => [x /=/and3P[xr lx xu]]; apply/and3P; split; [exact: num_real| |by[]].
case: l lx => [[] [[|l] |//] |//]; rewrite !bnd_simp => lx.
- by rewrite powR_ge0.
- by apply: powR_gt0; apply: lt_le_trans lx.
- by apply: powR_gt0; apply: le_lt_trans lx.
- by apply: powR_gt0; apply: le_lt_trans lx.
Qed.
Canonical powR_inum
powR_inum : forall {R : realType} [i : Itv.t], Itv.def (Itv.num_sem (R:=R)) i -> R -> Itv.def (Itv.num_sem (R:=R)) (powR_itv i) powR_inum is not universe polymorphic Arguments powR_inum {R} [i] x p%_ring_scope powR_inum is transparent Expands to: Constant mathcomp.analysis.exp.powR_inum Declared in library mathcomp.analysis.exp, line 1095, characters 10-19
Source code (iSource code : Itv.t) (xSource code : Itv.def (@Itv.num_sem R) i) pSource code :=
Itv.mk (num_spec_powR x p).
Lemma powR_cvg0Source code (xSource code : R) : 0 < x -> a `^ x @[aSource code --> 0^'+] --> 0.
Proof.
by apply: near_eq_cvg; near=> a; rewrite /powR gt_eqF 1?mulrC.
apply: (@cvg_comp _ _ _ _ _ _ (@ninfty_nbhs R)).
by apply: gt0_cvgMlNy; rewrite ?x0//; exact: lnNy.
exact/cvgNy_compNP/cvgr_expR.
Unshelve. end_near. Qed.
Lemma ge0_lt1_powR_cvg0Source code (zSource code : R) : 0 <= z -> z < 1 -> z `^ x @[xSource code --> +oo] --> 0.
Proof.
by apply: cvg_near_cst; near do by rewrite powR0// gt_eqF.
rewrite /powR gt_eqF//.
apply: cvg_comp (@cvgNy_expR R).
apply/lt0_cvgMlNy => //.
by rewrite ln_lt0// z_gt0.
Unshelve. all: by end_near. Qed.
Lemma derivable_powRSource code vSource code xSource code : {in `]0, +oo[, forall aSource code, derivable (powR ^~ x) a v}.
Proof.
move=> v0 a; rewrite in_itv/= andbT => a0.
apply: (@near_eq_derivable _ _ _ (fun a'Source code => expR (x * ln a'))) => //.
by near=> b; rewrite /powR gt_eqF//; near: b; exact: lt_nbhsr.
apply: diff_derivable; apply: differentiable_comp; last exact/derivable1_diffP.
apply: differentiableM => //; apply/derivable1_diffP.
by apply: ex_derive; exact: is_derive1_ln.
Unshelve. end_near. Qed.
Lemma powR_derive1Source code aSource code : {in `]0, +oo[%R,
(powR ^~ a) ^`()%classic =1 (fun xSource code => a * x `^ (a - 1))}.
Proof.
rewrite derive1E.
rewrite (@near_eq_derive _ _ _ _ (fun xSource code => expR (a * ln x)))//.
by near=> z; rewrite /powR gt_eqF//; near: z; exact: lt_nbhsr.
rewrite -derive1E.
rewrite derive1_comp//=.
by apply: derivableM => //; apply: ex_derive; exact: is_derive1_ln.
rewrite 2!derive1E.
rewrite deriveM//; first by apply: ex_derive; exact: is_derive1_ln.
rewrite !derive_val scaler0 addr0.
have [_ ->] := (is_derive1_ln x0).
rewrite mulrC powRB; first by rewrite (@gt_eqF _ _ x)//; apply: implybT.
by rewrite powRr1 ?ltW// mulrA [in RHS]mulrAC /powR gt_eqF.
Unshelve. end_near. Qed.
Global Instance is_derive1_powRSource code (aSource code xSource code : R) : 0 < x ->
is_derive x 1 (powR ^~ a) (a * x `^ (a - 1))%R.
Proof.
by apply: derivable_powR; rewrite ?in_itv/= ?andbT.
by rewrite -derive1E powR_derive1// in_itv andbT.
Qed.
Global Instance is_derive1_powRlSource code (aSource code xSource code : R) : 0 < a ->
is_derive x 1 (powR a) (ln a * a `^ x).
Proof.
Lemma lt0_powR1Source code xSource code pSource code : x < 0 -> x `^ p = 1.
Lemma powR_eq1Source code xSource code pSource code : (x `^ p == 1) = [|| (x == 1), (x < 0) | (p == 0)].
Proof.
have [->|p0]/= := eqVneq p 0; first by rewrite powRr0 eqxx orbT.
have [x0|x0|->]/= := ltgtP x 0; first by rewrite lt0_powR1// eqxx.
- rewrite /powR (gt_eqF x0)// -expR0; apply/negP => /eqP/expR_inj/eqP.
rewrite mulf_eq0 (negbTE p0)/= -ln1 => /eqP/ln_inj => /(_ _ _)/eqP.
by rewrite (negbTE x1) falseE; apply => //; rewrite posrE.
- by rewrite powR0// eq_sym oner_eq0.
Qed.
End PowR.
Notation "a `^ x"Source code := (powR a x) : ring_scope.
Section Lne.
Context {RSource code : realType}.
Implicit Types (x : \bar R) (r : R).
Local Open Scope ereal_scope.
Definition lne
lne : forall {R : realType}, \bar R -> \bar R lne is not universe polymorphic Arguments lne {R} x%_ereal_scope lne is transparent Expands to: Constant mathcomp.analysis.exp.lne Declared in library mathcomp.analysis.exp, line 1186, characters 11-14
Source code xSource code :=
match x with
| r%:E => if (r <= 0)%R then -oo else (ln r)%:E
| +oo => +oo
| -oo => -oo
end.
Lemma le0_lneNySource code xSource code : x <= 0 -> lne x = -oo.
Lemma lne_EFinSource code rSource code : (0 < r)%R -> lne (r%:E) = (ln r)%:E.
Lemma expeRKSource code : cancel expeR lne.
Lemma lneKSource code : {in `[0, +oo], cancel lne (@expeR R)}.
Proof.
Lemma lneK_eqSource code xSource code : (expeR (lne x) == x) = (0 <= x).
Proof.
Lemma lne1Source code : lne 1 = 0
Lemma lneMSource code : {in `]0, +oo] &, {morph lne : xSource code ySource code / x * y >-> x + y}}.
Proof.
Lemma lne_injSource code : {in `[0, +oo] &, injective lne}.
Lemma lneVSource code rSource code : (0 < r)%R -> lne r^-1%:E = - lne (r%:E).
Lemma lne_divSource code : {in `]0, +oo] &, {morph lne : xSource code ySource code / x / y >-> x - y}}.
Proof.
- rewrite inver// !gt_eqF//= pmulr_rle0// invr_le0 leNgt y0/=.
by rewrite leNgt x0/= ln_div.
- by rewrite mulr0 lexx leNgt x0/=.
- by rewrite inver !gt_eqF// leNgt y0/= gt0_mulye// lte_fin invr_gt0.
- by rewrite invey mule0/= lexx.
Qed.
Lemma lte_lneSource code : {in `[0, +oo] &, {mono lne : xSource code ySource code / x < y}}.
Lemma lee_lneSource code : {in `[0, +oo] &, {mono lne : xSource code ySource code / x <= y}}.
Lemma lneXnSource code nSource code xSource code : 0 < x -> lne (x ^+ n) = lne x *+ n.
Proof.
Lemma le_lne1DxSource code xSource code : - 1%E <= x -> lne (1 + x) <= x.
Proof.
Lemma lne_sublinearSource code xSource code : x \is a fin_num -> lne x < x.
Proof.
Lemma lne_ge0Source code xSource code : (0 <= lne x) = (1 <= x).
Proof.
Lemma lne_lt0Source code xSource code : (lne x < 0) = (x < 1).
Lemma lne_eq0Source code xSource code : (lne x == 0) = (x == 1).
Proof.
Lemma lne_gt0Source code xSource code : (0 < lne x) = (1 < x).
Lemma lne_le0Source code xSource code : (lne x <= 0) = (x <= 1).
End Lne.
Section poweR.
Local Open Scope ereal_scope.
Context {RSource code : realType}.
Implicit Types (s r : R) (x y : \bar R).
Definition poweR
poweR : forall {R : realType}, \bar R -> R -> \bar R poweR is not universe polymorphic Arguments poweR {R} x%_ereal_scope r%_ring_scope poweR is transparent Expands to: Constant mathcomp.analysis.exp.poweR Declared in library mathcomp.analysis.exp, line 1300, characters 11-16
Used by
- mathcomp.analysis.lebesgue_integral_theory.measurable_fun_approximation
Source code xSource code rSource code :=
match x with
| x'%:E => (x' `^ r)%:E
| +oo => if r == 0%R then 1%E else +oo
| -oo => if r == 0%R then 1%E else 0%E
end.
Local Notation "x `^ r"Source code := (poweR x r).
Lemma poweR_EFinUsed by
- mathcomp.analysis.hoelder
Source code sSource code rSource code : s%:E `^ r = (s `^ r)%:E.
Proof.
Lemma poweRyrSource code rSource code : r != 0%R -> +oo `^ r = +oo.
Proof.
Lemma poweRe0Source code xSource code : x `^ 0 = 1.
Lemma poweRe1Used by
- mathcomp.analysis.hoelder
Source code xSource code : 0 <= x -> x `^ 1 = x.
Lemma poweRNUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : x \is a fin_num -> x `^ (- r) = (fine x `^ r)^-1%:E.
Proof.
Lemma poweRNyrSource code rSource code : r != 0%R -> -oo `^ r = 0.
Proof.
Lemma poweREUsed by
- mathcomp.analysis.lebesgue_integral_theory.measurable_fun_approximation
Source code xSource code rSource code :
poweR x r = if r == 0%R then
(if x \is a fin_num then fine x `^ r else 1)%:E
else if x == +oo then +oo
else if x == -oo then 0
else (fine x `^ r)%:E.
Proof.
Lemma poweR_eqySource code xSource code rSource code : x `^ r = +oo -> x = +oo.
Proof.
Lemma eqy_poweRUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : (0 < r)%R -> x = +oo -> x `^ r = +oo.
Proof.
Lemma poweR_ltyUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : x < +oo -> x `^ r < +oo.
Lemma lty_poweRyUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : r != 0%R -> x `^ r < +oo -> x < +oo.
Lemma poweR0rUsed by
- mathcomp.analysis.hoelder
Source code rSource code : r != 0%R -> 0 `^ r = 0.
Proof.
Lemma poweR1rSource code rSource code : 1 `^ r = 1
Proof.
Lemma fine_poweRUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : fine (x `^ r) = ((fine x) `^ r)%R.
Lemma poweR_ge0Used by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : 0 <= x `^ r.
Lemma poweR_gt0Used by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : 0 < x -> 0 < x `^ r.
Lemma gt0_poweRUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : (0 < r)%R -> 0 <= x -> 0 < x `^ r -> 0 < x.
Lemma poweR_eq0Source code xSource code rSource code : 0 <= x -> (x `^ r == 0) = ((x == 0) && (r != 0%R)).
Proof.
by case: ifP => //; rewrite onee_eq0.
Qed.
Lemma poweR_eq0_eq0Used by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : 0 <= x -> x `^ r = 0 -> x = 0.
Lemma gt0_ler_poweRUsed by
- mathcomp.analysis.hoelder
Source code rSource code : (0 <= r)%R ->
{in `[0, +oo] &, {homo poweR ^~ r : xSource code ySource code / x <= y >-> x <= y}}.
Proof.
Lemma fin_num_poweRUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code : x \is a fin_num -> x `^ r \is a fin_num.
Proof.
Lemma poweRMUsed by
- mathcomp.analysis.hoelder
Source code xSource code ySource code rSource code : 0 <= x -> 0 <= y -> (x * y) `^ r = x `^ r * y `^ r.
Proof.
have powyrM s : (0 <= s)%R -> (+oo * s%:E) `^ r = +oo `^ r * s%:E `^ r.
case: ltgtP => // [s_gt0 _|<- _]; last first.
by rewrite mule0 poweRyr// !poweR0r// mule0.
by rewrite gt0_mulye// poweRyr// gt0_mulye// poweR_gt0.
case: x y => [x| |] [y| |]// x0 y0; first by rewrite /= -EFinM powRM.
- by rewrite muleC powyrM// muleC.
- by rewrite powyrM.
- by rewrite mulyy !poweRyr// mulyy.
Qed.
Lemma poweRrMUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code sSource code : x `^ (r * s) = (x `^ r) `^ s.
Proof.
Lemma poweRACSource code xSource code rSource code sSource code : (x `^ r) `^ s = (x `^ s) `^ r.
Definition poweRD_def
poweRD_def : forall {R : realType}, \bar R -> R -> R -> bool poweRD_def is not universe polymorphic Arguments poweRD_def {R} x%_ereal_scope (r s)%_ring_scope poweRD_def is transparent Expands to: Constant mathcomp.analysis.exp.poweRD_def Declared in library mathcomp.analysis.exp, line 1433, characters 11-21
Source code xSource code rSource code sSource code := ((r + s == 0)%R ==>
((x != 0) && ((x \isn't a fin_num) ==> (r == 0%R) && (s == 0%R)))).
Notation "x '`^?' ( r +? s )"Source code := (poweRD_def x r s) : ereal_scope.
Lemma poweRD_defEUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code sSource code :
x `^?(r +? s) = ((r + s == 0)%R ==>
((x != 0) && ((x \isn't a fin_num) ==> (r == 0%R) && (s == 0%R)))).
Proof.
Lemma poweRB_defESource code xSource code rSource code sSource code :
x `^?(r +? - s) = ((r == s)%R ==>
((x != 0) && ((x \isn't a fin_num) ==> (r == 0%R) && (s == 0%R)))).
Proof.
Lemma add_neq0_poweRD_defSource code xSource code rSource code sSource code : (r + s != 0)%R -> x `^?(r +? s).
Proof.
Lemma add_neq0_poweRB_defSource code xSource code rSource code sSource code : (r != s)%R -> x `^?(r +? - s).
Proof.
Lemma nneg_neq0_poweRD_defSource code xSource code rSource code sSource code : x != 0 -> (r >= 0)%R -> (s >= 0)%R ->
x `^?(r +? s).
Proof.
Lemma nneg_neq0_poweRB_defSource code xSource code rSource code sSource code : x != 0 -> (r >= 0)%R -> (s <= 0)%R ->
x `^?(r +? - s).
Proof.
Lemma poweRDUsed by
- mathcomp.analysis.hoelder
Source code xSource code rSource code sSource code : x `^?(r +? s) -> x `^ (r + s) = x `^ r * x `^ s.
Proof.
have [->|r0]/= := eqVneq r 0%R; first by rewrite add0r poweRe0 mul1e.
have [->|s0]/= := eqVneq s 0%R; first by rewrite addr0 poweRe0 mule1.
case: x => // [t|/=|/=]; rewrite ?(negPf r0, negPf s0, implybF); last 2 first.
- by move=> /negPf->; rewrite mulyy.
- by move=> /negPf->; rewrite mule0.
rewrite !poweR_EFin eqe => /implyP/(_ _)/andP cnd.
by rewrite powRD//; apply/implyP => /cnd[].
Qed.
Lemma poweRBSource code xSource code rSource code sSource code : x `^?(r +? - s) -> x `^ (r - s) = x `^ r * x `^ (- s).
Proof.
Lemma poweR12_sqrtSource code xSource code : 0 <= x -> x `^ 2^-1 = sqrte x.
Proof.
by rewrite lee_fin => x0 /=; rewrite powR12_sqrt.
Qed.
End poweR.
Notation "a `^ x"Source code := (poweR a x) : ereal_scope.
Section riemannR_series.
Context {RSource code : realType}.
Implicit Types a : R.
Local Open Scope real_scope.
Definition riemannR
riemannR : forall {R : realType}, R -> R ^nat riemannR is not universe polymorphic Arguments riemannR {R} a%_ring_scope _ riemannR is transparent Expands to: Constant mathcomp.analysis.exp.riemannR Declared in library mathcomp.analysis.exp, line 1494, characters 11-19
Source code aSource code : R ^nat := fun nSource code => (n.+1%:R `^ a)^-1.
Arguments riemannR a n /.
Lemma riemannR_gt0Source code aSource code iSource code : 0 <= a -> 0 < riemannR a i.
Lemma dvg_riemannRSource code aSource code : 0 <= a <= 1 -> ~ cvgn (series (riemannR a)).
Proof.
have : forall nSource code, harmonic n <= riemannR a n.
move=> [/=|n]; first by rewrite powR1 invr1.
rewrite -[leRHS]div1r ler_pdivlMr ?powR_gt0// mulrC ler_pdivrMr//.
by rewrite mul1r -[leRHS]powRr1// ler_powR// ler1n.
move/(series_squeeze_is_cvgn harmonic_ge0 (fun iSource code => ltW (riemannR_gt0 i a0))).
by move/contra_not; apply; exact: dvg_harmonic.
Qed.
End riemannR_series.
Section exponential_domination.
Context {RSource code : realType}.
Lemma pownMexpR_cvgr0Source code nSource code (bSource code : R) :
b < 0 -> x ^+ n * expR (b * x) @[xSource code --> +oo] --> 0.
Proof.
apply: (@cvg_trans _ (x ^+ n / expR (- (b * x)) @[xSource code --> +oo])).
by apply: near_eq_cvg; near=> x; rewrite expRN invrK.
elim: n => [|n ih].
under eq_cvg do rewrite expr0 div1r expRN invrK.
apply: cvg_comp (@cvgNy_expR _).
exact: lt0_cvgMrNy.
apply: lhopital_pinfty_at_pinfty.
- by near do exact: is_derive_exp.
- by near do exact: is_derive1_comp.
- by near=> x; rewrite mulf_neq0 ?expR_eq0// scaler1 gt_eqF// oppr_gt0.
- by apply: cvg_comp (@cvgy_expR _); exact/cvgNry/lt0_cvgMrNy.
- apply: cvg_trans.
apply: near_eq_cvg.
near=> x.
by rewrite !scaler1/= (mulrC _ (- _)) -mulf_div.
exact: cvgM0.
Unshelve. all: by end_near. Qed.
Lemma powRMexpR_cvgr0Source code (aSource code bSource code : R) : b < 0 ->
x `^ a * expR (b * x) @[xSource code --> +oo] --> 0.
Proof.
- apply: (squeeze_cvgr (fun=> 0) _ (fun xSource code => expR (b * x))) => //.
+ near=> x; apply/andP; split.
* by rewrite mulr_ge0// powR_ge0.
* by rewrite ler_piMl// -(powRr0 x) ler_powR.
+ by apply: cvg_comp (@cvgNy_expR _); exact: lt0_cvgMrNy.
near \oo => n.
apply: (squeeze_cvgr (fun=> 0) _ (fun xSource code => x ^+ n * expR (b * x))) => //.
- near=> x; apply/andP; split.
+ by rewrite mulr_ge0// powR_ge0.
+ rewrite -powR_mulrn// ler_pM2r ?expR_gt0// ler_powR//.
by near: n; exact: nbhs_infty_ger.
- exact: pownMexpR_cvgr0.
Unshelve. all: by end_near. Qed.
Lemma pownMpowR_cvgr0Source code nSource code (zSource code : R) :
0 <= z -> z < 1 -> x ^+ n * z `^ x @[xSource code --> +oo] --> 0.
Proof.
apply: cvg_near_cst.
by near=> x; rewrite powR0 ?mulr0// gt_eqF.
apply: cvg_trans (pownMexpR_cvgr0 n (ln z) _).
- by apply: near_eq_cvg; near=> x; rewrite expRM lnK.
- by rewrite ln_lt0// z_gt0 z_lt1.
Unshelve. all: by end_near. Qed.
Lemma pownMexpr_cvgn0Source code nSource code (zSource code : R) :
`|z| < 1 -> k%:R ^+ n * z ^+ k @[kSource code --> \oo] --> 0.
Proof.
apply: (@cvg_trans _ (k%:R ^+ n * `|z| `^ k%:R @[kSource code --> \oo])).
apply: near_eq_cvg.
near=> k.
by rewrite normrM !normrX (@ger0_norm _ k%:R)// powR_mulrn.
apply: (cvg_comp _ (fun xSource code => x ^+ n * `|z| `^ x)).
exact: cvgr_idn.
exact: pownMpowR_cvgr0.
Unshelve. all: by end_near. Qed.
End exponential_domination.