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.

remove a simp lemma and swap an equality

+88 -125
+3 -3
analysis/Analysis/Section_11_2.lean
··· 118 118 sorry 119 119 120 120 /-- Example 11.2.6 -/ 121 - theorem PiecewiseConstantOn.of_const {f:ℝ → ℝ} {I: BoundedInterval} (h: ConstantOn f (I:Set ℝ)) : 121 + theorem ConstantOn.piecewiseConstantOn {f:ℝ → ℝ} {I: BoundedInterval} (h: ConstantOn f (I:Set ℝ)) : 122 122 PiecewiseConstantOn f I := by sorry 123 123 124 124 /-- Lemma 11.2.7 / Exercise 11.2.1 -/ ··· 166 166 ℝ := ∑ J ∈ P.intervals, constant_value_on f (J:Set ℝ) * |J|ₗ 167 167 168 168 theorem PiecewiseConstantWith.integ_congr {f g:ℝ → ℝ} {I: BoundedInterval} {P: Partition I} 169 - (h: ∀ x ∈ (I:Set ℝ), f x = g x) : PiecewiseConstantWith.integ f P = PiecewiseConstantWith.integ g P := by 169 + (h: ∀ x ∈ (I:Set ℝ), f x = g x) : integ f P = integ g P := by 170 170 simp only [integ, Subtype.forall] 171 171 apply Finset.sum_congr rfl; intro J hJ; congr 1; apply constant_value_on_congr; intros 172 172 have := P.contains _ hJ; rw [subset_iff] at this ··· 222 222 simp [integ, h']; exact PiecewiseConstantWith.integ_eq h'.choose_spec h 223 223 224 224 theorem PiecewiseConstantOn.integ_congr {f g:ℝ → ℝ} {I: BoundedInterval} 225 - (h: ∀ x ∈ (I:Set ℝ), f x = g x) : PiecewiseConstantOn.integ f I = PiecewiseConstantOn.integ g I := by 225 + (h: ∀ x ∈ (I:Set ℝ), f x = g x) : integ f I = integ g I := by 226 226 by_cases hf : PiecewiseConstantOn f I 227 227 <;> have hg := hf <;> rw [congr h] at hg <;> simp [integ, hf, hg] 228 228 rw [PiecewiseConstantWith.integ_congr h, ←integ_def hg.choose_spec, ←integ_def ?_]
+3 -3
analysis/Analysis/Section_11_3.lean
··· 46 46 simp 47 47 refine ⟨ fun _ ↦ M , ⟨ ⟨ ?_, ?_, ⟩, PiecewiseConstantOn.integ_const M I ⟩ ⟩ 48 48 . peel h with _ _ h'; simp [abs_le'] at h'; simp [h'.1] 49 - exact PiecewiseConstantOn.of_const (ConstantOn.of_const (c := M) (by simp)) 49 + exact (ConstantOn.of_const (c := M) (by simp)).piecewiseConstantOn 50 50 51 51 lemma integral_bound_lower_of_bounded {f:ℝ → ℝ} {M:ℝ} {I: BoundedInterval} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) : -M * |I|ₗ ∈ (fun g ↦ PiecewiseConstantOn.integ g I) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I} := by 52 52 simp 53 53 refine ⟨ fun _ ↦ -M , ⟨ ⟨ ?_, ?_, ⟩, by convert PiecewiseConstantOn.integ_const (-M) I using 1; simp ⟩ ⟩ 54 54 . peel h with _ _ h'; simp [abs_le'] at h'; simp; linarith 55 - exact PiecewiseConstantOn.of_const (ConstantOn.of_const (c := -M) (by simp)) 55 + exact (ConstantOn.of_const (c := -M) (by simp)).piecewiseConstantOn 56 56 57 57 lemma integral_bound_upper_nonempty {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) : ((fun g ↦ PiecewiseConstantOn.integ g I) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by 58 58 obtain ⟨ _, h ⟩ := h; exact Set.nonempty_of_mem (integral_bound_upper_of_bounded h) ··· 142 142 IntegrableOn f I ∧ integ f I = 0 := by 143 143 have _ := length_of_subsingleton.mpr hI 144 144 have hconst : ConstantOn f I := ConstantOn.of_subsingleton 145 - convert integ_of_piecewise_const (PiecewiseConstantOn.of_const hconst) 145 + convert integ_of_piecewise_const hconst.piecewiseConstantOn 146 146 simp [PiecewiseConstantOn.integ_const' hconst, hI] 147 147 148 148 /-- Definition 11.3.9 (Riemann sums). The restriction to positive length J is not needed thanks to various junk value conventions. -/
+4 -4
analysis/Analysis/Section_11_4.lean
··· 186 186 have : ∃ f', MinorizesOn f' f I ∧ PiecewiseConstantOn f' I ∧ integ f I - ε < PiecewiseConstantOn.integ f' I ∧ MajorizesOn f' 0 I := by 187 187 obtain ⟨ f', hf'min, hf'const, hf'int ⟩ := gt_of_lt_lower_integral hf.1 (show integ f I - ε < lower_integral f I by linarith) 188 188 use max f' 0 189 - have hzero := PiecewiseConstantOn.of_const (ConstantOn.of_const' 0 I) 189 + have hzero := (ConstantOn.of_const' 0 I).piecewiseConstantOn 190 190 and_intros 191 191 . peel hf_nonneg with x hx _; specialize hf'min _ hx; aesop 192 192 . exact hf'const.max hzero ··· 196 196 have : ∃ g', MinorizesOn g' g I ∧ PiecewiseConstantOn g' I ∧ integ g I - ε < PiecewiseConstantOn.integ g' I ∧ MajorizesOn g' 0 I := by 197 197 obtain ⟨ g', hg'min, hg'const, hg'int ⟩ := gt_of_lt_lower_integral hg.1 (show integ g I - ε < lower_integral g I by linarith) 198 198 use max g' 0 199 - have hzero := PiecewiseConstantOn.of_const (ConstantOn.of_const' 0 I) 199 + have hzero := (ConstantOn.of_const' 0 I).piecewiseConstantOn 200 200 and_intros 201 201 . peel hg_nonneg with x hx _; specialize hg'min _ hx; aesop 202 202 . exact hg'const.max hzero ··· 206 206 have : ∃ f'', MajorizesOn f'' f I ∧ PiecewiseConstantOn f'' I ∧ PiecewiseConstantOn.integ f'' I < integ f I + ε ∧ MinorizesOn f'' (fun _ ↦ M₁) I := by 207 207 obtain ⟨ f'', hf''maj, hf''const, hf''int ⟩ := lt_of_gt_upper_integral hf.1 (show upper_integral f I < integ f I + ε by linarith) 208 208 use min f'' (fun _ ↦ M₁) 209 - have hM₁_piece := PiecewiseConstantOn.of_const (ConstantOn.of_const' M₁ I) 209 + have hM₁_piece := (ConstantOn.of_const' M₁ I).piecewiseConstantOn 210 210 and_intros 211 211 . peel hM₁ with x hx hM₁; rw [abs_le'] at hM₁ 212 212 specialize hf''maj _ hx; simp [hf''maj, hM₁.1] ··· 218 218 have : ∃ g'', MajorizesOn g'' g I ∧ PiecewiseConstantOn g'' I ∧ PiecewiseConstantOn.integ g'' I < integ g I + ε ∧ MinorizesOn g'' (fun _ ↦ M₂) I := by 219 219 obtain ⟨ g'', hg''maj, hg''const, hg''int ⟩ := lt_of_gt_upper_integral hg.1 (show upper_integral g I < integ g I + ε by linarith) 220 220 use min g'' (fun _ ↦ M₂) 221 - have hM₂_piece := PiecewiseConstantOn.of_const (ConstantOn.of_const' M₂ I) 221 + have hM₂_piece := (ConstantOn.of_const' M₂ I).piecewiseConstantOn 222 222 and_intros 223 223 . peel hM₂ with x hx hM₂; rw [abs_le'] at hM₂ 224 224 specialize hg''maj _ hx; simp [hg''maj, hM₂.1]
+4 -4
analysis/Analysis/Section_11_5.lean
··· 170 170 have h'const : PiecewiseConstantOn h' I := by 171 171 rw [of_join hjoin2 _]; and_intros 172 172 . rw [of_join hjoin1 _]; and_intros 173 - . exact of_const (ConstantOn.of_const h'const_left) 173 + . exact (ConstantOn.of_const h'const_left).piecewiseConstantOn 174 174 apply hhconst.congr' 175 175 intro x hx; simp [h', hx, mem_iff] 176 - exact of_const (ConstantOn.of_const h'const_right) 176 + exact (ConstantOn.of_const h'const_right).piecewiseConstantOn 177 177 have h'maj : MajorizesOn h' f I := by 178 178 intro x hx; by_cases hxI': x ∈ I' <;> simp [h', hxI'] 179 179 . solve_by_elim ··· 204 204 and_intros 205 205 . rw [of_join hjoin1 _] 206 206 and_intros 207 - . exact of_const (ConstantOn.of_const g'const_left) 207 + . exact (ConstantOn.of_const g'const_left).piecewiseConstantOn 208 208 apply hgconst.congr' 209 209 intro x hx; simp [g', hx, mem_iff] 210 - exact of_const (ConstantOn.of_const g'const_right) 210 + exact (ConstantOn.of_const g'const_right).piecewiseConstantOn 211 211 have g'maj : MinorizesOn g' f I := by 212 212 intro x hx; by_cases hxI': x ∈ I' <;> simp [g', hxI'] 213 213 . solve_by_elim
+73 -109
analysis/Analysis/Section_11_8.lean
··· 84 84 convert hf using 1 85 85 have h1 : .Ioo (x₀-ε) x₀ ∈ nhdsWithin x₀ (.Iio x₀) := by 86 86 convert inter_mem_nhdsWithin (t := .Ioo (x₀-ε) (x₀+ε)) _ _ 87 - . ext; simp; constructor 88 - . intro ⟨ h1, h2 ⟩; simp [h1, h2]; linarith 89 - aesop 87 + . ext; simp; exact ⟨ by intro ⟨ h1, h2 ⟩; simp [h1, h2]; linarith, by aesop ⟩ 90 88 apply Ioo_mem_nhds <;> linarith 91 89 rw [←nhdsWithin_inter_of_mem h1] 92 90 congr 1; simp [Set.Ioo_subset_Iio_self] ··· 96 94 (h : X ∈ nhds x₀) (hf: ContinuousWithinAt f X x₀) : 97 95 jump f x₀ = 0 := by 98 96 rw [mem_nhds_iff_exists_Ioo_subset] at h 99 - obtain ⟨ l, u, hx₀, hX ⟩ := h 100 - simp at hx₀ 101 - have hl : ∃ ε>0, .Ioc (x₀-ε) x₀ ⊆ X := by 102 - refine ⟨ x₀-l, by linarith, Set.Subset.trans ?_ hX ⟩ 103 - intro x hx; simp at hx ⊢; exact ⟨ hx.1, by linarith ⟩ 104 - have hu : ∃ ε>0, .Ico x₀ (x₀+ε) ⊆ X := by 105 - refine ⟨ u-x₀, by linarith, Set.Subset.trans ?_ hX ⟩ 106 - intro x hx; simp at hx ⊢; exact ⟨ by linarith, hx.2 ⟩ 97 + obtain ⟨ l, u, hx₀, hX ⟩ := h; simp at hx₀ 98 + have hl : ∃ ε>0, .Ioc (x₀-ε) x₀ ⊆ X := 99 + ⟨ x₀-l, by linarith, Set.Subset.trans (by intro _ _; simp_all; linarith) hX ⟩ 100 + have hu : ∃ ε>0, .Ico x₀ (x₀+ε) ⊆ X := 101 + ⟨ u-x₀, by linarith, Set.Subset.trans (by intro _ _; simp_all; linarith) hX ⟩ 107 102 simp [jump, left_lim_of_continuous hl hf, right_lim_of_continuous hu hf] 108 103 109 104 /-- Right limits exist for monotone functions -/ 110 105 theorem right_lim_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) : 111 106 Convergesto (.Ioi x₀) f (sInf (f '' .Ioi x₀)) x₀ := by 112 107 rw [Convergesto.iff, ←nhdsWithin.eq_1] 113 - apply MonotoneOn.tendsto_nhdsGT 114 - . apply hf.monotoneOn 115 - rw [bddBelow_def] 116 - use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 108 + apply (hf.monotoneOn _).tendsto_nhdsGT 109 + rw [bddBelow_def]; use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 117 110 118 111 theorem right_lim_of_monotone' {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) : 119 112 right_lim f x₀ = sInf (f '' .Ioi x₀) := right_lim_def (right_lim_of_monotone x₀ hf) ··· 122 115 theorem left_lim_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) : 123 116 Convergesto (.Iio x₀) f (sSup (f '' .Iio x₀)) x₀ := by 124 117 rw [Convergesto.iff, ←nhdsWithin.eq_1] 125 - apply MonotoneOn.tendsto_nhdsLT 126 - . apply hf.monotoneOn 127 - rw [bddAbove_def] 128 - use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 118 + apply (hf.monotoneOn _).tendsto_nhdsLT 119 + rw [bddAbove_def]; use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 129 120 130 121 theorem left_lim_of_monotone' {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) : 131 122 left_lim f x₀ = sSup (f '' .Iio x₀) := left_lim_def (left_lim_of_monotone x₀ hf) ··· 133 124 theorem jump_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) : 134 125 0 ≤ jump f x₀ := by 135 126 simp [jump, left_lim_of_monotone' x₀ hf, right_lim_of_monotone' x₀ hf] 136 - apply csSup_le (by simp) 137 - intro a ha 138 - apply le_csInf (by simp) 139 - intro b hb; simp at ha hb 140 - obtain ⟨ x, hx, rfl ⟩ := ha 141 - obtain ⟨ y, hy, rfl ⟩ := hb 127 + apply csSup_le (by simp); intro a ha 128 + apply le_csInf (by simp); intro b hb; simp at ha hb 129 + obtain ⟨ x, hx, rfl ⟩ := ha; obtain ⟨ y, hy, rfl ⟩ := hb 142 130 apply hf; linarith 143 131 144 132 theorem right_lim_le_left_lim_of_monotone {f:ℝ → ℝ} {a b:ℝ} (hab: a < b) ··· 148 136 calc 149 137 _ ≤ f ((a+b)/2) := by 150 138 apply ConditionallyCompleteLattice.csInf_le 151 - . rw [bddBelow_def] 152 - use f a; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 139 + . rw [bddBelow_def]; use f a; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 153 140 simp; use (a+b)/2; simp; linarith 154 141 _ ≤ _ := by 155 142 apply ConditionallyCompleteLattice.le_csSup 156 - . rw [bddAbove_def] 157 - use f b; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 143 + . rw [bddAbove_def]; use f b; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; linarith 158 144 simp; use (a+b)/2; simp; linarith 159 145 160 146 /-- Definition 11.8.1 -/ ··· 181 167 (hI : I ⊆ Ioo a b) (hα: ContinuousOn α (Ioo a b)) : 182 168 α[I]ₗ = α I.b - α I.a := by 183 169 have ha_left : left_lim α I.a = α I.a := by 184 - apply left_lim_of_continuous _ (hα.continuousWithinAt _) 185 - . refine ⟨ I.a - a, by linarith, ?_ ⟩ 186 - intro _; simp; intro h1 _; exact ⟨ h1, by linarith ⟩ 187 - simp [haa]; linarith 170 + apply left_lim_of_continuous _ (hα.continuousWithinAt (by simp [haa]; linarith)) 171 + exact ⟨ I.a - a, by linarith, by intro _; simp; intro _ _; and_intros <;> linarith ⟩ 188 172 have ha_right : right_lim α I.a = α I.a := by 189 - apply right_lim_of_continuous _ (hα.continuousWithinAt _) 190 - . refine ⟨ b - I.a, by linarith, ?_ ⟩ 191 - intro _; simp; intro _ h2; exact ⟨ by linarith, h2 ⟩ 192 - simp [haa]; linarith 173 + apply right_lim_of_continuous _ (hα.continuousWithinAt (by simp [haa]; linarith)) 174 + exact ⟨ b - I.a, by linarith, by intro _; simp; intro _ _; and_intros <;> linarith ⟩ 193 175 have hb_left : left_lim α I.b = α I.b := by 194 - apply left_lim_of_continuous _ (hα.continuousWithinAt _) 195 - . refine ⟨ I.b - a, by linarith, ?_ ⟩ 196 - intro _; simp; intro h1 _; exact ⟨ h1, by linarith ⟩ 197 - simp [hbb]; linarith 176 + apply left_lim_of_continuous _ (hα.continuousWithinAt (by simp [hbb]; linarith)) 177 + exact ⟨ I.b - a, by linarith, by intro _; simp; intro _ _; and_intros <;> linarith ⟩ 198 178 have hb_right : right_lim α I.b = α I.b := by 199 - apply right_lim_of_continuous _ (hα.continuousWithinAt _) 200 - . refine ⟨ b - I.b, by linarith, ?_ ⟩ 201 - intro _; simp; intro h1 h2; exact ⟨ by linarith, h2 ⟩ 202 - simp [hbb]; linarith 179 + apply right_lim_of_continuous _ (hα.continuousWithinAt (by simp [hbb]; linarith)) 180 + exact ⟨ b - I.b, by linarith, by intro _; simp; intro _ _; and_intros <;> linarith ⟩ 203 181 cases I with 204 182 | Icc _ _ => simp [α_length, hb_right, ha_left, hab] 205 183 | Ico _ _ => simp [α_length, hb_left, ha_left, hab] 206 184 | Ioc _ _ => simp [α_length, hb_right, ha_right, hab] 207 - | Ioo a' b' => simp [α_length, hb_left, ha_right]; intro h; simp [show a' = b' by linarith] 185 + | Ioo a' b' => simp [α_length, hb_left, ha_right]; intros; simp [show a' = b' by linarith] 208 186 209 187 /-- Example 11.8.2-/ 210 188 example : (fun x ↦ x^2)[Icc 2 3]ₗ = 5 := by ··· 222 200 sorry 223 201 224 202 /-- An improved version of BoundedInterval.joins that also controls α-length. -/ 225 - abbrev BoundedInterval.joins' (K I J: BoundedInterval) : Prop := 226 - K.joins I J ∧ ∀ α:ℝ → ℝ, α[K]ₗ = α[I]ₗ + α[J]ₗ 203 + abbrev BoundedInterval.joins' (K I J: BoundedInterval) : Prop := K.joins I J ∧ ∀ α:ℝ → ℝ, α[K]ₗ = α[I]ₗ + α[J]ₗ 227 204 228 205 theorem BoundedInterval.join_Icc_Ioc' {a b c:ℝ} (hab: a ≤ b) (hbc: b ≤ c) : (Icc a c).joins' (Icc a b) (Ioc b c) := by 229 206 refine ⟨ join_Icc_Ioc hab hbc, ?_ ⟩ ··· 290 267 ℝ := if h: PiecewiseConstantOn f I then PiecewiseConstantWith.RS_integ f h.choose α else 0 291 268 292 269 theorem PiecewiseConstantOn.RS_integ_def {f:ℝ → ℝ} {I: BoundedInterval} {P: Partition I} 293 - (h: PiecewiseConstantWith f P) (α:ℝ → ℝ) : PiecewiseConstantOn.RS_integ f I α = PiecewiseConstantWith.RS_integ f P α := by 270 + (h: PiecewiseConstantWith f P) (α:ℝ → ℝ) : RS_integ f I α = PiecewiseConstantWith.RS_integ f P α := by 294 271 have h' : PiecewiseConstantOn f I := by use P 295 - simp [PiecewiseConstantOn.RS_integ, h'] 296 - exact PiecewiseConstantWith.RS_integ_eq h'.choose_spec h α 272 + simp [RS_integ, h']; exact PiecewiseConstantWith.RS_integ_eq h'.choose_spec h α 297 273 298 274 /-- α-length non-negative when α monotone -/ 299 275 theorem α_length_nonneg_of_monotone {α:ℝ → ℝ} (hα: Monotone α) (I: BoundedInterval): ··· 303 279 /-- Analogue of Theorem 11.2.16 (a) (Laws of integration) / Exercise 11.8.3 -/ 304 280 theorem PiecewiseConstantOn.RS_integ_add {f g: ℝ → ℝ} {I: BoundedInterval} 305 281 (hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) {α:ℝ → ℝ} (hα: Monotone α): 306 - PiecewiseConstantOn.RS_integ (f + g) I α = PiecewiseConstantOn.RS_integ f I α + PiecewiseConstantOn.RS_integ g I α := by 282 + RS_integ (f + g) I α = RS_integ f I α + RS_integ g I α := by 307 283 sorry 308 284 309 285 /-- Analogue of Theorem 11.2.16 (b) (Laws of integration) / Exercise 11.8.3 -/ 310 286 theorem PiecewiseConstantOn.RS_integ_smul {f: ℝ → ℝ} {I: BoundedInterval} (c:ℝ) 311 287 (hf: PiecewiseConstantOn f I) {α:ℝ → ℝ} (hα: Monotone α) : 312 - PiecewiseConstantOn.RS_integ (c • f) I α = c * PiecewiseConstantOn.RS_integ f I α 288 + RS_integ (c • f) I α = c * RS_integ f I α 313 289 := by 314 290 sorry 315 291 ··· 317 293 theorem PiecewiseConstantOn.RS_integ_sub {f g: ℝ → ℝ} {I: BoundedInterval} 318 294 {α:ℝ → ℝ} (hα: Monotone α) 319 295 (hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) : 320 - PiecewiseConstantOn.RS_integ (f - g) I α = PiecewiseConstantOn.RS_integ f I α - PiecewiseConstantOn.RS_integ g I α := by 296 + RS_integ (f - g) I α = RS_integ f I α - RS_integ g I α := by 321 297 sorry 322 298 323 299 /-- Theorem 11.8.8 (d) (Laws of RS integration) / Exercise 11.8.8 -/ 324 300 theorem PiecewiseConstantOn.RS_integ_of_nonneg {f: ℝ → ℝ} {I: BoundedInterval} 325 301 {α:ℝ → ℝ} (hα: Monotone α) 326 302 (h: ∀ x ∈ I, 0 ≤ f x) (hf: PiecewiseConstantOn f I) : 327 - 0 ≤ PiecewiseConstantOn.RS_integ f I α := by 303 + 0 ≤ RS_integ f I α := by 328 304 sorry 329 305 330 306 /-- Theorem 11.8.8 (e) (Laws of RS integration) / Exercise 11.8.8 -/ 331 307 theorem PiecewiseConstantOn.RS_integ_mono {f g: ℝ → ℝ} {I: BoundedInterval} 332 308 {α:ℝ → ℝ} (hα: Monotone α) 333 309 (h: ∀ x ∈ I, f x ≤ g x) (hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) : 334 - PiecewiseConstantOn.RS_integ f I α ≤ PiecewiseConstantOn.RS_integ g I α := by 310 + RS_integ f I α ≤ RS_integ g I α := by 335 311 sorry 336 312 337 313 /-- Theorem 11.8.8 (f) (Laws of RS integration) / Exercise 11.8.8 -/ 338 314 theorem PiecewiseConstantOn.RS_integ_const (c: ℝ) (I: BoundedInterval) {α:ℝ → ℝ} (hα: Monotone α) : 339 - PiecewiseConstantOn.RS_integ (fun _ ↦ c) I α = c * α[I]ₗ := by 315 + RS_integ (fun _ ↦ c) I α = c * α[I]ₗ := by 340 316 sorry 341 317 342 318 /-- Theorem 11.8.8 (f) (Laws of RS integration) / Exercise 11.8.8 -/ 343 319 theorem PiecewiseConstantOn.RS_integ_const' {f:ℝ → ℝ} {I: BoundedInterval} 344 320 {α:ℝ → ℝ} (hα: Monotone α) (h: ConstantOn f I) : 345 - PiecewiseConstantOn.RS_integ f I α = (constant_value_on f I) * α[I]ₗ := by 321 + RS_integ f I α = (constant_value_on f I) * α[I]ₗ := by 346 322 sorry 347 323 348 324 open Classical in ··· 356 332 /-- Theorem 11.8.8 (g) (Laws of RS integration) / Exercise 11.8.8 -/ 357 333 theorem PiecewiseConstantOn.RS_integ_of_extend {I J: BoundedInterval} (hIJ: I ⊆ J) 358 334 {f: ℝ → ℝ} (h: PiecewiseConstantOn f I) {α:ℝ → ℝ} (hα: Monotone α): 359 - PiecewiseConstantOn.RS_integ (fun x ↦ if x ∈ I then f x else 0) J α = PiecewiseConstantOn.RS_integ f I α := by 335 + RS_integ (fun x ↦ if x ∈ I then f x else 0) J α = RS_integ f I α := by 360 336 sorry 361 337 362 338 /-- Theorem 11.8.8 (h) (Laws of RS integration) / Exercise 11.8.8 -/ 363 339 theorem PiecewiseConstantOn.RS_integ_of_join {I J K: BoundedInterval} (hIJK: K.joins' I J) 364 340 {f: ℝ → ℝ} (h: PiecewiseConstantOn f K) {α:ℝ → ℝ} (hα: Monotone α): 365 - PiecewiseConstantOn.RS_integ f K α = PiecewiseConstantOn.RS_integ f I α + PiecewiseConstantOn.RS_integ f J α := by 341 + RS_integ f K α = RS_integ f I α + RS_integ f J α := by 366 342 sorry 367 343 368 344 /-- Analogue of Definition 11.3.2 (Uppper and lower Riemann integrals )-/ 369 345 noncomputable abbrev upper_RS_integral (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ): ℝ := 370 - sInf ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) 346 + sInf ((PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) 371 347 372 348 noncomputable abbrev lower_RS_integral (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ): ℝ := 373 - sSup ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) 349 + sSup ((PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) 374 350 375 351 lemma RS_integral_bound_upper_of_bounded {f:ℝ → ℝ} {M:ℝ} {I: BoundedInterval} 376 352 (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) {α:ℝ → ℝ} (hα:Monotone α) 377 - : M * α[I]ₗ ∈ (fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I} := by 378 - simp 379 - refine ⟨ fun _ ↦ M, ⟨ ⟨ ?_, ?_, ⟩, PiecewiseConstantOn.RS_integ_const M I hα ⟩ ⟩ 380 - . peel h with x hx h; simp_all [abs_le'] 381 - apply PiecewiseConstantOn.of_const (ConstantOn.of_const (c := M) (by simp)) 353 + : M * α[I]ₗ ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I} := by 354 + simp; refine ⟨ fun _ ↦ M, ⟨ ⟨ ?_, ?_ ⟩, PiecewiseConstantOn.RS_integ_const M I hα ⟩ ⟩ 355 + . peel h with _ _ _; simp_all [abs_le'] 356 + exact (ConstantOn.of_const (c := M) (by simp)).piecewiseConstantOn 382 357 383 358 384 359 lemma RS_integral_bound_lower_of_bounded {f:ℝ → ℝ} {M:ℝ} {I: BoundedInterval} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) {α:ℝ → ℝ} (hα:Monotone α) 385 - : -M * α[I]ₗ ∈ (fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I} := by 386 - simp 387 - refine ⟨ fun _ ↦ -M, ⟨ ⟨ ?_, ?_, ⟩, ?_ ⟩ ⟩ 388 - . peel h with x hx h'; simp [abs_le'] at *; linarith 389 - . apply PiecewiseConstantOn.of_const (ConstantOn.of_const (c := -M) (by simp)) 390 - convert PiecewiseConstantOn.RS_integ_const _ _ hα using 1 391 - simp 360 + : -M * α[I]ₗ ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I} := by 361 + simp; refine ⟨ fun _ ↦ -M, ⟨ ⟨ ?_, ?_ ⟩, by convert PiecewiseConstantOn.RS_integ_const _ _ hα using 1; simp ⟩ ⟩ 362 + . peel h with _ _ _; simp [abs_le'] at *; linarith 363 + exact (ConstantOn.of_const (c := -M) (by simp)).piecewiseConstantOn 364 + 392 365 393 366 lemma RS_integral_bound_upper_nonempty {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) 394 367 {α:ℝ → ℝ} (hα: Monotone α) : 395 - ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by 396 - obtain ⟨ M, h ⟩ := h 397 - exact Set.nonempty_of_mem (RS_integral_bound_upper_of_bounded h hα) 368 + ((PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by 369 + obtain ⟨ M, h ⟩ := h; exact Set.nonempty_of_mem (RS_integral_bound_upper_of_bounded h hα) 398 370 399 371 lemma RS_integral_bound_lower_nonempty {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) 400 372 {α:ℝ → ℝ} (hα: Monotone α) : 401 - ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by 402 - obtain ⟨ M, h ⟩ := h 403 - exact Set.nonempty_of_mem (RS_integral_bound_lower_of_bounded h hα) 373 + ((PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by 374 + obtain ⟨ M, h ⟩ := h; exact Set.nonempty_of_mem (RS_integral_bound_lower_of_bounded h hα) 404 375 405 376 lemma RS_integral_bound_lower_le_upper {f:ℝ → ℝ} {I: BoundedInterval} {a b:ℝ} 406 377 {α:ℝ → ℝ} (hα: Monotone α) 407 - (ha: a ∈ (fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) 408 - (hb: b ∈ (fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) 378 + (ha: a ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) 379 + (hb: b ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) 409 380 : b ≤ a:= by 410 381 obtain ⟨ g, ⟨ ⟨ hmaj, hgp⟩, hgi ⟩ ⟩ := ha 411 382 obtain ⟨ h, ⟨ ⟨ hmin, hhp⟩, hhi ⟩ ⟩ := hb 412 - rw [←hgi, ←hhi] 413 - apply hhp.RS_integ_mono hα _ hgp 414 - intro x hx; exact (ge_iff_le.mp (hmin _ hx)).trans (hmaj _ hx) 383 + rw [←hgi, ←hhi]; apply hhp.RS_integ_mono hα _ hgp; intro _ hx; linarith [hmin _ hx, hmaj _ hx] 415 384 416 385 lemma RS_integral_bound_below {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) 417 386 {α:ℝ → ℝ} (hα: Monotone α) : 418 - BddBelow ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) := by 419 - rw [bddBelow_def] 420 - use (RS_integral_bound_lower_nonempty h hα).some 387 + BddBelow ((PiecewiseConstantOn.RS_integ · I α) '' 388 + {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) := by 389 + rw [bddBelow_def]; use (RS_integral_bound_lower_nonempty h hα).some 421 390 intro a ha; exact RS_integral_bound_lower_le_upper hα ha (RS_integral_bound_lower_nonempty h hα).some_mem 422 391 423 392 lemma RS_integral_bound_above {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) 424 393 {α:ℝ → ℝ} (hα: Monotone α): 425 - BddAbove ((fun g ↦ PiecewiseConstantOn.RS_integ g I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) := by 426 - rw [bddAbove_def] 427 - use (RS_integral_bound_upper_nonempty h hα).some 394 + BddAbove ((PiecewiseConstantOn.RS_integ · I α) '' 395 + {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) := by 396 + rw [bddAbove_def]; use (RS_integral_bound_upper_nonempty h hα).some 428 397 intro b hb; exact RS_integral_bound_lower_le_upper hα (RS_integral_bound_upper_nonempty h hα).some_mem hb 429 398 430 399 lemma le_lower_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} {M:ℝ} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) 431 400 {α:ℝ → ℝ} (hα: Monotone α) : 432 - -M * α[I]ₗ ≤ lower_RS_integral f I α := by 433 - exact ConditionallyCompleteLattice.le_csSup _ _ 401 + -M * α[I]ₗ ≤ lower_RS_integral f I α := 402 + ConditionallyCompleteLattice.le_csSup _ _ 434 403 (RS_integral_bound_above (BddOn.of_bounded h) hα) (RS_integral_bound_lower_of_bounded h hα) 435 404 436 405 lemma lower_RS_integral_le_upper {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I) 437 406 {α:ℝ → ℝ} (hα: Monotone α) : 438 407 lower_RS_integral f I α ≤ upper_RS_integral f I α := by 439 408 apply ConditionallyCompleteLattice.csSup_le _ _ (RS_integral_bound_lower_nonempty h hα) _ 440 - rw [mem_upperBounds] 441 - intros 409 + rw [mem_upperBounds]; intros 442 410 apply ConditionallyCompleteLattice.le_csInf _ _ (RS_integral_bound_upper_nonempty h hα) _ 443 - rw [mem_lowerBounds] 444 - intros; solve_by_elim [RS_integral_bound_lower_le_upper] 411 + rw [mem_lowerBounds]; intros; solve_by_elim [RS_integral_bound_lower_le_upper] 445 412 446 413 lemma RS_upper_integral_le {f:ℝ → ℝ} {I: BoundedInterval} {M:ℝ} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) 447 414 {α:ℝ → ℝ} (hα: Monotone α) : 448 - upper_RS_integral f I α ≤ M * α[I]ₗ := by 449 - exact ConditionallyCompleteLattice.csInf_le _ _ 415 + upper_RS_integral f I α ≤ M * α[I]ₗ := 416 + ConditionallyCompleteLattice.csInf_le _ _ 450 417 (RS_integral_bound_below (.of_bounded h) hα) (RS_integral_bound_upper_of_bounded h hα) 451 418 452 419 lemma upper_RS_integral_le_integ {f g:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I) 453 420 (hfg: MajorizesOn g f I) (hg: PiecewiseConstantOn g I) 454 421 {α:ℝ → ℝ} (hα: Monotone α) : 455 - upper_RS_integral f I α ≤ PiecewiseConstantOn.RS_integ g I α := by 456 - apply ConditionallyCompleteLattice.csInf_le _ _ (RS_integral_bound_below hf hα) _ 457 - use g; simpa [hg] 422 + upper_RS_integral f I α ≤ PiecewiseConstantOn.RS_integ g I α := 423 + ConditionallyCompleteLattice.csInf_le _ _ (RS_integral_bound_below hf hα) ⟨ g, by simpa [hg] ⟩ 458 424 459 425 lemma integ_le_lower_RS_integral {f h:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I) 460 426 (hfh: MinorizesOn h f I) (hg: PiecewiseConstantOn h I) 461 427 {α:ℝ → ℝ} (hα: Monotone α) : 462 - PiecewiseConstantOn.RS_integ h I α ≤ lower_RS_integral f I α := by 463 - apply ConditionallyCompleteLattice.le_csSup _ _ (RS_integral_bound_above hf hα) _ 464 - use h; simpa [hg] 428 + PiecewiseConstantOn.RS_integ h I α ≤ lower_RS_integral f I α := 429 + ConditionallyCompleteLattice.le_csSup _ _ (RS_integral_bound_above hf hα) ⟨ h, by simpa [hg] ⟩ 465 430 466 431 lemma lt_of_gt_upper_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I) 467 432 {α: ℝ → ℝ} (hα: Monotone α) {X:ℝ} (hX: upper_RS_integral f I α < X ) : 468 433 ∃ g, MajorizesOn g f I ∧ PiecewiseConstantOn g I ∧ PiecewiseConstantOn.RS_integ g I α < X := by 469 - obtain ⟨ Y, hY, hYX ⟩ := exists_lt_of_csInf_lt (RS_integral_bound_upper_nonempty hf hα) hX 434 + have ⟨ Y, hY, hYX ⟩ := exists_lt_of_csInf_lt (RS_integral_bound_upper_nonempty hf hα) hX 470 435 simp at hY; obtain ⟨ g, ⟨ hmaj, hgp ⟩, hgi ⟩ := hY; exact ⟨ g, hmaj, hgp, by rwa [hgi] ⟩ 471 436 472 437 lemma gt_of_lt_lower_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I) 473 438 {α:ℝ → ℝ} (hα: Monotone α) {X:ℝ} (hX: X < lower_RS_integral f I α) : 474 439 ∃ h, MinorizesOn h f I ∧ PiecewiseConstantOn h I ∧ X < PiecewiseConstantOn.RS_integ h I α := by 475 - obtain ⟨ Y, hY, hYX ⟩ := exists_lt_of_lt_csSup (RS_integral_bound_lower_nonempty hf hα) hX 440 + have ⟨ Y, hY, hYX ⟩ := exists_lt_of_lt_csSup (RS_integral_bound_lower_nonempty hf hα) hX 476 441 simp at hY; obtain ⟨ h, ⟨ hmin, hhp ⟩, hhi ⟩ := hY; exact ⟨ h, hmin, hhp, by rwa [hhi] ⟩ 477 442 478 443 /-- Analogue of Definition 11.3.4 -/ 479 - noncomputable abbrev RS_integ (f:ℝ → ℝ) (I: BoundedInterval) (α:ℝ → ℝ) : ℝ := 480 - upper_RS_integral f I α 444 + noncomputable abbrev RS_integ (f:ℝ → ℝ) (I: BoundedInterval) (α:ℝ → ℝ) : ℝ := upper_RS_integral f I α 481 445 482 446 noncomputable abbrev RS_IntegrableOn (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ) : Prop := 483 447 BddOn f I ∧ lower_RS_integral f I α = upper_RS_integral f I α
-1
analysis/Analysis/Section_3_1.lean
··· 224 224 theorem SetTheory.Set.pair_uniq (a b:Object) : ∃! (X:Set), ∀ x, x ∈ X ↔ x = a ∨ x = b := by sorry 225 225 226 226 /-- Remark 3.1.8 -/ 227 - @[simp] 228 227 theorem SetTheory.Set.pair_comm (a b:Object) : ({a,b}:Set) = {b,a} := by sorry 229 228 230 229 /-- Remark 3.1.8 -/
+1 -1
analysis/Analysis/Section_3_4.lean
··· 25 25 26 26 /-- Definition 3.4.1. Interestingly, the definition does not require S to be a subset of X. -/ 27 27 abbrev SetTheory.Set.image {X Y:Set} (f:X → Y) (S: Set) : Set := 28 - X.replace (P := fun x y ↦ y = f x ∧ x.val ∈ S) (by simp_all) 28 + X.replace (P := fun x y ↦ f x = y ∧ x.val ∈ S) (by simp_all) 29 29 30 30 /-- Definition 3.4.1 -/ 31 31 theorem SetTheory.Set.mem_image {X Y:Set} (f:X → Y) (S: Set) (y:Object) :