Download data/lean/OAI/MathematicalPhysics/AlternatingFlow/ExpNames.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.82 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/ExpNames.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/AlternatingFlow/ExpNames.lean
-
curl -L -o ExpNames.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/ExpNames.lean
3.82 kB
| import OAI.MathematicalPhysics.AlternatingFlow.EffectiveProfiles | |
| import OAI.MathematicalPhysics.AlternatingFlow.Names | |
| namespace OAI | |
| section ExpNamesDevelopment | |
| open scoped BigOperators ContDiff Topology | |
| open Filter | |
| namespace AlternatingNS.Effective | |
| attribute [local instance] Arithmetic.rationalCoding | |
| lemma rat_sum_range {A : Type*} [Primcodable A] {f : A β β β β} | |
| (hf : Computableβ f) : Computableβ (fun a n => β i β Finset.range n, f a i) := by | |
| have hs : Computableβ (fun a : A => fun z : β Γ β => z.2 + f a z.1) := | |
| Arithmetic.rat_add.to_comp.comp (Computable.snd.comp Computable.snd) | |
| (hf.comp Computable.fst (Computable.fst.comp Computable.snd)) | |
| have h := Computable.nat_rec (Computable.snd : Computable (fun z : A Γ β => z.2)) | |
| (Computable.const (0 : β)) | |
| (hs.comp (Computable.fst.comp Computable.fst) Computable.snd).toβ | |
| refine h.toβ.of_eq ?_ | |
| rintro β¨a,nβ© | |
| induction n with | |
| | zero => simp | |
| | succ n ih => simp only [Finset.sum_range_succ, ih] | |
| lemma abs_rat_cast_le_num (q : β) : |(q : β)| β€ q.num.natAbs := by | |
| have h : (q.den : β) β₯ 1 := by exact_mod_cast q.den_pos | |
| rw [Rat.cast_def, abs_div, β Int.cast_abs, β Int.natCast_natAbs, Int.cast_natCast, | |
| abs_of_nonneg (Nat.cast_nonneg _)] | |
| exact div_le_self (Nat.cast_nonneg _) h | |
| lemma exp_named : Named (fun q : β => Real.exp (q : β)) := by | |
| let N (z : β Γ β) : β := 2 * z.1.num.natAbs + z.2 + 1 | |
| have hN : Computable N := (Primrec.nat_add.comp | |
| (Primrec.nat_add.comp (Primrec.nat_mul.comp (Primrec.const 2) | |
| (Arithmetic.int_abs.comp (Arithmetic.rat_num.comp Primrec.fst))) Primrec.snd) | |
| (Primrec.const 1)).to_comp | |
| let a (z : β Γ β) : β := β i β Finset.range (N z), z.1 ^ i / i.factorial | |
| let err (z : β Γ β) : β := |z.1| ^ N z / (N z).factorial * 2 | |
| have ht : Computableβ (fun q : β => fun i : β => q ^ i / i.factorial) := | |
| Arithmetic.rat_div.to_comp.comp Arithmetic.rat_pow.to_comp | |
| (Arithmetic.rat_natCast.to_comp.comp (factorial.to_comp.comp Computable.snd)) | |
| have ha : Computable a := (rat_sum_range ht).comp Computable.fst hN | |
| have he : Computable err := Arithmetic.rat_mul.to_comp.comp | |
| (Arithmetic.rat_div.to_comp.comp | |
| (Arithmetic.rat_pow.to_comp.comp (Arithmetic.rat_abs.to_comp.comp Computable.fst) hN) | |
| (Arithmetic.rat_natCast.to_comp.comp (factorial.to_comp.comp hN))) (Computable.const 2) | |
| apply Named.of_certificate _ a err ha he | |
| Β· intro q n | |
| have hl : β(q : β)β / (N (q,n)).succ β€ 1 / 2 := by | |
| rw [div_le_iffβ (by positivity : (0 : β) < (N (q,n)).succ)] | |
| rw [show (q : β) = ((q : β) : β) by simp, Complex.norm_real, Real.norm_eq_abs] | |
| have hh := abs_rat_cast_le_num q | |
| dsimp [N]; push_cast; linarith | |
| have h := Complex.exp_bound' hl | |
| have hc : (β i β Finset.range (N (q,n)), (q : β) ^ i / i.factorial) = (a (q,n) : β) := by | |
| simp [a] | |
| rw [hc, show (q : β) = ((q : β) : β) by simp, β Complex.ofReal_exp, | |
| show (a (q,n) : β) = ((a (q,n) : β) : β) by simp, | |
| β Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs, | |
| Complex.norm_real, Real.norm_eq_abs] at h | |
| simpa only [err, Rat.cast_mul, Rat.cast_div, Rat.cast_pow, Rat.cast_abs, | |
| Rat.cast_natCast, Rat.cast_ofNat] using h | |
| Β· intro q | |
| have hlim := (FloorSemiring.tendsto_pow_div_factorial_atTop |(q : β)|).mul_const 2 | |
| have hshift : Tendsto (fun n => N (q,n)) atTop atTop := by | |
| apply tendsto_atTop_mono (f := fun n : β => n) _ tendsto_id | |
| intro n; dsimp [N]; omega | |
| simpa only [err, Function.comp_def, Rat.cast_mul, Rat.cast_div, Rat.cast_pow, | |
| Rat.cast_abs, Rat.cast_natCast, Rat.cast_ofNat, zero_mul] using hlim.comp hshift | |
| end AlternatingNS.Effective | |
| end ExpNamesDevelopment | |
| end OAI | |