Download data/lean/OAI/AlgebraicGeometry/Stability/NumericalWalls.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 24.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/AlgebraicGeometry/Stability/NumericalWalls.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/AlgebraicGeometry/Stability/NumericalWalls.lean
-
curl -L -o NumericalWalls.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/AlgebraicGeometry/Stability/NumericalWalls.lean
24.9 kB
| import Mathlib | |
| namespace OAI | |
| /-! Numerical character, discriminant and fixed-branch wall-transport inequalities. -/ | |
| noncomputable section | |
| namespace PrescribedCharges.Numerical | |
| @[ext] structure Character where | |
| r : β | |
| d : β | |
| w : β | |
| z : β | |
| namespace Character | |
| def twist (v : Character) (b : β) : Character where | |
| r := v.r | |
| d := v.d - b * v.r | |
| w := v.w - b * v.d + b ^ 2 * v.r / 2 | |
| z := v.z - b * v.w + b ^ 2 * v.d / 2 - b ^ 3 * v.r / 6 | |
| def discr (v : Character) : β := v.d ^ 2 - 2 * v.r * v.w | |
| def numerator (v : Character) (a : β) : β := v.w - a ^ 2 * v.r / 2 | |
| def defect (v : Character) (a : β) : β := v.z - a ^ 2 * v.d / 6 | |
| @[simp] theorem twist_zero (v : Character) : v.twist 0 = v := by | |
| ext <;> simp [twist] | |
| @[simp] theorem twist_twist (v : Character) (b c : β) : | |
| (v.twist b).twist c = v.twist (b + c) := by | |
| ext <;> simp only [twist] <;> ring | |
| @[simp] theorem discr_twist (v : Character) (b : β) : | |
| (v.twist b).discr = v.discr := by | |
| simp only [discr, twist] | |
| ring | |
| theorem discr_at_zero (v : Character) (a : β) (hz : v.numerator a = 0) : | |
| v.discr = v.d ^ 2 - a ^ 2 * v.r ^ 2 := by | |
| unfold numerator at hz | |
| unfold discr | |
| rw [sub_eq_zero.mp hz] | |
| ring | |
| theorem rank_bound (v : Character) {a : β} (ha : 0 < a) (hd : 0 < v.d) | |
| (hz : v.numerator a = 0) (hΞ : 0 β€ v.discr) : a * |v.r| β€ v.d := by | |
| rw [v.discr_at_zero a hz] at hΞ | |
| have hs : (a * |v.r|) ^ 2 β€ v.d ^ 2 := by | |
| simpa only [mul_pow, sq_abs] using (sub_nonneg.mp hΞ) | |
| have hn : 0 β€ a * |v.r| := mul_nonneg ha.le (abs_nonneg _) | |
| nlinarith | |
| theorem hasDerivAt_twist_z (v : Character) (b : β) : | |
| HasDerivAt (fun t : β => (v.twist t).z) (-(v.twist b).w) b := by | |
| have h := (((hasDerivAt_const b v.z).sub | |
| ((hasDerivAt_id b).mul_const v.w)).add | |
| ((((hasDerivAt_id b).pow 2).mul_const v.d).div_const 2)).sub | |
| ((((hasDerivAt_id b).pow 3).mul_const v.r).div_const 6) | |
| apply h.congr_deriv | |
| dsimp [twist] | |
| ring | |
| end Character | |
| def comparison (a d r : β) : β := d - a ^ 2 * r ^ 2 / d | |
| def excess (a d r : β) : β := d - a * |r| | |
| theorem comparison_eq_discr_div (v : Character) (a : β) (hd : v.d β 0) | |
| (hz : v.numerator a = 0) : comparison a v.d v.r = v.discr / v.d := by | |
| rw [v.discr_at_zero a hz] | |
| unfold comparison | |
| field_simp | |
| theorem comparison_factorization (a d r : β) (hd : d β 0) : | |
| comparison a d r = excess a d r * (d + a * |r|) / d := by | |
| unfold comparison excess | |
| field_simp | |
| nlinarith [sq_abs r] | |
| theorem comparison_sub_excess (a d r : β) (hd : d β 0) : | |
| comparison a d r - excess a d r = a * |r| * excess a d r / d := by | |
| rw [comparison_factorization a d r hd] | |
| field_simp | |
| ring | |
| theorem two_excess_sub_comparison (a d r : β) (hd : d β 0) : | |
| 2 * excess a d r - comparison a d r = excess a d r ^ 2 / d := by | |
| rw [comparison_factorization a d r hd] | |
| unfold excess | |
| field_simp | |
| ring | |
| theorem comparison_bounds {a d r : β} (ha : 0 < a) (hd : 0 < d) | |
| (hr : a * |r| β€ d) : | |
| 0 β€ comparison a d r β§ comparison a d r β€ d β§ | |
| excess a d r β€ comparison a d r β§ comparison a d r β€ 2 * excess a d r := by | |
| have he : 0 β€ excess a d r := sub_nonneg.mpr hr | |
| have hl : excess a d r β€ comparison a d r := by | |
| have h := div_nonneg (mul_nonneg (mul_nonneg ha.le (abs_nonneg r)) he) hd.le | |
| rw [β comparison_sub_excess a d r hd.ne'] at h | |
| exact sub_nonneg.mp h | |
| have hu : comparison a d r β€ 2 * excess a d r := by | |
| have h := div_nonneg (sq_nonneg (excess a d r)) hd.le | |
| rw [β two_excess_sub_comparison a d r hd.ne'] at h | |
| exact sub_nonneg.mp h | |
| refine β¨he.trans hl, ?_, hl, huβ© | |
| exact sub_le_self d (div_nonneg (mul_nonneg (sq_nonneg a) (sq_nonneg r)) hd.le) | |
| theorem excess_estimate_to_comparison {a C d r D : β} | |
| (ha : 0 < a) (hC : 0 β€ C) (hd : 0 < d) (hr : a * |r| β€ d) | |
| (hD : D β€ C * excess a d r) : D β€ C * comparison a d r := by | |
| exact hD.trans (mul_le_mul_of_nonneg_left (comparison_bounds ha hd hr).2.2.1 hC) | |
| theorem comparison_add_gap (a dβ dβ rβ rβ : β) | |
| (hβ : dβ β 0) (hβ : dβ β 0) (hββ : dβ + dβ β 0) : | |
| comparison a (dβ + dβ) (rβ + rβ) - | |
| (comparison a dβ rβ + comparison a dβ rβ) = | |
| a ^ 2 * (rβ * dβ - rβ * dβ) ^ 2 / (dβ * dβ * (dβ + dβ)) := by | |
| unfold comparison | |
| field_simp | |
| ring | |
| theorem comparison_superadditive (a rβ rβ : β) {dβ dβ : β} | |
| (hβ : 0 < dβ) (hβ : 0 < dβ) : | |
| comparison a dβ rβ + comparison a dβ rβ β€ | |
| comparison a (dβ + dβ) (rβ + rβ) := by | |
| have h := div_nonneg | |
| (mul_nonneg (sq_nonneg a) (sq_nonneg (rβ * dβ - rβ * dβ))) | |
| (mul_nonneg (mul_nonneg hβ.le hβ.le) (add_nonneg hβ.le hβ.le)) | |
| rw [β comparison_add_gap a dβ dβ rβ rβ hβ.ne' hβ.ne' (add_pos hβ hβ).ne'] at h | |
| exact sub_nonneg.mp h | |
| theorem sum_comparison_le {ΞΉ : Type*} (s : Finset ΞΉ) (a : β) (d r : ΞΉ β β) | |
| (hd : β i β s, 0 < d i) : | |
| β i β s, comparison a (d i) (r i) β€ | |
| comparison a (β i β s, d i) (β i β s, r i) := by | |
| classical | |
| induction s using Finset.induction_on with | |
| | empty => simp [comparison] | |
| | @insert i s hi ih => | |
| have hdi : 0 < d i := hd i (Finset.mem_insert_self _ _) | |
| have hds : β j β s, 0 < d j := fun j hj => hd j (Finset.mem_insert_of_mem hj) | |
| simp only [Finset.sum_insert hi] | |
| by_cases hs : s.Nonempty | |
| Β· have hsum : 0 < β j β s, d j := Finset.sum_pos hds hs | |
| exact (add_le_add (le_refl _) (ih hds)).trans | |
| (comparison_superadditive a (r i) (β j β s, r j) hdi hsum) | |
| Β· have he : s = β := Finset.not_nonempty_iff_eq_empty.mp hs | |
| simp [he, comparison] | |
| theorem exists_violating_factor {ΞΉ : Type*} (s : Finset ΞΉ) (a k : β) | |
| (d r D : ΞΉ β β) (hd : β i β s, 0 < d i) (hk : 0 β€ k) | |
| (h : k * comparison a (β i β s, d i) (β i β s, r i) < β i β s, D i) : | |
| β i β s, k * comparison a (d i) (r i) < D i := by | |
| by_contra hn | |
| push Not at hn | |
| have hf := Finset.sum_le_sum hn | |
| have hs := mul_le_mul_of_nonneg_left (sum_comparison_le s a d r hd) hk | |
| rw [Finset.mul_sum] at hs | |
| linarith | |
| theorem discriminant_split_two (a dβ dβ rβ rβ : β) : | |
| (dβ + dβ) ^ 2 - a ^ 2 * (rβ + rβ) ^ 2 = | |
| (dβ ^ 2 - a ^ 2 * rβ ^ 2) + (dβ ^ 2 - a ^ 2 * rβ ^ 2) + | |
| 2 * (dβ * dβ - a ^ 2 * rβ * rβ) := by ring | |
| theorem cross_term_nonneg {a dβ dβ rβ rβ : β} (ha : 0 β€ a) | |
| (hβ : a * |rβ| β€ dβ) (hβ : a * |rβ| β€ dβ) : | |
| 0 β€ dβ * dβ - a ^ 2 * rβ * rβ := by | |
| have hnβ := mul_nonneg ha (abs_nonneg rβ) | |
| have hnβ := mul_nonneg ha (abs_nonneg rβ) | |
| have hp := mul_le_mul hβ hβ hnβ (hnβ.trans hβ) | |
| have habs : rβ * rβ β€ |rβ| * |rβ| := by | |
| simpa only [abs_mul] using le_abs_self (rβ * rβ) | |
| have h := mul_le_mul_of_nonneg_left habs (sq_nonneg a) | |
| nlinarith | |
| theorem cross_term_zero {a dβ dβ rβ rβ : β} | |
| (ha : 0 < a) (hdβ : 0 < dβ) (hdβ : 0 < dβ) | |
| (hβ : a * |rβ| β€ dβ) (hβ : a * |rβ| β€ dβ) | |
| (hz : dβ * dβ - a ^ 2 * rβ * rβ = 0) : | |
| dβ = a * |rβ| β§ dβ = a * |rβ| β§ 0 < rβ * rβ := by | |
| have hnβ := mul_nonneg ha.le (abs_nonneg rβ) | |
| have hnβ := mul_nonneg ha.le (abs_nonneg rβ) | |
| have habs : rβ * rβ β€ |rβ| * |rβ| := by | |
| simpa only [abs_mul] using le_abs_self (rβ * rβ) | |
| have hp : dβ * dβ β€ (a * |rβ|) * (a * |rβ|) := by | |
| nlinarith [mul_le_mul_of_nonneg_left habs (sq_nonneg a)] | |
| have heβ : dβ = a * |rβ| := | |
| le_antisymm ((mul_le_mul_iff_leftβ hdβ).mp | |
| (hp.trans (mul_le_mul_of_nonneg_left hβ hnβ))) hβ | |
| have heβ : dβ = a * |rβ| := by | |
| apply le_antisymm _ hβ | |
| rw [β heβ] at hp | |
| exact (mul_le_mul_iff_rightβ hdβ).mp hp | |
| refine β¨heβ, heβ, ?_β© | |
| have hprod : 0 < a ^ 2 * (rβ * rβ) := by nlinarith [mul_pos hdβ hdβ] | |
| rcases mul_pos_iff.mp hprod with h | h | |
| Β· exact h.2 | |
| Β· exact False.elim ((sq_nonneg a).not_gt h.1) | |
| theorem discriminant_strict_drop {a dβ dβ rβ rβ : β} | |
| (hΞβ : 0 β€ dβ ^ 2 - a ^ 2 * rβ ^ 2) | |
| (hΞβ : 0 β€ dβ ^ 2 - a ^ 2 * rβ ^ 2) | |
| (hc : 0 < dβ * dβ - a ^ 2 * rβ * rβ) : | |
| dβ ^ 2 - a ^ 2 * rβ ^ 2 < (dβ + dβ) ^ 2 - a ^ 2 * (rβ + rβ) ^ 2 β§ | |
| dβ ^ 2 - a ^ 2 * rβ ^ 2 < (dβ + dβ) ^ 2 - a ^ 2 * (rβ + rβ) ^ 2 := by | |
| rw [discriminant_split_two] | |
| constructor <;> linarith | |
| theorem no_infinite_discrete_descent {N : β} (hN : 0 < N) : | |
| Β¬ β Ξ΄ : β β β, (β i, 0 β€ Ξ΄ i) β§ | |
| (β i, β m : β€, Ξ΄ i = (m : β) / (N : β)) β§ (β i, Ξ΄ (i + 1) < Ξ΄ i) := by | |
| classical | |
| rintro β¨Ξ΄, hpos, hlattice, hltβ© | |
| choose m hm using hlattice | |
| have hn : 0 < (N : β) := by exact_mod_cast hN | |
| have hmpos (i : β) : 0 β€ m i := by | |
| have h := hpos i | |
| rw [hm i] at h | |
| have h' : (0 : β) β€ (m i : β) := by simpa only [zero_mul] using (le_div_iffβ hn).mp h | |
| exact_mod_cast h' | |
| have hmstep (i : β) : m (i + 1) + 1 β€ m i := by | |
| have h := hlt i | |
| rw [hm i, hm (i + 1), div_lt_div_iff_of_pos_right hn] at h | |
| exact Int.add_one_le_iff.mpr (Int.cast_lt.mp h) | |
| have hmbound (i : β) : m i + (i : β€) β€ m 0 := by | |
| induction i with | |
| | zero => simp | |
| | succ i ih => | |
| push_cast | |
| linarith [hmstep i] | |
| obtain β¨n, hn'β© := exists_nat_gt (m 0) | |
| have hb := hmbound n | |
| have hp := hmpos n | |
| linarith | |
| namespace Character | |
| def branchD (v : Character) (a : β) : β := Real.sqrt (v.discr + a ^ 2 * v.r ^ 2) | |
| def branchB (v : Character) (a : β) : β := (v.d - v.branchD a) / v.r | |
| def branchDefect (v : Character) (a : β) : β := | |
| (v.twist (v.branchB a)).defect a | |
| def branchComparison (v : Character) (a : β) : β := comparison a (v.branchD a) v.r | |
| theorem branch_radicand_pos (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| 0 < v.discr + a ^ 2 * v.r ^ 2 := | |
| add_pos_of_nonneg_of_pos hΞ (mul_pos (sq_pos_of_pos ha) (sq_pos_of_ne_zero hr)) | |
| theorem branchD_pos (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : 0 < v.branchD a := | |
| Real.sqrt_pos.mpr (v.branch_radicand_pos ha hr hΞ) | |
| theorem branchD_sq (v : Character) (a : β) (hΞ : 0 β€ v.discr) : | |
| v.branchD a ^ 2 = v.discr + a ^ 2 * v.r ^ 2 := | |
| Real.sq_sqrt (add_nonneg hΞ (mul_nonneg (sq_nonneg a) (sq_nonneg v.r))) | |
| theorem twist_branchB_d (v : Character) (a : β) (hr : v.r β 0) : | |
| (v.twist (v.branchB a)).d = v.branchD a := by | |
| dsimp [twist, branchB] | |
| field_simp | |
| ring | |
| theorem numerator_branch (v : Character) (a : β) (hr : v.r β 0) | |
| (hΞ : 0 β€ v.discr) : (v.twist (v.branchB a)).numerator a = 0 := by | |
| have hi := v.discr_twist (v.branchB a) | |
| unfold discr at hi | |
| rw [v.twist_branchB_d a hr] at hi | |
| change v.branchD a ^ 2 - 2 * v.r * (v.twist (v.branchB a)).w = _ at hi | |
| have hs := v.branchD_sq a hΞ | |
| unfold discr at hs | |
| have hmul : v.r * (v.twist (v.branchB a)).numerator a = 0 := by | |
| change v.r * ((v.twist (v.branchB a)).w - a ^ 2 * v.r / 2) = 0 | |
| nlinarith | |
| exact (mul_eq_zero.mp hmul).resolve_left hr | |
| theorem branchComparison_nonneg (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| 0 β€ v.branchComparison a := by | |
| have hd := v.branchD_pos ha hr hΞ | |
| have hb : a * |v.r| β€ v.branchD a := by | |
| have hs := v.branchD_sq a hΞ | |
| nlinarith [sq_abs v.r] | |
| exact (comparison_bounds ha hd hb).1 | |
| theorem branch_rate_le (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| a * v.r ^ 2 / v.branchD a ^ 2 β€ 1 / a := by | |
| have hd := v.branchD_pos ha hr hΞ | |
| apply (div_le_div_iffβ (sq_pos_of_pos hd) ha).2 | |
| rw [one_mul, v.branchD_sq a hΞ] | |
| nlinarith | |
| theorem hasDerivAt_branchD (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| HasDerivAt v.branchD (a * v.r ^ 2 / v.branchD a) a := by | |
| have h := ((hasDerivAt_const a v.discr).add | |
| (((hasDerivAt_id a).pow 2).mul_const (v.r ^ 2))).sqrt | |
| (v.branch_radicand_pos ha hr hΞ).ne' | |
| apply h.congr_deriv | |
| dsimp [branchD] | |
| ring | |
| theorem hasDerivAt_branchB (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| HasDerivAt v.branchB (-a * v.r / v.branchD a) a := by | |
| have h := ((hasDerivAt_const a v.d).sub | |
| (v.hasDerivAt_branchD ha hr hΞ)).div_const v.r | |
| apply h.congr_deriv | |
| field_simp | |
| ring | |
| theorem hasDerivAt_branchDefect (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| HasDerivAt v.branchDefect (-a / 3 * v.branchComparison a) a := by | |
| have hd := v.hasDerivAt_branchD ha hr hΞ | |
| have hz := (v.hasDerivAt_twist_z (v.branchB a)).comp a | |
| (v.hasDerivAt_branchB ha hr hΞ) | |
| have h := hz.sub ((((hasDerivAt_id a).pow 2).mul hd).div_const 6) | |
| have hw := v.numerator_branch a hr hΞ | |
| change (v.twist (v.branchB a)).w - a ^ 2 * v.r / 2 = 0 at hw | |
| unfold branchDefect defect | |
| simp only [v.twist_branchB_d _ hr] | |
| apply h.congr_deriv | |
| rw [sub_eq_zero.mp hw] | |
| dsimp [branchComparison, comparison] | |
| ring | |
| theorem hasDerivAt_branchComparison (v : Character) {a : β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) : | |
| HasDerivAt v.branchComparison | |
| (-(a * v.r ^ 2 / v.branchD a ^ 2) * v.branchComparison a) a := by | |
| have hd := v.hasDerivAt_branchD ha hr hΞ | |
| have h := hd.sub ((((hasDerivAt_id a).pow 2).mul_const (v.r ^ 2)).div hd | |
| (v.branchD_pos ha hr hΞ).ne') | |
| apply h.congr_deriv | |
| dsimp [branchComparison, comparison] | |
| field_simp | |
| ring | |
| theorem hasDerivAt_branch_difference (v : Character) {a k' : β} {k : β β β} | |
| (ha : 0 < a) (hr : v.r β 0) (hΞ : 0 β€ v.discr) (hk : HasDerivAt k k' a) : | |
| HasDerivAt (fun t => v.branchDefect t - k t * v.branchComparison t) | |
| (v.branchComparison a * | |
| (-a / 3 - k' + k a * (a * v.r ^ 2 / v.branchD a ^ 2))) a := by | |
| apply ((v.hasDerivAt_branchDefect ha hr hΞ).sub | |
| (hk.mul (v.hasDerivAt_branchComparison ha hr hΞ))).congr_deriv | |
| ring | |
| theorem hasDerivAt_defect_rank_zero (v : Character) (a : β) (hr : v.r = 0) : | |
| HasDerivAt v.defect (-a / 3 * comparison a v.d v.r) a := by | |
| have h := (hasDerivAt_const a v.z).sub | |
| ((((hasDerivAt_id a).pow 2).mul_const v.d).div_const 6) | |
| apply h.congr_deriv | |
| simp [comparison, hr] | |
| ring | |
| theorem hasDerivAt_comparison_rank_zero (v : Character) (a : β) (hr : v.r = 0) : | |
| HasDerivAt (fun t : β => comparison t v.d v.r) 0 a := by | |
| simpa [comparison, hr] using hasDerivAt_const a v.d | |
| end Character | |
| def belowCoefficient (A C a : β) : β := C + (A ^ 2 - a ^ 2) / 6 | |
| def tailCoefficient (R a : β) : β := a * (R - a) / 3 | |
| def aboveCoefficient (A C a : β) : β := C * a / A | |
| theorem hasDerivAt_belowCoefficient (A C a : β) : | |
| HasDerivAt (belowCoefficient A C) (-a / 3) a := by | |
| apply ((hasDerivAt_const a C).add | |
| (((hasDerivAt_const a (A ^ 2)).sub ((hasDerivAt_id a).pow 2)).div_const 6)).congr_deriv | |
| dsimp | |
| ring | |
| theorem hasDerivAt_tailCoefficient (R a : β) : | |
| HasDerivAt (tailCoefficient R) ((R - 2 * a) / 3) a := by | |
| apply (((hasDerivAt_id a).mul | |
| ((hasDerivAt_const a R).sub (hasDerivAt_id a))).div_const 3).congr_deriv | |
| dsimp | |
| ring | |
| theorem hasDerivAt_aboveCoefficient (A C a : β) : | |
| HasDerivAt (aboveCoefficient A C) (C / A) a := by | |
| apply (((hasDerivAt_id a).const_mul C).div_const A).congr_deriv | |
| ring | |
| theorem belowCoefficient_nonneg {A C a : β} | |
| (hC : 0 β€ C) (ha : 0 < a) (haA : a β€ A) : 0 β€ belowCoefficient A C a := by | |
| unfold belowCoefficient | |
| have hsq : a ^ 2 β€ A ^ 2 := by nlinarith | |
| positivity | |
| theorem below_derivative_nonneg {A C a d r S : β} | |
| (hC : 0 β€ C) (ha : 0 < a) (haA : a β€ A) (hS : 0 β€ S) : | |
| 0 β€ S * (-a / 3 - (-a / 3) + belowCoefficient A C a * (a * r ^ 2 / d ^ 2)) := by | |
| simp only [sub_self, zero_add] | |
| exact mul_nonneg hS (mul_nonneg (belowCoefficient_nonneg hC ha haA) | |
| (div_nonneg (mul_nonneg ha.le (sq_nonneg _)) (sq_nonneg _))) | |
| theorem tail_derivative_nonpos {R a S rate : β} | |
| (ha : 0 < a) (haR : a β€ R) (hS : 0 β€ S) (hRate : rate β€ 1 / a) : | |
| S * (-a / 3 - (R - 2 * a) / 3 + tailCoefficient R a * rate) β€ 0 := by | |
| have hk : 0 β€ tailCoefficient R a := by | |
| exact div_nonneg (mul_nonneg ha.le (sub_nonneg.mpr haR)) (by norm_num) | |
| have h := mul_le_mul_of_nonneg_left hRate hk | |
| have heq : -a / 3 - (R - 2 * a) / 3 + tailCoefficient R a * (1 / a) = 0 := by | |
| unfold tailCoefficient | |
| field_simp | |
| ring | |
| apply mul_nonpos_of_nonneg_of_nonpos hS | |
| linarith | |
| theorem above_derivative_nonpos {A C a S rate : β} | |
| (hA : 0 < A) (hC : 0 β€ C) (ha : 0 < a) (hS : 0 β€ S) (hRate : rate β€ 1 / a) : | |
| S * (-a / 3 - C / A + aboveCoefficient A C a * rate) β€ 0 := by | |
| have hk : 0 β€ aboveCoefficient A C a := | |
| div_nonneg (mul_nonneg hC ha.le) hA.le | |
| have h := mul_le_mul_of_nonneg_left hRate hk | |
| have heq : aboveCoefficient A C a * (1 / a) = C / A := by | |
| unfold aboveCoefficient | |
| field_simp | |
| apply mul_nonpos_of_nonneg_of_nonpos hS | |
| rw [heq] at h | |
| linarith | |
| private theorem endpoint_le_of_nonneg_derivative {f f' : β β β} {a b : β} | |
| (hab : a β€ b) (hf : β x β Set.Icc a b, HasDerivAt f (f' x) x) | |
| (hn : β x β Set.Icc a b, 0 β€ f' x) : f a β€ f b := by | |
| have hm : MonotoneOn f (Set.Icc a b) := | |
| monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc a b) | |
| (fun x hx => (hf x hx).continuousAt.continuousWithinAt) | |
| (fun x hx => (hf x (interior_subset hx)).hasDerivWithinAt) | |
| (fun x hx => hn x (interior_subset hx)) | |
| exact hm (Set.left_mem_Icc.mpr hab) (Set.right_mem_Icc.mpr hab) hab | |
| private theorem endpoint_le_of_nonpos_derivative {f f' : β β β} {a b : β} | |
| (hab : a β€ b) (hf : β x β Set.Icc a b, HasDerivAt f (f' x) x) | |
| (hn : β x β Set.Icc a b, f' x β€ 0) : f b β€ f a := by | |
| have hm : AntitoneOn f (Set.Icc a b) := | |
| antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc a b) | |
| (fun x hx => (hf x hx).continuousAt.continuousWithinAt) | |
| (fun x hx => (hf x (interior_subset hx)).hasDerivWithinAt) | |
| (fun x hx => hn x (interior_subset hx)) | |
| exact hm (Set.left_mem_Icc.mpr hab) (Set.right_mem_Icc.mpr hab) hab | |
| namespace Character | |
| theorem below_endpoint (v : Character) {A C a : β} | |
| (hr : v.r β 0) (hΞ : 0 β€ v.discr) (hC : 0 β€ C) (ha : 0 < a) (haA : a β€ A) : | |
| v.branchDefect a - belowCoefficient A C a * v.branchComparison a β€ | |
| v.branchDefect A - C * v.branchComparison A := by | |
| have h := endpoint_le_of_nonneg_derivative haA | |
| (f := fun x => v.branchDefect x - belowCoefficient A C x * v.branchComparison x) | |
| (f' := fun x => v.branchComparison x * | |
| (-x / 3 - (-x / 3) + belowCoefficient A C x * (x * v.r ^ 2 / v.branchD x ^ 2))) | |
| (fun x hx => v.hasDerivAt_branch_difference (ha.trans_le hx.1) hr hΞ | |
| (hasDerivAt_belowCoefficient A C x)) | |
| (fun x hx => below_derivative_nonneg hC (ha.trans_le hx.1) hx.2 | |
| (v.branchComparison_nonneg (ha.trans_le hx.1) hr hΞ)) | |
| simpa only [belowCoefficient, sub_self, zero_div, add_zero] using h | |
| theorem tail_endpoint (v : Character) {A R : β} | |
| (hr : v.r β 0) (hΞ : 0 β€ v.discr) (hA : 0 < A) (hAR : A β€ R) : | |
| v.branchDefect R β€ | |
| v.branchDefect A - tailCoefficient R A * v.branchComparison A := by | |
| have h := endpoint_le_of_nonpos_derivative hAR | |
| (f := fun x => v.branchDefect x - tailCoefficient R x * v.branchComparison x) | |
| (f' := fun x => v.branchComparison x * | |
| (-x / 3 - (R - 2 * x) / 3 + tailCoefficient R x * (x * v.r ^ 2 / v.branchD x ^ 2))) | |
| (fun x hx => v.hasDerivAt_branch_difference (hA.trans_le hx.1) hr hΞ | |
| (hasDerivAt_tailCoefficient R x)) | |
| (fun x hx => tail_derivative_nonpos (hA.trans_le hx.1) hx.2 | |
| (v.branchComparison_nonneg (hA.trans_le hx.1) hr hΞ) | |
| (v.branch_rate_le (hA.trans_le hx.1) hr hΞ)) | |
| simpa only [tailCoefficient, sub_self, mul_zero, zero_div, zero_mul, sub_zero] using h | |
| theorem above_endpoint (v : Character) {A C a : β} | |
| (hr : v.r β 0) (hΞ : 0 β€ v.discr) (hA : 0 < A) (hC : 0 β€ C) (hAa : A β€ a) : | |
| v.branchDefect a - aboveCoefficient A C a * v.branchComparison a β€ | |
| v.branchDefect A - C * v.branchComparison A := by | |
| have h := endpoint_le_of_nonpos_derivative hAa | |
| (f := fun x => v.branchDefect x - aboveCoefficient A C x * v.branchComparison x) | |
| (f' := fun x => v.branchComparison x * | |
| (-x / 3 - C / A + aboveCoefficient A C x * (x * v.r ^ 2 / v.branchD x ^ 2))) | |
| (fun x hx => v.hasDerivAt_branch_difference (hA.trans_le hx.1) hr hΞ | |
| (hasDerivAt_aboveCoefficient A C x)) | |
| (fun x hx => above_derivative_nonpos hA hC (hA.trans_le hx.1) | |
| (v.branchComparison_nonneg (hA.trans_le hx.1) hr hΞ) | |
| (v.branch_rate_le (hA.trans_le hx.1) hr hΞ)) | |
| simpa only [aboveCoefficient, mul_div_cancel_rightβ _ hA.ne'] using h | |
| theorem below_endpoint_rank_zero (v : Character) (A C a : β) (hr : v.r = 0) : | |
| v.defect a - belowCoefficient A C a * comparison a v.d v.r = | |
| v.defect A - C * comparison A v.d v.r := by | |
| simp [defect, belowCoefficient, comparison, hr] | |
| ring | |
| theorem tail_endpoint_rank_zero (v : Character) (A R : β) | |
| (hr : v.r = 0) (hd : 0 β€ v.d) : | |
| v.defect R β€ v.defect A - tailCoefficient R A * comparison A v.d v.r := by | |
| simp only [defect, tailCoefficient, comparison, hr, zero_pow (by decide : 2 β 0), | |
| mul_zero, zero_div, sub_zero] | |
| nlinarith [mul_nonneg (sq_nonneg (R - A)) hd] | |
| theorem above_endpoint_rank_zero (v : Character) {A C a : β} | |
| (hr : v.r = 0) (hd : 0 β€ v.d) (hA : 0 < A) (hC : 0 β€ C) (hAa : A β€ a) : | |
| v.defect a - aboveCoefficient A C a * comparison a v.d v.r β€ | |
| v.defect A - C * comparison A v.d v.r := by | |
| have hcoef : C β€ aboveCoefficient A C a := by | |
| change C β€ C * a / A | |
| rw [le_div_iffβ hA] | |
| exact mul_le_mul_of_nonneg_left hAa hC | |
| have hsq : A ^ 2 β€ a ^ 2 := by nlinarith | |
| have hdef : v.defect a β€ v.defect A := by | |
| unfold defect | |
| exact sub_le_sub_left (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hsq hd) | |
| (by norm_num)) _ | |
| simp only [comparison, hr, zero_pow (by decide : 2 β 0), mul_zero, zero_div, sub_zero] | |
| exact sub_le_sub hdef (mul_le_mul_of_nonneg_right hcoef hd) | |
| end Character | |
| def tailThreshold (A C : β) : β := A + 3 * C / A | |
| def globalCorrection (A C : β) : β := | |
| max (C + A ^ 2 / 6) (C * tailThreshold A C / A) | |
| theorem tailThreshold_pos {A C : β} (hA : 0 < A) (hC : 0 β€ C) : | |
| 0 < tailThreshold A C := by | |
| unfold tailThreshold | |
| positivity | |
| theorem apex_le_tailThreshold {A C : β} (hA : 0 < A) (hC : 0 β€ C) : | |
| A β€ tailThreshold A C := by | |
| exact le_add_of_nonneg_right (div_nonneg (mul_nonneg (by norm_num) hC) hA.le) | |
| theorem globalCorrection_nonneg {A C : β} (hC : 0 β€ C) : | |
| 0 β€ globalCorrection A C := by | |
| exact (add_nonneg hC (div_nonneg (sq_nonneg A) (by norm_num))).trans (le_max_left _ _) | |
| theorem belowCoefficient_le_globalCorrection (A C a : β) : | |
| belowCoefficient A C a β€ globalCorrection A C := by | |
| unfold belowCoefficient globalCorrection | |
| exact (show C + (A ^ 2 - a ^ 2) / 6 β€ C + A ^ 2 / 6 by nlinarith [sq_nonneg a]).trans | |
| (le_max_left _ _) | |
| theorem aboveCoefficient_le_globalCorrection {A C a : β} | |
| (hA : 0 < A) (hC : 0 β€ C) (ha : a β€ tailThreshold A C) : | |
| aboveCoefficient A C a β€ globalCorrection A C := by | |
| exact (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left ha hC) hA.le).trans | |
| (le_max_right _ _) | |
| theorem tailCoefficient_at_apex_gt {A C R : β} | |
| (hA : 0 < A) (hR : tailThreshold A C < R) : C < tailCoefficient R A := by | |
| have h : 3 * C / A < R - A := by unfold tailThreshold at hR; linarith | |
| have hp := (div_lt_iffβ hA).mp h | |
| unfold tailCoefficient | |
| nlinarith | |
| theorem exists_nonnegative_rational_ge (K : β) : | |
| β k : β, 0 β€ k β§ K β€ (k : β) := by | |
| obtain β¨n, hnβ© := exists_nat_gt K | |
| refine β¨n, Nat.cast_nonneg n, ?_β© | |
| simpa only [Rat.cast_natCast] using hn.le | |
| theorem unnormalize_iff {h : β} (hh : 0 < h) (a k z d : β) : | |
| z / h β€ (a ^ 2 / 6 + k) * (d / h) β z β€ (a ^ 2 / 6 + k) * d := by | |
| rw [β mul_div_assoc, div_le_div_iff_of_pos_right hh] | |
| theorem rescale_correction_iff {s : β} (hs : s β 0) (a K z d : β) : | |
| z β€ ((a / s) ^ 2 / 6 + K) * (s ^ 2 * d) β | |
| z β€ (a ^ 2 / 6 + s ^ 2 * K) * d := by | |
| have h : ((a / s) ^ 2 / 6 + K) * (s ^ 2 * d) = (a ^ 2 / 6 + s ^ 2 * K) * d := by | |
| field_simp | |
| rw [h] | |
| theorem rescale_threshold_iff {s : β} (hs : 0 < s) (a R : β) : | |
| R < a / s β s * R < a := by | |
| rw [lt_div_iffβ hs, mul_comm R s] | |
| theorem numerical_conditions_insufficient (a k : β) : | |
| β v : Character, v.d = 1 β§ v.r = 0 β§ v.numerator a = 0 β§ | |
| 0 β€ v.discr β§ (a ^ 2 / 6 + k) * v.d < v.z := by | |
| refine β¨β¨0, 1, 0, (a ^ 2 / 6 + k) + 1β©, ?_β© | |
| simp [Character.numerator, Character.discr] | |
| end PrescribedCharges.Numerical | |
| end | |
| end OAI | |