Module mathcomp.analysis.pi_irrational
From mathcomp Require Import boot order algebra.From mathcomp Require Import interval_inference.
From mathcomp Require Import mathcomp_extra boolp classical_sets.
From mathcomp Require Import functions cardinality fsbigop.
From mathcomp Require Import reals ereal topology normedtype sequences.
From mathcomp Require Import real_interval esum measure measurable_realfun.
From mathcomp Require Import numfun realfun lebesgue_measure lebesgue_integral.
From mathcomp Require Import derive ftc trigo.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Import numFieldNormedType.Exports.
Import MeasurableR.
Lemma
Source code
measurable_fun A (horner p).
Proof.
Module
Source code
Local Open Scope ring_scope.
Lemma
Source code
(r ^+ n / n`!%:R @[ --> \oo] --> 0)%classic.
Proof.
Section algebraic_part.
Context { : realType}.
Variables : nat.
Hypothesis
Source code
Definition
pi_irrational.a : forall {R : realType}, nat -> R pi_irrational.a is not universe polymorphic Arguments pi_irrational.a {R} na%_nat_scope pi_irrational.a is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.a Declared in library mathcomp.analysis.pi_irrational, line 51, characters 11-12
Source code
Definition
pi_irrational.b : forall {R : realType}, nat -> R pi_irrational.b is not universe polymorphic Arguments pi_irrational.b {R} nb%_nat_scope pi_irrational.b is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.b Declared in library mathcomp.analysis.pi_irrational, line 53, characters 11-12
Source code
Definition
pi_irrational.f : forall {R : realType}, nat -> nat -> nat -> {poly R} pi_irrational.f is not universe polymorphic Arguments pi_irrational.f {R} (na nb n)%_nat_scope pi_irrational.f is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.f Declared in library mathcomp.analysis.pi_irrational, line 55, characters 11-12
Source code
Definition
pi_irrational.F : forall {R : realType}, nat -> nat -> nat -> {poly R} pi_irrational.F is not universe polymorphic Arguments pi_irrational.F {R} (na nb n)%_nat_scope pi_irrational.F is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.F Declared in library mathcomp.analysis.pi_irrational, line 57, characters 11-12
Source code
Let : b != 0
Proof.
Let
Source code
Proof.
by rewrite size_polyN size_scale ?b0// size_polyX.
by rewrite addrC size_polyDl hs ?size_polyC//; case: (a != 0).
Qed.
Let
Source code
Proof.
by rewrite size_polyN size_scale ?b0// size_polyX size_polyC; case: (a != 0).
by rewrite lead_coefN lead_coefZ lead_coefX mulr1.
Qed.
Let
Source code
Proof.
rewrite exprS size_proper_mul; last by rewrite P1_size /= Hn0.
by rewrite lead_coef_exp P1_lead_coef -exprS expf_neq0 // oppr_eq0 b0.
Qed.
Let
Source code
Proof.
Let
Source code
Proof.
Let
Source code
Let
Source code
Proof.
Lemma
Source code
Proof.
Definition
pi_irrational.pirat : forall {R : realType}, nat -> nat -> R pi_irrational.pirat is not universe polymorphic Arguments pi_irrational.pirat {R} (na nb)%_nat_scope pi_irrational.pirat is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.pirat Declared in library mathcomp.analysis.pi_irrational, line 112, characters 11-16
Source code
Let
Source code
Proof.
rewrite comp_polyM !comp_poly_exprn comp_polyB comp_polyC !comp_polyZ.
rewrite !comp_polyX scalerBr -!exprMn scale_polyC [b * _]mulrC divfK// opprB.
by rewrite subrKC -mul_polyC mulrA mulrC mulrBl -polyCM divfK// [_ * 'X]mulrC.
Qed.
Let
Source code
Proof.
Let
Source code
Proof.
have := derivn_fpix i.
rewrite -signr_odd.
have [oi|ei] := boolP (odd i).
rewrite expr1 scaleN1r => /eqP; rewrite -eqr_oppLR => /eqP.
rewrite -[in X in _ = X -> _]pf_sym => <-.
by rewrite hornerN rpredN/= horner_comp/= !hornerE subrr derive_f_0_int.
rewrite expr0 scale1r.
rewrite -[in X in _ = X -> _]pf_sym => <-.
by rewrite horner_comp/= !hornerE subrr derive_f_0_int.
Qed.
Lemma
Source code
Proof.
Lemma
Source code
Proof.
rewrite (eq_bigr (fun : 'I_n.+1 => (-1)^i *: f^`(i.*2.+2))).
by move=> i _; rewrite !derivZ.
rewrite [X in _ + X]big_ord_recl.
rewrite -exprnP expr0 scale1r (addrC f) addrA -[RHS]add0r.
congr (_ + _).
rewrite big_ord_recr addrC addrA -big_split big1=>[i _|].
rewrite /bump /= -scalerDl.
apply/eqP; rewrite scaler_eq0 /bump -exprnP add1n exprSr.
by rewrite mulrN1 addrC subr_eq0 eqxx orTb.
rewrite add0r /=; apply/eqP; rewrite scaler_eq0 -derivnS derivn_poly0; last first.
by rewrite deriv0 eqxx orbT.
suff -> : size f = (n + n.+1)%N by rewrite addnS addnn.
rewrite /f size_scale.
by rewrite invr_neq0 // pnatr_eq0 -lt0n (fact_gt0 n).
rewrite size_monicM ?monicXn //; first by rewrite -size_poly_eq0 P_size.
by rewrite size_polyXn P_size.
Qed.
End algebraic_part.
Section analytic_part.
Context { : realType}.
Let := @lebesgue_measure R.
Variable : nat.
Hypothesis
Source code
Let
Source code
Let : R := a na.
Let : R := b nb.
Let := @f R na nb.
Let
Source code
Proof.
Let
Source code
Proof.
Let
Source code
Let := @F R na nb.
Let
Source code
'D_1 (fun => (F n)^`().[x] * sin x - (F n).[x] * cos x) =
fsin n.
Proof.
Definition
pi_irrational.intfsin : forall {R : realType}, nat -> nat -> nat -> R pi_irrational.intfsin is not universe polymorphic Arguments pi_irrational.intfsin {R} (na nb n)%_nat_scope pi_irrational.intfsin is transparent Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.intfsin Declared in library mathcomp.analysis.pi_irrational, line 215, characters 11-18
Source code
Local Open Scope classical_set_scope.
Let
Source code
Proof.
by apply: cvgM => /=; [exact: continuous_horner|exact: continuous_sin].
Qed.
pi_irrational.Unnamed_thm : forall {R : realType} [p : {poly R}] [c : R], filter.cvg_to (filter.nbhs (filter.fmap [eta horner p] (filter.nbhs (num_topology.at_right (R:=R) c)))) (filter.nbhs p.[c]%R) pi_irrational.Unnamed_thm is not universe polymorphic Expanded type for implicit arguments pi_irrational.Unnamed_thm : forall {R : realType} [p : {poly R}] [c : R] [t : set R], filter.nbhs p.[c]%R t -> exists2 i : R, [set e | (0 < e)%R]%classic i & (pseudometric_structure.ball_ [eta normr] c i `<=` (fun t0 : R => (fun u : R => is_true (c < u)%R) t0 -> ([eta horner p] @^-1` t) t0))%classic Arguments pi_irrational.Unnamed_thm {R} [p c]%_ring_scope [t] _ pi_irrational.Unnamed_thm is opaque Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.Unnamed_thm Declared in library mathcomp.analysis.pi_irrational, line 225, characters 0-59
Source code
pi_irrational.Unnamed_thm : forall {R : realType} [p : {poly R}] [c : R], filter.cvg_to (filter.nbhs (filter.fmap [eta horner p] (filter.nbhs (num_topology.at_right (R:=R) c)))) (filter.nbhs p.[c]%R) pi_irrational.Unnamed_thm is not universe polymorphic Expanded type for implicit arguments pi_irrational.Unnamed_thm : forall {R : realType} [p : {poly R}] [c : R] [t : set R], filter.nbhs p.[c]%R t -> exists2 i : R, [set e | (0 < e)%R]%classic i & (pseudometric_structure.ball_ [eta normr] c i `<=` (fun t0 : R => (fun u : R => is_true (c < u)%R) t0 -> ([eta horner p] @^-1` t) t0))%classic Arguments pi_irrational.Unnamed_thm {R} [p c]%_ring_scope [t] _ pi_irrational.Unnamed_thm is opaque Expands to: Constant mathcomp.analysis.pi_irrational.pi_irrational.Unnamed_thm Declared in library mathcomp.analysis.pi_irrational, line 225, characters 0-59
Source code
by move=> p c; apply: cvg_at_right_filter; exact: continuous_horner.
Let
Source code
Proof.
set h := fun => ((F n)^`()).[x] * sin x - (F n).[x] * cos x.
rewrite (@continuous_FTC2 _ _ h).
- by rewrite pi_gt0.
- exact: cfsin.
- split=> [x x0pi| |].
+ by apply: derivableB => //; apply: derivableM => //; rewrite -derivE.
+ by apply: cvgB; apply: cvgM => //; apply: cvg_at_right_filter;
(exact: continuous_horner||exact: continuous_sin||exact: continuous_cos).
+ by apply: cvgB; apply: cvgM => //; apply: cvg_at_left_filter;
(exact: continuous_horner||exact: continuous_sin||exact: continuous_cos).
- by move=> x x0pi; rewrite -fsin_antiderivative derive1E.
- rewrite /h sin0 cospi cos0 sinpi !mulr0 !add0r mulr1 mulrN1 !opprK EFinN.
by rewrite oppeK -EFinD.
Qed.
Hypothesis
Source code
Lemma
Source code
Let : (f 0).[x] = 1.
Let
Source code
0 < fsin n x < (pi ^+ n * a ^+ n) / n`!%:R.
Proof.
have sinx0 : 0 < sin x by rewrite sin_gt0_pi// x0.
apply/andP; split.
rewrite mulr_gt0// /f !hornerE/= mulr_gt0//.
by rewrite mulr_gt0 ?invr_gt0 ?ltr0n ?fact_gt0// exprn_gt0.
by rewrite exprn_gt0// abx_gt0// x0 piratE.
rewrite /fsin !hornerE/= -2!mulrA mulrC ltr_pM2r ?invr_gt0 ?ltr0n ?fact_gt0//.
rewrite -!exprMn [in ltRHS]mulrC mulrA -exprMn.
have ? : 0 <= a - b * x by rewrite abx_ge0 ?piratE// (ltW x0) ltW.
have ? : x * (a - b * x) < a * pi.
rewrite [ltRHS]mulrC ltr_pM//; first exact/ltW.
by rewrite ltrBlDl// ltrDr mulr_gt0// lt0r /b pnatr_eq0 nb0/=.
have := sin_le1 x; rewrite le_eqVlt => /predU1P[x1|x1].
- by rewrite x1 mulr1 ltrXn2r ?gtn_eqF// mulr_ge0//; exact/ltW.
- rewrite -[ltRHS]mulr1 ltr_pM//.
+ by rewrite exprn_ge0// mulr_ge0//; exact/ltW.
+ exact/ltW.
+ by rewrite ltrXn2r ?gtn_eqF// mulr_ge0//; exact/ltW.
Qed.
Let
Source code
Proof.
- by rewrite /= !EFinN cos0 cospi !EFinN oppeK.
- exact/continuous_subspaceT/continuous_sin.
split.
- by move=> x x0pi; exact/derivableN/derivable_cos.
- by apply: cvgN; apply: cvg_at_right_filter; exact: continuous_cos.
- by apply: cvgN; apply: cvg_at_left_filter; exact: continuous_cos.
- by move=> x x0pi; rewrite derive1E deriveN// derive_val opprK.
Qed.
Let
Source code
Proof.
Let
Source code
closed_ball m d `<=` `]0%R, pi[.
Proof.
rewrite in_itv/= => /andP[mdz zmd]; rewrite in_itv/=; apply/andP; split.
rewrite (lt_le_trans _ mdz)// subr_gt0.
by rewrite ltr_pM2l// ?pi_gt0// ltf_pV2// ?posrE// ltr_nat.
rewrite (le_lt_trans zmd)// -mulrDr gtr_pMr// ?pi_gt0//.
by rewrite -ltrBrDl [X in _ < X - _](splitr 1) div1r addrK ltf_pV2 ?posrE// ltr_nat.
(* that would be immediate with lra... *)
Qed.
Let
Source code
exists2 : R, 0 < r & forall , x \in closed_ball m d -> r <= fsin n x.
Proof.
by rewrite lerBlDr -addrA lerDl -mulr2n mulrn_wge0// divr_ge0// pi_ge0.
have cf : {within `[m - d, m + d], continuous (fsin n)}.
exact: cfsin.
have [c cmd Hc] := @EVT_min R (fsin n) _ _ mdmd cf.
exists (fsin n c).
have /(_ _)/andP[]// := @fsin_bounded n c n0.
have := @small_ballS c; rewrite /=in_itv/=; apply.
by rewrite closed_ball_itv//= divr_gt0// pi_gt0.
move=> x /set_mem; rewrite closed_ball_itv//=; last exact: Hc.
by rewrite divr_gt0// pi_gt0.
Qed.
Lemma
Source code
Proof.
rewrite /fsin; under eq_integral do rewrite f0 mul1r.
by rewrite intsin ltry andbT.
have fsin_ge0 ( : R) : 0 <= x <= pi -> (0 <= (fsin n x)%:E)%E.
move=> /andP[x0 xpi]; rewrite lee_fin mulr_ge0//.
rewrite !hornerE mulr_ge0//=.
by rewrite mulr_ge0// exprn_ge0.
by rewrite exprn_ge0// abx_ge0// piratE x0.
by rewrite sin_ge0_pi// x0.
apply/andP; split.
rewrite -lt0n in n0.
have [r r0] := @min_fsin _ n0.
pose m : R := pi / 2; pose d : R := pi / 4 => rn.
apply: (@lt_le_trans _ _ (\int[mu]_( in closed_ball m d) r%:E))%E.
rewrite integral_cst//=; first exact: measurable_closed_ball.
rewrite mule_gt0// lebesgue_measure_closed_ball//.
by rewrite divr_ge0// pi_ge0.
by rewrite lte_fin mulrn_wgt0// divr_gt0// pi_gt0.
apply: (@le_trans _ _ (\int[mu]_( in (closed_ball m d)) (fsin n x)%:E))%E.
apply: ge0_le_integral => //=.
- exact: measurable_closed_ball.
- by move=> x _; rewrite lee_fin ltW.
- case/integrableP : (integrable_fsin n) => + _.
apply: measurable_funS => // x ix.
exact: subset_itv_oo_cc (small_ballS ix).
- by move=> x /mem_set /rn; rewrite lee_fin.
apply: ge0_subset_integral => //=.
- exact: measurable_closed_ball.
- by case/integrableP : (integrable_fsin n).
- by move=> x ix; exact: subset_itv_oo_cc (small_ballS ix).
case/integrableP : (integrable_fsin n) => ? /=.
apply: le_lt_trans; apply: ge0_le_integral => //=.
- apply/measurable_EFinP => /=; apply/measurableT_comp => //.
exact/measurable_EFinP.
- by move=> x x0pi; rewrite lee_fin ler_norm.
Qed.
Lemma
Source code
Proof.
rewrite intfsin_gt0/=.
apply: (@le_lt_trans _ _
(\int[mu]_( in `[0, pi]) (pi ^+ n * a ^+ n / n`!%:R))).
apply: le_Rintegral => //=.
- apply/continuous_compact_integrable; first exact: segment_compact.
exact: cst_within_continuous.
- move=> x.
have ? : 0 <= pi ^+ n * a ^+ n / n`!%:R :> R.
by rewrite mulr_ge0// mulr_ge0// exprn_ge0// pi_ge0.
rewrite in_itv/= => /andP[].
rewrite le_eqVlt => /predU1P[<- _|x0]; first by rewrite /fsin sin0 !hornerE.
rewrite le_eqVlt => /predU1P[->|xpi]; first by rewrite /fsin sinpi mulr0.
have n0 : (0 < n)%N by near: n; exists 1%N.
have /(_ _)/andP[|//] := @fsin_bounded _ x n0.
+ by rewrite x0.
+ by move=> _ /ltW.
rewrite Rintegral_cst//= lebesgue_measure_itv/= lte_fin pi_gt0/=.
rewrite subr0 mulrAC -exprMn (mulrC _ pi) -mulrA.
near: n.
have : pi * (pi * a) ^+ n / n`!%:R @[ --> \oo] --> 0.
rewrite -[X in _ --> X](mulr0 pi).
under eq_fun do rewrite -mulrA.
by apply: cvgMl_tmp; exact: exp_fact.
move/cvgrPdist_lt => /(_ e e0).
apply: filterS => n.
rewrite sub0r normrN ger0_norm.
by rewrite !mulr_ge0 ?pi_ge0// exprn_ge0// mulr_ge0// pi_ge0.
by rewrite mulrA; exact.
Unshelve. all: by end_near. Qed.
End analytic_part.
End pi_irrational.
Lemma
Source code
Proof.
by rewrite invr0 mulr0; apply/eqP; rewrite gt_eqF// pi_gt0.
have [na ana] : exists , (a%:~R = na%:R :> R)%R.
exists `|a|%N; rewrite natr_absz gtr0_norm//.
by have := @pi_gt0 R; rewrite piratE pmulr_lgt0 ?invr_gt0 ?ltr0n ?lt0n ?ltr0z.
rewrite {}ana in piratE.
have [N _] := pi_irrational.intfsin_small b0 (esym piratE) (@ltr01 R).
near \oo%classic => n.
have Nn : (N <= n)%N by near: n; exists N.
have := @pi_irrational.intfsin_int R _ _ b0 (esym piratE) n.
rewrite intrEge0; first by rewrite ltW// pi_irrational.intfsin_gt0.
move=> + /(_ n Nn).
move/natrP => [k] ->.
rewrite ltr0n ltrn1.
by case: k.
Unshelve. all: by end_near. Qed.