diff --git a/Analysis/Appendix_A_1.lean b/Analysis/Appendix_A_1.lean index d90d81fab..b0a881a4b 100644 --- a/Analysis/Appendix_A_1.lean +++ b/Analysis/Appendix_A_1.lean @@ -188,10 +188,10 @@ example {X Y Z:Prop} (hXY: X ↔ Y) (hXZ: X ↔ Z) : [X,Y,Z].TFAE := by tfae_have 1 ↔ 3 := by exact hXZ -- This line is optional tfae_finish -/-- Note for the {name (full := List.TFAE.out)}`out` method that one indexes starting from 0, in -contrast to the {tactic}`tfae_have` tactic. -/ +/-- Note that the {name (full := List.TFAE.out)}`out` method indexes starting from 1, just like +the {tactic}`tfae_have` tactic. -/ example {X Y Z:Prop} (h: [X,Y,Z].TFAE) : X ↔ Y := by - exact h.out 0 1 + exact h.out 1 2 /-- Exercise A.1.1. Fill in the first {syntax term}`sorry` with something reasonable. -/ example {X Y:Prop} : ¬ ((X ∨ Y) ∧ ¬ (X ∧ Y)) ↔ sorry := by sorry diff --git a/Analysis/Appendix_A_2.lean b/Analysis/Appendix_A_2.lean index 216fb972a..53a3e46a2 100644 --- a/Analysis/Appendix_A_2.lean +++ b/Analysis/Appendix_A_2.lean @@ -34,7 +34,7 @@ example : (3:ℤ) = 2 → (3:ℤ)^2 = 4 := example_A_2_1 3 example : (-2:ℤ) = 2 → (-2:ℤ)^2 = 4 := example_A_2_1 (-2) -#check _root_.not_imp +#check Classical.not_imp example : ¬ ((2+2=4) → (4+4)=2) := by rw [Classical.not_imp] @@ -66,7 +66,7 @@ example : ((2+2:ℤ)=5) → (4=(10-4:ℤ)) := by intro h have : (4 + 4:ℤ) = 10 := by replace h := congr(2*$h) - convert h using 1 + convert h using 1 <;> norm_num rwa [←eq_sub_iff_add_eq] at this /-- Theorem A.2.4 -/ diff --git a/Analysis/Appendix_A_6.lean b/Analysis/Appendix_A_6.lean index a8ca5b28a..ebaa0ab10 100644 --- a/Analysis/Appendix_A_6.lean +++ b/Analysis/Appendix_A_6.lean @@ -1,6 +1,7 @@ import Mathlib.Tactic import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv +import Mathlib.Analysis.Calculus.Deriv.MeanValue /-! # Analysis I, Appendix A.6: Some examples of proofs and quantifiers diff --git a/Analysis/Appendix_B_1.lean b/Analysis/Appendix_B_1.lean index 80afb6849..cd3de1ba6 100644 --- a/Analysis/Appendix_B_1.lean +++ b/Analysis/Appendix_B_1.lean @@ -56,7 +56,7 @@ abbrev Digit.mk {n:ℕ} (h: n < 10) : Digit := ⟨n, h⟩ theorem Digit.toNat_mk {n:ℕ} (h: n < 10) : (Digit.mk h:ℕ) = n := rfl @[simp] -theorem Digit.inj (d d':Digit) : d = d' ↔ (d:ℕ) = d' := by grind +theorem Digit.inj (d d':Digit) : d = d' ↔ (d:ℕ) = d' := Fin.ext_iff theorem Digit.mk_eq_iff (d:Digit) {n:ℕ} (h: n < 10) : d = mk h ↔ (d:ℕ) = n := by convert Digit.inj d (mk h) @@ -72,7 +72,7 @@ theorem Digit.mk_eq_iff (d:Digit) {n:ℕ} (h: n < 10) : d = mk h ↔ (d:ℕ) = n #check (9:Digit) theorem Digit.eq (n: Digit) : n = 0 ∨ n = 1 ∨ n = 2 ∨ n = 3 ∨ n = 4 ∨ n = 5 ∨ n = 6 ∨ n = 7 ∨ n = 8 ∨ n = 9 := by - fin_cases n <;> simp +decide + decide +revert /-- Definition B.1.2 -/ structure PosintDecimal where @@ -134,7 +134,7 @@ theorem PosintDecimal.ten_eq_ten : (mk' 1 [0] (by decide):ℕ) = 10 := by decide theorem PosintDecimal.digit_eq {d:Digit} (h: d ≠ 0) : (mk' d [] h:ℕ) = d := by - simp [toNat, mk'] + decide +revert theorem PosintDecimal.pos (p:PosintDecimal) : 0 < (p:ℕ) := by simp [toNat] @@ -188,6 +188,7 @@ theorem PosintDecimal.eq_append {p:PosintDecimal} (h: 2 ≤ p.digits.length) : rw [←p.digits.cons_head_tail p.nonempty] congr 1 convert (List.dropLast_append_getLast _).symm using 2; grind + rw [List.getLast_tail] simp [←List.length_pos_iff]; omega /-- Theorem B.1.4 (Uniqueness and existence of decimal representations) -/ @@ -198,8 +199,8 @@ theorem PosintDecimal.exists_unique (n:ℕ) : n > 0 → ∃! p:PosintDecimal, (p -- note: the variable `m` in the text is referred to as `m+1` here. clear n; intro m hind _ obtain hm | hm := lt_or_ge m 9 - . apply ExistsUnique.intro (mk' (.mk (show m+1 < 10 by omega)) [] (by simp [Digit.mk])) - . simp [mk', Digit.mk, toNat, Digit.toNat] + . apply ExistsUnique.intro (mk' (.mk (show m+1 < 10 by omega)) [] (Fin.ne_of_val_ne m.succ_ne_zero)) + . simp [mk', Digit.mk, toNat, Digit.toNat]; rfl intro d hd obtain hdl | hdl := lt_or_ge d.digits.length 2 . replace hdl : d.digits.length = 1 := by linarith [d.length_pos] @@ -210,18 +211,18 @@ theorem PosintDecimal.exists_unique (n:ℕ) : n > 0 → ∃! p:PosintDecimal, (p . simp [hdl, mk'] intro i hi₁ hi₂ replace hi₁ : i = 0 := by omega - simp [hi₁, mk', Digit.mk, hd] + simp [hi₁, mk', Digit.mk, hd]; rfl have : d.toNat ≥ 10 := calc _ ≥ (d.head:ℕ) * 10^(d.digits.length-1) := by set a : Fin d.digits.length := ⟨ d.digits.length - 1, by omega ⟩ + simp only [ge_iff_le, toNat] convert Finset.single_le_sum _ (Finset.mem_univ a) . simp [a, head, List.head_eq_getElem] . infer_instance intros; positivity _ ≥ 1 * 10^(2-1) := by gcongr - . have := d.head_ne_zero'; omega - norm_num + have := d.head_ne_zero'; omega _ = 10 := by norm_num linarith have := (m+1).mod_add_div 10 diff --git a/Analysis/Appendix_B_2.lean b/Analysis/Appendix_B_2.lean index 2910da9ed..76290a8e3 100644 --- a/Analysis/Appendix_B_2.lean +++ b/Analysis/Appendix_B_2.lean @@ -67,6 +67,7 @@ theorem NNRealDecimal.surj (x:NNReal) : ∃ d:NNRealDecimal, x = d := by have := (d.toNNReal_conv.tendsto_sum_tsum_nat).const_add (s 0:NNReal) convert_to Filter.atTop.Tendsto (fun n ↦ s n * (10:NNReal)^(-n:ℝ)) (nhds (d:NNReal)) at this . ext n; rw [hsum n] + . rfl apply tendsto_nhds_unique _ this apply Filter.Tendsto.squeeze (g := fun n:ℕ ↦ x - (10:NNReal)^(-n:ℝ)) (h := fun _ ↦ x) . convert Filter.Tendsto.const_sub (c := 0) x _ diff --git a/Analysis/MeasureTheory/Notation.lean b/Analysis/MeasureTheory/Notation.lean index 62738b275..0ca9b1690 100644 --- a/Analysis/MeasureTheory/Notation.lean +++ b/Analysis/MeasureTheory/Notation.lean @@ -1,4 +1,5 @@ import Mathlib.Tactic +import Mathlib.Analysis.InnerProductSpace.PiL2 /-! # Introduction to Measure Theory, Chapter 0: Notation @@ -79,7 +80,7 @@ def EuclideanSpace'.prod_equiv (d₁ d₂:ℕ) : EuclideanSpace' (d₁ + d₂) simp only [this] right_inv x := by ext ⟨i, hi⟩ - · simp [dif_pos hi] + · simp [dite_eq_left hi] · simp [show ¬(i + d₁ < d₁) by omega] def EuclideanSpace'.prod {d₁ d₂:ℕ} (E₁: Set (EuclideanSpace' d₁)) (E₂: Set (EuclideanSpace' d₂)) : Set (EuclideanSpace' (d₁+d₂)) := (EuclideanSpace'.prod_equiv d₁ d₂).symm '' (E₁ ×ˢ E₂) @@ -124,9 +125,9 @@ theorem ENNReal.upward_continuous {x y:ℕ → ENNReal} (hx: Monotone x) (hy: Mo have := hx hn.1 order have : atTop.Tendsto (fun n ↦ x n * y ny) (nhds ⊤) := by - convert Tendsto.comp (g := fun z ↦ z * y ny) _ hx_lim - convert (ENNReal.continuous_mul_const hyn').tendsto ⊤ - rw [top_mul]; order + have h := ((ENNReal.continuous_mul_const hyn').tendsto ⊤).comp hx_lim + rw [ENNReal.top_mul hny.ne'] at h + exact h apply tendsto_nhds_top_mono this simp [EventuallyLE, eventually_atTop] use ny; intro n hn @@ -134,10 +135,9 @@ theorem ENNReal.upward_continuous {x y:ℕ → ENNReal} (hx: Monotone x) (hy: Mo obtain rfl | hy₀' := eq_top_or_lt_top y₀ . rw [mul_top (by order)] have : atTop.Tendsto (fun n ↦ x nx * y n) (nhds ⊤) := by - convert Tendsto.comp (g := fun z ↦ (x nx) * z) _ hy_lim - convert (ENNReal.continuous_const_mul _).tendsto ⊤ - . rw [mul_top]; order - specialize hx_lt nx; order + have h := ((ENNReal.continuous_const_mul ((hx_lt nx).trans_lt hx₀').ne).tendsto ⊤).comp hy_lim + rw [ENNReal.mul_top hnx.ne'] at h + exact h apply tendsto_nhds_top_mono this simp [EventuallyLE, eventually_atTop] use nx; intro n hn @@ -166,7 +166,7 @@ example : ∃ (x y:ℕ → ENNReal) (_hx: Antitone x) (_hy: Antitone y) · have hxR : Tendsto (fun n : ℕ => (1 : ℝ) / (n : ℝ)) atTop (nhds 0) := tendsto_one_div_atTop_nhds_zero_nat have hxR' : Tendsto (fun n : ℕ => ENNReal.ofReal (1 / (n : ℝ))) atTop (nhds 0) := by - simpa [Function.comp, ENNReal.ofReal_zero] + simpa [Function.comp_def, ENNReal.ofReal_zero] using (ENNReal.continuous_ofReal.tendsto 0).comp hxR have heq : ∀ᶠ n in atTop, x n = ENNReal.ofReal (1 / (n : ℝ)) := by refine (eventually_ge_atTop 1).mono ?_ @@ -189,8 +189,7 @@ example : ∃ (x y:ℕ → ENNReal) (_hx: Antitone x) (_hy: Antitone y) example {A:Type} {x : A → ENNReal} (hx: ∑' α, x α < ⊤) : ∃ E: Set A, Countable E ∧ ∀ α ∉ E, x α = 0 := by refine ⟨{a | x a ≠ 0}, ?_, ?_⟩ - · simpa [Set.mem_setOf_eq] using - (Summable.countable_support_ennreal (ne_of_lt hx)) + · exact Summable.countable_support_ennreal (ne_of_lt hx) · aesop /-- Theorem 0.0.2 (Tonelli's theorem for series) -/ @@ -219,7 +218,7 @@ theorem ENNReal.tsum_of_tsum (x: ℕ → ℕ → ENNReal) : ∑' p:ℕ × ℕ, x _ ≤ _ := by apply ENNReal.tsum_le_tsum; intros; apply ENNReal.sum_le_tsum apply le_of_tendsto' (tendsto_nat_tsum _); intro N apply le_of_tendsto' (f := fun M ↦ ∑ n ∈ .range N, ∑ m ∈ .range M, x n m) (x := atTop) - . apply tendsto_finset_sum; intros; apply tendsto_nat_tsum + . apply tendsto_finsetSum; intros; apply tendsto_nat_tsum intro M; calc _ = ∑ p ∈ .range N ×ˢ .range M, x p.1 p.2 := by symm; apply Finset.sum_product _ ≤ _ := ENNReal.sum_le_tsum _ diff --git a/Analysis/MeasureTheory/Section_1_1_1.lean b/Analysis/MeasureTheory/Section_1_1_1.lean index ce582fcf3..f7ca07195 100644 --- a/Analysis/MeasureTheory/Section_1_1_1.lean +++ b/Analysis/MeasureTheory/Section_1_1_1.lean @@ -38,7 +38,7 @@ instance BoundedInterval.instEmpty : EmptyCollection BoundedInterval where /-- The empty {name}`BoundedInterval` coerces to the empty set. -/ @[simp] theorem BoundedInterval.coe_empty : ((∅ : BoundedInterval):Set ℝ) = ∅ := by - simp [toSet] + show toSet (Ioo 0 0) = ∅; simp [toSet] open Classical in /-- This is to make {name}`Finset`s of {name}`BoundedInterval`s work properly -/ @@ -278,12 +278,12 @@ lemma toSet_injective_of_nonempty {I J : BoundedInterval} end BoundedInterval /-- A witness for lowerBound of upperBounds -/ -def witness_lowerBound_upperBounds {X : Set ℝ} (y : ℝ) (hy : y ∈ X) +lemma witness_lowerBound_upperBounds {X : Set ℝ} (y : ℝ) (hy : y ∈ X) : y ∈ lowerBounds (upperBounds X) := by intro u hu; simp [upperBounds] at hu; exact hu hy /-- A witness for upperBound of lowerBounds -/ -def witness_upperBound_lowerBounds {X : Set ℝ} (y : ℝ) (hy : y ∈ X) +lemma witness_upperBound_lowerBounds {X : Set ℝ} (y : ℝ) (hy : y ∈ X) : y ∈ upperBounds (lowerBounds X) := by intro u hu; simp [lowerBounds] at hu; exact hu hy @@ -788,11 +788,11 @@ theorem BoundedInterval.sdiff (I J: BoundedInterval) : refine ⟨K₁, K₂, ?_⟩ rw [← hK₁, ← hK₂] ext x - simp only [Set.mem_diff, Set.mem_union, Set.mem_inter_iff, mem_iff', mk'_a, mk'_b, + simp only [Set.mem_sdiff, Set.mem_union, Set.mem_inter_iff, mem_iff', mk'_a, mk'_b, mk'_lclosed, mk'_uclosed] cases hIl : I.lclosed <;> cases hIu : I.uclosed <;> cases hJl : J.lclosed <;> cases hJu : J.uclosed <;> simp only [Bool.not_true, Bool.not_false, Bool.false_eq_true, reduceIte] <;> - push_neg <;> + push Not <;> constructor <;> intro h <;> grind @@ -815,13 +815,13 @@ theorem Box.sdiff {d:ℕ} (B C: Box d) : IsElementary (B.toSet \ C.toSet) := by cases k <;> simp refine ⟨Finset.univ.image (fun p : Fin d × Bool ↦ piece p.1 p.2), ?_⟩ ext x - simp only [Set.mem_diff, Box.mem_toSet, Set.mem_iUnion, Finset.mem_image, Finset.mem_univ, + simp only [Set.mem_sdiff, Box.mem_toSet, Set.mem_iUnion, Finset.mem_image, Finset.mem_univ, true_and, exists_prop] constructor · rintro ⟨hxB, hxC⟩ obtain ⟨i, hi⟩ : ∃ i, x i ∉ (C.side i : Set ℝ) := by by_contra hc - push_neg at hc + push Not at hc exact hxC (fun i ↦ hc i) have : x i ∈ ((K₁ i : Set ℝ)) ∪ ((K₂ i : Set ℝ)) := by rw [← hK i]; exact ⟨hxB i, hi⟩ @@ -858,13 +858,13 @@ theorem IsElementary.sdiff {d:ℕ} {E F: Set (EuclideanSpace' d)} | insert C T' hC ih => have hrw : E \ (⋃ B ∈ insert C T', (B:Set (EuclideanSpace' d))) = (E \ ⋃ B ∈ T', (B:Set (EuclideanSpace' d))) \ C.toSet := by - rw [Finset.set_biUnion_insert, Set.diff_diff, Set.union_comm] + rw [Finset.set_biUnion_insert, Set.sdiff_sdiff, Set.union_comm] rw [hrw] obtain ⟨S, hS⟩ := ih rw [hS] have hdiff : (⋃ B ∈ S, (B:Set (EuclideanSpace' d))) \ C.toSet = ⋃ B ∈ S, ((B:Set (EuclideanSpace' d)) \ C.toSet) := by - ext y; simp only [Set.mem_diff, Set.mem_iUnion, exists_prop]; tauto + ext y; simp only [Set.mem_sdiff, Set.mem_iUnion, exists_prop]; tauto rw [hdiff] have : (⋃ B ∈ S, ((B:Set (EuclideanSpace' d)) \ C.toSet)) = ⋃ X ∈ S.image (fun B : Box d ↦ (B:Set (EuclideanSpace' d)) \ C.toSet), X := by @@ -899,11 +899,11 @@ theorem BoundedInterval.translate (I: BoundedInterval) (c:ℝ) : · intro hy refine ⟨y - c, ?_, by ring⟩ revert hy - cases I.lclosed <;> cases I.uclosed <;> simp only [if_true, if_false, + cases I.lclosed <;> cases I.uclosed <;> simp only [ite_true, ite_false, Bool.false_eq_true] <;> grind · rintro ⟨z, hz, rfl⟩ revert hz - cases I.lclosed <;> cases I.uclosed <;> simp only [if_true, if_false, + cases I.lclosed <;> cases I.uclosed <;> simp only [ite_true, ite_false, Bool.false_eq_true] <;> grind /-- Translating a box gives a box. -/ @@ -1059,7 +1059,7 @@ theorem Box.partition {d:ℕ} (S: Finset (Box d)) : ∃ T: Finset (Box d), (T : intro B hB choose U hU using hJ use {B' | ∀ i, ∃ hi : B'.val.side i ∈ J i, ⟨ _, hi ⟩ ∈ U i hB} - ext x; simp only [Box.mem_toSet, Set.mem_iUnion, Set.mem_setOf_eq, Subtype.exists] + ext x; simp only [Box.mem_toSet, Set.mem_iUnion, Set.mem_ofPred_eq, Subtype.exists] constructor . intro h have h' : ∀ i, x i ∈ ⋃ K ∈ U i hB, (K:BoundedInterval).toSet := by @@ -1150,7 +1150,7 @@ theorem Box.vol_eq {d:ℕ} (B: Box d): (nhds |B|ᵥ) := by simp [Box.volume] have : ∀ i ∈ Finset.univ, Filter.atTop.Tendsto (fun N:ℕ ↦ (N:ℝ)⁻¹ * Nat.card ↥((B.side i).toSet ∩ Set.range ((fun n:ℤ ↦ (N:ℝ)⁻¹*n)))) (nhds |B.side i|ₗ) := fun i _ ↦ (B.side i).length_eq - convert tendsto_finset_prod Finset.univ this with N + convert tendsto_finsetProd Finset.univ this with N simp [Finset.prod_mul_distrib]; left norm_cast; simp_rw [←Nat.card_coe_set_eq, ←Nat.card_pi] apply Nat.card_congr (B.sample_congr N) @@ -1161,7 +1161,7 @@ theorem Box.sum_vol_eq {d:ℕ} {T: Finset (Box d)} (hT: (T : Set (Box d)).PairwiseDisjoint Box.toSet) : Filter.atTop.Tendsto (fun N:ℕ ↦ (N:ℝ)^(-d:ℝ) * Nat.card ↥((⋃ B ∈ T, B.toSet) ∩ (Set.range (fun (n:Fin d → ℤ) ↦ .toLp 2 (fun i ↦ (N:ℝ)⁻¹*(n i)))))) (nhds (∑ B ∈ T, |B|ᵥ)) := by - apply (tendsto_finset_sum T (fun B _ ↦ B.vol_eq)).congr' + apply (tendsto_finsetSum T (fun B _ ↦ B.vol_eq)).congr' rw [Filter.EventuallyEq, Filter.eventually_atTop]; use 1; intro N hN symm; convert Finset.mul_sum _ _ _ convert Nat.cast_sum _ _ @@ -1395,7 +1395,7 @@ lemma IsElementary.sum_insert_split {d:ℕ} {a: Set (EuclideanSpace' d)} {S': Fi -- Base case: S' = ∅ -- LHS: ∑ E:(insert a ∅), ... = sum over {a} -- RHS: measure of a + ∑ E:∅, ... = measure of a + 0 - simp [Finset.sum_empty] + simp [Finset.sum_empty]; exact Fintype.sum_unique _ | @insert b S'' hb_notin ih => -- Inductive case: S' = insert b S'' -- Goal: ∑ E:(insert a (insert b S'')), ... = measure(a) + ∑ E:(insert b S''), ... @@ -1867,7 +1867,7 @@ lemma Box.prod_side {d₁ d₂:ℕ} (B₁: Box d₁) (B₂: Box d₂) (i : Fin ( lemma EuclideanSpace'.prod_equiv_symm_apply_left {d₁ d₂:ℕ} (y : EuclideanSpace' d₁) (z : EuclideanSpace' d₂) {i : ℕ} (hi : i < d₁) : (EuclideanSpace'.prod_equiv d₁ d₂).symm (y, z) ⟨i, Nat.lt_add_right d₂ hi⟩ = y ⟨i, hi⟩ := by - simp [EuclideanSpace'.prod_equiv, dif_pos hi] + simp [EuclideanSpace'.prod_equiv, dite_eq_left hi] /-- Coordinate of a product vector in the second block. -/ lemma EuclideanSpace'.prod_equiv_symm_apply_right {d₁ d₂:ℕ} @@ -1875,7 +1875,7 @@ lemma EuclideanSpace'.prod_equiv_symm_apply_right {d₁ d₂:ℕ} (EuclideanSpace'.prod_equiv d₁ d₂).symm (y, z) ⟨d₁ + j, Nat.add_lt_add_left hj d₁⟩ = z ⟨j, hj⟩ := by have hnot : ¬ d₁ + j < d₁ := Nat.not_lt.mpr (Nat.le_add_right _ _) - simp [EuclideanSpace'.prod_equiv, dif_neg hnot, Nat.add_sub_cancel_left] + simp [EuclideanSpace'.prod_equiv, dite_eq_right hnot, Nat.add_sub_cancel_left] /-- First factor of {name}`prod_equiv`. -/ lemma EuclideanSpace'.prod_equiv_apply_fst {d₁ d₂:ℕ} @@ -1900,9 +1900,9 @@ lemma Box.prod_toSet {d₁ d₂:ℕ} (B₁: Box d₁) (B₂: Box d₂) : rcases i with ⟨i, hi⟩ simp only [Box.prod] split_ifs with h - · simp [EuclideanSpace'.prod_equiv, dif_pos h] + · simp [EuclideanSpace'.prod_equiv, dite_eq_left h] exact hy ⟨i, h⟩ - · simp [EuclideanSpace'.prod_equiv, dif_neg h] + · simp [EuclideanSpace'.prod_equiv, dite_eq_right h] exact hz ⟨i - d₁, Nat.sub_lt_left_of_lt_add (Nat.not_lt.mp h) hi⟩ · intro hx refine ⟨⟨(EuclideanSpace'.prod_equiv d₁ d₂ x).1, (EuclideanSpace'.prod_equiv d₁ d₂ x).2⟩, ?_, @@ -1910,12 +1910,12 @@ lemma Box.prod_toSet {d₁ d₂:ℕ} (B₁: Box d₁) (B₂: Box d₂) : constructor · intro i have hx' := hx ⟨(i : ℕ), Nat.lt_add_right d₂ i.isLt⟩ - simp [Box.prod, EuclideanSpace'.prod_equiv, dif_pos i.isLt] at hx' ⊢ + simp [Box.prod, EuclideanSpace'.prod_equiv, dite_eq_left i.isLt] at hx' ⊢ exact hx' · intro j have hnot : ¬ (j : ℕ) + d₁ < d₁ := Nat.not_lt.mpr (Nat.le_add_left d₁ _) have hx' := hx ⟨(j : ℕ) + d₁, by omega⟩ - simp [Box.prod, EuclideanSpace'.prod_equiv, dif_neg hnot] at hx' ⊢ + simp [Box.prod, EuclideanSpace'.prod_equiv, dite_eq_right hnot] at hx' ⊢ convert hx' <;> (apply Fin.ext; exact Nat.add_sub_cancel (j : ℕ) d₁) /-- Recovering the factors from a product box. -/ @@ -1926,12 +1926,12 @@ lemma Box.prod_injective {d₁ d₂:ℕ} : refine Prod.ext ?_ ?_ · ext i have := congrFun hside ⟨i, Nat.lt_add_right d₂ i.isLt⟩ - rw [Box.prod_side, Box.prod_side, dif_pos i.isLt, dif_pos i.isLt] at this + rw [Box.prod_side, Box.prod_side, dite_eq_left i.isLt, dite_eq_left i.isLt] at this exact this · ext j have hnot : ¬ (j : ℕ) + d₁ < d₁ := Nat.not_lt.mpr (Nat.le_add_left d₁ _) have := congrFun hside ⟨(j : ℕ) + d₁, by omega⟩ - rw [Box.prod_side, Box.prod_side, dif_neg hnot, dif_neg hnot] at this + rw [Box.prod_side, Box.prod_side, dite_eq_right hnot, dite_eq_right hnot] at this have hj (C : Box d₂) : C.side ⟨(j : ℕ) + d₁ - d₁, Nat.sub_lt_left_of_lt_add (Nat.not_lt.mp hnot) (by omega)⟩ = C.side j := diff --git a/Analysis/MeasureTheory/Section_1_1_2.lean b/Analysis/MeasureTheory/Section_1_1_2.lean index c6879d16a..7498a8fe0 100644 --- a/Analysis/MeasureTheory/Section_1_1_2.lean +++ b/Analysis/MeasureTheory/Section_1_1_2.lean @@ -435,7 +435,7 @@ theorem JordanMeasurable.equiv {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: Bornolo have hAB : A ⊆ B := hAE.trans hEB have hadd := IsElementary.measure_of_disjUnion hA (hB.sdiff hA) disjoint_sdiff_self_right have heq := IsElementary.measure_eq_of_set_eq (hA.union (hB.sdiff hA)) hB - (Set.union_diff_cancel hAB) + (Set.union_sdiff_cancel hAB) refine ⟨A, B, hA, hB, hAE, hEB, ?_⟩ linarith [hJM.2, hAμ, hBμ, hadd, heq] tfae_have 2 → 3 := by @@ -483,7 +483,7 @@ theorem JordanMeasurable.equiv {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: Bornolo intro x ⟨hx1, hx2⟩ exact hx1.2 hx2.2 have hadd := IsElementary.measure_of_disjUnion (hA.sdiff hC) hAinter hdisj - have hAdecomp : (A \ C) ∪ (A ∩ C) = A := Set.diff_union_inter A C + have hAdecomp : (A \ C) ∪ (A ∩ C) = A := Set.sdiff_union_inter A C have heq := IsElementary.measure_eq_of_set_eq ((hA.sdiff hC).union hAinter) hA hAdecomp have hinter_le : hAinter.measure ≤ hC.measure := @@ -529,10 +529,10 @@ theorem JordanMeasurable.union {d:ℕ} {E F : Set (EuclideanSpace' d)} have h_inner_outer_eq : ∀ ε > 0, ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E ∪ F ∧ E ∪ F ⊆ B ∧ (IsElementary.measure (hB.sdiff hA)) ≤ ε := by intro ε hε_pos obtain ⟨A₁, B₁, hA₁, hB₁, hA₁_subset_E, hE_subset_B₁, hB₁_minus_A₁⟩ : ∃ A₁ B₁ : Set (EuclideanSpace' d), ∃ hA₁ : IsElementary A₁, ∃ hB₁ : IsElementary B₁, A₁ ⊆ E ∧ E ⊆ B₁ ∧ (IsElementary.measure (hB₁.sdiff hA₁)) ≤ ε / 2 := by - have := JordanMeasurable.equiv hE_bounded |>.out 0 1 ; simp_all only [gt_iff_lt, exists_and_left, implies_true, + have := JordanMeasurable.equiv hE_bounded |>.out 1 2 ; simp_all only [gt_iff_lt, exists_and_left, implies_true, iff_true, div_pos_iff_of_pos_left, Nat.ofNat_pos] obtain ⟨A₂, B₂, hA₂, hB₂, hA₂_subset_F, hF_subset_B₂, hB₂_minus_A₂⟩ : ∃ A₂ B₂ : Set (EuclideanSpace' d), ∃ hA₂ : IsElementary A₂, ∃ hB₂ : IsElementary B₂, A₂ ⊆ F ∧ F ⊆ B₂ ∧ (IsElementary.measure (hB₂.sdiff hA₂)) ≤ ε / 2 := by - have := JordanMeasurable.equiv hF_bounded |>.out 0 1; + have := JordanMeasurable.equiv hF_bounded |>.out 1 2; exact this.mp hF ( ε / 2 ) ( half_pos hε_pos ) |> fun ⟨ A₂, B₂, hA₂, hB₂, hA₂_subset_F, hF_subset_B₂, hB₂_minus_A₂ ⟩ => ⟨ A₂, B₂, hA₂, hB₂, hA₂_subset_F, hF_subset_B₂, by linarith ⟩; refine' ⟨ A₁ ∪ A₂, B₁ ∪ B₂, _, _, _, _, _ ⟩ <;> try { exact hA₁.union hA₂ } <;> try { exact hB₁.union hB₂ } <;> try { exact Set.union_subset_union hA₁_subset_E hA₂_subset_F } <;> try { exact Set.union_subset_union hE_subset_B₁ hF_subset_B₂ }; refine' le_trans ( le_trans ( IsElementary.measure_mono _ _ _ ) ( IsElementary.measure_of_union _ _ ) ) _; @@ -542,7 +542,7 @@ theorem JordanMeasurable.union {d:ℕ} {E F : Set (EuclideanSpace' d)} exact hB₁.sdiff hA₁ exact hB₂.sdiff hA₂ exact by linarith! [ hB₁_minus_A₁, hB₂_minus_A₂ ] ; - intro x hx; simp_all only [gt_iff_lt, Set.mem_diff, Set.mem_union, not_or, not_false_eq_true, and_true]; + intro x hx; simp_all only [gt_iff_lt, Set.mem_sdiff, Set.mem_union, not_or, not_false_eq_true, and_true]; refine' le_antisymm _ _; · apply_rules [ Jordan_inner_le_outer ]; exact hE_bounded.union hF_bounded; @@ -583,10 +583,10 @@ theorem JordanMeasurable.inter {d:ℕ} {E F : Set (EuclideanSpace' d)} have h_jordan_measurable : ∀ ε > 0, ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E ∧ E ⊆ B ∧ (hB.sdiff hA).measure ≤ ε / 2 ∧ ∃ C D : Set (EuclideanSpace' d), ∃ hC : IsElementary C, ∃ hD : IsElementary D, C ⊆ F ∧ F ⊆ D ∧ (hD.sdiff hC).measure ≤ ε / 2 := by intro ε hε_pos obtain ⟨A, B, hA, hB, hA_sub, hB_sup, hA_B⟩ : ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E ∧ E ⊆ B ∧ (hB.sdiff hA).measure ≤ ε / 2 := by - have := JordanMeasurable.equiv (hE.1) |>.out 0 1; simp_all only [gt_iff_lt, exists_and_left, implies_true, + have := JordanMeasurable.equiv (hE.1) |>.out 1 2; simp_all only [gt_iff_lt, exists_and_left, implies_true, iff_true, div_pos_iff_of_pos_left, Nat.ofNat_pos]; obtain ⟨C, D, hC, hD, hC_sub, hD_sup, hC_D⟩ : ∃ C D : Set (EuclideanSpace' d), ∃ hC : IsElementary C, ∃ hD : IsElementary D, C ⊆ F ∧ F ⊆ D ∧ (hD.sdiff hC).measure ≤ ε / 2 := by - have := JordanMeasurable.equiv ( show Bornology.IsBounded F from hF.1 ) |>.out 0 1; + have := JordanMeasurable.equiv ( show Bornology.IsBounded F from hF.1 ) |>.out 1 2; exact this.mp hF ( ε / 2 ) ( half_pos hε_pos ) |> fun ⟨ C, D, hC, hD, hC_sub, hD_sup, hC_D ⟩ => ⟨ C, D, hC, hD, hC_sub, hD_sup, by linarith ⟩ use A, B, hA, hB, hA_sub, hB_sup, hA_B, C, D, hC, hD, hC_sub, hD_sup, hC_D; intro ε hε_pos @@ -617,7 +617,7 @@ theorem JordanMeasurable.inter {d:ℕ} {E F : Set (EuclideanSpace' d)} exact disjoint_sdiff_self_right convert IsElementary.measure_of_disjUnion hA ( IsElementary.sdiff hB hA ) h_disjoint using 1; convert IsElementary.measure_irrelevant _ _; - · exact Set.union_diff_cancel' (fun ⦃a⦄ a ↦ a) fun ⦃a⦄ a_1 ↦ hB_sub (hA_sub a_1); + · exact Set.union_sdiff_cancel' (fun ⦃a⦄ a ↦ a) fun ⦃a⦄ a_1 ↦ hB_sub (hA_sub a_1); · exact hB; linarith; have h_jordan_measurable : Jordan_outer_measure (E ∩ F) - Jordan_inner_measure (E ∩ F) = 0 := by @@ -628,18 +628,18 @@ theorem JordanMeasurable.inter {d:ℕ} {E F : Set (EuclideanSpace' d)} theorem JordanMeasurable.sdiff {d:ℕ} {E F : Set (EuclideanSpace' d)} (hE: JordanMeasurable E) (hF: JordanMeasurable F) : JordanMeasurable (E \ F) := by refine' ⟨ _, _ ⟩; - · exact hE.1.subset ( Set.diff_subset ); + · exact hE.1.subset ( Set.sdiff_subset ); · have h_diff : ∀ ε > 0, ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E \ F ∧ E \ F ⊆ B ∧ (hB.sdiff hA).measure ≤ ε := by have h_diff : ∀ ε > 0, ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E ∧ E ⊆ B ∧ (hB.sdiff hA).measure ≤ ε / 2 ∧ ∃ C D : Set (EuclideanSpace' d), ∃ hC : IsElementary C, ∃ hD : IsElementary D, C ⊆ F ∧ F ⊆ D ∧ (hD.sdiff hC).measure ≤ ε / 2 := by intros ε hε_pos obtain ⟨A, B, hA, hB, hAB⟩ : ∃ A B : Set (EuclideanSpace' d), ∃ hA : IsElementary A, ∃ hB : IsElementary B, A ⊆ E ∧ E ⊆ B ∧ (hB.sdiff hA).measure ≤ ε / 2 := by - have := JordanMeasurable.equiv hE.1 |>.out 0 1; + have := JordanMeasurable.equiv hE.1 |>.out 1 2; exact this.mp hE ( ε / 2 ) ( half_pos hε_pos ); have h_diff : ∀ ε > 0, ∃ C D : Set (EuclideanSpace' d), ∃ hC : IsElementary C, ∃ hD : IsElementary D, C ⊆ F ∧ F ⊆ D ∧ (hD.sdiff hC).measure ≤ ε / 2 := by have := JordanMeasurable.equiv hF.1; - have := this.out 0 1; + have := this.out 1 2; intro ε_1 a - simp_all only [gt_iff_lt, exists_and_left, implies_true, exists_prop, List.tfae_cons_self, iff_true, + simp_all only [gt_iff_lt, exists_and_left, implies_true, exists_prop, List.tfae_cons_of_mem, iff_true, div_pos_iff_of_pos_left, Nat.ofNat_pos]; exact ⟨ A, B, hA, hB, hAB.1, hAB.2.1, hAB.2.2, h_diff ε hε_pos ⟩; intro ε hε @@ -647,15 +647,15 @@ theorem JordanMeasurable.sdiff {d:ℕ} {E F : Set (EuclideanSpace' d)} use A \ D, B \ C; refine' ⟨ hA.sdiff hD, hB.sdiff hC, _, _, _ ⟩; · exact fun x hx => ⟨ hA_sub_E hx.1, fun hx' => hx.2 <| hF_sub_D hx' ⟩; - · exact Set.diff_subset_diff hE_sub_B hC_sub_F; + · exact Set.sdiff_subset_sdiff hE_sub_B hC_sub_F; · refine' le_trans ( IsElementary.measure_mono _ _ _ ) _; exact ( B \ A ) ∪ ( D \ C ); exact IsElementary.union ( hB.sdiff hA ) ( hD.sdiff hC ); - · grind only [= Set.setOf_true, = Set.mem_union, = Set.subset_def, = Set.setOf_false, = Set.mem_diff]; + · grind only [= Set.ofPred_true, = Set.mem_union, = Set.subset_def, = Set.ofPred_false, = Set.mem_sdiff]; · exact le_trans ( IsElementary.measure_of_union _ _ ) ( by linarith ); refine' le_antisymm _ _; · apply_rules [ Jordan_inner_le_outer ]; - exact hE.1.subset ( Set.diff_subset ); + exact hE.1.subset ( Set.sdiff_subset ); · refine' le_of_forall_pos_le_add fun ε ε_pos => _; obtain ⟨ A, B, hA, hB, hA', hB', h ⟩ := h_diff ε ε_pos; refine' le_trans ( csInf_le _ ⟨ B, hB, hB', rfl ⟩ ) _; @@ -671,15 +671,16 @@ theorem JordanMeasurable.sdiff {d:ℕ} {E F : Set (EuclideanSpace' d)} have hB_le_inner : hB.measure ≤ (hA.union (hB.sdiff hA)).measure := by apply_rules [ IsElementary.measure_mono ]; exact fun x hx => by by_cases hx' : x ∈ A <;> simp_all only [gt_iff_lt, exists_and_left, - Set.union_diff_self, Set.mem_union, or_true]; + Set.union_sdiff_self, Set.mem_union, or_true]; exact hB_le_inner.trans ( by simpa using IsElementary.measure_of_disjUnion hA ( hB.sdiff hA ) ( Set.disjoint_left.mpr fun x hx₁ hx₂ => by simp_all only [gt_iff_lt, - exists_and_left, Set.union_diff_self, Set.mem_diff, not_true_eq_false, and_false] ) |> le_of_eq ); + exists_and_left, Set.union_sdiff_self, Set.mem_sdiff, not_true_eq_false, and_false] ) |> le_of_eq ); linarith /-- Exercise 1.1.6 (i) (Boolean closure) -/ theorem JordanMeasurable.symmDiff {d:ℕ} {E F : Set (EuclideanSpace' d)} (hE: JordanMeasurable E) (hF: JordanMeasurable F) : JordanMeasurable (symmDiff E F) := by convert JordanMeasurable.union ( hE.sdiff hF ) ( hF.sdiff hE ) using 1 + rfl /-- Exercise 1.1.6 (ii) (non-negativity) -/ theorem JordanMeasurable.nonneg {d:ℕ} {E : Set (EuclideanSpace' d)} @@ -817,14 +818,14 @@ theorem JordanMeasurable.mes_of_union {d:ℕ} {E F : Set (EuclideanSpace' d)} by_contra h_contra; -- Since $E$ and $F$ are not disjoint, we can find a smaller set $G$ such that $E \cup F = E \cup G$ and $G$ is disjoint from $E$. obtain ⟨G, hG⟩ : ∃ G : Set (EuclideanSpace' d), Disjoint E G ∧ E ∪ F = E ∪ G ∧ G ⊆ F := by - exact ⟨ F \ E, disjoint_sdiff_self_right, by simp_all only [not_le, Set.union_diff_self], fun x hx => hx.1 ⟩; + exact ⟨ F \ E, disjoint_sdiff_self_right, by simp_all only [not_le, Set.union_sdiff_self], fun x hx => hx.1 ⟩; have hG_measurable : JordanMeasurable G := by have hG_measurable : JordanMeasurable (F \ E) := by exact sdiff hF hE; convert hG_measurable using 1; ext x; exact ⟨ fun hx => ⟨ hG.2.2 hx, fun hx' => hG.1.le_bot ⟨ hx', hx ⟩ ⟩, fun hx => by rw [ Set.ext_iff ] at hG; specialize hG; have := hG.2.1 x; simp_all only [not_le, - Set.mem_diff, Set.mem_union, or_true, false_or, true_iff] ⟩; + Set.mem_sdiff, Set.mem_union, or_true, false_or, true_iff] ⟩; have hG_measure : (hE.union hG_measurable).measure = hE.measure + hG_measurable.measure := by convert JordanMeasurable.mes_of_disjUnion hE hG_measurable hG.1 using 1; have hG_measure_le : hG_measurable.measure ≤ hF.measure := by @@ -1184,7 +1185,7 @@ lemma Jordan_inner_measure_prod_ge {d₁ d₂:ℕ} {E₁: Set (EuclideanSpace' d · have : hE₁.measure * hE₂.measure = 0 := by rcases h0 with h | h <;> simp [h] linarith [Jordan_inner_measure_nonneg (EuclideanSpace'.prod E₁ E₂)] - · push_neg at h0 + · push Not at h0 have hpos₁ : 0 < hE₁.measure := lt_of_le_of_ne hμ₁ (Ne.symm h0.1) have hpos₂ : 0 < hE₂.measure := lt_of_le_of_ne hμ₂ (Ne.symm h0.2) have hden : (0 : ℝ) < hE₁.measure + hE₂.measure + 1 := by positivity diff --git a/Analysis/MeasureTheory/Section_1_1_3.lean b/Analysis/MeasureTheory/Section_1_1_3.lean index d5127384b..e4e8e841f 100644 --- a/Analysis/MeasureTheory/Section_1_1_3.lean +++ b/Analysis/MeasureTheory/Section_1_1_3.lean @@ -123,7 +123,7 @@ lemma TaggedPartition.exists_norm_le (I: BoundedInterval) (hI: I = Icc I.a I.b) linarith /-- The filter {name}`TaggedPartition.nhds_zero` is non-trivial when the interval has positive length. -/ -instance TaggedPartition.nhds_zero_neBot (I: BoundedInterval) (hI: I = Icc I.a I.b) (hab: I.a < I.b) : +theorem TaggedPartition.nhds_zero_neBot (I: BoundedInterval) (hI: I = Icc I.a I.b) (hab: I.a < I.b) : Filter.NeBot (TaggedPartition.nhds_zero I) := by unfold TaggedPartition.nhds_zero rw [Filter.comap_neBot_iff] @@ -253,7 +253,7 @@ lemma eq_of_length_zero_of_Icc {I : BoundedInterval} · -- If I.a ≤ I.b, then with I.b ≤ I.a, we get I.a = I.b exact le_antisymm hab h_ba · -- If ¬(I.a ≤ I.b), then I.a > I.b - push_neg at hab + push Not at hab -- When I = Icc I.a I.b with I.a > I.b, we have I.toSet = ∅ have h_empty : I.toSet = ∅ := by rw [hI] @@ -489,8 +489,8 @@ lemma TaggedPartition.RiemannSum_changeTag_sub {I: BoundedInterval} {n:ℕ} (P: rw [h_delta] simp only [TaggedPartition.changeTag] by_cases hik : i = k - · subst hik; simp only [Function.update_self, if_true]; ring - · simp only [Function.update_of_ne hik, hik, if_false]; ring + · subst hik; simp only [Function.update_self, ite_true]; ring + · simp only [Function.update_of_ne hik, hik, ite_false]; ring conv_lhs => rw [Finset.sum_congr rfl (fun i _ => h_terms i)] rw [Finset.sum_ite_eq' Finset.univ k] simp @@ -592,13 +592,13 @@ theorem RiemannIntegrable.bounded {f: ℝ → ℝ} {I: BoundedInterval} (h: Riem have hxa : x = I.a := le_antisymm (by linarith [hx.1, hx.2, hab]) hx.1 rw [hxa] · -- Positive-length case - push_neg at hab + push Not at hab have h_lt : I.a < I.b := by rw [hIcc] at h_nonempty simp only [BoundedInterval.toSet] at h_nonempty obtain ⟨x, hax, hxb⟩ := h_nonempty by_contra h_not_lt - push_neg at h_not_lt + push Not at h_not_lt have : I.b < I.a := lt_of_le_of_ne h_not_lt (Ne.symm hab) linarith -- Use ε-δ characterization with ε = 1 @@ -609,7 +609,7 @@ theorem RiemannIntegrable.bounded {f: ℝ → ℝ} {I: BoundedInterval} (h: Riem obtain ⟨N, hN⟩ := exists_nat_gt ((I.b - I.a) / δ) have hN_pos : 0 < N := by by_contra h_not_pos - push_neg at h_not_pos + push Not at h_not_pos interval_cases N simp at hN linarith [div_pos h_width_pos hδ_pos] @@ -628,7 +628,7 @@ theorem RiemannIntegrable.bounded {f: ℝ → ℝ} {I: BoundedInterval} (h: Riem have h_P_norm_le : P.norm ≤ δ := by rw [h_P_norm]; exact h_norm_le -- For contradiction, assume f is unbounded by_contra h_unbounded - push_neg at h_unbounded + push Not at h_unbounded -- h_unbounded : ∀ M, ∃ x ∈ I.toSet, M < |f x| -- Let K = sum of |f| at partition left endpoints (a bound we'll use) let K := ∑ j : Fin N, |f (P.x_tag j)| diff --git a/Analysis/MeasureTheory/Section_1_2_0.lean b/Analysis/MeasureTheory/Section_1_2_0.lean index 961b339d4..96276c61d 100644 --- a/Analysis/MeasureTheory/Section_1_2_0.lean +++ b/Analysis/MeasureTheory/Section_1_2_0.lean @@ -239,7 +239,7 @@ lemma exercise_1_2_1_union : { toEquiv := Real.equiv_EuclideanSpace' continuous_toFun := hf_cont continuous_invFun := hg_cont } - simpa using e.image_closure Q + exact e.image_closure Q rw [← h_image_closure] at h_outer_eq rw [h_closure_Q] at h_outer_eq @@ -337,7 +337,7 @@ lemma exercise_1_2_1_union : have hy_rational : ∃ q : ℚ, (q:ℝ) = y := ⟨r.val, hr⟩ -- But y is irrational: hy_irrat_mem : y ∈ {x | Irrational x} -- This means Irrational y, which contradicts hy_rational - simp only [Set.mem_setOf_eq] at hy_irrat_mem + simp only [Set.mem_ofPred_eq] at hy_irrat_mem exact hy_irrat_mem hy_rational -- Real.equiv_EuclideanSpace' commutes with interior @@ -360,7 +360,7 @@ lemma exercise_1_2_1_union : { toEquiv := Real.equiv_EuclideanSpace' continuous_toFun := hf_cont continuous_invFun := hg_cont } - simpa using e.image_interior Q + exact e.image_interior Q rw [← h_image_interior] at h_inner_eq rw [h_interior_Q, Set.image_empty] at h_inner_eq @@ -468,7 +468,7 @@ example : refine ⟨E, ?_, ?_, ?_⟩ · intro n apply Bornology.IsBounded.subset (Metric.isBounded_Icc (a := 0) (b := 1)) - exact Set.diff_subset + exact Set.sdiff_subset · intro n have hJ : @@ -664,7 +664,7 @@ theorem Jordan_outer_eq {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: Bornology.IsBo apply Finset.sum_congr rfl intro E _ dsimp [vol] - rw [dif_pos (hS_elem E.val E.property)] + rw [dite_eq_left (hS_elem E.val E.property)] rw [h_congr] -- Subtype sum to set sum change ∑ E ∈ S_sets.attach, vol E.val = ∑ E ∈ S_sets, vol E @@ -694,7 +694,7 @@ theorem Jordan_outer_eq {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: Bornology.IsBo exact h_non dsimp [vol] rw [hE_empty] - rw [dif_pos (IsElementary.empty d)] + rw [dite_eq_left (IsElementary.empty d)] exact IsElementary.measure_of_empty d rw [h_sets_eq] @@ -704,7 +704,7 @@ theorem Jordan_outer_eq {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: Bornology.IsBo apply Finset.sum_congr rfl intro B hB dsimp [vol] - rw [dif_pos (IsElementary.box B)] + rw [dite_eq_left (IsElementary.box B)] exact IsElementary.measure_of_box B · -- Injectivity intro B₁ hB₁ B₂ hB₂ h_eq @@ -803,7 +803,7 @@ lemma Lebesgue_outer_measure_eq_nat_indexed {d:ℕ} (hd: 0 < d) (E: Set (Euclide -- Part 2 (≥): Countable covers ≥ ℕ-indexed covers · apply le_sInf intro b hb - simp only [Set.mem_setOf_eq] at hb + simp only [Set.mem_ofPred_eq] at hb obtain ⟨X, S, hS_cover, hb_eq⟩ := hb open Classical in @@ -941,7 +941,7 @@ lemma hasSum_indicator_top_of_infinite (X : Set ℕ) (hX : ¬X.Finite) : _ = ∑ i ∈ F, if i ∈ X then (1 : EReal) else 0 := by apply Finset.sum_congr rfl intro i hi - rw [if_pos] + rw [ite_eq_left] exact hF_sub (Finset.mem_coe.mpr hi) _ ≤ ∑ i ∈ s, if i ∈ X then (1 : EReal) else 0 := by apply Finset.sum_le_sum_of_subset_of_nonneg hFs @@ -1007,7 +1007,7 @@ lemma Lebesgue_outer_measure_of_dim_zero {E: Set (EuclideanSpace' 0)} : -- Lower bound: show 1 ≤ sInf (every cover has sum ≥ 1) · apply le_sInf intro b hb - simp only [Set.mem_setOf_eq] at hb + simp only [Set.mem_ofPred_eq] at hb obtain ⟨X, S, hcover, hb_eq⟩ := hb -- E is nonempty, so the cover must be nonempty have hX_nonempty : X.Nonempty := by @@ -1072,6 +1072,7 @@ lemma Lebesgue_outer_measure_of_dim_zero {E: Set (EuclideanSpace' 0)} : -- Apply helper lemma: infinite indicator sum diverges to ⊤ -- g and the lemma function are definitionally equal under classical convert hasSum_indicator_top_of_infinite X hX using 2 + simp [g] exact h_top.tsum_eq.symm ▸ h_top -- If HasSum g s, then for any finite set F, ∑ n ∈ F, g n ≤ s -- Apply this with F = {n₀} @@ -1110,7 +1111,7 @@ lemma Lebesgue_outer_measure_of_dim_zero {E: Set (EuclideanSpace' 0)} : -- Lower bound: 0 ≤ sInf (all EReal sums are ≥ 0 when summing volumes) · apply le_sInf intro b hb - simp only [Set.mem_setOf_eq] at hb + simp only [Set.mem_ofPred_eq] at hb obtain ⟨X, S, _, hb_eq⟩ := hb rw [hb_eq] -- Sum of nonnegative volumes is ≥ 0 @@ -1217,6 +1218,7 @@ lemma tsum_volume_finset_eq {d : ℕ} (hd : 0 < d) (S : Finset (Box d)) : apply Finset.prod_eq_zero (Finset.mem_univ (⟨0, hd⟩ : Fin d)) simp only [ite_true] simp [BoundedInterval.length] + exact le_of_eq rfl -- Step 2: Use tsum_eq_sum to convert infinite sum to finite sum have h_tsum_eq : ∑' n, (S_seq n).volume.toEReal = ∑ n ∈ Finset.range S_list.length, (S_seq n).volume.toEReal := by @@ -1224,7 +1226,7 @@ lemma tsum_volume_finset_eq {d : ℕ} (hd : 0 < d) (S : Finset (Box d)) : intro n hn simp only [Finset.mem_range, not_lt] at hn unfold S_seq - rw [dif_neg (not_lt_of_ge hn)] + rw [dite_eq_right (not_lt_of_ge hn)] simp [h_zero_vol] -- Step 3: Relate finset.range sum to finset S sum @@ -1287,7 +1289,7 @@ lemma tsum_volume_finset_eq {d : ℕ} (hd : 0 < d) (S : Finset (Box d)) : · -- h: Function preserves summand intro n hn have hn_lt := Finset.mem_range.mp hn - simp only [S_seq, dif_pos hn_lt] + simp only [S_seq, dite_eq_left hn_lt] -- For any bounded set, the Lebesgue outer measure is at most the Jordan outer measure. @@ -1325,7 +1327,7 @@ theorem Lebesgue_outer_measure_le_Jordan {d:ℕ} {E: Set (EuclideanSpace' d)} (h -- Find a nonempty box in the partition have : ∃ B ∈ S, B.toSet.Nonempty := by by_contra h - push_neg at h + push Not at h -- h says: ∀ B, B ∈ S → B.toSet = ∅ have hA_empty : A = ∅ := by rw [hA_eq] @@ -1408,7 +1410,7 @@ theorem Lebesgue_outer_measure_le_Jordan {d:ℕ} {E: Set (EuclideanSpace' d)} (h -- S_seq i.val = S_list.get ⟨i.val, i.isLt⟩ = B by hi_eq simp only [S_seq] have hi_val_lt : i.val < S_list.length := i.isLt - rw [dif_pos hi_val_lt] + rw [dite_eq_left hi_val_lt] -- Show ⟨i.val, hi_val_lt⟩ = i so we can use hi_eq have : (⟨i.val, hi_val_lt⟩ : Fin S_list.length) = i := Fin.ext rfl rw [this, hi_eq] diff --git a/Analysis/MeasureTheory/Section_1_2_1.lean b/Analysis/MeasureTheory/Section_1_2_1.lean index 6d5003b88..0b468436d 100644 --- a/Analysis/MeasureTheory/Section_1_2_1.lean +++ b/Analysis/MeasureTheory/Section_1_2_1.lean @@ -1,3 +1,4 @@ +import Mathlib.Analysis.Real.Cardinality import Analysis.MeasureTheory.Section_1_2_0 import Analysis.Misc.«Real-EReal-ENNReal» import Analysis.Misc.Combinatorics @@ -104,8 +105,8 @@ theorem Lebesgue_outer_measure.finite_union_le {d n:ℕ} (E: Fin n → Set (Eucl · intro ⟨k, hx⟩ by_cases hk : k < n · use ⟨k, hk⟩ - simpa [dif_pos hk] using hx - · simp [dif_neg hk] at hx + simpa [dite_eq_left hk] using hx + · simp [dite_eq_right hk] at hx rw [h_union] -- Apply countable subadditivity calc Lebesgue_outer_measure (⋃ k, E' k) @@ -113,7 +114,7 @@ theorem Lebesgue_outer_measure.finite_union_le {d n:ℕ} (E: Fin n → Set (Eucl _ = ∑ i : Fin n, Lebesgue_outer_measure (E i) := by -- The sum over ℕ equals the sum over Fin n because E' k = ∅ for k ≥ n -- First, establish that E' k = ∅ for k ≥ n, so its outer measure is 0 - have h_empty : ∀ k ≥ n, E' k = ∅ := fun k hk => dif_neg (not_lt.mpr hk) + have h_empty : ∀ k ≥ n, E' k = ∅ := fun k hk => dite_eq_right (not_lt.mpr hk) have h_measure_empty : ∀ k ≥ n, Lebesgue_outer_measure (E' k) = 0 := by intro k hk rw [h_empty k hk, of_empty] @@ -146,7 +147,7 @@ theorem Lebesgue_outer_measure.finite_union_le {d n:ℕ} (E: Fin n → Set (Eucl rw [this] congr 1 ext i - simp [E', dif_pos i.isLt] + simp [E', dite_eq_left i.isLt] noncomputable def set_dist {X:Type*} [PseudoMetricSpace X] (A B: Set X) : ℝ := @@ -570,7 +571,7 @@ lemma BoundedInterval.exists_points_with_diff {I : BoundedInterval} | Icc a b => simp only [length, BoundedInterval.a, BoundedInterval.b] at ht h_len_pos have h_ab : a < b := by - by_contra h; push_neg at h + by_contra h; push Not at h have : max (b - a) 0 = 0 := max_eq_right (by linarith) linarith have h_t_lt : t < b - a := by @@ -584,7 +585,7 @@ lemma BoundedInterval.exists_points_with_diff {I : BoundedInterval} | Ioo a b => simp only [length, BoundedInterval.a, BoundedInterval.b] at ht h_len_pos have h_ab : a < b := by - by_contra h; push_neg at h + by_contra h; push Not at h have : max (b - a) 0 = 0 := max_eq_right (by linarith) linarith have h_t_lt : t < b - a := by @@ -603,7 +604,7 @@ lemma BoundedInterval.exists_points_with_diff {I : BoundedInterval} | Ioc a b => simp only [length, BoundedInterval.a, BoundedInterval.b] at ht h_len_pos have h_ab : a < b := by - by_contra h; push_neg at h + by_contra h; push Not at h have : max (b - a) 0 = 0 := max_eq_right (by linarith) linarith have h_t_lt : t < b - a := by @@ -622,7 +623,7 @@ lemma BoundedInterval.exists_points_with_diff {I : BoundedInterval} | Ico a b => simp only [length, BoundedInterval.a, BoundedInterval.b] at ht h_len_pos have h_ab : a < b := by - by_contra h; push_neg at h + by_contra h; push Not at h have : max (b - a) 0 = 0 := max_eq_right (by linarith) linarith have h_t_lt : t < b - a := by @@ -779,7 +780,7 @@ lemma diameter_eq_sqrt_sum_sq {d:ℕ} (B: Box d) (h: B.toSet.Nonempty) : rw [h_target] -- Since ∑ side² > 0, at least one side is positive have h_exists_pos : ∃ j, 0 < |B.side j|ₗ := by - by_contra h_all_zero; push_neg at h_all_zero + by_contra h_all_zero; push Not at h_all_zero have h_sum_zero : (∑ i, |B.side i|ₗ^2) = 0 := by apply Finset.sum_eq_zero; intro i _ have : |B.side i|ₗ ≤ 0 := h_all_zero i @@ -808,7 +809,7 @@ lemma diameter_eq_sqrt_sum_sq {d:ℕ} (B: Box d) (h: B.toSet.Nonempty) : calc (|B.side j|ₗ * ratio)^2 < |x j - y j|^2 := h_sq_lt _ = (x j - y j)^2 := by rw [sq_abs] · -- c < 0 case: any distance ≥ 0 > c - push_neg at hc_nonneg + push Not at hc_nonneg obtain ⟨x, hx⟩ := h use 0 constructor @@ -936,7 +937,7 @@ lemma volume_subdivide {d:ℕ} (B: Box d) : rw [Finset.mem_filter] at hc₁ hc₂ -- c₁ and c₂ differ at some coordinate have ⟨i, hi_ne⟩ : ∃ i, c₁ i ≠ c₂ i := by - by_contra h; push_neg at h; exact hne (funext h) + by_contra h; push Not at h; exact hne (funext h) -- At that coordinate, g c₁ = g c₂ implies bisect.fst = bisect.snd have hside : (g c₁).side i = (g c₂).side i := congrArg (·.side i) (hc₁.2.trans hc₂.2.symm) simp only [g] at hside @@ -1445,14 +1446,14 @@ lemma diameter_lt_of_iter_count {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (r: rw [hB'] calc B.diameter ≤ 0 := h_diam_le _ < r := hr - · push_neg at h_diam_le + · push Not at h_diam_le by_cases h_small : B.diameter < r · -- Already small enough, no subdivisions needed simp only [iter_count, not_le.mpr h_diam_le, h_small, ↓reduceIte, subdivide_iter] at hB' simp only [Finset.mem_singleton] at hB' rw [hB']; exact h_small · -- Need subdivisions: B.diameter ≥ r, so we use the logarithmic formula - push_neg at h_small + push Not at h_small have h_iter_bound := diameter_subdivide_iter B hB (B.iter_count r) B' hB' -- Show that B.diameter / (√2)^k < r for k = iter_count -- Key: iter_count = ⌈2 * log(B.diameter / r) / log 2⌉ + 1 @@ -1545,7 +1546,7 @@ lemma subdivide_iter_covers {d:ℕ} (B : Box d) (k : ℕ) (x : EuclideanSpace' d · have hc : c i = true := decide_eq_true hm simp only [hc, ite_true] exact (BoundedInterval.mem_bisect_snd_iff (B''.side i) (x i) hx_i).mpr hm - · push_neg at hm + · push Not at hm have hc : c i = false := decide_eq_false (not_le.mpr hm) simp only [hc] exact (BoundedInterval.mem_bisect_fst_iff (B''.side i) (x i) hx_i).mpr (le_of_lt hm) @@ -1760,7 +1761,7 @@ lemma le_of_finset_cover {d:ℕ} (hd: 0 < d) (E: Set (EuclideanSpace' d)) have h_lhs : ∑' (p : SigmaType), p.snd.val.volume.toEReal = ↑(∑' (p : SigmaType), f_enn p) := by have h_eq : ∀ p : SigmaType, p.snd.val.volume.toEReal = φ (f_enn p) := by intro p - simp only [f_enn, φ, AddMonoidHom.coe_mk, ZeroHom.coe_mk] + show p.snd.val.volume.toEReal = ((ENNReal.ofReal p.snd.val.volume : ENNReal) : EReal) rw [EReal.coe_ennreal_ofReal, max_eq_left (Box.volume_nonneg _)] simp_rw [h_eq] exact (Summable.map_tsum ENNReal.summable φ h_cont).symm @@ -1781,7 +1782,7 @@ lemma le_of_finset_cover {d:ℕ} (hd: 0 < d) (E: Set (EuclideanSpace' d)) rw [map_sum] apply Finset.sum_congr rfl intro (B : (I n : Set (Box d))) _ - simp only [f_enn, φ, AddMonoidHom.coe_mk, ZeroHom.coe_mk] + show B.val.volume.toEReal = ((ENNReal.ofReal B.val.volume : ENNReal) : EReal) rw [EReal.coe_ennreal_ofReal, max_eq_left (Box.volume_nonneg _)] simp_rw [h_eq_term] exact (Summable.map_tsum ENNReal.summable φ h_cont).symm @@ -1863,7 +1864,7 @@ lemma exists_cover_close {d:ℕ} (hd: 0 < d) have h_exists_lt : ∃ v ∈ img_set, v < inf_val + (ε : EReal) := by -- If no such element existed, then inf_val + ε would be a lower bound by_contra h_not_exists - push_neg at h_not_exists + push Not at h_not_exists -- h_not_exists says: ∀ v ∈ img_set, inf_val + ε ≤ v -- This means inf_val + ε is a lower bound have h_is_lb : inf_val + (ε : EReal) ∈ lowerBounds img_set := by @@ -2222,16 +2223,7 @@ lemma partition_volume_bound {d : ℕ} {P : Finset (Box d)} Finset.sum_add_distrib _ = ∑ x : { B // B ∈ P_nonempty }, (B' x.1 x.2).volume + P_nonempty.card * ε := by congr 1 - rw [Finset.sum_const, Finset.card_univ, ← smul_eq_mul] - have : (Finset.univ : Finset { B // B ∈ P_nonempty }).image (fun x => x.val) = P_nonempty := by - ext B - simp only [Finset.mem_image] - constructor - · intro ⟨a, _, ha_eq⟩; rw [← ha_eq]; exact a.property - · intro hB; exact ⟨⟨B, hB⟩, Finset.mem_univ _, rfl⟩ - rw [← Finset.card_univ, ← this] - rw [Finset.card_image_of_injective _ (fun x y h => Subtype.ext h)] - simp [smul_eq_mul] + rw [Finset.sum_const, Finset.card_univ, Fintype.card_coe, nsmul_eq_mul] /-- Shrunk boxes B' inherit injectivity from parent boxes' disjointness when B' are nonempty. -/ lemma injective_of_shrunk_nonempty {d : ℕ} {P : Finset (Box d)} @@ -2284,13 +2276,13 @@ lemma Box.inflate {d:ℕ} (B: Box d) (δ: ℝ) (hδ: 0 < δ) : ext x; simp only [Box.mem_toSet, Set.mem_univ, iff_true]; intro i; exact Fin.elim0 i rw [hB_univ, interior_univ] -- Dimension d > 0: use continuity argument to find small enough ε - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd -- Define the expanded volume function f(ε) = ∏ᵢ (Lᵢ + 2ε) let f : ℝ → ℝ := fun ε => ∏ i : Fin d, (|B.side i|ₗ + 2 * ε) -- f is continuous have hf_cont : Continuous f := by - apply continuous_finset_prod + apply continuous_finsetProd intro i _ exact (continuous_const.add (continuous_const.mul continuous_id)) -- f(0) = |B|ᵥ @@ -2345,7 +2337,7 @@ lemma Box.inflate {d:ℕ} (B: Box d) (δ: ℝ) (hδ: 0 < δ) : -- |B'|ᵥ = ∏ᵢ |B'.side i|ₗ ≤ ∏ᵢ (|B.side i|ₗ + 2ε) = f(ε) have hB'_vol_le : |B'|ᵥ ≤ f ε := by simp only [Box.volume, f, B'] - apply Finset.prod_le_prod + apply Finset.prod_le_prod₀ · intro i _; exact BoundedInterval.length_nonneg _ · intro i _ simp only [BoundedInterval.length, BoundedInterval.a, BoundedInterval.b] @@ -2358,7 +2350,7 @@ lemma Box.inflate {d:ℕ} (B: Box d) (δ: ℝ) (hδ: 0 < δ) : · have h2 : max (b - a) 0 = b - a := max_eq_left (by linarith : 0 ≤ b - a) have h3 : max (b - a + 2 * ε) 0 = b - a + 2 * ε := max_eq_left (by linarith) rw [h2, h3] - · push_neg at hab + · push Not at hab have h2 : max (b - a) 0 = 0 := max_eq_right (by linarith : b - a ≤ 0) rw [h2, zero_add] exact max_le (by linarith) (by linarith) @@ -2388,7 +2380,7 @@ lemma Box.shrink_to_closed {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (δ: ℝ) ( rw [this]; exact isClosed_univ exact ⟨Set.Subset.refl _, h_closed, by linarith, hB⟩ -- Dimension d > 0 - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd have h_sides_nonempty : ∀ i : Fin d, (B.side i).toSet.Nonempty := fun i => Box.side_nonempty_of_nonempty B hB i @@ -2399,7 +2391,7 @@ lemma Box.shrink_to_closed {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (δ: ℝ) ( let g : ℝ → ℝ := fun ε => ∏ i : Fin d, max (|B.side i|ₗ - 2 * ε) 0 -- g is continuous (max ∘ (f, g) is continuous when f, g are) have hg_cont : Continuous g := by - apply continuous_finset_prod + apply continuous_finsetProd intro i _ apply Continuous.max · exact continuous_const.sub (continuous_const.mul continuous_id) @@ -2486,7 +2478,7 @@ lemma Box.shrink_to_closed {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (δ: ℝ) ( have h_ab : (B.side i).a ≤ (B.side i).b := by have := h_all_pos i simp only [BoundedInterval.length] at this - by_contra h_neg; push_neg at h_neg + by_contra h_neg; push Not at h_neg have : max ((B.side i).b - (B.side i).a) 0 = 0 := max_eq_right (by linarith) linarith simp only [BoundedInterval.length] at h_pos_len @@ -2520,7 +2512,7 @@ lemma Box.shrink_to_closed {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (δ: ℝ) ( have h_side_pos := h_all_pos i simp only [BoundedInterval.length] at h_side_pos have h_ab : (B.side i).a ≤ (B.side i).b := by - by_contra h_neg; push_neg at h_neg + by_contra h_neg; push Not at h_neg have : max ((B.side i).b - (B.side i).a) 0 = 0 := max_eq_right (by linarith) linarith have h_max : max ((B.side i).b - (B.side i).a) 0 = (B.side i).b - (B.side i).a := max_eq_left (by linarith) @@ -2532,7 +2524,7 @@ lemma Box.shrink_to_closed {d:ℕ} (B: Box d) (hB: B.toSet.Nonempty) (δ: ℝ) ( _ = (B.side i).b - (B.side i).a := by simp only [BoundedInterval.length, h_max] linarith · -- Degenerate case: some side has zero length, volume is 0 - push_neg at h_all_pos + push Not at h_all_pos obtain ⟨i₀, hi₀⟩ := h_all_pos have hvol_zero : |B|ᵥ = 0 := by simp only [Box.volume] @@ -3091,7 +3083,7 @@ lemma Lebesgue_outer_measure.elementary_dim_zero (E: Set (EuclideanSpace' 0)) (h rfl · -- Case: E is empty → outer measure = 0 = hE.measure have hE_empty : E = ∅ := Set.not_nonempty_iff_eq_empty.mp hne - simp only [hne, if_false] + simp only [hne, ite_false] -- Need: (0 : EReal) = hE.measure -- Use that E = ∅ implies hE.measure = 0 have h_meas_eq : hE.measure = (IsElementary.empty 0).measure := @@ -3114,7 +3106,7 @@ theorem Lebesgue_outer_measure.elementary {d:ℕ} (E: Set (EuclideanSpace' d)) ( -- For now, defer to a helper lemma exact Lebesgue_outer_measure.elementary_dim_zero E hE · -- Dimension > 0 case - push_neg at hd + push Not at hd have hd' : 0 < d := Nat.pos_of_ne_zero hd apply le_antisymm · exact IsElementary.outer_measure_le_measure hd' hE @@ -3400,7 +3392,7 @@ lemma U_real_closure_contains_unit_interval (ε : ℝ) (hε : 0 < ε) : · simp only [Rat.cast_zero, Set.mem_Icc, le_refl, zero_le_one, and_self] · rw [Rat.cast_zero, zero_sub, abs_neg, abs_of_nonneg hx.1] exact h - · push_neg at h + · push Not at h obtain ⟨r, hr1, hr2⟩ := exists_rat_btwn (sub_lt_self x hδ_pos) use r constructor @@ -3622,7 +3614,7 @@ example : ∃ (E: Set (EuclideanSpace' 1)), Bornology.IsBounded E ∧ refine ⟨?bounded, ?compact, ?not_jm⟩ case bounded => -- E ⊆ B which is bounded - apply Bornology.IsBounded.subset _ Set.diff_subset + apply Bornology.IsBounded.subset _ Set.sdiff_subset rw [Metric.isBounded_iff_subset_closedBall 0] use 3 intro x hx @@ -3658,7 +3650,7 @@ example : ∃ (E: Set (EuclideanSpace' 1)), Bornology.IsBounded E ∧ -- B \ U = B ∩ Uᶜ is closed in B (since Uᶜ is closed) have hU_compl_closed : IsClosed Uᶜ := hU_open.isClosed_compl -- B \ U is compact (closed subset of compact) - rw [Set.diff_eq] + rw [Set.sdiff_eq] exact hB_compact.inter_right hU_compl_closed case not_jm => intro hE_jm @@ -3770,7 +3762,7 @@ lemma IsElementary.measure_of_almostDisjUnion {d:ℕ} {E F: Set (EuclideanSpace' -- But E ∩ F is elementary and has empty interior, so measure ≤ 0 -- For disjoint interiors, we can show measure_mono in reverse direction have h_decomp_F : F = (E ∩ F) ∪ (F \ E) := by - ext x; simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_diff] + ext x; simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] constructor · intro hx by_cases hxE : x ∈ E @@ -3818,7 +3810,7 @@ lemma IsElementary.measure_of_almostDisjUnion {d:ℕ} {E F: Set (EuclideanSpace' by_cases hB_nonempty : B.toSet.Nonempty · right by_contra h_all_nonempty - push_neg at h_all_nonempty + push Not at h_all_nonempty have : (Set.univ.pi fun i => interior (B.side i).toSet).Nonempty := Set.univ_pi_nonempty_iff.mpr (fun i => h_all_nonempty i) rw [B.interior_toSet] at hB_interior_empty @@ -3935,7 +3927,7 @@ lemma BoundedInterval.interior_closure_subset_closure_interior (I : BoundedInter because the frontier of a box is a lower-dimensional set (union of faces). -/ lemma Box.interior_frontier_eq_empty {d : ℕ} (B : Box d) : interior (frontier B.toSet) = ∅ := by rw [Box.frontier_toSet, ← (PiLp.homeomorph 2 (fun _ : Fin d => ℝ)).preimage_interior] - rw [frontier, closure_pi_set, interior_pi_set Set.finite_univ, Set.diff_eq, + rw [frontier, closure_pi_set, interior_pi_set Set.finite_univ, Set.sdiff_eq, interior_inter, interior_pi_set Set.finite_univ, interior_compl, closure_pi_set] apply Set.eq_empty_iff_forall_notMem.mpr intro x hx @@ -4036,7 +4028,7 @@ theorem IsElementary.almost_disjoint {d k:ℕ} {E: Set (EuclideanSpace' d)} (hE: rw [mem_closure_iff] intro V hV_open hz_V by_contra h_empty - push_neg at h_empty + push Not at h_empty rw [Set.eq_empty_iff_forall_notMem] at h_empty have hV_sub : V ⊆ (B' i).toSet := fun w hw => by by_contra h_not_in @@ -4214,10 +4206,10 @@ theorem Lebesgue_outer_measure.univ {d:ℕ} {hd: 0 < d} : Lebesgue_outer_measure intro c rw [Box.interior_toSet] ext x; simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, true_implies, - Set.mem_setOf_eq, UnitBox, BoundedInterval.toSet, interior_Icc]; rfl + Set.mem_ofPred_eq, UnitBox, BoundedInterval.toSet, interior_Icc]; rfl rw [h_int a, h_int b] ext x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_and] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] intro ha hb apply hab funext i @@ -4408,7 +4400,7 @@ lemma interior {d:ℕ} (n:ℤ) (a: Fin d → ℤ) : {x | ∀ i, x i ∈ Set.Ioo ((a i : ℝ) / 2^n) (((a i : ℝ) + 1) / 2^n)} := by rw [Box.interior_toSet] ext x; simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, true_implies, - Set.mem_setOf_eq, DyadicCube, BoundedInterval.toSet, interior_Icc]; rfl + Set.mem_ofPred_eq, DyadicCube, BoundedInterval.toSet, interior_Icc]; rfl /-- Dyadic cubes at the same scale with different indices have disjoint interiors. -/ lemma almost_disjoint_same_scale {d:ℕ} {n:ℤ} {a b : Fin d → ℤ} (hab : a ≠ b) : @@ -4416,7 +4408,7 @@ lemma almost_disjoint_same_scale {d:ℕ} {n:ℤ} {a b : Fin d → ℤ} (hab : a simp only [AlmostDisjoint] rw [DyadicCube.interior, DyadicCube.interior] ext x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_and] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] intro ha hb apply hab funext i @@ -4488,11 +4480,11 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : exact ⟨le_trans (h_subset i).1 hxi.1, le_trans hxi.2 (h_subset i).2⟩ · -- Not contained, so they are almost disjoint left - push_neg at h_subset + push Not at h_subset obtain ⟨i, hi⟩ := h_subset simp only [AlmostDisjoint, DyadicCube.interior] ext x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_and] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] intro ha hb have hai := ha i have hbi := hb i @@ -4512,7 +4504,7 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : · -- Intervals (b_i/2^m, (b_i+1)/2^m) and (a_i/2^n, (a_i+1)/2^n) don't overlap linarith [hai.1, hbi.2] · -- Intervals overlap: b_i/2^m < a_i/2^n < (b_i+1)/2^m - push_neg at h_disj + push Not at h_disj -- a_i * 2^(m-n) lies strictly between b_i and b_i+1 -- But a_i * 2^(m-n) is an integer (since m > n implies m-n > 0) have hlo : (b i : ℝ) < (a i : ℝ) * 2^(m-n) := by @@ -4541,14 +4533,14 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : have : (b i : ℤ) < k ∧ k < b i + 1 := ⟨by exact_mod_cast hlo, by exact_mod_cast hhi⟩ omega · -- ¬(b_i/2^m < a_i/2^n), so a_i/2^n ≤ b_i/2^m - push_neg at h_left + push Not at h_left -- By hi: (a_i+1)/2^n < (b_i+1)/2^m have h_right := hi h_left by_cases h_disj : ((a i : ℝ) + 1) / 2^n ≤ (b i : ℝ) / 2^m · -- Intervals don't overlap linarith [hai.2, hbi.1] · -- Intervals overlap: b_i/2^m < (a_i+1)/2^n < (b_i+1)/2^m - push_neg at h_disj + push Not at h_disj -- (a_i+1) * 2^(m-n) lies strictly between b_i and b_i+1 have hlo : (b i : ℝ) < ((a i : ℝ) + 1) * 2^(m-n) := by have h1 : (b i : ℝ) / 2^m * 2^m < ((a i : ℝ) + 1) / 2^n * 2^m := by nlinarith @@ -4593,11 +4585,11 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : exact ⟨le_trans (h_subset i).1 hxi.1, le_trans hxi.2 (h_subset i).2⟩ · -- Not contained, so they are almost disjoint left - push_neg at h_subset + push Not at h_subset obtain ⟨i, hi⟩ := h_subset simp only [AlmostDisjoint, DyadicCube.interior] ext x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_and] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] intro ha hb have hai := ha i have hbi := hb i @@ -4611,7 +4603,7 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : · -- Intervals don't overlap linarith [hai.2, hbi.1] · -- Intervals overlap: a_i/2^n < b_i/2^m < (a_i+1)/2^n - push_neg at h_disj + push Not at h_disj -- b_i * 2^(n-m) lies strictly between a_i and a_i+1 have hlo : (a i : ℝ) < (b i : ℝ) * 2^(n-m) := by have h1 : (a i : ℝ) / 2^n * 2^n < (b i : ℝ) / 2^m * 2^n := by nlinarith @@ -4639,14 +4631,14 @@ lemma nesting {d:ℕ} {n m : ℤ} {a : Fin d → ℤ} {b : Fin d → ℤ} : have : (a i : ℤ) < k ∧ k < a i + 1 := ⟨by exact_mod_cast hlo, by exact_mod_cast hhi⟩ omega · -- ¬(a_i/2^n < b_i/2^m), so b_i/2^m ≤ a_i/2^n - push_neg at h_left + push Not at h_left -- By hi: (a_i+1)/2^n > (b_i+1)/2^m have h_right := hi h_left by_cases h_disj : ((b i : ℝ) + 1) / 2^m ≤ (a i : ℝ) / 2^n · -- Intervals don't overlap linarith [hai.1, hbi.2] · -- Intervals overlap: a_i/2^n < (b_i+1)/2^m < (a_i+1)/2^n - push_neg at h_disj + push Not at h_disj -- (b_i+1) * 2^(n-m) lies strictly between a_i and a_i+1 have hlo : (a i : ℝ) < ((b i : ℝ) + 1) * 2^(n-m) := by have h1 : (a i : ℝ) / 2^n * 2^n < ((b i : ℝ) + 1) / 2^m * 2^n := by nlinarith @@ -4915,7 +4907,7 @@ theorem IsOpen.eq_union_boxes {d:ℕ} (hd : 0 < d) (E: Set (EuclideanSpace' d)) have hQ_max_nonempty : Q_max.Nonempty := by obtain ⟨n₀, a₀, hx₀_mem, hsub, hmin⟩ := h_exists_min_scale x₀ hx₀ use ⟨n₀, a₀⟩ - simp only [Set.mem_setOf_eq, Q_max] + simp only [Set.mem_ofPred_eq, Q_max] constructor · exact hsub · intro q hq hsub' @@ -4955,7 +4947,7 @@ theorem IsOpen.eq_union_boxes {d:ℕ} (hd : 0 < d) (E: Set (EuclideanSpace' d)) use p.1 intro q hq by_contra hlt - push_neg at hlt + push Not at hlt have hle := hp.le_of_le hq hlt.le omega -- But there exist points in E whose maximal cube has scale > N @@ -5046,7 +5038,7 @@ theorem IsOpen.eq_union_boxes {d:ℕ} (hd : 0 < d) (E: Set (EuclideanSpace' d)) obtain ⟨n₀, a₀, hxa₀, hsub, hmin⟩ := h_exists_min_scale x hx -- (n₀, a₀) ∈ Q_max have h_in_Qmax : (⟨n₀, a₀⟩ : ℕ × (Fin d → ℤ)) ∈ Q_max := by - simp only [Set.mem_setOf_eq, Q_max] + simp only [Set.mem_ofPred_eq, Q_max] constructor · exact hsub · intro q hq hsub' @@ -5211,7 +5203,7 @@ theorem Lebesgue_outer_measure.of_open {d:ℕ} (E: Set (EuclideanSpace' d)) (hE: norm_num · -- Case: E is empty have hE_empty : E = ∅ := Set.not_nonempty_iff_eq_empty.mp hne - simp only [hne, if_false] + simp only [hne, ite_false] subst hE_empty -- Show (0 : EReal) = ↑(Jordan_inner_measure ∅) -- First prove Jordan_inner_measure ∅ = 0 @@ -5234,7 +5226,7 @@ theorem Lebesgue_outer_measure.of_open {d:ℕ} (E: Set (EuclideanSpace' d)) (hE: · use ∅, IsElementary.empty 0; simp [IsElementary.measure_of_empty] rw [h_jordan_empty] norm_num - · push_neg at hd + · push Not at hd have hd' : 0 < d := Nat.pos_of_ne_zero hd by_cases hE_empty : E = ∅ · -- Empty set case: use Lebesgue_outer_measure.of_empty and Jordan_inner_measure ∅ = 0 @@ -5318,7 +5310,7 @@ theorem Lebesgue_outer_measure.eq {d:ℕ} (E: Set (EuclideanSpace' d)) : Lebesgu · exact ⟨Set.univ, Set.subset_univ _, isOpen_univ, rfl⟩ · exact le_refl _ -- d > 0: main argument - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd -- Case split on whether m*(E) = ⊤ by_cases h_top : Lebesgue_outer_measure E = ⊤ @@ -5593,8 +5585,8 @@ lemma Lebesgue_outer_measure.exists_open_superset_measure_le {d:ℕ} (E: Set (Eu have h_le : sInf S + ε ≤ sInf S := h_inf.2 h_is_lb exact not_lt.mpr h_le h_lt unfold lowerBounds at h_not_lb - simp only [Set.mem_setOf_eq] at h_not_lb - push_neg at h_not_lb + simp only [Set.mem_ofPred_eq] at h_not_lb + push Not at h_not_lb obtain ⟨v, hv_in_S, hv_lt⟩ := h_not_lb obtain ⟨U, hE_sub_U, hU_open, hv_eq⟩ := hv_in_S use U diff --git a/Analysis/MeasureTheory/Section_1_2_2.lean b/Analysis/MeasureTheory/Section_1_2_2.lean index 0938c1e4f..f89e4ef33 100644 --- a/Analysis/MeasureTheory/Section_1_2_2.lean +++ b/Analysis/MeasureTheory/Section_1_2_2.lean @@ -1,3 +1,4 @@ +import Mathlib.Analysis.Calculus.ContDiff.Defs import Analysis.MeasureTheory.Section_1_2_1 /-! @@ -21,7 +22,7 @@ theorem IsOpen.measurable {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: IsOpen E) : · -- E ⊆ E (reflexivity) rfl · -- Show m*(E \ E) ≤ ε - have h_empty : E \ E = ∅ := Set.diff_self + have h_empty : E \ E = ∅ := Set.sdiff_self rw [h_empty] have h_zero : Lebesgue_outer_measure (∅ : Set (EuclideanSpace' d)) = 0 := Lebesgue_outer_measure.of_empty d @@ -132,9 +133,9 @@ private lemma IsClosed.measurable_of_bounded {d:ℕ} {E: Set (EuclideanSpace' d) have hxy : x = y := Subsingleton.elim x y rw [hxy] exact hy - rw [hEU_eq, Set.diff_self, Lebesgue_outer_measure.of_empty] + rw [hEU_eq, Set.sdiff_self, Lebesgue_outer_measure.of_empty] exact le_of_lt hε - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd -- If U \ E is empty, trivial by_cases h_diff_empty : U \ E = ∅ @@ -229,7 +230,7 @@ private lemma IsClosed.measurable_of_bounded {d:ℕ} {E: Set (EuclideanSpace' d) exact Set.mem_iUnion_of_mem i hyi have hF_sub : (⋃ n, (Q n).toSet) ⊆ U := by rw [← hQ_union] - exact Set.diff_subset + exact Set.sdiff_subset exact hF_sub (this hxF) -- So m*(E ∪ F_t) ≤ m*(U) ≤ m*(E) + ε/2 have h_bound : Lebesgue_outer_measure (E ∪ F_t) ≤ Lebesgue_outer_measure E + ε / 2 := by @@ -376,11 +377,11 @@ theorem IsNull.measurable {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: IsNull E) : use ∅ refine ⟨isOpen_empty, ?_, ?_⟩ · rw [hE_empty] - · simp only [Set.empty_diff] + · simp only [Set.empty_sdiff] rw [Lebesgue_outer_measure.of_empty] exact le_of_lt hε -- Now d > 0 - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd -- m*(E) = 0 implies m*(E) ≠ ⊤ have h_finite : Lebesgue_outer_measure E ≠ ⊤ := by rw [hE]; exact EReal.zero_ne_top @@ -419,7 +420,7 @@ theorem IsNull.measurable {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: IsNull E) : · -- m*(U \ E) ≤ ε -- Key bounds: m*(U \ E) ≤ m*(U) ≤ ∑ |U' n|ᵥ ≤ ∑ (|S n|ᵥ + δ n) ≤ ε'/2 + ε'/2 = ε' ≤ ε have h1 : Lebesgue_outer_measure (U \ E) ≤ Lebesgue_outer_measure U := - Lebesgue_outer_measure.mono Set.diff_subset + Lebesgue_outer_measure.mono Set.sdiff_subset have h2 : Lebesgue_outer_measure U ≤ ∑' n, Lebesgue_outer_measure (interior (U' n).toSet) := by have : U = ⋃ n, interior (U' n).toSet := rfl rw [this] @@ -531,7 +532,7 @@ theorem LebesgueMeasurable.empty' {d:ℕ} : LebesgueMeasurable (∅: Set (Euclid · exact isOpen_empty constructor · exact Set.empty_subset ∅ - · have h_empty : ∅ \ ∅ = (∅ : Set (EuclideanSpace' d)) := Set.diff_self + · have h_empty : ∅ \ ∅ = (∅ : Set (EuclideanSpace' d)) := Set.sdiff_self rw [h_empty] rw [Lebesgue_outer_measure.of_empty d] exact le_of_lt hε @@ -627,9 +628,9 @@ theorem LebesgueMeasurable.complement {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: -- Key set-theoretic fact: Eᶜ \ Fₙ = Uₙ \ E have h_diff_eq : ∀ n, Eᶜ \ F_n n = U n \ E := fun n => by - simp only [F_n, Set.diff_compl] + simp only [F_n, Set.sdiff_compl] ext x - simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_diff] + simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_sdiff] tauto -- Step 3: Define F = ⋃ Fₙ (F-sigma set) @@ -637,7 +638,7 @@ theorem LebesgueMeasurable.complement {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: -- Step 4: Show m*(Eᶜ \ F) = 0 have h_diff_F : ∀ n, Eᶜ \ F ⊆ U n \ E := fun n => by - have h1 : Eᶜ \ F ⊆ Eᶜ \ F_n n := Set.diff_subset_diff_right (Set.subset_iUnion F_n n) + have h1 : Eᶜ \ F ⊆ Eᶜ \ F_n n := Set.sdiff_subset_sdiff_right (Set.subset_iUnion F_n n) rw [h_diff_eq n] at h1 exact h1 @@ -650,7 +651,7 @@ theorem LebesgueMeasurable.complement {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: apply le_antisymm · -- Show m*(Eᶜ \ F) ≤ 0 by showing it's ≤ 1/(n+1) for all n by_contra h_ne - push_neg at h_ne + push Not at h_ne have h_pos : 0 < Lebesgue_outer_measure (Eᶜ \ F) := h_ne -- Get a real ε with 0 < ε ≤ m*(Eᶜ \ F) obtain ⟨ε, hε_pos, hε_le⟩ : ∃ ε : ℝ, 0 < ε ∧ (ε : EReal) ≤ Lebesgue_outer_measure (Eᶜ \ F) := by @@ -683,7 +684,7 @@ theorem LebesgueMeasurable.complement {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: -- Step 5: Show Eᶜ = F ∪ (Eᶜ \ F) have h_decomp : Eᶜ = F ∪ (Eᶜ \ F) := by ext x - simp only [Set.mem_union, Set.mem_diff] + simp only [Set.mem_union, Set.mem_sdiff] constructor · intro hx by_cases hxF : x ∈ F @@ -913,7 +914,7 @@ theorem LebesgueMeasurable.TFAE {d:ℕ} (E: Set (EuclideanSpace' d)) : ].TFAE := by sorry - /-- Exercise 1.2.8 -/ +/-- Exercise 1.2.8 -/ theorem Jordan_measurable.lebesgue {d:ℕ} {E: Set (EuclideanSpace' d)} (hE: JordanMeasurable E) : LebesgueMeasurable E := by sorry @@ -1100,7 +1101,7 @@ private lemma Lebesgue_measure.countable_union_bounded {d:ℕ} (hd : 0 < d) have h_14 : LebesgueMeasurable (E n) → (∀ ε > 0, ∃ F : Set (EuclideanSpace' d), IsClosed F ∧ F ⊆ E n ∧ Lebesgue_outer_measure (E n \ F) ≤ ε) := by - have := List.TFAE.out h_tfae 0 3 + have := List.TFAE.out h_tfae 1 4 exact this.mp exact h_14 (hmes n) δ hδ -- Choose ε_n = ε / 2^{n+1} for each n @@ -1134,7 +1135,7 @@ private lemma Lebesgue_measure.countable_union_bounded {d:ℕ} (hd : 0 < d) intro n -- E_n = F_n ∪ (E_n \ F_n), and F_n ⊆ E_n -- By monotonicity and subadditivity: m(E_n) ≤ m(F_n) + m(E_n \ F_n) ≤ m(F_n) + ε/2^{n+1} - have h_partition : E n = F n ∪ (E n \ F n) := (Set.union_diff_cancel (hF n).2.1).symm + have h_partition : E n = F n ∪ (E n \ F n) := (Set.union_sdiff_cancel (hF n).2.1).symm -- Binary subadditivity: m(A ∪ B) ≤ m(A) + m(B) have h_binary_subadd : Lebesgue_measure (F n ∪ (E n \ F n)) ≤ Lebesgue_measure (F n) + Lebesgue_measure (E n \ F n) := by @@ -1275,7 +1276,7 @@ theorem Lebesgue_measure.countable_union {d:ℕ} {E: ℕ → Set (EuclideanSpace simp_rw [h_empty, Set.iUnion_empty] simp only [Lebesgue_measure.empty, tsum_zero, le_refl] · -- At least one E n is nonempty; by disjointness in a subsingleton, exactly one - push_neg at h_empty + push Not at h_empty obtain ⟨n₀, hn₀⟩ := h_empty -- In a Subsingleton, a nonempty set equals univ have hE_univ : E n₀ = Set.univ := by @@ -1311,7 +1312,7 @@ theorem Lebesgue_measure.countable_union {d:ℕ} {E: ℕ → Set (EuclideanSpace rw [hE_empty m hm, Lebesgue_measure.empty] rw [h_sum, h_union] · -- For d ≥ 1, use the annuli decomposition from the textbook - push_neg at hd + push Not at hd have hd_pos : 0 < d := Nat.pos_of_ne_zero hd -- Define annuli: A_m = { x : m ≤ |x| < m+1 } for m ≥ 0 -- Then ℝᵈ = ⋃_m A_m (disjoint union) and each A_m is bounded @@ -1323,13 +1324,13 @@ theorem Lebesgue_measure.countable_union {d:ℕ} {E: ℕ → Set (EuclideanSpace rw [Metric.isBounded_iff_subset_closedBall 0] use m + 1 intro x hx - simp only [Metric.mem_closedBall, dist_zero_right, A, Set.mem_setOf_eq] at hx ⊢ + simp only [Metric.mem_closedBall, dist_zero_right, A, Set.mem_ofPred_eq] at hx ⊢ exact le_of_lt hx.2 -- The annuli cover all of ℝᵈ have hA_cover : ∀ x : EuclideanSpace' d, ∃ m, x ∈ A m := by intro x use ⌊‖x‖⌋₊ - simp only [A, Set.mem_setOf_eq] + simp only [A, Set.mem_ofPred_eq] constructor · exact Nat.floor_le (norm_nonneg x) · exact Nat.lt_floor_add_one ‖x‖ @@ -1338,14 +1339,14 @@ theorem Lebesgue_measure.countable_union {d:ℕ} {E: ℕ → Set (EuclideanSpace intro i _ j _ hij simp only [Function.onFun, Set.disjoint_iff] intro x ⟨hi, hj⟩ - simp only [A, Set.mem_setOf_eq, Set.mem_empty_iff_false] at hi hj ⊢ + simp only [A, Set.mem_ofPred_eq, Set.mem_empty_iff_false] at hi hj ⊢ by_cases h : i < j · have h1 : (j : ℝ) ≤ ‖x‖ := hj.1 have h2 : ‖x‖ < i + 1 := hi.2 have h3 : (j : ℝ) < i + 1 := lt_of_le_of_lt h1 h2 have h4 : j < i + 1 := by exact_mod_cast h3 omega - · push_neg at h + · push Not at h have hji : j < i := lt_of_le_of_ne h (Ne.symm hij) have h1 : (i : ℝ) ≤ ‖x‖ := hi.1 have h2 : ‖x‖ < j + 1 := hj.2 @@ -1366,7 +1367,7 @@ theorem Lebesgue_measure.countable_union {d:ℕ} {E: ℕ → Set (EuclideanSpace have h2 : IsOpen { x : EuclideanSpace' d | ‖x‖ < (m : ℝ) + 1 } := isOpen_lt continuous_norm continuous_const have heq : A m = { x | (m : ℝ) ≤ ‖x‖ } ∩ { x | ‖x‖ < (m : ℝ) + 1 } := by - ext x; simp only [A, Set.mem_setOf_eq, Set.mem_inter_iff] + ext x; simp only [A, Set.mem_ofPred_eq, Set.mem_inter_iff] rw [heq] exact LebesgueMeasurable.inter h1.measurable h2.measurable exact LebesgueMeasurable.inter (hmes n) hA_meas @@ -1535,17 +1536,17 @@ theorem Lebesgue_measure.finite_union {d n:ℕ} {E: Fin n → Set (EuclideanSpac · intro ⟨k, hx⟩ by_cases hk : k < n · use ⟨k, hk⟩ - simpa [dif_pos hk] using hx - · simp [dif_neg hk] at hx + simpa [dite_eq_left hk] using hx + · simp [dite_eq_right hk] at hx -- E' is measurable (E(k) is measurable, ∅ is measurable) have hmes' : ∀ k, LebesgueMeasurable (E' k) := by intro k simp only [E'] by_cases hk : k < n - · simp [dif_pos hk] + · simp [dite_eq_left hk] exact hmes ⟨k, hk⟩ - · simp [dif_neg hk] + · simp [dite_eq_right hk] exact LebesgueMeasurable.empty -- E' is pairwise disjoint @@ -1553,24 +1554,24 @@ theorem Lebesgue_measure.finite_union {d n:ℕ} {E: Fin n → Set (EuclideanSpac intro i _ j _ hij simp only [E', Function.onFun] by_cases hi : i < n <;> by_cases hj : j < n - · simp only [dif_pos hi, dif_pos hj] + · simp only [dite_eq_left hi, dite_eq_left hj] have hne : (⟨i, hi⟩ : Fin n) ≠ ⟨j, hj⟩ := by intro heq apply hij exact congrArg Fin.val heq exact hdisj (Set.mem_univ _) (Set.mem_univ _) hne - · simp only [dif_pos hi, dif_neg hj] + · simp only [dite_eq_left hi, dite_eq_right hj] exact disjoint_bot_right - · simp only [dif_neg hi, dif_pos hj] + · simp only [dite_eq_right hi, dite_eq_left hj] exact disjoint_bot_left - · simp only [dif_neg hi, dif_neg hj] + · simp only [dite_eq_right hi, dite_eq_right hj] exact disjoint_bot_left -- Apply countable_union rw [h_union, Lebesgue_measure.countable_union hmes' hdisj'] -- The tsum over ℕ equals the tsum over Fin n (since E' k = ∅ for k ≥ n) - have h_empty : ∀ k ≥ n, E' k = ∅ := fun k hk => dif_neg (not_lt.mpr hk) + have h_empty : ∀ k ≥ n, E' k = ∅ := fun k hk => dite_eq_right (not_lt.mpr hk) have h_measure_empty : ∀ k ≥ n, Lebesgue_measure (E' k) = 0 := by intro k hk rw [h_empty k hk, Lebesgue_measure.empty] @@ -1581,7 +1582,7 @@ theorem Lebesgue_measure.finite_union {d n:ℕ} {E: Fin n → Set (EuclideanSpac -- Direct approach: show term-by-term equality using the embedding have h_eq_terms : ∀ i : Fin n, Lebesgue_measure (E' i.val) = Lebesgue_measure (E i) := by intro i - simp only [E', dif_pos i.isLt] + simp only [E', dite_eq_left i.isLt] -- The tsum over ℕ equals the tsum over Fin n via reindexing -- Show that the support of E' is contained in {k : k < n} @@ -1777,7 +1778,7 @@ theorem Lebesgue_measure.unique {d:ℕ} (m: Set (EuclideanSpace' d) → EReal) : ∀ E, LebesgueMeasurable E → m E = Lebesgue_measure E := by sorry /-- Exercise 1.2.24(i) (Lebesgue measure as the completion of elementary measure). -/ -instance IsElementary.ae_equiv {d:ℕ} {A: Set (EuclideanSpace' d)} (hA: IsElementary A): +def IsElementary.ae_equiv {d:ℕ} {A: Set (EuclideanSpace' d)} (hA: IsElementary A): Setoid (Set A) := { r E F := IsNull (Subtype.val '' (_root_.symmDiff E F)) iseqv := by sorry diff --git a/Analysis/MeasureTheory/Section_1_2_3.lean b/Analysis/MeasureTheory/Section_1_2_3.lean index 2bcf178f6..ec03e0d9b 100644 --- a/Analysis/MeasureTheory/Section_1_2_3.lean +++ b/Analysis/MeasureTheory/Section_1_2_3.lean @@ -164,7 +164,7 @@ theorem VitaliSet.nonmeasurable : ¬ LebesgueMeasurable (Real.equiv_EuclideanSpa -- f has range = {q | q ∈ [-1,1]} have hf_range : {q | q ∈ Set.Icc (-1:ℚ) 1} = Set.range f := by ext q - simp only [Set.mem_setOf_eq, Set.mem_range, f] + simp only [Set.mem_ofPred_eq, Set.mem_range, f] constructor · intro hq let q' : {q : ℚ | q ∈ Set.Icc (-1:ℚ) 1} := ⟨q, hq⟩ diff --git a/Analysis/MeasureTheory/Section_1_3_1.lean b/Analysis/MeasureTheory/Section_1_3_1.lean index 434df43f0..0e470726d 100644 --- a/Analysis/MeasureTheory/Section_1_3_1.lean +++ b/Analysis/MeasureTheory/Section_1_3_1.lean @@ -203,7 +203,7 @@ lemma atom_pairwiseDisjoint {X : Type*} {k k' : ℕ} (E : Fin k → Set X) (E' : simp only [Function.onFun] rw [Set.disjoint_left] intro x hxi hxj - simp only [atom, Set.mem_setOf_eq, atomMembership_eq_testBit] at hxi hxj + simp only [atom, Set.mem_ofPred_eq, atomMembership_eq_testBit] at hxi hxj -- If i ≠ j, they differ in some bit have hne : i.val ≠ j.val := Fin.val_ne_of_ne hij obtain ⟨bit, hbit⟩ := Nat.exists_testBit_ne_of_ne hne @@ -212,7 +212,7 @@ lemma atom_pairwiseDisjoint {X : Type*} {k k' : ℕ} (E : Fin k → Set X) (E' : have hj_lt : j.val < 2^(k + k') := j.isLt have hbit_bound : bit < k + k' := by by_contra h - push_neg at h + push Not at h have hi_false : i.val.testBit bit = false := Nat.testBit_lt_two_pow (Nat.lt_of_lt_of_le hi_lt (Nat.pow_le_pow_right (by norm_num : 1 ≤ 2) h)) have hj_false : j.val.testBit bit = false := Nat.testBit_lt_two_pow (Nat.lt_of_lt_of_le hj_lt (Nat.pow_le_pow_right (by norm_num : 1 ≤ 2) h)) exact hbit (hi_false.trans hj_false.symm) @@ -323,7 +323,7 @@ lemma atomIndexOf_testBit_E {X : Type*} [DecidableEq X] {k k' : ℕ} (E : Fin k -- Use testBit_two_pow_mul_add: for j.val < k and Part1 < 2^k, testBit j only looks at Part1 have hpart1_lt : (Finset.univ.filter fun i : Fin k => x ∈ E i).sum (fun i => (2:ℕ)^i.val) < 2^k := sum_pow_two_fin_lt - rw [add_comm, Nat.testBit_two_pow_mul_add _ hpart1_lt, if_pos j.isLt] + rw [add_comm, Nat.testBit_two_pow_mul_add _ hpart1_lt, ite_eq_left j.isLt] -- Now show: Part1.testBit j.val ↔ x ∈ E j rw [Nat.testBit_sum_pow_two_fin] simp only [Finset.mem_filter, Finset.mem_univ, true_and] @@ -341,7 +341,7 @@ lemma atomIndexOf_testBit_E' {X : Type*} [DecidableEq X] {k k' : ℕ} (E : Fin k sum_pow_two_fin_lt rw [add_comm, Nat.testBit_two_pow_mul_add _ hpart1_lt] have hge : ¬ (k + j.val < k) := by omega - rw [if_neg hge] + rw [ite_eq_right hge] -- Now show: Part2_inner.testBit ((k + j.val) - k) ↔ x ∈ E' j have hsub : (k + j.val) - k = j.val := Nat.add_sub_cancel_left k j.val rw [hsub, Nat.testBit_sum_pow_two_fin] @@ -354,7 +354,7 @@ lemma set_eq_biUnion_atoms {X : Type*} {k k' : ℕ} (E : Fin k → Set X) (E' : ext x constructor · intro hx - simp only [Set.mem_iUnion, Set.mem_setOf_eq] + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] -- Construct the atom index from x's membership pattern let n : Fin (2^(k+k')) := ⟨atomIndexOf E E' x, atomIndexOf_lt E E' x⟩ refine ⟨n, ?_, ?_⟩ @@ -363,12 +363,12 @@ lemma set_eq_biUnion_atoms {X : Type*} {k k' : ℕ} (E : Fin k → Set X) (E' : simp only [n, atomIndexOf_testBit_E E E' x i] exact hx · -- Show x ∈ atom E E' n - simp only [atom, Set.mem_setOf_eq, n] + simp only [atom, Set.mem_ofPred_eq, n] refine ⟨fun j => ?_, fun j => ?_⟩ · rw [atomMembership_eq_testBit, atomIndexOf_testBit_E E E' x j] · rw [atomMembership_eq_testBit, atomIndexOf_testBit_E' E E' x j] · intro hx - simp only [Set.mem_iUnion, Set.mem_setOf_eq] at hx + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] at hx obtain ⟨n, hn_bit, hx_atom⟩ := hx exact (hx_atom.1 i).mp hn_bit @@ -379,18 +379,18 @@ lemma set_eq_biUnion_atoms' {X : Type*} {k k' : ℕ} (E : Fin k → Set X) (E' : ext x constructor · intro hx - simp only [Set.mem_iUnion, Set.mem_setOf_eq] + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] let n : Fin (2^(k+k')) := ⟨atomIndexOf E E' x, atomIndexOf_lt E E' x⟩ refine ⟨n, ?_, ?_⟩ · rw [atomMembership_eq_testBit] simp only [n, atomIndexOf_testBit_E' E E' x i] exact hx - · simp only [atom, Set.mem_setOf_eq, n] + · simp only [atom, Set.mem_ofPred_eq, n] refine ⟨fun j => ?_, fun j => ?_⟩ · rw [atomMembership_eq_testBit, atomIndexOf_testBit_E E E' x j] · rw [atomMembership_eq_testBit, atomIndexOf_testBit_E' E E' x j] · intro hx - simp only [Set.mem_iUnion, Set.mem_setOf_eq] at hx + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] at hx obtain ⟨n, hn_bit, hx_atom⟩ := hx exact (hx_atom.2 i).mp hn_bit @@ -404,7 +404,7 @@ lemma atom_measurable {d k k' : ℕ} {E : Fin k → Set (EuclideanSpace' d)} {E' (⋂ i : Fin k, if atomMembership k k' n i then E i else (E i)ᶜ) ∩ (⋂ i : Fin k', if atomMembership k k' n (k + i) then E' i else (E' i)ᶜ) := by ext x - simp only [atom, Set.mem_setOf_eq, Set.mem_inter_iff, Set.mem_iInter] + simp only [atom, Set.mem_ofPred_eq, Set.mem_inter_iff, Set.mem_iInter] constructor · intro ⟨h1, h2⟩ constructor @@ -560,7 +560,7 @@ lemma weightedMeasureSum_eq_of_eq {d k k' : ℕ} have hE_eq : E i = ⋃ n, atom' n := by rw [hE_decomp i] ext x - simp only [Set.mem_iUnion, Set.mem_setOf_eq] + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] constructor · intro ⟨n, hn, hx⟩ use n @@ -614,7 +614,7 @@ lemma weightedMeasureSum_eq_of_eq {d k k' : ℕ} have hE'_eq : E' i = ⋃ n, atom'' n := by rw [hE'_decomp i] ext x - simp only [Set.mem_iUnion, Set.mem_setOf_eq] + simp only [Set.mem_iUnion, Set.mem_ofPred_eq] constructor · intro ⟨n, hn, hx⟩ use n @@ -743,7 +743,7 @@ lemma singleAtom_pairwiseDisjoint {X : Type*} {k : ℕ} (E : Fin k → Set X) : /-- Membership in singleAtom is determined by bit pattern -/ lemma mem_singleAtom_iff {X : Type*} {k : ℕ} (E : Fin k → Set X) (n : Fin (2^k)) (x : X) : x ∈ singleAtom E n ↔ ∀ i : Fin k, n.val.testBit i.val ↔ x ∈ E i := by - simp only [singleAtom, atom, Set.mem_setOf_eq] + simp only [singleAtom, atom, Set.mem_ofPred_eq] constructor · intro ⟨h1, _⟩ i specialize h1 i @@ -846,7 +846,7 @@ lemma UnsignedSimpleFunction.support_measurable {d:ℕ} {f: EuclideanSpace' d -- Key: Support f = ⋃ i, E' i have h_eq : Support f = ⋃ i, E' i := by ext x - simp only [Support, Set.mem_setOf_eq, Set.mem_iUnion, E'] + simp only [Support, Set.mem_ofPred_eq, Set.mem_iUnion, E'] constructor · -- (⊆) If f(x) ≠ 0, some c_i > 0 and x ∈ E_i intro hne @@ -899,7 +899,7 @@ lemma AlmostAlways.ofAlways {d:ℕ} {P: EuclideanSpace' d → Prop} (h: ∀ x, P unfold AlmostAlways IsNull have h_empty : { x | ¬ P x } = ∅ := by ext x - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_not] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_not] exact h x rw [h_empty] exact Lebesgue_outer_measure.of_empty d @@ -912,7 +912,7 @@ lemma AlmostAlways.mp {d:ℕ} {P Q: EuclideanSpace' d → Prop} (hP: AlmostAlway -- Goal: Lebesgue_outer_measure { x | ¬ Q x } = 0 have h_subset : { x | ¬ Q x } ⊆ { x | ¬ P x } := by intro x hx - simp only [Set.mem_setOf_eq] at * + simp only [Set.mem_ofPred_eq] at * exact fun hp => hx (himp x hp) -- By monotonicity: measure { x | ¬ Q x } ≤ measure { x | ¬ P x } = 0 have h_le := Lebesgue_outer_measure.mono h_subset @@ -928,7 +928,7 @@ lemma AlmostAlways.countable {d:ℕ} {I: Type*} [Countable I] {P: I → Euclidea -- hP i : Lebesgue_outer_measure { x | ¬ P i x } = 0 have h_eq : { x | ¬ ∀ i, P i x } = ⋃ i, { x | ¬ P i x } := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iUnion, not_forall] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion, not_forall] rw [h_eq] -- Need: Lebesgue_outer_measure (⋃ i, { x | ¬ P i x }) = 0 -- Use countable type I via Encodable @@ -987,9 +987,9 @@ lemma AlmostEverywhereEqual.trans {d:ℕ} {X: Type*} {f g h: EuclideanSpace' d unfold AlmostEverywhereEqual AlmostAlways IsNull at * have h_subset : {x | f x ≠ h x} ⊆ {x | f x ≠ g x} ∪ {x | g x ≠ h x} := by intro x hx - simp only [Set.mem_setOf_eq, Set.mem_union] at * + simp only [Set.mem_ofPred_eq, Set.mem_union] at * by_contra hc - push_neg at hc + push Not at hc exact hx (hc.1.trans hc.2) -- Express union as ℕ-indexed union for countable subadditivity let E : ℕ → Set (EuclideanSpace' d) := fun n => @@ -1167,7 +1167,7 @@ lemma RealSimpleFunction.disjoint_representation {d:ℕ} {f: EuclideanSpace' d · rw [heq] exact DisjointRepr.eq_sum_atomValue_indicator c E -def RealSimpleFunction.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : UnsignedSimpleFunction (EReal.pos_fun f) := by +lemma RealSimpleFunction.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : UnsignedSimpleFunction (EReal.pos_fun f) := by -- Use disjoint representation: f = ∑ i, v_i • A_i.indicator' with disjoint A_i obtain ⟨n, v, A, hA_meas, hA_disj, heq⟩ := hf.disjoint_representation -- The positive part is ∑ i, (max(v_i, 0)).toEReal • EReal.indicator(A_i) @@ -1211,7 +1211,7 @@ def RealSimpleFunction.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpl · intro h; exact absurd (Finset.mem_univ j) h rw [hlhs, hrhs] · -- x is not in any atom, so f(x) = 0 - push_neg at hx_in + push Not at hx_in have hlhs : f x = 0 := by rw [heq] simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] @@ -1225,7 +1225,7 @@ def RealSimpleFunction.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpl rw [hlhs, hrhs] simp only [max_self, EReal.coe_zero] -def RealSimpleFunction.neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : UnsignedSimpleFunction (EReal.neg_fun f) := by +lemma RealSimpleFunction.neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : UnsignedSimpleFunction (EReal.neg_fun f) := by -- neg_fun f = pos_fun (-f), and -f = (-1) • f is a simple function have h : EReal.neg_fun f = EReal.pos_fun ((-1 : ℝ) • f) := by ext x; simp only [EReal.neg_fun, EReal.pos_fun, Pi.smul_apply, smul_eq_mul, neg_one_mul] @@ -1234,7 +1234,7 @@ def RealSimpleFunction.neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpl noncomputable def RealSimpleFunction.integ {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : ℝ := (hf.pos).integ.toReal - (hf.neg).integ.toReal -def ComplexSimpleFunction.re {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : RealSimpleFunction (Complex.re_fun f) := by +lemma ComplexSimpleFunction.re {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : RealSimpleFunction (Complex.re_fun f) := by -- If f = ∑ i, c_i • Complex.indicator(E_i), then Re(f) = ∑ i, Re(c_i) • indicator'(E_i) obtain ⟨k, c, E, hmes, heq⟩ := hf use k, fun i => (c i).re, E @@ -1249,7 +1249,7 @@ def ComplexSimpleFunction.re {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: Complex simp only [Complex.indicator, Real.complex_fun] rw [Complex.re_mul_ofReal] -def ComplexSimpleFunction.im {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : RealSimpleFunction (Complex.im_fun f) := by +lemma ComplexSimpleFunction.im {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : RealSimpleFunction (Complex.im_fun f) := by -- If f = ∑ i, c_i • Complex.indicator(E_i), then Im(f) = ∑ i, Im(c_i) • indicator'(E_i) obtain ⟨k, c, E, hmes, heq⟩ := hf use k, fun i => (c i).im, E diff --git a/Analysis/MeasureTheory/Section_1_3_2.lean b/Analysis/MeasureTheory/Section_1_3_2.lean index 40c7407b1..253598794 100644 --- a/Analysis/MeasureTheory/Section_1_3_2.lean +++ b/Analysis/MeasureTheory/Section_1_3_2.lean @@ -88,7 +88,7 @@ private lemma ii_imp_iii : stmt_ii f → stmt_iii f := by simp only [PointwiseAeConvergesTo, AlmostAlways] have h_empty : {x | ¬Filter.atTop.Tendsto (fun n ↦ g n x) (nhds (f x))} = ∅ := by ext x - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_not] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_not] exact hg_conv x rw [h_empty] exact Lebesgue_outer_measure.of_empty d @@ -109,14 +109,14 @@ private lemma iv_imp_ii : stmt_iv f → stmt_ii f := by private lemma Set.indicator'_eq_one' {X : Type*} {E : Set X} {x : X} (hx : x ∈ E) : ((E.indicator' x : ℝ) : EReal) = 1 := by classical - rw [Set.indicator'_apply, if_pos hx] + rw [Set.indicator'_apply, ite_eq_left hx] rfl -- Helper: Set.indicator' equals 0 when x ∉ E private lemma Set.indicator'_eq_zero' {X : Type*} {E : Set X} {x : X} (hx : x ∉ E) : ((E.indicator' x : ℝ) : EReal) = 0 := by classical - rw [Set.indicator'_apply, if_neg hx] + rw [Set.indicator'_apply, ite_eq_right hx] rfl -- Level sets of simple functions are Lebesgue measurable @@ -182,7 +182,7 @@ private lemma UnsignedSimpleFunction.levelset_gt_LebesgueMeasurable -- {g > t} = ⋃_{S : ∑_{i ∈ S} c_i > t} R_S have h_eq : {x | g x > t} = ⋃ S ∈ (Finset.univ : Finset (Finset (Fin k))).filter (fun S => ∑ i ∈ S, c i > t), R S := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] constructor · intro hgx obtain ⟨S, hxS, _⟩ := h_partition x @@ -207,9 +207,9 @@ private lemma limsupSet_LebesgueMeasurable {g : ℕ → EuclideanSpace' d → ER intro n by_cases hn : n ≥ N · convert UnsignedSimpleFunction.levelset_gt_LebesgueMeasurable (hg n) (t + 1 / (M + 1)) - ext x; simp only [Set.mem_iUnion, Set.mem_setOf_eq, exists_prop, and_iff_right_iff_imp]; intro _; exact hn + ext x; simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop, and_iff_right_iff_imp]; intro _; exact hn · convert LebesgueMeasurable.empty - ext x; simp only [Set.mem_iUnion, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_exists] + ext x; simp only [Set.mem_iUnion, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_exists] intro h; exact absurd h hn -- This is the main technical work of the proof @@ -226,15 +226,15 @@ private lemma iii_imp_v : stmt_iii f → stmt_v f := by -- So {f > λ} = ⋃_{M≥1} ⋂_{N≥1} ⋃_{n≥N} {g_n > λ + 1/M} outside a null set have h_ae_eq : {x | f x > t} ∩ Nᶜ = E ∩ Nᶜ := by ext x - simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_setOf_eq, N] - push_neg + simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_ofPred_eq, N] + push Not constructor · -- f x > t ∧ converges → x ∈ E ∧ converges intro ⟨hfx, hconv⟩ refine ⟨?_, hconv⟩ -- Since f(x) > t and g_n(x) → f(x), we can find M such that f(x) > t + 1/M -- Then eventually g_n(x) > t + 1/M, which means x ∈ limsupSet - simp only [E, limsupSet, Set.mem_iUnion, Set.mem_iInter, Set.mem_setOf_eq] + simp only [E, limsupSet, Set.mem_iUnion, Set.mem_iInter, Set.mem_ofPred_eq] -- The detailed analysis argument uses Filter.Tendsto properties -- For a limit f(x), if f(x) > t, then ∃ε>0 with f(x) > t+ε -- Choose M with 1/M < ε, then eventually g_n(x) > t + 1/M @@ -339,7 +339,7 @@ private lemma iii_imp_v : stmt_iii f → stmt_v f := by refine ⟨?_, hconv⟩ -- If x ∈ limsupSet g t, then for some M, infinitely often g_n(x) > t + 1/M -- Since g_n(x) → f(x), limsup g_n(x) = f(x), so f(x) ≥ t + 1/M > t - simp only [E, limsupSet, Set.mem_iUnion, Set.mem_iInter, Set.mem_setOf_eq] at hE_mem + simp only [E, limsupSet, Set.mem_iUnion, Set.mem_iInter, Set.mem_ofPred_eq] at hE_mem -- hE_mem : ∃ M, ∀ N, ∃ n ≥ N, g n x > t + 1/(M+1) obtain ⟨M, hM⟩ := hE_mem -- Set threshold := t + 1/(M+1) @@ -378,7 +378,7 @@ private lemma iii_imp_v : stmt_iii f → stmt_v f := by -- g n x ≥ 0 for all n, and g n x → f x, so f x ≥ 0 have h_limit_nonneg : f x ≥ 0 := by by_contra h_neg - push_neg at h_neg + push Not at h_neg have h_mem : Set.Iio 0 ∈ nhds (f x) := Iio_mem_nhds h_neg have h_event : ∀ᶠ n in Filter.atTop, g n x < 0 := hconv h_mem rw [Filter.eventually_atTop] at h_event @@ -389,7 +389,7 @@ private lemma iii_imp_v : stmt_iii f → stmt_v f := by _ ≤ f x := h_limit_nonneg -- Now ⊥ < t < ⊤ (t is a finite real) by_contra h_not_gt - push_neg at h_not_gt + push Not at h_not_gt -- h_not_gt : f x ≤ t -- Derive contradiction: if f x ≤ t, eventually g_n x < threshold, but frequently > threshold have h_denom_ne_top : (M : EReal) + 1 ≠ ⊤ := EReal.add_ne_top (EReal.natCast_ne_top M) (EReal.coe_ne_top 1) @@ -454,7 +454,7 @@ private lemma v_imp_vi : stmt_v f → stmt_vi f := by · -- t = ⊤: {f ≥ ⊤} = {f = ⊤} = ⋂_{n ∈ ℕ} {f > n} have h_eq : {x | f x ≥ ⊤} = ⋂ (n : ℕ), {x | f x > n} := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iInter, ge_iff_le] + simp only [Set.mem_ofPred_eq, Set.mem_iInter, ge_iff_le] constructor · intro hfx n simp only [gt_iff_lt, top_le_iff.mp hfx] @@ -471,7 +471,7 @@ private lemma v_imp_vi : stmt_v f → stmt_vi f := by -- Use {f ≥ t'} = ⋂_n {f > (t' - 1/(n+1) : ℝ)} have h_eq : {x | f x ≥ (t' : EReal)} = ⋂ (n : ℕ), {x | f x > ((t' - 1 / (n + 1)) : ℝ)} := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iInter, ge_iff_le, gt_iff_lt] + simp only [Set.mem_ofPred_eq, Set.mem_iInter, ge_iff_le, gt_iff_lt] constructor · intro hfx n have h1 : (0 : ℝ) < 1 / (n + 1) := by positivity @@ -480,7 +480,7 @@ private lemma v_imp_vi : stmt_v f → stmt_vi f := by exact lt_of_lt_of_le h3 hfx · intro hfx by_contra h - push_neg at h + push Not at h -- f x < t' have hfx_lt_t' : f x < (t' : EReal) := h -- Get a witness for f x being a real @@ -533,14 +533,14 @@ private lemma vi_imp_v : stmt_vi f → stmt_v f := by | none => ∅ := fun _ => rfl have h_eq : {x | f x > t} = ⋃ n, F n := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iUnion] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion] constructor · intro hfx -- f x > t, so there exists q ∈ ℚ with t < q < f x obtain ⟨q, hq1, hq2⟩ := EReal.exists_rat_btwn_of_lt hfx use Encodable.encode q -- encode q as ℕ rw [hF_eq, Encodable.encodek] - simp only [hq1, ite_true, Set.mem_setOf_eq] + simp only [hq1, ite_true, Set.mem_ofPred_eq] exact le_of_lt hq2 · intro ⟨n, hn⟩ rw [hF_eq] at hn @@ -549,7 +549,7 @@ private lemma vi_imp_v : stmt_vi f → stmt_v f := by | some q => simp only [hd] at hn by_cases h : t < ((q : ℝ) : EReal) - · simp only [h, ite_true, Set.mem_setOf_eq] at hn + · simp only [h, ite_true, Set.mem_ofPred_eq] at hn calc t < ((q : ℝ) : EReal) := h _ ≤ f x := hn · simp only [h, ite_false, Set.mem_empty_iff_false] at hn @@ -609,7 +609,7 @@ private lemma v_to_viii_imp_ix (hv : stmt_v f) (hvi : stmt_vi f) (hvii : stmt_vi have h_eq : f⁻¹' (Real.toEReal '' Set.Ioo a b) = {x | f x > a} ∩ {x | f x < b} := by rw [EReal.image_coe_Ioo] ext x - simp only [Set.mem_preimage, Set.mem_Ioo, Set.mem_inter_iff, Set.mem_setOf_eq, gt_iff_lt] + simp only [Set.mem_preimage, Set.mem_Ioo, Set.mem_inter_iff, Set.mem_ofPred_eq, gt_iff_lt] rw [h_eq] exact (hv _).inter (hvii _) | Icc a b => @@ -617,7 +617,7 @@ private lemma v_to_viii_imp_ix (hv : stmt_v f) (hvi : stmt_vi f) (hvii : stmt_vi have h_eq : f⁻¹' (Real.toEReal '' Set.Icc a b) = {x | f x ≥ a} ∩ {x | f x ≤ b} := by rw [EReal.image_coe_Icc] ext x - simp only [Set.mem_preimage, Set.mem_Icc, Set.mem_inter_iff, Set.mem_setOf_eq, ge_iff_le] + simp only [Set.mem_preimage, Set.mem_Icc, Set.mem_inter_iff, Set.mem_ofPred_eq, ge_iff_le] rw [h_eq] exact (hvi _).inter (hviii _) | Ioc a b => @@ -625,7 +625,7 @@ private lemma v_to_viii_imp_ix (hv : stmt_v f) (hvi : stmt_vi f) (hvii : stmt_vi have h_eq : f⁻¹' (Real.toEReal '' Set.Ioc a b) = {x | f x > a} ∩ {x | f x ≤ b} := by rw [EReal.image_coe_Ioc] ext x - simp only [Set.mem_preimage, Set.mem_Ioc, Set.mem_inter_iff, Set.mem_setOf_eq, gt_iff_lt] + simp only [Set.mem_preimage, Set.mem_Ioc, Set.mem_inter_iff, Set.mem_ofPred_eq, gt_iff_lt] rw [h_eq] exact (hv _).inter (hviii _) | Ico a b => @@ -633,7 +633,7 @@ private lemma v_to_viii_imp_ix (hv : stmt_v f) (hvi : stmt_vi f) (hvii : stmt_vi have h_eq : f⁻¹' (Real.toEReal '' Set.Ico a b) = {x | f x ≥ a} ∩ {x | f x < b} := by rw [EReal.image_coe_Ico] ext x - simp only [Set.mem_preimage, Set.mem_Ico, Set.mem_inter_iff, Set.mem_setOf_eq, ge_iff_le] + simp only [Set.mem_preimage, Set.mem_Ico, Set.mem_inter_iff, Set.mem_ofPred_eq, ge_iff_le] rw [h_eq] exact (hvi _).inter (hvii _) @@ -683,13 +683,13 @@ private lemma ereal_top_singleton_eq : ({⊤} : Set EReal) = (Set.range Real.toE constructor · intro hx rw [hx] - push_neg + push Not constructor · intro r hr exact EReal.coe_ne_top r hr · intro h; exact absurd h.symm (ne_of_lt bot_lt_top) · intro hx - push_neg at hx + push Not at hx induction x using EReal.rec with | bot => exact (hx.2 rfl).elim | top => rfl @@ -1035,7 +1035,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm swap · -- v not in range: level set is empty convert LebesgueMeasurable.empty - ext x; simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] + ext x; simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] intro h; exact hv_range ⟨x, h⟩ -- v is in range: the level set is a Boolean combination of measurable sets @@ -1043,7 +1043,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm have h_split : {x | approx_fn f n x = v} = ({x | ‖x‖ ≤ (n:ℝ)} ∩ {x | approx_fn f n x = v}) ∪ ({x | ‖x‖ > (n:ℝ)} ∩ {x | approx_fn f n x = v}) := by - ext x; simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq] + ext x; simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_ofPred_eq] by_cases h : ‖x‖ ≤ n <;> simp [h, lt_of_not_ge] rw [h_split] apply LebesgueMeasurable.union @@ -1066,7 +1066,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm rw [← EReal.coe_div]; congr 1; field_simp have h_eq : {x | ‖x‖ ≤ (n:ℝ)} ∩ {x | approx_fn f n x = v} = {x | ‖x‖ ≤ n} ∩ {x | f x ≥ (n : EReal)} := by - ext x; simp only [Set.mem_inter_iff, Set.mem_setOf_eq] + ext x; simp only [Set.mem_inter_iff, Set.mem_ofPred_eq] constructor · intro ⟨hnorm, hval⟩ rw [hv_eq_n] at hval @@ -1101,9 +1101,9 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm have h_min_le : (min (f x) ↑n).toReal ≤ n := by have h_le := min_le_right (f x) ↑n have := EReal.toReal_le_toReal h_le hbot (EReal.coe_ne_top n) - simp only at this; exact this + exact this have h_min_eq_n : (min (f x) ↑n).toReal = n := le_antisymm h_min_le h_toReal_ge - by_contra hcontra; push_neg at hcontra + by_contra hcontra; push Not at hcontra have h_min_eq : min (f x) ↑n = f x := min_eq_left (le_of_lt hcontra) rw [h_min_eq] at h_min_eq_n have h_fx_ne_top : f x ≠ ⊤ := by intro heq; rw [heq] at hcontra; exact not_lt.mpr le_top hcontra @@ -1145,7 +1145,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm have h_eq : {x | ‖x‖ ≤ (n:ℝ)} ∩ {x | approx_fn f n x = v} = {x | ‖x‖ ≤ n} ∩ ({x | f x ≥ (((k : ℕ) : ℝ) / (2^n : ℝ) : EReal)} ∩ {x | f x < ((((k + 1) : ℕ) : ℝ) / (2^n : ℝ) : EReal)}) := by - ext x; simp only [Set.mem_inter_iff, Set.mem_setOf_eq] + ext x; simp only [Set.mem_inter_iff, Set.mem_ofPred_eq] constructor · intro ⟨hnorm, hval⟩ rw [hv_eq] at hval @@ -1206,7 +1206,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm _ = ((k + 1) : ℕ) / 2^n := by rw [h_k1_eq] _ ≤ n := h_val_le_n' · -- h_fx_le_n : ¬(f x ≤ n), i.e., n < f x - push_neg at h_fx_le_n + push Not at h_fx_le_n -- min(f x, n) = n when f x > n have h_min : min (f x) ↑n = ↑n := min_eq_right (le_of_lt h_fx_le_n) -- h_toReal_lt : (min (f x) n).toReal < (↑k + 1) / 2^n @@ -1295,7 +1295,7 @@ private lemma approx_fn_levelset_LebesgueMeasurable (hf : Unsigned f) (hvi : stm · have h_eq : {x | ‖x‖ > (n:ℝ)} ∩ {x | approx_fn f n x = v} = if v = 0 then {x | ‖x‖ > (n:ℝ)} else ∅ := by ext x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, approx_fn] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, approx_fn] constructor · intro ⟨hn, hv⟩ have hn' : ¬ ‖x‖ ≤ (n:ℝ) := not_le.mpr hn @@ -1347,14 +1347,13 @@ private lemma v_to_xi_imp_iv (hf : Unsigned f) (hvi : stmt_vi f) (hvii : stmt_vi have h_unique : ∃! i : Fin K, x ∈ E i := by by_cases hk_max : k = n * 2^n · use ⟨n * 2^n, by omega⟩ - simp only [E, c, Set.mem_setOf_eq] + simp only [E, c, Set.mem_ofPred_eq] constructor · simp only [hk_max] at hk_eq simp only [ite_true] rw [hk_eq] -- Use helper lemma, then normalize coercions - convert mul_pow2_div_pow2_eq n using 2 - simp only [← EReal.coe_natCast, Nat.cast_pow, Nat.cast_ofNat, EReal.coe_pow] + convert mul_pow2_div_pow2_eq n using 2 <;> norm_cast · intro j hj -- hj : approx_fn f n x = if ↑j = n * 2^n then ↑n else ↑↑↑j / ↑(2^n) -- The simp didn't make progress because E is not in scope for hj after previous simp @@ -1370,7 +1369,7 @@ private lemma v_to_xi_imp_iv (hf : Unsigned f) (hvi : stmt_vi f) (hvii : stmt_vi convert hj.symm.trans hk_eq using 2 <;> norm_cast exact ereal_div_pow2_eq_imp_eq j.val (n * 2^n) n h_eq_ereal · use ⟨k, by omega⟩ - simp only [E, c, Set.mem_setOf_eq] + simp only [E, c, Set.mem_ofPred_eq] constructor · have h_c_val : (if k = n * 2^n then (n : EReal) else ((k : ℕ) : ℝ) / (2^n : ℝ)) = ((k : ℕ) : ℝ) / (2^n : ℝ) := by simp [hk_max] simp only [h_c_val] @@ -1385,7 +1384,7 @@ private lemma v_to_xi_imp_iv (hf : Unsigned f) (hvi : stmt_vi f) (hvii : stmt_vi convert hk_eq.symm.trans hj using 2; all_goals norm_cast have h_eq : (((k : ℕ) : ℝ) : EReal) / ((2^n : ℕ) : EReal) = (((n * 2^n : ℕ) : ℝ) : EReal) / ((2^n : ℕ) : EReal) := by - rw [h_k_val]; convert (mul_pow2_div_pow2_eq n).symm using 2 + rw [h_k_val]; convert (mul_pow2_div_pow2_eq n).symm using 2 <;> norm_cast exact absurd (ereal_div_pow2_eq_imp_eq k (n * 2^n) n h_eq) hk_max · -- Both j and k are not n*2^n simp only [hj_max, ↓reduceIte] at hj @@ -1436,7 +1435,7 @@ private lemma v_to_xi_imp_iv (hf : Unsigned f) (hvi : stmt_vi f) (hvii : stmt_vi intro x hx simp only [Support] at hx by_contra h - simp only [Set.mem_setOf_eq, not_le] at h + simp only [Set.mem_ofPred_eq, not_le] at h -- When ‖x‖ > n, approx_fn f n x = 0 have h' : ¬(‖x‖ ≤ (n : ℝ)) := not_le.mpr h have h_eq : approx_fn f n x = 0 := by @@ -1716,7 +1715,7 @@ theorem UnsignedMeasurable.TFAE {d:ℕ} {f: EuclideanSpace' d → EReal} (hf: Un /-- Exercise 1.3.3(i) -/ theorem Continuous.UnsignedMeasurable {d:ℕ} {f: EuclideanSpace' d → EReal} (hf: Continuous f) (hnonneg: Unsigned f): _root_.UnsignedMeasurable f := by have h_iff : _root_.UnsignedMeasurable f ↔ ∀ U : Set EReal, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (_root_.UnsignedMeasurable.TFAE hnonneg).out 0 9 + (_root_.UnsignedMeasurable.TFAE hnonneg).out 1 10 apply h_iff.mpr intro U hU exact IsOpen.measurable (hU.preimage hf) @@ -1746,7 +1745,7 @@ theorem UnsignedMeasurable.sup {d:ℕ} {f: ℕ → EuclideanSpace' d → EReal} exact le_trans ((hf 0).1 x) (le_iSup (fun n ↦ f n x) 0) have h_iff : UnsignedMeasurable (fun x ↦ iSup (fun n ↦ f n x)) ↔ ∀ t, LebesgueMeasurable {x | iSup (fun n ↦ f n x) > t} := - (UnsignedMeasurable.TFAE hnonneg).out 0 4 + (UnsignedMeasurable.TFAE hnonneg).out 1 5 apply h_iff.mpr intro t have h_eq : {x | iSup (fun n ↦ f n x) > t} = ⋃ n, {x | f n x > t} := by @@ -1755,7 +1754,7 @@ theorem UnsignedMeasurable.sup {d:ℕ} {f: ℕ → EuclideanSpace' d → EReal} rw [h_eq] refine LebesgueMeasurable.countable_union fun n => ?_ have hn : UnsignedMeasurable (f n) ↔ ∀ t, LebesgueMeasurable {x | f n x > t} := - (UnsignedMeasurable.TFAE (hf n).1).out 0 4 + (UnsignedMeasurable.TFAE (hf n).1).out 1 5 exact hn.mp (hf n) t /-- Exercise 1.3.3(iii) -/ @@ -1765,17 +1764,17 @@ theorem UnsignedMeasurable.inf {d:ℕ} {f: ℕ → EuclideanSpace' d → EReal} exact le_iInf fun n => (hf n).1 x have h_iff : UnsignedMeasurable (fun x ↦ iInf (fun n ↦ f n x)) ↔ ∀ t, LebesgueMeasurable {x | iInf (fun n ↦ f n x) ≥ t} := - (UnsignedMeasurable.TFAE hnonneg).out 0 5 + (UnsignedMeasurable.TFAE hnonneg).out 1 6 apply h_iff.mpr intro t have h_eq : {x | iInf (fun n ↦ f n x) ≥ t} = ⋂ n, {x | f n x ≥ t} := by ext x - simp only [Set.mem_setOf_eq, Set.mem_iInter] + simp only [Set.mem_ofPred_eq, Set.mem_iInter] exact le_iInf_iff rw [h_eq] refine LebesgueMeasurable.countable_inter fun n => ?_ have hn : UnsignedMeasurable (f n) ↔ ∀ t, LebesgueMeasurable {x | f n x ≥ t} := - (UnsignedMeasurable.TFAE (hf n).1).out 0 5 + (UnsignedMeasurable.TFAE (hf n).1).out 1 6 exact hn.mp (hf n) t /-- Exercise 1.3.3(iii) -/ @@ -1792,7 +1791,7 @@ theorem UnsignedMeasurable.liminf {d:ℕ} {f: ℕ → EuclideanSpace' d → ERea theorem UnsignedMeasurable.aeEqual {d:ℕ} {f g: EuclideanSpace' d → EReal} (hf: UnsignedMeasurable f) (hg : Unsigned g) (heq: AlmostEverywhereEqual f g) : UnsignedMeasurable g := by obtain ⟨_, u, hu, huf⟩ := hf have h_iff : UnsignedMeasurable g ↔ ∃ u, (∀ n, UnsignedSimpleFunction (u n)) ∧ - PointwiseAeConvergesTo u g := (UnsignedMeasurable.TFAE hg).out 0 2 + PointwiseAeConvergesTo u g := (UnsignedMeasurable.TFAE hg).out 1 3 refine h_iff.mpr ⟨u, hu, ?_⟩ exact AlmostAlways.mp heq fun x hx => hx ▸ huf x @@ -1807,9 +1806,9 @@ theorem UnsignedMeasurable.aeLimit {d:ℕ} {f: EuclideanSpace' d → EReal} (g: theorem UnsignedMeasurable.comp_cts {d:ℕ} {f: EuclideanSpace' d → EReal} (hf: UnsignedMeasurable f) {φ: EReal → EReal} (hφ: Continuous φ) (hφnn : ∀ x ≥ 0, φ x ≥ 0) : UnsignedMeasurable (φ ∘ f) := by have hnonneg : Unsigned (φ ∘ f) := fun x => hφnn (f x) (hf.1 x) have h_source : UnsignedMeasurable f ↔ ∀ U, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (UnsignedMeasurable.TFAE hf.1).out 0 9 + (UnsignedMeasurable.TFAE hf.1).out 1 10 have h_target : UnsignedMeasurable (φ ∘ f) ↔ ∀ U, IsOpen U → LebesgueMeasurable ((φ ∘ f) ⁻¹' U) := - (UnsignedMeasurable.TFAE hnonneg).out 0 9 + (UnsignedMeasurable.TFAE hnonneg).out 1 10 exact h_target.mpr fun U hU => h_source.mp hf (φ ⁻¹' U) (hU.preimage hφ) /-- Exercise 1.3.3(vii) -/ @@ -1896,7 +1895,7 @@ lemma binaryDigit_le_one (x : ℝ) (j : ℕ) : binaryDigit x j ≤ 1 := by lemma binaryDigit_zero (j : ℕ) : binaryDigit 0 j = 0 := by simp only [binaryDigit] have h0' : (0:ℝ) ∈ Set.Ico 0 1 := ⟨le_refl 0, by norm_num⟩ - rw [if_pos h0'] + rw [ite_eq_left h0'] simp [mul_zero] /-- Binary digits of 1 are all 1. -/ @@ -2075,7 +2074,7 @@ lemma binaryDigit_exists_one_of_pos {x : ℝ} (hx_pos : 0 < x) (hx_lt : x < 1) : constructor · simp only [Nat.cast_one]; exact hj_ge · simp only [Nat.cast_one]; linarith - exact ⟨j, by simp only [binaryDigit, if_pos hx_Ico, h_floor_eq]⟩ + exact ⟨j, by simp only [binaryDigit, ite_eq_left hx_Ico, h_floor_eq]⟩ /-- The partial sum bounds x from below: Sₙ(x) ≤ x -/ lemma binaryDigit_partial_sum_le {x : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (n : ℕ) : @@ -2099,7 +2098,7 @@ lemma binaryDigit_partial_sum_lt (x : ℝ) (n : ℕ) : lemma binaryDigit_one_implies_lower_bound {x : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (k : ℕ) (hbk : binaryDigit x (k + 1) = 1) : (⌊(2:ℝ)^k * x⌋₊ : ℝ) / (2:ℝ)^k + (1:ℝ) / (2:ℝ)^(k + 1) ≤ x := by - simp only [binaryDigit, if_pos hx] at hbk + simp only [binaryDigit, ite_eq_left hx] at hbk have heq : (2:ℝ)^(k+1) * x = 2 * ((2:ℝ)^k * x) := by ring have h_floor_odd : ⌊2 * ((2:ℝ)^k * x)⌋₊ % 2 = 1 := by rw [← heq]; exact hbk have h2k1_pos : (0:ℝ) < 2^(k+1) := by positivity @@ -2119,7 +2118,7 @@ lemma binaryDigit_one_implies_lower_bound {x : ℝ} (hx : x ∈ Set.Ico (0:ℝ) lemma binaryDigit_zero_implies_upper_bound {y : ℝ} (hy : y ∈ Set.Ico (0:ℝ) 1) (k : ℕ) (hbk : binaryDigit y (k + 1) = 0) : y < (⌊(2:ℝ)^k * y⌋₊ : ℝ) / (2:ℝ)^k + (1:ℝ) / (2:ℝ)^(k + 1) := by - simp only [binaryDigit, if_pos hy] at hbk + simp only [binaryDigit, ite_eq_left hy] at hbk have heq : (2:ℝ)^(k+1) * y = 2 * ((2:ℝ)^k * y) := by ring have h_floor_even : ⌊2 * ((2:ℝ)^k * y)⌋₊ % 2 = 0 := by rw [← heq]; exact hbk have h2k1_pos : (0:ℝ) < 2^(k+1) := by positivity @@ -2151,7 +2150,7 @@ lemma floor_eq_of_binaryDigit_eq {x y : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (hy | succ n ih => have h_prev : ∀ j < n, binaryDigit x (j + 1) = binaryDigit y (j + 1) := fun j hj => heq j (Nat.lt_succ_of_lt hj) have ih' := ih h_prev - simp only [binaryDigit, if_pos hx, if_pos hy] at heq + simp only [binaryDigit, ite_eq_left hx, ite_eq_left hy] at heq have hmod_eq := heq n (Nat.lt_succ_self n) have hx_nonneg : 0 ≤ (2:ℝ)^n * x := mul_nonneg (by positivity) hx.1 have hy_nonneg : 0 ≤ (2:ℝ)^n * y := mul_nonneg (by positivity) hy.1 @@ -2169,7 +2168,7 @@ lemma binaryDigit_first_diff {x y : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (hy : y ∀ j < k, binaryDigit x (j + 1) = binaryDigit y (j + 1) := by have h_exists_diff : ∃ j, binaryDigit x (j + 1) ≠ binaryDigit y (j + 1) := by by_contra h_all_eq - push_neg at h_all_eq + push Not at h_all_eq have h_floor_eq : ∀ n, ⌊(2:ℝ)^n * x⌋₊ = ⌊(2:ℝ)^n * y⌋₊ := by intro n exact floor_eq_of_binaryDigit_eq hx hy (fun j _ => h_all_eq j) @@ -2199,7 +2198,7 @@ lemma binaryDigit_first_diff {x y : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (hy : y have hby := binaryDigit_le_one y (k + 1) by_cases h : binaryDigit x (k + 1) < binaryDigit y (k + 1) · exact ⟨k, h, hk_first⟩ - · push_neg at h + · push Not at h have hbx_eq : binaryDigit x (k + 1) = 1 := by omega have hby_eq : binaryDigit y (k + 1) = 0 := by omega exfalso @@ -2219,7 +2218,7 @@ lemma binaryToTernary_lt_of_digit_lt {x y : ℝ} have hby_le := binaryDigit_le_one y (k + 1) have hbx_zero : binaryDigit x (k + 1) = 0 := by omega have hby_one : binaryDigit y (k + 1) = 1 := by omega - simp only [binaryToTernaryFn, if_pos hx, if_pos hy] + simp only [binaryToTernaryFn, ite_eq_left hx, ite_eq_left hy] let fx := fun j => (2 * binaryDigit x (j + 1) : ℝ) * (1/3:ℝ)^(j + 1) let fy := fun j => (2 * binaryDigit y (j + 1) : ℝ) * (1/3:ℝ)^(j + 1) have h_first_eq : ∑ j ∈ Finset.range k, fx j = ∑ j ∈ Finset.range k, fy j := by @@ -2288,7 +2287,7 @@ lemma ternary_02_expansion_unique {d e : ℕ → ℕ} (heq : ∑' j, (d j : ℝ) * (1/3:ℝ)^(j + 1) = ∑' j, (e j : ℝ) * (1/3:ℝ)^(j + 1)) : ∀ j, d j = e j := by by_contra h_ne - push_neg at h_ne + push Not at h_ne have h_exists : ∃ k, d k ≠ e k := h_ne let k := Nat.find h_exists have hk_ne : d k ≠ e k := Nat.find_spec h_exists @@ -2417,7 +2416,7 @@ private lemma partial_sum_eq_floor {x : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) (n : have h2n_pos : (0:ℝ) < 2^n := by positivity have hx_nonneg : 0 ≤ x := hx.1 have hb : binaryDigit x (n + 1) = ⌊(2:ℝ)^(n+1) * x⌋₊ % 2 := by - simp only [binaryDigit, if_pos hx] + simp only [binaryDigit, ite_eq_left hx] have h_floor : ⌊(2:ℝ)^(n+1) * x⌋₊ = 2 * ⌊(2:ℝ)^n * x⌋₊ + ⌊(2:ℝ)^(n+1) * x⌋₊ % 2 := by have h2 : (2:ℝ)^(n+1) * x = 2 * ((2:ℝ)^n * x) := by ring rw [h2] @@ -2446,7 +2445,7 @@ private lemma binary_summable {x : ℝ} (hx : x ∈ Set.Ico (0:ℝ) 1) : · intro j have h1 : (binaryDigit x (j + 1) : ℝ) ≤ 1 := by have : binaryDigit x (j + 1) ≤ 1 := by - simp only [binaryDigit, if_pos hx] + simp only [binaryDigit, ite_eq_left hx] omega exact_mod_cast this calc (binaryDigit x (j + 1) : ℝ) * (1/2:ℝ)^(j + 1) @@ -2544,7 +2543,7 @@ lemma mem_CantorSet_of_ternary_02 {y : ℝ} (d : ℕ → ℕ) apply Finset.sum_congr rfl intro j hj simp only [Finset.mem_range] at hj - rw [dif_pos hj] + rw [dite_eq_left hj] simp only [a] field_simp; ring_nf; simp have h_tail_nonneg : 0 ≤ ∑' j, (d (n + j) : ℝ) * (1/3:ℝ)^(n + j + 1) := by @@ -2610,18 +2609,18 @@ lemma binaryToTernary_exists : ∃ g : ℝ → ℝ, BinaryToTernaryProperties g · norm_num zero_outside := by intro x hx - simp only [binaryToTernaryFn, if_neg hx] + simp only [binaryToTernaryFn, ite_eq_right hx] zero_at_zero := by simp only [binaryToTernaryFn] have h0 : (0:ℝ) ∈ Set.Icc 0 1 := ⟨le_refl 0, by norm_num⟩ - rw [if_pos h0] + rw [ite_eq_left h0] simp only [binaryDigit_zero, Nat.cast_zero, mul_zero, zero_mul, tsum_zero] zero_set_countable := by apply Set.Countable.mono _ (Set.countable_singleton 0) intro x hx - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_singleton_iff] at hx ⊢ + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_singleton_iff] at hx ⊢ obtain ⟨hx_in, hgx⟩ := hx - simp only [binaryToTernaryFn, if_pos hx_in] at hgx + simp only [binaryToTernaryFn, ite_eq_left hx_in] at hgx by_contra hx_ne have hx_pos : 0 < x := by rcases eq_or_lt_of_le hx_in.1 with rfl | hpos @@ -2652,17 +2651,17 @@ lemma binaryToTernary_exists : ∃ g : ℝ → ℝ, BinaryToTernaryProperties g subst hy1 have h_exists_k : ∃ k, binaryDigit x (k + 1) = 0 := by by_contra h_all_one - push_neg at h_all_one + push Not at h_all_one have h_all_eq_one : ∀ j, binaryDigit x (j + 1) = 1 := by intro j have h := binaryDigit_le_one x (j + 1) have hne := h_all_one j omega by_cases hx_dyadic : x ∈ DyadicRationals - · simp only [DyadicRationals, Set.mem_setOf_eq] at hx_dyadic + · simp only [DyadicRationals, Set.mem_ofPred_eq] at hx_dyadic obtain ⟨k, n, hx_eq, _⟩ := hx_dyadic have h_zero_after : binaryDigit x (n + 1) = 0 := by - simp only [binaryDigit, if_pos hx_Ico] + simp only [binaryDigit, ite_eq_left hx_Ico] rw [hx_eq] have h_calc : (2:ℝ)^(n + 1) * (k / (2:ℝ)^n) = 2 * k := by field_simp; ring rw [h_calc] @@ -2705,7 +2704,7 @@ lemma binaryToTernary_exists : ∃ g : ℝ → ℝ, BinaryToTernaryProperties g image_in_cantor := by intro y hy obtain ⟨x, hx, rfl⟩ := hy - simp only [binaryToTernaryFn, if_pos hx] + simp only [binaryToTernaryFn, ite_eq_left hx] let d : ℕ → ℕ := fun j => 2 * binaryDigit x (j + 1) have hd : ∀ j, d j ∈ ({0, 2} : Set ℕ) := by intro j @@ -2723,14 +2722,14 @@ lemma binaryToTernary_exists : ∃ g : ℝ → ℝ, BinaryToTernaryProperties g injective_on_nonterminating := by let A := Set.Icc (0:ℝ) 1 \ DyadicRationals use A - refine ⟨Set.diff_subset, ?_, ?_, ?_⟩ + refine ⟨Set.sdiff_subset, ?_, ?_, ?_⟩ · have h_sdiff : Set.Icc (0:ℝ) 1 \ A = DyadicRationals ∩ Set.Icc 0 1 := by - simp only [A, Set.diff_diff_right, Set.diff_self, Set.empty_union, Set.inter_comm] + simp only [A, Set.sdiff_sdiff_right, Set.sdiff_self, Set.empty_union, Set.inter_comm] rw [h_sdiff] exact DyadicRationals.countable.mono Set.inter_subset_left · intro x₁ hx₁ x₂ hx₂ heq - simp only [A, Set.mem_diff] at hx₁ hx₂ - simp only [binaryToTernaryFn, if_pos hx₁.1, if_pos hx₂.1] at heq + simp only [A, Set.mem_sdiff] at hx₁ hx₂ + simp only [binaryToTernaryFn, ite_eq_left hx₁.1, ite_eq_left hx₂.1] at heq let d₁ : ℕ → ℕ := fun j => 2 * binaryDigit x₁ (j + 1) let d₂ : ℕ → ℕ := fun j => 2 * binaryDigit x₂ (j + 1) have hd₁ : ∀ j, d₁ j ∈ ({0, 2} : Set ℕ) := by @@ -2762,13 +2761,13 @@ lemma binaryToTernary_exists : ∃ g : ℝ → ℝ, BinaryToTernaryProperties g intro j rcases j with _ | j · - simp only [binaryDigit, if_pos hx₁_Ico, if_pos hx₂_Ico, pow_zero, one_mul] + simp only [binaryDigit, ite_eq_left hx₁_Ico, ite_eq_left hx₂_Ico, pow_zero, one_mul] have h1 : ⌊x₁⌋₊ = 0 := Nat.floor_eq_zero.mpr hx₁_Ico.2 have h2 : ⌊x₂⌋₊ = 0 := Nat.floor_eq_zero.mpr hx₂_Ico.2 simp [h1, h2] · exact hbinary_eq j · ext x - simp only [A, Set.mem_inter_iff, Set.mem_diff, Set.mem_empty_iff_false, iff_false, not_and] + simp only [A, Set.mem_inter_iff, Set.mem_sdiff, Set.mem_empty_iff_false, iff_false, not_and] intro ⟨_, hx_not_dyadic⟩ hx_dyadic exact hx_not_dyadic hx_dyadic } @@ -2793,7 +2792,7 @@ lemma binaryToTernary_eq_zero_iff {x : ℝ} (hx : x ∈ Set.Icc (0:ℝ) 1) : intro y hy constructor · exact ⟨hy.1, le_trans hy.2 hx.2⟩ - · simp only [Set.mem_setOf_eq] + · simp only [Set.mem_ofPred_eq] have h0y : (0:ℝ) ∈ Set.Icc 0 1 := ⟨le_refl 0, by norm_num⟩ have hy_in : y ∈ Set.Icc 0 1 := ⟨hy.1, le_trans hy.2 hx.2⟩ have h_mono1 := binaryToTernary_props.monotone_on h0y hy_in hy.1 @@ -2853,7 +2852,7 @@ lemma f_lifted_zero_set_measurable : LebesgueMeasurable {x : EuclideanSpace' 1 | (Real.equiv_EuclideanSpace' '' (Set.Icc 0 1)ᶜ) ∪ (Real.equiv_EuclideanSpace' '' (Set.Icc 0 1 ∩ {x | binaryToTernary x = 0})) := by ext x - simp only [Set.mem_setOf_eq, Set.mem_union, Set.mem_image] + simp only [Set.mem_ofPred_eq, Set.mem_union, Set.mem_image] constructor · intro hfx simp only [f_lifted] at hfx @@ -2870,7 +2869,7 @@ lemma f_lifted_zero_set_measurable : LebesgueMeasurable {x : EuclideanSpace' 1 | by_cases h_in : EuclideanSpace'.equiv_Real x ∈ Set.Icc 0 1 · right use EuclideanSpace'.equiv_Real x - simp only [Set.mem_inter_iff, Set.mem_setOf_eq] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq] constructor · exact ⟨h_in, hbinary_eq⟩ · exact EuclideanSpace'.equiv_Real.symm_apply_apply x @@ -2917,7 +2916,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : (Real.equiv_EuclideanSpace' '' Set.Ioi 1) ∪ {x : EuclideanSpace' 1 | EuclideanSpace'.equiv_Real x ∈ Set.Icc 0 1 ∧ f_lifted x ≤ t} := by ext x - simp only [Set.mem_setOf_eq, Set.mem_union, Set.mem_image] + simp only [Set.mem_ofPred_eq, Set.mem_union, Set.mem_image] constructor · intro hfx by_cases h_neg : EuclideanSpace'.equiv_Real x < 0 @@ -2929,7 +2928,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : use EuclideanSpace'.equiv_Real x exact ⟨h_big, EuclideanSpace'.equiv_Real.symm_apply_apply x⟩ · right - push_neg at h_neg h_big + push Not at h_neg h_big exact ⟨⟨h_neg, h_big⟩, hfx⟩ · intro h rcases h with (⟨r, hr, hrx⟩ | ⟨r, hr, hrx⟩) | ⟨h_in, hfx⟩ @@ -2983,7 +2982,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : have h_set_eq : {x : EuclideanSpace' 1 | EuclideanSpace'.equiv_Real x ∈ Set.Icc 0 1 ∧ f_lifted x ≤ ↑t'} = Real.equiv_EuclideanSpace' '' S := by ext x - simp only [Set.mem_setOf_eq, Set.mem_image, S] + simp only [Set.mem_ofPred_eq, Set.mem_image, S] constructor · intro ⟨h_in, hfx⟩ use EuclideanSpace'.equiv_Real x @@ -3004,7 +3003,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : have h_ordConnected : S.OrdConnected := Convex.ordConnected h_convex by_cases hS_empty : S = ∅ · rw [hS_empty]; simp only [Set.image_empty]; exact LebesgueMeasurable.empty - push_neg at hS_empty + push Not at hS_empty have h_zero_in_S : (0:ℝ) ∈ S := by simp only [S, Set.mem_Icc] constructor @@ -3028,7 +3027,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : have h_S_subset_Icc : S ⊆ Set.Icc 0 a := fun x hx => ⟨hx.1.1, le_csSup h_bdd_above hx⟩ have h_image_Icc : Real.equiv_EuclideanSpace' '' Set.Icc 0 a = {x : EuclideanSpace' 1 | EuclideanSpace'.equiv_Real x ∈ Set.Icc 0 a} := by - ext x; simp only [Set.mem_image, Set.mem_setOf_eq] + ext x; simp only [Set.mem_image, Set.mem_ofPred_eq] constructor · intro ⟨r, hr, hrx⟩ rw [← hrx, EuclideanSpace'.equiv_Real.apply_symm_apply]; exact hr @@ -3061,7 +3060,7 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : rw [h_S_eq] have h_image_Ico : Real.equiv_EuclideanSpace' '' Set.Ico 0 a = {x : EuclideanSpace' 1 | EuclideanSpace'.equiv_Real x ∈ Set.Ico 0 a} := by - ext x; simp only [Set.mem_image, Set.mem_setOf_eq] + ext x; simp only [Set.mem_image, Set.mem_ofPred_eq] constructor · intro ⟨r, hr, hrx⟩ rw [← hrx, EuclideanSpace'.equiv_Real.apply_symm_apply]; exact hr @@ -3069,11 +3068,11 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : exact ⟨EuclideanSpace'.equiv_Real x, hx, EuclideanSpace'.equiv_Real.symm_apply_apply x⟩ -- [0, a) = [0, a] \ {a} have h_diff : Set.Ico 0 a = Set.Icc 0 a \ {a} := by - ext x; simp only [Set.mem_Ico, Set.mem_diff, Set.mem_Icc, Set.mem_singleton_iff] + ext x; simp only [Set.mem_Ico, Set.mem_sdiff, Set.mem_Icc, Set.mem_singleton_iff] constructor · intro ⟨h1, h2⟩; exact ⟨⟨h1, le_of_lt h2⟩, ne_of_lt h2⟩ · intro ⟨⟨h1, h2⟩, h3⟩; exact ⟨h1, lt_of_le_of_ne h2 h3⟩ - rw [h_diff, Set.image_diff Real.equiv_EuclideanSpace'.injective, Set.diff_eq] + rw [h_diff, Set.image_sdiff Real.equiv_EuclideanSpace'.injective, Set.sdiff_eq] apply LebesgueMeasurable.inter h_meas_Icc apply LebesgueMeasurable.complement apply IsNull.measurable @@ -3082,26 +3081,26 @@ lemma sublevel_set_measurable (t : EReal) (ht_pos : 0 < t) (ht_lt_one : t < 1) : lemma f_lifted_measurable : UnsignedMeasurable f_lifted := by -- Apply Lemma 1.3.9(viii): f is measurable iff ∀ t, {x | f(x) ≤ t} is measurable have h_iff : UnsignedMeasurable f_lifted ↔ (∀ t, LebesgueMeasurable {x | f_lifted x ≤ t}) := - (UnsignedMeasurable.TFAE f_lifted_unsigned).out 0 7 + (UnsignedMeasurable.TFAE f_lifted_unsigned).out 1 8 apply h_iff.mpr intro t rcases lt_trichotomy t 0 with ht_neg | ht_zero | ht_pos · have h_empty : {x | f_lifted x ≤ t} = ∅ := by ext x - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_le] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_le] exact lt_of_lt_of_le ht_neg (f_lifted_unsigned x) rw [h_empty]; exact LebesgueMeasurable.empty · subst ht_zero have h_eq : {x | f_lifted x ≤ (0 : EReal)} = {x | f_lifted x = 0} := by ext x - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] constructor · intro hle; exact le_antisymm hle (f_lifted_unsigned x) · intro heq; rw [heq] rw [h_eq]; exact f_lifted_zero_set_measurable · rcases le_or_gt 1 t with ht_ge_one | ht_lt_one · have h_univ : {x | f_lifted x ≤ t} = Set.univ := by - ext x; simp only [Set.mem_setOf_eq, Set.mem_univ, iff_true] + ext x; simp only [Set.mem_ofPred_eq, Set.mem_univ, iff_true] exact le_trans (f_lifted_le_one x) ht_ge_one rw [h_univ]; exact IsOpen.measurable isOpen_univ · exact sublevel_set_measurable t ht_pos ht_lt_one @@ -3140,7 +3139,7 @@ lemma exists_nonmeasurable_with_cantor_image : case hF_nonmeas => intro hF_meas have hV_decomp : VitaliSet = F ∪ (VitaliSet \ A) := by - ext x; simp only [F, Set.mem_inter_iff, Set.mem_union, Set.mem_diff] + ext x; simp only [F, Set.mem_inter_iff, Set.mem_union, Set.mem_sdiff] constructor · intro hx by_cases hxA : x ∈ A @@ -3253,7 +3252,7 @@ example : ∃ (f: EuclideanSpace' 1 → EReal) (_hf: UnsignedMeasurable f) (E: S have h_diff_null : IsNull (Icc' \ A') := by apply Countable.Lebesgue_measure Nat.one_pos have : Icc' \ A' = Real.equiv_EuclideanSpace' '' (Set.Icc 0 1 \ A) := by - ext x; simp only [Set.mem_diff, Set.mem_image, Icc', A'] + ext x; simp only [Set.mem_sdiff, Set.mem_image, Icc', A'] constructor · rintro ⟨⟨r, hr, rfl⟩, hn⟩ exact ⟨r, ⟨hr, fun ha => hn ⟨r, ha, rfl⟩⟩, rfl⟩ @@ -3264,10 +3263,10 @@ example : ∃ (f: EuclideanSpace' 1 → EReal) (_hf: UnsignedMeasurable f) (E: S have h_A'_sub : A' ⊆ Icc' := by rintro _ ⟨a, ha, rfl⟩; exact ⟨a, hA_sub ha, rfl⟩ -- A' ∩ (Icc' \ A')ᶜ = Icc' ∩ (Icc' \ A')ᶜ = A' (since A' ⊆ Icc') refine LebesgueMeasurable.of_ae_eq hIcc'_meas h_diff_null ?_ - ext x; simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_diff] + ext x; simp only [Set.mem_inter_iff, Set.mem_compl_iff, Set.mem_sdiff] constructor · intro ⟨hx, _⟩; exact ⟨h_A'_sub hx, fun ⟨_, h⟩ => h hx⟩ - · intro ⟨hi, hn⟩; push_neg at hn; exact ⟨hn hi, fun ⟨_, h⟩ => h (hn hi)⟩ + · intro ⟨hi, hn⟩; push Not at hn; exact ⟨hn hi, fun ⟨_, h⟩ => h (hn hi)⟩ -- F' = f⁻¹'(...) ∩ A' is measurable have : F' = Remark_1_3_10.f_lifted ⁻¹' (Real.toEReal '' (Remark_1_3_10.binaryToTernary '' F)) ∩ A' := h_preimage_inter.symm @@ -3357,12 +3356,12 @@ theorem ComplexMeasurable.TFAE {d:ℕ} {f: EuclideanSpace' d → ℂ}: /-- Exercise 1.3.8(i) -/ theorem Continuous.RealMeasurable {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: Continuous f) : RealMeasurable f := by have h_iff : _root_.RealMeasurable f ↔ ∀ U, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (_root_.RealMeasurable.TFAE (f := f)).out 0 3 + (_root_.RealMeasurable.TFAE (f := f)).out 1 4 exact h_iff.mpr fun U hU => IsOpen.measurable (hU.preimage hf) theorem Continuous.ComplexMeasurable {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: Continuous f) : ComplexMeasurable f := by have h_iff : _root_.ComplexMeasurable f ↔ ∀ U, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (_root_.ComplexMeasurable.TFAE (f := f)).out 0 4 + (_root_.ComplexMeasurable.TFAE (f := f)).out 1 5 exact h_iff.mpr fun U hU => IsOpen.measurable (hU.preimage hf) /-- Exercise 1.3.8(ii) -/ @@ -3375,7 +3374,7 @@ theorem RealMeasurable.aeEqual {d:ℕ} {f g: EuclideanSpace' d → ℝ} (hf: Rea (heq: AlmostEverywhereEqual f g) : RealMeasurable g := by obtain ⟨u, hu, huf⟩ := hf have h_iff : RealMeasurable g ↔ ∃ u, (∀ n, RealSimpleFunction (u n)) ∧ - PointwiseAeConvergesTo u g := (RealMeasurable.TFAE (f := g)).out 0 1 + PointwiseAeConvergesTo u g := (RealMeasurable.TFAE (f := g)).out 1 2 refine h_iff.mpr ⟨u, hu, ?_⟩ exact AlmostAlways.mp heq fun x hx => hx ▸ huf x @@ -3383,7 +3382,7 @@ theorem ComplexMeasurable.aeEqual {d:ℕ} {f g: EuclideanSpace' d → ℂ} (hf: (heq: AlmostEverywhereEqual f g) : ComplexMeasurable g := by obtain ⟨u, hu, huf⟩ := hf have h_iff : ComplexMeasurable g ↔ ∃ u, (∀ n, ComplexSimpleFunction (u n)) ∧ - PointwiseAeConvergesTo u g := (ComplexMeasurable.TFAE (f := g)).out 0 1 + PointwiseAeConvergesTo u g := (ComplexMeasurable.TFAE (f := g)).out 1 2 refine h_iff.mpr ⟨u, hu, ?_⟩ exact AlmostAlways.mp heq fun x hx => hx ▸ huf x @@ -3399,16 +3398,16 @@ theorem ComplexMeasurable.aeLimit {d:ℕ} {f: EuclideanSpace' d → ℂ} (g: ℕ /-- Exercise 1.3.8(v) -/ theorem RealMeasurable.comp_cts {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealMeasurable f) {φ: ℝ → ℝ} (hφ: Continuous φ) : RealMeasurable (φ ∘ f) := by have h_source : RealMeasurable f ↔ ∀ U, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (RealMeasurable.TFAE (f := f)).out 0 3 + (RealMeasurable.TFAE (f := f)).out 1 4 have h_target : RealMeasurable (φ ∘ f) ↔ ∀ U, IsOpen U → LebesgueMeasurable ((φ ∘ f) ⁻¹' U) := - (RealMeasurable.TFAE (f := φ ∘ f)).out 0 3 + (RealMeasurable.TFAE (f := φ ∘ f)).out 1 4 exact h_target.mpr fun U hU => h_source.mp hf (φ ⁻¹' U) (hU.preimage hφ) theorem ComplexMeasurable.comp_cts {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexMeasurable f) {φ: ℂ → ℂ} (hφ: Continuous φ) : ComplexMeasurable (φ ∘ f) := by have h_source : ComplexMeasurable f ↔ ∀ U, IsOpen U → LebesgueMeasurable (f ⁻¹' U) := - (ComplexMeasurable.TFAE (f := f)).out 0 4 + (ComplexMeasurable.TFAE (f := f)).out 1 5 have h_target : ComplexMeasurable (φ ∘ f) ↔ ∀ U, IsOpen U → LebesgueMeasurable ((φ ∘ f) ⁻¹' U) := - (ComplexMeasurable.TFAE (f := φ ∘ f)).out 0 4 + (ComplexMeasurable.TFAE (f := φ ∘ f)).out 1 5 exact h_target.mpr fun U hU => h_source.mp hf (φ ⁻¹' U) (hU.preimage hφ) /-- Exercise 1.3.8(vi) (Sum of measurable functions) -/ diff --git a/Analysis/MeasureTheory/Section_1_3_3.lean b/Analysis/MeasureTheory/Section_1_3_3.lean index afd8e8b02..fed6596e8 100644 --- a/Analysis/MeasureTheory/Section_1_3_3.lean +++ b/Analysis/MeasureTheory/Section_1_3_3.lean @@ -25,7 +25,7 @@ theorem LowerUnsignedLebesgueIntegral.eq {d:ℕ} {f: EuclideanSpace' d → EReal -- (∀ x, g x ≤ f x) ∧ R = hg.integ (since R = hg.integ is constant in x) congr 1 ext R - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] constructor · intro ⟨g, hg, hcond⟩ -- Extract the pointwise bound and the equality @@ -88,10 +88,10 @@ theorem LowerUnsignedLebesgueIntegral.eq {d:ℕ} {f: EuclideanSpace' d → EReal rw [Set.indicator'_of_notMem hnotmem, EReal.coe_zero, mul_zero] exact hf x · -- On Nᶜ: g' x = g x * 1 = g x ≤ f x (by definition of N) - simp only [N, Set.mem_setOf_eq] at hx - push_neg at hx + simp only [N, Set.mem_ofPred_eq] at hx + push Not at hx simp only [g', EReal.indicator, Real.EReal_fun] - have hmem : x ∈ Nᶜ := by simp only [Set.mem_compl_iff, N, Set.mem_setOf_eq, hx, not_true_eq_false, not_false_eq_true] + have hmem : x ∈ Nᶜ := by simp only [Set.mem_compl_iff, N, Set.mem_ofPred_eq, hx, not_true_eq_false, not_false_eq_true] rw [Set.indicator'_of_mem hmem, EReal.coe_one, mul_one] exact hx -- g' = g almost everywhere (they differ only on N which is null) @@ -100,10 +100,10 @@ theorem LowerUnsignedLebesgueIntegral.eq {d:ℕ} {f: EuclideanSpace' d → EReal -- {x | g' x ≠ g x} ⊆ N, and N is null have hsub : {x | g' x ≠ g x} ⊆ N := by intro x hx - simp only [Set.mem_setOf_eq] at hx + simp only [Set.mem_ofPred_eq] at hx by_contra hxN -- If x ∉ N, then g' x = g x * 1 = g x - have hmem : x ∈ Nᶜ := by simp only [Set.mem_compl_iff, N, Set.mem_setOf_eq]; exact hxN + have hmem : x ∈ Nᶜ := by simp only [Set.mem_compl_iff, N, Set.mem_ofPred_eq]; exact hxN simp only [g', EReal.indicator, Real.EReal_fun, Set.indicator'_of_mem hmem, EReal.coe_one, mul_one] at hx exact hx rfl diff --git a/Analysis/MeasureTheory/Section_1_3_4.lean b/Analysis/MeasureTheory/Section_1_3_4.lean index e00e5490f..9952424e5 100644 --- a/Analysis/MeasureTheory/Section_1_3_4.lean +++ b/Analysis/MeasureTheory/Section_1_3_4.lean @@ -189,7 +189,7 @@ noncomputable def ComplexAbsolutelyIntegrable.norm {d:ℕ} {f: EuclideanSpace' d noncomputable def RealAbsolutelyIntegrable.norm {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealAbsolutelyIntegrable f) : ℝ := hf.abs.integ -def RealMeasurable.measurable_pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealMeasurable f) : UnsignedMeasurable (EReal.pos_fun f) := by +lemma RealMeasurable.measurable_pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealMeasurable f) : UnsignedMeasurable (EReal.pos_fun f) := by constructor · -- Unsigned: ∀ x, EReal.pos_fun f x ≥ 0 intro x @@ -206,7 +206,7 @@ def RealMeasurable.measurable_pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: Re continuous_coe_real_ereal.comp (continuous_max.comp (continuous_id.prodMk continuous_const)) exact hcont.continuousAt.tendsto.comp (hg_conv x) -def RealMeasurable.measurable_neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealMeasurable f) : UnsignedMeasurable (EReal.neg_fun f) := by +lemma RealMeasurable.measurable_neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealMeasurable f) : UnsignedMeasurable (EReal.neg_fun f) := by constructor · -- Unsigned: ∀ x, EReal.neg_fun f x ≥ 0 intro x @@ -223,7 +223,7 @@ def RealMeasurable.measurable_neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: Re continuous_coe_real_ereal.comp (continuous_max.comp (continuous_neg.prodMk continuous_const)) exact hcont.continuousAt.tendsto.comp (hg_conv x) -def RealAbsolutelyIntegrable.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealAbsolutelyIntegrable f) : UnsignedAbsolutelyIntegrable (EReal.pos_fun f) := by +lemma RealAbsolutelyIntegrable.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealAbsolutelyIntegrable f) : UnsignedAbsolutelyIntegrable (EReal.pos_fun f) := by constructor · exact hf.1.measurable_pos · -- UnsignedLebesgueIntegral (pos_fun f) ≤ UnsignedLebesgueIntegral (abs_fun f) < ⊤ @@ -239,7 +239,7 @@ def RealAbsolutelyIntegrable.pos {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: Rea · exact AlmostAlways.ofAlways h_le exact lt_of_le_of_lt h_mono hf.2 -def RealAbsolutelyIntegrable.neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealAbsolutelyIntegrable f) : UnsignedAbsolutelyIntegrable (EReal.neg_fun f) := by +lemma RealAbsolutelyIntegrable.neg {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealAbsolutelyIntegrable f) : UnsignedAbsolutelyIntegrable (EReal.neg_fun f) := by constructor · exact hf.1.measurable_neg · -- UnsignedLebesgueIntegral (neg_fun f) ≤ UnsignedLebesgueIntegral (abs_fun f) < ⊤ @@ -265,7 +265,7 @@ noncomputable def RealLebesgueIntegral {d:ℕ} (f: EuclideanSpace' d → ℝ) : open Classical in noncomputable def ComplexLebesgueIntegral {d:ℕ} (f: EuclideanSpace' d → ℂ) : ℂ := if hf: ComplexAbsolutelyIntegrable f then hf.integ else 0 -def RealSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : hf.AbsolutelyIntegrable ↔ RealAbsolutelyIntegrable f := by +lemma RealSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) : hf.AbsolutelyIntegrable ↔ RealAbsolutelyIntegrable f := by constructor · -- Forward: hf.AbsolutelyIntegrable → RealAbsolutelyIntegrable f intro hfi @@ -280,7 +280,7 @@ def RealSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' d rw [RealSimpleFunction.AbsolutelyIntegrable, ← LowerUnsignedLebesgueIntegral.eq_simpleIntegral hf.abs] exact hf_integ -def ComplexSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : hf.AbsolutelyIntegrable ↔ ComplexAbsolutelyIntegrable f := by +lemma ComplexSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) : hf.AbsolutelyIntegrable ↔ ComplexAbsolutelyIntegrable f := by constructor · -- Forward: hf.AbsolutelyIntegrable → ComplexAbsolutelyIntegrable f intro hfi @@ -295,7 +295,7 @@ def ComplexSimpleFunction.absolutelyIntegrable_iff' {d:ℕ} {f: EuclideanSpace' rw [ComplexSimpleFunction.AbsolutelyIntegrable, ← LowerUnsignedLebesgueIntegral.eq_simpleIntegral hf.abs] exact hf_integ -def RealSimpleFunction.AbsolutelyIntegrable.integ_eq {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) (hfi: hf.AbsolutelyIntegrable) : hf.integ = (hf.absolutelyIntegrable_iff'.mp hfi).integ := by +lemma RealSimpleFunction.AbsolutelyIntegrable.integ_eq {d:ℕ} {f: EuclideanSpace' d → ℝ} (hf: RealSimpleFunction f) (hfi: hf.AbsolutelyIntegrable) : hf.integ = (hf.absolutelyIntegrable_iff'.mp hfi).integ := by -- hf.integ = (hf.pos).integ.toReal - (hf.neg).integ.toReal -- (hf.absolutelyIntegrable_iff'.mp hfi).integ = (UnsignedLebesgueIntegral (pos_fun f)).toReal - (UnsignedLebesgueIntegral (neg_fun f)).toReal simp only [RealSimpleFunction.integ, RealAbsolutelyIntegrable.integ, UnsignedAbsolutelyIntegrable.integ] @@ -305,7 +305,7 @@ def RealSimpleFunction.AbsolutelyIntegrable.integ_eq {d:ℕ} {f: EuclideanSpace' · -- (hf.neg).integ.toReal = (UnsignedLebesgueIntegral (neg_fun f)).toReal rw [UnsignedLebesgueIntegral, LowerUnsignedLebesgueIntegral.eq_simpleIntegral hf.neg] -def ComplexSimpleFunction.AbsolutelyIntegrable.integ_eq {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) (hfi: hf.AbsolutelyIntegrable) : hf.integ = (hf.absolutelyIntegrable_iff'.mp hfi).integ := by +lemma ComplexSimpleFunction.AbsolutelyIntegrable.integ_eq {d:ℕ} {f: EuclideanSpace' d → ℂ} (hf: ComplexSimpleFunction f) (hfi: hf.AbsolutelyIntegrable) : hf.integ = (hf.absolutelyIntegrable_iff'.mp hfi).integ := by -- Both sides are defined as re.integ + I * im.integ simp only [ComplexSimpleFunction.integ, ComplexAbsolutelyIntegrable.integ] -- The key is that the re and im of the complex absolutely integrable give the same integral as the real simple function integrals @@ -971,7 +971,7 @@ theorem L1.dist_eq_zero {d:ℕ} (f g: EuclideanSpace' d → ℂ) (hf: ComplexAbs -- Show the sets are equal have h_sets_eq : {x | ¬EReal.abs_fun (f - g) x = 0} = {x | ¬f x = g x} := by ext x - simp only [Set.mem_setOf_eq, EReal.abs_fun] + simp only [Set.mem_ofPred_eq, EReal.abs_fun] -- Goal: ¬‖(f - g) x‖.toEReal = 0 ↔ ¬f x = g x constructor · intro h hfg @@ -1040,9 +1040,9 @@ theorem ComplexAbsolutelyIntegrableOn.glue {d:ℕ} {f: EuclideanSpace' d → ℂ (hf: ComplexAbsolutelyIntegrableOn f (E ∪ F)) : ∃ hE : ComplexAbsolutelyIntegrableOn f E, ∃ hF: ComplexAbsolutelyIntegrableOn f F, hf.integ = hE.integ + hF.integ := by sorry -def ComplexAbsolutelyIntegrableOn.restrict {d:ℕ} {f: EuclideanSpace' d → ℂ} {E F: Set (EuclideanSpace' d)} (hf: ComplexAbsolutelyIntegrableOn f E) (hF: LebesgueMeasurable F): ComplexAbsolutelyIntegrableOn (f * Complex.indicator F) E := by sorry +lemma ComplexAbsolutelyIntegrableOn.restrict {d:ℕ} {f: EuclideanSpace' d → ℂ} {E F: Set (EuclideanSpace' d)} (hf: ComplexAbsolutelyIntegrableOn f E) (hF: LebesgueMeasurable F): ComplexAbsolutelyIntegrableOn (f * Complex.indicator F) E := by sorry -def ComplexAbsolutelyIntegrableOn.mono {d:ℕ} {f: EuclideanSpace' d → ℂ} {E F: Set (EuclideanSpace' d)} (hf: ComplexAbsolutelyIntegrableOn f E) (hE: LebesgueMeasurable E) (hF: LebesgueMeasurable F) (hsub: F ⊆ E): ComplexAbsolutelyIntegrableOn f F := by sorry +lemma ComplexAbsolutelyIntegrableOn.mono {d:ℕ} {f: EuclideanSpace' d → ℂ} {E F: Set (EuclideanSpace' d)} (hf: ComplexAbsolutelyIntegrableOn f E) (hE: LebesgueMeasurable E) (hF: LebesgueMeasurable F) (hsub: F ⊆ E): ComplexAbsolutelyIntegrableOn f F := by sorry theorem ComplexAbsolutelyIntegrableOn.integ_restrict {d:ℕ} {f: EuclideanSpace' d → ℂ} {E F: Set (EuclideanSpace' d)} (hE: LebesgueMeasurable E) (hF: LebesgueMeasurable F) (hsub: F ⊆ E) (hf: ComplexAbsolutelyIntegrableOn f E) : (hf.mono hE hF hsub).integ = (hf.restrict hF).integ:= by sorry @@ -1187,7 +1187,7 @@ lemma RealAbsolutelyIntegrable.integ_smul' {d:ℕ} {f: EuclideanSpace' d → ℝ rw [h_pos_scale, h_neg_scale, EReal.toReal_mul, EReal.toReal_mul, EReal.toReal_coe] ring · -- Case c < 0 - push_neg at hc + push Not at hc have h_pos : EReal.pos_fun (c • f) = ((-c) : EReal) • EReal.neg_fun f := EReal.pos_fun_smul_neg f c hc have h_neg : EReal.neg_fun (c • f) = ((-c) : EReal) • EReal.pos_fun f := EReal.neg_fun_smul_neg f c hc have hnc : 0 ≤ -c := neg_nonneg.mpr (le_of_lt hc) diff --git a/Analysis/MeasureTheory/Section_1_3_5.lean b/Analysis/MeasureTheory/Section_1_3_5.lean index 9562a4eaf..9e0db1373 100644 --- a/Analysis/MeasureTheory/Section_1_3_5.lean +++ b/Analysis/MeasureTheory/Section_1_3_5.lean @@ -37,7 +37,7 @@ private lemma unsigned_approx_from_sup {d:ℕ} {f: EuclideanSpace' d → EReal} ∃ hg : UnsignedSimpleFunction g, ∀ x, g x ≤ f x ∧ R = hg.integ }, L - (ε : EReal) < R := by by_contra h_all - push_neg at h_all + push Not at h_all have h_le : L ≤ L - (ε : EReal) := by conv_lhs => rw [hL_def, UnsignedLebesgueIntegral, LowerUnsignedLebesgueIntegral] exact sSup_le fun R hR => h_all R hR @@ -634,7 +634,7 @@ private lemma RealAbsolutelyIntegrable.smul_indicator {d:ℕ} exact h_simple.absolutelyIntegrable_iff'.mp (h_simple.absolutelyIntegrable_iff.mpr (by calc Lebesgue_measure (Support (c • E.indicator')) ≤ Lebesgue_outer_measure E := Lebesgue_outer_measure.mono (fun x hx => by - rw [Support, Set.mem_setOf_eq, Pi.smul_apply, smul_eq_mul] at hx + rw [Support, Set.mem_ofPred_eq, Pi.smul_apply, smul_eq_mul] at hx by_contra h_not exact hx (by rw [Set.indicator'_of_notMem h_not, mul_zero])) _ < ⊤ := hfin hc)) @@ -724,7 +724,7 @@ private lemma RealSimpleFunction.approx_by_step_aux {d:ℕ} {g : EuclideanSpace' -- Step 3: For each j with v j ≠ 0, A j ⊆ Support g, hence finite measure have hA_sub_support : ∀ j, v j ≠ 0 → A j ⊆ Support g := by intro j hvj x hx - rw [Support, Set.mem_setOf_eq, hg_eq'] + rw [Support, Set.mem_ofPred_eq, hg_eq'] simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] rw [Finset.sum_eq_single j] · exact mul_ne_zero hvj (Set.indicator'_of_mem hx ▸ one_ne_zero) @@ -762,7 +762,7 @@ private lemma RealSimpleFunction.approx_by_step_aux {d:ℕ} {g : EuclideanSpace' intro j by_cases hvj : v j = 0 · exact ⟨∅, IsElementary.empty d, fun h => absurd hvj h⟩ - · have h_tfae := (LebesgueMeasurable.finite_TFAE (A j)).out 0 7 + · have h_tfae := (LebesgueMeasurable.finite_TFAE (A j)).out 1 8 have h_approx := h_tfae.mp ⟨hA_meas j, hA_fin j hvj⟩ obtain ⟨F, hF_elem, hF_bound⟩ := h_approx (↑(δ / (↑n * (|v j| + 1)))) @@ -794,9 +794,9 @@ private lemma RealSimpleFunction.approx_by_step_aux {d:ℕ} {g : EuclideanSpace' ((hh_simple.absolutelyIntegrable_iff).mpr (by have h_support_sub : Support h ⊆ ⋃ j : Fin n, F j := by intro x hx - rw [Support, Set.mem_setOf_eq] at hx + rw [Support, Set.mem_ofPred_eq] at hx rw [Set.mem_iUnion] - by_contra h_not; push_neg at h_not; apply hx + by_contra h_not; push Not at h_not; apply hx rw [hh_def]; simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] exact Finset.sum_eq_zero fun j _ => by rw [Set.indicator'_of_notMem (h_not j)]; ring @@ -1020,11 +1020,11 @@ private lemma Box.scaled_indicator_approx_continuous {d:ℕ} (B : Box d) (c : set ε₀ : ℝ := δ / (2 * |c|) with hε₀_def have hε₀ : 0 < ε₀ := div_pos hδ (mul_pos two_pos hc_abs_pos) -- Get compact K ⊆ B.toSet with measure(B.toSet \ K) ≤ ε₀ - have h_tfae_03 := (LebesgueMeasurable.finite_TFAE B.toSet).out 0 3 + have h_tfae_03 := (LebesgueMeasurable.finite_TFAE B.toSet).out 1 4 obtain ⟨K, hK_compact, hK_sub, hK_bound⟩ := h_tfae_03.mp ⟨hB_meas, hB_fin⟩ (↑ε₀) (EReal.coe_pos.mpr hε₀) -- Get open U ⊇ B.toSet with measure(U \ B.toSet) ≤ ε₀ and finite measure - have h_tfae_01 := (LebesgueMeasurable.finite_TFAE B.toSet).out 0 1 + have h_tfae_01 := (LebesgueMeasurable.finite_TFAE B.toSet).out 1 2 obtain ⟨U, hU_open, hB_sub_U, hU_fin, hU_diff_bound⟩ := h_tfae_01.mp ⟨hB_meas, hB_fin⟩ (↑ε₀) (EReal.coe_pos.mpr hε₀) -- K ⊆ U (since K ⊆ B.toSet ⊆ U) @@ -1277,7 +1277,7 @@ private lemma RealStepFunction.approx_by_continuous_compact_aux {d:ℕ} refine ⟨g, ?_, ?_, ?_, ?_⟩ -- g is continuous · show Continuous g - apply continuous_finset_sum + apply continuous_finsetSum intro B _ exact hg_cont B -- g is compactly supported @@ -1288,7 +1288,7 @@ private lemma RealStepFunction.approx_by_continuous_compact_aux {d:ℕ} · exact isCompact_iUnion (fun B => (hK_compact B)) · intro x hx rw [Set.mem_iUnion] at hx - push_neg at hx + push Not at hx simp only [hg_def] exact Finset.sum_eq_zero (fun B _ => hK_support B x (hx B)) -- g is AI (sum of AI functions) @@ -1427,7 +1427,7 @@ theorem ComplexAbsolutelyIntegrable.approx_by_continuous_compact {d:ℕ} {f: Euc obtain ⟨K_re, hK_re_compact, hK_re_supp⟩ := hg_re_cs obtain ⟨K_im, hK_im_compact, hK_im_supp⟩ := hg_im_cs refine ⟨K_re ∪ K_im, hK_re_compact.union hK_im_compact, fun x hx => ?_⟩ - rw [Set.mem_union] at hx; push_neg at hx + rw [Set.mem_union] at hx; push Not at hx simp only [hg_def, Pi.add_apply, Pi.smul_apply, smul_eq_mul, Real.complex_fun] rw [hK_re_supp x hx.1, hK_im_supp x hx.2] simp diff --git a/Analysis/MeasureTheory/Section_1_4_1.lean b/Analysis/MeasureTheory/Section_1_4_1.lean index 9da9f24c9..57bad2579 100644 --- a/Analysis/MeasureTheory/Section_1_4_1.lean +++ b/Analysis/MeasureTheory/Section_1_4_1.lean @@ -64,6 +64,7 @@ instance ConcreteBooleanAlgebra.instOrderBot {X:Type*} : OrderBot (ConcreteBoole } /-- Exercise 1.4.1 (Elementary algebra) -/ +@[instance_reducible] def EuclideanSpace'.elementary_boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) := { measurable := fun E => IsElementary E ∨ IsElementary Eᶜ @@ -73,6 +74,7 @@ def EuclideanSpace'.elementary_boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra } /-- Example 1.4.4 (Jordan algebra) -/ +@[instance_reducible] def JordanMeasurable.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) := { measurable := fun E => JordanMeasurable E ∨ JordanMeasurable Eᶜ @@ -81,7 +83,7 @@ def JordanMeasurable.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (Euclidean union_mem := by sorry } -def JordanMeasurable.gt_elementary_boolean_algebra (d:ℕ) : +theorem JordanMeasurable.gt_elementary_boolean_algebra (d:ℕ) : JordanMeasurable.boolean_algebra d ≥ EuclideanSpace'.elementary_boolean_algebra d := by intro E hE rcases hE with h | h @@ -89,6 +91,7 @@ def JordanMeasurable.gt_elementary_boolean_algebra (d:ℕ) : · exact Or.inr h.jordanMeasurable /-- Example 1.4.5 (Lebesgue algebra) -/ +@[instance_reducible] def LebesgueMeasurable.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) := { measurable := fun E => LebesgueMeasurable E @@ -97,14 +100,15 @@ def LebesgueMeasurable.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (Euclide union_mem := fun _ _ hE hF => hE.union hF } -def LebesgueMeasurable.gt_jordan_boolean_algebra (d:ℕ) : +theorem LebesgueMeasurable.gt_jordan_boolean_algebra (d:ℕ) : LebesgueMeasurable.boolean_algebra d ≥ JordanMeasurable.boolean_algebra d := by intro E hE rcases hE with h | h · exact Jordan_measurable.lebesgue h - · simpa [LebesgueMeasurable.boolean_algebra] using (Jordan_measurable.lebesgue h).complement + · show LebesgueMeasurable E; simpa using (Jordan_measurable.lebesgue h).complement /-- Example 1.4.6 (Null algebra) -/ +@[instance_reducible] def IsNull.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) := { measurable := fun E => IsNull E ∨ IsNull Eᶜ @@ -133,14 +137,15 @@ def IsNull.boolean_algebra (d:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) exact fun h => hx (Or.inl h) } -def IsNull.lt_lebesgue_boolean_algebra (d:ℕ) : +theorem IsNull.lt_lebesgue_boolean_algebra (d:ℕ) : IsNull.boolean_algebra d ≤ LebesgueMeasurable.boolean_algebra d := by intro E hE rcases hE with h | h · exact IsNull.measurable h - · simpa [LebesgueMeasurable.boolean_algebra] using (IsNull.measurable h).complement + · show LebesgueMeasurable E; simpa using (IsNull.measurable h).complement /-- Exercise 1.4.2 (Restriction) -/ +@[instance_reducible] def ConcreteBooleanAlgebra.restrict {X:Type*} (B: ConcreteBooleanAlgebra X) (A:Set X) : ConcreteBooleanAlgebra A := { measurable := fun E => ∃ E' : Set X, B.measurable E' ∧ E = Subtype.val ⁻¹' E' @@ -151,11 +156,12 @@ def ConcreteBooleanAlgebra.restrict {X:Type*} (B: ConcreteBooleanAlgebra X) (A:S ⟨E' ∪ F', B.union_mem E' F' hE' hF', by simp [hE, hF]⟩ } -def ConcreteBooleanAlgebra.restrict_iff {X:Type*} {B: ConcreteBooleanAlgebra X} {A:Set X} (h: B.measurable A) (E: Set A) : +theorem ConcreteBooleanAlgebra.restrict_iff {X:Type*} {B: ConcreteBooleanAlgebra X} {A:Set X} (h: B.measurable A) (E: Set A) : (B.restrict A).measurable E ↔ B.measurable (Subtype.val '' E) := by sorry /-- Remark 1.4.2: {name}`ConcreteBooleanAlgebra`s are {name}`BooleanAlgebra`s -/ +@[instance_reducible] def ConcreteBooleanAlgebra.toBooleanAlgebra {X:Type*} (B: ConcreteBooleanAlgebra X) : BooleanAlgebra (B.measurableSets) := { sup := sorry @@ -179,6 +185,7 @@ def ConcreteBooleanAlgebra.toBooleanAlgebra {X:Type*} (B: ConcreteBooleanAlgebra def IsPartition {I X:Type*} (parts: I → Set X) : Prop := (Set.PairwiseDisjoint Set.univ parts) ∧ (⋃ i, parts i = Set.univ) /-- Example 1.4.7 (Atomic algebra) -/ +@[instance_reducible] def IsPartition.to_ConcreteBooleanAlgebra {I X: Type*} {atoms: I → Set X} (h_part: IsPartition atoms) : ConcreteBooleanAlgebra X := { measurable := fun E => ∃ J: Set I, E = ⋃ i ∈ J, atoms i @@ -187,16 +194,16 @@ def IsPartition.to_ConcreteBooleanAlgebra {I X: Type*} {atoms: I → Set X} (h_p union_mem := by sorry } -def IsPartition.discrete (X:Type*) : IsPartition (fun x:X ↦ {x}) := by +theorem IsPartition.discrete (X:Type*) : IsPartition (fun x:X ↦ {x}) := by refine ⟨?_, ?_⟩ · intro x _ y _ hxy exact Set.disjoint_singleton.mpr hxy · ext x simp [Set.mem_iUnion] -def ConcreteBooleanAlgebra.top_atomic (X:Type*) : (IsPartition.discrete X).to_ConcreteBooleanAlgebra = ⊤ := by sorry +theorem ConcreteBooleanAlgebra.top_atomic (X:Type*) : (IsPartition.discrete X).to_ConcreteBooleanAlgebra = ⊤ := by sorry -def IsPartition.trivial (X:Type*) : IsPartition (fun (x:Unit) ↦ (Set.univ: Set X)) := by +theorem IsPartition.trivial (X:Type*) : IsPartition (fun (x:Unit) ↦ (Set.univ: Set X)) := by refine ⟨?_, ?_⟩ · intro a _ b _ hne exact (hne (Subsingleton.elim a b)).elim @@ -207,22 +214,22 @@ def IsPartition.trivial (X:Type*) : IsPartition (fun (x:Unit) ↦ (Set.univ: Set · intro _ exact Set.mem_iUnion.mpr ⟨(), Set.mem_univ x⟩ -def ConcreteBooleanAlgebra.bot_atomic (X:Type*) : (IsPartition.trivial X).to_ConcreteBooleanAlgebra = ⊥ := by sorry +theorem ConcreteBooleanAlgebra.bot_atomic (X:Type*) : (IsPartition.trivial X).to_ConcreteBooleanAlgebra = ⊥ := by sorry def IsPartition.finer_than {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} (_: IsPartition parts_I) (_: IsPartition parts_J) : Prop := ∀ i:I, ∃ j:J, parts_I i ⊆ parts_J j -def IsPartition.mono {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} +theorem IsPartition.mono {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} (hI: IsPartition parts_I) (hJ: IsPartition parts_J) (h_finer: hI.finer_than hJ) : hI.to_ConcreteBooleanAlgebra ≥ hJ.to_ConcreteBooleanAlgebra := by sorry -def IsPartition.remove_empty {I X:Type*} {parts: I → Set X} (h_part: IsPartition parts) : IsPartition (fun (i:{i:I // parts i ≠ ∅}) ↦ parts i.val) := +theorem IsPartition.remove_empty {I X:Type*} {parts: I → Set X} (h_part: IsPartition parts) : IsPartition (fun (i:{i:I // parts i ≠ ∅}) ↦ parts i.val) := by sorry -def IsPartition.remove_empty_to_ConcreteBooleanAlgebra {I X:Type*} {parts: I → Set X} (h_part: IsPartition parts) : +theorem IsPartition.remove_empty_to_ConcreteBooleanAlgebra {I X:Type*} {parts: I → Set X} (h_part: IsPartition parts) : h_part.to_ConcreteBooleanAlgebra = h_part.remove_empty.to_ConcreteBooleanAlgebra := by sorry @@ -231,49 +238,50 @@ def IsPartition.remove_empty_to_ConcreteBooleanAlgebra {I X:Type*} {parts: I → noncomputable def DyadicCube' {d:ℕ} (n:ℤ) (a: Fin d → ℤ) : Box d := { side := fun i ↦ BoundedInterval.Ico (a i/2^n) ((a i + 1)/2^n) } /-- Example 1.4.8 -/ -def DyadicCube'.partition (d n:ℕ) : IsPartition (fun (a: Fin d → ℤ) ↦ (DyadicCube' n a).toSet) := +theorem DyadicCube'.partition (d n:ℕ) : IsPartition (fun (a: Fin d → ℤ) ↦ (DyadicCube' n a).toSet) := by sorry +@[instance_reducible] def DyadicCube'.boolean_algebra (d n:ℕ) : ConcreteBooleanAlgebra (EuclideanSpace' d) := (DyadicCube'.partition d n).to_ConcreteBooleanAlgebra -def DyadicCube'.boolean_algebra_mono (d:ℕ) {m n:ℕ} (h: m ≤ n) : +theorem DyadicCube'.boolean_algebra_mono (d:ℕ) {m n:ℕ} (h: m ≤ n) : DyadicCube'.boolean_algebra d m ≤ DyadicCube'.boolean_algebra d n := by sorry def IsPartition.relabels {I J X:Type*} {parts_I: I → Set X} (_: IsPartition parts_I) {parts_J : J → Set X} (_: IsPartition parts_J) : Prop := ∃ e : I ≃ J, ∀ i:I, parts_I i = parts_J (e i) /-- Exercise 1.4.3 (Non-empty atoms of an atomic algebra determined up to relabeling) -/ -def IsPartition.boolean_algebra_eq_iff {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} +theorem IsPartition.boolean_algebra_eq_iff {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} (hI: IsPartition parts_I) (hJ: IsPartition parts_J) : hI.to_ConcreteBooleanAlgebra = hJ.to_ConcreteBooleanAlgebra ↔ hI.remove_empty.relabels hJ.remove_empty := by sorry def IsPartition.no_empty {I X:Type*} {parts: I → Set X} (_: IsPartition parts) : Prop := ∀ i:I, parts i ≠ ∅ -def IsPartition.boolean_algebra_eq_iff' {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} +theorem IsPartition.boolean_algebra_eq_iff' {I J X:Type*} {parts_I: I → Set X} {parts_J: J → Set X} (hI: IsPartition parts_I) (hJ: IsPartition parts_J) (hIn: hI.no_empty) (hJn: hJ.no_empty) : hI.to_ConcreteBooleanAlgebra = hJ.to_ConcreteBooleanAlgebra ↔ hI.relabels hJ := by sorry def ConcreteBooleanAlgebra.isAtomic {X:Type*} (B: ConcreteBooleanAlgebra X) : Prop := ∃ (I:Type*) (parts: I → Set X) (hI:IsPartition parts), B = hI.to_ConcreteBooleanAlgebra /-- Exercise 1.4.4 (Finite boolean algebras are atomic) -/ -def ConcreteBooleanAlgebra.atomic_of_finite {X:Type*} (B: ConcreteBooleanAlgebra X) (h_fin: (B.measurableSets).Finite) : B.isAtomic := +theorem ConcreteBooleanAlgebra.atomic_of_finite {X:Type*} (B: ConcreteBooleanAlgebra X) (h_fin: (B.measurableSets).Finite) : B.isAtomic := by sorry -def ConcreteBooleanAlgebra.card_of_finite {X:Type*} (B: ConcreteBooleanAlgebra X) (h_fin: (B.measurableSets).Finite) : ∃ n:ℕ, (B.measurableSets).ncard = 2^n := by sorry +theorem ConcreteBooleanAlgebra.card_of_finite {X:Type*} (B: ConcreteBooleanAlgebra X) (h_fin: (B.measurableSets).Finite) : ∃ n:ℕ, (B.measurableSets).ncard = 2^n := by sorry /-- Exercise 1.4.5 (elementary algebra not atomic) -/ -def EuclideanSpace'.elementary_boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (EuclideanSpace'.elementary_boolean_algebra d).isAtomic := +theorem EuclideanSpace'.elementary_boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (EuclideanSpace'.elementary_boolean_algebra d).isAtomic := by sorry /-- Exercise 1.4.5 (Jordan algebra not atomic) -/ -def JordanMeasurable.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (JordanMeasurable.boolean_algebra d).isAtomic := +theorem JordanMeasurable.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (JordanMeasurable.boolean_algebra d).isAtomic := by sorry /-- Exercise 1.4.5 (Lebesgue algebra not atomic) -/ -def LebesgueMeasurable.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (LebesgueMeasurable.boolean_algebra d).isAtomic := +theorem LebesgueMeasurable.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (LebesgueMeasurable.boolean_algebra d).isAtomic := by sorry /-- Exercise 1.4.5 (Null algebra not atomic) -/ -def IsNull.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (IsNull.boolean_algebra d).isAtomic := +theorem IsNull.boolean_algebra_not_atomic (d:ℕ) (hd: d ≥ 1) : ¬ (IsNull.boolean_algebra d).isAtomic := by sorry /-- Exercise 1.4.6 (Intersection of algebras) -/ @@ -288,6 +296,7 @@ instance ConcreteBooleanAlgebra.instInfSet {X:Type*} : InfSet (ConcreteBooleanAl } } +@[instance_reducible] def ConcreteBooleanAlgebra.generated_by {X:Type*} (F: Set (Set X)) : ConcreteBooleanAlgebra X := sInf { B | ∀ E ∈ F, B.measurable E } @@ -314,14 +323,14 @@ instance ConcreteBooleanAlgebra.instCompleteLattice {X:Type*} : CompleteLattice } /-- Example 1.4.11 -/ -instance ConcreteBooleanAlgebra.eq_generated_by_iff {X:Type*} (F: Set (Set X)) : (∃ (B : ConcreteBooleanAlgebra X), B.measurableSets = F) ↔ (ConcreteBooleanAlgebra.generated_by F).measurableSets = F := by sorry +theorem ConcreteBooleanAlgebra.eq_generated_by_iff {X:Type*} (F: Set (Set X)) : (∃ (B : ConcreteBooleanAlgebra X), B.measurableSets = F) ↔ (ConcreteBooleanAlgebra.generated_by F).measurableSets = F := by sorry /-- Exercise 1.4.7 (Generation by boxes) -/ -instance EuclideanSpace'.elementary_boolean_algebra_generated_by_boxes (d:ℕ) : EuclideanSpace'.elementary_boolean_algebra d = +theorem EuclideanSpace'.elementary_boolean_algebra_generated_by_boxes (d:ℕ) : EuclideanSpace'.elementary_boolean_algebra d = ConcreteBooleanAlgebra.generated_by (Box.toSet '' Set.univ) := by sorry /-- Exercise 1.4.9 (Recursive definition of generated Boolean algebra). -/ -def ConcreteBooleanAlgebra.generated_by_eq {X:Type*} (F: Set (Set X)) : +theorem ConcreteBooleanAlgebra.generated_by_eq {X:Type*} (F: Set (Set X)) : (ConcreteBooleanAlgebra.generated_by F).measurableSets = ⋃ n, Nat.rec (motive := fun _ ↦ Set (Set X)) F (fun n G ↦ { E: Set X | (∃ S: Finset G, E = ⋃ (H:S), H) ∨ (∃ S: Finset G, E = (⋃ (H:S), H)ᶜ) }) n := by sorry diff --git a/Analysis/MeasureTheory/Section_1_4_2.lean b/Analysis/MeasureTheory/Section_1_4_2.lean index d23899833..eaed69186 100644 --- a/Analysis/MeasureTheory/Section_1_4_2.lean +++ b/Analysis/MeasureTheory/Section_1_4_2.lean @@ -1,4 +1,5 @@ import Mathlib.SetTheory.Cardinal.Aleph +import Mathlib.MeasureTheory.MeasurableSpace.Defs import Analysis.MeasureTheory.Section_1_4_1 /-! # Introduction to Measure Theory, Section 1.4.2: $\sigma$-algebras and measurable spaces @@ -16,23 +17,26 @@ def ConcreteBooleanAlgebra.isSigmaAlgebra {X: Type*} (B: ConcreteBooleanAlgebra theorem ConcreteSigmaAlgebra.isSigmaAlgebra {X: Type*} (B: ConcreteSigmaAlgebra X) : B.isSigmaAlgebra := B.countable_union_mem +@[instance_reducible] def ConcreteBooleanAlgebra.isSigmaAlgebra.toSigmaAlgebra {X: Type*} {B: ConcreteBooleanAlgebra X} (h: B.isSigmaAlgebra) : ConcreteSigmaAlgebra X := { countable_union_mem := h } /-- Exercise 1.4.10 -/ -def ConcreteBooleanAlgebra.isAtomic.isSigmaAlgebra {X: Type*} {B: ConcreteBooleanAlgebra X} (h: B.isAtomic) : B.isSigmaAlgebra := +theorem ConcreteBooleanAlgebra.isAtomic.isSigmaAlgebra {X: Type*} {B: ConcreteBooleanAlgebra X} (h: B.isAtomic) : B.isSigmaAlgebra := by sorry /-- Exercise 1.4.11 -/ theorem LebesgueMeasurable.boolean_algebra.isSigmaAlgebra (d:ℕ) : (LebesgueMeasurable.boolean_algebra d).isSigmaAlgebra := fun E hE => LebesgueMeasurable.countable_union hE +@[instance_reducible] def LebesgueMeasurable.sigmaAlgebra (d:ℕ) : ConcreteSigmaAlgebra (EuclideanSpace' d) := (LebesgueMeasurable.boolean_algebra.isSigmaAlgebra d).toSigmaAlgebra theorem IsNull.boolean_algebra.isSigmaAlgebra (d:ℕ) : (IsNull.boolean_algebra d).isSigmaAlgebra := by sorry +@[instance_reducible] def IsNull.sigmaAlgebra (d:ℕ) : ConcreteSigmaAlgebra (EuclideanSpace' d) := (IsNull.boolean_algebra.isSigmaAlgebra d).toSigmaAlgebra @@ -49,6 +53,7 @@ theorem ConcreteSigmaAlgebra.restrict_is_sigma {X:Type*} (B: ConcreteSigmaAlgebr ext x simp [heq] +@[instance_reducible] def ConcreteSigmaAlgebra.restrict {X:Type*} (B: ConcreteSigmaAlgebra X) (A:Set X) : ConcreteSigmaAlgebra A := (B.restrict_is_sigma A).toSigmaAlgebra instance ConcreteSigmaAlgebra.instLE (X:Type*) : LE (ConcreteSigmaAlgebra X) := @@ -122,6 +127,7 @@ instance ConcreteSigmaAlgebra.instInfSet {X:Type*} : InfSet (ConcreteSigmaAlgebr } } +@[instance_reducible] def ConcreteSigmaAlgebra.generated_by {X:Type*} (F: Set (Set X)) : ConcreteSigmaAlgebra X := sInf { B | ∀ E ∈ F, B.measurable E } @@ -160,6 +166,7 @@ theorem ConcreteSigmaAlgebra.induction {X:Type*} {F: Set (Set X)} {P: Set X → by sorry /-- Definition 1.4.16 (Borel σ-algebra) -/ +@[instance_reducible] def BorelSigmaAlgebra (X:Type*) [TopologicalSpace X] : ConcreteSigmaAlgebra X := ConcreteSigmaAlgebra.generated_by { U : Set X | IsOpen U } @@ -183,7 +190,7 @@ theorem BorelSigmaAlgebra.generated_by_elementary (d:ℕ) : BorelSigmaAlgebra (E open Ordinal in /-- Exercise 1.4.15 (Recursive definition of generated sigma-algebra). -/ -def ConcreteSigmaAlgebra.generated_by_eq {X:Type*} (F: Set (Set X)) : +theorem ConcreteSigmaAlgebra.generated_by_eq {X:Type*} (F: Set (Set X)) : (ConcreteSigmaAlgebra.generated_by F).measurableSets = ⋃ α < ω₁, Ordinal.limitRecOn (motive := fun _ ↦ Set (Set X)) α F (fun n G ↦ { E: Set X | (∃ S: Set G, Countable S ∧ E = ⋃ (H:S), H) ∨ (∃ S: Set G, Countable S ∧ E = (⋃ (H:S), H)ᶜ) }) (fun α _ G ↦ ⋃ (β : Ordinal) (h : β < α), G β h) := by sorry @@ -235,6 +242,7 @@ theorem LebesgueMeasurable.sigmaAlgebra_generated_by {d:ℕ} : LebesgueMeasurable.sigmaAlgebra d = ConcreteSigmaAlgebra.generated_by ( (BorelSigmaAlgebra (EuclideanSpace' d)).measurableSets ∪ (IsNull.sigmaAlgebra d).measurableSets) := by sorry +@[instance_reducible] def ConcreteSigmaAlgebra.measurableSpace {X: Type*} (B: ConcreteSigmaAlgebra X) : MeasurableSpace X := { MeasurableSet' := B.measurable measurableSet_empty := B.empty_mem @@ -242,6 +250,7 @@ def ConcreteSigmaAlgebra.measurableSpace {X: Type*} (B: ConcreteSigmaAlgebra X) measurableSet_iUnion := B.countable_union_mem } +@[instance_reducible] def MeasurableSpace.sigmaAlgebra {X: Type*} (M: MeasurableSpace X) : ConcreteSigmaAlgebra X := { measurable := M.MeasurableSet' empty_mem := M.measurableSet_empty @@ -270,8 +279,10 @@ theorem BorelSigmaAlgebra.le_LebesgueSigmaAlgebra (d:ℕ) : BorelSigmaAlgebra (E intro E hE exact hE (LebesgueMeasurable.sigmaAlgebra d) fun U hU => IsOpen.measurable hU +@[instance_reducible] def ConcreteSigmaAlgebra.toMeasurableSpace {X: Type*} (B: ConcreteSigmaAlgebra X) : MeasurableSpace X := B.measurableSpace +@[instance_reducible] def MeasurableSpace.toConcreteSigmaAlgebra {X: Type*} (M: MeasurableSpace X) : ConcreteSigmaAlgebra X := M.sigmaAlgebra diff --git a/Analysis/MeasureTheory/Section_1_4_3.lean b/Analysis/MeasureTheory/Section_1_4_3.lean index 9b6edf7ed..871cbfa03 100644 --- a/Analysis/MeasureTheory/Section_1_4_3.lean +++ b/Analysis/MeasureTheory/Section_1_4_3.lean @@ -1,3 +1,4 @@ +import Mathlib.MeasureTheory.Measure.NullMeasurable import Analysis.MeasureTheory.Section_1_4_2 /-! @@ -29,6 +30,7 @@ Tagged so that the `ext` tactic applies to these measures. -/ rfl /-- Example 1.4.21 (Lebesgue measure) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.lebesgue (d:ℕ) : FinitelyAdditiveMeasure (LebesgueMeasurable.boolean_algebra d) := { measure A := Lebesgue_measure A @@ -38,6 +40,7 @@ noncomputable def FinitelyAdditiveMeasure.lebesgue (d:ℕ) : FinitelyAdditiveMea } /-- Example 1.4.21 (restriction to a subalgebra) -/ +@[instance_reducible] def FinitelyAdditiveMeasure.restrict_alg {X:Type*} {B: ConcreteBooleanAlgebra X} (μ: FinitelyAdditiveMeasure B) {B':ConcreteBooleanAlgebra X} (hBB': B' ≤ B) : FinitelyAdditiveMeasure B' := { measure := μ.measure @@ -48,14 +51,17 @@ def FinitelyAdditiveMeasure.restrict_alg {X:Type*} {B: ConcreteBooleanAlgebra X} } /-- Example 1.4.21 (Jordan measure) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.jordan (d:ℕ) : FinitelyAdditiveMeasure (JordanMeasurable.boolean_algebra d) := (FinitelyAdditiveMeasure.lebesgue d).restrict_alg (LebesgueMeasurable.gt_jordan_boolean_algebra d) /-- Example 1.4.21 (null sets) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.null (d:ℕ) : FinitelyAdditiveMeasure (IsNull.boolean_algebra d) := (FinitelyAdditiveMeasure.lebesgue d).restrict_alg (IsNull.lt_lebesgue_boolean_algebra d) /-- Example 1.4.21 (elementary sets) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.elem (d:ℕ) : FinitelyAdditiveMeasure (EuclideanSpace'.elementary_boolean_algebra d) := (FinitelyAdditiveMeasure.lebesgue d).restrict_alg (le_trans (JordanMeasurable.gt_elementary_boolean_algebra d) @@ -63,6 +69,7 @@ noncomputable def FinitelyAdditiveMeasure.elem (d:ℕ) : FinitelyAdditiveMeasure open Classical in /-- Example 1.4.22 (Dirac measure) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.dirac {X:Type*} (x₀:X) (B: ConcreteBooleanAlgebra X) : FinitelyAdditiveMeasure B := { measure := fun A => if x₀ ∈ A then 1 else 0 @@ -172,6 +179,7 @@ noncomputable instance FinitelyAdditiveMeasure.instDistribMulAction {X:Type*} {B } /-- Example 1.4.25 (Restriction of a measure) -/ +@[instance_reducible] def FinitelyAdditiveMeasure.restrict {X:Type*} {B: ConcreteBooleanAlgebra X} (μ: FinitelyAdditiveMeasure B) (A:Set X) (hA:B.measurable A) : FinitelyAdditiveMeasure (B.restrict A) := { measure := fun E => μ.measure E @@ -187,6 +195,7 @@ def FinitelyAdditiveMeasure.restrict {X:Type*} {B: ConcreteBooleanAlgebra X} (μ } /-- Example 1.4.26 (Counting a measure) -/ +@[instance_reducible] noncomputable def FinitelyAdditiveMeasure.counting (X:Type*) : FinitelyAdditiveMeasure (⊤ : ConcreteBooleanAlgebra X) := { measure := fun E => ENat.card E @@ -206,7 +215,7 @@ lemma ConcreteBooleanAlgebra.inter_mem {X:Type*} (B: ConcreteBooleanAlgebra X) { /-- Boolean algebras are closed under set difference. -/ lemma ConcreteBooleanAlgebra.diff_mem {X:Type*} (B: ConcreteBooleanAlgebra X) {E F : Set X} (hE : B.measurable E) (hF : B.measurable F) : B.measurable (E \ F) := by - rw [Set.diff_eq] + rw [Set.sdiff_eq] exact B.inter_mem hE (B.compl_mem F hF) /-- Boolean algebras are closed under finite unions. -/ @@ -224,7 +233,7 @@ lemma ConcreteBooleanAlgebra.finite_biUnion_mem {X J:Type*} (B: ConcreteBooleanA theorem FinitelyAdditiveMeasure.mono {X:Type*} {B: ConcreteBooleanAlgebra X} (μ: FinitelyAdditiveMeasure B) {E F : Set X} (hE : B.measurable E) (hF : B.measurable F) (hsub : E ⊆ F) : μ.measure E ≤ μ.measure F := by have hdiff := B.diff_mem hF hE have hdisj : Disjoint E (F \ E) := Set.disjoint_left.mpr fun _ hxE hxd => hxd.2 hxE - have hunion : E ∪ (F \ E) = F := Set.union_diff_cancel hsub + have hunion : E ∪ (F \ E) = F := Set.union_sdiff_cancel hsub have hsum := μ.measure_finite_additive E (F \ E) hE hdiff hdisj rw [← hunion, hsum] exact le_add_of_nonneg_right (μ.measure_pos (F \ E) hdiff) @@ -253,10 +262,10 @@ theorem FinitelyAdditiveMeasure.finite_subadditivity {X:Type*} {B: ConcreteBoole intro A C hA hC have hdiff := B.diff_mem hC hA have hdisj : Disjoint A (C \ A) := Set.disjoint_left.mpr fun _ hxA hxd => hxd.2 hxA - have hunion : A ∪ (C \ A) = A ∪ C := Set.union_diff_self + have hunion : A ∪ (C \ A) = A ∪ C := Set.union_sdiff_self have hsum := μ.measure_finite_additive A (C \ A) hA hdiff hdisj rw [← hunion, hsum] - exact add_le_add (le_refl _) (μ.mono hdiff hC Set.diff_subset) + exact add_le_add (le_refl _) (μ.mono hdiff hC Set.sdiff_subset) refine Finset.induction_on I ?empty ?step · simp [μ.measure_empty] · intro a s ha ih @@ -272,10 +281,10 @@ theorem FinitelyAdditiveMeasure.mes_union_add_mes_inter {X:Type*} {B: ConcreteBo have hdisj₁ : Disjoint E (F \ E) := Set.disjoint_left.mpr fun _ hxE hxd => hxd.2 hxE have hdisj₂ : Disjoint (E ∩ F) (F \ E) := Set.disjoint_left.mpr fun _ hx hxd => hxd.2 hx.1 - have h₁ : E ∪ (F \ E) = E ∪ F := Set.union_diff_self + have h₁ : E ∪ (F \ E) = E ∪ F := Set.union_sdiff_self have h₂ : (E ∩ F) ∪ (F \ E) = F := by ext x - simp [Set.mem_union, Set.mem_inter_iff, Set.mem_diff] + simp [Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] tauto have hsum₁ := μ.measure_finite_additive E (F \ E) hE hdiff hdisj₁ have hsum₂ := μ.measure_finite_additive (E ∩ F) (F \ E) hinter hdiff hdisj₂ @@ -306,6 +315,7 @@ def FinitelyAdditiveMeasure.isCountablyAdditive {X:Type*} {B: ConcreteBooleanAlg B.isSigmaAlgebra ∧ ∀ (E : ℕ → Set X), (∀ n, B.measurable (E n)) → Set.univ.PairwiseDisjoint E → μ.measure (⋃ n, E n) = ∑' n, (μ.measure (E n)) +@[instance_reducible] def FinitelyAdditiveMeasure.isCountablyAdditive.toCountablyAdditive {X:Type*} {B: ConcreteBooleanAlgebra X} (μ: FinitelyAdditiveMeasure B) (h: μ.isCountablyAdditive) : CountablyAdditiveMeasure h.1.toSigmaAlgebra := { measure := μ.measure @@ -324,6 +334,7 @@ theorem FinitelyAdditiveMeasure.isCountablyAdditive_restrict_alg {X:Type*} {B B' ⟨B'.countable_union_mem, fun E hE hdisj => μ.measure_countable_additive E (fun n => hBB' (E n) (hE n)) hdisj⟩ +@[instance_reducible] def CountablyAdditiveMeasure.restrict_alg {X:Type*} {B B': ConcreteSigmaAlgebra X} (μ: CountablyAdditiveMeasure B) (hBB' : B' ≤ B) : CountablyAdditiveMeasure B' := { toFinitelyAdditiveMeasure := μ.toFinitelyAdditiveMeasure.restrict_alg hBB', @@ -340,6 +351,7 @@ theorem FinitelyAdditiveMeasure.counting_isCountablyAdditive {X:Type*} : (Finite by sorry /-- Example 1.4.30 -/ +@[instance_reducible] def CountablyAdditiveMeasure.restrict {X:Type*} {B: ConcreteSigmaAlgebra X} (μ: CountablyAdditiveMeasure B) (A:Set X) (hA:B.measurable A) : CountablyAdditiveMeasure (B.restrict A) := { toFinitelyAdditiveMeasure := μ.toFinitelyAdditiveMeasure.restrict A hA, @@ -420,6 +432,7 @@ noncomputable instance CountablyAdditiveMeasure.instDistribMulAction {X:Type*} { } /-- Exercise 1.4.22(ii) -/ +@[instance_reducible] noncomputable def CountablyAdditiveMeasure.sum {X:Type*} {B: ConcreteSigmaAlgebra X} (μ: ℕ → CountablyAdditiveMeasure B) : CountablyAdditiveMeasure B := { toFinitelyAdditiveMeasure := { @@ -448,7 +461,8 @@ noncomputable def CountablyAdditiveMeasure.toMeasure {X:Type*} {B: ConcreteSigma noncomputable def FinitelyAdditiveMeasure.isCountablyAdditive.toMeasure {X:Type*} {B: ConcreteBooleanAlgebra X} {μ: FinitelyAdditiveMeasure B} (h: μ.isCountablyAdditive) : @Measure X h.1.toSigmaAlgebra.measurableSpace := h.toCountablyAdditive.toMeasure -def Measure.toCountablyAdditiveMeasure {X:Type*} [M : MeasurableSpace X] (μ: Measure X) : CountablyAdditiveMeasure M.sigmaAlgebra := +@[instance_reducible] +noncomputable def Measure.toCountablyAdditiveMeasure {X:Type*} [M : MeasurableSpace X] (μ: Measure X) : CountablyAdditiveMeasure M.sigmaAlgebra := { toFinitelyAdditiveMeasure := { measure E := μ.measureOf E diff --git a/Analysis/Misc/Combinatorics.lean b/Analysis/Misc/Combinatorics.lean index ffed38eab..a9b602ad7 100644 --- a/Analysis/Misc/Combinatorics.lean +++ b/Analysis/Misc/Combinatorics.lean @@ -52,7 +52,6 @@ lemma Fin.prod_add_eq_sum_prod_choice (d : ℕ) (a b : Fin d → ℝ) : · intro c' _ simp only [Finset.mem_filter, Finset.mem_univ, Fin.cons_zero, true_and] · intro c₁ _ c₂ _ heq - simp only at heq funext i have h : (Fin.cons true c₁ : Fin (d+1) → Bool) i.succ = (Fin.cons true c₂ : Fin (d+1) → Bool) i.succ := by rw [heq] @@ -86,7 +85,6 @@ lemma Fin.prod_add_eq_sum_prod_choice (d : ℕ) (a b : Fin d → ℝ) : simp only [Finset.mem_filter, Finset.mem_univ, Fin.cons_zero] trivial · intro c₁ _ c₂ _ heq - simp only at heq funext i have h : (Fin.cons false c₁ : Fin (d+1) → Bool) i.succ = (Fin.cons false c₂ : Fin (d+1) → Bool) i.succ := by rw [heq] diff --git a/Analysis/Misc/FiniteChoice.lean b/Analysis/Misc/FiniteChoice.lean index d85582971..3036645f2 100644 --- a/Analysis/Misc/FiniteChoice.lean +++ b/Analysis/Misc/FiniteChoice.lean @@ -13,9 +13,9 @@ theorem finite_choice {X:Type*} {f:X → ℕ} {N:ℕ} (h: ∀ n < N, ∃ x, f x set g' : Fin (N+1) → X := fun n ↦ if h:n.val < N then g ⟨ n.val, h ⟩ else x use g' intro n; by_cases h:n.val < N - . simp only [g', dif_pos h, hg] + . simp only [g', dite_eq_left h, hg] convert hx - . simp only [g', dif_neg h] + . simp only [g', dite_eq_right h] exact Nat.eq_of_lt_succ_of_not_lt n.isLt h lemma sec_ex {α β:Type*} [Fintype β] [DecidableEq β] (f : α → β) (h : ∀ b: β, ∃ a : α, f a = b) : ∃ s :β → α, f ∘ s = id := by @@ -48,9 +48,9 @@ def finite_choice_trunc {X:Type*} {f:X → ℕ} {N:ℕ} (h: ∀ n < N, Trunc {x apply Trunc.mk use g' intro n; by_cases h:n.val < N - . simp only [g', dif_pos h, hg] + . simp only [g', dite_eq_left h, hg] convert hx - . simp only [g', dif_neg h] + . simp only [g', dite_eq_right h] exact Nat.eq_of_lt_succ_of_not_lt n.isLt h def sec_ex_trunc {α β:Type*} [Fintype β] [DecidableEq β] (f : α → β) (h : ∀ b, Trunc { a // f a = b}) : Trunc { s // f ∘ s = id } := by diff --git a/Analysis/Misc/NatBitwise.lean b/Analysis/Misc/NatBitwise.lean index 333e67396..11fb1731a 100644 --- a/Analysis/Misc/NatBitwise.lean +++ b/Analysis/Misc/NatBitwise.lean @@ -67,11 +67,11 @@ lemma testBit_finset_sum_pow_two {s : Finset ℕ} {i : ℕ} : constructor · intro h have : i ∈ (s.sum (2^·)).bitIndices.toFinset := List.mem_toFinset.mpr h - rw [Finset.toFinset_bitIndices_twoPowSum] at this + rw [Finset.toFinset_bitIndices_sum_two_pow] at this exact this · intro h have : i ∈ (s.sum (2^·)).bitIndices.toFinset := by - rw [Finset.toFinset_bitIndices_twoPowSum] + rw [Finset.toFinset_bitIndices_sum_two_pow] exact h exact List.mem_toFinset.mp this diff --git a/Analysis/Misc/Probability.lean b/Analysis/Misc/Probability.lean index 3da1329da..84d50e0bd 100644 --- a/Analysis/Misc/Probability.lean +++ b/Analysis/Misc/Probability.lean @@ -14,7 +14,7 @@ namespace FinitelyAdditive instance instFunLike (A:Type*) [BooleanAlgebra A] : FunLike (FinitelyAdditive A) A ℝ where coe ℙ := ℙ.prob - coe_injective' f g h := by { cases f; cases g; congr } + coe_injective f g h := by { cases f; cases g; congr } variable {A:Type*} [BooleanAlgebra A] (ℙ: FinitelyAdditive A) {A':Type*} [BooleanAlgebra A'] (ℙ': FinitelyAdditive A') @@ -88,8 +88,8 @@ class ExampleProb {A:Type*} [BooleanAlgebra A] (ℙ: FinitelyAdditive A) where prob_E := by simp [hf, Ω.prob_E] prob_EF := by simp [hf, Ω.prob_EF, ←map_sup] prob_EF' := by simp [hf, Ω.prob_EF', ←map_inf] - prob_EG := by simp [hf, Ω.prob_EG, ←map_sdiff'] - prob_G := by simp [hf, Ω.prob_G, ←map_compl'] + prob_EG := by rw [←map_sdiff', hf.map, Ω.prob_EG] + prob_G := by rw [←map_compl', hf.map, Ω.prob_G] end FinitelyAdditive diff --git a/Analysis/Misc/Real-EReal-ENNReal.lean b/Analysis/Misc/Real-EReal-ENNReal.lean index 6b3a28dc7..6361ed75e 100644 --- a/Analysis/Misc/Real-EReal-ENNReal.lean +++ b/Analysis/Misc/Real-EReal-ENNReal.lean @@ -15,7 +15,7 @@ that are not specific to measure theory but are used throughout the formalizatio lemma max_div_two (x : ℝ) : max x 0 / 2 = max (x / 2) 0 := by by_cases hx : 0 ≤ x · simp [max_eq_left hx, max_eq_left (div_nonneg hx (by norm_num : (0:ℝ) < 2).le)] - · push_neg at hx + · push Not at hx simp [max_eq_right (le_of_lt hx), max_eq_right (by linarith : x / 2 ≤ 0)] /-- The square root function is subadditive: {lean}`√(x + y) ≤ √x + √y` for non-negative reals. @@ -77,7 +77,7 @@ lemma EReal.le_of_forall_pos_le_add' {a b : EReal} by_cases hb : b = ⊤ · subst hb; exact le_top · by_contra ha_gt - push_neg at ha_gt + push Not at ha_gt -- a > b and b ≠ ⊤ induction a using EReal.rec with | bot => simp at ha_gt diff --git a/Analysis/Misc/SIExamples.lean b/Analysis/Misc/SIExamples.lean index baca588c4..71a7da6e0 100644 --- a/Analysis/Misc/SIExamples.lean +++ b/Analysis/Misc/SIExamples.lean @@ -41,10 +41,10 @@ abbrev SqrtFrequency := Scalar half_frequency_unit abbrev sqrt_hertz:SqrtFrequency := StandardUnit _ example : sqrt_hertz**2 = hertz := by - simp [←Scalar.val_inj, half_frequency_unit, frequency_unit, sqrt_hertz] + simp [half_frequency_unit, frequency_unit, sqrt_hertz]; rfl example {w : SqrtFrequency} (hw : w = 2 • sqrt_hertz) : hertz.in (w**2) = 4 := by - simp [half_frequency_unit, frequency_unit, hw] + simp [half_frequency_unit, frequency_unit, hw, Scalar.in] norm_num /-- An example of a non-negative scalar type -/ diff --git a/Analysis/Misc/UnitsSystem.lean b/Analysis/Misc/UnitsSystem.lean index 1d56adef9..6544583d9 100644 --- a/Analysis/Misc/UnitsSystem.lean +++ b/Analysis/Misc/UnitsSystem.lean @@ -104,9 +104,7 @@ the {tactic}`simp` and {tactic}`norm_cast` tags. -/ theorem Scalar.toFormal_inj {d: Dimensions} (q₁ q₂:Scalar d) : (q₁:Formal) = (q₂:Formal) ↔ q₁ = q₂ := by constructor - . simp [toFormal, ←val_inj]; intro h - replace h := congr($h d) - simpa using h + . simp [toFormal, ←val_inj] intro h; simp [h] /-- Conveniently, casts from one scalar to another will automatically disappear when moving to @@ -144,8 +142,7 @@ theorem Scalar.val_add {d:Dimensions} (q₁ q₂:Scalar d) : (q₁ + q₂).val = /-- Note how the {tactic}`simp` lemma is in the direction of pushing coercions inward. -/ @[simp,norm_cast] theorem Scalar.toFormal_add {d:Dimensions} (q₁ q₂:Scalar d) : ((q₁ + q₂:Scalar d):Formal) = (q₁:Formal) + (q₂:Formal) := by - simp only [toFormal, val_add, Finsupp.single_add] - rfl + simp only [toFormal, val_add, AddMonoidAlgebra.single_add] instance Scalar.instNeg {d:Dimensions} : Neg (Scalar d) where neg q := ⟨-q.val⟩ @@ -159,7 +156,7 @@ instance Scalar.instNeZero_neg {d:Dimensions} (q:Scalar d) [h:NeZero q] : NeZero @[simp,norm_cast] theorem Scalar.toFormal_neg {d:Dimensions} (q:Scalar d) : ((-q:Scalar d):Formal) = -(q:Formal) := by - simp only [toFormal, val_neg, Finsupp.single_neg]; rfl + simp only [toFormal, val_neg, AddMonoidAlgebra.single_neg] instance Scalar.instSub {d:Dimensions} : Sub (Scalar d) where sub q₁ q₂ := ⟨q₁.val - q₂.val⟩ @@ -169,7 +166,7 @@ theorem Scalar.val_sub {d:Dimensions} (q₁ q₂ : Scalar d) : (q₁ - q₂).val @[simp,norm_cast] theorem Scalar.toFormal_sub {d:Dimensions} (q₁ q₂ :Scalar d) : ((q₁ - q₂ :Scalar d):Formal) = (q₁:Formal) - q₂ := by - simp only [toFormal, val_sub, Finsupp.single_sub]; rfl + simp only [toFormal, val_sub, AddMonoidAlgebra.single_sub] instance Scalar.instSMul {α} {d:Dimensions} [SMul α ℝ] : SMul α (Scalar d) where smul c q := ⟨c • q.val⟩ @@ -340,7 +337,7 @@ theorem Scalar.inv_coe (r:ℝ) : ((r:Scalar 0).inv:Formal) = ((r⁻¹:ℝ):Scal @[simp] theorem Scalar.mul_inv {d₁ d₂:Dimensions} (q₁:Scalar d₁) (q₂:Scalar d₂) : (q₁ * q₂).inv = ((q₁.inv) * (q₂.inv)).cast := by - simp [←toFormal_inj, toFormal]; congr 1; ring + simp [←toFormal_inj, toFormal]; ring @[simp] theorem Scalar.pow_inv {d:Dimensions} (q:Scalar d) (n:ℕ) : (q ** n).inv = (q.inv ** n).cast := by diff --git a/Analysis/Misc/erdos_379.lean b/Analysis/Misc/erdos_379.lean index 0d4c04fdd..f18ba6c33 100644 --- a/Analysis/Misc/erdos_379.lean +++ b/Analysis/Misc/erdos_379.lean @@ -97,5 +97,5 @@ theorem erdos_379 : Filter.atTop.limsup (fun n ↦ (S n:ENat)) = ⊤ := by have := hp'.one_lt have := (p-1).lt_two_pow_self have : 2^(p-1) ≤ 2 ^ (p ^ (r + 2)).totient := by - rw [totient_prime_pow hp']; gcongr; simp; apply Nat.le_mul_of_pos_left; positivity; omega + rw [totient_prime_pow hp']; gcongr; apply Nat.le_mul_of_pos_left; positivity; omega grind diff --git a/Analysis/Misc/erdos_613.lean b/Analysis/Misc/erdos_613.lean index 9a0d7789b..e032f44f9 100644 --- a/Analysis/Misc/erdos_613.lean +++ b/Analysis/Misc/erdos_613.lean @@ -18,7 +18,7 @@ def hasMonoStar {V:Type*} (G : SimpleGraph V) (color : Sym2 V → Fin 2) ∀ ⦃y : V⦄, y ∈ S → G.Adj x y ∧ color (s(x, y)) = col /-- -{given -show}`a, b, c : V` +{given -show (type := "V")}`a, b, c` “Color-{name}`col` monochromatic triangle”: there exist {name}`a`, {name}`b`, {name}`c` with all three edges present in {lean}`G` and colored {name}`col`. (Adjacency already forces distinctness.) -/ @@ -81,9 +81,9 @@ def GAdj : V → V → Prop /-- The graph {name}`G` on 16 vertices used for the n=5 counterexample. -/ def G : SimpleGraph V where Adj := GAdj - symm := by + symm := ⟨by intro u v h - cases u <;> cases v <;> grind [GAdj] + cases u <;> cases v <;> grind [GAdj]⟩ loopless := ⟨by intro v; cases v <;> simp [GAdj]⟩ /-! @@ -222,9 +222,7 @@ lemma degree_A1 (i : Fin 2) : G.degree (A1 i) = 7 := by simp [VEquiv] grind _ = 1 := by - fin_cases i <;> simp - . convert Finset.card_singleton 1 - convert Finset.card_singleton 0 + fin_cases i <;> decide . calc _ = Finset.card (Finset.univ : Finset (Fin 5)) := by congr; ext; simp @@ -319,8 +317,7 @@ lemma degree_A2 (i : Fin 3) : G.degree (A2 i) = 8 := by simp [VEquiv] grind _ = _ := by - convert Finset.card_erase_of_mem (show i ∈ Finset.univ by simp) - grind + convert Finset.card_erase_of_mem (show i ∈ Finset.univ by simp) <;> simp [Finset.filter_ne'] . calc _ = Finset.card (Finset.univ: Finset (Fin 5)) := by congr; ext; simp @@ -573,7 +570,7 @@ lemma exists_block_receives_at_least_6_red have hsum := redBlocks_partition_card color -- If both blocks had ≤ 5, then the total would be ≤ 10 — contradiction. by_contra h - push_neg at h -- h : (redBlock1 color).card ≤ 5 ∧ (redBlock2 color).card ≤ 5 + push Not at h -- h : (redBlock1 color).card ≤ 5 ∧ (redBlock2 color).card ≤ 5 have hle10 : (redNeighbors color).card ≤ 10 := by have : (redBlock1 color).card + (redBlock2 color).card ≤ 5 + 5 := by grind diff --git a/Analysis/Misc/erdos_707.lean b/Analysis/Misc/erdos_707.lean index e5af795db..d532e98e1 100644 --- a/Analysis/Misc/erdos_707.lean +++ b/Analysis/Misc/erdos_707.lean @@ -146,7 +146,7 @@ noncomputable def g {a:ZMod N} (ha: a ∉ B) (b:B): B := (hdiff (a-b.val) (by grind)).choose.2 lemma f_def {a:ZMod N} (ha: a ∉ B) (b:B) : a - b = f ha b - g ha b := by - convert (hdiff (a - b.val) (by grind)).choose_spec.1.symm + convert (hdiff (a - b.val) (by grind)).choose_spec.1.symm <;> rfl lemma f_def' {a:ZMod N} (ha: a ∉ B) (b c d:B) : a - b = c - d ↔ c = f ha b ∧ d = g ha b := by constructor diff --git a/Analysis/Section_10_1.lean b/Analysis/Section_10_1.lean index 6c6735ef3..881cd5b85 100644 --- a/Analysis/Section_10_1.lean +++ b/Analysis/Section_10_1.lean @@ -1,5 +1,6 @@ import Mathlib.Tactic import Mathlib.Analysis.Calculus.Deriv.Basic +import Mathlib.Analysis.Calculus.Deriv.Slope /-! # Analysis I, Section 10.1: Basic definitions @@ -188,7 +189,7 @@ theorem _root_.HasDerivWithinAt.of_comp {X Y: Set ℝ} {x₀ y₀ f'x₀ g'y₀: /-- Exercise 10.1.5 -/ theorem _root_.HasDerivWithinAt.of_pow (n:ℕ) (x₀:ℝ) : HasDerivWithinAt (fun x ↦ x^n) -(n * x₀^((n:ℤ)-1)) .univ x₀ := by + (n * x₀^((n:ℤ)-1)) .univ x₀ := by sorry /-- Exercise 10.1.6 -/ diff --git a/Analysis/Section_10_2.lean b/Analysis/Section_10_2.lean index a0f02d7f7..e1bc8f529 100644 --- a/Analysis/Section_10_2.lean +++ b/Analysis/Section_10_2.lean @@ -1,4 +1,5 @@ import Mathlib.Tactic +import Mathlib.Analysis.Calculus.Deriv.Basic import Analysis.Section_9_6 /-! # Analysis I, Section 10.2: Local maxima, local minima, and derivatives diff --git a/Analysis/Section_10_3.lean b/Analysis/Section_10_3.lean index 17755a0a5..64ba50fa4 100644 --- a/Analysis/Section_10_3.lean +++ b/Analysis/Section_10_3.lean @@ -1,4 +1,6 @@ import Mathlib.Tactic +import Mathlib.Analysis.Calculus.Deriv.Basic +import Mathlib.Analysis.Calculus.Deriv.MeanValue /-! # Analysis I, Section 10.3: Monotone functions and derivatives diff --git a/Analysis/Section_10_5.lean b/Analysis/Section_10_5.lean index bbfa9c0b4..ad7462bb5 100644 --- a/Analysis/Section_10_5.lean +++ b/Analysis/Section_10_5.lean @@ -1,4 +1,5 @@ import Mathlib.Tactic +import Mathlib.Analysis.Calculus.Deriv.Mul import Analysis.Section_9_1 import Analysis.Section_10_1 import Analysis.Section_10_2 diff --git a/Analysis/Section_11_1.lean b/Analysis/Section_11_1.lean index 5f71505c2..3895520df 100644 --- a/Analysis/Section_11_1.lean +++ b/Analysis/Section_11_1.lean @@ -42,7 +42,7 @@ instance BoundedInterval.instEmpty : EmptyCollection BoundedInterval where @[simp] theorem BoundedInterval.coe_empty : ((∅ : BoundedInterval):Set ℝ) = ∅ := by - simp [toSet] + show toSet (Ioo 0 0) = ∅; simp [toSet] open Classical in /-- This is to make {name}`Finset`s of {name}`BoundedInterval`s work properly -/ @@ -240,8 +240,8 @@ noncomputable abbrev Partition.join {I J K:BoundedInterval} (P: Partition I) (Q: all_goals grind contains L hL := by simp at hL; obtain hLP | hLQ := hL - . apply (P.contains _ hLP).trans; simp [h, subset_iff] - apply (Q.contains _ hLQ).trans; simp [h, subset_iff] + . apply _root_.trans (P.contains _ hLP); simp [h, subset_iff] + apply _root_.trans (Q.contains _ hLQ); simp [h, subset_iff] } @[simp] @@ -338,7 +338,7 @@ theorem Partition.sum_of_length (I: BoundedInterval) (P: Partition I) : | Ioc a b => use (Icc b b), hK, Ioo a b; apply join_Ioo_Icc <;> order | Ico _ _ => simp at hI' simp [length_of_subsingleton, -Set.subsingleton_coe] at hsub - have hKI' := (K.Ioo_subset.trans hKI).trans I.subset_Icc + have hKI' := _root_.trans (_root_.trans K.Ioo_subset hKI) I.subset_Icc simp only [subset_iff] at hKI' have hKb : K.b = I.b := by rw [le_antisymm_iff]; split_ands diff --git a/Analysis/Section_11_10.lean b/Analysis/Section_11_10.lean index 27bdcef4c..460c465fd 100644 --- a/Analysis/Section_11_10.lean +++ b/Analysis/Section_11_10.lean @@ -56,7 +56,7 @@ theorem PiecewiseConstantOn.RS_integ_eq_integ_of_mul_deriv _ = _ := by congr have hJsub (hJab : J.a ≤ J.b) : J ⊆ Ioo (J.a - 1) (J.b + 1) := - (subset_Icc J).trans (by simp [subset_iff, Set.Icc_subset_Ioo_iff hJab]) + _root_.trans (subset_Icc J) (by simp [subset_iff, Set.Icc_subset_Ioo_iff hJab]) obtain hJab | hJab := le_iff_eq_or_lt.mp (length_nonneg J) . rw [(integ_on_subsingleton hJab.symm).2] simp [le_iff_lt_or_eq] at hJab; obtain hJab | hJab := hJab @@ -65,7 +65,7 @@ theorem PiecewiseConstantOn.RS_integ_eq_integ_of_mul_deriv simp [length] at hJab rw [α_length_of_cts ?_ ?_ ?_ (hJsub ?_) hαcont.continuousOn ] . have : Icc J.a J.b ⊆ Icc a b := by - have := closure_mono $ (subset_iff _ _).mp $ (Ioo_subset J).trans $ P.contains _ hJ + have := closure_mono $ (subset_iff _ _).mp $ _root_.trans (Ioo_subset J) (P.contains _ hJ) simpa [closure_Ioo (show J.a ≠ J.b by linarith), subset_iff] using this calc _ = Chapter11.integ α' (Icc J.a J.b) := (hα'.mono' this).eq (subset_Icc J) rfl rfl diff --git a/Analysis/Section_11_4.lean b/Analysis/Section_11_4.lean index c217c2311..15df8a5d5 100644 --- a/Analysis/Section_11_4.lean +++ b/Analysis/Section_11_4.lean @@ -111,10 +111,10 @@ theorem IntegrableOn.max {I: BoundedInterval} {f g:ℝ → ℝ} (hf: IntegrableO have lower_le_upper : 0 ≤ upper_integral (f ⊔ g) I - lower_integral (f ⊔ g) I := by linarith [lower_integral_le_upper hmax_bound] have (ε:ℝ) (hε: 0 < ε) : upper_integral (f ⊔ g) I - lower_integral (f ⊔ g) I ≤ 4*ε := by choose f' hf'min hf'const hf'int using gt_of_lt_lower_integral hf.1 (show integ f I - ε < lower_integral f I - by grind) - choose g' hg'min hg'const hg'int using gt_of_lt_lower_integral hg.1 (show integ g I - ε < lower_integral g I by grind) - choose f'' hf''max hf''const hf''int using lt_of_gt_upper_integral hf.1 (show upper_integral f I < integ f I + ε by grind) - choose g'' hg''max hg''const hg''int using lt_of_gt_upper_integral hg.1 (show upper_integral g I < integ g I + ε by grind) + by unfold integ; linarith [hf.2]) + choose g' hg'min hg'const hg'int using gt_of_lt_lower_integral hg.1 (show integ g I - ε < lower_integral g I by unfold integ; linarith [hg.2]) + choose f'' hf''max hf''const hf''int using lt_of_gt_upper_integral hf.1 (show upper_integral f I < integ f I + ε by unfold integ; linarith) + choose g'' hg''max hg''const hg''int using lt_of_gt_upper_integral hg.1 (show upper_integral g I < integ g I + ε by unfold integ; linarith) set h := (f'' - f') + (g'' - g') have hf'_integ := integ_of_piecewise_const hf'const have hg'_integ := integ_of_piecewise_const hg'const @@ -283,7 +283,8 @@ theorem integ_of_mul {I: BoundedInterval} {f g:ℝ → ℝ} (hf: IntegrableOn f rw [show f = fplus - fminus by ext; simp [fplus, fminus], show g = gplus - gminus by ext; simp [gplus, gminus]] ring_nf - exact ((hfplusgplus.add (hfplusgminus.neg.1.sub hfminusgplus).1).1.add hfminusgminus).1 + convert ((hfplusgplus.add (hfplusgminus.neg.1.sub hfminusgplus).1).1.add hfminusgminus).1 using 2 + ext x; simp [fplus, gplus]; ring open BoundedInterval /-- Exercise 11.4.2 -/ diff --git a/Analysis/Section_11_5.lean b/Analysis/Section_11_5.lean index 0126e3961..e7aba85f5 100644 --- a/Analysis/Section_11_5.lean +++ b/Analysis/Section_11_5.lean @@ -192,7 +192,7 @@ theorem integ_of_bdd_cts {I: BoundedInterval} {f:ℝ → ℝ} (hbound: BddOn f I rw [PiecewiseConstantOn.integ_congr g'const_right, integ_const, Irightlen] have g'integ5 : PiecewiseConstantOn.integ g' I' = PiecewiseConstantOn.integ g I' := by apply PiecewiseConstantOn.integ_congr; grind [mem_iff] - grind + linarith exact ⟨ hbound, by linarith [nonneg_of_le_const_mul_eps this] ⟩ /-- Definition 11.5.4 -/ diff --git a/Analysis/Section_11_6.lean b/Analysis/Section_11_6.lean index 8e3aa396d..184d47fc7 100644 --- a/Analysis/Section_11_6.lean +++ b/Analysis/Section_11_6.lean @@ -38,7 +38,8 @@ theorem integ_of_monotone {a b:ℝ} {f:ℝ → ℝ} (hf: MonotoneOn f (Icc a b)) have hbeq : b = a + δ*N := by simp [δ]; field_simp; linarith set e : ℕ ↪ BoundedInterval := { toFun j := Ico (a + δ*j) (a + δ*(j+1)) - inj' j k hjk := by simp at hjk; obtain _ | _ := hjk <;> linarith + inj' := show Function.Injective _ by + intro j k hjk; simp at hjk; obtain _ | _ := hjk <;> linarith } set P : Partition I := { intervals := insert (Icc b b) (.map e (.range N)) diff --git a/Analysis/Section_11_7.lean b/Analysis/Section_11_7.lean index d7a092088..7834ef159 100644 --- a/Analysis/Section_11_7.lean +++ b/Analysis/Section_11_7.lean @@ -71,7 +71,7 @@ theorem not_integrable : BddOn f_9_3_21 (Icc 0 1) ∧ ¬ IntegrableOn f_9_3_21 ( _ = _ := by simp replace hlower : lower_integral f_9_3_21 (Icc 0 1) = 0 := by simp [lower_integ_eq_sup_lower_sum hbdd, hlower] - grind + intro h; linarith [h.2] end Chapter11 diff --git a/Analysis/Section_11_9.lean b/Analysis/Section_11_9.lean index 0f0e8bf09..a34072358 100644 --- a/Analysis/Section_11_9.lean +++ b/Analysis/Section_11_9.lean @@ -73,7 +73,7 @@ theorem deriv_of_integ {a b:ℝ} (hab: a < b) {f:ℝ → ℝ} (hf: IntegrableOn HasDerivWithinAt (fun x => integ f (Icc a x)) (f x₀) (.Icc a b) x₀ := by -- This proof is written to follow the structure of the original text. rw [HasDerivWithinAt.iff_approx_linear] - simp [(ContinuousWithinAt.tfae _ f x₀).out 0 2] at hcts + simp [(ContinuousWithinAt.tfae _ f x₀).out 1 3] at hcts peel hcts with ε hε δ hδ hconv; intro y hy hyδ obtain hx₀y | rfl | hx₀y := lt_trichotomy x₀ y . have := ((hf.join (join_Icc_Ioc hy.1 hy.2)).1.join (join_Icc_Ioc hx₀.1 (le_of_lt hx₀y))).2 @@ -129,6 +129,7 @@ theorem integ_eq_antideriv_sub {a b:ℝ} (h:a ≤ b) {f F: ℝ → ℝ} have hF'_cts : ContinuousOn F' (Ioo (a-1) (b+1)) := by convert (hF_cts.comp_continuous (f := fun x ↦ max (min x b) a) (by fun_prop) ?_).continuousOn using 1 + . rfl intros; simp [le_of_lt h] have hupper (P: Partition (Icc a b)) : upper_riemann_sum f P ≥ F b - F a := by @@ -139,7 +140,7 @@ theorem integ_eq_antideriv_sub {a b:ℝ} (h:a ≤ b) {f F: ℝ → ℝ} intro J hJ; by_cases hJ_empty : (J:Set ℝ) = ∅ . simp [α_length_of_empty _ hJ_empty, length_of_empty hJ_empty] obtain hJab | hJab := le_or_gt J.b J.a - . push_neg at hJ_empty; choose x hx using hJ_empty + . push Not at hJ_empty; choose x hx using hJ_empty cases J with | Ioo _ _ => simp at hx; linarith | Ioc _ _ => simp at hx; linarith @@ -157,16 +158,16 @@ theorem integ_eq_antideriv_sub {a b:ℝ} (h:a ≤ b) {f F: ℝ → ℝ} set d := J.b apply P.contains at hJ have hJ' : Icc a b ⊆ Ioo (a-1/2) (b+1/2) := by apply Set.Icc_subset_Ioo <;> linarith - apply ((Ioo_subset J).trans hJ).trans at hJ' + apply _root_.trans (_root_.trans (Ioo_subset J) hJ) at hJ' simp [subset_iff] at hJ' rw [Set.Ioo_subset_Ioo_iff hJab] at hJ' have hJ'' : Icc a b ⊆ Ioo (a-1) (b+1) := by apply Set.Icc_subset_Ioo <;> linarith - apply hJ.trans at hJ'' + apply _root_.trans hJ at hJ'' rw [α_length_of_cts _ (le_of_lt hJab) _ hJ'' hF'_cts] <;> try linarith have := HasDerivWithinAt.mean_value hJab (hF'_cts.mono ?_) ?_ . choose e he hmean using this have : HasDerivWithinAt F' (f e) (.Ioo c d) e := by - apply (Ioo_subset J).trans at hJ + apply _root_.trans (Ioo_subset J) at hJ simp [subset_iff] at hJ apply ((hF.2 e (hJ he)).mono hJ).congr (f := F) all_goals grind @@ -189,12 +190,13 @@ theorem integ_eq_antideriv_sub {a b:ℝ} (h:a ≤ b) {f F: ℝ → ℝ} . intro _ _; simp at *; refine ⟨ ⟨ ?_, ?_ ⟩, ?_ ⟩ <;> linarith simp at he; rw [closure_Ioo (by linarith)]; simp; linarith . simp; rw [Set.Icc_subset_Ioo_iff (le_of_lt hJab)]; grind - apply (Ioo_subset J).trans at hJ + apply _root_.trans (Ioo_subset J) at hJ + rw [subset_iff] at hJ apply (hF.1.mono _).congr . intro x hx - have : x ∈ Set.Icc a b := by specialize hJ _ hx; simpa using hJ + have : x ∈ Set.Icc a b := hJ hx grind - grind [subset_iff] + exact hJ _ = F'[Icc a b]ₗ := P.sum_of_α_length F' _ = F' b - F' a := by apply α_length_of_cts _ _ _ _ hF'_cts <;> try linarith diff --git a/Analysis/Section_2_2.lean b/Analysis/Section_2_2.lean index 6c36ddf69..a2e414e23 100644 --- a/Analysis/Section_2_2.lean +++ b/Analysis/Section_2_2.lean @@ -177,7 +177,7 @@ lemma Nat.uniq_succ_eq (a:Nat) (ha: a.IsPos) : ∃! b, b++ = a := by sorry /-- Definition 2.2.11 (Ordering of the natural numbers). - This defines the {kw (of := «term_≤_»)}`≤` notation on the natural numbers. -/ + This defines the {kw! (of := «term_≤_»)}`≤` notation on the natural numbers. -/ instance Nat.instLE : LE Nat where le n m := ∃ a:Nat, m = n + a @@ -377,7 +377,7 @@ instance Nat.instLinearOrder : LinearOrder Nat where example (a b c d:Nat) (hab: a ≤ b) (hbc: b ≤ c) (hcd: c ≤ d) (hda: d ≤ a) : a = c := by order -/-- An illustration of the {tactic}`calc` tactic with {kw (of := «term_≤_»)}`≤`/ +/-- An illustration of the {tactic}`calc` tactic with {kw! (of := «term_≤_»)}`≤`/ {kw (of :=«term_<_»)}`<`. -/ example (a b c d e:Nat) (hab: a ≤ b) (hbc: b < c) (hcd: c ≤ d) (hde: d ≤ e) : a + 0 < e := by diff --git a/Analysis/Section_3_3.lean b/Analysis/Section_3_3.lean index c7af01a43..2121edca1 100644 --- a/Analysis/Section_3_3.lean +++ b/Analysis/Section_3_3.lean @@ -76,7 +76,7 @@ abbrev Function.mk_fn {X Y: Set} (f: X → Y) : Function X Y := /-- Definition 3.3.1 -/ theorem Function.eval {X Y: Set} (f: Function X Y) (x: X) (y: Y) : y = f x ↔ f.P x y := by - convert ((f.unique x).choose_iff y).symm + exact ((f.unique x).choose_iff y).symm @[simp] theorem Function.eval_of {X Y: Set} (f: X → Y) (x:X) : (Function.mk_fn f) x = f x := by @@ -90,7 +90,7 @@ theorem SetTheory.Set.P_3_3_3a_existsUnique (x: Nat) : ∃! y: Nat, P_3_3_3a x y apply ExistsUnique.intro ((x+1:ℕ):Nat) . simp [P_3_3_3a] intro y h - simpa [P_3_3_3a, Equiv.symm_apply_eq] using h + simp [P_3_3_3a, Equiv.symm_apply_eq] at h; exact h abbrev SetTheory.Set.f_3_3_3a : Function Nat Nat := Function.mk P_3_3_3a P_3_3_3a_existsUnique @@ -314,7 +314,7 @@ theorem Function.onto_iff {X Y: Set} (f: Function X Y) : f.onto ↔ Function.Sur /-- Example 3.3.21 (using Mathlib) -/ example : ¬ Function.Surjective (fun (n:ℤ) ↦ n^2) := by - unfold Function.Surjective; push_neg + unfold Function.Surjective; push Not use (-1); intro a linarith [sq_nonneg a] @@ -368,7 +368,7 @@ example : Function.Bijective (fun n ↦ ⟨ n+1, by omega⟩ : ℕ → { n:ℕ / example : ¬ Function.Bijective (fun n ↦ n+1) := by suffices h : ¬ Function.Surjective (fun n ↦ n+1) by unfold Function.Bijective; tauto - unfold Function.Surjective; push_neg + unfold Function.Surjective; push Not use 0; intros symm; apply Nat.zero_ne_add_one @@ -385,7 +385,7 @@ theorem Function.bijective_incorrect_def : rw [Function.bijective] suffices h : ¬ f.one_to_one by tauto rw [Function.one_to_one_iff] - push_neg; use 0, 1; simp [f] + push Not; use 0, 1; simp [f] /-- We cannot use the notation {syntax term}`f⁻¹` for the inverse because in Mathlib's {name}`Inv` class, the inverse @@ -398,7 +398,7 @@ abbrev Function.inverse {X Y: Set} (f: Function X Y) (h: f.bijective) : intros apply existsUnique_of_exists_of_unique . aesop - intro _ _ hx hx'; simp at hx hx' + intro _ _ hx hx' rw [←hx'] at hx apply f.one_to_one_iff.mp h.1 simp [hx] diff --git a/Analysis/Section_3_6.lean b/Analysis/Section_3_6.lean index b472310b7..dba8cfff4 100644 --- a/Analysis/Section_3_6.lean +++ b/Analysis/Section_3_6.lean @@ -219,7 +219,11 @@ theorem SetTheory.Set.has_card_to_card {X:Set} {n: ℕ}: X.has_card n → X.card intro h; simp [card, card_uniq (⟨ n, h ⟩:X.finite).choose_spec h]; aesop theorem SetTheory.Set.card_to_has_card {X:Set} {n: ℕ} (hn: n ≠ 0): X.card = n → X.has_card n - := by grind [card, has_card_card] + := by + intro h + have hX : X.finite := by + by_contra hX; simp [card, hX] at h; omega + rw [←h]; exact has_card_card hX theorem SetTheory.Set.card_fin_eq (n:ℕ): (Fin n).has_card n := (has_card_iff _ _).mp ⟨ id, Function.bijective_id ⟩ diff --git a/Analysis/Section_3_epilogue.lean b/Analysis/Section_3_epilogue.lean index 00c789f8d..73ad4207e 100644 --- a/Analysis/Section_3_epilogue.lean +++ b/Analysis/Section_3_epilogue.lean @@ -44,9 +44,10 @@ open PSet in the natural numbers. -/ noncomputable def ZFSet.nat_equiv : ℕ ≃ omega.{u} := Equiv.ofBijective (fun n => ⟨mk (ofNat.{u} n),mk_mem_iff.mpr (Mem.mk _ (ULift.up n))⟩) (by constructor - · intro _ _; simp [eq]; apply eq_of_ofNat_equiv_ofNat + · intro _ _ h; exact eq_of_ofNat_equiv_ofNat _ _ (eq.mp (Subtype.mk.inj h)) · intro ⟨x,hx⟩; rw [←mk_out x, omega] at hx; erw [mk_mem_iff] at hx; obtain ⟨n,hn⟩ := hx - simp [mk_func, PSet.omega] at *; use n.down; rw [←mk_out x, eq]; exact hn.symm + simp [PSet.omega] at *; use n.down; apply Subtype.ext; simp only; rw [←mk_out x, eq] + exact hn.symm ) open Classical in @@ -57,7 +58,7 @@ power set axiom also requiring some technical manipulation). -/ noncomputable instance ZFSet.inst_SetTheory : Chapter3.SetTheory.{u + 1,u + 1} where Set := ZFSet Object := ZFSet - set_to_object := { toFun ⦃a₁⦄ := a₁, inj' _ _ h := h} + set_to_object := { toFun ⦃a₁⦄ := a₁, inj' := show Function.Injective _ from fun _ _ h ↦ h } mem o s := o ∈ s extensionality _ _ := ext emptyset := ∅ @@ -75,7 +76,7 @@ noncomputable instance ZFSet.inst_SetTheory : Chapter3.SetTheory.{u + 1,u + 1} w · intro ⟨z, ⟨hzA, hz⟩, hz'⟩; use z, hzA; simp [hzA, hz hzA] at hz' simp [←hz', Exists.choose_spec] · intro ⟨z, hzA, hz'⟩; use z, ⟨hzA, by aesop⟩ - apply hp ⟨_, hzA⟩; rw [dif_pos ⟨hzA, ⟨_, hz'⟩⟩]; use Exists.choose_spec _ + apply hp ⟨_, hzA⟩; rw [dite_eq_left ⟨hzA, ⟨_, hz'⟩⟩]; use Exists.choose_spec _ nat := omega nat_equiv := nat_equiv regularity_axiom A := by @@ -85,8 +86,8 @@ noncomputable instance ZFSet.inst_SetTheory : Chapter3.SetTheory.{u + 1,u + 1} w pow X Y := funs Y X function_to_object X Y := { toFun f := @map (fun s ↦ if h : s ∈ X then f ⟨s,h⟩ else ∅) (allZFSetDefinable _) X - inj' x _ h := by - ext ⟨s, hs⟩; simp_rw [ZFSet.ext_iff, mem_map] at h + inj' := show Function.Injective _ by + intro x _ h; ext ⟨s, hs⟩; simp_rw [ZFSet.ext_iff, mem_map] at h specialize h (s.pair (x ⟨_,hs⟩)); aesop} powerset_axiom X Y F := by simp [IsFunc]; constructor diff --git a/Analysis/Section_4_1.lean b/Analysis/Section_4_1.lean index 2563e9966..6735edaa3 100644 --- a/Analysis/Section_4_1.lean +++ b/Analysis/Section_4_1.lean @@ -45,7 +45,7 @@ instance PreInt.instSetoid : Setoid PreInt where trans := by -- This proof is written to follow the structure of the original text. intro ⟨ a,b ⟩ ⟨ c,d ⟩ ⟨ e,f ⟩ h1 h2; simp_all - have h3 := congrArg₂ (· + ·) h1 h2; simp at h3 + have h3 := congrArg₂ (· + ·) h1 h2 have : (a + f) + (c + d) = (e + b) + (c + d) := calc (a + f) + (c + d) = a + d + (c + f) := by abel _ = c + b + (e + d) := h3 diff --git a/Analysis/Section_4_2.lean b/Analysis/Section_4_2.lean index e9b872a32..d3b26f726 100644 --- a/Analysis/Section_4_2.lean +++ b/Analysis/Section_4_2.lean @@ -94,7 +94,7 @@ instance Rat.add_inst : Add Rat where /-- Definition 4.2.2 (Addition of rationals) -/ theorem Rat.add_eq (a c:ℤ) {b d:ℤ} (hb: b ≠ 0) (hd: d ≠ 0) : (a // b) + (c // d) = (a*d + b*c) // (b*d) := by - convert Quotient.lift₂_mk _ _ _ _ <;> simp [hb, hd] + simp only [formalDiv, hb, hd, ne_eq, not_false_eq_true, ↓reduceDIte]; rfl /-- Lemma 4.2.3 (Multiplication well-defined) -/ instance Rat.mul_inst : Mul Rat where @@ -103,7 +103,7 @@ instance Rat.mul_inst : Mul Rat where /-- Definition 4.2.2 (Multiplication of rationals) -/ theorem Rat.mul_eq (a c:ℤ) {b d:ℤ} (hb: b ≠ 0) (hd: d ≠ 0) : (a // b) * (c // d) = (a*c) // (b*d) := by - convert Quotient.lift₂_mk _ _ _ _ <;> simp [hb, hd] + simp only [formalDiv, hb, hd, ne_eq, not_false_eq_true, ↓reduceDIte]; rfl /-- Lemma 4.2.3 (Negation well-defined) -/ instance Rat.neg_inst : Neg Rat where diff --git a/Analysis/Section_4_4.lean b/Analysis/Section_4_4.lean index 64c42e552..37e9aa45e 100644 --- a/Analysis/Section_4_4.lean +++ b/Analysis/Section_4_4.lean @@ -115,7 +115,7 @@ theorem Rat.not_exist_sqrt_two : ¬ ∃ x:ℚ, x^2 = 2 := by | succ n ih => exact (hf _ ih).2 have hlt (n:ℕ) : a (n+1) < a n := by have : a (n+1) = f (a n) := n.rec_add_one p (fun n p ↦ f p) - grind + rw [this]; exact (hf _ (ha n)).1 exact Nat.no_infinite_descent ⟨ a, hlt ⟩ diff --git a/Analysis/Section_5_1.lean b/Analysis/Section_5_1.lean index 1f34c614b..2de6da92c 100644 --- a/Analysis/Section_5_1.lean +++ b/Analysis/Section_5_1.lean @@ -318,7 +318,7 @@ theorem Sequence.IsCauchy.harmonic : (mk' 1 (fun n ↦ (1:ℚ)/n)).IsCauchy := b obtain ⟨ N, hN : N > 1/ε ⟩ := exists_nat_gt (1 / ε) have hN' : N > 0 := by observe : (1/ε) > 0 - observe : (N:ℚ) > 0 + have : (N:ℚ) > 0 := lt_trans this hN norm_cast at this refine ⟨ N, by norm_cast, ?_ ⟩ intro j hj k hk diff --git a/Analysis/Section_5_2.lean b/Analysis/Section_5_2.lean index df10bff3f..3c63a8532 100644 --- a/Analysis/Section_5_2.lean +++ b/Analysis/Section_5_2.lean @@ -38,7 +38,7 @@ lemma Rat.closeSeq_def (ε: ℚ) (a b: Sequence) : /-- Example 5.2.2 (a) -/ example : (0.1:ℚ).CloseSeq ((fun n:ℕ ↦ ((-1)^n:ℚ)):Sequence) -((fun n:ℕ ↦ ((1.1:ℚ) * (-1)^n)):Sequence) := by sorry + ((fun n:ℕ ↦ ((1.1:ℚ) * (-1)^n)):Sequence) := by sorry /-- Example 5.2.2 (b) -/ example : ¬ (0.1:ℚ).Steady ((fun n:ℕ ↦ ((-1)^n:ℚ)):Sequence) := by sorry diff --git a/Analysis/Section_5_3.lean b/Analysis/Section_5_3.lean index 5464b757b..d423f410d 100644 --- a/Analysis/Section_5_3.lean +++ b/Analysis/Section_5_3.lean @@ -97,7 +97,7 @@ noncomputable abbrev LIM (a:ℕ → ℚ) : Real := theorem LIM_def {a:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) : LIM a = Quotient.mk _ (CauchySequence.mk' ha) := by - rw [LIM, dif_pos ha] + rw [LIM, dite_eq_left ha] /-- Definition 5.3.1 (Real numbers) -/ theorem Real.eq_lim (x:Real) : ∃ (a:ℕ → ℚ), (a:Sequence).IsCauchy ∧ x = LIM a := by @@ -112,9 +112,9 @@ theorem Real.LIM_eq_LIM {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Se LIM a = LIM b ↔ Sequence.Equiv a b := by constructor . intro h; replace h := Quotient.exact h - rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iff] at h + rwa [dite_eq_left ha, dite_eq_left hb, CauchySequence.equiv_iff] at h intro h; apply Quotient.sound - rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iff] + rwa [dite_eq_left ha, dite_eq_left hb, CauchySequence.equiv_iff] /-- Lemma 5.3.6 (Sum of Cauchy sequences is Cauchy). -/ theorem Sequence.IsCauchy.add {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) : @@ -170,9 +170,9 @@ noncomputable instance Real.add_inst : Add Real where /-- Definition 5.3.4 (Addition of reals) -/ theorem Real.LIM_add {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) : LIM a + LIM b = LIM (a + b) := by - simp_rw [LIM_def ha, LIM_def hb, LIM_def (Sequence.IsCauchy.add ha hb)] - convert Quotient.liftOn₂_mk _ _ _ _ using 1 - simp [LIM]; grind + rw [LIM_def ha, LIM_def hb] + change LIM ((CauchySequence.mk' ha : ℕ → ℚ) + (CauchySequence.mk' hb : ℕ → ℚ)) = _ + simp only [CauchySequence.coe_coe] /-- Proposition 5.3.10 (Product of Cauchy sequences is Cauchy) -/ @@ -211,9 +211,9 @@ noncomputable instance Real.mul_inst : Mul Real where theorem Real.LIM_mul {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) : LIM a * LIM b = LIM (a * b) := by - simp_rw [LIM_def ha, LIM_def hb, LIM_def (Sequence.IsCauchy.mul ha hb)] - convert Quotient.liftOn₂_mk _ _ _ _ using 1 - simp [LIM]; grind + rw [LIM_def ha, LIM_def hb] + change LIM ((CauchySequence.mk' ha : ℕ → ℚ) * (CauchySequence.mk' hb : ℕ → ℚ)) = _ + simp only [CauchySequence.coe_coe] instance Real.instRatCast : RatCast Real where ratCast := fun q ↦ diff --git a/Analysis/Section_5_epilogue.lean b/Analysis/Section_5_epilogue.lean index adf8fbe3c..8572a2ee8 100644 --- a/Analysis/Section_5_epilogue.lean +++ b/Analysis/Section_5_epilogue.lean @@ -128,7 +128,7 @@ namespace Chapter5 noncomputable abbrev Real.equivR : Real ≃ ℝ := Real.equivCut.trans _root_.Real.equivCut.symm lemma Real.equivR_iff (x : Real) (y : ℝ) : y = Real.equivR x ↔ y.toCut = x.toCut := by - simp only [equivR, Equiv.trans_apply, ←Equiv.apply_eq_iff_eq_symm_apply] + simp only [equivR, Equiv.trans_apply, Equiv.eq_symm_apply] rfl -- In order to use this definition, we need some machinery diff --git a/Analysis/Section_6_2.lean b/Analysis/Section_6_2.lean index b55c98c5c..d45aabffe 100644 --- a/Analysis/Section_6_2.lean +++ b/Analysis/Section_6_2.lean @@ -125,7 +125,7 @@ theorem EReal.sup_of_empty : sSup (∅:Set EReal) = ⊥ := sSup_empty theorem EReal.sup_of_infty_mem {E: Set EReal} (hE: ⊤ ∈ E) : sSup E = ⊤ := csSup_eq_top_of_top_mem hE /-- Definition 6.2.6 -/ -theorem EReal.sup_of_neg_infty_mem {E: Set EReal} : sSup E = sSup (E \ {⊥}) := (sSup_diff_singleton_bot _).symm +theorem EReal.sup_of_neg_infty_mem {E: Set EReal} : sSup E = sSup (E \ {⊥}) := (sSup_sdiff_singleton_bot _).symm theorem EReal.inf_eq_neg_sup (E: Set EReal) : sInf E = - sSup (-E) := by simp_rw [←isGLB_iff_sInf_eq, isGLB_iff_le_iff, EReal.le_neg] diff --git a/Analysis/Section_6_5.lean b/Analysis/Section_6_5.lean index 314c65577..d5470e9ed 100644 --- a/Analysis/Section_6_5.lean +++ b/Analysis/Section_6_5.lean @@ -34,7 +34,9 @@ lemma Sequence.pow_eval {a:Sequence} {k: ℕ} {n: ℤ} (hn : n ≥ a.m): (a ^ k) @[simp] lemma Sequence.pow_one (a:Sequence) : a^1 = a := by - ext n; rfl; simp only [HPow.hPow, Pow.pow]; split_ifs with h; simp; simp [a.vanish n (by grind)] + ext n; rfl; by_cases h : n ≥ a.m + · simp [pow_eval h] + · rw [(a^1).vanish n (by change n < a.m; grind), a.vanish n (by grind)] lemma Sequence.pow_succ (a:Sequence) (k:ℕ): a^(k+1) = a^k * a := by ext x diff --git a/Analysis/Section_6_epilogue.lean b/Analysis/Section_6_epilogue.lean index 15b9475a6..2fbb96b66 100644 --- a/Analysis/Section_6_epilogue.lean +++ b/Analysis/Section_6_epilogue.lean @@ -1,4 +1,5 @@ import Mathlib.Tactic +import Mathlib.Topology.MetricSpace.CauSeqFilter import Analysis.Section_6_7 /-! @@ -81,7 +82,7 @@ theorem Chapter6.Sequence.isBounded_iff_isBounded_range (a:ℕ → ℝ): calc _ = |a n - a m| := Real.dist_eq _ _ _ ≤ |a n| + |a m| := abs_sub _ _ - _ ≤ M + M := by gcongr; convert h n; convert h m + _ ≤ M + M := by gcongr; simpa using h n; simpa using h m _ = _ := by ring intro ⟨ C, h ⟩ have : C ≥ 0 := by specialize h 0 0; simpa using h @@ -116,7 +117,7 @@ theorem Chapter6.Sequence.limit_point_iff (a:ℕ → ℝ) (L:ℝ) : . intro h s ⟨ ε, hε, hεs ⟩ N have ⟨ n, hn1, hn2 ⟩ := h _ (half_pos hε) N (by positivity) have hn : n ≥ 0 := by grind - refine ⟨ n.toNat, by rwa [ge_iff_le, Int.le_toNat hn], ?_ ⟩ + refine ⟨ n.toNat, by rwa [Int.le_toNat hn], ?_ ⟩ apply hεs; simp [Real.dist_eq, hn] at *; linarith intro h ε hε N _ have ⟨ n, hn1, hn2 ⟩ := h (Metric.ball L ε) ⟨ _, hε, by aesop ⟩ N.toNat diff --git a/Analysis/Section_7_1.lean b/Analysis/Section_7_1.lean index e24098cd6..4c2244af7 100644 --- a/Analysis/Section_7_1.lean +++ b/Analysis/Section_7_1.lean @@ -320,7 +320,7 @@ theorem sum_union_disjoint {n : ℕ} {S : Type*} [Fintype S] sorry /-- {given}`aᵢ` Exercise 7.1.7. Uses {lean}`Fin m` (so {lean}`aᵢ < m`) instead of the book's {lean}`aᵢ ≤ m`; - the bound is baked into the type, and {kw (of := «term_<_»)}`<` replaces {kw (of := «term_≤_»)}`≤` to match the 0-indexed shift. -/ + the bound is baked into the type, and {kw (of := «term_<_»)}`<` replaces {kw! (of := «term_≤_»)}`≤` to match the 0-indexed shift. -/ theorem sum_finite_col_row_counts {n m : ℕ} (a : Fin n → Fin m) : ∑ i, (a i : ℕ) = ∑ j : Fin m, {i : Fin n | j < a i}.toFinset.card := by sorry diff --git a/Analysis/Section_7_2.lean b/Analysis/Section_7_2.lean index a93f45840..5722a792d 100644 --- a/Analysis/Section_7_2.lean +++ b/Analysis/Section_7_2.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Algebra.Field.Power +import Mathlib.Algebra.Ring.Int.Parity /-! # Analysis I, Section 7.2: Infinite series diff --git a/Analysis/Section_7_3.lean b/Analysis/Section_7_3.lean index 5716a8fba..cbe9a567d 100644 --- a/Analysis/Section_7_3.lean +++ b/Analysis/Section_7_3.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Algebra.Field.Power +import Mathlib.Algebra.Ring.Int.Parity import Mathlib.NumberTheory.LSeries.RiemannZeta import Mathlib.NumberTheory.LSeries.HurwitzZetaValues import Analysis.Section_6_1 @@ -131,7 +131,7 @@ theorem Series.cauchy_criterion {s:Series} (hm: s.m = 1) (hs:s.nonneg) (hmono: . simp [T, Series.partial, htm, hN]; convert hM 0; simp [S, Series.partial, hm] rw [Int.eq_natCast_toNat.mpr hN]; apply (Lemma_7_3_6 N.toNat).2.trans; grind intro ⟨ M, hM ⟩; use M; intro K'; obtain hK' | hK' := lt_or_ge K' 1 - . simp [S, Series.partial, hm, hK']; convert hM (-1) + . simp [S, Series.partial, hm, hK']; convert hM (-1); simp [T, Series.partial, htm] set K := (K'-1).toNat; have hK : K' = K + 1 := by rw [Int.toNat_of_nonneg (by linarith)]; abel calc _ ≤ S (2 ^ (K+1) - 1) := by @@ -177,14 +177,15 @@ theorem Series.zeta_eq {q:ℝ} (hq: q > 1) : (mk' (m := 1) fun n ↦ 1 / (n:ℝ) rw [abs_of_nonneg]; positivity have tail (a: ℤ → ℝ) (L:ℝ) : Filter.atTop.Tendsto a (nhds L) ↔ Filter.atTop.Tendsto (fun n:ℕ ↦ a n) (nhds L) := by convert Filter.tendsto_map'_iff (g:= fun n:ℕ ↦ (n:ℤ) ) - simp + · simp + · rfl unfold convergesTo rw [tail _ L] convert Summable.tendsto_sum_tsum_nat this with n simp [Series.partial] set e : ℕ ↪ ℤ := { toFun n := n+1 - inj' _ _ _ := by grind + inj' := show Function.Injective _ by intro a b h; simpa using h } convert Finset.sum_map _ e _ using 2 with n _ m hm . ext x; simp [e]; constructor diff --git a/Analysis/Section_7_4.lean b/Analysis/Section_7_4.lean index a54a5c4d7..07d115897 100644 --- a/Analysis/Section_7_4.lean +++ b/Analysis/Section_7_4.lean @@ -17,6 +17,7 @@ theorem Series.sum_eq_sum (b:ℕ → ℝ) {N:ℤ} (hN: N ≥ 0) : ∑ n ∈ .Icc ext x; simp; constructor . intro ⟨ _, _ ⟩; use x.toNat; omega grind + simp /-- Proposition 7.4.1 -/ theorem Series.converges_of_permute_nonneg {a:ℕ → ℝ} (ha: (a:Series).nonneg) (hconv: (a:Series).converges) @@ -53,6 +54,7 @@ theorem Series.converges_of_permute_nonneg {a:ℕ → ℝ} (ha: (a:Series).nonne . have hM' : M < 0 := by linarith simp [T, Series.partial, hM'] convert le_ciSup (f := S) ?_ (-1) + . simp [S, Series.partial] simp [BddAbove, Set.Nonempty, upperBounds, hSBound] set Y := Finset.Iic M.toNat have hN : ∃ N, ∀ m ∈ Y, f m ≤ N := by @@ -76,6 +78,7 @@ theorem Series.converges_of_permute_nonneg {a:ℕ → ℝ} (ha: (a:Series).nonne . have hN' : N < 0 := by linarith simp [S, Series.partial, hN'] convert le_ciSup (f := T) ?_ (-1) + . simp [T, Series.partial] simp [BddAbove, Set.Nonempty, upperBounds, hTbound] set X := Finset.Iic N.toNat have hM : ∃ M, ∀ n ∈ X, ∃ m, f m = n ∧ m ≤ M := by @@ -91,6 +94,7 @@ theorem Series.converges_of_permute_nonneg {a:ℕ → ℝ} (ha: (a:Series).nonne ext x; simp; constructor . intro ⟨ _, _ ⟩; use x.toNat; omega grind + simp calc _ = ∑ n ∈ X, a n := by simp [S, sum_eq_sum, hN, X] _ = ∑ n ∈ ((Finset.Iic M).filter (f · ∈ X)).image f, a n := by @@ -178,6 +182,7 @@ theorem Series.absConverges_of_permute {a:ℕ → ℝ} (ha : (a:Series).absConve ext x; simp; constructor . intro ⟨ _, _ ⟩; use x.toNat; omega grind + simp calc _ ≤ |(af:Series).partial M' - (a:Series).partial N| + |(a:Series).partial N - L'| := abs_sub_le _ _ _ _ < |(af:Series).partial M' - (a:Series).partial N| + ε/2 := by gcongr diff --git a/Analysis/Section_7_5.lean b/Analysis/Section_7_5.lean index 1336e1513..696224bad 100644 --- a/Analysis/Section_7_5.lean +++ b/Analysis/Section_7_5.lean @@ -32,7 +32,7 @@ theorem Series.root_test_pos {s : Series} set α := α'.toReal have hαα' : α' = α := by symm; apply coe_toReal - . contrapose! h; simp [h]; exact le_top + . contrapose! h; simp [h] contrapose! hpos; simp [hpos] rw [hαα'] at h hpos; norm_cast at h hpos set ε := (1-α)/2 @@ -123,7 +123,7 @@ theorem Series.ratio_ineq {c:ℤ → ℝ} (m:ℤ) (hpos: ∀ n ≥ m, c n > 0) : have hLpos : 0 ≤ L := by rw [hL'] at hL'pos; norm_cast at hL'pos apply le_of_forall_gt_imp_ge_of_dense intro y hy - by_cases hy' : y = ⊤; · simp [hy']; exact le_top + by_cases hy' : y = ⊤; · simp [hy'] have : y = y.toReal := by symm; apply coe_toReal hy'; contrapose! hy; simp [hy] rw [this, hL', EReal.coe_lt_coe_iff] at hy set ε := y.toReal - L @@ -157,7 +157,7 @@ theorem Series.ratio_ineq {c:ℤ → ℝ} (m:ℤ) (hpos: ∀ n ≥ m, c n > 0) : calc _ ≤ atTop.limsup (fun n:ℤ ↦ ((A^(1/(n:ℝ)) * (L+ε):ℝ):EReal)) := by apply limsup_le_limsup <;> try isBoundedDefault - unfold EventuallyLE; rw [eventually_atTop] + rw [eventually_atTop] use N _ ≤ (atTop.limsup (fun n:ℤ ↦ ((A^(1/(n:ℝ)):ℝ):EReal))) * (atTop.limsup (fun n:ℤ ↦ ((L+ε:ℝ):EReal))) := by convert EReal.limsup_mul_le _ _ _ _ with n @@ -169,11 +169,14 @@ theorem Series.ratio_ineq {c:ℤ → ℝ} (m:ℤ) (hpos: ∀ n ≥ m, c n > 0) : _ = (L+ε:ℝ) := by simp; convert one_mul _ apply Tendsto.limsup_eq - convert Tendsto.comp (f := fun n:ℤ ↦ (A ^ (n:ℝ)⁻¹)) (g := fun x:ℝ ↦ (x:EReal)) (y := nhds 1) _ _ - . apply continuous_coe_real_ereal.tendsto'; norm_num - convert Tendsto.comp (f := fun n:ℤ ↦ (n:ℝ)⁻¹) (g := fun x:ℝ ↦ A^x) (y := nhds 0) _ _ - . apply (continuous_const_rpow (by positivity)).tendsto'; simp - exact tendsto_inv_atTop_zero.comp tendsto_intCast_atTop_atTop + have h1 : Tendsto (fun n:ℤ ↦ (n:ℝ)⁻¹) atTop (nhds 0) := + tendsto_inv_atTop_zero.comp tendsto_intCast_atTop_atTop + have h2 : Tendsto (fun n:ℤ ↦ A ^ (n:ℝ)⁻¹) atTop (nhds 1) := by + have := ((continuous_const_rpow (a := A) (by positivity)).tendsto 0).comp h1 + simpa [Function.comp_def] using this + have h3 : Tendsto (fun n:ℤ ↦ ((A ^ (n:ℝ)⁻¹ : ℝ) : EReal)) atTop (nhds ((1:ℝ):EReal)) := + (continuous_coe_real_ereal.tendsto 1).comp h2 + simpa using h3 /-- Corollary 7.5.3 (Ratio test, convergence). -/ theorem Series.ratio_test_pos {s : Series} (hnon: ∀ n ≥ s.m, s.seq n ≠ 0) diff --git a/Analysis/Section_8_1.lean b/Analysis/Section_8_1.lean index 4121a2da2..faa13f917 100644 --- a/Analysis/Section_8_1.lean +++ b/Analysis/Section_8_1.lean @@ -93,8 +93,8 @@ theorem CountablyInfinite.iff_image_inj {A:Type} (X: Set A) : CountablyInfinite refine ⟨ ⟨ Subtype.val ∘ f, ?_ ⟩, ?_ ⟩ . intro x y hxy; apply hright.injective; simp_all [Subtype.val_inj] ext; simp; constructor - . intro hx; use g ⟨ _, hx ⟩; simp [hleft _] - rintro ⟨ _, rfl ⟩; aesop + . intro hx; use g ⟨ _, hx ⟩; exact congrArg Subtype.val (hleft _) + rintro ⟨ _, rfl ⟩; exact (f _).property intro ⟨ f, hf ⟩ have := Function.leftInverse_invFun (Function.Embedding.injective f) use (Function.invFun f) ∘ Subtype.val; split_ands @@ -143,7 +143,7 @@ theorem Nat.min_eq_sInf {X : Set ℕ} (hX : X.Nonempty) : min X = sInf X := by open Classical in /-- Equivalence with Mathlib's {name}`Nat.find` method -/ theorem Nat.min_eq_find {X : Set ℕ} (hX : X.Nonempty) : min X = Nat.find hX := by - symm; rw [Nat.find_eq_iff]; have := min_spec hX; grind + symm; rw [Nat.find_eq_iff hX]; have := min_spec hX; grind /-- Proposition 8.1.5 -/ theorem Nat.monotone_enum_of_infinite (X : Set ℕ) [Infinite X] : ∃! f : ℕ → X, Function.Bijective f ∧ StrictMono f := by @@ -227,12 +227,12 @@ theorem Int.countablyInfinite : CountablyInfinite ℤ := by -- This proof is written to follow the structure of the original text. have h1 : CountablyInfinite {n:ℤ | n ≥ 0} := by rw [CountablyInfinite.iff_image_inj] - use ⟨ (↑·:ℕ → ℤ), by intro _ _ _; simp_all ⟩ + use ⟨ (↑·:ℕ → ℤ), Nat.cast_injective ⟩ ext n; simp; refine ⟨ ?_, by aesop ⟩ . intro h; use n.toNat; simp [h] have h2 : CountablyInfinite {n:ℤ | n ≤ 0} := by rw [CountablyInfinite.iff_image_inj] - use ⟨ (-↑·:ℕ → ℤ), by intro _ _ _; simp_all ⟩ + use ⟨ Neg.neg ∘ (↑·:ℕ → ℤ), neg_injective.comp Nat.cast_injective ⟩ ext n; simp; refine ⟨ ?_, by aesop ⟩ intro h; use (-n).toNat; simp [h] have : CountablyInfinite (.univ : Set ℤ) := by diff --git a/Analysis/Section_8_2.lean b/Analysis/Section_8_2.lean index 9d9640f26..f4def08fd 100644 --- a/Analysis/Section_8_2.lean +++ b/Analysis/Section_8_2.lean @@ -62,8 +62,10 @@ theorem Sum.eq {X: Type} {f:X → ℝ} {g:ℕ → X} (h: Bijective g) (hfg: (f set g' := this.choose choose g'_inv hleft hright using bijective_iff_has_inverse.mp hbij convert convergesTo_sum (converges_of_absConverges hfg) using 1 + . rfl have hG : Bijective (g'_inv ∘ g) := .comp ⟨hright.injective, hleft.surjective⟩ h convert (absConverges_of_permute hconv hG).2 using 4 with _ n + . rfl by_cases hn : n ≥ 0 <;> simp [hn, hright (g n.toNat)] theorem Sum.of_comp {X Y:Type} {f:X → ℝ} (h: AbsConvergent f) {g: Y → X} (hbij: Bijective g) : AbsConvergent (f ∘ g) ∧ Sum f = Sum (f ∘ g) := by @@ -71,8 +73,8 @@ theorem Sum.of_comp {X Y:Type} {f:X → ℝ} (h: AbsConvergent f) {g: Y → X} ( choose g_inv hleft hright using bijective_iff_has_inverse.mp hbij have hbij_g_inv_g' : Bijective (g_inv ∘ g') := .comp ⟨hright.injective, hleft.surjective⟩ hbij' have hident : (f ∘ g) ∘ g_inv ∘ g' = f ∘ g' := by ext n; simp [hright (g' n)] - refine ⟨ ⟨ g_inv ∘ g', ⟨ hbij_g_inv_g', by convert hconv' ⟩ ⟩, ?_ ⟩ - have h := eq (f := f ∘ g) hbij_g_inv_g' (by convert hconv') + refine ⟨ ⟨ g_inv ∘ g', ⟨ hbij_g_inv_g', by convert hconv'; exact congrFun hident _ ⟩ ⟩, ?_ ⟩ + have h := eq (f := f ∘ g) hbij_g_inv_g' (by convert hconv'; exact congrFun hident _) rw [hident] at h solve_by_elim [convergesTo_uniq, eq] @@ -119,7 +121,7 @@ theorem sum_of_sum_of_AbsConvergent_nonneg {f:ℕ × ℕ → ℝ} (hf:AbsConverg . simp [a, sum_product, Series.partial] solve_by_elim replace (N:ℤ) : ∑ n ∈ Icc 0 N, (a n.toNat).sum ≤ L := by - apply le_of_tendsto' (x := .atTop) (tendsto_finset_sum _ _) (this N) + apply le_of_tendsto' (x := .atTop) (tendsto_finsetSum _ _) (this N) solve_by_elim [convergesTo_sum] replace (N:ℤ) : (fun n ↦ (a n).sum:Series).partial N ≤ L := by convert this N with n hn; simp_all @@ -174,7 +176,7 @@ theorem sum_of_sum_of_AbsConvergent {f:ℕ × ℕ → ℝ} (hf:AbsConvergent f) - (fun n ↦ ((fun m ↦ (fminus) (n, m)):Series).sum:Series) convert_to (fun n ↦ ((fun m ↦ (fplus - fminus) (n, m)):Series).sum:Series) = (((fun n ↦ ((fun m ↦ fplus (n, m)):Series).sum) - (fun n ↦ ((fun m ↦ (fminus) (n, m)):Series).sum):ℕ → ℝ):Series) - . convert sub_coe _ _ + . exact sub_coe (fun n ↦ ((fun m ↦ fplus (n, m)):Series).sum) (fun n ↦ ((fun m ↦ fminus (n, m)):Series).sum) rcongr _ n; simp convert (sub _ _).2 with m; rfl split_ifs with h <;> simp [h, HSub.hSub, Sub.sub] @@ -186,7 +188,9 @@ theorem sum_of_sum_of_AbsConvergent {f:ℕ × ℕ → ℝ} (hf:AbsConvergent f) have hminus := Sum.eq hg (hfminus_conv.comp hg) apply convergesTo_uniq h1 _ convert (convergesTo.sub hplus hminus) using 3 with n - split_ifs with h <;> simp [h, hdiff, HSub.hSub, Sub.sub] + . rfl + change _ = (if n ≥ 0 then (fplus ∘ g) n.toNat else 0) - (if n ≥ 0 then (fminus ∘ g) n.toNat else 0) + split_ifs with h <;> simp [hdiff] /-- Theorem 8.2.2, third version -/ theorem sum_of_sum_of_AbsConvergent' {f:ℕ × ℕ → ℝ} (hf:AbsConvergent f) : @@ -196,9 +200,12 @@ theorem sum_of_sum_of_AbsConvergent' {f:ℕ × ℕ → ℝ} (hf:AbsConvergent f) have hπ: Bijective π := Involutive.bijective (congrFun rfl) have ⟨ g, hg, hconv ⟩ := hf convert sum_of_sum_of_AbsConvergent (f := f ∘ π) _ using 2 + . rfl + . rfl . exact (Sum.of_comp hf hπ).2 refine ⟨ _, hπ.comp hg, ?_ ⟩ convert hconv using 2 + rfl /-- Theorem 8.2.2, fourth version -/ theorem sum_comm {f:ℕ × ℕ → ℝ} (hf:AbsConvergent f) : @@ -359,7 +366,7 @@ theorem AbsConvergent'.iff_Summable {X:Type} (f:X → ℝ) : AbsConvergent' f rw [bddAbove_def] use ∑ x ∈ S, |f x| + 1; simp; intro T calc - _ = ∑ x ∈ (T ∩ S), |f x| + ∑ x ∈ (T \ S), |f x| := (sum_inter_add_sum_diff _ _ _).symm + _ = ∑ x ∈ (T ∩ S), |f x| + ∑ x ∈ (T \ S), |f x| := (sum_inter_add_sum_sdiff _ _ _).symm _ ≤ _ := by gcongr . exact inter_subset_right @@ -395,6 +402,7 @@ theorem Sum'.eq_tsum {X:Type} (f:X → ℝ) (h: AbsConvergent' f) : exact h.subtype E replace this := Sum.eq hg this convert convergesTo_uniq this _ using 1 + · rfl · replace : ∑' x, f x = ∑' n, f (g n) := calc _ = ∑' x:E, f x := by exact (tsum_subtype_eq_of_support_subset (fun x hx => hx)).symm diff --git a/Analysis/Section_8_3.lean b/Analysis/Section_8_3.lean index 5a6c1be6a..95ef1253f 100644 --- a/Analysis/Section_8_3.lean +++ b/Analysis/Section_8_3.lean @@ -139,7 +139,6 @@ theorem Uncountable.real : Uncountable ℝ := by calc _ = ∑' j:ℕ, (10:ℝ)^(-1-n₀:ℝ) * (1/(10:ℝ))^j := by apply tsum_congr; intro j - simp only [Equiv.ofBijective, DFunLike.coe, EquivLike.coe] rw [pow_add, pow_add, rpow_sub, rpow_neg, rpow_one, rpow_natCast] <;> try positivity simp; congr _ = (10:ℝ)^(-1-n₀:ℝ) * ∑' j:ℕ, (1/(10:ℝ))^j := tsum_mul_left diff --git a/Analysis/Section_8_5.lean b/Analysis/Section_8_5.lean index 4a3b64cbc..c09fe48bc 100644 --- a/Analysis/Section_8_5.lean +++ b/Analysis/Section_8_5.lean @@ -102,7 +102,7 @@ example (n:ℤ): ¬ IsMin n ∧ ¬ IsMax n := by sorry theorem WellFoundedLT.iff (X:Type) [LinearOrder X] : WellFoundedLT X ↔ ∀ A:Set X, A.Nonempty → ∃ x:A, IsMin x := by unfold WellFoundedLT IsMin - rw [isWellFounded_iff, WellFounded.wellFounded_iff_has_min] + rw [WellFounded.wellFounded_iff_has_min] peel with A hA; constructor . intro ⟨ x, hxA, h ⟩; use ⟨ x, hxA ⟩; intro ⟨ y, hy ⟩ this; specialize h y hy simp at *; order @@ -140,9 +140,10 @@ theorem WellFoundedLT.subset {X:Type} [PartialOrder X] {A B: Set X} (hA: IsTotal rw [iff' hA] at hwell; rw [iff' (hA.subset hAB)]; intro C hC have ⟨ ⟨ ⟨ x, hx ⟩, hx' ⟩, hmin ⟩ := hwell ((B.embeddingOfSubset _ hAB) '' C) (by aesop) simp at hx'; choose y hy hyC this using hx'; use ⟨ _, hyC ⟩ - simp_all [IsMin, Set.embeddingOfSubset] - intro a ha_B ha_C - apply hmin _ (hAB ha_B) <;> trivial + have hyx : y = x := congrArg Subtype.val this + subst hyx + intro ⟨ ⟨ a, ha_B ⟩, ha_C ⟩ h + exact hmin (b := ⟨ ⟨ a, hAB ha_B ⟩, ⟨ ⟨ a, ha_B ⟩, ha_C, rfl ⟩ ⟩) h /-- Proposition 8.5.10 / Exercise 8.5.10 -/ theorem WellFoundedLT.strong_induction {X:Type} [LinearOrder X] [WellFoundedLT X] {P:X → Prop} @@ -498,7 +499,7 @@ def WellOrderedSubset.empty (X : Type) : WellOrderedSubset X where ord := { PartialOrder.discrete (∅ : Set X) with le_total := fun ⟨_, h⟩ ↦ h.elim toDecidableLE := fun ⟨_, h⟩ ↦ h.elim } - wf := ⟨⟨fun ⟨_, h⟩ ↦ h.elim⟩⟩ + wf := ⟨fun ⟨_, h⟩ ↦ h.elim⟩ theorem WellOrderedSubset.empty_isMin (X : Type) : @IsMin (WellOrderedSubset X) (instPartialOrder X).toPreorder.toLE diff --git a/Analysis/Section_9_1.lean b/Analysis/Section_9_1.lean index c580b5711..689472a87 100644 --- a/Analysis/Section_9_1.lean +++ b/Analysis/Section_9_1.lean @@ -1,5 +1,6 @@ import Mathlib.Tactic import Mathlib.Analysis.SpecificLimits.Basic +import Mathlib.Topology.Instances.Real.Lemmas import Analysis.Section_6_4 /-! # Analysis I, Section 9.1: Subsets of the real line @@ -262,8 +263,9 @@ theorem mem_Icc_isLimit {a b x:ℝ} (h: a < b) (hx: x ∈ Set.Icc a b) : LimitPt have : (n + (b - x)⁻¹)⁻¹ ≤ b-x := by rwa [inv_le_comm₀ ?_ ?_] <;> positivity grind convert (Filter.Tendsto.const_add x (a := 0) ?_) using 1; · simp - convert Filter.Tendsto.comp (f := fun (k:ℕ) ↦ (k:ℝ)) (g := fun k ↦ 1/(k+(b-x)⁻¹)) ?_ tendsto_natCast_atTop_atTop - convert tendsto_mul_add_inv_atTop_nhds_zero 1 (b - x)⁻¹ (by norm_num) using 2 with n; simp + have h1 : Filter.atTop.Tendsto (fun k:ℝ ↦ 1/(k+(b-x)⁻¹)) (nhds 0) := by + convert tendsto_mul_add_inv_atTop_nhds_zero 1 (b - x)⁻¹ (by norm_num) using 2 with n; simp + exact h1.comp tendsto_natCast_atTop_atTop sorry theorem mem_Ico_isLimit {a b x:ℝ} (hx: x ∈ Set.Ico a b) : LimitPt x (.Ico a b) := by diff --git a/Analysis/Section_9_10.lean b/Analysis/Section_9_10.lean index 0796617ac..9e4fa89f3 100644 --- a/Analysis/Section_9_10.lean +++ b/Analysis/Section_9_10.lean @@ -22,7 +22,7 @@ theorem BddAbove.unbounded_iff' (X:Set ℝ) : ¬ BddAbove X ↔ sSup ((fun x:ℝ erw [sSup_eq_top, unbounded_iff] constructor . intro h M hM; choose x hx hxM using h M.toReal - use x, ⟨x, hx, rfl⟩; revert M; simp [EReal.forall]; tauto + use x, ⟨x, hx, rfl⟩; revert M; simp [EReal.forall] intro h M; specialize h (M:EReal) (EReal.coe_lt_top M) obtain ⟨_, ⟨x, hx, rfl⟩, hMx⟩ := h; exact ⟨x, hx, EReal.coe_lt_coe_iff.mp hMx⟩ diff --git a/Analysis/Section_9_3.lean b/Analysis/Section_9_3.lean index 2e8af602c..567c3cbc7 100644 --- a/Analysis/Section_9_3.lean +++ b/Analysis/Section_9_3.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Data.Real.Sign +import Mathlib.Basic.Real.Sign import Analysis.Section_9_1 set_option doc.verso.suggestions false diff --git a/Analysis/Section_9_4.lean b/Analysis/Section_9_4.lean index e92aa1d37..6c6c01a77 100644 --- a/Analysis/Section_9_4.lean +++ b/Analysis/Section_9_4.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Data.Real.Sign +import Mathlib.Basic.Real.Sign import Mathlib.Topology.ContinuousOn import Analysis.Section_9_3 /-! @@ -73,7 +73,7 @@ theorem _root_.Filter.Tendsto.comp_of_continuous {X:Set ℝ} {f: ℝ → ℝ} {x (h_cont: ContinuousWithinAt f X x₀) {a: ℕ → ℝ} (ha: ∀ n, a n ∈ X) (hconv: Filter.atTop.Tendsto a (nhds x₀)): Filter.atTop.Tendsto (fun n ↦ f (a n)) (nhds (f x₀)) := by - have := (ContinuousWithinAt.tfae X f x₀).out 0 1 + have := (ContinuousWithinAt.tfae X f x₀).out 1 2 grind /-- Proposition 9.4.9 -/ diff --git a/Analysis/Section_9_5.lean b/Analysis/Section_9_5.lean index b4411315c..f41ef9366 100644 --- a/Analysis/Section_9_5.lean +++ b/Analysis/Section_9_5.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Data.Real.Sign +import Mathlib.Basic.Real.Sign import Analysis.Section_9_3 import Analysis.Section_9_4 @@ -85,7 +85,7 @@ theorem ContinuousAt.iff_eq_left_right_limit {X: Set ℝ} {f: ℝ → ℝ} {x₀ . sorry intro ⟨ ⟨ hre, hright⟩, ⟨ hle, lheft ⟩ ⟩ set L := f x₀ - have := (ContinuousWithinAt.tfae X f x₀).out 0 2 + have := (ContinuousWithinAt.tfae X f x₀).out 1 3 rw [this] intro ε hε apply right_limit.eq' at hre diff --git a/Analysis/Section_9_6.lean b/Analysis/Section_9_6.lean index 79f472f67..bae906566 100644 --- a/Analysis/Section_9_6.lean +++ b/Analysis/Section_9_6.lean @@ -1,5 +1,5 @@ import Mathlib.Tactic -import Mathlib.Data.Real.Sign +import Mathlib.Basic.Real.Sign import Analysis.Section_9_3 import Analysis.Section_9_4 diff --git a/lake-manifest.json b/lake-manifest.json index b0c25c6ce..aebe33094 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,41 +1,41 @@ -{"version": "1.1.0", +{"version": "1.3.0", "packagesDir": ".lake/packages", "packages": [{"url": "https://github.com/leanprover-community/mathlib4.git", "type": "git", "subDir": null, "scope": "", - "rev": "698d2b68b870f1712040ab0c233d34372d4b56df", + "rev": "56a005855ea17e0b0958f73ec801ae140b0a1679", "name": "mathlib", "manifestFile": "lake-manifest.json", - "inputRev": "v4.29.0-rc8", + "inputRev": "v4.35.0", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover/verso", "type": "git", "subDir": null, "scope": "", - "rev": "b6a5bacc221b260a67d474a2436b89d067ae5f7d", + "rev": "304b8561790c50222551c937ce02928df0d5b445", "name": "verso", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "v4.35.0", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover/doc-gen4", "type": "git", "subDir": null, "scope": "", - "rev": "fbfa185b60c17f8efb9c78863ccf3cf873b6721b", + "rev": "0e1ffe2e4ba5ecfdfaf15c65b8d3805dbb7134ae", "name": "«doc-gen4»", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "v4.35.0", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/plausible", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "22a0afa903bcf65285152eea298a3d319badc78d", + "rev": "dfa4f38190d07c37e315953e08b90fe2d95b3c24", "name": "plausible", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -45,7 +45,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", + "rev": "d6b4c7be5be75ec4917c873ac50c756dc1436372", "name": "LeanSearchClient", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -55,7 +55,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "db22912cdd820b2a2bd84bd25273cb322ff09ead", + "rev": "a41f0e9a4dea23188ea9cc1c41ac9f8bbafe0b93", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -65,17 +65,17 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "136730b5a40dc633967f5433cb7668df5c3bf9a3", + "rev": "df72b022e558978a1c50264cfc4d7fec86fa8e04", "name": "proofwidgets", "manifestFile": "lake-manifest.json", - "inputRev": "v0.0.94", + "inputRev": "main", "inherited": true, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/aesop", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "3426969888a264d3f69b6f30ab50aa11f28eb38d", + "rev": "4a174c490d8707121c4a9290800489f105d85e07", "name": "aesop", "manifestFile": "lake-manifest.json", "inputRev": "master", @@ -85,7 +85,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "3a9fde028258300f1cbb003d457d47c8d8e16b1c", + "rev": "dce0ad79c486cb1fb504af04f953c3466b0c6db8", "name": "Qq", "manifestFile": "lake-manifest.json", "inputRev": "master", @@ -95,7 +95,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "bce25af79ec73f5e63240d4399a4cd8a6a227fcb", + "rev": "66e469188fe07963e5cf666c7d4433f45b8131c5", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -105,17 +105,27 @@ "type": "git", "subDir": null, "scope": "leanprover", - "rev": "61cd682f2a25175996bc1b9e8d8231e76cded866", + "rev": "c24fe6078c630e89b489bffe59b3e20ac30d12c8", "name": "Cli", "manifestFile": "lake-manifest.json", - "inputRev": "v4.29.0-rc8", + "inputRev": "v4.35.0", "inherited": true, "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover/illuminate", + "type": "git", + "subDir": null, + "scope": "", + "rev": "f77493ba242e94f518b125ef2e538cd4ab0ca678", + "name": "illuminate", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, {"url": "https://github.com/acmepjz/md4lean", "type": "git", "subDir": null, "scope": "", - "rev": "6a3fb240133bcb7e1a066fdc784b3fdc304e3fc5", + "rev": "31907cc18f48a95384f99cee5582c00fb39e0f67", "name": "MD4Lean", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -125,27 +135,27 @@ "type": "git", "subDir": null, "scope": "", - "rev": "52b9dfbd2658408e37ae6e8b72601ddeaaa25a0c", + "rev": "892d6dc520270b5fb8c1291dd1b131e8c16255ed", "name": "subverso", "manifestFile": "lake-manifest.json", "inputRev": "main", "inherited": true, "configFile": "lakefile.lean"}, - {"url": "https://github.com/kim-em/leansqlite", + {"url": "https://github.com/leanprover/leansqlite", "type": "git", "subDir": null, "scope": "", - "rev": "d14544c72b593af6a66131bc34cdab16bf7c0940", + "rev": "4ed2f27ecf81792abc8ff848670ac4356d0c4794", "name": "leansqlite", "manifestFile": "lake-manifest.json", - "inputRev": "suppress-reducibility-warning", + "inputRev": "main", "inherited": true, "configFile": "lakefile.lean"}, {"url": "https://github.com/fgdorais/lean4-unicode-basic", "type": "git", "subDir": null, "scope": "", - "rev": "629254926fb54ef83d582bd41a0b9eb72b934015", + "rev": "6e48acac3a91665fcdc4a20d50b7ce6b7b41711f", "name": "UnicodeBasic", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -155,11 +165,12 @@ "type": "git", "subDir": null, "scope": "", - "rev": "5d31b64fb703c5d77f6ef4d1fb958f9bdf1ea539", + "rev": "876b844aa52183cbcc0d82fdd4d1fc349f0dac34", "name": "BibtexQuery", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "master", "inherited": true, "configFile": "lakefile.toml"}], "name": "Analysis", - "lakeDir": ".lake"} + "lakeDir": ".lake", + "fixedToolchain": false} diff --git a/lakefile.lean b/lakefile.lean index ffb44c155..768377373 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -14,14 +14,14 @@ package «Analysis» where -- add any additional package configuration options here meta if get_config? env = some "dev" then -require «doc-gen4» from git "https://github.com/leanprover/doc-gen4" @ "main" +require «doc-gen4» from git "https://github.com/leanprover/doc-gen4" @ "v4.35.0" require verso from git - "https://github.com/leanprover/verso" @ "main" + "https://github.com/leanprover/verso" @ "v4.35.0" -- Require Mathlib (the comprehensive library of mathematics in Lean) require mathlib from git - "https://github.com/leanprover-community/mathlib4.git" @ "v4.29.0-rc8" + "https://github.com/leanprover-community/mathlib4.git" @ "v4.35.0" @[default_target] diff --git a/lean-toolchain b/lean-toolchain index b58ff4f08..d87704efd 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.29.0-rc8 \ No newline at end of file +leanprover/lean4:v4.35.0 \ No newline at end of file