My solutions to Tao's Analysis I, formalized in Lean
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at solutions 194 lines 8.5 kB view raw
1import Mathlib.Tactic 2import Analysis.Section_5_epilogue 3import Analysis.Section_6_6 4 5/-! 6# Analysis I, Section 6.7: Real exponentiation, part II 7 8I have attempted to make the translation as faithful a paraphrasing as possible of the original 9text. When there is a choice between a more idiomatic Lean solution and a more faithful 10translation, I have generally chosen the latter. In particular, there will be places where the 11Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided 12doing so. 13 14Main constructions and results of this section: 15 16- Real exponentiation. 17 18Because the Chapter 5 reals have been deprecated in favor of the Mathlib reals, and Mathlib real 19exponentiation is defined without first going through rational exponentiation, we will adopt a 20somewhat awkward compromise, in that we will initially accept the Mathlib exponentiation operation 21(with all its API) when the exponent is a rational, and use this to define a notion of real 22exponentiation which in the epilogue to this chapter we will show is identical to the Mathlib operation. 23-/ 24 25namespace Chapter6 26 27/-- Lemma 6.7.1 (Continuity of exponentiation) -/ 28lemma ratPow_continuous {x α:} (hx: x > 0) {q: } 29 (hq: ((fun n (q n:)):Sequence).TendsTo α) : 30 ((fun n x^(q n:)):Sequence).Convergent := by 31 -- This proof is rearranged slightly from the original text. 32 obtain M, hM, hbound := Sequence.bounded_of_convergent α, hq 33 rcases lt_trichotomy x 1 with h | rfl | h 34 . sorry 35 . simp; exact 1, Sequence.lim_of_const 1 36 have h': 1 x := by linarith 37 rw [Sequence.Cauchy_iff_convergent] 38 intro ε 39 obtain K, hK, hclose := Sequence.lim_of_roots hx (ε*x^(-M)) (by positivity) 40 obtain N, hN, hq := Sequence.IsCauchy.convergent α, hq (1/(K+1:)) (by positivity) 41 simp [Real.CloseSeq, Real.dist_eq] at hclose hK hN 42 lift N to using hN 43 lift K to using hK 44 specialize hclose K (by simp) (by simp); simp at hclose 45 use N, (by simp) 46 intro n hn m hm; simp at hn hm 47 specialize hq n (by simp [hn]) m (by simp [hm]) 48 simp [Real.Close, hn, hm, Real.dist_eq] at hq 49 have : 0 (N:) := by simp 50 lift n to using (by linarith) 51 lift m to using (by linarith) 52 simp at hn hm hq 53 rcases le_or_gt (q m) (q n) with hqq | hqq 54 . replace : x^(q m:) x^(q n:) := by rw [Real.rpow_le_rpow_left_iff h]; norm_cast 55 rw [abs_of_nonneg (by linarith)] 56 calc 57 _ = x^(q m:) * (x^(q n - q m:) - 1) := by 58 ring_nf; rw [Real.rpow_add (by linarith)]; ring_nf 59 _ x^M * (x^(1/(K+1:)) - 1) := by 60 gcongr <;> try exact h' 61 . rw [sub_nonneg]; apply Real.one_le_rpow h' (by norm_cast; linarith) 62 . specialize hbound m; simp_all [abs_le'] 63 rw [abs_le'] at hq; convert hq.1 using 1; field_simp 64 _ x^M * (ε * x^(-M)) := by gcongr; simp_all [abs_le'] 65 _ = ε := by rw [mul_comm, mul_assoc, Real.rpow_add (by linarith)]; simp 66 replace : x^(q n:) x^(q m:) := by rw [Real.rpow_le_rpow_left_iff h]; norm_cast; linarith 67 rw [abs_of_nonpos (by linarith)] 68 calc 69 _ = x^(q n:) * (x^(q m - q n:) - 1) := by ring_nf; rw [Real.rpow_add (by linarith)]; ring_nf 70 _ x^M * (x^(1/(K+1:)) - 1) := by 71 gcongr <;> try exact h' 72 . rw [sub_nonneg]; apply Real.one_le_rpow h' (by norm_cast; linarith) 73 . specialize hbound n; simp_all [abs_le'] 74 rw [abs_le'] at hq; convert hq.2 using 1 <;> simp 75 _ x^M * (ε * x^(-M)) := by gcongr; simp_all [abs_le'] 76 _ = ε := by rw [mul_comm, mul_assoc, Real.rpow_add (by linarith)]; simp 77 78 79lemma ratPow_lim_uniq {x α:} (hx: x > 0) {q q': } 80 (hq: ((fun n (q n:)):Sequence).TendsTo α) 81 (hq': ((fun n (q' n:)):Sequence).TendsTo α) : 82 lim ((fun n x^(q n:)):Sequence) = lim ((fun n x^(q' n:)):Sequence) := by 83 -- This proof is written to follow the structure of the original text. 84 set r := q - q' 85 suffices : (fun n x^(r n:):Sequence).TendsTo 1 86 . rw [mul_one (lim ((fun n x^(q' n:)):Sequence))] 87 rw [Sequence.lim_eq] at this 88 convert (Sequence.lim_mul (b := (fun n x^(r n:):Sequence)) (ratPow_continuous hx hq') this.1).2 89 . rw [Sequence.mul_coe] 90 rcongr _ n 91 rw [Real.rpow_add (by linarith)] 92 simp [r] 93 rw [this.2] 94 intro ε 95 have h1 := Sequence.lim_of_roots hx 96 have h2 := Sequence.tendsTo_inv h1 (by norm_num) 97 obtain K1, hK1, h3 := h1 ε 98 obtain K2, hK2, h4 := h2 ε 99 simp [Inv.inv, Sequence.inv_coe] at hK1 hK2 100 lift K1 to using hK1 101 lift K2 to using hK2 102 simp [Sequence.inv_coe] at h4 103 set K := max K1 K2 104 have hr := Sequence.tendsTo_sub hq hq' 105 rw [Sequence.sub_coe] at hr 106 obtain N, hN, hr := hr (1 / (K + 1:)) (by positivity) 107 refine N, by simp_all, ?_ 108 intro n hn; simp at hn 109 specialize h3 K (by simp [K]) 110 specialize h4 K (by simp [K]) 111 simp [hn, Real.dist_eq, abs_le', K, -Nat.cast_max] at h3 h4 112 specialize hr n (by simp [hn]) 113 simp [Real.Close, hn, abs_le'] at hr 114 rcases lt_trichotomy x 1 with h | rfl | h 115 . sorry 116 . simp; linarith 117 have h5 : x ^ (r n.toNat:) x^(K + 1:)⁻¹ := by gcongr; linarith; simp_all [r] 118 have h6 : (x^(K + 1:)⁻¹)⁻¹ x ^ (r n.toNat:) := by 119 rw [Real.rpow_neg (by linarith)] 120 gcongr; linarith 121 simp [r]; linarith 122 constructor <;> linarith 123 124theorem Real.eq_lim_of_rat (α:) : q: , ((fun n (q n:)):Sequence).TendsTo α := by 125 obtain q, hcauchy, hLIM := Chapter5.Real.eq_lim (Chapter5.Real.equivR.symm α); use q 126 replace hcauchy := Sequence.lim_eq_LIM hcauchy 127 simp only [hLIM, Equiv.apply_symm_apply] at hcauchy 128 convert hcauchy; aesop 129 130/-- Definition 6.7.2 (Exponentiation to a real exponent) -/ 131noncomputable abbrev Real.rpow (x:) (α:) : := lim ((fun n x^((eq_lim_of_rat α).choose n:)):Sequence) 132 133lemma Real.rpow_eq_lim_ratPow {x α:} (hx: x > 0) {q: } 134 (hq: ((fun n (q n:)):Sequence).TendsTo α) : 135 rpow x α = lim ((fun n x^(q n:)):Sequence) := 136 ratPow_lim_uniq hx (eq_lim_of_rat α).choose_spec hq 137 138 139lemma Real.ratPow_tendsto_rpow {x α:} (hx: x > 0) {q: } 140 (hq: ((fun n (q n:)):Sequence).TendsTo α) : 141 ((fun n x^(q n:)):Sequence).TendsTo (rpow x α) := by 142 rw [Sequence.lim_eq] 143 exact ratPow_continuous hx hq, (Real.rpow_eq_lim_ratPow hx hq).symm 144 145lemma Real.rpow_of_rat_eq_ratPow {x:} (hx: x > 0) {q: } : 146 rpow x (q:) = x^(q:) := by 147 convert rpow_eq_lim_ratPow hx (α := q) (Sequence.lim_of_const _) 148 exact (Sequence.lim_eq.mp (Sequence.lim_of_const _)).2.symm 149 150/-- Proposition 6.7.3(a) / Exercise 6.7.1 -/ 151theorem Real.ratPow_nonneg {x:} (hx: x > 0) (q:) : rpow x q 0 := by 152 sorry 153 154/-- Proposition 6.7.3(b) -/ 155theorem Real.ratPow_add {x:} (hx: x > 0) (q r:) : rpow x (q+r) = rpow x q * rpow x r := by 156 obtain q', hq' := eq_lim_of_rat q 157 obtain r', hr' := eq_lim_of_rat r 158 have hq'r' := Sequence.tendsTo_add hq' hr' 159 rw [Sequence.add_coe] at hq'r' 160 convert_to ((fun n ((q' n + r' n:):)):Sequence).TendsTo (q + r) at hq'r' 161 . rcongr _ n; simp 162 have h1 := ratPow_continuous hx hq' 163 have h2 := ratPow_continuous hx hr' 164 rw [rpow_eq_lim_ratPow hx hq', rpow_eq_lim_ratPow hx hr', 165 rpow_eq_lim_ratPow hx hq'r', (Sequence.lim_mul h1 h2).2, 166 Sequence.mul_coe] 167 rcongr n; rw [Real.rpow_add (by linarith)]; simp 168 169 170/-- Proposition 6.7.3(b) / Exercise 6.7.1 -/ 171theorem Real.ratPow_ratPow {x:} (hx: x > 0) (q r:) : rpow (rpow x q) r = rpow x (q*r) := by 172 sorry 173 174/-- Proposition 6.7.3(c) / Exercise 6.7.1 -/ 175theorem Real.ratPow_neg {x:} (hx: x > 0) (q:) : rpow x (-q) = 1 / rpow x q := by 176 sorry 177 178/-- Proposition 6.7.3(d) / Exercise 6.7.1 -/ 179theorem Real.ratPow_mono {x y:} (hx: x > 0) (hy: y > 0) {q:} (h: q > 0) : x > y rpow x q > rpow y q := by 180 sorry 181 182/-- Proposition 6.7.3(e) / Exercise 6.7.1 -/ 183theorem Real.ratPow_mono_of_gt_one {x:} (hx: x > 1) {q r:} : rpow x q > rpow x r q > r := by 184 sorry 185 186/-- Proposition 6.7.3(e) / Exercise 6.7.1 -/ 187theorem Real.ratPow_mono_of_lt_one {x:} (hx0: 0 < x) (hx: x < 1) {q r:} : rpow x q < rpow x r q < r := by 188 sorry 189 190/-- Proposition 6.7.3(f) / Exercise 6.7.1 -/ 191theorem Real.ratPow_mul {x y:} (hx: x > 0) (hy: y > 0) (q:) : rpow (x*y) q = rpow x q * rpow y q := by 192 sorry 193 194end Chapter6