diff --git a/Archive/Imo/Imo1987Q1.lean b/Archive/Imo/Imo1987Q1.lean index c352c7910d960e..346db232c622de 100644 --- a/Archive/Imo/Imo1987Q1.lean +++ b/Archive/Imo/Imo1987Q1.lean @@ -54,7 +54,7 @@ fixed points. -/ def fiber (k : ℕ) : Set (Perm α) := {σ : Perm α | card (fixedPoints σ) = k} -instance {k : ℕ} : Fintype (fiber α k) := inferInstanceAs <| Fintype (setOf _) +instance {k : ℕ} : Fintype (fiber α k) := inferInstanceAs <| Fintype (Set.ofPred _) @[simp] theorem mem_fiber {σ : Perm α} {k : ℕ} : σ ∈ fiber α k ↔ card (fixedPoints σ) = k := diff --git a/Archive/Imo/Imo1988Q6.lean b/Archive/Imo/Imo1988Q6.lean index d5ea683cfcae51..808ba4e04a4a8b 100644 --- a/Archive/Imo/Imo1988Q6.lean +++ b/Archive/Imo/Imo1988Q6.lean @@ -92,7 +92,7 @@ theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ → -- Our assumptions ensure that we can then prove the claim. suffices exc : exceptional.Nonempty by -- Suppose that there exists an element in the exceptional locus. - simp only [Set.Nonempty, Prod.exists, Set.mem_setOf_eq, exceptional] at exc + simp only [Set.Nonempty, Prod.exists, Set.mem_ofPred_eq, exceptional] at exc -- Let (a,b) be such an element, and consider all the possible cases. rcases exc with ⟨a, b, hH, hb⟩ rcases hb with (_ | rfl | rfl | hB | hB) @@ -138,7 +138,7 @@ theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ → -- This means that m_y = m, -- and the conditions H(m_x, m_y) and m_x < m_y are satisfied. simp only at mx_lt_my hHm m_eq - simp only [exceptional, hHm, Set.mem_setOf_eq, true_and] at h_base + simp only [exceptional, hHm, Set.mem_ofPred_eq, true_and] at h_base push Not at h_base -- Finally, it also means that (m_x, m_y) does not lie in the base locus, -- that m_x ≠ 0, m_x ≠ m_y, B(m_x) ≠ m_y, and B(m_x) ≠ m_x + m_y. diff --git a/Archive/Imo/Imo2008Q2.lean b/Archive/Imo/Imo2008Q2.lean index 695b32fc2160d6..682c6a3dbabf2a 100644 --- a/Archive/Imo/Imo2008Q2.lean +++ b/Archive/Imo/Imo2008Q2.lean @@ -65,7 +65,7 @@ theorem imo2008_q2b : Set.Infinite rationalSolutions := by have hW_sub_S : W ⊆ rationalSolutions := by intro s hs_in_W rw [rationalSolutions] - simp only [Set.mem_setOf_eq] at hs_in_W ⊢ + simp only [Set.mem_ofPred_eq] at hs_in_W ⊢ rcases hs_in_W with ⟨x, y, z, h₁, t, ht_gt_zero, hx_t, hy_t, hz_t⟩ use x, y, z have key_gt_zero : 0 < t ^ 2 + t + 1 := by linarith [pow_pos ht_gt_zero 2, ht_gt_zero] @@ -99,7 +99,7 @@ theorem imo2008_q2b : Set.Infinite rationalSolutions := by set z : ℚ := -t * (t + 1) with hz_def simp only [t, W, K, g, Set.mem_image, Prod.exists] use x, y, z; constructor - · simp only [Set.mem_setOf_eq] + · simp only [Set.mem_ofPred_eq] use x, y, z; constructor · rfl · use t; constructor diff --git a/Archive/Imo/Imo2024Q3.lean b/Archive/Imo/Imo2024Q3.lean index 2c51652ba0ffd4..58c57b4dab2cd0 100644 --- a/Archive/Imo/Imo2024Q3.lean +++ b/Archive/Imo/Imo2024Q3.lean @@ -160,7 +160,7 @@ lemma apply_add_one_ne_of_apply_eq {i j : ℕ} (hi : N ≤ i) (hj : N ≤ j) (hi hij.lt_or_gt.elim (fun h ↦ (hc.apply_add_one_lt_of_apply_eq hi h ha).ne) fun h ↦ (hc.apply_add_one_lt_of_apply_eq hj h ha.symm).ne' -lemma exists_infinite_setOf_apply_eq : ∃ m, {i | a i = m}.Infinite := by +lemma exists_infinite_setOfPred_apply_eq : ∃ m, {i | a i = m}.Infinite := by by_contra! hi have hr : (Set.range a).Infinite := by contrapose! hi with hr @@ -180,16 +180,25 @@ lemma exists_infinite_setOf_apply_eq : ∃ m, {i | a i = m}.Infinite := by exact hc.apply_nth_add_one_eq toFinset_card_pos (N_lt_of_M_le_apply (a := a) (by simp only [apply_nth_zero, hi])).le -lemma nonempty_setOf_infinite_setOf_apply_eq : {m | {i | a i = m}.Infinite}.Nonempty := - hc.exists_infinite_setOf_apply_eq +@[deprecated (since := "2026-07-09")] +alias exists_infinite_setOf_apply_eq := exists_infinite_setOfPred_apply_eq -lemma injOn_setOf_apply_add_one_eq_of_M_le {n : ℕ} (h : M a N ≤ n) : +lemma nonempty_setOfPred_infinite_setOfPred_apply_eq : {m | {i | a i = m}.Infinite}.Nonempty := + hc.exists_infinite_setOfPred_apply_eq + +@[deprecated (since := "2026-07-09")] +alias nonempty_setOf_infinite_setOf_apply_eq := nonempty_setOfPred_infinite_setOfPred_apply_eq + +lemma injOn_setOfPred_apply_add_one_eq_of_M_le {n : ℕ} (h : M a N ≤ n) : Set.InjOn a {i | a (i + 1) = n} := by intro i hi j hj hij have hi' := hi ▸ hc.nth_apply_add_one_eq (Nat.lt_add_one_iff.mp (N_lt_of_M_le_apply (hi ▸ h))) have hj' := hj ▸ hc.nth_apply_add_one_eq (Nat.lt_add_one_iff.mp (N_lt_of_M_le_apply (hj ▸ h))) rw [← hi', ← hj', hij] +@[deprecated (since := "2026-07-09")] +alias injOn_setOf_apply_add_one_eq_of_M_le := injOn_setOfPred_apply_add_one_eq_of_M_le + lemma empty_consecutive_apply_ge_M : {i | M a N ≤ a i ∧ M a N ≤ a (i + 1)} = ∅ := by rw [Set.eq_empty_iff_forall_notMem] intro i @@ -224,7 +233,7 @@ lemma empty_consecutive_apply_ge_M : {i | M a N ≤ a i ∧ M a N ≤ a (i + 1)} have ht' : a (i + 1) = #t' := hc.apply_add_one_eq_card N_le_i rw [← card_t_eq_card_t'] at ht' have ht'inj : Set.InjOn a t := by - refine (hc.injOn_setOf_apply_add_one_eq_of_M_le hi1).mono ?_ + refine (hc.injOn_setOfPred_apply_add_one_eq_of_M_le hi1).mono ?_ simp_all [t, t'] have card_image_eq_card_t : #(Finset.image a t) = #t := Finset.card_image_of_injOn ht'inj have card_image_lt_M : #(Finset.image a t) < M a N := by @@ -246,12 +255,15 @@ lemma card_lt_M_of_M_le {n : ℕ} (h : M a N ≤ n) : suffices H : a (Nat.nth (fun x ↦ a x = n) (M a N - 1) + 1) = M a N from Nat.le_of_eq H.symm convert! hc.apply_nth_add_one_eq hin' (N_lt_of_M_le_apply ha).le using 1 -lemma bddAbove_setOf_infinite_setOf_apply_eq : BddAbove {m | {i | a i = m}.Infinite} := by +lemma bddAbove_setOfPred_infinite_setOfPred_apply_eq : BddAbove {m | {i | a i = m}.Infinite} := by refine ⟨M a N, fun x hi ↦ ?_⟩ by_contra hx exact hi (hc.card_lt_M_of_M_le (not_le.mp hx).le).1 -lemma infinite_setOf_apply_eq_anti {j k : ℕ} (hj : 0 < j) (hk : {i | a i = k}.Infinite) +@[deprecated (since := "2026-07-09")] +alias bddAbove_setOf_infinite_setOf_apply_eq := bddAbove_setOfPred_infinite_setOfPred_apply_eq + +lemma infinite_setOfPred_apply_eq_anti {j k : ℕ} (hj : 0 < j) (hk : {i | a i = k}.Infinite) (hjk : j ≤ k) : {i | a i = j}.Infinite := by have hk' : {i | a (i + 1) = k}.Infinite := by have hinj : Set.InjOn (· + 1) {i | a (i + 1) = k} := (add_left_injective _).injOn @@ -259,7 +271,7 @@ lemma infinite_setOf_apply_eq_anti {j k : ℕ} (hj : 0 < j) (hk : {i | a i = k}. have hk0 : ({i | a i = k} \ {0}).Infinite := hk.sdiff (Set.finite_singleton _) convert! hk0 using 1 ext i - simp only [Set.mem_image, Set.mem_setOf_eq, Set.mem_sdiff, Set.mem_singleton_iff] + simp only [Set.mem_image, Set.mem_ofPred_eq, Set.mem_sdiff, Set.mem_singleton_iff] refine ⟨?_, ?_⟩ · rintro ⟨j, rfl, rfl⟩ simp @@ -268,7 +280,7 @@ lemma infinite_setOf_apply_eq_anti {j k : ℕ} (hj : 0 < j) (hk : {i | a i = k}. have hinj : Set.InjOn (fun x ↦ Nat.nth (a · = a x) (j - 1) + 1) ({i | a (i + 1) = k} \ Set.Ico 0 N) := by intro x hx y hy h - simp only [Set.mem_sdiff, Set.mem_setOf_eq, Set.mem_Ico, zero_le, true_and, not_lt] at hx hy + simp only [Set.mem_sdiff, Set.mem_ofPred_eq, Set.mem_Ico, zero_le, true_and, not_lt] at hx hy rcases hx with ⟨hxk, hNx⟩ rcases hy with ⟨hyk, hNy⟩ simp only [add_left_inj] at h @@ -284,10 +296,13 @@ lemma infinite_setOf_apply_eq_anti {j k : ℕ} (hj : 0 < j) (hk : {i | a i = k}. have hk'' : (_ \ Set.Ico 0 (N + 2)).Infinite := ((Set.infinite_image_iff hinj).mpr (hk'.sdiff (Set.finite_Ico _ _))).sdiff (Set.finite_Ico _ _) refine hk''.mono fun _ hi ↦ ?_ - simp only [Set.mem_image, Set.mem_sdiff, Set.mem_setOf_eq, Set.mem_Ico, zero_le, true_and, + simp only [Set.mem_image, Set.mem_sdiff, Set.mem_ofPred_eq, Set.mem_Ico, zero_le, true_and, not_lt] at hi rcases hi with ⟨⟨x, -, rfl⟩, _⟩ - rw [Set.mem_setOf_eq, hc.apply_nth_add_one_eq_of_lt (by lia), Nat.sub_add_cancel hj] + rw [Set.mem_ofPred_eq, hc.apply_nth_add_one_eq_of_lt (by lia), Nat.sub_add_cancel hj] + +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_apply_eq_anti := infinite_setOfPred_apply_eq_anti /-! ### The definitions of small, medium and big numbers and the eventual alternation -/ @@ -301,41 +316,62 @@ def Small (j : ℕ) : Prop := j ≤ k a variable {a} -lemma infinite_setOf_apply_eq_k : {i | a i = k a}.Infinite := - Nat.sSup_mem hc.nonempty_setOf_infinite_setOf_apply_eq hc.bddAbove_setOf_infinite_setOf_apply_eq +lemma infinite_setOfPred_apply_eq_k : {i | a i = k a}.Infinite := + Nat.sSup_mem hc.nonempty_setOfPred_infinite_setOfPred_apply_eq + hc.bddAbove_setOfPred_infinite_setOfPred_apply_eq + +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_apply_eq_k := infinite_setOfPred_apply_eq_k -lemma infinite_setOf_apply_eq_iff_small {j : ℕ} (hj : 0 < j) : +lemma infinite_setOfPred_apply_eq_iff_small {j : ℕ} (hj : 0 < j) : {i | a i = j}.Infinite ↔ Small a j := - ⟨fun h ↦ le_csSup hc.bddAbove_setOf_infinite_setOf_apply_eq h, - fun h ↦ hc.infinite_setOf_apply_eq_anti hj hc.infinite_setOf_apply_eq_k h⟩ + ⟨fun h ↦ le_csSup hc.bddAbove_setOfPred_infinite_setOfPred_apply_eq h, + fun h ↦ hc.infinite_setOfPred_apply_eq_anti hj hc.infinite_setOfPred_apply_eq_k h⟩ + +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_apply_eq_iff_small := infinite_setOfPred_apply_eq_iff_small -lemma finite_setOf_apply_eq_iff_not_small {j : ℕ} (hj : 0 < j) : +lemma finite_setOfPred_apply_eq_iff_not_small {j : ℕ} (hj : 0 < j) : {i | a i = j}.Finite ↔ ¬Small a j := by - contrapose!; exact hc.infinite_setOf_apply_eq_iff_small hj + contrapose!; exact hc.infinite_setOfPred_apply_eq_iff_small hj -lemma finite_setOf_apply_eq_k_add_one : {i | a i = k a + 1}.Finite := by - rw [hc.finite_setOf_apply_eq_iff_not_small (by lia), Small] +@[deprecated (since := "2026-07-09")] +alias finite_setOf_apply_eq_iff_not_small := finite_setOfPred_apply_eq_iff_not_small + +lemma finite_setOfPred_apply_eq_k_add_one : {i | a i = k a + 1}.Finite := by + rw [hc.finite_setOfPred_apply_eq_iff_not_small (by lia), Small] lia +@[deprecated (since := "2026-07-09")] +alias finite_setOf_apply_eq_k_add_one := finite_setOfPred_apply_eq_k_add_one + /-- There are only finitely many `m` that appear more than `k` times. -/ -lemma finite_setOf_k_lt_card : {m | ∀ hf : {i | a i = m}.Finite, k a < #hf.toFinset}.Finite := by +lemma finite_setOfPred_k_lt_card : + {m | ∀ hf : {i | a i = m}.Finite, k a < #hf.toFinset}.Finite := by rw [← Set.finite_image_iff] - · refine Set.Finite.of_sdiff (hc.finite_setOf_apply_eq_k_add_one.subset fun i hi ↦ ?_) + · refine Set.Finite.of_sdiff (hc.finite_setOfPred_apply_eq_k_add_one.subset fun i hi ↦ ?_) (Set.finite_Iic N) - simp only [Set.mem_sdiff, Set.mem_image, Set.mem_setOf_eq, Set.mem_Iic, not_le] at hi + simp only [Set.mem_sdiff, Set.mem_image, Set.mem_ofPred_eq, Set.mem_Iic, not_le] at hi rcases hi with ⟨⟨j, hjf, rfl⟩, hNi⟩ - rw [Set.mem_setOf_eq, hc.apply_nth_add_one_eq hjf (by lia)] + rw [Set.mem_ofPred_eq, hc.apply_nth_add_one_eq hjf (by lia)] · intro i hi j hj hij simp only [add_left_inj] at hij apply_fun a at hij rwa [Nat.nth_mem _ hi, Nat.nth_mem _ hj] at hij -lemma bddAbove_setOf_k_lt_card : BddAbove {m | ∀ hf : {i | a i = m}.Finite, k a < #hf.toFinset} := - hc.finite_setOf_k_lt_card.bddAbove +@[deprecated (since := "2026-07-09")] +alias finite_setOf_k_lt_card := finite_setOfPred_k_lt_card + +lemma bddAbove_setOfPred_k_lt_card : + BddAbove {m | ∀ hf : {i | a i = m}.Finite, k a < #hf.toFinset} := + hc.finite_setOfPred_k_lt_card.bddAbove + +@[deprecated (since := "2026-07-09")] +alias bddAbove_setOf_k_lt_card := bddAbove_setOfPred_k_lt_card lemma k_pos : 0 < k a := by by_contra! hn - apply nonpos_iff_eq_zero.mp hn ▸ hc.infinite_setOf_apply_eq_k + apply nonpos_iff_eq_zero.mp hn ▸ hc.infinite_setOfPred_apply_eq_k convert! Set.finite_empty ext i simp [(hc.pos i).ne'] @@ -344,8 +380,11 @@ lemma small_one : Small a 1 := by by_contra hns simp only [Small, not_le, Nat.lt_one_iff, hc.k_pos.ne'] at hns -lemma infinite_setOf_apply_eq_one : {i | a i = 1}.Infinite := - (hc.infinite_setOf_apply_eq_iff_small (by decide)).mpr hc.small_one +lemma infinite_setOfPred_apply_eq_one : {i | a i = 1}.Infinite := + (hc.infinite_setOfPred_apply_eq_iff_small (by decide)).mpr hc.small_one + +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_apply_eq_one := infinite_setOfPred_apply_eq_one variable (a) @@ -362,7 +401,7 @@ def Big (j : ℕ) : Prop := l a < j variable {a} lemma k_le_l : k a ≤ l a := - le_csSup hc.bddAbove_setOf_k_lt_card (fun hf ↦ absurd hf hc.infinite_setOf_apply_eq_k) + le_csSup hc.bddAbove_setOfPred_k_lt_card (fun hf ↦ absurd hf hc.infinite_setOfPred_apply_eq_k) lemma k_lt_of_big {j : ℕ} (h : Big a j) : k a < j := hc.k_le_l.trans_lt h @@ -375,10 +414,10 @@ lemma not_small_of_big {j : ℕ} (h : Big a j) : ¬Small a j := by simp [Small, lemma exists_card_le_of_big {j : ℕ} (h : Big a j) : ∃ hf : {i | a i = j}.Finite, #hf.toFinset ≤ k a := by have hns := hc.not_small_of_big h - rw [← hc.finite_setOf_apply_eq_iff_not_small (hc.pos_of_big h)] at hns + rw [← hc.finite_setOfPred_apply_eq_iff_not_small (hc.pos_of_big h)] at hns use hns by_contra! hlt - exact notMem_of_csSup_lt h hc.bddAbove_setOf_k_lt_card fun _ ↦ hlt + exact notMem_of_csSup_lt h hc.bddAbove_setOfPred_k_lt_card fun _ ↦ hlt variable (a N) @@ -401,7 +440,7 @@ lemma not_medium_of_N'aux_lt {j : ℕ} (h : N'aux a N < j) : ¬Medium a (a j) := have hf : s.Finite := by refine (Set.finite_Ioc _ _).biUnion ?_ rintro i ⟨hk, -⟩ - rwa [hc.finite_setOf_apply_eq_iff_not_small (by lia), Small, not_le] + rwa [hc.finite_setOfPred_apply_eq_iff_not_small (by lia), Small, not_le] exact fun hm ↦ notMem_of_csSup_lt (le_sup_left.trans_lt h) (hf.subset fun i hi ↦ (by simpa [s] using! hi)).bddAbove hm @@ -429,18 +468,20 @@ lemma nth_sup_k_le_N'aux_of_small {j : ℕ} (h : Small a j) : Nat.nth (a · = j) (k a) ≤ N'aux a N := match j with | 0 => by simp only [hc.nth_apply_eq_zero, zero_le] - | j + 1 => ((Nat.nth_le_nth ((hc.infinite_setOf_apply_eq_iff_small (Nat.zero_lt_succ j)).mpr h)).2 + | j + 1 => ((Nat.nth_le_nth + ((hc.infinite_setOfPred_apply_eq_iff_small (Nat.zero_lt_succ j)).mpr h)).2 le_sup_left).trans (nth_sup_k_N_add_one_le_N'aux_of_small h) lemma nth_sup_N_add_one_le_N'aux_of_small {j : ℕ} (h : Small a j) : Nat.nth (a · = j) (N + 1) ≤ N'aux a N := match j with | 0 => by simp only [hc.nth_apply_eq_zero, zero_le] - | j + 1 => ((Nat.nth_le_nth ((hc.infinite_setOf_apply_eq_iff_small (Nat.zero_lt_succ j)).mpr h)).2 + | j + 1 => ((Nat.nth_le_nth + ((hc.infinite_setOfPred_apply_eq_iff_small (Nat.zero_lt_succ j)).mpr h)).2 le_sup_right).trans (nth_sup_k_N_add_one_le_N'aux_of_small h) lemma N_lt_N'aux : N < N'aux a N := - Nat.add_one_le_iff.mp ((Nat.le_nth fun hf ↦ absurd hf hc.infinite_setOf_apply_eq_one).trans + Nat.add_one_le_iff.mp ((Nat.le_nth fun hf ↦ absurd hf hc.infinite_setOfPred_apply_eq_one).trans (hc.nth_sup_N_add_one_le_N'aux_of_small hc.small_one)) /-- `N` is less than `N'`. -/ @@ -448,7 +489,7 @@ lemma N_lt_N' : N < N' a N := hc.N_lt_N'aux.trans_le (Nat.le_add_right _ _) lemma lt_card_filter_eq_of_small_nth_lt {i j t : ℕ} (hj0 : 0 < j) (h : Small a j) (ht : Nat.nth (a · = j) t < i) : t < #{m ∈ Finset.range i | a m = j} := by - rw [← hc.infinite_setOf_apply_eq_iff_small hj0] at h + rw [← hc.infinite_setOfPred_apply_eq_iff_small hj0] at h rw [← Nat.count_eq_card_filter_range] exact (Nat.nth_lt_nth h).mp (ht.trans_le (Nat.le_nth_count h _)) @@ -554,7 +595,7 @@ lemma N_add_one_lt_apply_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' by_contra exact hc.not_small_of_big ((by lia : i = N' a N) ▸ h) hc.small_apply_N' -lemma setOf_apply_eq_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' : N' a N ≤ i) : +lemma setOfPred_apply_eq_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' : N' a N ≤ i) : {j | a j = a i} = {j | N < j ∧ Small a (a (j - 1)) ∧ a i = #{t ∈ Finset.range j | a t = a (j - 1)}} := by have hs : {j | N < j ∧ Small a (a (j - 1)) ∧ a i = #{t ∈ Finset.range j | a t = a (j - 1)}} ⊆ @@ -572,11 +613,11 @@ lemma setOf_apply_eq_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' : N' · simp only [Nat.card_Icc, add_tsub_cancel_right] · simp only [add_left_inj] at htu simp only [Finset.coe_Icc, Set.mem_Icc] at ht hu - rw [← Small, ← hc.infinite_setOf_apply_eq_iff_small (by lia)] at ht hu + rw [← Small, ← hc.infinite_setOfPred_apply_eq_iff_small (by lia)] at ht hu apply_fun a at htu rwa [Nat.nth_mem_of_infinite ht.2, Nat.nth_mem_of_infinite hu.2] at htu refine hs ▸ Finset.card_le_card (Finset.subset_iff.2 fun j hj ↦ ?_) - simp only [Set.Finite.mem_toFinset, Set.mem_setOf_eq] + simp only [Set.Finite.mem_toFinset, Set.mem_ofPred_eq] simp only [Finset.mem_image, Finset.mem_Icc] at hj rcases hj with ⟨t, ⟨ht1, htk⟩, rfl⟩ have hN1 : N < a i - 1 := by @@ -585,7 +626,7 @@ lemma setOf_apply_eq_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' : N' simp only [add_tsub_cancel_right] rw [← Small] at htk have htki := htk - rw [← hc.infinite_setOf_apply_eq_iff_small (by lia)] at htki + rw [← hc.infinite_setOfPred_apply_eq_iff_small (by lia)] at htki rw [Nat.nth_mem_of_infinite htki] simp only [htk, true_and] refine ⟨Nat.lt_add_one_iff.mpr ((Nat.le_nth (fun hf ↦ absurd hf htki)).trans @@ -593,15 +634,18 @@ lemma setOf_apply_eq_of_apply_big_of_N'_le {i : ℕ} (h : Big a (a i)) (hN' : N' rw [← Nat.count_eq_card_filter_range, Nat.count_nth_succ_of_infinite htki] lia +@[deprecated (since := "2026-07-09")] +alias setOf_apply_eq_of_apply_big_of_N'_le := setOfPred_apply_eq_of_apply_big_of_N'_le + lemma N_lt_of_apply_eq_of_apply_big_of_N'_le {i j : ℕ} (hj : a j = a i) (h : Big a (a i)) (hN' : N' a N ≤ i) : N < j := have hj' : j ∈ {t | a t = a i} := by simpa using hj - (hc.setOf_apply_eq_of_apply_big_of_N'_le h hN' ▸ hj').1 + (hc.setOfPred_apply_eq_of_apply_big_of_N'_le h hN' ▸ hj').1 lemma small_apply_sub_one_of_apply_eq_of_apply_big_of_N'_le {i j : ℕ} (hj : a j = a i) (h : Big a (a i)) (hN' : N' a N ≤ i) : Small a (a (j - 1)) := have hj' : j ∈ {t | a t = a i} := by simpa using hj - (hc.setOf_apply_eq_of_apply_big_of_N'_le h hN' ▸ hj').2.1 + (hc.setOfPred_apply_eq_of_apply_big_of_N'_le h hN' ▸ hj').2.1 /-! ### The main lemmas leading to the required result -/ @@ -628,7 +672,7 @@ lemma apply_add_one_eq_card_small_le_card_eq {i : ℕ} (hi : N' a N < i) (hib : have ht0 : 0 < t := by by_contra! h0 simp [nonpos_iff_eq_zero.mp h0, hc.apply_ne_zero] at htr - rw [← hc.infinite_setOf_apply_eq_iff_small ht0] at hts + rw [← hc.infinite_setOfPred_apply_eq_iff_small ht0] at hts rw [← Nat.count_eq_card_filter_range] at htr constructor · rwa [add_lt_add_iff_right, ← Nat.lt_nth_iff_count_lt hts, @@ -639,7 +683,7 @@ lemma apply_add_one_eq_card_small_le_card_eq {i : ℕ} (hi : N' a N < i) (hib : have := hc.N_add_one_lt_apply_of_apply_big_of_N'_le hib hi.le lia · intro t ht u hu htu - simp only [Finset.coe_filter, Finset.mem_range, Set.mem_setOf_eq, Nat.lt_add_one_iff] at ht hu + simp only [Finset.coe_filter, Finset.mem_range, Set.mem_ofPred_eq, Nat.lt_add_one_iff] at ht hu rw [← Small] at ht hu have ht0 : 0 < t := by by_contra! h0 @@ -649,8 +693,8 @@ lemma apply_add_one_eq_card_small_le_card_eq {i : ℕ} (hi : N' a N < i) (hib : by_contra! h0 simp only [nonpos_iff_eq_zero] at h0 simp [h0, hc.apply_ne_zero] at hu - rw [← hc.infinite_setOf_apply_eq_iff_small ht0] at ht - rw [← hc.infinite_setOf_apply_eq_iff_small hu0] at hu + rw [← hc.infinite_setOfPred_apply_eq_iff_small ht0] at ht + rw [← hc.infinite_setOfPred_apply_eq_iff_small hu0] at hu simp only [add_left_inj] at htu apply_fun a at htu rwa [Nat.nth_mem_of_infinite ht.1, Nat.nth_mem_of_infinite hu.1] at htu @@ -800,10 +844,10 @@ noncomputable def p (n : ℕ) : ℕ := sInf (pSet a n) variable {a} lemma nonempty_pSet (n : ℕ) : (pSet a n).Nonempty := by - rcases hc.infinite_setOf_apply_eq_one.exists_gt n with ⟨i, hi1, hni⟩ - rcases hc.infinite_setOf_apply_eq_one.exists_gt i with ⟨j, hj1, hij⟩ + rcases hc.infinite_setOfPred_apply_eq_one.exists_gt n with ⟨i, hi1, hni⟩ + rcases hc.infinite_setOfPred_apply_eq_one.exists_gt i with ⟨j, hj1, hij⟩ refine ⟨j - n, ?_⟩ - simp only [pSet, Finset.mem_Ico, Set.mem_setOf_eq] + simp only [pSet, Finset.mem_Ico, Set.mem_ofPred_eq] exact ⟨i, ⟨hni.le, by lia⟩, hi1 ▸ ⟨hc.small_one, hj1 ▸ (by congr; lia)⟩⟩ lemma exists_mem_Ico_small_and_apply_add_p_eq (n : ℕ) : @@ -818,7 +862,7 @@ lemma p_pos (n : ℕ) : 0 < p a n := by lemma card_filter_apply_eq_Ico_add_p_le_one (n : ℕ) {j : ℕ} (hjs : Small a j) : #{i ∈ Finset.Ico n (n + p a n) | a i = j} ≤ 1 := by have h : IsLeast (pSet a n) (p a n) := isLeast_csInf (hc.nonempty_pSet n) - simp only [IsLeast, pSet, Set.mem_setOf_eq, mem_lowerBounds, forall_exists_index, and_imp, + simp only [IsLeast, pSet, Set.mem_ofPred_eq, mem_lowerBounds, forall_exists_index, and_imp, Finset.mem_Ico] at h rw [Finset.card_le_one_iff] intro x y hx hy diff --git a/Archive/Imo/Imo2024Q5.lean b/Archive/Imo/Imo2024Q5.lean index ebdb10c91fe044..9cb6e3c8182637 100644 --- a/Archive/Imo/Imo2024Q5.lean +++ b/Archive/Imo/Imo2024Q5.lean @@ -1034,7 +1034,7 @@ def answer : ℕ := 3 /-- The final result, combining upper and lower bounds. -/ theorem result : IsLeast {k | ∃ s : Strategy 2022, s.ForcesWinIn k} answer := by - simp_rw [IsLeast, mem_lowerBounds, Set.mem_setOf, forall_exists_index] + simp_rw [IsLeast, mem_lowerBounds, Set.mem_ofPred, forall_exists_index] exact ⟨⟨winningStrategy (by simp), winningStrategy_forcesWinIn_three (by simp)⟩, fun k s h ↦ h.three_le (by simp)⟩ diff --git a/Archive/Sensitivity.lean b/Archive/Sensitivity.lean index e16a8c042c5fba..eb25ea5ddec42f 100644 --- a/Archive/Sensitivity.lean +++ b/Archive/Sensitivity.lean @@ -140,7 +140,7 @@ theorem adj_iff_proj_adj {p q : Q n.succ} (h₀ : p 0 = q 0) : @[symm] theorem adjacent.symm {p q : Q n} : q ∈ p.adjacent ↔ p ∈ q.adjacent := by - simp only [adjacent, ne_comm, Set.mem_setOf_eq] + simp only [adjacent, ne_comm, Set.mem_ofPred_eq] end Q diff --git a/Archive/Wiedijk100Theorems/AreaOfACircle.lean b/Archive/Wiedijk100Theorems/AreaOfACircle.lean index 71aaa05c5d0099..d41ec82f69a97d 100644 --- a/Archive/Wiedijk100Theorems/AreaOfACircle.lean +++ b/Archive/Wiedijk100Theorems/AreaOfACircle.lean @@ -65,7 +65,7 @@ theorem disc_eq_regionBetween : regionBetween (fun x => -sqrt (r ^ 2 - x ^ 2)) (fun x => sqrt (r ^ 2 - x ^ 2)) (Ioc (-r) r) := by ext p - simp only [disc, regionBetween, mem_setOf_eq, mem_Ioo, mem_Ioc] + simp only [disc, regionBetween, mem_ofPred_eq, mem_Ioo, mem_Ioc] constructor <;> intro h · cases abs_lt_of_sq_lt_sq' (lt_of_add_lt_of_nonneg_left h (sq_nonneg p.2)) r.2 with | intro left right => diff --git a/Archive/Wiedijk100Theorems/BallotProblem.lean b/Archive/Wiedijk100Theorems/BallotProblem.lean index b7fb68ef7f0ef7..0472be7c1a72b1 100644 --- a/Archive/Wiedijk100Theorems/BallotProblem.lean +++ b/Archive/Wiedijk100Theorems/BallotProblem.lean @@ -74,7 +74,7 @@ open scoped List in theorem mem_countedSequence_iff_perm {p q l} : l ∈ countedSequence p q ↔ l ~ List.replicate p (1 : ℤ) ++ List.replicate q (-1) := by rw [List.perm_replicate_append_replicate] - · simp only [countedSequence, List.subset_def, mem_setOf_eq, List.mem_cons (b := (1 : ℤ)), + · simp only [countedSequence, List.subset_def, mem_ofPred_eq, List.mem_cons (b := (1 : ℤ)), List.mem_singleton] · norm_num1 @@ -200,7 +200,7 @@ theorem first_vote_pos : ((countedSequence_nonempty _ _).image _)] · have : List.cons (-1) '' countedSequence (p + 1) q ∩ {l : List ℤ | l.headI = 1} = ∅ := by ext - simp only [mem_inter_iff, mem_image, mem_setOf_eq, mem_empty_iff_false, iff_false, + simp only [mem_inter_iff, mem_image, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and, forall_exists_index, and_imp] rintro l _ rfl norm_num @@ -255,7 +255,7 @@ theorem countedSequence_int_pos_counted_succ_succ (p q : ℕ) : rw [counted_succ_succ, union_inter_distrib_right, (_ : List.cons (-1) '' countedSequence (p + 1) q ∩ {l | l.headI = 1} = ∅), union_empty] <;> · ext - simp only [mem_inter_iff, mem_image, mem_setOf_eq, and_iff_left_iff_imp, mem_empty_iff_false, + simp only [mem_inter_iff, mem_image, mem_ofPred_eq, and_iff_left_iff_imp, mem_empty_iff_false, iff_false, not_and, forall_exists_index, and_imp] rintro y _ rfl norm_num diff --git a/Archive/Wiedijk100Theorems/BirthdayProblem.lean b/Archive/Wiedijk100Theorems/BirthdayProblem.lean index 6e8939c320feb3..9f99a4e0b14264 100644 --- a/Archive/Wiedijk100Theorems/BirthdayProblem.lean +++ b/Archive/Wiedijk100Theorems/BirthdayProblem.lean @@ -50,7 +50,7 @@ theorem birthday_measure : trans ‖Fin 23 ↪ Fin 365‖ · rw [← Fintype.card_coe] apply Fintype.card_congr - rw [Set.Finite.coeSort_toFinset, Set.coe_setOf] + rw [Set.Finite.coeSort_toFinset, Set.coe_ofPred] exact Equiv.subtypeInjectiveEquivEmbedding _ _ · rw [Fintype.card_embedding_eq, Fintype.card_fin, Fintype.card_fin] rfl diff --git a/Archive/Wiedijk100Theorems/CubingACube.lean b/Archive/Wiedijk100Theorems/CubingACube.lean index 647fcef5884878..5691b0c1d673fd 100644 --- a/Archive/Wiedijk100Theorems/CubingACube.lean +++ b/Archive/Wiedijk100Theorems/CubingACube.lean @@ -183,7 +183,7 @@ theorem shiftUp_bottom_subset_bottoms (hc : (cs i).xm ≠ 1) : (cs i).shiftUp.bottom ⊆ ⋃ i : ι, (cs i).bottom := by intro p hp; obtain ⟨hp0, hps⟩ := hp; rw [tail_shiftUp] at hps have : p ∈ (unitCube : Cube (n + 1)).toSet := by - simp only [toSet, forall_iff_succ, hp0, side_unitCube, mem_setOf_eq, mem_Ico, head_shiftUp] + simp only [toSet, forall_iff_succ, hp0, side_unitCube, mem_ofPred_eq, mem_Ico, head_shiftUp] refine ⟨⟨?_, ?_⟩, ?_⟩ · rw [← zero_add (0 : ℝ)]; apply add_le_add · apply zero_le_b h @@ -223,10 +223,10 @@ variable {c : Cube (n + 1)} (h : Correct cs) (v : Valley cs c) theorem valley_unitCube [Nontrivial ι] (h : Correct cs) : Valley cs unitCube := by refine ⟨?_, ?_, ?_⟩ · intro v - simp only [bottom, and_imp, mem_iUnion, mem_setOf_eq] + simp only [bottom, and_imp, mem_iUnion, mem_ofPred_eq] intro h0 hv have : v ∈ (unitCube : Cube (n + 1)).toSet := by - dsimp only [toSet, unitCube, mem_setOf_eq] + dsimp only [toSet, unitCube, mem_ofPred_eq] rw [forall_iff_succ, h0]; constructor · norm_num [side, unitCube] · exact hv @@ -410,7 +410,7 @@ theorem mi_not_onBoundary (j : Fin n) : ¬OnBoundary (mi_mem_bcubes : mi h v ∈ have i'_i'' : i' ≠ i'' := by rintro ⟨⟩ have : (cs i).b ∈ (cs i').toSet := by - simp only [toSet, forall_iff_succ, hi.1, bottom_mem_side h2i', true_and, mem_setOf_eq] + simp only [toSet, forall_iff_succ, hi.1, bottom_mem_side h2i', true_and, mem_ofPred_eq] intro j₂; by_cases hj₂ : j₂ = j · simpa [p', side_tail, hj'.symm, hj₂] using hi''.2 j · simpa [p, hj₂] using! hi'.2 j₂ @@ -457,7 +457,7 @@ theorem valley_mi : Valley cs (cs (mi h v)).shiftUp := by simp only [not_subset, tail_shiftUp] at h2i' rcases h2i' with ⟨p1, hp1, h2p1⟩ have : ∃ p3, p3 ∈ (cs i').tail.toSet ∧ p3 ∉ (cs i).tail.toSet ∧ p3 ∈ c.tail.toSet := by - simp only [toSet, not_forall, mem_setOf_eq] at h2p1; obtain ⟨j, hj⟩ := h2p1 + simp only [toSet, not_forall, mem_ofPred_eq] at h2p1; obtain ⟨j, hj⟩ := h2p1 rcases Ico_lemma (mi_not_onBoundary' j).1 (by simp [hw]) (mi_not_onBoundary' j).2 (le_trans (hp2 j).1 <| le_of_lt (h2p2 j).2) (le_trans (h2p2 j).1 <| le_of_lt (hp2 j).2) ⟨hj, hp1 j⟩ with @@ -466,7 +466,7 @@ theorem valley_mi : Valley cs (cs (mi h v)).shiftUp := by · intro j'; by_cases h : j' = j · simp only [if_pos h]; exact h ▸ h3w · simp only [if_neg h]; exact hp2 j' - · simp only [toSet, not_forall, mem_setOf_eq]; use j; rw [if_pos rfl]; convert! h2w + · simp only [toSet, not_forall, mem_ofPred_eq]; use j; rw [if_pos rfl]; convert! h2w · intro j'; by_cases h : j' = j · simp only [if_pos h, side_tail]; exact h ▸ hw · simp only [if_neg h]; apply hi.2; apply h2p2 @@ -484,7 +484,7 @@ theorem valley_mi : Valley cs (cs (mi h v)).shiftUp := by let p' := @cons n (fun _ => ℝ) (cs i).xm p3 have hp' : p' ∈ (cs i').toSet := by simpa [i, p', toSet, forall_iff_succ, hi'.symm] using! h1p3 have h2p' : p' ∈ (cs i'').toSet := by - simp only [p', toSet, forall_iff_succ, cons_succ, cons_zero, mem_setOf_eq] + simp only [p', toSet, forall_iff_succ, cons_succ, cons_zero, mem_ofPred_eq] refine ⟨?_, by simpa [toSet] using! hi''.2⟩ have : (cs i).b 0 = (cs i'').b 0 := by rw [hi.1, h2i''.1] simp [side, hw', xm, this, h3i''] diff --git a/Archive/Wiedijk100Theorems/Konigsberg.lean b/Archive/Wiedijk100Theorems/Konigsberg.lean index a7b598b01317c8..2eb24c3c4527e7 100644 --- a/Archive/Wiedijk100Theorems/Konigsberg.lean +++ b/Archive/Wiedijk100Theorems/Konigsberg.lean @@ -66,15 +66,17 @@ lemma degree_eq_degree (v : Verts) : graph.degree v = degree v := by cases v <;> lemma not_even_degree_iff (w : Verts) : ¬Even (degree w) ↔ w = V1 ∨ w = V2 ∨ w = V3 ∨ w = V4 := by cases w <;> decide -lemma setOf_odd_degree_eq : +lemma setOfPred_odd_degree_eq : {v | Odd (graph.degree v)} = {Verts.V1, Verts.V2, Verts.V3, Verts.V4} := by ext w simp [not_even_degree_iff, ← Nat.not_even_iff_odd] +@[deprecated (since := "2026-07-09")] alias setOf_odd_degree_eq := setOfPred_odd_degree_eq + /-- The Königsberg graph is not Eulerian. -/ theorem not_isEulerian {u v : Verts} (p : graph.Walk u v) (h : p.IsEulerian) : False := by have h := h.card_odd_degree - have h' := setOf_odd_degree_eq + have h' := setOfPred_odd_degree_eq apply_fun Fintype.card at h' rw [h'] at h simp at h diff --git a/Archive/ZagierTwoSquares.lean b/Archive/ZagierTwoSquares.lean index f3ca1d717a3649..fb11d460bbadd7 100644 --- a/Archive/ZagierTwoSquares.lean +++ b/Archive/ZagierTwoSquares.lean @@ -38,7 +38,7 @@ variable (k : ℕ) [hk : Fact (4 * k + 1).Prime] def zagierSet : Set (ℕ × ℕ × ℕ) := {t | t.1 * t.1 + 4 * t.2.1 * t.2.2 = 4 * k + 1} lemma zagierSet_lower_bound {x y z : ℕ} (h : (x, y, z) ∈ zagierSet k) : 0 < x ∧ 0 < y ∧ 0 < z := by - rw [zagierSet, mem_setOf_eq] at h + rw [zagierSet, mem_ofPred_eq] at h refine ⟨?_, ?_, ?_⟩ all_goals by_contra q @@ -57,7 +57,7 @@ lemma zagierSet_lower_bound {x y z : ℕ} (h : (x, y, z) ∈ zagierSet k) : 0 < lemma zagierSet_upper_bound {x y z : ℕ} (h : (x, y, z) ∈ zagierSet k) : x ≤ k + 1 ∧ y ≤ k ∧ z ≤ k := by obtain ⟨_, _, _⟩ := zagierSet_lower_bound k h - rw [zagierSet, mem_setOf_eq] at h + rw [zagierSet, mem_ofPred_eq] at h refine ⟨?_, ?_, ?_⟩ <;> nlinarith lemma zagierSet_subset : zagierSet k ⊆ Ioc 0 (k + 1) ×ˢ Ioc 0 k ×ˢ Ioc 0 k := by @@ -80,7 +80,7 @@ variable (k : ℕ) /-- The obvious involution `(x, y, z) ↦ (x, z, y)`. -/ def obvInvo : Function.End (zagierSet k) := fun ⟨⟨x, y, z⟩, h⟩ => ⟨⟨x, z, y⟩, by - simp only [zagierSet, Set.mem_setOf_eq] at h ⊢ + simp only [zagierSet, Set.mem_ofPred_eq] at h ⊢ linarith [h]⟩ theorem obvInvo_sq : obvInvo k ^ 2 = 1 := rfl @@ -93,7 +93,7 @@ theorem sq_add_sq_of_nonempty_fixedPoints (hn : (fixedPoints (obvInvo k)).Nonemp obtain ⟨⟨⟨x, y, z⟩, he⟩, hf⟩ := hn have := mem_fixedPoints_iff.mp hf simp only [obvInvo, Subtype.mk.injEq, Prod.mk.injEq, true_and] at this - simp only [zagierSet, Set.mem_setOf_eq] at he + simp only [zagierSet, Set.mem_ofPred_eq] at he use x, (2 * y) rw [show 2 * y * (2 * y) = 4 * y * y by linarith, ← he, this.1] @@ -103,7 +103,7 @@ def complexInvo : Function.End (zagierSet k) := fun ⟨⟨x, y, z⟩, h⟩ => ⟨if x + z < y then ⟨x + 2 * z, z, y - x - z⟩ else if 2 * y < x then ⟨x - 2 * y, x + z - y, y⟩ else ⟨2 * y - x, y, x + z - y⟩, by - split_ifs with less more <;> simp only [zagierSet, Set.mem_setOf_eq] at h ⊢ + split_ifs with less more <;> simp only [zagierSet, Set.mem_ofPred_eq] at h ⊢ · -- less: `x + z < y` (`x < y - z` as stated by Zagier) rw [Nat.sub_sub]; zify [less.le] at h ⊢; linarith [h] · -- more: `2 * y < x` @@ -152,7 +152,7 @@ theorem eq_of_mem_fixedPoints {t : zagierSet k} (mem : t ∈ fixedPoints (comple · -- more obtain ⟨_, _, _⟩ := mem; simp_all · -- middle (the one fixed point falls under this case) - simp only [zagierSet, Set.mem_setOf_eq] at h + simp only [zagierSet, Set.mem_ofPred_eq] at h replace mem := mem.1 rw [tsub_eq_iff_eq_add_of_le more, ← two_mul] at mem replace mem := (mul_left_cancel₀ two_ne_zero mem).symm @@ -167,7 +167,7 @@ theorem eq_of_mem_fixedPoints {t : zagierSet k} (mem : t ∈ fixedPoints (comple /-- The singleton containing `(1, 1, k)`. -/ def singletonFixedPoint : Finset (zagierSet k) := - {⟨(1, 1, k), (by simp only [zagierSet, Set.mem_setOf_eq]; linarith)⟩} + {⟨(1, 1, k), (by simp only [zagierSet, Set.mem_ofPred_eq]; linarith)⟩} /-- `complexInvo k` has exactly one fixed point. -/ theorem card_fixedPoints_eq_one : Fintype.card (fixedPoints (complexInvo k)) = 1 := by diff --git a/Counterexamples/AharoniKorman.lean b/Counterexamples/AharoniKorman.lean index ffc861009c76ce..8b32c36d227830 100644 --- a/Counterexamples/AharoniKorman.lean +++ b/Counterexamples/AharoniKorman.lean @@ -243,7 +243,7 @@ This corresponds to 5.8 (i) in the [hollom2025]. -/ lemma ordConnected_level {n : ℕ} : (level n).OrdConnected := by rw [Set.ordConnected_iff] - simp only [level_eq, Set.mem_setOf_eq, Set.subset_def, Set.mem_Icc, and_imp, Hollom.forall, + simp only [level_eq, Set.mem_ofPred_eq, Set.subset_def, Set.mem_Icc, and_imp, Hollom.forall, Prod.forall, forall_eq, toHollom_le_toHollom_iff_fixed_right] intro a b c d ac bd e f g h1 h2 exact le_antisymm (le_of_toHollom_le_toHollom h1) (le_of_toHollom_le_toHollom h2) @@ -415,7 +415,7 @@ theorem exists_finite_intersection (hC : IsChain (· ≤ ·) C) : -- In fact, we only need it to be nonempty, and find a point. obtain ⟨x, hxy⟩ := this.nonempty induction hxy.1.2 using induction_on_level with | h x y => - simp only [Set.mem_sdiff, Set.mem_inter_iff, toHollom_mem_level_iff, and_true, Set.mem_setOf_eq, + simp only [Set.mem_sdiff, Set.mem_inter_iff, toHollom_mem_level_iff, and_true, Set.mem_ofPred_eq, not_le, D] at hxy -- Take the point `(x, y, n + 1)` in `C` that avoids `D`. As `(u, v, n)` is also in the chain `C`, -- they must be comparable. @@ -840,7 +840,7 @@ lemma square_subset_above (h : (C ∩ level n).Finite) : simp +contextual only [sup_le_iff, embed, RelEmbedding.coe_mk, Function.Embedding.coeFn_mk, Set.mem_inter_iff, and_imp, «forall», toHollom_mem_level_iff, Prod.forall, Set.subset_def, Set.mem_image, Set.mem_Ici, Prod.exists, Prod.mk_le_mk, - Set.mem_setOf_eq, forall_exists_index, Prod.mk.injEq, + Set.mem_ofPred_eq, forall_exists_index, Prod.mk.injEq, toHollom_le_toHollom_iff_fixed_right, Set.mem_sdiff, and_true, ← max_add_add_right, Hollom.ext_iff] -- After simplifying, direct calculations show the subset relation as required. @@ -956,7 +956,7 @@ lemma square_subset_S_case_1 (h : (C ∩ level n).Finite) (h' : (C ∩ level (n rw [eventually_atTop, level_eq] refine ⟨max b c, ?_⟩ simp only [sup_le_iff, embed, RelEmbedding.coe_mk, Function.Embedding.coeFn_mk, - Set.mem_inter_iff, Set.mem_setOf_eq, and_imp, «forall», Prod.forall, + Set.mem_inter_iff, Set.mem_ofPred_eq, and_imp, «forall», Prod.forall, Set.subset_def, Set.mem_image, Set.mem_Ici, Prod.exists, Prod.mk_le_mk, forall_exists_index, Prod.mk.injEq, Hollom.ext_iff] rintro d hbd hcd _ _ _ e f hde hdf rfl rfl rfl g h _ hgh rfl @@ -1027,18 +1027,18 @@ theorem not_S_hits_next (f : SpinalMap C) (hC : IsChain (· ≤ ·) C) cases (C ∩ level (n + 1)).finite_or_infinite -- In the case that `C ∩ level (n + 1)` is finite, this is immediate from the definition of `S`. case inl h => - rw [S, if_pos h, Set.mem_setOf_eq] at hx + rw [S, if_pos h, Set.mem_ofPred_eq] at hx intro hy refine f.incomp_apply ?_ (hx.2 _ hy).symm have := R_subset_level hx.1 - simp only [level_eq, Set.mem_setOf_eq] at this + simp only [level_eq, Set.mem_ofPred_eq] at this intro h simp [level_eq, h, this] at hy -- So suppose it is infinite case inr h => -- Write `(x, y, n)` for our given point, and set `(a, b, n + 1) := f(x, y, n)` induction S_subset_level hx using induction_on_level with | h x y => - simp only [S, if_neg h, Set.mem_setOf_eq] at hx + simp only [S, if_neg h, Set.mem_ofPred_eq] at hx intro hp set fp := f h(x, y, n) with hfp clear_value fp diff --git a/Counterexamples/Phillips.lean b/Counterexamples/Phillips.lean index 384d1931679214..9425a0aa805190 100644 --- a/Counterexamples/Phillips.lean +++ b/Counterexamples/Phillips.lean @@ -460,7 +460,7 @@ We need the continuum hypothesis to construct it. theorem sierpinski_pathological_family (Hcont : #ℝ = ℵ₁) : ∃ f : ℝ → Set ℝ, (∀ x, (univ \ f x).Countable) ∧ ∀ y, {x : ℝ | y ∈ f x}.Countable := by obtain ⟨r, hr₁, hr₂⟩ := Cardinal.exists_rel_mk_fibers_lt ℝ - refine ⟨fun x ↦ setOf (r x), ?_, ?_⟩ + refine ⟨fun x ↦ Set.ofPred (r x), ?_, ?_⟩ · simpa [Hcont, ← Set.compl_eq_univ_sdiff] using! hr₁ · simpa [Hcont] using hr₂ @@ -512,7 +512,7 @@ theorem countable_ne (Hcont : #ℝ = ℵ₁) (φ : (DiscreteCopy ℝ →ᵇ ℝ) {x | φ.toBoundedAdditiveMeasure.continuousPart univ ≠ φ (f Hcont x)} ⊆ {x | (φ.toBoundedAdditiveMeasure.discreteSupport ∩ spf Hcont x).Nonempty} := by intro x hx - simp only [mem_setOf] at * + simp only [mem_ofPred] at * contrapose! hx exact apply_f_eq_continuousPart Hcont φ x hx |>.symm have B : @@ -520,7 +520,7 @@ theorem countable_ne (Hcont : #ℝ = ℵ₁) (φ : (DiscreteCopy ℝ →ᵇ ℝ) ⋃ y ∈ φ.toBoundedAdditiveMeasure.discreteSupport, {x | y ∈ spf Hcont x} := by intro x hx dsimp at hx - simp only [exists_prop, mem_iUnion, mem_setOf_eq] + simp only [exists_prop, mem_iUnion, mem_ofPred_eq] exact hx apply Countable.mono (Subset.trans A B) exact Countable.biUnion (countable_discreteSupport _) fun a _ => countable_spf_mem Hcont a @@ -531,7 +531,7 @@ theorem comp_ae_eq_const (Hcont : #ℝ = ℵ₁) (φ : (DiscreteCopy ℝ →ᵇ apply ae_restrict_of_ae refine measure_mono_null ?_ ((countable_ne Hcont φ).measure_zero _) intro x - simp only [imp_self, mem_setOf_eq, mem_compl_iff] + simp only [imp_self, mem_ofPred_eq, mem_compl_iff] theorem integrable_comp (Hcont : #ℝ = ℵ₁) (φ : (DiscreteCopy ℝ →ᵇ ℝ) →L[ℝ] ℝ) : IntegrableOn (fun x => φ (f Hcont x)) (Icc 0 1) := by diff --git a/Counterexamples/SeparableNotSecondCountable.lean b/Counterexamples/SeparableNotSecondCountable.lean index 235aea89afe8b5..bdc8853b913742 100644 --- a/Counterexamples/SeparableNotSecondCountable.lean +++ b/Counterexamples/SeparableNotSecondCountable.lean @@ -45,7 +45,7 @@ theorem not_secondCountableTopology : ¬SecondCountableTopology (ℝ ×ₗ Bool) intro h have : {x : ℝ ×ₗ Bool | (ofLex x).2}.Countable := by simpa [Prod.Lex.covBy_iff, Bool.covBy_iff, exists_or, not_covBy, (Bool.le_true _).not_gt, - (Bool.false_le _).lt_iff_ne] using countable_setOf_covBy_left (α := ℝ ×ₗ Bool) + (Bool.false_le _).lt_iff_ne] using countable_setOfPred_covBy_left (α := ℝ ×ₗ Bool) refine not_countable_univ <| (this.image fun x ↦ (ofLex x).1).mono fun x _ ↦ ?_ exact ⟨toLex (x, true), rfl, rfl⟩ diff --git a/Counterexamples/SorgenfreyLine.lean b/Counterexamples/SorgenfreyLine.lean index 3aa441118c278a..6618e73e90a815 100644 --- a/Counterexamples/SorgenfreyLine.lean +++ b/Counterexamples/SorgenfreyLine.lean @@ -71,7 +71,7 @@ theorem nhds_basis_Ico (a : ℝₗ) : (𝓝 a).HasBasis (a < ·) (Ico a ·) := b have : (⨅ x : { i // i ≤ a }, 𝓟 (Ici ↑x)) = 𝓟 (Ici a) := by refine (IsLeast.isGLB ?_).iInf_eq exact ⟨⟨⟨a, le_rfl⟩, rfl⟩, forall_mem_range.2 fun b => principal_mono.2 <| Ici_subset_Ici.2 b.2⟩ - simp only [mem_setOf_eq, iInf_and, iInf_exists, @iInf_comm _ (_ ∈ _), @iInf_comm _ (Set ℝₗ), + simp only [mem_ofPred_eq, iInf_and, iInf_exists, @iInf_comm _ (_ ∈ _), @iInf_comm _ (Set ℝₗ), iInf_iInf_eq_right, mem_Ico] simp_rw [@iInf_comm _ ℝₗ (_ ≤ _), iInf_subtype', ← Ici_inter_Iio, ← inf_principal, ← inf_iInf, ← iInf_inf, this, iInf_subtype] @@ -281,7 +281,7 @@ theorem not_separatedNhds_rat_irrational_antidiag : have H : {x : ℝ | Irrational x} ⊆ ⋃ n, C n := fun x hx => mem_iUnion.2 ⟨_, subset_closure ⟨hx, rfl⟩⟩ have Hd : Dense (⋃ n, interior (C n)) := - IsGδ.setOf_irrational.dense_iUnion_interior_of_closed dense_irrational + IsGδ.setOfPred_irrational.dense_iUnion_interior_of_closed dense_irrational (fun _ => isClosed_closure) H obtain ⟨N, hN⟩ : ∃ n : ℕ+, (interior <| C n).Nonempty := nonempty_iUnion.mp Hd.nonempty /- Choose a rational number `r` in the interior of the closure of `C N`, then choose `n ≥ N > 0` diff --git a/Mathlib/Algebra/AffineMonoid/Irreducible.lean b/Mathlib/Algebra/AffineMonoid/Irreducible.lean index 25361838cedfaf..55f26ba739d5a5 100644 --- a/Mathlib/Algebra/AffineMonoid/Irreducible.lean +++ b/Mathlib/Algebra/AffineMonoid/Irreducible.lean @@ -83,7 +83,7 @@ lemma Submonoid.closure_irreducible [Monoid.FG M] : obtain rfl | hr₀ := eq_or_ne r 1 · simpa using hSmax (y := S \ {1}) (by simpa) Finset.sdiff_subset hrS -- Else find `a`, `b` non-units such that `a * b = r`. - simp only [irreducible_iff, Set.mem_setOf_eq, not_and, not_forall, not_or] at hrirred + simp only [irreducible_iff, Set.mem_ofPred_eq, not_and, not_forall, not_or] at hrirred obtain ⟨a, b, hr, ha, hb⟩ := hrirred <| by simpa -- Write `a = ∏ s ∈ S, s ^ m s`, `b = ∏ s ∈ S, s ^ n s` for some coefficients `m`, `n`. obtain ⟨m, -, hm⟩ := Submonoid.mem_closure_finset (x := a).mp (by rw [hSgen]; exact mem_top _) diff --git a/Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean b/Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean index 49483234759347..47b6fce6df8a09 100644 --- a/Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean +++ b/Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean @@ -507,12 +507,12 @@ abbrev rangeRestrict (f : F) : A →ₙₐ[R] (NonUnitalAlgHom.range f : NonUnit /-- The equalizer of two non-unital `R`-algebra homomorphisms -/ def equalizer (ϕ ψ : F) : NonUnitalSubalgebra R A where carrier := {a | (ϕ a : B) = ψ a} - zero_mem' := by rw [Set.mem_setOf_eq, map_zero, map_zero] + zero_mem' := by rw [Set.mem_ofPred_eq, map_zero, map_zero] add_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by - rw [Set.mem_setOf_eq, map_add, map_add, hx, hy] + rw [Set.mem_ofPred_eq, map_add, map_add, hx, hy] mul_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by - rw [Set.mem_setOf_eq, map_mul, map_mul, hx, hy] - smul_mem' r x (hx : ϕ x = ψ x) := by rw [Set.mem_setOf_eq, map_smul, map_smul, hx] + rw [Set.mem_ofPred_eq, map_mul, map_mul, hx, hy] + smul_mem' r x (hx : ϕ x = ψ x) := by rw [Set.mem_ofPred_eq, map_smul, map_smul, hx] @[simp] theorem mem_equalizer (φ ψ : F) (x : A) : diff --git a/Mathlib/Algebra/Algebra/Spectrum/Basic.lean b/Mathlib/Algebra/Algebra/Spectrum/Basic.lean index 4970815af4ca2f..218fdf28feb528 100644 --- a/Mathlib/Algebra/Algebra/Spectrum/Basic.lean +++ b/Mathlib/Algebra/Algebra/Spectrum/Basic.lean @@ -158,7 +158,7 @@ theorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemi @[simp] theorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by - simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true] + simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.ofPred_true] @[simp] theorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by @@ -252,11 +252,14 @@ theorem preimage_units_mul_comm (a b : A) : ((↑) : Rˣ → R) ⁻¹' σ (a * b) = (↑) ⁻¹' σ (b * a) := Set.ext fun _ => unit_mem_mul_comm -theorem setOf_isUnit_inter_mul_comm (a b : A) : +theorem setOfPred_isUnit_inter_mul_comm (a b : A) : {r | IsUnit r} ∩ σ (a * b) = {r | IsUnit r} ∩ σ (b * a) := by ext r simpa using fun hr : IsUnit r ↦ unit_mem_mul_comm (r := hr.unit) +@[deprecated (since := "2026-07-09")] +alias setOf_isUnit_inter_mul_comm := setOfPred_isUnit_inter_mul_comm + section Star variable [InvolutiveStar R] [StarRing A] [StarModule R A] diff --git a/Mathlib/Algebra/Algebra/Spectrum/Pi.lean b/Mathlib/Algebra/Algebra/Spectrum/Pi.lean index 1d02f55cde2992..cd62513370b76f 100644 --- a/Mathlib/Algebra/Algebra/Spectrum/Pi.lean +++ b/Mathlib/Algebra/Algebra/Spectrum/Pi.lean @@ -76,20 +76,20 @@ section spectrum lemma Pi.spectrum_eq [CommSemiring R] [∀ i, Ring (κ i)] [∀ i, Algebra R (κ i)] (a : ∀ i, κ i) : spectrum R a = ⋃ i, spectrum R (a i) := by apply compl_injective - simp_rw [spectrum, Set.compl_iUnion, compl_compl, resolventSet, Set.iInter_setOf, + simp_rw [spectrum, Set.compl_iUnion, compl_compl, resolventSet, Set.iInter_ofPred, Pi.isUnit_iff, sub_apply, algebraMap_apply] lemma Prod.spectrum_eq [CommSemiring R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] (a : A) (b : B) : spectrum R (⟨a, b⟩ : A × B) = spectrum R a ∪ spectrum R b := by apply compl_injective - simp_rw [spectrum, Set.compl_union, compl_compl, resolventSet, ← Set.setOf_and, + simp_rw [spectrum, Set.compl_union, compl_compl, resolventSet, ← Set.ofPred_and, Prod.isUnit_iff, algebraMap_apply, mk_sub_mk] lemma Pi.quasispectrum_eq [Nonempty ι] [CommSemiring R] [∀ i, NonUnitalRing (κ i)] [∀ i, Module R (κ i)] (a : ∀ i, κ i) : quasispectrum R a = ⋃ i, quasispectrum R (a i) := by ext r - simp only [quasispectrum, Set.mem_setOf_eq, Set.mem_iUnion] + simp only [quasispectrum, Set.mem_ofPred_eq, Set.mem_iUnion] by_cases hr : IsUnit r · lift r to Rˣ using hr with r' hr' simp [isQuasiregular_pi_iff] @@ -100,7 +100,8 @@ lemma Prod.quasispectrum_eq [CommSemiring R] [NonUnitalRing A] [NonUnitalRing B] quasispectrum R (⟨a, b⟩ : A × B) = quasispectrum R a ∪ quasispectrum R b := by apply compl_injective ext r - simp only [quasispectrum, Set.mem_compl_iff, Set.mem_setOf_eq, not_forall, not_not, Set.mem_union] + simp only [quasispectrum, Set.mem_compl_iff, Set.mem_ofPred_eq, not_forall, not_not, + Set.mem_union] by_cases hr : IsUnit r · lift r to Rˣ using hr with r' hr' simp [isQuasiregular_prod_iff] diff --git a/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean b/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean index 01711a7aa8dadb..3bfb56c388d95f 100644 --- a/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean +++ b/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean @@ -278,7 +278,7 @@ lemma NonUnitalAlgHom.quasispectrum_apply_subset' {F R : Type*} (S : Type*) {A B [FunLike F A B] [NonUnitalAlgHomClass F S A B] (φ : F) (a : A) : quasispectrum R (φ a) ⊆ quasispectrum R a := by refine Set.compl_subset_compl.mp fun x ↦ ?_ - simp only [quasispectrum, Set.mem_compl_iff, Set.mem_setOf_eq, not_forall, not_not, + simp only [quasispectrum, Set.mem_compl_iff, Set.mem_ofPred_eq, not_forall, not_not, forall_exists_index] refine fun hx this ↦ ⟨hx, ?_⟩ rw [Units.smul_def, ← smul_one_smul S] at this ⊢ @@ -303,7 +303,7 @@ lemma quasispectrum_eq_spectrum_union (R : Type*) {A : Type*} [CommSemiring R] [Ring A] [Algebra R A] (a : A) : quasispectrum R a = spectrum R a ∪ {r : R | ¬ IsUnit r} := by ext r rw [quasispectrum] - simp only [Set.mem_setOf_eq, Set.mem_union, ← imp_iff_or_not, spectrum.mem_iff] + simp only [Set.mem_ofPred_eq, Set.mem_union, ← imp_iff_or_not, spectrum.mem_iff] congr! 1 with hr rw [not_iff_not, isQuasiregular_iff_isUnit, ← sub_eq_add_neg, Algebra.algebraMap_eq_smul_one] exact (IsUnit.smul_sub_iff_sub_inv_smul hr.unit a).symm @@ -381,7 +381,7 @@ lemma quasispectrum.mul_comm {R A : Type*} [CommRing R] [NonUnitalRing A] [Modul ← Set.inter_union_compl (quasispectrum R (b * a)) {r | IsUnit r}] congr! 1 · simpa [Set.inter_comm _ {r | IsUnit r}, Unitization.quasispectrum_eq_spectrum_inr, - Unitization.inr_mul] using spectrum.setOf_isUnit_inter_mul_comm _ _ + Unitization.inr_mul] using spectrum.setOfPred_isUnit_inter_mul_comm _ _ · rw [Set.inter_eq_right.mpr, Set.inter_eq_right.mpr] all_goals exact fun _ ↦ quasispectrum.not_isUnit_mem _ diff --git a/Mathlib/Algebra/Algebra/Subalgebra/Basic.lean b/Mathlib/Algebra/Algebra/Subalgebra/Basic.lean index a34f06fcba9763..be7c6f12e77a4a 100644 --- a/Mathlib/Algebra/Algebra/Subalgebra/Basic.lean +++ b/Mathlib/Algebra/Algebra/Subalgebra/Basic.lean @@ -1019,14 +1019,14 @@ variable {R A B : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B @[simps coe toSubsemiring] def equalizer (ϕ ψ : A →ₐ[R] B) : Subalgebra R A where carrier := { a | ϕ a = ψ a } - zero_mem' := by simp only [Set.mem_setOf_eq, map_zero] - one_mem' := by simp only [Set.mem_setOf_eq, map_one] + zero_mem' := by simp only [Set.mem_ofPred_eq, map_zero] + one_mem' := by simp only [Set.mem_ofPred_eq, map_one] add_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by - rw [Set.mem_setOf_eq, map_add, map_add, hx, hy] + rw [Set.mem_ofPred_eq, map_add, map_add, hx, hy] mul_mem' {x y} (hx : ϕ x = ψ x) (hy : ϕ y = ψ y) := by - rw [Set.mem_setOf_eq, map_mul, map_mul, hx, hy] + rw [Set.mem_ofPred_eq, map_mul, map_mul, hx, hy] algebraMap_mem' x := by - simp only [Set.mem_setOf_eq, AlgHomClass.commutes] + simp only [Set.mem_ofPred_eq, AlgHomClass.commutes] @[simp] theorem mem_equalizer (φ ψ : A →ₐ[R] B) (x : A) : x ∈ equalizer φ ψ ↔ φ x = ψ x := diff --git a/Mathlib/Algebra/BigOperators/Associated.lean b/Mathlib/Algebra/BigOperators/Associated.lean index 897989824e09f6..cd86285018609d 100644 --- a/Mathlib/Algebra/BigOperators/Associated.lean +++ b/Mathlib/Algebra/BigOperators/Associated.lean @@ -95,9 +95,9 @@ theorem divisor_closure_eq_closure [CommMonoidWithZero M₀] [IsCancelMulZero M simp only [Multiset.prod_zero] at hprod left; exact .of_mul_eq_one _ hprod.symm | cons c s hind => - simp only [Multiset.mem_cons, forall_eq_or_imp, Set.mem_setOf] at hm + simp only [Multiset.mem_cons, forall_eq_or_imp, Set.mem_ofPred] at hm simp only [Multiset.prod_cons] at hprod - simp only [Set.mem_setOf_eq] at hind + simp only [Set.mem_ofPred_eq] at hind obtain ⟨ha₁ | ha₂, hs⟩ := hm · rcases ha₁.exists_right_inv with ⟨k, hk⟩ refine hind x (y * k) ?_ hs ?_ diff --git a/Mathlib/Algebra/Category/Ring/Topology.lean b/Mathlib/Algebra/Category/Ring/Topology.lean index 0091d90b2d3289..de7bcc590ee314 100644 --- a/Mathlib/Algebra/Category/Ring/Topology.lean +++ b/Mathlib/Algebra/Category/Ring/Topology.lean @@ -99,7 +99,7 @@ lemma isClosedEmbedding_precomp_of_surjective isClosed_iInter fun x ↦ (isClosed_singleton (x := 0)).preimage (continuous_apply (R := R) x.1) convert! this ext x - simp only [Set.mem_range, Set.mem_iInter, Set.mem_setOf_eq, Subtype.forall, RingHom.mem_ker] + simp only [Set.mem_range, Set.mem_iInter, Set.mem_ofPred_eq, Subtype.forall, RingHom.mem_ker] constructor · rintro ⟨g, rfl⟩ a ha; simp [ha] · exact fun H ↦ ⟨CommRingCat.ofHom (RingHom.liftOfSurjective f.hom hf ⟨x.hom, H⟩), diff --git a/Mathlib/Algebra/DirectSum/Module.lean b/Mathlib/Algebra/DirectSum/Module.lean index df9c5d5c16977c..f4de0512e6215c 100644 --- a/Mathlib/Algebra/DirectSum/Module.lean +++ b/Mathlib/Algebra/DirectSum/Module.lean @@ -140,7 +140,7 @@ theorem linearMap_ext ⦃ψ ψ' : (⨁ i, M i) →ₗ[R] N⦄ /-- The inclusion of a subset of the direct summands into a larger subset of the direct summands, as a linear map. -/ def lsetToSet (S T : Set ι) (H : S ⊆ T) : (⨁ i : S, M i) →ₗ[R] ⨁ i : T, M i := - toModule R _ _ fun i ↦ lof R T (fun i : Subtype T ↦ M i) ⟨i, H i.prop⟩ + toModule R _ _ fun i ↦ lof R T (fun i : T ↦ M i) ⟨i, H i.prop⟩ variable (ι M) diff --git a/Mathlib/Algebra/FiniteSupport/Basic.lean b/Mathlib/Algebra/FiniteSupport/Basic.lean index d4a8e2c5c0c6eb..9efd55fd9e1d9b 100644 --- a/Mathlib/Algebra/FiniteSupport/Basic.lean +++ b/Mathlib/Algebra/FiniteSupport/Basic.lean @@ -181,7 +181,7 @@ lemma HasFiniteMulSupport.fun_comp_of_injective (hg : Injective g) (hf : f.HasFi lemma HasFiniteMulSupport.of_comp [One β] (hfg : (f ∘ g).HasFiniteMulSupport) (h : f 1 = 1) (hf : Injective f) : g.HasFiniteMulSupport := by - refine Set.Finite.subset hfg fun _ ha ↦ Set.mem_setOf.mpr fun H ↦ Set.mem_setOf.mp ha ?_ + refine Set.Finite.subset hfg fun _ ha ↦ Set.mem_ofPred.mpr fun H ↦ Set.mem_ofPred.mp ha ?_ grind -- The additive version is a special case of `Function.HasFiniteSupport.smul_left`. diff --git a/Mathlib/Algebra/FreeAlgebra.lean b/Mathlib/Algebra/FreeAlgebra.lean index 6658040586f4be..03dd3132461f84 100644 --- a/Mathlib/Algebra/FreeAlgebra.lean +++ b/Mathlib/Algebra/FreeAlgebra.lean @@ -548,7 +548,7 @@ theorem induction {motive : FreeAlgebra R X → Prop} (a : FreeAlgebra R X) : motive a := by -- the arguments are enough to construct a subalgebra, and a mapping into it from X let s : Subalgebra R (FreeAlgebra R X) := - { carrier := motive + { carrier := {x | motive x} mul_mem' := mul _ _ add_mem' := add _ _ algebraMap_mem' := grade0 } diff --git a/Mathlib/Algebra/Group/Action/Equidecomp.lean b/Mathlib/Algebra/Group/Action/Equidecomp.lean index c84317733ea596..813965e5d2bc1c 100644 --- a/Mathlib/Algebra/Group/Action/Equidecomp.lean +++ b/Mathlib/Algebra/Group/Action/Equidecomp.lean @@ -163,7 +163,7 @@ open scoped Classical in theorem IsDecompOn.comp {g f : X → X} {B A : Set X} {T S : Finset G} (hg : IsDecompOn g B T) (hf : IsDecompOn f A S) (h : MapsTo f A B) : IsDecompOn (g ∘ f) A (T * S) := by - rw [left_eq_inter.mpr h] + rw [left_eq_inter.mpr h.subset_preimage] exact hg.comp' hf /-- The composition of two equidecompositions as an equidecomposition. -/ diff --git a/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean b/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean index f6768197835e42..26cfaff403653a 100644 --- a/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean +++ b/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean @@ -308,8 +308,14 @@ theorem iUnion_inv_smul : ⋃ g : α, g⁻¹ • s = ⋃ g : α, g • s := (Function.Surjective.iSup_congr _ inv_surjective) fun _ ↦ rfl @[to_additive] -theorem iUnion_smul_eq_setOf_exists {s : Set β} : ⋃ g : α, g • s = { a | ∃ g : α, g • a ∈ s } := by - simp_rw [← iUnion_setOf, ← iUnion_inv_smul, ← preimage_smul, preimage] +theorem iUnion_smul_eq_ofPred_exists {s : Set β} : ⋃ g : α, g • s = { a | ∃ g : α, g • a ∈ s } := by + simp_rw [← iUnion_ofPred, ← iUnion_inv_smul, ← preimage_smul, preimage] + +@[deprecated (since := "2026-07-09")] +alias iUnion_smul_eq_setOf_exists := iUnion_smul_eq_ofPred_exists + +@[deprecated (since := "2026-07-09")] +alias iUnion_vadd_eq_setOf_exists := iUnion_vadd_eq_ofPred_exists @[to_additive (attr := simp)] lemma inv_smul_set_distrib (a : α) (s : Set α) : (a • s)⁻¹ = op a⁻¹ • s⁻¹ := by diff --git a/Mathlib/Algebra/Group/Center.lean b/Mathlib/Algebra/Group/Center.lean index 4df0b272320399..e70bb00a9141c7 100644 --- a/Mathlib/Algebra/Group/Center.lean +++ b/Mathlib/Algebra/Group/Center.lean @@ -124,7 +124,7 @@ lemma center_subset_centralizer (S : Set M) : Set.center M ⊆ S.centralizer := @[to_additive addCentralizer_union] lemma centralizer_union : centralizer (S ∪ T) = centralizer S ∩ centralizer T := by - simp [centralizer, or_imp, forall_and, setOf_and] + simp [centralizer, or_imp, forall_and, ofPred_and] @[to_additive (attr := gcongr) addCentralizer_subset] lemma centralizer_subset (h : S ⊆ T) : centralizer T ⊆ centralizer S := fun _ ht s hs ↦ ht s (h hs) diff --git a/Mathlib/Algebra/Group/Irreducible/Indecomposable.lean b/Mathlib/Algebra/Group/Irreducible/Indecomposable.lean index 84d433be7f56d1..89b58595a41172 100644 --- a/Mathlib/Algebra/Group/Irreducible/Indecomposable.lean +++ b/Mathlib/Algebra/Group/Irreducible/Indecomposable.lean @@ -32,8 +32,7 @@ def IsMulIndecomposable (v : ι → M) (s : Set ι) (i : ι) : Prop := @[to_additive] protected lemma IsMulIndecomposable.subset (v : ι → M) (s : Set ι) : - {i | IsMulIndecomposable v s i} ⊆ s := by - aesop + {i | IsMulIndecomposable v s i} ⊆ s := fun _ hi ↦ hi.1 @[to_additive] lemma isMulIndecomposable_id_univ [Subsingleton Mˣ] {x : M} (hx : x ≠ 1) : diff --git a/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean b/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean index 28e4c96416321f..0b332db2cac4b2 100644 --- a/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean +++ b/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean @@ -159,9 +159,12 @@ section Inv variable {ι : Sort*} [Inv α] {s t : Set α} {a : α} @[to_additive (attr := simp)] -theorem inv_setOf (p : α → Prop) : {x | p x}⁻¹ = {x | p x⁻¹} := +theorem inv_ofPred (p : α → Prop) : {x | p x}⁻¹ = {x | p x⁻¹} := rfl +@[deprecated (since := "2026-07-09")] alias inv_setOf := inv_ofPred +@[deprecated (since := "2026-07-09")] alias neg_setOf := neg_ofPred + @[to_additive (attr := simp, push)] theorem mem_inv : a ∈ s⁻¹ ↔ a⁻¹ ∈ s := Iff.rfl diff --git a/Mathlib/Algebra/Group/Subgroup/Basic.lean b/Mathlib/Algebra/Group/Subgroup/Basic.lean index 812e977e3439de..83f90577882bd8 100644 --- a/Mathlib/Algebra/Group/Subgroup/Basic.lean +++ b/Mathlib/Algebra/Group/Subgroup/Basic.lean @@ -524,7 +524,7 @@ def conjugatesOfSet (s : Set G) : Set G := @[to_additive] theorem mem_conjugatesOfSet_iff {x : G} : x ∈ conjugatesOfSet s ↔ ∃ a ∈ s, IsConj a x := by rw [conjugatesOfSet, Set.mem_iUnion₂] - simp only [conjugatesOf, isConj_iff, Set.mem_setOf_eq, exists_prop] + simp only [conjugatesOf, isConj_iff, Set.mem_ofPred_eq, exists_prop] @[to_additive] theorem subset_conjugatesOfSet : s ⊆ conjugatesOfSet s := fun (x : G) (h : x ∈ s) => diff --git a/Mathlib/Algebra/Group/Subgroup/Lattice.lean b/Mathlib/Algebra/Group/Subgroup/Lattice.lean index 04aeb1ddde5112..c54ee4c21413df 100644 --- a/Mathlib/Algebra/Group/Subgroup/Lattice.lean +++ b/Mathlib/Algebra/Group/Subgroup/Lattice.lean @@ -555,7 +555,7 @@ theorem mem_iSup_of_directed {ι} [hι : Nonempty ι] {K : ι → Subgroup G} (h have : iSup K = ⨆ i : PLift ι, ⨆ (_ : True), K i.down := by simp [iSup_plift_down] rw [this, mem_biSup_of_directedOn trivial] · simp - · simp only [setOf_true] + · simp only [ofPred_true] rw [directedOn_onFun_iff, Set.image_univ, directedOn_range] -- `Directed.mono_comp` and much of the Set API requires `Type u` instead of `Sort u` intro i diff --git a/Mathlib/Algebra/Group/Subgroup/MulOppositeLemmas.lean b/Mathlib/Algebra/Group/Subgroup/MulOppositeLemmas.lean index 982d45461cfffc..78551c5eba913f 100644 --- a/Mathlib/Algebra/Group/Subgroup/MulOppositeLemmas.lean +++ b/Mathlib/Algebra/Group/Subgroup/MulOppositeLemmas.lean @@ -107,7 +107,7 @@ theorem unop_iInf (S : ι → Subgroup Gᵐᵒᵖ) : (iInf S).unop = ⨅ i, (S i @[to_additive] theorem op_closure (s : Set G) : (closure s).op = closure (MulOpposite.unop ⁻¹' s) := by - simp_rw [closure, op_sInf, Set.preimage_setOf_eq, Subgroup.coe_unop] + simp_rw [closure, op_sInf, Set.preimage_ofPred_eq, Subgroup.coe_unop] congr with a exact MulOpposite.unop_surjective.forall diff --git a/Mathlib/Algebra/Group/Submonoid/Basic.lean b/Mathlib/Algebra/Group/Submonoid/Basic.lean index e080248b0791ed..70af6fb8736879 100644 --- a/Mathlib/Algebra/Group/Submonoid/Basic.lean +++ b/Mathlib/Algebra/Group/Submonoid/Basic.lean @@ -346,18 +346,18 @@ section IsUnit /-- The submonoid consisting of the units of a monoid -/ @[to_additive /-- The additive submonoid consisting of the additive units of an additive monoid -/] def IsUnit.submonoid (M : Type*) [Monoid M] : Submonoid M where - carrier := setOf IsUnit - one_mem' := by simp only [isUnit_one, Set.mem_setOf_eq] + carrier := Set.ofPred IsUnit + one_mem' := by simp only [isUnit_one, Set.mem_ofPred_eq] mul_mem' := by intro a b ha hb - rw [Set.mem_setOf_eq] at * + rw [Set.mem_ofPred_eq] at * exact IsUnit.mul ha hb @[to_additive] theorem IsUnit.mem_submonoid_iff {M : Type*} [Monoid M] (a : M) : a ∈ IsUnit.submonoid M ↔ IsUnit a := by - change a ∈ setOf IsUnit ↔ IsUnit a - rw [Set.mem_setOf_eq] + change a ∈ Set.ofPred IsUnit ↔ IsUnit a + rw [Set.mem_ofPred_eq] end IsUnit diff --git a/Mathlib/Algebra/Group/Submonoid/Defs.lean b/Mathlib/Algebra/Group/Submonoid/Defs.lean index 5773ce82160051..5ea0a128ae4552 100644 --- a/Mathlib/Algebra/Group/Submonoid/Defs.lean +++ b/Mathlib/Algebra/Group/Submonoid/Defs.lean @@ -317,7 +317,7 @@ open Submonoid @[to_additive /-- The additive submonoid of elements `x : M` such that `f x = g x` -/] def eqLocusM (f g : M →* N) : Submonoid M where carrier := { x | f x = g x } - one_mem' := by rw [Set.mem_setOf_eq, f.map_one, g.map_one] + one_mem' := by rw [Set.mem_ofPred_eq, f.map_one, g.map_one] mul_mem' (hx : _ = _) (hy : _ = _) := by simp [*] @[to_additive (attr := simp)] diff --git a/Mathlib/Algebra/Group/Submonoid/MulOpposite.lean b/Mathlib/Algebra/Group/Submonoid/MulOpposite.lean index aaf2d55239f3e5..48715caa338ad4 100644 --- a/Mathlib/Algebra/Group/Submonoid/MulOpposite.lean +++ b/Mathlib/Algebra/Group/Submonoid/MulOpposite.lean @@ -170,7 +170,7 @@ theorem unop_iInf (S : ι → Submonoid Mᵐᵒᵖ) : (iInf S).unop = ⨅ i, (S @[to_additive] theorem op_closure (s : Set M) : (closure s).op = closure (MulOpposite.unop ⁻¹' s) := by - simp_rw [closure, op_sInf, Set.preimage_setOf_eq, Submonoid.coe_unop] + simp_rw [closure, op_sInf, Set.preimage_ofPred_eq, Submonoid.coe_unop] congr with a exact MulOpposite.unop_surjective.forall diff --git a/Mathlib/Algebra/Group/Subsemigroup/MulOpposite.lean b/Mathlib/Algebra/Group/Subsemigroup/MulOpposite.lean index e783682e5f5864..c477bf9df23ae7 100644 --- a/Mathlib/Algebra/Group/Subsemigroup/MulOpposite.lean +++ b/Mathlib/Algebra/Group/Subsemigroup/MulOpposite.lean @@ -160,7 +160,7 @@ theorem unop_iInf (S : ι → Subsemigroup Mᵐᵒᵖ) : (iInf S).unop = ⨅ i, @[to_additive] theorem op_closure (s : Set M) : (closure s).op = closure (MulOpposite.unop ⁻¹' s) := by - simp_rw [closure, op_sInf, Set.preimage_setOf_eq, Subsemigroup.coe_unop] + simp_rw [closure, op_sInf, Set.preimage_ofPred_eq, Subsemigroup.coe_unop] congr with a exact MulOpposite.unop_surjective.forall diff --git a/Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean b/Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean index 40dc44026944e1..fcf4884e62e710 100644 --- a/Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean +++ b/Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean @@ -55,7 +55,7 @@ lemma mem_nonZeroDivisorsLeft_iff : x ∈ nonZeroDivisorsLeft M₀ ↔ ∀ y, x lemma notMem_nonZeroDivisorsLeft_iff : x ∉ nonZeroDivisorsLeft M₀ ↔ {y | x * y = 0 ∧ y ≠ 0}.Nonempty := by - simpa [mem_nonZeroDivisorsLeft_iff] using! Set.nonempty_def.symm + simp [mem_nonZeroDivisorsLeft_iff, Set.Nonempty] /-- The collection of elements of a `MonoidWithZero` that are not right zero divisors form a `Submonoid`. -/ @@ -69,7 +69,7 @@ lemma mem_nonZeroDivisorsRight_iff : x ∈ nonZeroDivisorsRight M₀ ↔ ∀ y, lemma notMem_nonZeroDivisorsRight_iff : x ∉ nonZeroDivisorsRight M₀ ↔ {y | y * x = 0 ∧ y ≠ 0}.Nonempty := by - simpa [mem_nonZeroDivisorsRight_iff] using! Set.nonempty_def.symm + simp [mem_nonZeroDivisorsRight_iff, Set.Nonempty] lemma nonZeroDivisorsLeft_eq_right (M₀ : Type*) [CommMonoidWithZero M₀] : nonZeroDivisorsLeft M₀ = nonZeroDivisorsRight M₀ := by @@ -78,7 +78,7 @@ lemma nonZeroDivisorsLeft_eq_right (M₀ : Type*) [CommMonoidWithZero M₀] : @[simp] lemma coe_nonZeroDivisorsLeft_eq [NoZeroDivisors M₀] [Nontrivial M₀] : nonZeroDivisorsLeft M₀ = {x : M₀ | x ≠ 0} := by ext x - simp only [SetLike.mem_coe, mem_nonZeroDivisorsLeft_iff, mul_eq_zero, Set.mem_setOf_eq] + simp only [SetLike.mem_coe, mem_nonZeroDivisorsLeft_iff, mul_eq_zero, Set.mem_ofPred_eq] refine ⟨fun h ↦ ?_, fun hx y hx' ↦ by simp_all⟩ contrapose! h exact ⟨1, Or.inl h, one_ne_zero⟩ @@ -87,7 +87,7 @@ lemma nonZeroDivisorsLeft_eq_right (M₀ : Type*) [CommMonoidWithZero M₀] : nonZeroDivisorsRight M₀ = {x : M₀ | x ≠ 0} := by ext x simp only [SetLike.mem_coe, mem_nonZeroDivisorsRight_iff, mul_eq_zero, forall_eq_or_imp, true_and, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] refine ⟨fun h ↦ ?_, fun hx y hx' ↦ by contradiction⟩ contrapose! h exact ⟨1, h, one_ne_zero⟩ diff --git a/Mathlib/Algebra/Homology/EulerCharacteristic.lean b/Mathlib/Algebra/Homology/EulerCharacteristic.lean index 9c2852324d0a16..cd9ce7df400fa0 100644 --- a/Mathlib/Algebra/Homology/EulerCharacteristic.lean +++ b/Mathlib/Algebra/Homology/EulerCharacteristic.lean @@ -103,7 +103,7 @@ variable (c : ComplexShape ι) [c.EulerCharSigns] /-- The support of a graded object with respect to finite rank: the set of indices where the rank is nonzero. -/ -def finrankSupport (X : CategoryTheory.GradedObject ι (ModuleCat R)) : Set ι := +noncomputable def finrankSupport (X : CategoryTheory.GradedObject ι (ModuleCat R)) : Set ι := Function.support (fun i => Module.finrank R (X i)) /-- The finite rank support is contained in a set if and only if diff --git a/Mathlib/Algebra/Homology/HomotopyCategory/HomComplexCohomology.lean b/Mathlib/Algebra/Homology/HomotopyCategory/HomComplexCohomology.lean index d251133210dbbf..cbb931a446e364 100644 --- a/Mathlib/Algebra/Homology/HomotopyCategory/HomComplexCohomology.lean +++ b/Mathlib/Algebra/Homology/HomotopyCategory/HomComplexCohomology.lean @@ -43,7 +43,7 @@ namespace HomComplex /-- The subgroup of `Cocycle K L n` consisting of coboundaries. -/ def coboundaries : AddSubgroup (Cocycle K L n) where - carrier := setOf (fun α ↦ ∃ (m : ℤ) (hm : m + 1 = n) (β : Cochain K L m), δ m n β = α) + carrier := Set.ofPred (fun α ↦ ∃ (m : ℤ) (hm : m + 1 = n) (β : Cochain K L m), δ m n β = α) zero_mem' := ⟨n - 1, by simp, 0, by simp⟩ add_mem' := by rintro α₁ α₂ ⟨m, hm, β₁, hβ₁⟩ ⟨m', hm', β₂, hβ₂⟩ @@ -144,7 +144,7 @@ lemma toHom_mk_eq_zero_iff (x : Cocycle K L n) : toHom (mk x) = 0 ↔ x ∈ coboundaries K L n := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · simp only [coboundaries, exists_prop, AddSubgroup.mem_mk, AddSubmonoid.mem_mk, - AddSubsemigroup.mem_mk, Set.mem_setOf_eq] + AddSubsemigroup.mem_mk, Set.mem_ofPred_eq] rw [toHom_mk, HomotopyCategory.quotient_map_eq_zero_iff] at h obtain ⟨γ, h⟩ := Cochain.equivHomotopy _ _ h.some simp only [Cochain.ofHom_zero, add_zero, Cocycle.equivHomShift_symm_apply, diff --git a/Mathlib/Algebra/Homology/HomotopyCategory/KInjective.lean b/Mathlib/Algebra/Homology/HomotopyCategory/KInjective.lean index b6a656aa516bf1..5b0fefb066cba4 100644 --- a/Mathlib/Algebra/Homology/HomotopyCategory/KInjective.lean +++ b/Mathlib/Algebra/Homology/HomotopyCategory/KInjective.lean @@ -143,7 +143,7 @@ lemma isKInjective_of_injective (L : CochainComplex C ℤ) (d : ℤ) `isKInjective_of_injective_aux` in order to get better approximations, and we pass to the limit. -/ let X (n : ℕ) : Set (Cochain K L (-1)) := - setOf (fun α => (δ (-1) 0 α).EqUpTo (Cochain.ofHom f) (n + d - 1)) + Set.ofPred (fun α => (δ (-1) 0 α).EqUpTo (Cochain.ofHom f) (n + d - 1)) let x₀ : X 0 := ⟨0, fun p q hpq hp ↦ IsZero.eq_of_tgt (L.isZero_of_isStrictlyGE d _ (by lia)) _ _⟩ let φ (n : ℕ) (α : X n) : X (n + 1) := diff --git a/Mathlib/Algebra/Lie/Abelian.lean b/Mathlib/Algebra/Lie/Abelian.lean index b6282a5809a925..122250e6d154ad 100644 --- a/Mathlib/Algebra/Lie/Abelian.lean +++ b/Mathlib/Algebra/Lie/Abelian.lean @@ -352,7 +352,7 @@ theorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : ⁅I, N theorem LieSubmodule.lie_abelian_iff_lie_self_eq_bot : IsLieAbelian I ↔ ⁅I, I⁆ = ⊥ := by simp only [_root_.eq_bot_iff, lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le, - LieSubmodule.bot_coe, Set.subset_singleton_iff, Set.mem_setOf_eq, exists_imp] + LieSubmodule.bot_coe, Set.subset_singleton_iff, Set.mem_ofPred_eq, exists_imp] refine ⟨fun h z x y hz => hz.symm.trans diff --git a/Mathlib/Algebra/Lie/Basis.lean b/Mathlib/Algebra/Lie/Basis.lean index 2d0156503cd810..9327d6acd0b098 100644 --- a/Mathlib/Algebra/Lie/Basis.lean +++ b/Mathlib/Algebra/Lie/Basis.lean @@ -401,10 +401,10 @@ lemma iSupIndep_rootSpace : set sV : Set (b.cartan → R) := {f | ∃ n : ι → ℕ, n ≠ 0 ∧ f = ∑ i, n i • b.baseSupp i} with hsV have hs0' : rootSpace b.cartan 0 = ⨆ i ∈ s0, LieModule.genWeightSpace L i := by simp [hs0] have hsU' : U = ⨆ i ∈ sU, LieModule.genWeightSpace L i := by - simp only [hU, hsU, mem_setOf_eq, iSup_exists, iSup_and, iSup_comm (ι := b.cartan → R), + simp only [hU, hsU, mem_ofPred_eq, iSup_exists, iSup_and, iSup_comm (ι := b.cartan → R), iSup_iSup_eq_left, LinearMap.coe_sum, LinearMap.coe_smul] have hsV' : V = ⨆ i ∈ sV, LieModule.genWeightSpace L i := by - simp only [hV, hsV, mem_setOf_eq, iSup_exists, iSup_and, iSup_comm (ι := b.cartan → R), + simp only [hV, hsV, mem_ofPred_eq, iSup_exists, iSup_and, iSup_comm (ι := b.cartan → R), iSup_iSup_eq_left, LinearMap.coe_sum, LinearMap.coe_smul] have hU0 : Disjoint s0 sU := by suffices ∀ g ∈ sU, g ≠ 0 by @@ -528,7 +528,7 @@ lemma root_mem_or_mem_neg (χ : b.cartan.root) : (∃ n : ι → ℕ, n ≠ 0 ∧ χ.toLinear = ∑ i, n i • b.baseSupp i) := by have hχ' : ¬ χ.IsZero := by simpa using hχ simp only [hχ', s, singleton_union, mem_union, mem_insert_iff, Weight.coe_eq_zero_iff, - mem_setOf_eq, false_or] at hs + mem_ofPred_eq, false_or] at hs simpa only [← LinearMap.coe_neg, ← Weight.coe_coe, LinearMap.coe_injective.eq_iff] using hs refine hs.symm.imp (fun ⟨n, hn₀, hn⟩ ↦ ?_) (fun ⟨n, hn₀, hn⟩ ↦ ?_) <;> simpa [hn] using this n diff --git a/Mathlib/Algebra/Lie/Character.lean b/Mathlib/Algebra/Lie/Character.lean index b4882120742afb..230e525f145162 100644 --- a/Mathlib/Algebra/Lie/Character.lean +++ b/Mathlib/Algebra/Lie/Character.lean @@ -55,7 +55,7 @@ theorem lieCharacter_apply_of_mem_derived (χ : LieCharacter R L) {x : L} LieSubmodule.mem_toSubmodule, LieSubmodule.lieIdeal_oper_eq_linear_span] at h induction h using Submodule.span_induction with | mem y h => - simp only [Subtype.exists, LieSubmodule.mem_top, exists_const, Set.mem_setOf_eq] at h + simp only [Subtype.exists, LieSubmodule.mem_top, exists_const, Set.mem_ofPred_eq] at h obtain ⟨z, w, rfl⟩ := h exact lieCharacter_apply_lie .. | zero => exact map_zero _ diff --git a/Mathlib/Algebra/Lie/IdealOperations.lean b/Mathlib/Algebra/Lie/IdealOperations.lean index 830d6a71329130..8f886f7c646e8e 100644 --- a/Mathlib/Algebra/Lie/IdealOperations.lean +++ b/Mathlib/Algebra/Lie/IdealOperations.lean @@ -279,7 +279,7 @@ theorem comap_bracket_eq {J₁ J₂ : LieIdeal R L'} (h : f.IsIdealMorphism) : congr ext simp_all only [Subtype.exists, LieSubmodule.mem_inf, LieHom.mem_idealRange_iff, exists_prop, - Set.mem_setOf_eq, LieHom.coe_toLinearMap, mem_comap, + Set.mem_ofPred_eq, LieHom.coe_toLinearMap, mem_comap, exists_exists_and_exists_and_eq_and, LieHom.map_lie] grind diff --git a/Mathlib/Algebra/Lie/InvariantForm.lean b/Mathlib/Algebra/Lie/InvariantForm.lean index 18f81272293a12..d1c5831cd59868 100644 --- a/Mathlib/Algebra/Lie/InvariantForm.lean +++ b/Mathlib/Algebra/Lie/InvariantForm.lean @@ -172,7 +172,7 @@ lemma atomistic : ∀ I : LieIdeal K L, sSup {J : LieIdeal K L | IsAtom J ∧ J · exact le_sSup ⟨hJ, hJI⟩ rw [← atomistic (J' ⊓ I)] apply sSup_le_sSup - simp only [le_inf_iff, Set.setOf_subset_setOf, and_imp] + simp only [le_inf_iff, Set.ofPred_subset_ofPred, and_imp] tauto suffices J ⊔ J' = ⊤ by rw [← sup_inf_assoc_of_le _ hJI, this, top_inf_eq] exact (orthogonal_isCompl Φ hΦ_nondeg hΦ_inv hΦ_refl hL J hJ).codisjoint.eq_top @@ -198,11 +198,11 @@ theorem isSemisimple_of_nondegenerate : IsSemisimple K L := by intro I hI apply (orthogonal_disjoint Φ hΦ_nondeg hΦ_inv hL I hI).mono_right apply sSup_le - simp only [Set.mem_sdiff, Set.mem_setOf_eq, Set.mem_singleton_iff, and_imp] + simp only [Set.mem_sdiff, Set.mem_ofPred_eq, Set.mem_singleton_iff, and_imp] intro J hJ hJI rw [← lie_eq_self_of_isAtom_of_nonabelian J hJ (hL J hJ), lieIdeal_oper_eq_span, lieSpan_le] rintro _ ⟨x, y, rfl⟩ - simp only [orthogonal_carrier, Set.mem_setOf_eq] + simp only [orthogonal_carrier, Set.mem_ofPred_eq] intro z hz rw [← neg_eq_zero, ← hΦ_inv] suffices ⁅(x : L), z⁆ = 0 by simp only [this, map_zero, LinearMap.zero_apply] diff --git a/Mathlib/Algebra/Lie/LieTheorem.lean b/Mathlib/Algebra/Lie/LieTheorem.lean index 99cfd0cfdef20b..3df495cd073ba1 100644 --- a/Mathlib/Algebra/Lie/LieTheorem.lean +++ b/Mathlib/Algebra/Lie/LieTheorem.lean @@ -70,7 +70,7 @@ private lemma weightSpaceOfIsLieTower_aux (z : L) (v : V) (hv : v ∈ weightSpac have T_apply_succ (w : A) (n : ℕ) : Submodule.map (T χ w) (U' (n + 1)) ≤ U' n := by simp only [OrderHom.coe_mk, U', Submodule.map_span, Submodule.span_le, Set.image_subset_iff] - simp only [Set.subset_def, Set.mem_setOf_eq, Set.mem_preimage, SetLike.mem_coe, + simp only [Set.subset_def, Set.mem_ofPred_eq, Set.mem_preimage, SetLike.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] induction n generalizing w · simp only [zero_add, Nat.lt_one_iff, LinearMap.sub_apply, LieModule.toEnd_apply_apply, diff --git a/Mathlib/Algebra/Lie/Nilpotent.lean b/Mathlib/Algebra/Lie/Nilpotent.lean index 6057a30d645de4..60654f257ddb20 100644 --- a/Mathlib/Algebra/Lie/Nilpotent.lean +++ b/Mathlib/Algebra/Lie/Nilpotent.lean @@ -195,7 +195,7 @@ theorem trivial_iff_lower_central_eq_bot : IsTrivial L M ↔ lowerCentralSeries · simp · rw [LieSubmodule.eq_bot_iff] at h; apply IsTrivial.mk; intro x m; apply h apply LieSubmodule.subset_lieSpan - simp only [Subtype.exists, LieSubmodule.mem_top, exists_prop, true_and, Set.mem_setOf] + simp only [Subtype.exists, LieSubmodule.mem_top, exists_prop, true_and, Set.mem_ofPred] exact ⟨x, m, rfl⟩ section diff --git a/Mathlib/Algebra/Lie/Semisimple/Basic.lean b/Mathlib/Algebra/Lie/Semisimple/Basic.lean index e84e6d1937976e..85a7ece2121e54 100644 --- a/Mathlib/Algebra/Lie/Semisimple/Basic.lean +++ b/Mathlib/Algebra/Lie/Semisimple/Basic.lean @@ -139,7 +139,7 @@ lemma isSimple_of_isAtom (I : LieIdeal R L) (hI : IsAtom I) : IsSimple R I where rw [← sSup_union, Set.union_sdiff_self, Set.union_eq_self_of_subset_left, IsSemisimple.sSup_atoms_eq_top] · apply LieSubmodule.mem_top - · simp only [Set.singleton_subset_iff, Set.mem_setOf_eq, hI] + · simp only [Set.singleton_subset_iff, Set.mem_ofPred_eq, hI] -- Hence we can write `x` as `a + b` with `a ∈ I` -- and `b` in the supremum of the atoms not equal to `I`. rw [LieSubmodule.mem_sup] at hx diff --git a/Mathlib/Algebra/Lie/Solvable.lean b/Mathlib/Algebra/Lie/Solvable.lean index c6923c1c2982f7..6862e9b1845d4b 100644 --- a/Mathlib/Algebra/Lie/Solvable.lean +++ b/Mathlib/Algebra/Lie/Solvable.lean @@ -370,7 +370,7 @@ instance radicalIsSolvable [IsNoetherian R L] : IsSolvable (radical R L) := by rw [← CompleteLattice.isSupClosedCompact_iff_wellFoundedGT] at hwf refine hwf { I : LieIdeal R L | IsSolvable I } ⟨⊥, ?_⟩ fun I hI J hJ => ?_ · exact LieAlgebra.isSolvableBot R L - · rw [Set.mem_setOf_eq] at hI hJ ⊢ + · rw [Set.mem_ofPred_eq] at hI hJ ⊢ apply LieAlgebra.isSolvableAdd R L /-- The `→` direction of this lemma is actually true without the `IsNoetherian` assumption. -/ diff --git a/Mathlib/Algebra/Lie/Subalgebra.lean b/Mathlib/Algebra/Lie/Subalgebra.lean index 66b8058de3041c..c7c82acb21f2f7 100644 --- a/Mathlib/Algebra/Lie/Subalgebra.lean +++ b/Mathlib/Algebra/Lie/Subalgebra.lean @@ -440,7 +440,7 @@ instance : InfSet (LieSubalgebra R L) := ⟨fun S ↦ { sInf {(s : Submodule R L) | s ∈ S} with lie_mem' := @fun x y hx hy ↦ by - simp only [Submodule.mem_carrier, mem_iInter, Submodule.coe_sInf, mem_setOf_eq, + simp only [Submodule.mem_carrier, mem_iInter, Submodule.coe_sInf, mem_ofPred_eq, forall_apply_eq_imp_iff₂, exists_imp, and_imp] at hx hy ⊢ intro K hK exact K.lie_mem (hx K hK) (hy K hK) }⟩ diff --git a/Mathlib/Algebra/Lie/Submodule.lean b/Mathlib/Algebra/Lie/Submodule.lean index 82a263fbcad7bd..cceea1ee35a320 100644 --- a/Mathlib/Algebra/Lie/Submodule.lean +++ b/Mathlib/Algebra/Lie/Submodule.lean @@ -323,7 +323,7 @@ instance : InfSet (LieSubmodule R L M) := ⟨fun S ↦ { toSubmodule := sInf {(s : Submodule R M) | s ∈ S} lie_mem := fun {x m} h ↦ by - simp only [Submodule.mem_carrier, mem_iInter, Submodule.coe_sInf, mem_setOf_eq, + simp only [Submodule.mem_carrier, mem_iInter, Submodule.coe_sInf, mem_ofPred_eq, forall_apply_eq_imp_iff₂, forall_exists_index, and_imp] at h ⊢ intro N hN; apply N.lie_mem (h N hN) }⟩ @@ -354,7 +354,7 @@ theorem iInf_toSubmodule {ι} (p : ι → LieSubmodule R L M) : theorem coe_sInf (S : Set (LieSubmodule R L M)) : (↑(sInf S) : Set M) = ⋂ s ∈ S, (s : Set M) := by rw [← LieSubmodule.coe_toSubmodule, sInf_toSubmodule, Submodule.coe_sInf] ext m - simp only [mem_iInter, mem_setOf_eq, forall_apply_eq_imp_iff₂, exists_imp, + simp only [mem_iInter, mem_ofPred_eq, forall_apply_eq_imp_iff₂, exists_imp, and_imp, SetLike.mem_coe, mem_toSubmodule] @[simp] diff --git a/Mathlib/Algebra/Lie/Weights/Basic.lean b/Mathlib/Algebra/Lie/Weights/Basic.lean index 79af6197d3d0f5..c7612718c81ff5 100644 --- a/Mathlib/Algebra/Lie/Weights/Basic.lean +++ b/Mathlib/Algebra/Lie/Weights/Basic.lean @@ -268,12 +268,14 @@ noncomputable instance : DecidablePred (IsNonZero (R := R) (L := L) (M := M)) := variable (R L M) in /-- The set of weights is equivalent to a subtype. -/ -def equivSetOf : Weight R L M ≃ {χ : L → R | genWeightSpace M χ ≠ ⊥} where +def equivSetOfPred : Weight R L M ≃ {χ : L → R | genWeightSpace M χ ≠ ⊥} where toFun w := ⟨w.1, w.2⟩ invFun w := ⟨w.1, w.2⟩ left_inv w := by simp right_inv w := by simp +@[deprecated (since := "2026-07-09")] alias equivSetOf := equivSetOfPred + lemma genWeightSpaceOf_ne_bot (χ : Weight R L M) (x : L) : genWeightSpaceOf M (χ x) x ≠ ⊥ := by have : ⨅ x, genWeightSpaceOf M (χ x) x ≠ ⊥ := χ.genWeightSpace_ne_bot @@ -672,7 +674,7 @@ lemma iSupIndep_genWeightSpace : iSupIndep fun χ : L → R ↦ genWeightSpace M lemma iSupIndep_genWeightSpace' : iSupIndep fun χ : Weight R L M ↦ genWeightSpace M χ := (iSupIndep_genWeightSpace R L M).comp <| - Subtype.val_injective.comp (Weight.equivSetOf R L M).injective + Subtype.val_injective.comp (Weight.equivSetOfPred R L M).injective lemma iSupIndep_genWeightSpaceOf (x : L) : iSupIndep fun (χ : R) ↦ genWeightSpaceOf M χ x := by rw [← LieSubmodule.iSupIndep_toSubmodule] @@ -689,7 +691,7 @@ lemma finite_genWeightSpace_ne_bot [IsNoetherian R M] : instance Weight.instFinite [IsNoetherian R M] : Finite (Weight R L M) := by have : Finite {χ : L → R | genWeightSpace M χ ≠ ⊥} := finite_genWeightSpace_ne_bot R L M - exact Finite.of_injective (equivSetOf R L M) (equivSetOf R L M).injective + exact Finite.of_injective (equivSetOfPred R L M) (equivSetOfPred R L M).injective noncomputable instance Weight.instFintype [IsNoetherian R M] : Fintype (Weight R L M) := .ofFinite _ @@ -772,7 +774,7 @@ lemma iSup_genWeightSpace_eq_top [IsTriangularizable K L M] : lemma iSup_genWeightSpace_eq_top' [IsTriangularizable K L M] : ⨆ χ : Weight K L M, genWeightSpace M χ = ⊤ := by have := iSup_genWeightSpace_eq_top K L M - erw [← iSup_ne_bot_subtype, ← (Weight.equivSetOf K L M).iSup_comp] at this + erw [← iSup_ne_bot_subtype, ← (Weight.equivSetOfPred K L M).iSup_comp] at this exact this lemma eq_iSup_inf_genWeightSpace [IsTriangularizable K L M] (N : LieSubmodule K L M) : diff --git a/Mathlib/Algebra/Lie/Weights/Cartan.lean b/Mathlib/Algebra/Lie/Weights/Cartan.lean index e6da1b44287b17..552e781a21a35d 100644 --- a/Mathlib/Algebra/Lie/Weights/Cartan.lean +++ b/Mathlib/Algebra/Lie/Weights/Cartan.lean @@ -290,7 +290,7 @@ lemma mem_corootSpace {x : H} : rfl simp_rw [this, corootSpace, ← LieModuleHom.map_top, ← LieSubmodule.mem_toSubmodule, LieSubmodule.toSubmodule_map, LieSubmodule.top_toSubmodule, ← TensorProduct.span_tmul_eq_top, - LinearMap.map_span, Set.image, Set.mem_setOf_eq, exists_exists_exists_and_eq] + LinearMap.map_span, Set.image, Set.mem_ofPred_eq, exists_exists_exists_and_eq] change (x : L) ∈ Submodule.span R {x | ∃ (a : rootSpace H α) (b : rootSpace H (-α)), ⁅(a : L), (b : L)⁆ = x} ↔ _ simp @@ -306,7 +306,7 @@ lemma mem_corootSpace' {x : H} : rw [← Submodule.mem_map, Submodule.coe_subtype, Submodule.map_span, mem_corootSpace, ← this] ext u simp only [Submodule.coe_subtype, mem_image, Subtype.exists, LieSubalgebra.mem_toSubmodule, - exists_and_right, exists_eq_right, mem_setOf_eq, s] + exists_and_right, exists_eq_right, mem_ofPred_eq, s] refine ⟨fun ⟨_, y, hy, z, hz, hyz⟩ ↦ ⟨y, hy, z, hz, hyz⟩, fun ⟨y, hy, z, hz, hyz⟩ ↦ ⟨?_, y, hy, z, hz, hyz⟩⟩ convert! diff --git a/Mathlib/Algebra/Lie/Weights/Killing.lean b/Mathlib/Algebra/Lie/Weights/Killing.lean index 0fcc327d084cda..2fe4afedb5793e 100644 --- a/Mathlib/Algebra/Lie/Weights/Killing.lean +++ b/Mathlib/Algebra/Lie/Weights/Killing.lean @@ -307,7 +307,7 @@ lemma span_weight_isNonZero_eq_top : insert 0 ({α : Weight K H L | α.IsNonZero}.image (Weight.toLinear K H L)) by simpa only [Submodule.span_insert_zero] using Submodule.span_mono this rintro - ⟨α, rfl⟩ - simp only [mem_insert_iff, Weight.coe_toLinear_eq_zero_iff, mem_image, mem_setOf_eq] + simp only [mem_insert_iff, Weight.coe_toLinear_eq_zero_iff, mem_image, mem_ofPred_eq] tauto @[simp] diff --git a/Mathlib/Algebra/Module/FinitePresentation.lean b/Mathlib/Algebra/Module/FinitePresentation.lean index de0440401bcbe2..868d97be9c72b3 100644 --- a/Mathlib/Algebra/Module/FinitePresentation.lean +++ b/Mathlib/Algebra/Module/FinitePresentation.lean @@ -171,7 +171,7 @@ lemma Module.finitePresentation_of_surjective [h : Module.FinitePresentation R M obtain ⟨t, ht⟩ := hl' have H : Function.Surjective (Finsupp.linearCombination R ((↑) : s → M)) := LinearMap.range_eq_top.mp - (by rw [range_linearCombination, Subtype.range_val, ← hs]) + (by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl) apply Module.finitePresentation_of_free_of_surjective (l ∘ₗ linearCombination R Subtype.val) (hl.comp H) choose σ hσ using (show _ from H) @@ -188,7 +188,7 @@ lemma Module.FinitePresentation.fg_ker [Module.Finite R M] obtain ⟨s, hs, hs'⟩ := h have H : Function.Surjective (Finsupp.linearCombination R ((↑) : s → N)) := LinearMap.range_eq_top.mp - (by rw [range_linearCombination, Subtype.range_val, ← hs]) + (by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl) obtain ⟨f, hf⟩ : ∃ f : (s →₀ R) →ₗ[R] M, l ∘ₗ f = (Finsupp.linearCombination R Subtype.val) := by choose f hf using show _ from hl exact ⟨Finsupp.linearCombination R (fun i ↦ f i), by ext; simp [hf]⟩ @@ -221,7 +221,7 @@ lemma Module.finitePresentation_of_ker [Module.FinitePresentation R N] let π := Finsupp.linearCombination R ((↑) : s → M) have H : Function.Surjective π := LinearMap.range_eq_top.mp - (by rw [range_linearCombination, Subtype.range_val, ← hs]) + (by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl) have inst : Module.Finite R (LinearMap.ker (l ∘ₗ π)) := .of_fg <| Module.FinitePresentation.fg_ker _ (hl.comp H) let f : LinearMap.ker (l ∘ₗ π) →ₗ[R] LinearMap.ker l := LinearMap.restrict π (fun x ↦ id) @@ -365,7 +365,7 @@ lemma Module.FinitePresentation.exists_lift_of_isLocalizedModule let π := Finsupp.linearCombination R ((↑) : σ → M) have hπ : Function.Surjective π := LinearMap.range_eq_top.mp - (by rw [range_linearCombination, Subtype.range_val, ← hσ]) + (by rw [range_linearCombination, Subtype.range_coe_subtype, ← hσ]; rfl) classical choose s hs using IsLocalizedModule.surj S f let i : σ → N := diff --git a/Mathlib/Algebra/Module/Submodule/Invariant.lean b/Mathlib/Algebra/Module/Submodule/Invariant.lean index ec04da8d126ce9..110046f2cd2597 100644 --- a/Mathlib/Algebra/Module/Submodule/Invariant.lean +++ b/Mathlib/Algebra/Module/Submodule/Invariant.lean @@ -38,7 +38,7 @@ def invtSubmodule : Sublattice (Submodule R M) where ⟨le_trans hp <| Submodule.comap_mono le_sup_left, le_trans hq <| Submodule.comap_mono le_sup_right⟩ infClosed' p hp q hq := by - simp only [Set.mem_setOf_eq, Submodule.comap_inf, le_inf_iff] + simp only [Set.mem_ofPred_eq, Submodule.comap_inf, le_inf_iff] exact ⟨inf_le_of_left_le hp, inf_le_of_right_le hq⟩ lemma mem_invtSubmodule {p : Submodule R M} : diff --git a/Mathlib/Algebra/Module/ZLattice/Basic.lean b/Mathlib/Algebra/Module/ZLattice/Basic.lean index a7546316ed9cbe..bf24e57418102e 100644 --- a/Mathlib/Algebra/Module/ZLattice/Basic.lean +++ b/Mathlib/Algebra/Module/ZLattice/Basic.lean @@ -314,7 +314,7 @@ variable [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) theorem fundamentalDomain_subset_parallelepiped [Fintype ι] : fundamentalDomain b ⊆ parallelepiped b := by - rw [fundamentalDomain, parallelepiped_basis_eq, Set.setOf_subset_setOf] + rw [fundamentalDomain, parallelepiped_basis_eq, Set.ofPred_subset_ofPred] exact fun _ h i ↦ Set.Ico_subset_Icc_self (h i) instance [Finite ι] : DiscreteTopology (span ℤ (Set.range b)) := by @@ -345,7 +345,7 @@ theorem fundamentalDomain_measurableSet [MeasurableSpace E] [OpensMeasurableSpac · refine measurableSet_preimage (LinearMap.continuous_of_finiteDimensional _).measurable ?_ exact MeasurableSet.pi Set.countable_univ fun _ _ => measurableSet_Ico · ext - simp only [D, fundamentalDomain, Set.mem_Ico, Set.mem_setOf_eq, LinearEquiv.coe_coe, + simp only [D, fundamentalDomain, Set.mem_Ico, Set.mem_ofPred_eq, LinearEquiv.coe_coe, Set.mem_preimage, Basis.equivFun_apply, Set.mem_pi, Set.mem_univ, forall_true_left] /-- For a ℤ-lattice `Submodule.span ℤ (Set.range b)`, proves that the set defined @@ -399,7 +399,7 @@ theorem volume_real_fundamentalDomain [Fintype ι] [DecidableEq ι] (b : Basis theorem fundamentalDomain_ae_parallelepiped [Fintype ι] [MeasurableSpace E] (μ : Measure E) [BorelSpace E] [Measure.IsAddHaarMeasure μ] : - fundamentalDomain b =ᵐ[μ] parallelepiped b := by + fundamentalDomain b =ᵐˢ[μ] parallelepiped b := by classical have : FiniteDimensional ℝ E := b.finiteDimensional_of_finite rw [← measure_symmDiff_eq_zero_iff, symmDiff_of_le (fundamentalDomain_subset_parallelepiped b)] @@ -412,7 +412,7 @@ theorem fundamentalDomain_ae_parallelepiped [Fintype ι] [MeasurableSpace E] (μ simp_rw [vsub_eq_sub, zero_sub, neg_mem_iff] exact linearIndependent_iff_notMem_span.mp b.linearIndependent i intro x hx - simp_rw [parallelepiped_basis_eq, Set.mem_Icc, Set.mem_sdiff, Set.mem_setOf_eq, + simp_rw [parallelepiped_basis_eq, Set.mem_Icc, Set.mem_sdiff, Set.mem_ofPred_eq, mem_fundamentalDomain, Set.mem_Ico, not_forall, not_and, not_lt] at hx obtain ⟨i, hi⟩ := hx.2 have : b.repr x i = 1 := le_antisymm (hx.1 i).2 (hi (hx.1 i).1) @@ -461,7 +461,7 @@ theorem ZLattice.FG [hs : IsZLattice K L] : L.FG := by refine fg_def.mpr ⟨map (span ℤ s).mkQ L, ?_, span_eq _⟩ let b := Basis.mk h_lind (by rw [← hs.span_top, ← h_span] - exact span_mono (by simp only [Subtype.range_coe_subtype, Set.setOf_mem_eq, subset_rfl])) + exact span_mono (by simp only [Subtype.range_coe_subtype, Set.ofPred_mem_eq, subset_rfl])) rw [show span ℤ s = span ℤ (Set.range b) by simp [b, Basis.coe_mk, Subtype.range_coe_subtype]] have : Fintype s := h_lind.setFinite.fintype refine Set.Finite.of_finite_image (f := ((↑) : _ → E) ∘ quotientEquiv b) ?_ @@ -479,7 +479,7 @@ theorem ZLattice.FG [hs : IsZLattice K L] : L.FG := by · rw [fract, SetLike.mem_coe, sub_eq_add_neg] refine Submodule.add_mem _ h_mem (neg_mem (Set.mem_of_subset_of_mem ?_ (Subtype.mem (floor b x)))) - rw [SetLike.coe_subset_coe, Basis.coe_mk, Subtype.range_coe_subtype, Set.setOf_mem_eq] + rw [SetLike.coe_subset_coe, Basis.coe_mk, Subtype.range_coe_subtype, Set.ofPred_mem_eq] exact span_le.mpr h_incl · -- `span ℤ s` is finitely generated because `s` is finite rw [ker_mkQ, inf_of_le_right (span_le.mpr h_incl)] @@ -560,7 +560,7 @@ theorem ZLattice.rank [hs : IsZLattice K L] : finrank ℤ L = finrank K E := by contrapose! h -- Since `finrank ℤ L > finrank K E`, there exists a vector `v ∈ b` with `v ∉ e` obtain ⟨v, hv⟩ : (Set.range b \ Set.range e).Nonempty := by - rw [Basis.coe_mk, Subtype.range_coe_subtype, Set.setOf_mem_eq, ← Set.toFinset_nonempty] + rw [Basis.coe_mk, Subtype.range_coe_subtype, Set.ofPred_mem_eq, ← Set.toFinset_nonempty] contrapose! h rw [Set.toFinset_sdiff, Finset.sdiff_eq_empty_iff_subset] at h replace h := Finset.card_le_card h diff --git a/Mathlib/Algebra/Module/ZLattice/Covolume.lean b/Mathlib/Algebra/Module/ZLattice/Covolume.lean index 05d7349d94a083..56e80fab2761a6 100644 --- a/Mathlib/Algebra/Module/ZLattice/Covolume.lean +++ b/Mathlib/Algebra/Module/ZLattice/Covolume.lean @@ -247,7 +247,7 @@ private theorem tendsto_card_le_div''_aux {F : E → ℝ} (hF₁ : ∀ x ⦃r : ℝ⦄, 0 ≤ r → F (r • x) = r ^ card ι * (F x)) {c : ℝ} (hc : 0 < c) : c • {x ∈ X | F x ≤ 1} = {x ∈ X | F x ≤ c ^ card ι} := by ext x - simp_rw [Set.mem_smul_set_iff_inv_smul_mem₀ hc.ne', Set.mem_setOf_eq, hF₁ _ + simp_rw [Set.mem_smul_set_iff_inv_smul_mem₀ hc.ne', Set.mem_ofPred_eq, hF₁ _ (inv_pos_of_pos hc).le, inv_pow, inv_mul_le_iff₀ (pow_pos hc _), mul_one, and_congr_left_iff] exact fun _ ↦ ⟨fun h ↦ (smul_inv_smul₀ hc.ne' x) ▸ hX h hc, fun h ↦ hX h (inv_pos_of_pos hc)⟩ diff --git a/Mathlib/Algebra/MonoidAlgebra/Grading.lean b/Mathlib/Algebra/MonoidAlgebra/Grading.lean index ce985acf86dc7e..f3ab840fe01679 100644 --- a/Mathlib/Algebra/MonoidAlgebra/Grading.lean +++ b/Mathlib/Algebra/MonoidAlgebra/Grading.lean @@ -52,7 +52,7 @@ abbrev gradeBy (f : M → ι) (i : ι) : Submodule R R[M] where zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) - smul_mem' _ _ h := Set.Subset.trans Finsupp.support_smul h + smul_mem' _ _ h m hm := h m (Finsupp.support_smul hm) /-- The submodule corresponding to each grade. -/ abbrev grade (m : M) : Submodule R R[M] := @@ -61,11 +61,11 @@ abbrev grade (m : M) : Submodule R R[M] := theorem gradeBy_id : gradeBy R (id : M → M) = grade R := rfl theorem mem_gradeBy_iff (f : M → ι) (i : ι) (a : R[M]) : - a ∈ gradeBy R f i ↔ (a.coeff.support : Set M) ⊆ f ⁻¹' {i} := by rfl + a ∈ gradeBy R f i ↔ (a.coeff.support : Set M) ⊆ f ⁻¹' {i} := + ⟨fun h m hm => h m hm, fun h _ hm => h hm⟩ theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.coeff.support ⊆ {m} := by - rw [← Finset.coe_subset, Finset.coe_singleton] - rfl + simp [← Finset.coe_subset] theorem mem_grade_iff' (m : M) (a : R[M]) : a ∈ grade R m ↔ a ∈ LinearMap.range (lsingle (R := R) m) := by diff --git a/Mathlib/Algebra/Notation/Support.lean b/Mathlib/Algebra/Notation/Support.lean index 6499333b2a6073..a1370564d45000 100644 --- a/Mathlib/Algebra/Notation/Support.lean +++ b/Mathlib/Algebra/Notation/Support.lean @@ -175,7 +175,7 @@ lemma mulSupport_comp_eq_preimage (g : κ → M) (f : ι → κ) : lemma mulSupport_prodMk (f : ι → M) (g : ι → N) : mulSupport (fun x ↦ (f x, g x)) = mulSupport f ∪ mulSupport g := Set.ext fun x ↦ by - simp only [mulSupport, not_and_or, mem_union, mem_setOf_eq, Prod.mk_eq_one, Ne] + simp only [mulSupport, not_and_or, mem_union, mem_ofPred_eq, Prod.mk_eq_one, Ne] @[to_additive support_prodMk'] lemma mulSupport_prodMk' (f : ι → M × N) : diff --git a/Mathlib/Algebra/Order/Antidiag/Nat.lean b/Mathlib/Algebra/Order/Antidiag/Nat.lean index 0aa55fa23256da..e8f59f74c4cdb6 100644 --- a/Mathlib/Algebra/Order/Antidiag/Nat.lean +++ b/Mathlib/Algebra/Order/Antidiag/Nat.lean @@ -190,7 +190,7 @@ private theorem primeFactorsPiBij_inj (d n : ℕ) intro ⟨p, hp, hfg⟩ use f p hp dsimp only [Nat.primeFactorsPiBij] - apply ne_of_mem_of_not_mem (s := {x | p ∣ x}) <;> simp_rw [Set.mem_setOf_eq] + apply ne_of_mem_of_not_mem (s := {x | p ∣ x}) <;> simp_rw [Set.mem_ofPred_eq] · rw [Finset.prod_filter] convert! Finset.dvd_prod_of_mem _ (mem_attach (n.primeFactors) ⟨p, hp⟩) rw [if_pos rfl] diff --git a/Mathlib/Algebra/Order/Archimedean/Class.lean b/Mathlib/Algebra/Order/Archimedean/Class.lean index 23ab632c89c4d9..aa4a966e876fe0 100644 --- a/Mathlib/Algebra/Order/Archimedean/Class.lean +++ b/Mathlib/Algebra/Order/Archimedean/Class.lean @@ -259,6 +259,11 @@ theorem mk_mabs (a : M) : mk |a|ₘ = mk a := instance [Subsingleton M] : Subsingleton (MulArchimedeanClass M) := inferInstanceAs (Subsingleton (Antisymmetrization ..)) +-- Shortcut instance for computability +@[to_additive] +instance : PartialOrder (MulArchimedeanClass M) := + inferInstanceAs <| PartialOrder (Antisymmetrization (MulArchimedeanOrder M) (· ≤ ·)) + @[to_additive] noncomputable instance : LinearOrder (MulArchimedeanClass M) := diff --git a/Mathlib/Algebra/Order/Archimedean/IndicatorCard.lean b/Mathlib/Algebra/Order/Archimedean/IndicatorCard.lean index 61be60c432d313..3f239bdb9018b0 100644 --- a/Mathlib/Algebra/Order/Archimedean/IndicatorCard.lean +++ b/Mathlib/Algebra/Order/Archimedean/IndicatorCard.lean @@ -75,7 +75,7 @@ lemma limsup_eq_tendsto_sum_indicator_atTop {α R : Type*} (fun n ↦ ∑ k ∈ Finset.range n, (s k).indicator (fun _ ↦ r) ω) atTop } := by nth_rw 1 [← Nat.cofinite_eq_atTop, cofinite.limsup_set_eq] ext ω - rw [mem_setOf_eq, mem_setOf_eq, infinite_iff_tendsto_sum_indicator_atTop h, iff_eq_eq] + rw [mem_ofPred_eq, mem_ofPred_eq, infinite_iff_tendsto_sum_indicator_atTop h, iff_eq_eq] congr end Set diff --git a/Mathlib/Algebra/Order/CompleteField.lean b/Mathlib/Algebra/Order/CompleteField.lean index e0515d95472fab..bd8934c10475e9 100644 --- a/Mathlib/Algebra/Order/CompleteField.lean +++ b/Mathlib/Algebra/Order/CompleteField.lean @@ -126,7 +126,7 @@ theorem cutMap_bddAbove (a : α) : BddAbove (cutMap β a) := by theorem cutMap_add (a b : α) : cutMap β (a + b) = cutMap β a + cutMap β b := by refine (image_subset_iff.2 fun q hq => ?_).antisymm ?_ - · rw [mem_setOf_eq, ← sub_lt_iff_lt_add] at hq + · rw [mem_ofPred_eq, ← sub_lt_iff_lt_add] at hq obtain ⟨q₁, hq₁q, hq₁ab⟩ := exists_rat_btwn hq refine ⟨q₁, by rwa [coe_mem_cutMap_iff], q - q₁, ?_, add_sub_cancel _ _⟩ norm_cast @@ -135,7 +135,7 @@ theorem cutMap_add (a b : α) : cutMap β (a + b) = cutMap β a + cutMap β b := · rintro _ ⟨_, ⟨qa, ha, rfl⟩, _, ⟨qb, hb, rfl⟩, rfl⟩ -- After https://github.com/leanprover/lean4/pull/2734, `norm_cast` needs help with beta reduction. refine ⟨qa + qb, ?_, by beta_reduce; norm_cast⟩ - rw [mem_setOf_eq, cast_add] + rw [mem_ofPred_eq, cast_add] exact add_lt_add ha hb end CutMap diff --git a/Mathlib/Algebra/Order/Group/Ideal.lean b/Mathlib/Algebra/Order/Group/Ideal.lean index f0ba65f529b2e3..6d55201f87a3d0 100644 --- a/Mathlib/Algebra/Order/Group/Ideal.lean +++ b/Mathlib/Algebra/Order/Group/Ideal.lean @@ -33,10 +33,10 @@ generated. -/ ideal is finitely generated. -/] theorem fg_of_wellQuasiOrderedLE (I : SemigroupIdeal M) : I.FG := by have hpwo := Set.isPWO_of_wellQuasiOrderedLE { x | x ∈ I } - refine ⟨_, (setOf_minimal_antichain _).finite_of_partiallyWellOrderedOn - (hpwo.mono (setOf_minimal_subset _)), ?_⟩ + refine ⟨_, (setOfPred_minimal_antichain _).finite_of_partiallyWellOrderedOn + (hpwo.mono (setOfPred_minimal_subset _)), ?_⟩ ext x - simp only [mem_closure'', SetLike.setOf_mem_eq, SetLike.mem_coe, Set.mem_setOf_eq] + simp only [mem_closure'', SetLike.setOfPred_mem_eq, SetLike.mem_coe, Set.mem_ofPred_eq] constructor · intro hx rcases hpwo.exists_le_minimal hx with ⟨z, hz, hz'⟩ diff --git a/Mathlib/Algebra/Order/Group/Pointwise/Interval.lean b/Mathlib/Algebra/Order/Group/Pointwise/Interval.lean index 1101a11f3267ee..f90a9b4e3c43b8 100644 --- a/Mathlib/Algebra/Order/Group/Pointwise/Interval.lean +++ b/Mathlib/Algebra/Order/Group/Pointwise/Interval.lean @@ -842,7 +842,7 @@ lemma preimage_const_mul_Ioi_or_Iio (hb : a ≠ 0) {U V : Set α} (hU : U ∈ {s | ∃ a, s = Ioi a ∨ s = Iio a}) (hV : V = (a * ·) ⁻¹' U) : V ∈ {s | ∃ a, s = Ioi a ∨ s = Iio a} := by obtain ⟨aU, (haU | haU)⟩ := hU <;> - simp only [hV, haU, mem_setOf_eq] <;> + simp only [hV, haU, mem_ofPred_eq] <;> use a⁻¹ * aU <;> rcases lt_or_gt_of_ne hb with (hb | hb) · right; rw [Set.preimage_const_mul_Ioi_of_neg _ hb, div_eq_inv_mul] diff --git a/Mathlib/Algebra/Order/GroupWithZero/Basic.lean b/Mathlib/Algebra/Order/GroupWithZero/Basic.lean index 9810e9a39dfd9d..1003ca665170b5 100644 --- a/Mathlib/Algebra/Order/GroupWithZero/Basic.lean +++ b/Mathlib/Algebra/Order/GroupWithZero/Basic.lean @@ -1230,7 +1230,7 @@ lemma inv_strictAnti₀ (hb : 0 < b) (hba : b < a) : a⁻¹ < b⁻¹ := (inv_lt_inv₀ (hb.trans hba) hb).2 hba lemma strictAntiOn_inv_pos : StrictAntiOn (fun x : G₀ ↦ x⁻¹) {r | 0 < r} := - fun ⦃_⦄ ha ⦃_⦄ _ h ↦ inv_strictAnti₀ (Set.mem_setOf.mp ha) h + fun ⦃_⦄ ha ⦃_⦄ _ h ↦ inv_strictAnti₀ (Set.mem_ofPred.mp ha) h lemma antitoneOn_inv_pos : AntitoneOn (fun x : G₀ ↦ x⁻¹) {r | 0 < r} := strictAntiOn_inv_pos.antitoneOn diff --git a/Mathlib/Algebra/Order/Quantale.lean b/Mathlib/Algebra/Order/Quantale.lean index 71cb4d071d7404..478c0e3af442eb 100644 --- a/Mathlib/Algebra/Order/Quantale.lean +++ b/Mathlib/Algebra/Order/Quantale.lean @@ -180,7 +180,7 @@ instance : MulRightMono α where theorem leftMulResiduation_le_iff_mul_le : x ≤ y ⇨ₗ z ↔ x * y ≤ z where mp h1 := by grw [h1] - simp_all only [leftMulResiduation, sSup_mul_distrib, Set.mem_setOf_eq, + simp_all only [leftMulResiduation, sSup_mul_distrib, Set.mem_ofPred_eq, iSup_le_iff, implies_true] mpr h1 := le_sSup h1 @@ -188,7 +188,7 @@ theorem leftMulResiduation_le_iff_mul_le : x ≤ y ⇨ₗ z ↔ x * y ≤ z wher theorem rightMulResiduation_le_iff_mul_le : x ≤ y ⇨ᵣ z ↔ y * x ≤ z where mp h1 := by grw [h1] - simp_all only [rightMulResiduation, mul_sSup_distrib, Set.mem_setOf_eq, + simp_all only [rightMulResiduation, mul_sSup_distrib, Set.mem_ofPred_eq, iSup_le_iff, implies_true] mpr h1 := le_sSup h1 diff --git a/Mathlib/Algebra/Order/Rearrangement.lean b/Mathlib/Algebra/Order/Rearrangement.lean index 44b20c6d3cf59b..bde64c8837496f 100644 --- a/Mathlib/Algebra/Order/Rearrangement.lean +++ b/Mathlib/Algebra/Order/Rearrangement.lean @@ -76,7 +76,7 @@ theorem MonovaryOn.sum_smul_comp_perm_le_sum_smul (hfg : MonovaryOn f g s) set τ : Perm ι := σ.trans (swap a (σ a)) with hτ have hτs : {x | τ x ≠ x} ⊆ s := by intro x hx - simp only [τ, Ne, Set.mem_setOf_eq, Equiv.swap_comp_apply] at hx + simp only [τ, Ne, Set.mem_ofPred_eq, Equiv.swap_comp_apply] at hx split_ifs at hx with h₁ h₂ · obtain rfl | hax := eq_or_ne x a · contradiction diff --git a/Mathlib/Algebra/Order/Ring/Int.lean b/Mathlib/Algebra/Order/Ring/Int.lean index ea4d7a1e64af8e..35c299226e0731 100644 --- a/Mathlib/Algebra/Order/Ring/Int.lean +++ b/Mathlib/Algebra/Order/Ring/Int.lean @@ -44,7 +44,7 @@ instance instIsStrictOrderedRing : IsStrictOrderedRing ℤ := .of_mul_pos @Int.m /-! ### Miscellaneous lemmas -/ lemma isCompl_even_odd : IsCompl { n : ℤ | Even n } { n | Odd n } := by - simp [← not_even_iff_odd, ← Set.compl_setOf, isCompl_compl] + simp [← not_even_iff_odd, ← Set.compl_ofPred, isCompl_compl] @[simp] lemma _root_.Nat.cast_natAbs {α : Type*} [AddGroupWithOne α] (n : ℤ) : (n.natAbs : α) = |n| := by diff --git a/Mathlib/Algebra/Order/Ring/Nat.lean b/Mathlib/Algebra/Order/Ring/Nat.lean index 351db6239412cb..44b8d540a8b9fb 100644 --- a/Mathlib/Algebra/Order/Ring/Nat.lean +++ b/Mathlib/Algebra/Order/Ring/Nat.lean @@ -37,6 +37,6 @@ instance instLinearOrderedCommMonoidWithZero : LinearOrderedCommMonoidWithZero /-! ### Miscellaneous lemmas -/ lemma isCompl_even_odd : IsCompl { n : ℕ | Even n } { n | Odd n } := by - simp only [← Set.compl_setOf, isCompl_compl, ← not_even_iff_odd] + simp only [← Set.compl_ofPred, isCompl_compl, ← not_even_iff_odd] end Nat diff --git a/Mathlib/Algebra/Order/Ring/StandardPart.lean b/Mathlib/Algebra/Order/Ring/StandardPart.lean index 569ba5e7f072ed..da2eeea0c1c2ca 100644 --- a/Mathlib/Algebra/Order/Ring/StandardPart.lean +++ b/Mathlib/Algebra/Order/Ring/StandardPart.lean @@ -460,13 +460,8 @@ theorem stdPart_eq_sInf (f : ℝ →+*o K) (x : K) : stdPart x = sInf {r | x < f exact hs.le.trans (f.monotone' hs'.le) · rw [stdPart_of_mk_ne_zero hx.ne] have hr {r} := hx.trans_le (mk_map_nonneg_of_archimedean f r) - obtain h | h := le_or_gt 0 x - · convert! Real.sInf_empty.symm - rw [Set.eq_empty_iff_forall_notMem] - exact fun r ↦ (lt_of_mk_lt_mk_of_nonneg hr h).not_gt - · convert! Real.sInf_univ.symm - rw [Set.eq_univ_iff_forall] - exact fun r ↦ lt_of_mk_lt_mk_of_nonpos hr h.le + obtain hx | hx := le_total 0 x <;> + simp [(lt_of_mk_lt_mk_of_nonneg hr _).not_gt, lt_of_mk_lt_mk_of_nonpos hr, *] theorem stdPart_eq_sSup (f : ℝ →+*o K) (x : K) : stdPart x = sSup {r | f r < x} := by rw [← neg_inj, ← stdPart_neg, stdPart_eq_sInf f, ← Real.sInf_neg] diff --git a/Mathlib/Algebra/Order/ToIntervalMod.lean b/Mathlib/Algebra/Order/ToIntervalMod.lean index 637edc191bba29..65ee2f49148f4f 100644 --- a/Mathlib/Algebra/Order/ToIntervalMod.lean +++ b/Mathlib/Algebra/Order/ToIntervalMod.lean @@ -678,7 +678,7 @@ alias ⟨_, AddCommGroup.ModEq.toIcoMod_eq_toIcoMod⟩ := toIcoMod_inj theorem Ico_eq_locus_Ioc_eq_iUnion_Ioo : { b | toIcoMod hp a b = toIocMod hp a b } = ⋃ z : ℤ, Set.Ioo (a + z • p) (a + p + z • p) := by ext1 - simp_rw [Set.mem_setOf, Set.mem_iUnion, ← Set.sub_mem_Ioo_iff_left, ← + simp_rw [Set.mem_ofPred, Set.mem_iUnion, ← Set.sub_mem_Ioo_iff_left, ← not_modEq_iff_toIcoMod_eq_toIocMod, modEq_iff_forall_notMem_Ioo_mod hp, not_forall, Classical.not_not] diff --git a/Mathlib/Algebra/Polynomial/Basic.lean b/Mathlib/Algebra/Polynomial/Basic.lean index 4f38dc96829bbb..d93cac9a6c30e1 100644 --- a/Mathlib/Algebra/Polynomial/Basic.lean +++ b/Mathlib/Algebra/Polynomial/Basic.lean @@ -708,7 +708,7 @@ theorem ext {p q : R[X]} : (∀ n, coeff p n = coeff q n) → p = q := set_option backward.isDefEq.respectTransparency false in /-- Monomials generate the additive monoid of polynomials. -/ -theorem addSubmonoid_closure_setOf_eq_monomial : +theorem addSubmonoid_closure_setOfPred_eq_monomial : AddSubmonoid.closure { p : R[X] | ∃ n a, p = monomial n a } = ⊤ := by apply top_unique rw [← AddSubmonoid.map_equiv_top (toFinsuppIso R).symm.toAddEquiv, ← addSubmonoidClosure_single, @@ -717,10 +717,13 @@ theorem addSubmonoid_closure_setOf_eq_monomial : rintro _ ⟨n, a, rfl⟩ exact ⟨n, a, Polynomial.ofFinsupp_single _ _⟩ +@[deprecated (since := "2026-07-09")] +alias addSubmonoid_closure_setOf_eq_monomial := addSubmonoid_closure_setOfPred_eq_monomial + @[ext high] theorem addHom_ext {M : Type*} [AddZeroClass M] {f g : R[X] →+ M} (h : ∀ n a, f (monomial n a) = g (monomial n a)) : f = g := - AddMonoidHom.eq_of_eqOn_denseM addSubmonoid_closure_setOf_eq_monomial <| by + AddMonoidHom.eq_of_eqOn_denseM addSubmonoid_closure_setOfPred_eq_monomial <| by rintro p ⟨n, a, rfl⟩ exact h n a diff --git a/Mathlib/Algebra/Polynomial/EraseLead.lean b/Mathlib/Algebra/Polynomial/EraseLead.lean index 54af338b94faea..df0bffaaa19fec 100644 --- a/Mathlib/Algebra/Polynomial/EraseLead.lean +++ b/Mathlib/Algebra/Polynomial/EraseLead.lean @@ -418,7 +418,7 @@ theorem card_support_eq {n : ℕ} : Function.extend Fin.castSucc x fun _ => f.leadingCoeff, ?_, ?_, ?_⟩ · intro i j hij have hi : i ∈ Set.range (Fin.castSucc : Fin n → Fin (n + 1)) := by - simp only [Fin.range_castSucc, Nat.succ_eq_add_one, Set.mem_setOf_eq] + simp only [Fin.range_castSucc, Nat.succ_eq_add_one, Set.mem_ofPred_eq] exact lt_of_lt_of_le hij (Nat.lt_succ_iff.mp j.2) obtain ⟨i, rfl⟩ := hi rw [Fin.strictMono_castSucc.injective.extend_apply] diff --git a/Mathlib/Algebra/Polynomial/Roots.lean b/Mathlib/Algebra/Polynomial/Roots.lean index c55613f8ce6cd2..28d15c05f2afc3 100644 --- a/Mathlib/Algebra/Polynomial/Roots.lean +++ b/Mathlib/Algebra/Polynomial/Roots.lean @@ -138,19 +138,21 @@ theorem card_le_degree_of_subset_roots {p : R[X]} {Z : Finset R} (h : Z.val ⊆ #Z ≤ p.natDegree := (Multiset.card_le_card (Finset.val_le_iff_val_subset.2 h)).trans (Polynomial.card_roots' p) -theorem finite_setOf_isRoot {p : R[X]} (hp : p ≠ 0) : Set.Finite { x | IsRoot p x } := by +theorem finite_setOfPred_isRoot {p : R[X]} (hp : p ≠ 0) : Set.Finite { x | IsRoot p x } := by classical - simpa only [← Finset.setOf_mem, Multiset.mem_toFinset, mem_roots hp] + simpa only [← Finset.setOfPred_mem, Multiset.mem_toFinset, mem_roots hp] using p.roots.toFinset.finite_toSet +@[deprecated (since := "2026-07-09")] alias finite_setOf_isRoot := finite_setOfPred_isRoot + theorem eq_zero_of_infinite_isRoot (p : R[X]) (h : Set.Infinite { x | IsRoot p x }) : p = 0 := - not_imp_comm.mp finite_setOf_isRoot h + not_imp_comm.mp finite_setOfPred_isRoot h theorem exists_max_root [LinearOrder R] (p : R[X]) (hp : p ≠ 0) : ∃ x₀, ∀ x, p.IsRoot x → x ≤ x₀ := - Set.exists_upper_bound_image _ _ <| finite_setOf_isRoot hp + Set.exists_upper_bound_image _ _ <| finite_setOfPred_isRoot hp theorem exists_min_root [LinearOrder R] (p : R[X]) (hp : p ≠ 0) : ∃ x₀, ∀ x, p.IsRoot x → x₀ ≤ x := - Set.exists_lower_bound_image _ _ <| finite_setOf_isRoot hp + Set.exists_lower_bound_image _ _ <| finite_setOfPred_isRoot hp theorem eq_of_infinite_eval_eq (p q : R[X]) (h : Set.Infinite { x | eval x p = eval x q }) : p = q := by @@ -608,6 +610,7 @@ theorem bUnion_roots_finite {R S : Type*} [Semiring R] [CommRing S] [IsDomain S] (⋃ (f : R[X]) (_ : f.natDegree ≤ d ∧ ∀ i, f.coeff i ∈ U), ((f.map m).roots.toFinset : Set S)).Finite := Set.Finite.biUnion + (s := {f : R[X] | f.natDegree ≤ d ∧ ∀ i, f.coeff i ∈ U}) (by -- We prove that the set of polynomials under consideration is finite because its -- image by the injective map `π` is finite diff --git a/Mathlib/Algebra/Ring/Submonoid/Pointwise.lean b/Mathlib/Algebra/Ring/Submonoid/Pointwise.lean index b40650b7b053b3..07f5550da9f7d0 100644 --- a/Mathlib/Algebra/Ring/Submonoid/Pointwise.lean +++ b/Mathlib/Algebra/Ring/Submonoid/Pointwise.lean @@ -91,7 +91,7 @@ lemma smul_le : M • N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m • n ∈ P := @[elab_as_elim] protected lemma smul_induction_on {C : A → Prop} {a : A} (ha : a ∈ M • N) (hm : ∀ m ∈ M, ∀ n ∈ N, C (m • n)) (hadd : ∀ x y, C x → C y → C (x + y)) : C a := - (@smul_le _ _ _ _ _ _ _ ⟨⟨setOf C, hadd _ _⟩, by + (@smul_le _ _ _ _ _ _ _ ⟨⟨Set.ofPred C, hadd _ _⟩, by simpa only [smul_zero] using! hm _ (zero_mem _) _ (zero_mem _)⟩).2 hm ha @[simp] diff --git a/Mathlib/Algebra/Ring/Subring/MulOpposite.lean b/Mathlib/Algebra/Ring/Subring/MulOpposite.lean index f92b3d0ab594db..ba378fd1401beb 100644 --- a/Mathlib/Algebra/Ring/Subring/MulOpposite.lean +++ b/Mathlib/Algebra/Ring/Subring/MulOpposite.lean @@ -137,7 +137,7 @@ theorem unop_iInf (S : ι → Subring Rᵐᵒᵖ) : (iInf S).unop = ⨅ i, (S i) opEquiv.symm.map_iInf _ theorem op_closure (s : Set R) : (closure s).op = closure (MulOpposite.unop ⁻¹' s) := by - simp_rw [closure, op_sInf, Set.preimage_setOf_eq, coe_unop] + simp_rw [closure, op_sInf, Set.preimage_ofPred_eq, coe_unop] congr with a exact MulOpposite.unop_surjective.forall diff --git a/Mathlib/Algebra/Ring/Subsemiring/MulOpposite.lean b/Mathlib/Algebra/Ring/Subsemiring/MulOpposite.lean index a2e677732e4c03..f1e8c0369d03d9 100644 --- a/Mathlib/Algebra/Ring/Subsemiring/MulOpposite.lean +++ b/Mathlib/Algebra/Ring/Subsemiring/MulOpposite.lean @@ -143,7 +143,7 @@ theorem unop_iInf (S : ι → Subsemiring Rᵐᵒᵖ) : (iInf S).unop = ⨅ i, ( opEquiv.symm.map_iInf _ theorem op_closure (s : Set R) : (closure s).op = closure (MulOpposite.unop ⁻¹' s) := by - simp_rw [closure, op_sInf, Set.preimage_setOf_eq, coe_unop] + simp_rw [closure, op_sInf, Set.preimage_ofPred_eq, coe_unop] congr with a exact MulOpposite.unop_surjective.forall diff --git a/Mathlib/Algebra/Star/Center.lean b/Mathlib/Algebra/Star/Center.lean index 4b2778c9f4225a..491b0276652147 100644 --- a/Mathlib/Algebra/Star/Center.lean +++ b/Mathlib/Algebra/Star/Center.lean @@ -25,7 +25,7 @@ theorem Set.star_mem_center (ha : a ∈ Set.center R) : star a ∈ Set.center R theorem Set.star_centralizer : star s.centralizer = (star s).centralizer := by simp_rw [centralizer, ← commute_iff_eq] - conv_lhs => simp only [← star_preimage, preimage_setOf_eq, ← commute_star_comm] + conv_lhs => simp only [← star_preimage, preimage_ofPred_eq, ← commute_star_comm] conv_rhs => simp only [← image_star, forall_mem_image] theorem Set.union_star_self_comm (hcomm : ∀ x ∈ s, ∀ y ∈ s, y * x = x * y) diff --git a/Mathlib/Algebra/Star/Unitary.lean b/Mathlib/Algebra/Star/Unitary.lean index 3cf41580a98415..3e33ae62c51776 100644 --- a/Mathlib/Algebra/Star/Unitary.lean +++ b/Mathlib/Algebra/Star/Unitary.lean @@ -34,7 +34,7 @@ unitary -/ def unitary (R : Type*) [Monoid R] [StarMul R] : Submonoid R where carrier := { U | star U * U = 1 ∧ U * star U = 1 } - one_mem' := by simp only [mul_one, and_self_iff, Set.mem_setOf_eq, star_one] + one_mem' := by simp only [mul_one, and_self_iff, Set.mem_ofPred_eq, star_one] mul_mem' := @fun U B ⟨hA₁, hA₂⟩ ⟨hB₁, hB₂⟩ => by refine ⟨?_, ?_⟩ · calc diff --git a/Mathlib/AlgebraicGeometry/AffineScheme.lean b/Mathlib/AlgebraicGeometry/AffineScheme.lean index fb0f92073d1e68..4f07ef75ab9a36 100644 --- a/Mathlib/AlgebraicGeometry/AffineScheme.lean +++ b/Mathlib/AlgebraicGeometry/AffineScheme.lean @@ -326,7 +326,7 @@ theorem isBasis_basicOpen (X : Scheme) [IsAffine X] : PrimeSpectrum.isBasis_basic_opens.of_isInducing (TopCat.homeoOfIso (Scheme.forgetToTop.mapIso X.isoSpec)).isInducing using 1 ext V - simp only [Set.mem_range, exists_exists_eq_and, Set.mem_setOf, + simp only [Set.mem_range, exists_exists_eq_and, Set.mem_ofPred, ← Opens.coe_inj (V := V), ← Scheme.toSpecΓ_preimage_basicOpen] rfl @@ -934,7 +934,7 @@ theorem iSup_basicOpen_eq_self_iff {s : Set Γ(X, U)} : · simp only [Opens.carrier_eq_coe, PrimeSpectrum.basicOpen_eq_zeroLocus_compl] rw [← Set.compl_iInter, Set.compl_univ_iff, ← PrimeSpectrum.zeroLocus_iUnion, ← PrimeSpectrum.zeroLocus_empty_iff_eq_top, PrimeSpectrum.zeroLocus_span] - simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.setOf_mem_eq] + simp only [Set.iUnion_singleton_eq_range, Subtype.range_val_subtype, Set.ofPred_mem_eq] include hU in theorem self_le_iSup_basicOpen_iff {s : Set Γ(X, U)} : diff --git a/Mathlib/AlgebraicGeometry/Morphisms/Affine.lean b/Mathlib/AlgebraicGeometry/Morphisms/Affine.lean index e2615dd23bd633..783de6d168625d 100644 --- a/Mathlib/AlgebraicGeometry/Morphisms/Affine.lean +++ b/Mathlib/AlgebraicGeometry/Morphisms/Affine.lean @@ -121,7 +121,7 @@ lemma isAffine_of_isAffineOpen_basicOpen (s : Set Γ(X, ⊤)) · change IsAffineOpen _ simp only [← basicOpen_eq_of_affine] exact (isAffineOpen_top (Scheme.Spec.obj (op _))).basicOpen _ - · rw [PrimeSpectrum.iSup_basicOpen_eq_top_iff, Subtype.range_coe_subtype, Set.setOf_mem_eq, hs] + · rw [PrimeSpectrum.iSup_basicOpen_eq_top_iff, Subtype.range_coe_subtype, Set.ofPred_mem_eq, hs] · rw [Scheme.toSpecΓ_preimage_basicOpen] exact hs₂ _ i.2 · simp only [Opens.map_top, morphismRestrict_app] @@ -164,7 +164,7 @@ instance : HasAffineProperty @IsAffineHom fun X _ _ _ ↦ IsAffine X where simpa [Scheme.preimage_basicOpen] using! this eq_targetAffineLocally' := by ext X Y f - simp only [targetAffineLocally, Scheme.affineOpens, Set.coe_setOf, Set.mem_setOf_eq, + simp only [targetAffineLocally, Scheme.affineOpens, Set.coe_ofPred, Set.mem_ofPred_eq, Subtype.forall, isAffineHom_iff] rfl @@ -316,7 +316,7 @@ theorem isAffineHom_diagonal_iff {f : X ⟶ Y} : (.diagonal @IsAffineHom)) f).to_iff.trans ?_ simp only [targetAffineLocally, diagonal_isAffine_iff_forall_isAffineOpen_inf, (IsOpenImmersion.opensEquiv (f ⁻¹ᵁ _).ι).forall_congr_left, Scheme.affineOpens, - Subtype.forall, Set.mem_setOf_eq, Scheme.Opens.opensRange_ι, ← Scheme.Hom.preimage_inf, + Subtype.forall, Set.mem_ofPred_eq, Scheme.Opens.opensRange_ι, ← Scheme.Hom.preimage_inf, IsOpenImmersion.opensEquiv_symm_apply, Scheme.Hom.image_preimage_eq_opensRange_inf, ← Scheme.Hom.isAffineOpen_iff_of_isOpenImmersion (Scheme.Opens.ι _)] congr! with U hU V₁ hV₁ V₂ hV₂ @@ -331,11 +331,11 @@ lemma IsAffineOpen.inf [IsAffineHom (pullback.diagonal (terminal.from X))] lemma IsAffineOpen.iInf [IsAffineHom (pullback.diagonal (terminal.from X))] {ι : Sort*} [Finite ι] [Nonempty ι] {U : ι → X.Opens} (hU : ∀ i, IsAffineOpen (U i)) : IsAffineOpen (⨅ i, U i) := - InfClosed.iInf_mem_of_nonempty (s := setOf IsAffineOpen) (fun _ h _ h' ↦ h.inf h') hU + InfClosed.iInf_mem_of_nonempty (s := Set.ofPred IsAffineOpen) (fun _ h _ h' ↦ h.inf h') hU lemma IsAffineOpen.biInf [IsAffineHom (pullback.diagonal (terminal.from X))] {ι : Type*} (s : Set ι) (hs : s.Finite) (hs' : s.Nonempty) {U : ι → X.Opens} (hU : ∀ i ∈ s, IsAffineOpen (U i)) : IsAffineOpen (⨅ i ∈ s, U i) := - InfClosed.biInf_mem_of_nonempty (s := setOf IsAffineOpen) (fun _ h _ h' ↦ h.inf h') hs hs' hU + InfClosed.biInf_mem_of_nonempty (s := Set.ofPred IsAffineOpen) (fun _ h _ h' ↦ h.inf h') hs hs' hU end AlgebraicGeometry diff --git a/Mathlib/AlgebraicGeometry/Morphisms/FinitePresentation.lean b/Mathlib/AlgebraicGeometry/Morphisms/FinitePresentation.lean index ad50cc03d03afb..5b887edb7dda1d 100644 --- a/Mathlib/AlgebraicGeometry/Morphisms/FinitePresentation.lean +++ b/Mathlib/AlgebraicGeometry/Morphisms/FinitePresentation.lean @@ -134,7 +134,7 @@ nonrec lemma Scheme.Hom.isLocallyConstructible_image (f : X ⟶ Y) ((Scheme.homeoOfIso (Y.affineCover.f i).isoOpensRange).image_eq_preimage_symm _) apply Set.image_injective.mpr Subtype.val_injective rw [Set.image_preimage_eq_inter_range, ← Set.image_comp, ← Set.image_comp, - Subtype.range_coe_subtype, Set.setOf_mem_eq] + Subtype.range_coe_subtype, Set.ofPred_mem_eq] change _ = (Y.affineCover.pullbackHom f i ≫ (Y.affineCover.f i).isoOpensRange.hom ≫ Opens.ι _).base.hom '' _ rw [Scheme.Hom.isoOpensRange_hom_ι, Cover.pullbackHom_map, Scheme.Hom.comp_base, diff --git a/Mathlib/AlgebraicGeometry/Morphisms/Preimmersion.lean b/Mathlib/AlgebraicGeometry/Morphisms/Preimmersion.lean index 9344fdf1b8f994..1ca6f3aec286ae 100644 --- a/Mathlib/AlgebraicGeometry/Morphisms/Preimmersion.lean +++ b/Mathlib/AlgebraicGeometry/Morphisms/Preimmersion.lean @@ -102,7 +102,7 @@ instance : IsStableUnderBaseChange @IsPreimmersion := by constructor let L (x : (pullback f g :)) : { x : X × Y | f x.1 = g x.2 } := ⟨⟨pullback.fst f g x, pullback.snd f g x⟩, - by simp only [Set.mem_setOf, ← Scheme.Hom.comp_apply, pullback.condition]⟩ + by simp only [Set.mem_ofPred, ← Scheme.Hom.comp_apply, pullback.condition]⟩ have : IsEmbedding L := IsEmbedding.of_comp (by fun_prop) continuous_subtype_val (SurjectiveOnStalks.isEmbedding_pullback f g) exact IsEmbedding.subtypeVal.comp ((TopCat.pullbackHomeoPreimage _ f.continuous _ diff --git a/Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean b/Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean index 8f5630f669eab2..e421f5a2bc15ab 100644 --- a/Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean +++ b/Mathlib/AlgebraicGeometry/ProjectiveSpectrum/Topology.lean @@ -105,7 +105,7 @@ theorem coe_vanishingIdeal (t : Set (ProjectiveSpectrum 𝒜)) : theorem mem_vanishingIdeal (t : Set (ProjectiveSpectrum 𝒜)) (f : A) : f ∈ vanishingIdeal t ↔ ∀ x : ProjectiveSpectrum 𝒜, x ∈ t → f ∈ x.asHomogeneousIdeal := by - rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq] + rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_ofPred_eq] @[simp] theorem vanishingIdeal_singleton (x : ProjectiveSpectrum 𝒜) : diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Boundary.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Boundary.lean index 9f02d77707a461..d990c314ad8f36 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Boundary.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Boundary.lean @@ -35,7 +35,7 @@ namespace SSet all `m`-simplices of `stdSimplex n` that are not surjective (when viewed as monotone function `m → n`). -/ def boundary (n : ℕ) : (Δ[n] : SSet.{u}).Subcomplex where - obj _ := setOf (fun s ↦ ¬Function.Surjective (stdSimplex.asOrderHom s)) + obj _ := Set.ofPred (fun s ↦ ¬Function.Surjective (stdSimplex.asOrderHom s)) map _ _ hs h := hs (Function.Surjective.of_comp h) /-- The boundary `∂Δ[n]` of the `n`-th standard simplex -/ @@ -91,7 +91,7 @@ lemma boundary_obj_eq_univ (m n : ℕ) (h : m < n := by lia) : @[simp] lemma boundary_zero : boundary.{u} 0 = ⊥ := by ext m x - simp only [boundary, Nat.reduceAdd, Set.mem_setOf_eq, Subfunctor.bot_obj, Set.bot_eq_empty, + simp only [boundary, Nat.reduceAdd, Set.mem_ofPred_eq, Subfunctor.bot_obj, Set.bot_eq_empty, Set.mem_empty_iff_false, iff_false, Decidable.not_not] intro x exact ⟨0, by subsingleton⟩ diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Degenerate.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Degenerate.lean index 0ee1d0267cef92..e87c929548f6a9 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Degenerate.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Degenerate.lean @@ -34,7 +34,7 @@ variable (X : SSet.{u}) /-- An `n`-simplex of a simplicial set `X` is degenerate if it is in the range of `X.map f.op` for some morphism `f : [n] ⟶ [m]` with `m < n`. -/ def degenerate (n : ℕ) : Set (X _⦋n⦌) := - setOf (fun x ↦ ∃ (m : ℕ) (_ : m < n) (f : ⦋n⦌ ⟶ ⦋m⦌), + Set.ofPred (fun x ↦ ∃ (m : ℕ) (_ : m < n) (f : ⦋n⦌ ⟶ ⦋m⦌), x ∈ Set.range (X.map f.op)) /-- The set of `n`-dimensional non-degenerate simplices in a simplicial diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean index a828db88171e27..b12ece54feb0fa 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Horn.lean @@ -30,7 +30,7 @@ for which the union of `{i}` and the range of `α` is not all of `n` (when viewing `α` as monotone function `m → n`). -/ @[simps -isSimp obj] def horn (n : ℕ) (i : Fin (n + 1)) : (Δ[n] : SSet.{u}).Subcomplex where - obj _ := setOf (fun s ↦ Set.range (stdSimplex.asOrderHom s) ∪ {i} ≠ Set.univ) + obj _ := Set.ofPred (fun s ↦ Set.range (stdSimplex.asOrderHom s) ∪ {i} ≠ Set.univ) map φ s hs h := hs (by rw [Set.eq_univ_iff_forall] at h ⊢; intro j apply Or.imp _ id (h j) diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean index d52431c39482d5..f5e9a4fec28b03 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean @@ -126,7 +126,7 @@ namespace Subcomplex /-- The external product of subcomplexes of simplicial sets. -/ @[simps] def prod {X Y : SSet.{u}} (A : X.Subcomplex) (B : Y.Subcomplex) : (X ⊗ Y).Subcomplex where - obj Δ := (A.obj Δ).prod (B.obj Δ) + obj Δ := A.obj Δ ×ˢ B.obj Δ map i _ hx := ⟨A.map i hx.1, B.map i hx.2⟩ lemma prod_monotone {X Y : SSet.{u}} @@ -247,11 +247,10 @@ variable {X Y : SSet.{u}} (S : X.Subcomplex) (T : Y.Subcomplex) /-- Given `S ≤ X` and `T ≤ Y`, this is the subcomplex of `X ⊗ Y` given by `(X ⊗ T) ⊔ (S ⊗ Y)`. -/ def unionProd : (X ⊗ Y).Subcomplex := ((⊤ : X.Subcomplex).prod T) ⊔ (S.prod ⊤) -set_option backward.defeqAttrib.useBackward true in +set_option backward.isDefEq.respectTransparency false in lemma mem_unionProd_iff {n : SimplexCategoryᵒᵖ} (x : (X ⊗ Y).obj n) : dsimp% x ∈ (unionProd S T).obj _ ↔ x.2 ∈ T.obj _ ∨ x.1 ∈ S.obj _ := by - dsimp [unionProd, Set.prod] - cat_disch + simp [unionProd, Set.mem_prod (α := X.obj n)] lemma top_prod_le_unionProd : (⊤ : X.Subcomplex).prod T ≤ S.unionProd T := le_sup_left @@ -288,13 +287,10 @@ lemma ι₁_ι : ι₁ S T ≫ (unionProd S T).ι = X ◁ T.ι := rfl @[reassoc (attr := simp)] lemma ι₂_ι : ι₂ S T ≫ (unionProd S T).ι = S.ι ▷ Y := rfl +set_option backward.isDefEq.respectTransparency false in lemma bicartSq : BicartSq (S.prod T) ((⊤ : X.Subcomplex).prod T) (S.prod ⊤) (unionProd S T) where sup_eq := rfl - inf_eq := by - ext n ⟨x, y⟩ - change _ ∧ _ ↔ _ - simp [prod, Set.prod, Membership.mem, Set.Mem, setOf] - tauto + inf_eq := by ext n; simp [Set.mem_prod (α := X.obj n), and_comm] lemma isPushout : IsPushout (S.ι ▷ (T : SSet)) ((S : SSet) ◁ T.ι) (unionProd.ι₁ S T) (unionProd.ι₂ S T) := diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/Simplices.lean b/Mathlib/AlgebraicTopology/SimplicialSet/Simplices.lean index 954be17519ec39..71a715edcbf836 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/Simplices.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/Simplices.lean @@ -124,7 +124,7 @@ lemma le_def {s t : X.S} : s ≤ t ↔ s.subcomplex ≤ t.subcomplex := lemma le_iff {s t : X.S} : s ≤ t ↔ ∃ (f : ⦋s.dim⦌ ⟶ ⦋t.dim⦌), X.map f.op t.simplex = s.simplex := by - rw [le_def, Subcomplex.ofSimplex_le_iff, Subfunctor.ofSection_obj, Set.mem_setOf_eq] + rw [le_def, Subcomplex.ofSimplex_le_iff, Subfunctor.ofSection_obj, Set.mem_ofPred_eq] tauto lemma mk_map_le {n m : ℕ} (x : X _⦋n⦌) (f : ⦋m⦌ ⟶ ⦋n⦌) : diff --git a/Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean b/Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean index ba21e62be40308..ad2b94d8bed891 100644 --- a/Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean +++ b/Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean @@ -272,7 +272,7 @@ attribute [local simp] image_subset_iff as a subcomplex. -/ @[simps -isSimp obj] def face {n : ℕ} (S : Finset (Fin (n + 1))) : (Δ[n] : SSet.{u}).Subcomplex where - obj U := setOf (fun f ↦ Finset.image (objEquiv f).toOrderHom ⊤ ≤ S) + obj U := Set.ofPred (fun f ↦ Finset.image (objEquiv f).toOrderHom ⊤ ≤ S) map {U V} i := by aesop attribute [local simp] face_obj @@ -605,7 +605,7 @@ private lemma bijective_image_objEquiv_toOrderHom_univ (m : ℕ) : obtain ⟨f₂, rfl⟩ := objEquiv.symm.surjective x₂ simp only [mem_nonDegenerate_iff_mono, Equiv.apply_symm_apply, SimplexCategory.mono_iff_injective, SimplexCategory.len_mk] at h₁ h₂ - simp only [Set.mem_setOf_eq, SimplexCategory.len_mk, Equiv.apply_symm_apply, + simp only [Set.mem_ofPred_eq, SimplexCategory.len_mk, Equiv.apply_symm_apply, Subtype.mk.injEq, EmbeddingLike.apply_eq_iff_eq] at h₃ ⊢ apply SimplexCategory.Hom.ext rw [← OrderHom.range_eq_iff h₁ h₂] diff --git a/Mathlib/Analysis/Analytic/Basic.lean b/Mathlib/Analysis/Analytic/Basic.lean index 0c93cffbd50709..a70691e48211e5 100644 --- a/Mathlib/Analysis/Analytic/Basic.lean +++ b/Mathlib/Analysis/Analytic/Basic.lean @@ -519,7 +519,7 @@ theorem AnalyticWithinAt.mono_of_mem_nhdsWithin rcases h with ⟨p, hp⟩ exact ⟨p, hp.mono_of_mem_nhdsWithin hst⟩ -theorem AnalyticWithinAt.congr_set (h : AnalyticWithinAt 𝕜 f s x) (hst : s =ᶠ[𝓝 x] t) : +theorem AnalyticWithinAt.congr_set (h : AnalyticWithinAt 𝕜 f s x) (hst : s =ᶠˢ[𝓝 x] t) : AnalyticWithinAt 𝕜 f t x := by refine h.mono_of_mem_nhdsWithin ?_ simp [← nhdsWithin_eq_iff_eventuallyEq.mpr hst, self_mem_nhdsWithin] diff --git a/Mathlib/Analysis/Analytic/CPolynomialDef.lean b/Mathlib/Analysis/Analytic/CPolynomialDef.lean index 080fd7c388245b..979ee9a81876f0 100644 --- a/Mathlib/Analysis/Analytic/CPolynomialDef.lean +++ b/Mathlib/Analysis/Analytic/CPolynomialDef.lean @@ -392,7 +392,7 @@ theorem changeOrigin_eval_of_finite (p : FormalMultilinearSeries 𝕜 E F) {n : simp_rw [← {m | m < n}.iUnion_of_singleton_coe, preimage_iUnion, ← range_sigmaMk] exact finite_iUnion fun _ ↦ finite_range _ · refine fun s ↦ Not.imp_symm fun hs ↦ ?_ - simp only [preimage_setOf_eq, changeOriginIndexEquiv_apply_fst, mem_setOf, not_lt] at hs + simp only [preimage_ofPred_eq, changeOriginIndexEquiv_apply_fst, mem_ofPred, not_lt] at hs dsimp only [f] rw [changeOriginSeriesTerm_bound p hn _ _ _ hs, _root_.zero_apply, _root_.zero_apply] have hfkl k l : HasSum (f ⟨k, l, ·⟩) (changeOriginSeries p k l (fun _ ↦ x) fun _ ↦ y) := by diff --git a/Mathlib/Analysis/Analytic/Composition.lean b/Mathlib/Analysis/Analytic/Composition.lean index a2d67c703fbb11..ad87882348b5c3 100644 --- a/Mathlib/Analysis/Analytic/Composition.lean +++ b/Mathlib/Analysis/Analytic/Composition.lean @@ -582,7 +582,7 @@ theorem compPartialSumTargetSet_image_compPartialSumSource (m M N : ℕ) ∃ (j : _) (hj : j ∈ compPartialSumSource m M N), compChangeOfVariables m M N j hj = i := by rcases i with ⟨n, c⟩ refine ⟨⟨c.length, c.blocksFun⟩, ?_, ?_⟩ - · simp only [compPartialSumTargetSet, Set.mem_setOf_eq] at hi + · simp only [compPartialSumTargetSet, Set.mem_ofPred_eq] at hi simp only [mem_compPartialSumSource_iff, hi.left, hi.right, true_and, and_true] exact fun a => c.one_le_blocks' _ · dsimp [compChangeOfVariables] diff --git a/Mathlib/Analysis/Analytic/Constructions.lean b/Mathlib/Analysis/Analytic/Constructions.lean index 44c8d8cc59f201..a4823d7cdda8e3 100644 --- a/Mathlib/Analysis/Analytic/Constructions.lean +++ b/Mathlib/Analysis/Analytic/Constructions.lean @@ -742,7 +742,7 @@ theorem HasFPowerSeriesWithinOnBall.compContinuousLinearMap · simp · simp only [Set.mem_insert_iff, add_eq_left, Set.mem_preimage, map_add] at hy1 ⊢ rcases hy1 with (hy1 | hy1) <;> simp [hy1] - · simp only [Metric.eball, edist_zero_right, Set.mem_setOf_eq] at hy2 ⊢ + · simp only [Metric.eball, edist_zero_right, Set.mem_ofPred_eq] at hy2 ⊢ exact lt_of_le_of_lt (ContinuousLinearMap.le_opENorm _ _) (mul_lt_of_lt_div' hy2) theorem HasFPowerSeriesOnBall.compContinuousLinearMap (hf : HasFPowerSeriesOnBall f pf (u x) r) : diff --git a/Mathlib/Analysis/Analytic/Inverse.lean b/Mathlib/Analysis/Analytic/Inverse.lean index 5a1ae3790ef0d7..8577b5a33a6d72 100644 --- a/Mathlib/Analysis/Analytic/Inverse.lean +++ b/Mathlib/Analysis/Analytic/Inverse.lean @@ -149,7 +149,7 @@ theorem leftInv_comp (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) ext k simp [h] simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, - applyComposition_ones, C, D, -Set.toFinset_setOf, -Finset.union_singleton] + applyComposition_ones, C, D, -Set.toFinset_ofPred, -Finset.union_singleton] /-! ### The right inverse of a formal multilinear series -/ @@ -223,7 +223,7 @@ theorem comp_rightInv_aux1 {n : ℕ} (hn : 0 < n) (p : FormalMultilinearSeries p 1 fun _ : Fin 1 => q n v := by apply p.congr (Composition.single_length hn) fun j hj1 _ => ?_ simp [applyComposition_single] - simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_setOf, + simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_ofPred, -add_right_inj, -Composition.single_length, -Finset.union_singleton] theorem comp_rightInv_aux2 (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) (n : ℕ) @@ -236,7 +236,7 @@ theorem comp_rightInv_aux2 (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[ refine sum_congr rfl fun c hc => p.congr rfl fun j hj1 hj2 => ?_ have : ∀ k, c.blocksFun k < n + 2 := by simp only [Set.mem_toFinset (s := {c : Composition (n + 2) | 1 < c.length}), - Set.mem_setOf_eq] at hc + Set.mem_ofPred_eq] at hc simp [← Composition.ne_single_iff N, Composition.eq_single_iff_length, ne_of_gt hc] simp [applyComposition, this] @@ -257,7 +257,7 @@ theorem comp_rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F id_apply_one, ContinuousLinearEquiv.coe_apply, continuousMultilinearCurryFin1_symm_apply] | n + 2 => have N : 0 < n + 2 := by simp - simp [comp_rightInv_aux1 N, h, rightInv, comp_rightInv_aux2, -Set.toFinset_setOf] + simp [comp_rightInv_aux1 N, h, rightInv, comp_rightInv_aux2, -Set.toFinset_ofPred] theorem rightInv_coeff (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (x : E) (n : ℕ) (hn : 2 ≤ n) : @@ -274,7 +274,7 @@ theorem rightInv_coeff (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] ext v have N : 0 < n + 2 := by simp have : ((p 1) fun _ : Fin 1 => 0) = 0 := ContinuousMultilinearMap.map_zero _ - simp [comp_rightInv_aux1 N, this, comp_rightInv_aux2, -Set.toFinset_setOf] + simp [comp_rightInv_aux1 N, this, comp_rightInv_aux2, -Set.toFinset_ofPred] /-! ### Coincidence of the left and the right inverse -/ @@ -391,7 +391,7 @@ theorem radius_right_inv_pos_of_radius_pos_aux1 (n : ℕ) (p : ℕ → ℝ) (hp exact prod_nonneg fun j _ ↦ (by positivity [ha, hp (x.snd.blocksFun j)]) rintro ⟨k, c⟩ hd simp only [Set.mem_toFinset (s := {c | 1 < Composition.length c}), mem_Ico, mem_sigma, - Set.mem_setOf_eq] at hd + Set.mem_ofPred_eq] at hd simp only [mem_compPartialSumTarget_iff] refine ⟨hd.2, c.length_le.trans_lt hd.1.2, fun j => ?_⟩ have : c ≠ Composition.single k (zero_lt_two.trans_le hd.1.1) := by diff --git a/Mathlib/Analysis/Analytic/Order.lean b/Mathlib/Analysis/Analytic/Order.lean index 5f8cb7ed88f349..15629de78bf86b 100644 --- a/Mathlib/Analysis/Analytic/Order.lean +++ b/Mathlib/Analysis/Analytic/Order.lean @@ -577,7 +577,7 @@ namespace AnalyticOnNhd variable {U : Set 𝕜} {f : 𝕜 → E} /-- The set where an analytic function has infinite order is clopen in its domain of analyticity. -/ -theorem isClopen_setOf_analyticOrderAt_eq_top (hf : AnalyticOnNhd 𝕜 f U) : +theorem isClopen_setOfPred_analyticOrderAt_eq_top (hf : AnalyticOnNhd 𝕜 f U) : IsClopen {u : U | analyticOrderAt f u = ⊤} := by constructor · rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open] @@ -602,13 +602,16 @@ theorem isClopen_setOf_analyticOrderAt_eq_top (hf : AnalyticOnNhd 𝕜 f U) : conv => arg 1; intro; left; right; arg 1; intro rw [analyticOrderAt_eq_top, eventually_nhds_iff] - simp only [mem_setOf_eq] at hz + simp only [mem_ofPred_eq] at hz rw [analyticOrderAt_eq_top, eventually_nhds_iff] at hz obtain ⟨t', h₁t', h₂t', h₃t'⟩ := hz use Subtype.val ⁻¹' t' simp only [isOpen_induced h₂t', mem_preimage, h₃t', and_self, and_true] grind +@[deprecated (since := "2026-07-09")] +alias isClopen_setOf_analyticOrderAt_eq_top := isClopen_setOfPred_analyticOrderAt_eq_top + /-- On a connected set, there exists a point where a meromorphic function `f` has finite order iff `f` has finite order at every point. -/ theorem exists_analyticOrderAt_ne_top_iff_forall (hf : AnalyticOnNhd 𝕜 f U) (hU : IsConnected U) : @@ -617,7 +620,7 @@ theorem exists_analyticOrderAt_ne_top_iff_forall (hf : AnalyticOnNhd 𝕜 f U) ( obtain ⟨v⟩ : Nonempty U := inferInstance suffices (∀ (u : U), analyticOrderAt f u ≠ ⊤) ∨ ∀ (u : U), analyticOrderAt f u = ⊤ by tauto simpa [Set.eq_empty_iff_forall_notMem, Set.eq_univ_iff_forall] using - isClopen_iff.1 hf.isClopen_setOf_analyticOrderAt_eq_top + isClopen_iff.1 hf.isClopen_setOfPred_analyticOrderAt_eq_top /-- On a preconnected set, a meromorphic function has finite order at one point if it has finite order at another point. -/ @@ -629,7 +632,7 @@ theorem analyticOrderAt_ne_top_of_isPreconnected {x y : 𝕜} (hf : AnalyticOnNh /-- The set where an analytic function has zero or infinite order is discrete within its domain of analyticity. -/ -theorem codiscrete_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) : +theorem codiscrete_setOfPred_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) : {u : U | analyticOrderAt f u = 0 ∨ analyticOrderAt f u = ⊤} ∈ Filter.codiscrete U := by simp_rw [mem_codiscrete_subtype_iff_mem_codiscreteWithin, mem_codiscreteWithin, disjoint_principal_right] @@ -640,11 +643,15 @@ theorem codiscrete_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 · filter_upwards [h₁f] with a ha simp +contextual [(hf a _).analyticOrderAt_eq_zero, ha] +@[deprecated (since := "2026-07-09")] +alias codiscrete_setOf_analyticOrderAt_eq_zero_or_top := + codiscrete_setOfPred_analyticOrderAt_eq_zero_or_top + /-- The set where an analytic function has zero or infinite order is discrete within its domain of analyticity. -/ -theorem codiscreteWithin_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) : +theorem codiscreteWithin_setOfPred_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNhd 𝕜 f U) : {u : 𝕜 | analyticOrderAt f u = 0 ∨ analyticOrderAt f u = ⊤} ∈ codiscreteWithin U := by simp_rw [mem_codiscreteWithin, disjoint_principal_right] intro x hx @@ -654,6 +661,10 @@ theorem codiscreteWithin_setOf_analyticOrderAt_eq_zero_or_top (hf : AnalyticOnNh · filter_upwards [h₁f] with a ha simp +contextual [(hf a _).analyticOrderAt_eq_zero, ha] +@[deprecated (since := "2026-07-09")] +alias codiscreteWithin_setOf_analyticOrderAt_eq_zero_or_top := + codiscreteWithin_setOfPred_analyticOrderAt_eq_zero_or_top + /-- If an analytic function `f` is not constantly zero on a connected set `U`, then its set of zeros is codiscrete within `U`. diff --git a/Mathlib/Analysis/Analytic/Uniqueness.lean b/Mathlib/Analysis/Analytic/Uniqueness.lean index c7842ff404e3fc..20fe97cfe84c8c 100644 --- a/Mathlib/Analysis/Analytic/Uniqueness.lean +++ b/Mathlib/Analysis/Analytic/Uniqueness.lean @@ -166,7 +166,7 @@ theorem eqOn_zero_of_preconnected_of_eventuallyEq_zero_aux [CompleteSpace F] {f let u := {x | f =ᶠ[𝓝 x] 0} suffices main : closure u ∩ U ⊆ u by have Uu : U ⊆ u := - hU.subset_of_closure_inter_subset isOpen_setOf_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main + hU.subset_of_closure_inter_subset isOpen_setOfPred_eventually_nhds ⟨z₀, h₀, hfz₀⟩ main intro z hz simpa using mem_of_mem_nhds (Uu hz) /- Take a limit point `x`, then a ball `B (x, r)` on which it has a power series expansion, and diff --git a/Mathlib/Analysis/Asymptotics/Defs.lean b/Mathlib/Analysis/Asymptotics/Defs.lean index ef7188bcd7fc48..cd88403ddedceb 100644 --- a/Mathlib/Analysis/Asymptotics/Defs.lean +++ b/Mathlib/Analysis/Asymptotics/Defs.lean @@ -1176,7 +1176,7 @@ theorem isBigOWith_const_const (c : E) {c' : F''} (hc' : c' ≠ 0) (l : Filter simp only [IsBigOWith_def] apply univ_mem' intro x - rw [mem_setOf, div_mul_cancel₀ _ (norm_ne_zero_iff.mpr hc')] + rw [mem_ofPred, div_mul_cancel₀ _ (norm_ne_zero_iff.mpr hc')] theorem isBigO_const_const (c : E) {c' : F''} (hc' : c' ≠ 0) (l : Filter α) : (fun _x : α => c) =O[l] fun _x => c' := diff --git a/Mathlib/Analysis/Asymptotics/Lemmas.lean b/Mathlib/Analysis/Asymptotics/Lemmas.lean index 026a39b13ca486..6dd234c97c8585 100644 --- a/Mathlib/Analysis/Asymptotics/Lemmas.lean +++ b/Mathlib/Analysis/Asymptotics/Lemmas.lean @@ -610,7 +610,7 @@ theorem IsBigOWith.right_le_sub_of_lt_one {f₁ f₂ : α → E'} (h : IsBigOWit IsBigOWith (1 / (1 - c)) l f₂ fun x => f₂ x - f₁ x := IsBigOWith.of_bound <| mem_of_superset h.bound fun x hx => by - simp only [mem_setOf_eq] at hx ⊢ + simp only [mem_ofPred_eq] at hx ⊢ rw [mul_comm, one_div, ← div_eq_mul_inv, le_div_iff₀, mul_sub, mul_one, mul_comm] · exact le_trans (sub_le_sub_left hx _) (norm_sub_norm_le _ _) · exact sub_pos.2 hc @@ -744,7 +744,7 @@ lemma isBigO_nat_atTop_induction {f : ℕ → E''} {g : ℕ → F''} let ubounds := {C | ∀ m ∈ Finset.Icc n₀ n₁, ‖f m‖ ≤ C * ‖g m‖} let C₁ := (Finset.Icc n₀ n₁).sup' (Finset.nonempty_Icc.mpr H₁) fun n => ‖f n‖ / ‖g n‖ have C₁_mem : C₁ ∈ ubounds := by - rw [Set.mem_setOf] + rw [Set.mem_ofPred] intro m hm calc ‖f m‖ = (‖f m‖ / ‖g m‖) * ‖g m‖ := by by_cases hm' : g m = 0 <;> grind [norm_eq_zero] _ ≤ C₁ * ‖g m‖ := by diff --git a/Mathlib/Analysis/BoxIntegral/Basic.lean b/Mathlib/Analysis/BoxIntegral/Basic.lean index 90d0a9b09bc2e2..6fdefd88a4ba4f 100644 --- a/Mathlib/Analysis/BoxIntegral/Basic.lean +++ b/Mathlib/Analysis/BoxIntegral/Basic.lean @@ -228,7 +228,7 @@ theorem integrable_iff_cauchy_basis [CompleteSpace F] : Integrable I l f vol ↔ rw [integrable_iff_cauchy, cauchy_map_iff', (l.hasBasis_toFilteriUnion_top _).prod_self.tendsto_iff uniformity_basis_dist_le] refine forall₂_congr fun ε _ => exists_congr fun r => ?_ - simp only [Prod.forall, exists_imp, prodMk_mem_set_prod_eq, and_imp, mem_setOf_eq] + simp only [Prod.forall, exists_imp, prodMk_mem_set_prod_eq, and_imp, mem_ofPred_eq] exact and_congr Iff.rfl ⟨fun H c₁ c₂ π₁ π₂ h₁ hU₁ h₂ hU₂ => H π₁ π₂ c₁ h₁ hU₁ c₂ h₂ hU₂, @@ -600,7 +600,7 @@ theorem tendsto_integralSum_sum_integral (h : Integrable I l f vol) (π₀ : Pre (𝓝 <| ∑ J ∈ π₀.boxes, integral J l f vol) := by refine ((l.hasBasis_toFilteriUnion I π₀).tendsto_iff nhds_basis_closedBall).2 fun ε ε0 => ?_ refine ⟨h.convergenceR ε, h.convergenceR_cond ε, ?_⟩ - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] rintro π ⟨c, hc, hU⟩ exact h.dist_integralSum_sum_integral_le_of_memBaseSet_of_iUnion_eq ε0 hc hU @@ -807,7 +807,7 @@ theorem HasIntegral.of_bRiemann_eq_false_of_forall_isLittleO (hl : l.bRiemann = classical set δ : ℝ≥0 → ℝⁿ → Ioi (0 : ℝ) := fun c x => if x ∈ s then δ₁ c x (εs x) else (δ₂ c) x ε' refine ⟨δ, fun c => l.rCond_of_bRiemann_eq_false hl, ?_⟩ - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] rintro π ⟨c, hπδ, hπp⟩ -- Now we split the sum into two parts based on whether `π.tag J` belongs to `s` or not. rw [← g.sum_partition_boxes le_rfl hπp, Metric.mem_closedBall, integralSum, diff --git a/Mathlib/Analysis/BoxIntegral/Partition/Basic.lean b/Mathlib/Analysis/BoxIntegral/Partition/Basic.lean index 0824afe45602b0..30675792379128 100644 --- a/Mathlib/Analysis/BoxIntegral/Partition/Basic.lean +++ b/Mathlib/Analysis/BoxIntegral/Partition/Basic.lean @@ -160,14 +160,14 @@ theorem bot_boxes : (⊥ : Prepartition I).boxes = ∅ := rfl /-- An auxiliary lemma used to prove that the same point can't belong to more than `2 ^ Fintype.card ι` closed boxes of a prepartition. -/ -theorem injOn_setOf_mem_Icc_setOf_lower_eq (x : ι → ℝ) : +theorem injOn_setOfPred_mem_Icc_setOfPred_lower_eq (x : ι → ℝ) : InjOn (fun J : Box ι => { i | J.lower i = x i }) { J | J ∈ π ∧ x ∈ Box.Icc J } := by rintro J₁ ⟨h₁, hx₁⟩ J₂ ⟨h₂, hx₂⟩ (H : { i | J₁.lower i = x i } = { i | J₂.lower i = x i }) suffices ∀ i, (Ioc (J₁.lower i) (J₁.upper i) ∩ Ioc (J₂.lower i) (J₂.upper i)).Nonempty by choose y hy₁ hy₂ using this exact π.eq_of_mem_of_mem h₁ h₂ hy₁ hy₂ intro i - simp only [Set.ext_iff, mem_setOf] at H + simp only [Set.ext_iff, mem_ofPred] at H rcases (hx₁.1 i).eq_or_lt with hi₁ | hi₁ · have hi₂ : J₂.lower i = x i := (H _).1 hi₁ have H₁ : x i < J₁.upper i := by simpa only [hi₁] using J₁.lower_lt_upper i @@ -177,6 +177,9 @@ theorem injOn_setOf_mem_Icc_setOf_lower_eq (x : ι → ℝ) : · have hi₂ : J₂.lower i < x i := (hx₂.1 i).lt_of_ne (mt (H _).2 hi₁.ne) exact ⟨x i, ⟨hi₁, hx₁.2 i⟩, ⟨hi₂, hx₂.2 i⟩⟩ +@[deprecated (since := "2026-07-09")] +alias injOn_setOf_mem_Icc_setOf_lower_eq := injOn_setOfPred_mem_Icc_setOfPred_lower_eq + open scoped Classical in /-- The set of boxes of a prepartition that contain `x` in their closures has cardinality at most `2 ^ Fintype.card ι`. -/ @@ -185,7 +188,7 @@ theorem card_filter_mem_Icc_le [Fintype ι] (x : ι → ℝ) : rw [← Fintype.card_set] refine Finset.card_le_card_of_injOn (fun J : Box ι => { i | J.lower i = x i }) (fun _ _ => Finset.mem_univ _) ?_ - simpa using π.injOn_setOf_mem_Icc_setOf_lower_eq x + simpa using π.injOn_setOfPred_mem_Icc_setOfPred_lower_eq x /-- Given a prepartition `π : BoxIntegral.Prepartition I`, `π.iUnion` is the part of `I` covered by the boxes of `π`. -/ diff --git a/Mathlib/Analysis/BoxIntegral/Partition/Filter.lean b/Mathlib/Analysis/BoxIntegral/Partition/Filter.lean index 9bd1813fa24e48..17cdf2d8ec4da7 100644 --- a/Mathlib/Analysis/BoxIntegral/Partition/Filter.lean +++ b/Mathlib/Analysis/BoxIntegral/Partition/Filter.lean @@ -449,7 +449,7 @@ theorem hasBasis_toFilteriUnion (l : IntegrationParams) (I : Box ι) (π₀ : Pr (l.toFilteriUnion I π₀).HasBasis (fun r : ℝ≥0 → (ι → ℝ) → Ioi (0 : ℝ) => ∀ c, l.RCond (r c)) fun r => { π | ∃ c, l.MemBaseSet I c (r c) π ∧ π.iUnion = π₀.iUnion } := by have := fun c => l.hasBasis_toFilterDistortioniUnion I c π₀ - simpa only [setOf_and, setOf_exists] using! hasBasis_iSup this + simpa only [ofPred_and, ofPred_exists] using! hasBasis_iSup this theorem hasBasis_toFilteriUnion_top (l : IntegrationParams) (I : Box ι) : (l.toFilteriUnion I ⊤).HasBasis (fun r : ℝ≥0 → (ι → ℝ) → Ioi (0 : ℝ) => ∀ c, l.RCond (r c)) @@ -460,7 +460,7 @@ theorem hasBasis_toFilteriUnion_top (l : IntegrationParams) (I : Box ι) : theorem hasBasis_toFilter (l : IntegrationParams) (I : Box ι) : (l.toFilter I).HasBasis (fun r : ℝ≥0 → (ι → ℝ) → Ioi (0 : ℝ) => ∀ c, l.RCond (r c)) fun r => { π | ∃ c, l.MemBaseSet I c (r c) π } := by - simpa only [setOf_exists] using! hasBasis_iSup (l.hasBasis_toFilterDistortion I) + simpa only [ofPred_exists] using! hasBasis_iSup (l.hasBasis_toFilterDistortion I) theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J) : Tendsto (TaggedPrepartition.embedBox I J h) (l.toFilteriUnion I ⊤) @@ -471,7 +471,7 @@ theorem tendsto_embedBox_toFilteriUnion_top (l : IntegrationParams) (h : I ≤ J refine ((l.hasBasis_toFilterDistortioniUnion I c ⊤).tendsto_iff (l.hasBasis_toFilterDistortioniUnion J _ _)).2 fun r hr => ?_ refine ⟨r, hr, fun π hπ => ?_⟩ - rw [mem_setOf_eq, Prepartition.iUnion_top] at hπ + rw [mem_ofPred_eq, Prepartition.iUnion_top] at hπ refine ⟨⟨hπ.1.1, hπ.1.2, fun hD => le_trans (hπ.1.3 hD) (le_max_left _ _), fun _ => ?_⟩, ?_⟩ · refine ⟨_, π₀.iUnion_compl.trans ?_, le_max_right _ _⟩ congr 1 diff --git a/Mathlib/Analysis/BoxIntegral/Partition/Measure.lean b/Mathlib/Analysis/BoxIntegral/Partition/Measure.lean index 7592beab86c6ba..843f3edc8f544a 100644 --- a/Mathlib/Analysis/BoxIntegral/Partition/Measure.lean +++ b/Mathlib/Analysis/BoxIntegral/Partition/Measure.lean @@ -67,11 +67,11 @@ end Countable variable [Fintype ι] -theorem coe_ae_eq_Icc : (I : Set (ι → ℝ)) =ᵐ[volume] Box.Icc I := by +theorem coe_ae_eq_Icc : (I : Set (ι → ℝ)) =ᵐˢ[volume] Box.Icc I := by rw [coe_eq_pi] exact Measure.univ_pi_Ioc_ae_eq_Icc -theorem Ioo_ae_eq_Icc : Box.Ioo I =ᵐ[volume] Box.Icc I := +theorem Ioo_ae_eq_Icc : Box.Ioo I =ᵐˢ[volume] Box.Icc I := Measure.univ_pi_Ioo_ae_eq_Icc end Box diff --git a/Mathlib/Analysis/BoxIntegral/Partition/Split.lean b/Mathlib/Analysis/BoxIntegral/Partition/Split.lean index b02d5ddc5dbe5d..216ae4b3b3fff4 100644 --- a/Mathlib/Analysis/BoxIntegral/Partition/Split.lean +++ b/Mathlib/Analysis/BoxIntegral/Partition/Split.lean @@ -63,7 +63,7 @@ def splitLower (I : Box ι) (i : ι) (x : ℝ) : WithBot (Box ι) := theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by rw [splitLower, coe_mk'] ext y - simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, ← Pi.le_def, + simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_ofPred_eq, forall_and, ← Pi.le_def, le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j ≤ upper I j) i, mem_def] rw [and_comm (a := y i ≤ x)] @@ -101,7 +101,7 @@ theorem coe_splitUpper : (splitUpper I i x : Set (ι → ℝ)) = ↑I ∩ { y | classical rw [splitUpper, coe_mk'] ext y - simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, + simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_ofPred_eq, forall_and, forall_update_iff I.lower fun j z => z < y j, max_lt_iff, and_assoc (a := x < y i), and_forall_ne (p := fun j => lower I j < y j) i, mem_def] exact and_comm @@ -173,7 +173,7 @@ theorem mem_split_iff' : J ∈ split I i x ↔ @[simp] theorem iUnion_split (I : Box ι) (i : ι) (x : ℝ) : (split I i x).iUnion = I := by - simp [split, ← inter_union_distrib_left, ← setOf_or, le_or_gt] + simp [split, ← inter_union_distrib_left, ← ofPred_or, le_or_gt] theorem isPartitionSplit (I : Box ι) (i : ι) (x : ℝ) : IsPartition (split I i x) := isPartition_iff_iUnion_eq.2 <| iUnion_split I i x diff --git a/Mathlib/Analysis/BoxIntegral/UnitPartition.lean b/Mathlib/Analysis/BoxIntegral/UnitPartition.lean index 2caace409304a7..949f0d7dce6d20 100644 --- a/Mathlib/Analysis/BoxIntegral/UnitPartition.lean +++ b/Mathlib/Analysis/BoxIntegral/UnitPartition.lean @@ -208,7 +208,7 @@ theorem setFinite_index {s : Set (ι → ℝ)} (hs₁ : NullMeasurableSet s) (hs · exact ((Disjoint.inter_right _ (disjoint.mp h)).inter_left _).aedisjoint · exact lt_top_iff_ne_top.mp <| measure_lt_top_of_subset (by simp only [Set.iUnion_subset_iff, Set.inter_subset_right, implies_true]) hs₂ - · rw [Set.mem_setOf, Set.inter_eq_self_of_subset_left hν, volume_box] + · rw [Set.mem_ofPred, Set.inter_eq_self_of_subset_left hν, volume_box] /-- For `B : BoxIntegral.Box`, the set of indices of `unitPartition.box` that are subsets of `B`. This is a finite set. These boxes cover `B` if it has integral vertices, see @@ -220,7 +220,7 @@ def admissibleIndex (B : Box ι) : Finset (ι → ℤ) := by variable {n} in theorem mem_admissibleIndex_iff {B : Box ι} {ν : ι → ℤ} : ν ∈ admissibleIndex n B ↔ box n ν ≤ B := by - rw [admissibleIndex, Set.Finite.mem_toFinset, Set.mem_setOf_eq, Box.coe_subset_coe] + rw [admissibleIndex, Set.Finite.mem_toFinset, Set.mem_ofPred_eq, Box.coe_subset_coe] open scoped Classical in /-- For `B : BoxIntegral.Box`, the `TaggedPrepartition` formed by the set of all diff --git a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Commute.lean b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Commute.lean index 14eb52c7561fd5..1fa2f8b2e31793 100644 --- a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Commute.lean +++ b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Commute.lean @@ -59,7 +59,7 @@ protected theorem Commute.cfcHom {a b : A} (ha : p a) (hb₁ : Commute a b) | add f g hf hg => rw [map_add]; exact hf.add_left hg | mul f g hf hg => rw [map_mul]; exact mul_left hf hg | frequently f hf => - rw [commute_iff_eq, ← Set.mem_setOf (p := fun x => x * b = b * x), + rw [commute_iff_eq, ← Set.mem_ofPred (p := fun x => x * b = b * x), ← (isClosed_eq (by fun_prop) (by fun_prop)).closure_eq] apply mem_closure_of_frequently_of_tendsto hf exact cfcHom_continuous ha |>.tendsto _ @@ -144,7 +144,7 @@ protected theorem Commute.cfcₙHom {a b : A} (ha : p a) (hb₁ : Commute a b) | add f g hf hg => rw [map_add]; exact hf.add_left hg | mul f g hf hg => rw [map_mul]; exact mul_left hf hg | frequently f hf => - rw [commute_iff_eq, ← Set.mem_setOf (p := fun x => x * b = b * x), + rw [commute_iff_eq, ← Set.mem_ofPred (p := fun x => x * b = b * x), ← (isClosed_eq (by fun_prop) (by fun_prop)).closure_eq] apply mem_closure_of_frequently_of_tendsto hf exact cfcₙHom_continuous ha |>.tendsto _ diff --git a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Continuity.lean b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Continuity.lean index e423b7abf9d708..698cc548bb794d 100644 --- a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Continuity.lean +++ b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Continuity.lean @@ -220,7 +220,7 @@ theorem continuous_cfcHomSuperset_left apply continuous_of_uniform_approx_of_continuous rw [Metric.uniformity_basis_dist_le.forall_iff (by aesop)] intro ε hε - simp only [Set.mem_setOf_eq, dist_eq_norm] + simp only [Set.mem_ofPred_eq, dist_eq_norm] obtain ⟨g, hg, g_cont⟩ := frequently_iff.mp hf (Metric.closedBall_mem_nhds f hε) simp only [Metric.mem_closedBall, dist_comm g, dist_eq_norm] at hg refine ⟨_, g_cont, fun x ↦ ?_⟩ @@ -422,7 +422,7 @@ theorem continuousOn_cfc_nnreal {s : Set ℝ≥0} (hs : IsCompact s) intro x hx simpa refine continuousOn_cfc A (hs.image NNReal.continuous_coe) _ hf |>.mono fun a ha ↦ ?_ - simp only [Set.mem_setOf_eq, nonneg_iff_isSelfAdjoint_and_quasispectrumRestricts] at ha ⊢ + simp only [Set.mem_ofPred_eq, nonneg_iff_isSelfAdjoint_and_quasispectrumRestricts] at ha ⊢ rw [← SpectrumRestricts] at ha refine ⟨ha.1.1, ?_⟩ rw [← ha.1.2.algebraMap_image] @@ -754,7 +754,7 @@ theorem continuous_cfcₙHomSuperset_left apply continuous_of_uniform_approx_of_continuous rw [Metric.uniformity_basis_dist_le.forall_iff (by aesop)] intro ε hε - simp only [Set.mem_setOf_eq, dist_eq_norm] + simp only [Set.mem_ofPred_eq, dist_eq_norm] obtain ⟨g, hg, g_cont⟩ := frequently_iff.mp hf (Metric.closedBall_mem_nhds f hε) simp only [Metric.mem_closedBall, dist_comm g, dist_eq_norm] at hg refine ⟨_, g_cont, fun x ↦ ?_⟩ @@ -778,7 +778,7 @@ theorem continuousOn_cfcₙ {s : Set 𝕜} (hs : IsCompact s) (f : 𝕜 → 𝕜 x rw [cfcₙHomSuperset_apply, Set.restrict_apply, cfcₙ_apply _ _ (hf.mono x.2.2) hf0 x.2.1] congr! - · convert! continuousOn_empty _ + · convert continuousOn_empty _ using 1 rw [Set.eq_empty_iff_forall_notMem] exact fun a ha ↦ hs0 <| ha.2 <| quasispectrum.zero_mem 𝕜 a @@ -973,7 +973,7 @@ theorem continuousOn_cfcₙ_nnreal {s : Set ℝ≥0} (hs : IsCompact s) (f : ℝ intro x hx simpa refine continuousOn_cfcₙ A (hs.image NNReal.continuous_coe) _ hf |>.mono fun a ha ↦ ?_ - simp only [Set.mem_setOf_eq, nonneg_iff_isSelfAdjoint_and_quasispectrumRestricts] at ha ⊢ + simp only [Set.mem_ofPred_eq, nonneg_iff_isSelfAdjoint_and_quasispectrumRestricts] at ha ⊢ refine ⟨ha.1.1, ?_⟩ rw [← ha.1.2.algebraMap_image] exact Set.image_mono ha.2 diff --git a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Order.lean b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Order.lean index 796f98de0f49ad..0046479cf9d6f9 100644 --- a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Order.lean +++ b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Order.lean @@ -482,11 +482,12 @@ lemma isClosed_nonneg : IsClosed {a : A | 0 ≤ a} := by rw [Unitization.isometry_inr (𝕜 := ℂ) |>.isClosedEmbedding.isClosed_iff_image_isClosed] convert! this.inter <| (Unitization.isometry_inr (𝕜 := ℂ)).isClosedEmbedding.isClosed_range ext a - simp only [Set.mem_image, Set.mem_setOf_eq, Set.mem_inter_iff, Set.mem_range, ← exists_and_left] + simp only [Set.mem_image, Set.mem_ofPred_eq, Set.mem_inter_iff, Set.mem_range, + ← exists_and_left] congr! 2 with x exact and_congr_left fun h ↦ by simp [← h] simp only [nonneg_iff_isSelfAdjoint_and_quasispectrumRestricts, - and_congr_right (SpectrumRestricts.nnreal_iff_nnnorm · le_rfl), Set.setOf_and] + and_congr_right (SpectrumRestricts.nnreal_iff_nnnorm · le_rfl), Set.ofPred_and] refine isClosed_eq ?_ ?_ |>.inter <| isClosed_le ?_ ?_ all_goals fun_prop diff --git a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Range.lean b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Range.lean index d5c57f6db61e4f..2bca9810f587b1 100644 --- a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Range.lean +++ b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Range.lean @@ -125,7 +125,7 @@ variable [ContinuousStar A] [StarModule ℝ A] lemma range_cfc_nnreal_subset [ContinuousFunctionalCalculus ℝ A IsSelfAdjoint] (a : A) (ha : 0 ≤ a := by cfc_tac) : Set.range (cfc (R := ℝ≥0) · a) ⊆ {x | x ∈ StarAlgebra.elemental ℝ a ∧ 0 ≤ x} := by - grw [range_cfc_nnreal_eq_image_cfc_real a ha, Set.setOf_and, SetLike.setOf_mem_eq, + grw [range_cfc_nnreal_eq_image_cfc_real a ha, Set.ofPred_and, SetLike.setOfPred_mem_eq, ← range_cfc_subset ℝ ha.isSelfAdjoint, Set.inter_comm, ← Set.image_preimage_eq_inter_range] exact Set.image_mono fun _ ↦ cfc_nonneg @@ -133,7 +133,7 @@ lemma range_cfc_nnreal [ClosedEmbeddingContinuousFunctionalCalculus ℝ A IsSelfAdjoint] (a : A) (ha : 0 ≤ a) : Set.range (cfc (R := ℝ≥0) · a) = {x | x ∈ StarAlgebra.elemental ℝ a ∧ 0 ≤ x} := by apply subset_antisymm (range_cfc_nnreal_subset a ha) - rw [range_cfc_nnreal_eq_image_cfc_real a ha, Set.setOf_and, SetLike.setOf_mem_eq, + rw [range_cfc_nnreal_eq_image_cfc_real a ha, Set.ofPred_and, SetLike.setOfPred_mem_eq, ← range_cfc _ ha.isSelfAdjoint, Set.inter_comm, ← Set.image_preimage_eq_inter_range] rintro _ ⟨f, hf, rfl⟩ exact cfc_cases _ a f ⟨0, by simp, by simp⟩ fun hf' ha' ↦ @@ -235,18 +235,18 @@ variable [StarModule ℝ A] [ContinuousStar A] [ContinuousConstSMul ℝ A] lemma range_cfcₙ_nnreal_subset [NonUnitalContinuousFunctionalCalculus ℝ A IsSelfAdjoint] (a : A) (ha : 0 ≤ a := by cfc_tac) : Set.range (cfcₙ (R := ℝ≥0) · a) ⊆ {x | x ∈ NonUnitalStarAlgebra.elemental ℝ a ∧ 0 ≤ x} := by - grw [range_cfcₙ_nnreal_eq_image_cfcₙ_real a ha, Set.setOf_and, SetLike.setOf_mem_eq, + grw [range_cfcₙ_nnreal_eq_image_cfcₙ_real a ha, Set.ofPred_and, SetLike.setOfPred_mem_eq, ← range_cfcₙ_subset _ ha.isSelfAdjoint, Set.inter_comm, ← Set.image_preimage_eq_inter_range] exact Set.image_mono fun _ ↦ cfcₙ_nonneg lemma range_cfcₙ_nnreal [NonUnitalClosedEmbeddingContinuousFunctionalCalculus ℝ A IsSelfAdjoint] (a : A) (ha : 0 ≤ a := by cfc_tac) : Set.range (cfcₙ (R := ℝ≥0) · a) = {x | x ∈ NonUnitalStarAlgebra.elemental ℝ a ∧ 0 ≤ x} := by - rw [range_cfcₙ_nnreal_eq_image_cfcₙ_real a ha, Set.setOf_and, SetLike.setOf_mem_eq, + rw [range_cfcₙ_nnreal_eq_image_cfcₙ_real a ha, Set.ofPred_and, SetLike.setOfPred_mem_eq, ← range_cfcₙ _ ha.isSelfAdjoint, Set.inter_comm, ← Set.image_preimage_eq_inter_range] refine Set.Subset.antisymm (Set.image_mono (fun _ ↦ cfcₙ_nonneg)) ?_ rintro _ ⟨f, hf, rfl⟩ - simp only [Set.preimage_setOf_eq, Set.mem_setOf_eq, Set.mem_image] at hf ⊢ + simp only [Set.preimage_ofPred_eq, Set.mem_ofPred_eq, Set.mem_image] at hf ⊢ obtain (⟨h₁, h₂, h₃⟩ | h | h | h) := by simpa only [not_and_or] using em (ContinuousOn f (quasispectrum ℝ a) ∧ f 0 = 0 ∧ IsSelfAdjoint a) diff --git a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unitary.lean b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unitary.lean index 28dc156f35cfef..4326a7841cbedb 100644 --- a/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unitary.lean +++ b/Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Unitary.lean @@ -29,7 +29,7 @@ variable [Algebra R A] [ContinuousFunctionalCalculus R A p] lemma cfc_unitary_iff (f : R → R) (a : A) (ha : p a := by cfc_tac) (hf : ContinuousOn f (spectrum R a) := by cfc_cont_tac) : cfc f a ∈ unitary A ↔ ∀ x ∈ spectrum R a, star (f x) * f x = 1 := by - simp only [unitary, Submonoid.mem_mk, Subsemigroup.mem_mk, Set.mem_setOf_eq] + simp only [unitary, Submonoid.mem_mk, Subsemigroup.mem_mk, Set.mem_ofPred_eq] rw [← IsStarNormal.cfc_map (p := p) f a |>.star_comm_self |>.eq, and_self, ← cfc_one R a, ← cfc_star, ← cfc_mul .., cfc_eq_cfc_iff_eqOn] exact Iff.rfl diff --git a/Mathlib/Analysis/CStarAlgebra/Extreme.lean b/Mathlib/Analysis/CStarAlgebra/Extreme.lean index aa45572a6a0ff4..7bf7715670618e 100644 --- a/Mathlib/Analysis/CStarAlgebra/Extreme.lean +++ b/Mathlib/Analysis/CStarAlgebra/Extreme.lean @@ -24,11 +24,11 @@ variable {A : Type*} [NonUnitalCStarAlgebra A] /-- The star projections in a non-unital C⋆-algebra are exactly the extreme points of the nonnegative closed unit ball. -/ -theorem isStarProjection_iff_mem_extremePoints_setOf_nonneg_inter_unitClosedBall +theorem isStarProjection_iff_mem_extremePoints_setOfPred_nonneg_inter_unitClosedBall [PartialOrder A] [StarOrderedRing A] {e : A} : IsStarProjection e ↔ e ∈ extremePoints ℝ ({x : A | 0 ≤ x} ∩ closedBall 0 1) := by simp only [mem_closedBall_zero_iff, mem_extremePoints_iff_left, mem_inter_iff, - mem_setOf_eq, and_imp] + mem_ofPred_eq, and_imp] refine ⟨fun he ↦ ⟨⟨he.nonneg, he.norm_le⟩, fun a ha ha1 b hb hb1 ⟨t, s, h0t, h0s, hts, hlin⟩ ↦ ?_⟩, fun ⟨⟨h1, h2⟩, h3⟩ ↦ ?_⟩ · /- Suppose `e` is a star projection, and `a` and `b` are in the nonnegative closed unit ball @@ -83,3 +83,7 @@ theorem isStarProjection_iff_mem_extremePoints_setOf_nonneg_inter_unitClosedBall · rw [← norm_inr (𝕜 := ℂ), norm_le_one_iff_of_nonneg _ this, ← sub_nonneg] calc 0 ≤ star (1 - e : A⁺¹) * (1 - e) := star_mul_self_nonneg _ _ = _ := by simp [LE.le.star_eq, h1, mul_sub, sub_mul, two_smul, sub_sub, add_sub] + +@[deprecated (since := "2026-07-09")] +alias isStarProjection_iff_mem_extremePoints_setOf_nonneg_inter_unitClosedBall := + isStarProjection_iff_mem_extremePoints_setOfPred_nonneg_inter_unitClosedBall diff --git a/Mathlib/Analysis/CStarAlgebra/Multiplier.lean b/Mathlib/Analysis/CStarAlgebra/Multiplier.lean index 2e7e3627c8e6b8..5ba03960d1c82d 100644 --- a/Mathlib/Analysis/CStarAlgebra/Multiplier.lean +++ b/Mathlib/Analysis/CStarAlgebra/Multiplier.lean @@ -522,7 +522,7 @@ theorem isUniformEmbedding_toProdMulOpposite : instance [CompleteSpace A] : CompleteSpace 𝓜(𝕜, A) := by rw [completeSpace_iff_isComplete_range isUniformEmbedding_toProdMulOpposite.isUniformInducing] apply IsClosed.isComplete - simp only [range_toProdMulOpposite, Set.setOf_forall] + simp only [range_toProdMulOpposite, Set.ofPred_forall] exact isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ isClosed_eq (by fun_prop) (by fun_prop) variable [StarRing A] [CStarRing A] diff --git a/Mathlib/Analysis/CStarAlgebra/Spectrum.lean b/Mathlib/Analysis/CStarAlgebra/Spectrum.lean index d821cfa99d5166..7588b126ff5d17 100644 --- a/Mathlib/Analysis/CStarAlgebra/Spectrum.lean +++ b/Mathlib/Analysis/CStarAlgebra/Spectrum.lean @@ -209,10 +209,7 @@ theorem selfAdjoint.val_re_map_spectrum (a : selfAdjoint A) : lemma IsSelfAdjoint.isConnected_spectrum_compl {a : A} (ha : IsSelfAdjoint a) : IsConnected (σ ℂ a)ᶜ := by suffices IsConnected (((σ ℂ a)ᶜ ∩ {z | 0 ≤ z.im}) ∪ (σ ℂ a)ᶜ ∩ {z | z.im ≤ 0}) by - rw [← Set.inter_union_distrib_left, ← Set.setOf_or] at this - rw [← Set.inter_univ (σ ℂ a)ᶜ] - convert this - exact Eq.symm <| Set.eq_univ_of_forall (fun z ↦ le_total 0 z.im) + simpa [← Set.inter_union_distrib_left, ← Set.ofPred_or, le_total] using this refine IsConnected.union ?nonempty ?upper ?lower case nonempty => have := Filter.NeBot.nonempty_of_mem inferInstance <| Filter.mem_map.mp <| @@ -222,7 +219,7 @@ lemma IsSelfAdjoint.isConnected_spectrum_compl {a : A} (ha : IsSelfAdjoint a) : case' lower => apply Complex.isConnected_of_lowerHalfPlane ?_ <| Set.inter_subset_right all_goals refine Set.subset_inter (fun z hz hz' ↦ ?_) (fun _ ↦ by simpa using le_of_lt) - rw [Set.mem_setOf_eq, ha.im_eq_zero_of_mem_spectrum hz'] at hz + rw [Set.mem_ofPred_eq, ha.im_eq_zero_of_mem_spectrum hz'] at hz simp_all namespace StarSubalgebra diff --git a/Mathlib/Analysis/CStarAlgebra/Unitary/Connected.lean b/Mathlib/Analysis/CStarAlgebra/Unitary/Connected.lean index ac8d947d77b276..9626220b152d1b 100644 --- a/Mathlib/Analysis/CStarAlgebra/Unitary/Connected.lean +++ b/Mathlib/Analysis/CStarAlgebra/Unitary/Connected.lean @@ -225,10 +225,10 @@ lemma Unitary.continuousOn_argSelfAdjoint : apply ContinuousOn.image_comp_continuous ?_ continuous_subtype_val apply continuousOn_cfc A (s := sphere 0 1 ∩ {z | 2 * (1 - z.re) ≤ ε}) ?_ _ ?_ |>.mono · rintro - ⟨v, hv, rfl⟩ - simp only [Set.subset_inter_iff, Set.mem_setOf_eq] + simp only [Set.subset_inter_iff, Set.mem_ofPred_eq] refine ⟨inferInstance, spectrum_subset_circle v, ?_⟩ intro z hz - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] trans ‖(v - 1 : A)‖ ^ 2 · exact two_mul_one_sub_le_norm_sub_one_sq v.2 hz · refine Real.le_sqrt (by positivity) (by positivity) |>.mp ?_ diff --git a/Mathlib/Analysis/Calculus/BumpFunction/SmoothApprox.lean b/Mathlib/Analysis/Calculus/BumpFunction/SmoothApprox.lean index 80dd4cd7c301e8..67c4ec8a525ff5 100644 --- a/Mathlib/Analysis/Calculus/BumpFunction/SmoothApprox.lean +++ b/Mathlib/Analysis/Calculus/BumpFunction/SmoothApprox.lean @@ -13,7 +13,7 @@ public import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension In this file we prove that smooth functions are dense in the set of continuous functions from a real finite-dimensional vector space to a Banach space, -see `ContinuousMap.dense_setOf_contDiff`. +see `ContinuousMap.dense_setOfPred_contDiff`. We also prove several unbundled versions of this statement. The heavy part of the proof is done upstream in `ContDiffBump.dist_normed_convolution_le` @@ -52,11 +52,11 @@ theorem UniformContinuous.exists_contDiff_dist_le (hf : UniformContinuous f) (h exact ⟨g, hgc, fun a ↦ (hg a _ fun _ h ↦ (hfδ h).le).trans_lt (half_lt_self hε)⟩ /-- Infinitely smooth functions are dense in the space of continuous functions. -/ -theorem ContinuousMap.dense_setOf_contDiff : Dense {f : C(E, F) | ContDiff ℝ ∞ f} := by +theorem ContinuousMap.dense_setOfPred_contDiff : Dense {f : C(E, F) | ContDiff ℝ ∞ f} := by intro f rw [mem_closure_iff_nhds_basis (nhds_basis_uniformity uniformity_basis_dist.compactConvergenceUniformity)] - simp only [Prod.forall, mem_setOf_eq, and_imp] + simp only [Prod.forall, mem_ofPred_eq, and_imp] intro K ε hK hε have : UniformContinuousOn f (cthickening 1 K) := hK.cthickening.uniformContinuousOn_of_continuous <| by fun_prop @@ -67,3 +67,6 @@ theorem ContinuousMap.dense_setOf_contDiff : Dense {f : C(E, F) | ContDiff ℝ rw [mem_ball, lt_min_iff] at hy exact hfδ _ (mem_cthickening_of_dist_le _ x _ _ hx hy.1.le) _ (self_subset_cthickening _ hx) hy.2 |>.le + +@[deprecated (since := "2026-07-09")] +alias ContinuousMap.dense_setOf_contDiff := ContinuousMap.dense_setOfPred_contDiff diff --git a/Mathlib/Analysis/Calculus/ContDiff/Basic.lean b/Mathlib/Analysis/Calculus/ContDiff/Basic.lean index 1b47d10f546325..21e8c7b3ca1bda 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Basic.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Basic.lean @@ -371,7 +371,7 @@ theorem HasFTaylorSeriesUpToOn.comp_continuousAffineMap · intro m hm x hx convert! (hA m).hasFDerivAt.comp_hasFDerivWithinAt x - ((hf.fderivWithin m hm (g x) hx).comp x g.hasFDerivWithinAt (Subset.refl _)) + ((hf.fderivWithin m hm (g x) hx).comp x g.hasFDerivWithinAt (mapsTo_preimage ..)) ext y v change p (g x) (Nat.succ m) (g.contLinear ∘ cons y v) = p (g x) m.succ (cons (g.contLinear y) (g.contLinear ∘ v)) diff --git a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean index aac7759c6a9585..73180a459466aa 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Defs.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Defs.lean @@ -302,11 +302,11 @@ theorem ContDiffWithinAt.congr_mono (h.mono h₁).congr h' hx theorem ContDiffWithinAt.congr_set (h : ContDiffWithinAt 𝕜 n f s x) {t : Set E} - (hst : s =ᶠ[𝓝 x] t) : ContDiffWithinAt 𝕜 n f t x := by + (hst : s =ᶠˢ[𝓝 x] t) : ContDiffWithinAt 𝕜 n f t x := by rw [← nhdsWithin_eq_iff_eventuallyEq] at hst apply h.mono_of_mem_nhdsWithin <| hst ▸ self_mem_nhdsWithin -theorem contDiffWithinAt_congr_set {t : Set E} (hst : s =ᶠ[𝓝 x] t) : +theorem contDiffWithinAt_congr_set {t : Set E} (hst : s =ᶠˢ[𝓝 x] t) : ContDiffWithinAt 𝕜 n f s x ↔ ContDiffWithinAt 𝕜 n f t x := ⟨fun h => h.congr_set hst, fun h => h.congr_set hst.symm⟩ @@ -793,7 +793,7 @@ theorem ContDiffWithinAt.differentiableWithinAt_iteratedFDerivWithin {m : ℕ} rcases h.contDiffOn' (ENat.add_one_natCast_le_withTop_of_lt hmn) (by simp [this]) with ⟨u, uo, xu, hu⟩ set t := insert x s ∩ u - have A : t =ᶠ[𝓝[≠] x] s := by + have A : t =ᶠˢ[𝓝[≠] x] s := by simp only [set_eventuallyEq_iff_inf_principal, ← nhdsWithin_inter'] rw [← inter_assoc, nhdsWithin_inter_of_mem', ← sdiff_eq_compl_inter, insert_sdiff_of_mem, sdiff_eq_compl_inter] diff --git a/Mathlib/Analysis/Calculus/ContDiff/FTaylorSeries.lean b/Mathlib/Analysis/Calculus/ContDiff/FTaylorSeries.lean index 084664a10b855d..8d835c4e468d59 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/FTaylorSeries.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/FTaylorSeries.lean @@ -579,7 +579,7 @@ protected theorem Set.EqOn.iteratedFDerivWithin (hs : EqOn f₁ f s) (n : ℕ) : EqOn (iteratedFDerivWithin 𝕜 n f₁ s) (iteratedFDerivWithin 𝕜 n f s) s := fun _x hx => iteratedFDerivWithin_congr hs hx n -theorem iteratedFDerivWithin_eventually_congr_set' (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) (n : ℕ) : +theorem iteratedFDerivWithin_eventually_congr_set' (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) (n : ℕ) : iteratedFDerivWithin 𝕜 n f s =ᶠ[𝓝 x] iteratedFDerivWithin 𝕜 n f t := by induction n generalizing x with | zero => rfl @@ -588,7 +588,7 @@ theorem iteratedFDerivWithin_eventually_congr_set' (y : E) (h : s =ᶠ[𝓝[{y} simp only [iteratedFDerivWithin_succ_eq_comp_left, (· ∘ ·)] rw [(ihn hy).fderivWithin_eq_of_nhds, fderivWithin_congr_set' _ hy] -theorem iteratedFDerivWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) (n : ℕ) : +theorem iteratedFDerivWithin_eventually_congr_set (h : s =ᶠˢ[𝓝 x] t) (n : ℕ) : iteratedFDerivWithin 𝕜 n f s =ᶠ[𝓝 x] iteratedFDerivWithin 𝕜 n f t := iteratedFDerivWithin_eventually_congr_set' x (h.filter_mono inf_le_left) n @@ -597,7 +597,7 @@ then the corresponding iterated derivatives are equal. Note that we also allow to puncture the neighborhood of `x` at `y`. If `y ≠ x`, then this is a no-op. -/ -theorem iteratedFDerivWithin_congr_set' {y} (h : s =ᶠ[𝓝[{y}ᶜ] x] t) (n : ℕ) : +theorem iteratedFDerivWithin_congr_set' {y} (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) (n : ℕ) : iteratedFDerivWithin 𝕜 n f s x = iteratedFDerivWithin 𝕜 n f t x := (iteratedFDerivWithin_eventually_congr_set' y h n).self_of_nhds @@ -607,7 +607,7 @@ theorem iteratedFDerivWithin_insert {n y} : iteratedFDerivWithin_congr_set' (y := x) (eventually_mem_nhdsWithin.mono <| by intros; simp_all).set_eq _ -theorem iteratedFDerivWithin_congr_set (h : s =ᶠ[𝓝 x] t) (n : ℕ) : +theorem iteratedFDerivWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) (n : ℕ) : iteratedFDerivWithin 𝕜 n f s x = iteratedFDerivWithin 𝕜 n f t x := (iteratedFDerivWithin_eventually_congr_set h n).self_of_nhds diff --git a/Mathlib/Analysis/Calculus/ContDiff/Operations.lean b/Mathlib/Analysis/Calculus/ContDiff/Operations.lean index fcd9c1301e8602..f886050d5be2f7 100644 --- a/Mathlib/Analysis/Calculus/ContDiff/Operations.lean +++ b/Mathlib/Analysis/Calculus/ContDiff/Operations.lean @@ -177,7 +177,7 @@ at this point. -/ @[fun_prop] theorem ContDiffWithinAt.add {s : Set E} {f g : E → F} (hf : ContDiffWithinAt 𝕜 n f s x) (hg : ContDiffWithinAt 𝕜 n g s x) : ContDiffWithinAt 𝕜 n (fun x => f x + g x) s x := - contDiff_add.contDiffWithinAt.comp x (hf.prodMk hg) subset_preimage_univ + contDiff_add.contDiffWithinAt.comp x (hf.prodMk hg) (mapsTo_univ ..) /-- The sum of two `C^n` functions at a point is `C^n` at this point. -/ @[fun_prop] @@ -211,7 +211,7 @@ The iterated derivative of the sum of two functions is the sum of the iterated d have hft : ContDiffOn 𝕜 i f (s ∩ t) := fun a ha ↦ (h (by simp_all)).1.mono inter_subset_left have hgt : ContDiffOn 𝕜 i g (s ∩ t) := fun a ha ↦ (h (by simp_all)).2.mono inter_subset_left have hut : UniqueDiffOn 𝕜 (s ∩ t) := hu.inter ht - have H : ↑(s ∩ t) =ᶠ[𝓝 x] s := + have H : ↑(s ∩ t) =ᶠˢ[𝓝 x] s := inter_eventuallyEq_left.mpr (eventually_of_mem (ht.mem_nhds hxt) (fun _ h _ ↦ h)) rw [← iteratedFDerivWithin_congr_set H, ← iteratedFDerivWithin_congr_set H, ← iteratedFDerivWithin_congr_set H] @@ -251,7 +251,7 @@ this point. -/ @[fun_prop] theorem ContDiffWithinAt.neg {s : Set E} {f : E → F} (hf : ContDiffWithinAt 𝕜 n f s x) : ContDiffWithinAt 𝕜 n (fun x => -f x) s x := - contDiff_neg.contDiffWithinAt.comp x hf subset_preimage_univ + contDiff_neg.contDiffWithinAt.comp x hf (mapsTo_univ ..) /-- The negative of a `C^n` function at a point is `C^n` at this point. -/ @[fun_prop] @@ -560,7 +560,7 @@ set at this point. -/ @[to_fun (attr := fun_prop)] theorem ContDiffWithinAt.smul {s : Set E} {f : E → 𝕜'} {g : E → F} (hf : ContDiffWithinAt 𝕜 n f s x) (hg : ContDiffWithinAt 𝕜 n g s x) : ContDiffWithinAt 𝕜 n (f • g) s x := - contDiff_smul.contDiffWithinAt.comp x (hf.prodMk hg) subset_preimage_univ + contDiff_smul.contDiffWithinAt.comp x (hf.prodMk hg) (mapsTo_univ ..) /-- The scalar multiplication of two `C^n` functions at a point is `C^n` at this point. -/ @[to_fun (attr := fun_prop)] diff --git a/Mathlib/Analysis/Calculus/Deriv/Basic.lean b/Mathlib/Analysis/Calculus/Deriv/Basic.lean index 89412bdad756e9..47794569428399 100644 --- a/Mathlib/Analysis/Calculus/Deriv/Basic.lean +++ b/Mathlib/Analysis/Calculus/Deriv/Basic.lean @@ -324,11 +324,11 @@ theorem HasDerivAtFilter.isBigO_sub_rev (hf : HasDerivAtFilter f f' L) (hf' : f' theorem HasStrictDerivAt.hasDerivAt (h : HasStrictDerivAt f f' x) : HasDerivAt f f' x := h.hasStrictFDerivAt.hasFDerivAt -theorem hasDerivWithinAt_congr_set' {s t : Set 𝕜} (y : 𝕜) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem hasDerivWithinAt_congr_set' {s t : Set 𝕜} (y : 𝕜) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : HasDerivWithinAt f f' s x ↔ HasDerivWithinAt f f' t x := hasFDerivWithinAt_congr_set' y h -theorem hasDerivWithinAt_congr_set {s t : Set 𝕜} (h : s =ᶠ[𝓝 x] t) : +theorem hasDerivWithinAt_congr_set {s t : Set 𝕜} (h : s =ᶠˢ[𝓝 x] t) : HasDerivWithinAt f f' s x ↔ HasDerivWithinAt f f' t x := hasFDerivWithinAt_congr_set h @@ -358,7 +358,7 @@ alias ⟨HasDerivWithinAt.Iic_of_Iio, HasDerivWithinAt.Iio_of_Iic⟩ := hasDeriv theorem HasDerivWithinAt.Ioi_iff_Ioo [LinearOrder 𝕜] [OrderClosedTopology 𝕜] {x y : 𝕜} (h : x < y) : HasDerivWithinAt f f' (Ioo x y) x ↔ HasDerivWithinAt f f' (Ioi x) x := - hasFDerivWithinAt_inter <| Iio_mem_nhds h + hasFDerivWithinAt_inter (s := Ioi x) <| Iio_mem_nhds h alias ⟨HasDerivWithinAt.Ioi_of_Ioo, HasDerivWithinAt.Ioo_of_Ioi⟩ := HasDerivWithinAt.Ioi_iff_Ioo @@ -494,10 +494,10 @@ theorem derivWithin_subset (st : s ⊆ t) (ht : UniqueDiffWithinAt 𝕜 s x) (h : DifferentiableWithinAt 𝕜 f t x) : derivWithin f s x = derivWithin f t x := ((DifferentiableWithinAt.hasDerivWithinAt h).mono st).derivWithin ht -theorem derivWithin_congr_set' (y : 𝕜) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem derivWithin_congr_set' (y : 𝕜) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : derivWithin f s x = derivWithin f t x := by simp only [derivWithin, fderivWithin_congr_set' y h] -theorem derivWithin_congr_set (h : s =ᶠ[𝓝 x] t) : derivWithin f s x = derivWithin f t x := by +theorem derivWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : derivWithin f s x = derivWithin f t x := by simp only [derivWithin, fderivWithin_congr_set h] @[simp] diff --git a/Mathlib/Analysis/Calculus/Deriv/Inv.lean b/Mathlib/Analysis/Calculus/Deriv/Inv.lean index e81a21975b47f2..9872e356f606bd 100644 --- a/Mathlib/Analysis/Calculus/Deriv/Inv.lean +++ b/Mathlib/Analysis/Calculus/Deriv/Inv.lean @@ -45,7 +45,7 @@ theorem hasStrictDerivAt_inv (hx : x ≠ 0) : HasStrictDerivAt Inv.inv (-(x ^ 2) refine .of_isLittleO <| this.congr' ?_ (Eventually.of_forall fun _ => mul_one _) refine Eventually.mono ((isOpen_ne.prod isOpen_ne).mem_nhds ⟨hx, hx⟩) ?_ rintro ⟨y, z⟩ ⟨hy, hz⟩ - simp only [mem_setOf_eq] at hy hz + simp only [mem_ofPred_eq] at hy hz simp [field] ring refine (isBigO_refl (fun p : 𝕜 × 𝕜 => p.1 - p.2) _).mul_isLittleO ((isLittleO_one_iff 𝕜).2 ?_) diff --git a/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean b/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean index bb2d7794ab3b86..cafe5f611063bc 100644 --- a/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean +++ b/Mathlib/Analysis/Calculus/Deriv/MeanValue.lean @@ -204,7 +204,7 @@ theorem not_differentiableWithinAt_of_deriv_tendsto_atTop_Ioi (f : ℝ → ℝ) refine nhdsWithin_eq_nhdsWithin' (s := Ioi a) (Ioi_mem_nhds hz''.1) ?_ simp only [Ioc_inter_Ioi, le_refl, sup_of_le_left] ext y - exact ⟨fun h => ⟨mem_Icc_of_Ioc h, mem_of_mem_inter_left h⟩, fun ⟨H1, H2⟩ => ⟨H2, H1.2⟩⟩ + exact ⟨fun h => ⟨mem_Icc_of_Ioc h, h.1⟩, fun ⟨H1, H2⟩ => ⟨H2, H1.2⟩⟩ rw [← hfinal] exact self_mem_nhdsWithin have hcont : ContinuousOn f (Icc a b) := by diff --git a/Mathlib/Analysis/Calculus/FDeriv/Congr.lean b/Mathlib/Analysis/Calculus/FDeriv/Congr.lean index fa50ff49921b4e..fbbf82dadb6236 100644 --- a/Mathlib/Analysis/Calculus/FDeriv/Congr.lean +++ b/Mathlib/Analysis/Calculus/FDeriv/Congr.lean @@ -39,7 +39,7 @@ section congr /-! ### congr properties of the derivative -/ -theorem hasFDerivWithinAt_congr_set_nhdsNE (h : s =ᶠ[𝓝[≠] x] t) : +theorem hasFDerivWithinAt_congr_set_nhdsNE (h : s =ᶠˢ[𝓝[≠] x] t) : HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x := calc HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' (s \ {x}) x := @@ -50,35 +50,35 @@ theorem hasFDerivWithinAt_congr_set_nhdsNE (h : s =ᶠ[𝓝[≠] x] t) : using h _ ↔ HasFDerivWithinAt f f' t x := hasFDerivWithinAt_sdiff_singleton_self -theorem hasFDerivWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem hasFDerivWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x := hasFDerivWithinAt_congr_set_nhdsNE <| h.filter_mono inf_le_left /-- In the case `y = x`, see also `hasFDerivWithinAt_congr_set_nhdsNE`, which does not require the domain to be a T₁ space. -/ theorem hasFDerivWithinAt_congr_set' [T1Space E] (y : E) - (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : + (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : HasFDerivWithinAt f f' s x ↔ HasFDerivWithinAt f f' t x := by rcases eq_or_ne x y with rfl | hne · exact hasFDerivWithinAt_congr_set_nhdsNE h · rw [hne.nhdsWithin_compl_singleton] at h exact hasFDerivWithinAt_congr_set h -theorem differentiableWithinAt_congr_set_nhdsNE (h : s =ᶠ[𝓝[≠] x] t) : +theorem differentiableWithinAt_congr_set_nhdsNE (h : s =ᶠˢ[𝓝[≠] x] t) : DifferentiableWithinAt 𝕜 f s x ↔ DifferentiableWithinAt 𝕜 f t x := exists_congr fun _ => hasFDerivWithinAt_congr_set_nhdsNE h /-- In the case `y = x`, see also `differentiableWithinAt_congr_set_nhdsNE`, which does not require the domain to be a T₁ space. -/ -theorem differentiableWithinAt_congr_set' [T1Space E] (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem differentiableWithinAt_congr_set' [T1Space E] (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : DifferentiableWithinAt 𝕜 f s x ↔ DifferentiableWithinAt 𝕜 f t x := exists_congr fun _ => hasFDerivWithinAt_congr_set' _ h -theorem differentiableWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem differentiableWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : DifferentiableWithinAt 𝕜 f s x ↔ DifferentiableWithinAt 𝕜 f t x := exists_congr fun _ => hasFDerivWithinAt_congr_set h -theorem fderivWithin_congr_set_nhdsNE (h : s =ᶠ[𝓝[≠] x] t) : +theorem fderivWithin_congr_set_nhdsNE (h : s =ᶠˢ[𝓝[≠] x] t) : fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x := by classical simp only [fderivWithin, differentiableWithinAt_congr_set_nhdsNE h, @@ -86,19 +86,19 @@ theorem fderivWithin_congr_set_nhdsNE (h : s =ᶠ[𝓝[≠] x] t) : /-- In the case `y = x`, see also `fderivWithin_congr_set_nhdsNE`, which does not require the domain to be a T₁ space. -/ -theorem fderivWithin_congr_set' [T1Space E] (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem fderivWithin_congr_set' [T1Space E] (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x := by classical simp only [fderivWithin, differentiableWithinAt_congr_set' _ h, hasFDerivWithinAt_congr_set' _ h] -theorem fderivWithin_congr_set (h : s =ᶠ[𝓝 x] t) : fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x := +theorem fderivWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : fderivWithin 𝕜 f s x = fderivWithin 𝕜 f t x := fderivWithin_congr_set_nhdsNE <| h.filter_mono inf_le_left -theorem fderivWithin_eventually_congr_set' [T1Space E] (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem fderivWithin_eventually_congr_set' [T1Space E] (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : fderivWithin 𝕜 f s =ᶠ[𝓝 x] fderivWithin 𝕜 f t := (eventually_nhds_nhdsWithin.2 h).mono fun _ => fderivWithin_congr_set' y -theorem fderivWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem fderivWithin_eventually_congr_set (h : s =ᶠˢ[𝓝 x] t) : fderivWithin 𝕜 f s =ᶠ[𝓝 x] fderivWithin 𝕜 f t := (eventually_eventually_nhds.2 h).mono fun _ => fderivWithin_congr_set diff --git a/Mathlib/Analysis/Calculus/FDeriv/Measurable.lean b/Mathlib/Analysis/Calculus/FDeriv/Measurable.lean index 691f26f39fbed8..fde670146f7d6e 100644 --- a/Mathlib/Analysis/Calculus/FDeriv/Measurable.lean +++ b/Mathlib/Analysis/Calculus/FDeriv/Measurable.lean @@ -793,7 +793,7 @@ open Uniformity lemma isOpen_A_with_param {r s : ℝ} (hf : Continuous f.uncurry) (L : E →L[𝕜] F) : IsOpen {p : α × E | p.2 ∈ A (f p.1) L r s} := by have : ProperSpace E := .of_locallyCompactSpace 𝕜 - simp only [A, mem_Ioc, mem_ball, map_sub, mem_setOf_eq] + simp only [A, mem_Ioc, mem_ball, map_sub, mem_ofPred_eq] apply isOpen_iff_mem_nhds.2 rintro ⟨a, x⟩ ⟨r', ⟨Irr', Ir'r⟩, hr⟩ rcases exists_between Irr' with ⟨t, hrt, htr'⟩ @@ -859,7 +859,7 @@ lemma isOpen_B_with_param {r s t : ℝ} (hf : Continuous f.uncurry) (K : Set (E IsOpen {p : α × E | p.2 ∈ B (f p.1) K r s t} := by suffices H : IsOpen (⋃ L ∈ K, {p : α × E | p.2 ∈ A (f p.1) L r t ∧ p.2 ∈ A (f p.1) L s t}) by - convert! H; ext p; simp [B] + convert! H; simp [B] refine isOpen_biUnion (fun L _ ↦ ?_) exact (isOpen_A_with_param hf L).inter (isOpen_A_with_param hf L) @@ -876,7 +876,7 @@ theorem measurableSet_of_differentiableAt_of_isComplete_with_param = {p : α × E | p.2 ∈ D (f p.1) K} := by simp [← differentiable_set_eq_D K hK] rw [this] simp only [D, mem_iInter, mem_iUnion] - simp only [setOf_forall, setOf_exists] + simp only [ofPred_forall, ofPred_exists] refine MeasurableSet.iInter (fun _ ↦ ?_) refine MeasurableSet.iUnion (fun _ ↦ ?_) refine MeasurableSet.iInter (fun _ ↦ ?_) diff --git a/Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean b/Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean index f6490c818ee8c8..5de7ed22c8ecb5 100644 --- a/Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean +++ b/Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean @@ -117,7 +117,7 @@ lemma fderivWithin_fderivWithin_eq_of_mem_nhdsWithin (h : t ∈ 𝓝[s] x) exact (hf.fderivWithin_right (m := 1) ht le_rfl (mem_of_mem_nhdsWithin hx h)).differentiableWithinAt one_ne_zero -lemma fderivWithin_fderivWithin_eq_of_eventuallyEq (h : s =ᶠ[𝓝 x] t) : +lemma fderivWithin_fderivWithin_eq_of_eventuallyEq (h : s =ᶠˢ[𝓝 x] t) : fderivWithin 𝕜 (fderivWithin 𝕜 f s) s x = fderivWithin 𝕜 (fderivWithin 𝕜 f t) t x := calc fderivWithin 𝕜 (fderivWithin 𝕜 f s) s x = fderivWithin 𝕜 (fderivWithin 𝕜 f t) s x := @@ -129,7 +129,7 @@ lemma fderivWithin_fderivWithin_eq_of_mem_nhds {f : E → F} {x : E} {s : Set E} fderivWithin 𝕜 (fderivWithin 𝕜 f s) s x = fderiv 𝕜 (fderiv 𝕜 f) x := by simp only [← fderivWithin_univ] apply fderivWithin_fderivWithin_eq_of_eventuallyEq - simp [h] + simp [-Set.mem_univ, h] @[simp] lemma isSymmSndFDerivWithinAt_univ : IsSymmSndFDerivWithinAt 𝕜 f univ x ↔ IsSymmSndFDerivAt 𝕜 f x := by @@ -144,12 +144,12 @@ theorem IsSymmSndFDerivWithinAt.mono_of_mem_nhdsWithin (h : IsSymmSndFDerivWithi exact h v w theorem IsSymmSndFDerivWithinAt.congr_set (h : IsSymmSndFDerivWithinAt 𝕜 f s x) - (hst : s =ᶠ[𝓝 x] t) : IsSymmSndFDerivWithinAt 𝕜 f t x := by + (hst : s =ᶠˢ[𝓝 x] t) : IsSymmSndFDerivWithinAt 𝕜 f t x := by intro v w rw [fderivWithin_fderivWithin_eq_of_eventuallyEq hst.symm] exact h v w -theorem isSymmSndFDerivWithinAt_congr_set (hst : s =ᶠ[𝓝 x] t) : +theorem isSymmSndFDerivWithinAt_congr_set (hst : s =ᶠˢ[𝓝 x] t) : IsSymmSndFDerivWithinAt 𝕜 f s x ↔ IsSymmSndFDerivWithinAt 𝕜 f t x := ⟨fun h ↦ h.congr_set hst, fun h ↦ h.congr_set hst.symm⟩ @@ -302,7 +302,7 @@ theorem Convex.taylor_approx_two_segment {v w : E} (hv : x + v ∈ interior s) refine ⟨?_, xt_mem t ⟨ht.1, ht.2.le⟩⟩ rw [add_assoc, add_mem_ball_iff_norm] exact I.trans_lt hδ - simpa only [mem_setOf_eq, add_assoc x, add_sub_cancel_left] using sδ H + simpa only [mem_ofPred_eq, add_assoc x, add_sub_cancel_left] using sδ H _ ≤ ε * (‖h • v‖ + ‖h • w‖) * ‖h • w‖ := by gcongr apply (norm_add_le _ _).trans @@ -589,7 +589,6 @@ theorem ContDiffWithinAt.isSymmSndFDerivWithinAt {n : ℕ∞ω} intro y hy apply fderivWithin_fderivWithin_eq_of_eventuallyEq filter_upwards [u_open.mem_nhds hy.2] with z hz - change (z ∈ s) = (z ∈ s ∩ u) simp_all have B : Tendsto (fun k ↦ fderivWithin 𝕜 (fderivWithin 𝕜 f s) s (y k)) atTop (𝓝 (fderivWithin 𝕜 (fderivWithin 𝕜 f s) s x)) := by diff --git a/Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean b/Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean index c868edf4a29c29..87223996a7f0f6 100644 --- a/Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean +++ b/Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean @@ -280,7 +280,7 @@ theorem order_zero : (0 : FormalMultilinearSeries 𝕜 E F).order = 0 := by simp theorem ne_zero_of_order_ne_zero (hp : p.order ≠ 0) : p ≠ 0 := fun h => by simp [h] at hp theorem order_eq_find [DecidablePred fun n => p n ≠ 0] (hp : ∃ n, p n ≠ 0) : - p.order = Nat.find hp := by convert! Nat.sInf_def hp + p.order = Nat.find hp := by convert! Nat.sInf_def (s := {n | p n ≠ 0}) hp theorem order_eq_find' [DecidablePred fun n => p n ≠ 0] (hp : p ≠ 0) : p.order = Nat.find (FormalMultilinearSeries.ne_iff.mp hp) := @@ -294,7 +294,7 @@ theorem order_eq_zero_iff (hp : p ≠ 0) : p.order = 0 ↔ p 0 ≠ 0 := by simp [order_eq_zero_iff', hp] theorem apply_order_ne_zero (hp : p ≠ 0) : p p.order ≠ 0 := - Nat.sInf_mem (FormalMultilinearSeries.ne_iff.1 hp) + Nat.sInf_mem (s := {n | p n ≠ 0}) (FormalMultilinearSeries.ne_iff.1 hp) theorem apply_order_ne_zero' (hp : p.order ≠ 0) : p p.order ≠ 0 := apply_order_ne_zero (ne_zero_of_order_ne_zero hp) diff --git a/Mathlib/Analysis/Calculus/Gradient/Basic.lean b/Mathlib/Analysis/Calculus/Gradient/Basic.lean index e954b2d8320958..093c64b70c75b2 100644 --- a/Mathlib/Analysis/Calculus/Gradient/Basic.lean +++ b/Mathlib/Analysis/Calculus/Gradient/Basic.lean @@ -257,11 +257,11 @@ theorem HasGradientAtFilter.isBigO_sub (h : HasGradientAtFilter f f' x L) : (fun x' => f x' - f x) =O[L] fun x' => x' - x := HasFDerivAtFilter.isBigO_sub h |>.comp_tendsto prod_pure.ge -theorem hasGradientWithinAt_congr_set' {s t : Set F} (y : F) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem hasGradientWithinAt_congr_set' {s t : Set F} (y : F) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : HasGradientWithinAt f f' s x ↔ HasGradientWithinAt f f' t x := hasFDerivWithinAt_congr_set' y h -theorem hasGradientWithinAt_congr_set {s t : Set F} (h : s =ᶠ[𝓝 x] t) : +theorem hasGradientWithinAt_congr_set {s t : Set F} (h : s =ᶠˢ[𝓝 x] t) : HasGradientWithinAt f f' s x ↔ HasGradientWithinAt f f' t x := hasFDerivWithinAt_congr_set h diff --git a/Mathlib/Analysis/Calculus/LineDeriv/Basic.lean b/Mathlib/Analysis/Calculus/LineDeriv/Basic.lean index 205985ca6109f2..15b18877e870f4 100644 --- a/Mathlib/Analysis/Calculus/LineDeriv/Basic.lean +++ b/Mathlib/Analysis/Calculus/LineDeriv/Basic.lean @@ -298,27 +298,27 @@ theorem lineDerivWithin_of_isOpen (hs : IsOpen s) (hx : x ∈ s) : lineDerivWithin 𝕜 f s x v = lineDeriv 𝕜 f x v := lineDerivWithin_of_mem_nhds (hs.mem_nhds hx) -theorem hasLineDerivWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem hasLineDerivWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : HasLineDerivWithinAt 𝕜 f f' s x v ↔ HasLineDerivWithinAt 𝕜 f f' t x v := by apply hasDerivWithinAt_congr_set let F := fun (t : 𝕜) ↦ x + t • v have B : ContinuousAt F 0 := by apply Continuous.continuousAt; fun_prop - have : s =ᶠ[𝓝 (F 0)] t := by convert! h; simp [F] + have : s =ᶠˢ[𝓝 (F 0)] t := by convert! h; simp [F] exact B.preimage_mem_nhds this -theorem lineDifferentiableWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem lineDifferentiableWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : LineDifferentiableWithinAt 𝕜 f s x v ↔ LineDifferentiableWithinAt 𝕜 f t x v := ⟨fun h' ↦ ((hasLineDerivWithinAt_congr_set h).1 h'.hasLineDerivWithinAt).lineDifferentiableWithinAt, fun h' ↦ ((hasLineDerivWithinAt_congr_set h.symm).1 h'.hasLineDerivWithinAt).lineDifferentiableWithinAt⟩ -theorem lineDerivWithin_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem lineDerivWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : lineDerivWithin 𝕜 f s x v = lineDerivWithin 𝕜 f t x v := by apply derivWithin_congr_set let F := fun (t : 𝕜) ↦ x + t • v have B : ContinuousAt F 0 := by apply Continuous.continuousAt; fun_prop - have : s =ᶠ[𝓝 (F 0)] t := by convert! h; simp [F] + have : s =ᶠˢ[𝓝 (F 0)] t := by convert! h; simp [F] exact B.preimage_mem_nhds this theorem Filter.EventuallyEq.hasLineDerivAt_iff (h : f₀ =ᶠ[𝓝 x] f₁) : @@ -398,7 +398,8 @@ theorem HasLineDerivAt.le_of_lip' {f : E → F} {f' : F} {x₀ : E} (hf : HasLin have A : Continuous (fun (t : 𝕜) ↦ x₀ + t • v) := by fun_prop have : ∀ᶠ x in 𝓝 (x₀ + (0 : 𝕜) • v), ‖f x - f x₀‖ ≤ C * ‖x - x₀‖ := by simpa using hlip filter_upwards [(A.continuousAt (x := 0)).preimage_mem_nhds this] with t ht - simp only [preimage_setOf_eq, add_sub_cancel_left, norm_smul, mem_setOf_eq, mul_comm (‖t‖)] at ht + simp only [preimage_ofPred_eq, add_sub_cancel_left, norm_smul, mem_ofPred_eq, + mul_comm (‖t‖)] at ht simpa [mul_assoc] using ht /-- Converse to the mean value inequality: if `f` is line differentiable at `x₀` and `C`-lipschitz @@ -433,7 +434,8 @@ theorem norm_lineDeriv_le_of_lip' {f : E → F} {x₀ : E} have A : Continuous (fun (t : 𝕜) ↦ x₀ + t • v) := by fun_prop have : ∀ᶠ x in 𝓝 (x₀ + (0 : 𝕜) • v), ‖f x - f x₀‖ ≤ C * ‖x - x₀‖ := by simpa using hlip filter_upwards [(A.continuousAt (x := 0)).preimage_mem_nhds this] with t ht - simp only [preimage_setOf_eq, add_sub_cancel_left, norm_smul, mem_setOf_eq, mul_comm (‖t‖)] at ht + simp only [preimage_ofPred_eq, add_sub_cancel_left, norm_smul, mem_ofPred_eq, + mul_comm (‖t‖)] at ht simpa [mul_assoc] using ht /-- Converse to the mean value inequality: if `f` is `C`-lipschitz on a neighborhood of `x₀` diff --git a/Mathlib/Analysis/Calculus/ParametricIntegral.lean b/Mathlib/Analysis/Calculus/ParametricIntegral.lean index a6a6365b699152..792d31e7a375dd 100644 --- a/Mathlib/Analysis/Calculus/ParametricIntegral.lean +++ b/Mathlib/Analysis/Calculus/ParametricIntegral.lean @@ -121,8 +121,8 @@ theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] ‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by apply mem_of_superset (ball_mem_nhds _ ε_pos) intro x x_in; simp only - rw [Set.mem_setOf_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, integral_sub, - ← ContinuousLinearMap.integral_apply hF'_int] + rw [Set.mem_ofPred_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, + integral_sub, ← ContinuousLinearMap.integral_apply hF'_int] exacts [hF_int' x x_in, hF_int, (hF_int' x x_in).sub hF_int, hF'_int.apply_continuousLinearMap _] rw [hasFDerivAt_iff_tendsto, tendsto_congr' this, ← tendsto_zero_iff_norm_tendsto_zero, ← diff --git a/Mathlib/Analysis/Calculus/SmoothSeries.lean b/Mathlib/Analysis/Calculus/SmoothSeries.lean index a4e9ff00e3668c..73b993187ce387 100644 --- a/Mathlib/Analysis/Calculus/SmoothSeries.lean +++ b/Mathlib/Analysis/Calculus/SmoothSeries.lean @@ -282,6 +282,6 @@ theorem contDiff_tsum_of_eventually (hf : ∀ i, ContDiff 𝕜 N (f i)) (hv k (hk.trans hm)).subtype _ refine contDiff_tsum (fun i => (hf i).of_le (mod_cast hm)) h'u ?_ rintro k ⟨i, hi⟩ x hk - simp only [t, T, Finite.mem_toFinset, mem_setOf_eq, Finset.mem_range, not_forall, not_le, + simp only [t, T, Finite.mem_toFinset, mem_ofPred_eq, Finset.mem_range, not_forall, not_le, exists_prop, not_exists, not_and, not_lt] at hi exact hi k (Nat.lt_succ_iff.2 (WithTop.coe_le_coe.1 hk)) x diff --git a/Mathlib/Analysis/Calculus/TangentCone/Basic.lean b/Mathlib/Analysis/Calculus/TangentCone/Basic.lean index 6b15b633c211e8..d436c99da89424 100644 --- a/Mathlib/Analysis/Calculus/TangentCone/Basic.lean +++ b/Mathlib/Analysis/Calculus/TangentCone/Basic.lean @@ -29,7 +29,7 @@ variable [AddCommGroup E] [SMul 𝕜 E] [TopologicalSpace E] {s t : Set E} {x : @[gcongr] theorem tangentConeAt_mono (h : s ⊆ t) : tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜 t x := by - simp only [tangentConeAt_def, setOf_subset_setOf] + simp only [tangentConeAt_def, ofPred_subset_ofPred] refine fun y hy ↦ hy.mono ?_ gcongr @@ -40,7 +40,7 @@ respect to `𝕜` is contained in the tangent cone of `s` at `x` with respect to theorem tangentConeAt_mono_field {𝕜' : Type*} [Monoid 𝕜'] [SMul 𝕜 𝕜'] [MulAction 𝕜' E] [IsScalarTower 𝕜 𝕜' E] : tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜' s x := by - simp only [tangentConeAt_def, setOf_subset_setOf] + simp only [tangentConeAt_def, ofPred_subset_ofPred] refine fun y hy ↦ hy.mono ?_ rw [← smul_one_smul (Filter 𝕜')] grw [le_top (a := ⊤ • 1)] @@ -49,7 +49,7 @@ theorem Filter.HasBasis.tangentConeAt_eq_biInter_closure {ι} {p : ι → Prop} (h : (𝓝 0).HasBasis p U) : tangentConeAt 𝕜 s x = ⋂ (i) (_ : p i), closure ((univ : Set 𝕜) • (U i ∩ (x + ·) ⁻¹' s)) := by ext y - simp only [tangentConeAt_def, mem_setOf_eq, mem_iInter₂, ← map₂_smul, ← map_prod_eq_map₂, + simp only [tangentConeAt_def, mem_ofPred_eq, mem_iInter₂, ← map₂_smul, ← map_prod_eq_map₂, ((nhdsWithin_hasBasis h _).top_prod.map _).clusterPt_iff_forall_mem_closure, image_prod, image2_smul] @@ -61,7 +61,7 @@ variable [ContinuousAdd E] theorem tangentConeAt_mono_nhds (h : 𝓝[s] x ≤ 𝓝[t] x) : tangentConeAt 𝕜 s x ⊆ tangentConeAt 𝕜 t x := by - simp only [tangentConeAt_def, setOf_subset_setOf] + simp only [tangentConeAt_def, ofPred_subset_ofPred] refine fun y hy ↦ hy.mono ?_ gcongr _ • ?_ rw [nhdsWithin_le_iff] diff --git a/Mathlib/Analysis/Calculus/TangentCone/Defs.lean b/Mathlib/Analysis/Calculus/TangentCone/Defs.lean index 73b3674a166318..f78390aa206123 100644 --- a/Mathlib/Analysis/Calculus/TangentCone/Defs.lean +++ b/Mathlib/Analysis/Calculus/TangentCone/Defs.lean @@ -113,7 +113,7 @@ This lemma provides a convenient way to unfold the definition of `tangentConeAt` theorem exists_fun_of_mem_tangentConeAt (h : y ∈ tangentConeAt R s x) : ∃ (α : Type (max u v)) (l : Filter α) (_hl : l.NeBot) (c : α → R) (d : α → E), Tendsto d l (𝓝 0) ∧ (∀ᶠ n in l, x + d n ∈ s) ∧ Tendsto (fun n ↦ c n • d n) l (𝓝 y) := by - rw [tangentConeAt, mem_setOf, ← map₂_smul, ← map_prod_eq_map₂, ClusterPt, + rw [tangentConeAt, mem_ofPred, ← map₂_smul, ← map_prod_eq_map₂, ClusterPt, ← neBot_inf_comap_iff_map'] at h refine ⟨R × E, _, h, Prod.fst, Prod.snd, ?_, ?_, ?_⟩ · refine (tendsto_snd (f := ⊤)).mono_left <| inf_le_right.trans <| ?_ diff --git a/Mathlib/Analysis/Calculus/TangentCone/Seq.lean b/Mathlib/Analysis/Calculus/TangentCone/Seq.lean index 793f6005c32653..03a858118f9f01 100644 --- a/Mathlib/Analysis/Calculus/TangentCone/Seq.lean +++ b/Mathlib/Analysis/Calculus/TangentCone/Seq.lean @@ -41,7 +41,7 @@ theorem mem_tangentConeAt_iff_exists_seq {R E : Type*} [AddCommGroup E] [SMul R (∀ᶠ n in atTop, x + d n ∈ s) ∧ Tendsto (fun n ↦ c n • d n) atTop (𝓝 y) := by constructor · intro h - simp only [tangentConeAt_def, Set.mem_setOf, ← map₂_smul, ← map_prod_eq_map₂, ClusterPt, + simp only [tangentConeAt_def, Set.mem_ofPred, ← map₂_smul, ← map_prod_eq_map₂, ClusterPt, ← neBot_inf_comap_iff_map'] at h rcases @exists_seq_tendsto _ _ _ h with ⟨cd, hcd⟩ simp only [tendsto_inf, tendsto_comap_iff, tendsto_prod_iff', tendsto_nhdsWithin_iff] at hcd diff --git a/Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean b/Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean index 894bf7351a290e..77cdd9c723493e 100644 --- a/Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean +++ b/Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean @@ -147,7 +147,7 @@ theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l -- With a small ball in hand, apply the mean value theorem refine eventually_prod_iff.mpr - ⟨_, b, fun e : E => Metric.ball x r e, + ⟨_, b, (· ∈ Metric.ball x r), eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left, norm_neg_add] at e ⊢ refine lt_of_le_of_lt ?_ (hxyε y hy) @@ -283,7 +283,7 @@ theorem difference_quotients_converge_uniformly obtain ⟨r, hr, hr'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d rw [eventually_prod_iff] refine - ⟨_, b, fun e : E => Metric.ball x r e, + ⟨_, b, (· ∈ Metric.ball x r), eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩ simp only [Pi.zero_apply, dist_zero_left] rw [norm_neg_add, ← smul_sub, norm_smul, norm_inv, RCLike.norm_coe_norm] diff --git a/Mathlib/Analysis/Calculus/VectorField.lean b/Mathlib/Analysis/Calculus/VectorField.lean index 59828087fde36f..fe910dbfa90074 100644 --- a/Mathlib/Analysis/Calculus/VectorField.lean +++ b/Mathlib/Analysis/Calculus/VectorField.lean @@ -322,21 +322,21 @@ theorem lieBracketWithin_eq_lieBracket (hs : UniqueDiffWithinAt 𝕜 s x) /-- Variant of `lieBracketWithin_congr_set` where one requires the sets to coincide only in the complement of a point. -/ -theorem lieBracketWithin_congr_set' (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem lieBracketWithin_congr_set' (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : lieBracketWithin 𝕜 V W s x = lieBracketWithin 𝕜 V W t x := by simp [lieBracketWithin, fderivWithin_congr_set' _ h] -theorem lieBracketWithin_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem lieBracketWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : lieBracketWithin 𝕜 V W s x = lieBracketWithin 𝕜 V W t x := lieBracketWithin_congr_set' x <| h.filter_mono inf_le_left /-- Variant of `lieBracketWithin_eventually_congr_set` where one requires the sets to coincide only in the complement of a point. -/ -theorem lieBracketWithin_eventually_congr_set' (y : E) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem lieBracketWithin_eventually_congr_set' (y : E) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : lieBracketWithin 𝕜 V W s =ᶠ[𝓝 x] lieBracketWithin 𝕜 V W t := (eventually_nhds_nhdsWithin.2 h).mono fun _ => lieBracketWithin_congr_set' y -theorem lieBracketWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem lieBracketWithin_eventually_congr_set (h : s =ᶠˢ[𝓝 x] t) : lieBracketWithin 𝕜 V W s =ᶠ[𝓝 x] lieBracketWithin 𝕜 V W t := lieBracketWithin_eventually_congr_set' x <| h.filter_mono inf_le_left @@ -652,7 +652,7 @@ lemma pullbackWithin_lieBracketWithin_of_isSymmSndFDerivWithinAt_of_eventuallyEq {f : E → F} {V W : F → F} {x : E} {t : Set F} {u : Set E} (hf : IsSymmSndFDerivWithinAt 𝕜 f s x) (h'f : ContDiffWithinAt 𝕜 2 f s x) (hV : DifferentiableWithinAt 𝕜 V t (f x)) (hW : DifferentiableWithinAt 𝕜 W t (f x)) - (hu : UniqueDiffOn 𝕜 u) (hx : x ∈ u) (hst : MapsTo f u t) (hus : u =ᶠ[𝓝 x] s) : + (hu : UniqueDiffOn 𝕜 u) (hx : x ∈ u) (hst : MapsTo f u t) (hus : u =ᶠˢ[𝓝 x] s) : pullbackWithin 𝕜 f (lieBracketWithin 𝕜 V W t) s x = lieBracketWithin 𝕜 (pullbackWithin 𝕜 f V s) (pullbackWithin 𝕜 f W s) s x := calc pullbackWithin 𝕜 f (lieBracketWithin 𝕜 V W t) s x diff --git a/Mathlib/Analysis/Complex/AbelLimit.lean b/Mathlib/Analysis/Complex/AbelLimit.lean index e5c69cb9bf16d0..395023bb45b32d 100644 --- a/Mathlib/Analysis/Complex/AbelLimit.lean +++ b/Mathlib/Analysis/Complex/AbelLimit.lean @@ -52,7 +52,7 @@ def stolzCone (s : ℝ) : Set ℂ := {z | |z.im| < s * (1 - z.re)} theorem stolzSet_empty {M : ℝ} (hM : M ≤ 1) : stolzSet M = ∅ := by ext z - rw [stolzSet, Set.mem_setOf, Set.mem_empty_iff_false, iff_false, not_and, not_lt, ← sub_pos] + rw [stolzSet, Set.mem_ofPred, Set.mem_empty_iff_false, iff_false, not_and, not_lt, ← sub_pos] intro zn calc _ ≤ 1 * (1 - ‖z‖) := by gcongr @@ -67,7 +67,7 @@ theorem nhdsWithin_lt_le_nhdsWithin_stolzSet {M : ℝ} (hM : 1 < M) : simp only [eventually_iff, mem_nhdsWithin] refine ⟨Set.Ioo 0 2, isOpen_Ioo, by simp, fun x hx ↦ ?_⟩ push _ ∈ _ at hx - simp only [Set.mem_setOf_eq, stolzSet, ← ofReal_one, ← ofReal_sub, norm_real, + simp only [Set.mem_ofPred_eq, stolzSet, ← ofReal_one, ← ofReal_sub, norm_real, norm_of_nonneg hx.1.1.le, norm_of_nonneg <| (sub_pos.mpr hx.2).le] exact ⟨hx.2, lt_mul_left (sub_pos.mpr hx.2) hM⟩ @@ -100,8 +100,8 @@ lemma stolzCone_subset_stolzSet_aux {s : ℝ} (hs : 0 < s) : ∃ M ε, 0 < M ∧ 0 < ε ∧ {z : ℂ | 1 - ε < z.re} ∩ stolzCone s ⊆ stolzSet M := by peel stolzCone_subset_stolzSet_aux' s with M ε hM hε H rintro z ⟨hzl, hzr⟩ - rw [Set.mem_setOf_eq, sub_lt_comm, ← one_re, ← sub_re] at hzl - rw [stolzCone, Set.mem_setOf_eq, ← one_re, ← sub_re] at hzr + rw [Set.mem_ofPred_eq, sub_lt_comm, ← one_re, ← sub_re] at hzl + rw [stolzCone, Set.mem_ofPred_eq, ← one_re, ← sub_re] at hzr replace H := H (1 - z).re z.im ((mul_pos_iff_of_pos_left hs).mp <| (abs_nonneg z.im).trans_lt hzr) hzl hzr have h : z.im ^ 2 = (1 - z).im ^ 2 := by @@ -116,7 +116,7 @@ lemma nhdsWithin_stolzCone_le_nhdsWithin_stolzSet {s : ℝ} (hs : 0 < s) : use M rw [nhdsWithin_le_iff, mem_nhdsWithin] refine ⟨{w | 1 - ε < w.re}, isOpen_lt continuous_const continuous_re, ?_, H⟩ - simp only [Set.mem_setOf_eq, one_re, sub_lt_self_iff, hε] + simp only [Set.mem_ofPred_eq, one_re, sub_lt_self_iff, hε] end StolzSet diff --git a/Mathlib/Analysis/Complex/AbsMax.lean b/Mathlib/Analysis/Complex/AbsMax.lean index 91fc12726b6e26..90018451ab70a0 100644 --- a/Mathlib/Analysis/Complex/AbsMax.lean +++ b/Mathlib/Analysis/Complex/AbsMax.lean @@ -217,13 +217,16 @@ theorem norm_eventually_eq_of_isLocalMax {f : E → F} {c : E} (hr <| closure_ball_subset_closedBall hx).1.differentiableWithinAt) fun x hx => (hr <| ball_subset_closedBall hx).2⟩ -theorem isOpen_setOf_mem_nhds_and_isMaxOn_norm {f : E → F} {s : Set E} +theorem isOpen_setOfPred_mem_nhds_and_isMaxOn_norm {f : E → F} {s : Set E} (hd : DifferentiableOn ℂ f s) : IsOpen {z | s ∈ 𝓝 z ∧ IsMaxOn (norm ∘ f) s z} := by refine isOpen_iff_mem_nhds.2 fun z hz => (eventually_eventually_nhds.2 hz.1).and ?_ replace hd : ∀ᶠ w in 𝓝 z, DifferentiableAt ℂ f w := hd.eventually_differentiableAt hz.1 exact (norm_eventually_eq_of_isLocalMax hd <| hz.2.isLocalMax hz.1).mono fun x hx y hy => le_trans (hz.2 hy).out hx.ge +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_mem_nhds_and_isMaxOn_norm := isOpen_setOfPred_mem_nhds_and_isMaxOn_norm + /-- **Maximum modulus principle** on a connected set. Let `U` be a (pre)connected open set in a complex normed space. Let `f : E → F` be a function that is complex differentiable on `U`. Suppose that `‖f x‖` takes its maximum value on `U` at `c ∈ U`. Then `‖f x‖ = ‖f c‖` for all `x ∈ U`. -/ @@ -234,8 +237,8 @@ theorem norm_eqOn_of_isPreconnected_of_isMaxOn {f : E → F} {U : Set E} {c : E} have hV : ∀ x ∈ V, ‖f x‖ = ‖f c‖ := fun x hx => le_antisymm (hm hx.1) (hx.2 hcU) suffices U ⊆ V from fun x hx => hV x (this hx) have hVo : IsOpen V := by - simpa only [ho.mem_nhds_iff, setOf_and, setOf_mem_eq] - using isOpen_setOf_mem_nhds_and_isMaxOn_norm hd + simpa only [ho.mem_nhds_iff, ofPred_and, ofPred_mem_eq] + using isOpen_setOfPred_mem_nhds_and_isMaxOn_norm hd have hVne : (U ∩ V).Nonempty := ⟨c, hcU, hcU, hm⟩ set W := U ∩ {z | ‖f z‖ ≠ ‖f c‖} have hWo : IsOpen W := hd.continuousOn.norm.isOpen_inter_preimage ho isOpen_ne diff --git a/Mathlib/Analysis/Complex/Basic.lean b/Mathlib/Analysis/Complex/Basic.lean index ded2fe18b25a89..e81f809fe05d15 100644 --- a/Mathlib/Analysis/Complex/Basic.lean +++ b/Mathlib/Analysis/Complex/Basic.lean @@ -636,7 +636,7 @@ open scoped ComplexOrder /-- The *slit plane* is the complex plane with the closed negative real axis removed. -/ def slitPlane : Set ℂ := {z | 0 < z.re ∨ z.im ≠ 0} -lemma mem_slitPlane_iff {z : ℂ} : z ∈ slitPlane ↔ 0 < z.re ∨ z.im ≠ 0 := Set.mem_setOf +lemma mem_slitPlane_iff {z : ℂ} : z ∈ slitPlane ↔ 0 < z.re ∨ z.im ≠ 0 := Set.mem_ofPred /- If `z` is non-zero, then either `z` or `-z` is in `slitPlane`. -/ lemma mem_slitPlane_or_neg_mem_slitPlane {z : ℂ} (hz : z ≠ 0) : @@ -648,7 +648,7 @@ lemma mem_slitPlane_or_neg_mem_slitPlane {z : ℂ} (hz : z ≠ 0) : by_contra! contra exact hz (le_antisymm contra.1.1 contra.2.1) contra.1.2 -lemma slitPlane_eq_union : slitPlane = {z | 0 < z.re} ∪ {z | z.im ≠ 0} := Set.setOf_or.symm +lemma slitPlane_eq_union : slitPlane = {z | 0 < z.re} ∪ {z | z.im ≠ 0} := Set.ofPred_or.symm lemma isOpen_slitPlane : IsOpen slitPlane := (isOpen_lt continuous_const continuous_re).union (isOpen_ne_fun continuous_im continuous_const) diff --git a/Mathlib/Analysis/Complex/BorelCaratheodory.lean b/Mathlib/Analysis/Complex/BorelCaratheodory.lean index 4b30ceacc5feed..36f54a4482ca60 100644 --- a/Mathlib/Analysis/Complex/BorelCaratheodory.lean +++ b/Mathlib/Analysis/Complex/BorelCaratheodory.lean @@ -112,7 +112,7 @@ public theorem borelCaratheodory (hM : 0 < M) (hf : DifferentiableOn ℂ f (ball have hfz : ‖f z - f 0‖ ≤ 2 * (M + ‖f 0‖) * ‖z‖ / (R - ‖z‖) := by apply borelCaratheodory_zero (by positivity) (by fun_prop) ?_ hR hz (by simp) intro x hx - simp only [Set.mem_setOf_eq, sub_re] + simp only [Set.mem_ofPred_eq, sub_re] calc (f x).re - (f 0).re ≤ M - (f 0).re := by gcongr; exact hf₁ hx _ ≤ M + ‖f 0‖ := by linarith [neg_le_abs (f 0).re, abs_re_le_norm (f 0)] have h_denom_ne : R - ‖z‖ ≠ 0 := by linarith [mem_ball_zero_iff.mp hz] diff --git a/Mathlib/Analysis/Complex/CauchyIntegral.lean b/Mathlib/Analysis/Complex/CauchyIntegral.lean index 7ab35a8eefd071..a1e060cbaa98c3 100644 --- a/Mathlib/Analysis/Complex/CauchyIntegral.lean +++ b/Mathlib/Analysis/Complex/CauchyIntegral.lean @@ -407,8 +407,10 @@ theorem circleIntegral_sub_center_inv_smul_of_differentiable_on_off_countable_of have hc' : ContinuousOn (fun z => (z - c)⁻¹) (sphere c r) := (continuousOn_id.sub continuousOn_const).inv₀ fun z hz => sub_ne_zero.2 <| hzne _ hz rw [circleIntegral.integral_sub] <;> refine (hc'.smul ?_).circleIntegrable hr0.le - · exact hc.mono <| subset_inter - (sphere_subset_closedBall.trans <| closedBall_subset_closedBall hrR) hzne + · refine hc.mono ?_ + grw [subset_sdiff, disjoint_left] + refine ⟨?_, hzne⟩ + grw [sphere_subset_closedBall, hrR] · exact continuousOn_const _ ≤ 2 * π * r * (r⁻¹ * (ε / (2 * π))) := by refine circleIntegral.norm_integral_le_of_norm_le_const hr0.le fun z hz => ?_ diff --git a/Mathlib/Analysis/Complex/Convex.lean b/Mathlib/Analysis/Complex/Convex.lean index 0880cb21418b09..7f356acb4b901f 100644 --- a/Mathlib/Analysis/Complex/Convex.lean +++ b/Mathlib/Analysis/Complex/Convex.lean @@ -71,12 +71,12 @@ namespace Complex lemma isConnected_of_upperHalfPlane {r} {s : Set ℂ} (hs₁ : {z | r < z.im} ⊆ s) (hs₂ : s ⊆ {z | r ≤ z.im}) : IsConnected s := by - refine .subset_closure ?_ hs₁ (by simpa only [closure_setOf_lt_im] using hs₂) + refine .subset_closure ?_ hs₁ (by simpa only [closure_setOfPred_lt_im] using hs₂) exact (convex_halfSpace_im_gt r).isConnected ⟨(r + 1) * I, by simp⟩ lemma isConnected_of_lowerHalfPlane {r} {s : Set ℂ} (hs₁ : {z | z.im < r} ⊆ s) (hs₂ : s ⊆ {z | z.im ≤ r}) : IsConnected s := by - refine .subset_closure ?_ hs₁ (by simpa only [closure_setOf_im_lt] using hs₂) + refine .subset_closure ?_ hs₁ (by simpa only [closure_setOfPred_im_lt] using hs₂) exact (convex_halfSpace_im_lt r).isConnected ⟨(r - 1) * I, by simp⟩ lemma rectangle_eq_convexHull (z w : ℂ) : diff --git a/Mathlib/Analysis/Complex/CoveringMap.lean b/Mathlib/Analysis/Complex/CoveringMap.lean index 2d5b9fa2902f01..e6da4c7fc19dde 100644 --- a/Mathlib/Analysis/Complex/CoveringMap.lean +++ b/Mathlib/Analysis/Complex/CoveringMap.lean @@ -90,8 +90,9 @@ theorem isCoveringMapOn_zpow (n : ℤ) (hn : (n : 𝕜) ≠ 0) : refine .of_isCoveringMap_restrictPreimage _ (by simp) ?_ ?_ · convert isClosed_singleton (x := (0 : 𝕜)).isOpen_compl ext; simp [this] - · convert! (isCoveringMap_zpow n hn).comp_homeomorph (.setCongr _) using 1 - ext; simpa using! (this _).not + · refine (isCoveringMap_zpow n hn).comp_homeomorph (.setCongr (t := {x : 𝕜 | x ≠ 0}) ?_) + ext + simp [this] attribute [-instance] Units.mulAction' diff --git a/Mathlib/Analysis/Complex/Harmonic/Analytic.lean b/Mathlib/Analysis/Complex/Harmonic/Analytic.lean index d7bf86de72edee..bcf8efc296cddc 100644 --- a/Mathlib/Analysis/Complex/Harmonic/Analytic.lean +++ b/Mathlib/Analysis/Complex/Harmonic/Analytic.lean @@ -61,7 +61,7 @@ theorem HarmonicAt.analyticAt_complex_partial (hf : HarmonicAt f x) : AnalyticAt ℂ (fun z ↦ fderiv ℝ f z 1 - I * fderiv ℝ f z I) x := DifferentiableOn.analyticAt (s := { x | HarmonicAt f x }) (fun _ hy ↦ (HarmonicAt.differentiableAt_complex_partial hy).differentiableWithinAt) - ((isOpen_setOf_harmonicAt f).mem_nhds hf) + ((isOpen_setOfPred_harmonicAt f).mem_nhds hf) /- If a function `f : ℂ → ℝ` is harmonic on an open ball, then `f` is the real part of a function @@ -141,7 +141,7 @@ Harmonic functions are real analytic. TODO: Prove this for harmonic functions on an arbitrary f.d. inner product space (not just on `ℂ`). -/ theorem HarmonicAt.analyticAt (hf : HarmonicAt f x) : AnalyticAt ℝ f x := by - obtain ⟨ε, h₁ε, h₂ε⟩ := isOpen_iff.1 (isOpen_setOf_harmonicAt (f := f)) x hf + obtain ⟨ε, h₁ε, h₂ε⟩ := isOpen_iff.1 (isOpen_setOfPred_harmonicAt (f := f)) x hf obtain ⟨F, h₁F, h₂F⟩ := InnerProductSpace.HarmonicOnNhd.exists_analyticOnNhd_ball_re_eq (fun _ hy ↦ h₂ε hy) rw [analyticAt_congr (Filter.eventually_of_mem (ball_mem_nhds x h₁ε) (fun y hy ↦ h₂F.symm hy))] diff --git a/Mathlib/Analysis/Complex/Harmonic/MeanValue.lean b/Mathlib/Analysis/Complex/Harmonic/MeanValue.lean index bdea21e7477652..c45e7fd829991e 100644 --- a/Mathlib/Analysis/Complex/Harmonic/MeanValue.lean +++ b/Mathlib/Analysis/Complex/Harmonic/MeanValue.lean @@ -27,7 +27,7 @@ closed disc of radius `R` and center `c`, then the circle average `circleAverage theorem HarmonicOnNhd.circleAverage_eq (hf : HarmonicOnNhd f (closedBall c |R|)) : circleAverage f c R = f c := by obtain ⟨e, h₁e, h₂e⟩ := (isCompact_closedBall c |R|).exists_thickening_subset_open - (isOpen_setOf_harmonicAt f) hf + (isOpen_setOfPred_harmonicAt f) hf rw [thickening_closedBall h₁e (abs_nonneg R)] at h₂e obtain ⟨F, h₁F, h₂F⟩ := InnerProductSpace.HarmonicOnNhd.exists_analyticOnNhd_ball_re_eq h₂e have h₃F : DifferentiableOn ℂ F (closure (ball c |R|)) := by diff --git a/Mathlib/Analysis/Complex/Harmonic/Poisson.lean b/Mathlib/Analysis/Complex/Harmonic/Poisson.lean index 23f6f29bbb0d2f..a496e295af0e66 100644 --- a/Mathlib/Analysis/Complex/Harmonic/Poisson.lean +++ b/Mathlib/Analysis/Complex/Harmonic/Poisson.lean @@ -42,7 +42,7 @@ theorem HarmonicOnNhd.circleAverage_re_herglotzRieszKernel_smul (hf : HarmonicOnNhd f (closedBall c R)) (hw : w ∈ ball c R) : Real.circleAverage ((re ∘ herglotzRieszKernel c w) • f) c R = f w := by obtain ⟨e, h₁e, h₂e⟩ := (isCompact_closedBall c R).exists_thickening_subset_open - (isOpen_setOf_harmonicAt f) (by aesop) + (isOpen_setOfPred_harmonicAt f) (by aesop) rw [thickening_closedBall h₁e (pos_of_mem_ball hw).le] at h₂e obtain ⟨F, h₁F, h₂F⟩ := HarmonicOnNhd.exists_analyticOnNhd_ball_re_eq h₂e have h₃F : DifferentiableOn ℂ F (closure (ball c R)) := by diff --git a/Mathlib/Analysis/Complex/OpenMapping.lean b/Mathlib/Analysis/Complex/OpenMapping.lean index bf2e6ef5658fbf..2f5310c2253a6d 100644 --- a/Mathlib/Analysis/Complex/OpenMapping.lean +++ b/Mathlib/Analysis/Complex/OpenMapping.lean @@ -93,7 +93,7 @@ theorem AnalyticAt.eventually_constant_or_nhds_le_map_nhds_aux (hf : AnalyticAt have h2 : ∀ᶠ z in 𝓝 z₀, AnalyticAt ℂ f z := (isOpen_analyticAt ℂ f).eventually_mem hf obtain ⟨ρ, hρ, h3, h4⟩ : ∃ ρ > 0, AnalyticOnNhd ℂ f (closedBall z₀ ρ) ∧ ∀ z ∈ closedBall z₀ ρ, z ≠ z₀ → f z ≠ f z₀ := by - simpa only [setOf_and, subset_inter_iff] using! + simpa only [ofPred_and, subset_inter_iff] using! nhds_basis_closedBall.mem_iff.mp (h2.and (eventually_nhdsWithin_iff.mp h1)) replace h3 : DiffContOnCl ℂ f (ball z₀ ρ) := ⟨h3.differentiableOn.mono ball_subset_closedBall, diff --git a/Mathlib/Analysis/Complex/PhragmenLindelof.lean b/Mathlib/Analysis/Complex/PhragmenLindelof.lean index d5488434b0b8d1..b624e37d3eafa3 100644 --- a/Mathlib/Analysis/Complex/PhragmenLindelof.lean +++ b/Mathlib/Analysis/Complex/PhragmenLindelof.lean @@ -669,7 +669,7 @@ theorem right_half_plane_of_tendsto_zero_on_real (hd : DiffContOnCl ℂ f {z | 0 obtain ⟨x₀, hx₀, hmax⟩ : ∃ x : ℝ, 0 ≤ x ∧ ∀ y : ℝ, 0 ≤ y → ‖f y‖ ≤ ‖f x‖ := by have hfc : ContinuousOn (fun x : ℝ => f x) (Ici 0) := by refine hd.continuousOn.comp continuous_ofReal.continuousOn fun x hx => ?_ - rwa [closure_setOf_lt_re] + rwa [closure_setOfPred_lt_re] by_cases! h₀ : ∀ x : ℝ, 0 ≤ x → f x = 0 · refine ⟨0, le_rfl, fun y hy => ?_⟩; rw [h₀ y hy, h₀ 0 le_rfl] rcases h₀ with ⟨x₀, hx₀, hne⟩ @@ -693,7 +693,7 @@ theorem right_half_plane_of_tendsto_zero_on_real (hd : DiffContOnCl ℂ f {z | 0 -- move to a lemma? intro z hz rw [mem_ball, dist_zero_left, dist_eq, Complex.norm_of_nonneg hx₀] at hz - rw [mem_setOf_eq] + rw [mem_ofPred_eq] contrapose! hz calc x₀ ≤ x₀ - z.re := (le_sub_self_iff _).2 hz @@ -764,8 +764,9 @@ theorem eq_zero_on_right_half_plane_of_superexponential_decay (hd : DiffContOnCl rcases him with ⟨C, hC⟩ -- Due to continuity, it suffices to prove the equality on the open right half-plane. suffices ∀ z : ℂ, 0 < z.re → f z = 0 by - simpa only [closure_setOf_lt_re] using! - EqOn.of_subset_closure this hd.continuousOn continuousOn_const subset_closure Subset.rfl + simpa only [closure_setOfPred_lt_re] using! + EqOn.of_subset_closure (s := {z | 0 < z.re}) (fun z hz ↦ this z hz) + hd.continuousOn continuousOn_const subset_closure Subset.rfl -- Consider $g_n(z)=e^{nz}f(z)$. set g : ℕ → ℂ → E := fun (n : ℕ) (z : ℂ) => exp z ^ n • f z have hg : ∀ n z, ‖g n z‖ = expR z.re ^ n * ‖f z‖ := fun n z ↦ by diff --git a/Mathlib/Analysis/Complex/ReImTopology.lean b/Mathlib/Analysis/Complex/ReImTopology.lean index 54a79042637da9..d7cb693dea1abd 100644 --- a/Mathlib/Analysis/Complex/ReImTopology.lean +++ b/Mathlib/Analysis/Complex/ReImTopology.lean @@ -24,8 +24,8 @@ Each statement about `Complex.re` listed below has a counterpart about `Complex. and is a quotient map; * `Complex.interior_preimage_re`, `Complex.closure_preimage_re`, `Complex.frontier_preimage_re`: formulas for `interior (Complex.re ⁻¹' s)` etc; -* `Complex.interior_setOf_re_le` etc: particular cases of the above formulas in the cases when `s` - is one of the infinite intervals `Set.Ioi a`, `Set.Ici a`, `Set.Iio a`, and `Set.Iic a`, +* `Complex.interior_setOfPred_re_le` etc: particular cases of the above formulas in the cases + when `s` is one of the infinite intervals `Set.Ioi a`, `Set.Ici a`, `Set.Iio a`, and `Set.Iic a`, formulated as `interior {z : ℂ | z.re ≤ a} = {z | z.re < a}` etc. ## Tags @@ -80,69 +80,115 @@ theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' (isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm @[simp] -theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by +theorem interior_setOfPred_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by simpa only [interior_Iic] using! interior_preimage_re (Iic a) +@[deprecated (since := "2026-07-09")] +alias interior_setOf_re_le := interior_setOfPred_re_le + @[simp] -theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by +theorem interior_setOfPred_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by simpa only [interior_Iic] using! interior_preimage_im (Iic a) +@[deprecated (since := "2026-07-09")] +alias interior_setOf_im_le := interior_setOfPred_im_le + @[simp] -theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by +theorem interior_setOfPred_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by simpa only [interior_Ici] using! interior_preimage_re (Ici a) +@[deprecated (since := "2026-07-09")] +alias interior_setOf_le_re := interior_setOfPred_le_re + @[simp] -theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by +theorem interior_setOfPred_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by simpa only [interior_Ici] using! interior_preimage_im (Ici a) +@[deprecated (since := "2026-07-09")] +alias interior_setOf_le_im := interior_setOfPred_le_im + @[simp] -theorem closure_setOf_re_lt (a : ℝ) : closure { z : ℂ | z.re < a } = { z | z.re ≤ a } := by +theorem closure_setOfPred_re_lt (a : ℝ) : closure { z : ℂ | z.re < a } = { z | z.re ≤ a } := by simpa only [closure_Iio] using! closure_preimage_re (Iio a) +@[deprecated (since := "2026-07-09")] +alias closure_setOf_re_lt := closure_setOfPred_re_lt + @[simp] -theorem closure_setOf_im_lt (a : ℝ) : closure { z : ℂ | z.im < a } = { z | z.im ≤ a } := by +theorem closure_setOfPred_im_lt (a : ℝ) : closure { z : ℂ | z.im < a } = { z | z.im ≤ a } := by simpa only [closure_Iio] using! closure_preimage_im (Iio a) +@[deprecated (since := "2026-07-09")] alias closure_setOf_im_lt := closure_setOfPred_im_lt + @[simp] -theorem closure_setOf_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re } := by +theorem closure_setOfPred_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re } := by simpa only [closure_Ioi] using! closure_preimage_re (Ioi a) +@[deprecated (since := "2026-07-09")] +alias closure_setOf_lt_re := closure_setOfPred_lt_re + @[simp] -theorem closure_setOf_lt_im (a : ℝ) : closure { z : ℂ | a < z.im } = { z | a ≤ z.im } := by +theorem closure_setOfPred_lt_im (a : ℝ) : closure { z : ℂ | a < z.im } = { z | a ≤ z.im } := by simpa only [closure_Ioi] using! closure_preimage_im (Ioi a) +@[deprecated (since := "2026-07-09")] alias closure_setOf_lt_im := closure_setOfPred_lt_im + @[simp] -theorem frontier_setOf_re_le (a : ℝ) : frontier { z : ℂ | z.re ≤ a } = { z | z.re = a } := by +theorem frontier_setOfPred_re_le (a : ℝ) : frontier { z : ℂ | z.re ≤ a } = { z | z.re = a } := by simpa only [frontier_Iic] using! frontier_preimage_re (Iic a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_re_le := frontier_setOfPred_re_le + @[simp] -theorem frontier_setOf_im_le (a : ℝ) : frontier { z : ℂ | z.im ≤ a } = { z | z.im = a } := by +theorem frontier_setOfPred_im_le (a : ℝ) : frontier { z : ℂ | z.im ≤ a } = { z | z.im = a } := by simpa only [frontier_Iic] using! frontier_preimage_im (Iic a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_im_le := frontier_setOfPred_im_le + @[simp] -theorem frontier_setOf_le_re (a : ℝ) : frontier { z : ℂ | a ≤ z.re } = { z | z.re = a } := by +theorem frontier_setOfPred_le_re (a : ℝ) : frontier { z : ℂ | a ≤ z.re } = { z | z.re = a } := by simpa only [frontier_Ici] using! frontier_preimage_re (Ici a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_le_re := frontier_setOfPred_le_re + @[simp] -theorem frontier_setOf_le_im (a : ℝ) : frontier { z : ℂ | a ≤ z.im } = { z | z.im = a } := by +theorem frontier_setOfPred_le_im (a : ℝ) : frontier { z : ℂ | a ≤ z.im } = { z | z.im = a } := by simpa only [frontier_Ici] using! frontier_preimage_im (Ici a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_le_im := frontier_setOfPred_le_im + @[simp] -theorem frontier_setOf_re_lt (a : ℝ) : frontier { z : ℂ | z.re < a } = { z | z.re = a } := by +theorem frontier_setOfPred_re_lt (a : ℝ) : frontier { z : ℂ | z.re < a } = { z | z.re = a } := by simpa only [frontier_Iio] using! frontier_preimage_re (Iio a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_re_lt := frontier_setOfPred_re_lt + @[simp] -theorem frontier_setOf_im_lt (a : ℝ) : frontier { z : ℂ | z.im < a } = { z | z.im = a } := by +theorem frontier_setOfPred_im_lt (a : ℝ) : frontier { z : ℂ | z.im < a } = { z | z.im = a } := by simpa only [frontier_Iio] using! frontier_preimage_im (Iio a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_im_lt := frontier_setOfPred_im_lt + @[simp] -theorem frontier_setOf_lt_re (a : ℝ) : frontier { z : ℂ | a < z.re } = { z | z.re = a } := by +theorem frontier_setOfPred_lt_re (a : ℝ) : frontier { z : ℂ | a < z.re } = { z | z.re = a } := by simpa only [frontier_Ioi] using! frontier_preimage_re (Ioi a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_lt_re := frontier_setOfPred_lt_re + @[simp] -theorem frontier_setOf_lt_im (a : ℝ) : frontier { z : ℂ | a < z.im } = { z | z.im = a } := by +theorem frontier_setOfPred_lt_im (a : ℝ) : frontier { z : ℂ | a < z.im } = { z | z.im = a } := by simpa only [frontier_Ioi] using! frontier_preimage_im (Ioi a) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_lt_im := frontier_setOfPred_lt_im + theorem closure_reProdIm (s t : Set ℝ) : closure (s ×ℂ t) = closure s ×ℂ closure t := by simpa only [← preimage_eq_preimage equivRealProdCLM.symm.toHomeomorph.surjective, equivRealProdCLM.symm.toHomeomorph.preimage_closure] using! @closure_prod_eq _ _ _ _ s t @@ -155,15 +201,21 @@ theorem frontier_reProdIm (s t : Set ℝ) : simpa only [← preimage_eq_preimage equivRealProdCLM.symm.toHomeomorph.surjective, equivRealProdCLM.symm.toHomeomorph.preimage_frontier] using! frontier_prod_eq s t -theorem frontier_setOf_le_re_and_le_im (a b : ℝ) : +theorem frontier_setOfPred_le_re_and_le_im (a b : ℝ) : frontier { z | a ≤ re z ∧ b ≤ im z } = { z | a ≤ re z ∧ im z = b ∨ re z = a ∧ b ≤ im z } := by simpa only [closure_Ici, frontier_Ici] using! frontier_reProdIm (Ici a) (Ici b) -theorem frontier_setOf_le_re_and_im_le (a b : ℝ) : +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_le_re_and_le_im := frontier_setOfPred_le_re_and_le_im + +theorem frontier_setOfPred_le_re_and_im_le (a b : ℝ) : frontier { z | a ≤ re z ∧ im z ≤ b } = { z | a ≤ re z ∧ im z = b ∨ re z = a ∧ im z ≤ b } := by simpa only [closure_Ici, closure_Iic, frontier_Ici, frontier_Iic] using! frontier_reProdIm (Ici a) (Iic b) +@[deprecated (since := "2026-07-09")] +alias frontier_setOf_le_re_and_im_le := frontier_setOfPred_le_re_and_im_le + end Complex open Complex Metric diff --git a/Mathlib/Analysis/Complex/UpperHalfPlane/ProperAction.lean b/Mathlib/Analysis/Complex/UpperHalfPlane/ProperAction.lean index aa9604b24b4f2c..461c5b87ea92ac 100644 --- a/Mathlib/Analysis/Complex/UpperHalfPlane/ProperAction.lean +++ b/Mathlib/Analysis/Complex/UpperHalfPlane/ProperAction.lean @@ -105,10 +105,7 @@ lemma isProperMap_smul_I : IsProperMap fun g : SL(2, ℝ) ↦ g • I := by convert! ProperSpace.isCompact_closedBall (0 : Matrix (Fin 2) (Fin 2) ℝ) (max √A √A') simp only [le_sup_iff, Fin.forall_fin_two, Fin.isValue, Metric.closedBall, dist_zero_right, Matrix.norm_def, pi_norm_le_iff_of_nonempty, Real.norm_eq_abs] - #adaptation_note /-- Before https://github.com/leanprover/lean4/pull/13166 - (replacing grind's canonicalizer with a type-directed normalizer), `ext` was not necessary. - The cause of this might be `Matrix` function application defeq abuse. -/ - ext; grind + grind have := Matrix.SpecialLinearGroup.isClosedEmbedding_val.isCompact_preimage this refine this.of_isClosed_subset (hK.isClosed.preimage <| by fun_prop) (fun g hg ↦ ?_) intro i j diff --git a/Mathlib/Analysis/Convex/Basic.lean b/Mathlib/Analysis/Convex/Basic.lean index 14ef4e4268b6b4..dfa3eab51161a8 100644 --- a/Mathlib/Analysis/Convex/Basic.lean +++ b/Mathlib/Analysis/Convex/Basic.lean @@ -122,9 +122,11 @@ theorem DirectedOn.convex_sUnion {c : Set (Set E)} (hdir : DirectedOn (· ⊆ · rw [sUnion_eq_iUnion] exact (directedOn_iff_directed.1 hdir).convex_iUnion fun A => hc A.2 -theorem Convex.setOf_const_imp {P : Prop} (hs : Convex 𝕜 s) : Convex 𝕜 {x | P → x ∈ s} := by +theorem Convex.setOfPred_const_imp {P : Prop} (hs : Convex 𝕜 s) : Convex 𝕜 {x | P → x ∈ s} := by by_cases hP : P <;> simp [hP, hs, convex_univ] +@[deprecated (since := "2026-07-09")] alias Convex.setOf_const_imp := Convex.setOfPred_const_imp + end SMul section Module diff --git a/Mathlib/Analysis/Convex/Caratheodory.lean b/Mathlib/Analysis/Convex/Caratheodory.lean index d46b491697673e..ed18655cbfd064 100644 --- a/Mathlib/Analysis/Convex/Caratheodory.lean +++ b/Mathlib/Analysis/Convex/Caratheodory.lean @@ -55,7 +55,7 @@ then it is in the convex hull of a strict subset of `t`. -/ theorem mem_convexHull_erase [DecidableEq E] {t : Finset E} (h : ¬AffineIndependent 𝕜 ((↑) : t → E)) {x : E} (m : x ∈ convexHull 𝕜 (↑t : Set E)) : ∃ y : (↑t : Set E), x ∈ convexHull 𝕜 (↑(t.erase y) : Set E) := by - simp only [Finset.convexHull_eq, mem_setOf_eq] at m ⊢ + simp only [Finset.convexHull_eq, mem_ofPred_eq] at m ⊢ obtain ⟨f, fpos, fsum, rfl⟩ := m obtain ⟨g, gcombo, gsum, gpos⟩ := exists_nontrivial_relation_sum_zero_of_not_affine_ind h replace gpos := exists_pos_of_sum_zero_of_exists_nonzero g gsum gpos @@ -166,7 +166,7 @@ theorem eq_pos_convex_span_of_mem_convexHull {x : E} (hx : x ∈ convexHull 𝕜 rw [convexHull_eq_union] at hx simp only [exists_prop, Set.mem_iUnion] at hx obtain ⟨t, ht₁, ht₂, ht₃⟩ := hx - simp only [t.convexHull_eq, Set.mem_setOf_eq] at ht₃ + simp only [t.convexHull_eq, Set.mem_ofPred_eq] at ht₃ obtain ⟨w, hw₁, hw₂, hw₃⟩ := ht₃ let t' := {i ∈ t | w i ≠ 0} refine ⟨t', t'.fintypeCoeSort, ((↑) : t' → E), w ∘ ((↑) : t' → E), ?_, ?_, ?_, ?_, ?_⟩ diff --git a/Mathlib/Analysis/Convex/Combination.lean b/Mathlib/Analysis/Convex/Combination.lean index ce97f12f200196..8165b2b1fc2723 100644 --- a/Mathlib/Analysis/Convex/Combination.lean +++ b/Mathlib/Analysis/Convex/Combination.lean @@ -379,7 +379,7 @@ lemma mem_convexHull_iff_exists_fintype {s : Set E} {x : E} : x ∈ convexHull R s ↔ ∃ (ι : Type) (_ : Fintype ι) (w : ι → R) (z : ι → E), (∀ i, 0 ≤ w i) ∧ ∑ i, w i = 1 ∧ (∀ i, z i ∈ s) ∧ ∑ i, w i • z i = x := by constructor - · simp only [convexHull_eq, mem_setOf_eq] + · simp only [convexHull_eq, mem_ofPred_eq] rintro ⟨ι, t, w, z, h⟩ refine ⟨t, inferInstance, w ∘ (↑), z ∘ (↑), ?_⟩ simpa [← sum_attach t, centerMass_eq_of_sum_1 _ _ h.2.1] using h @@ -409,7 +409,7 @@ theorem Finset.convexHull_eq (s : Finset E) : convexHull R ↑s = theorem Finset.mem_convexHull {s : Finset E} {x : E} : x ∈ convexHull R (s : Set E) ↔ ∃ w : E → R, (∀ y ∈ s, 0 ≤ w y) ∧ ∑ y ∈ s, w y = 1 ∧ s.centerMass w id = x := by - rw [Finset.convexHull_eq, Set.mem_setOf_eq] + rw [Finset.convexHull_eq, Set.mem_ofPred_eq] /-- This is a version of `Finset.mem_convexHull` stated without `Finset.centerMass`. -/ lemma Finset.mem_convexHull' {s : Finset E} {x : E} : @@ -617,7 +617,7 @@ namespace Affine.Simplex [IsOrderedRing 𝕜] [AddCommGroup V] [Module 𝕜 V] {n : ℕ} (s : Simplex 𝕜 V n) : convexHull 𝕜 (Set.range s.points) = s.closedInterior := by ext p - rw [convexHull_range_eq_exists_affineCombination, Set.mem_setOf] + rw [convexHull_range_eq_exists_affineCombination, Set.mem_ofPred] constructor <;> intro h · obtain ⟨u, w, hw, hw1, rfl⟩ := h have hw' : ∀ i ∈ u, w i ≤ 1 := by diff --git a/Mathlib/Analysis/Convex/Continuous.lean b/Mathlib/Analysis/Convex/Continuous.lean index 43d9e1edf74da6..b43a4a75640fa7 100644 --- a/Mathlib/Analysis/Convex/Continuous.lean +++ b/Mathlib/Analysis/Convex/Continuous.lean @@ -152,7 +152,7 @@ lemma ConvexOn.continuousOn_tfae (hC : IsOpen C) (hC' : C.Nonempty) (hf : Convex | h, x, hx => by obtain ⟨r, hr⟩ := h hx obtain ⟨ε, hε, hεD⟩ := Metric.mem_nhds_iff.1 <| Filter.inter_mem (hC.mem_nhds hx) hr - simp only [preimage_setOf_eq, Pi.abs_apply, subset_inter_iff, hC.nhdsWithin_eq hx] at hεD ⊢ + simp only [preimage_ofPred_eq, Pi.abs_apply, subset_inter_iff, hC.nhdsWithin_eq hx] at hεD ⊢ obtain ⟨K, hK⟩ := exists_lipschitzOnWith_of_isBounded (hf.subset hεD.1 (convex_ball ..)) (half_lt_self hε) <| isBounded_iff_forall_norm_le.2 ⟨r, by simpa using! hεD.2⟩ exact ⟨K, _, ball_mem_nhds _ (by simpa), hK⟩ diff --git a/Mathlib/Analysis/Convex/Deriv.lean b/Mathlib/Analysis/Convex/Deriv.lean index 0e4fae608c2e01..2b1ccf5be34b2b 100644 --- a/Mathlib/Analysis/Convex/Deriv.lean +++ b/Mathlib/Analysis/Convex/Deriv.lean @@ -492,7 +492,7 @@ lemma monotoneOn_rightDeriv (hfc : ConvexOn ℝ S f) : simp_rw [hfc.rightDeriv_eq_sInf_slope_of_mem_interior hxs, hfc.rightDeriv_eq_sInf_slope_of_mem_interior hys] refine csInf_le_of_le (b := slope f x y) (bddBelow_slope_lt_of_mem_interior hfc hxs) - ⟨y, by simp only [mem_setOf_eq, hxy, and_true]; exact interior_subset hys⟩ + ⟨y, by simp only [mem_ofPred_eq, hxy, and_true]; exact interior_subset hys⟩ (le_csInf ?_ ?_) · have hys' := hys rw [mem_interior_iff_mem_nhds, mem_nhds_iff_exists_Ioo_subset] at hys' @@ -512,7 +512,7 @@ lemma monotoneOn_leftDeriv (hfc : ConvexOn ℝ S f) : simp_rw [hfc.leftDeriv_eq_sSup_slope_of_mem_interior hxs, hfc.leftDeriv_eq_sSup_slope_of_mem_interior hys] refine le_csSup_of_le (b := slope f x y) (bddAbove_slope_gt_of_mem_interior hfc hys) - ⟨x, by simp only [slope_comm, mem_setOf_eq, hxy, and_true]; exact interior_subset hxs⟩ + ⟨x, by simp only [slope_comm, mem_ofPred_eq, hxy, and_true]; exact interior_subset hxs⟩ (csSup_le ?_ ?_) · have hxs' := hxs rw [mem_interior_iff_mem_nhds, mem_nhds_iff_exists_Ioo_subset] at hxs' diff --git a/Mathlib/Analysis/Convex/DoublyStochasticMatrix.lean b/Mathlib/Analysis/Convex/DoublyStochasticMatrix.lean index 5401ae19c71739..f7b72916a3e9cc 100644 --- a/Mathlib/Analysis/Convex/DoublyStochasticMatrix.lean +++ b/Mathlib/Analysis/Convex/DoublyStochasticMatrix.lean @@ -65,7 +65,7 @@ lemma doublyStochastic_eq_rowStochastic_inf_colStochastic : doublyStochastic R n = rowStochastic R n ⊓ colStochastic R n := by ext M simp only [rowStochastic, colStochastic, Submonoid.mem_inf, Submonoid.mem_mk, Subsemigroup.mem_mk, - Set.mem_setOf_eq, doublyStochastic] + Set.mem_ofPred_eq, doublyStochastic] grind lemma mem_doublyStochastic_iff_mem_rowStochastic_and_mem_colStochastic {M : Matrix n n R} : diff --git a/Mathlib/Analysis/Convex/Extrema.lean b/Mathlib/Analysis/Convex/Extrema.lean index 4aa46bf303147e..31e5ca00d98b51 100644 --- a/Mathlib/Analysis/Convex/Extrema.lean +++ b/Mathlib/Analysis/Convex/Extrema.lean @@ -32,7 +32,7 @@ theorem IsMinOn.of_isLocalMinOn_of_convexOn_Icc {f : ℝ → β} {a b : ℝ} (a_ (h_local_min : IsLocalMinOn f (Icc a b) a) (h_conv : ConvexOn ℝ (Icc a b) f) : IsMinOn f (Icc a b) a := by rintro c hc - dsimp only [mem_setOf_eq] + dsimp only [mem_ofPred_eq] rw [IsLocalMinOn, nhdsWithin_Icc_eq_nhdsGE a_lt_b] at h_local_min rcases hc.1.eq_or_lt with (rfl | a_lt_c) · exact le_rfl @@ -66,7 +66,7 @@ theorem IsMinOn.of_isLocalMinOn_of_convexOn {f : E → β} {a : E} (a_in_s : a have fg_min_on : IsMinOn (f ∘ g) (Icc 0 1 : Set ℝ) 0 := by refine IsMinOn.of_isLocalMinOn_of_convexOn_Icc one_pos fg_local_min_on ?_ exact (h_conv.comp_affineMap g).subset h_maps (convex_Icc 0 1) - simpa only [hg0, hg1, comp_apply, mem_setOf_eq] using fg_min_on (right_mem_Icc.2 zero_le_one) + simpa only [hg0, hg1, comp_apply, mem_ofPred_eq] using fg_min_on (right_mem_Icc.2 zero_le_one) /-- A local maximum of a concave function is a global maximum, restricted to a set `s`. -/ theorem IsMaxOn.of_isLocalMaxOn_of_concaveOn {f : E → β} {a : E} (a_in_s : a ∈ s) diff --git a/Mathlib/Analysis/Convex/FunctionTopology.lean b/Mathlib/Analysis/Convex/FunctionTopology.lean index 5889e70105e828..cd9e9596865518 100644 --- a/Mathlib/Analysis/Convex/FunctionTopology.lean +++ b/Mathlib/Analysis/Convex/FunctionTopology.lean @@ -14,8 +14,8 @@ import Mathlib.Topology.Algebra.Monoid We prove the following facts: -* `isClosed_setOf_convexOn` : the set of convex functions on a set is closed -* `isClosed_setOf_concaveOn` : the set of concave functions on a set is closed +* `isClosed_setOfPred_convexOn` : the set of convex functions on a set is closed +* `isClosed_setOfPred_concaveOn` : the set of concave functions on a set is closed -/ open scoped Topology @@ -28,16 +28,21 @@ variable {𝕜 α β : Type*} [Semiring 𝕜] [PartialOrder 𝕜] [PartialOrder [ContinuousConstSMul 𝕜 β] [ContinuousAdd β] /-- The set of convex functions on a set `s` is closed. -/ -public theorem isClosed_setOf_convexOn {s : Set α} : +public theorem isClosed_setOfPred_convexOn {s : Set α} : IsClosed {f : α → β | ConvexOn 𝕜 s f} := by - simp only [ConvexOn, setOf_and, setOf_forall] + simp only [ConvexOn, ofPred_and, ofPred_forall] refine IsClosed.inter isClosed_const ?_ exact isClosed_iInter fun x => isClosed_iInter fun hx => isClosed_iInter fun y => isClosed_iInter fun hy => isClosed_iInter fun a => isClosed_iInter fun b => isClosed_iInter fun ha => isClosed_iInter fun hb => isClosed_iInter fun hab => isClosed_le (by fun_prop) (by fun_prop) +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_convexOn := isClosed_setOfPred_convexOn + /-- The set of concave functions on a set `s` is closed. -/ -public theorem isClosed_setOf_concaveOn {s : Set α} : +public theorem isClosed_setOfPred_concaveOn {s : Set α} : IsClosed {f : α → β | ConcaveOn 𝕜 s f} := - isClosed_setOf_convexOn (α := α) (β := βᵒᵈ) + isClosed_setOfPred_convexOn (α := α) (β := βᵒᵈ) + +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_concaveOn := isClosed_setOfPred_concaveOn diff --git a/Mathlib/Analysis/Convex/Gauge.lean b/Mathlib/Analysis/Convex/Gauge.lean index f9f9a4716a3155..96b0e99c3da9c3 100644 --- a/Mathlib/Analysis/Convex/Gauge.lean +++ b/Mathlib/Analysis/Convex/Gauge.lean @@ -101,9 +101,8 @@ theorem gauge_zero' : gauge (0 : Set E) = 0 := by rw [gauge_def'] obtain rfl | hx := eq_or_ne x 0 · simp only [csInf_Ioi, mem_zero, Pi.zero_apply, sep_true, smul_zero] - · simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero] - convert! Real.sInf_empty - exact eq_empty_iff_forall_notMem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx + · have (r : ℝ) : ¬ (0 < r ∧ r = 0) := by grind + simp [*] @[simp] theorem gauge_empty : gauge (∅ : Set E) = 0 := by @@ -133,10 +132,10 @@ theorem gauge_le_of_mem (ha : 0 ≤ a) (hx : x ∈ a • s) : gauge s x ≤ a := · rw [mem_singleton_iff.1 (zero_smul_set_subset _ hx), gauge_zero] · exact csInf_le bddBelow_gauge_set ⟨ha', hx⟩ -theorem setOf_gauge_le_eq (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ : Absorbent ℝ s) +theorem setOfPred_gauge_le_eq (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ : Absorbent ℝ s) (ha : 0 ≤ a) : { x | gauge s x ≤ a } = ⋂ (r : ℝ) (_ : a < r), r • s := by ext x - simp_rw [Set.mem_iInter, Set.mem_setOf_eq] + simp_rw [Set.mem_iInter, Set.mem_ofPred_eq] refine ⟨fun h r hr => ?_, fun h => le_of_forall_pos_lt_add fun ε hε => ?_⟩ · have hr' := ha.trans_lt hr rw [mem_smul_set_iff_inv_smul_mem₀ hr'.ne'] @@ -148,27 +147,33 @@ theorem setOf_gauge_le_eq (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ exact hδr.le · linarith [gauge_le_of_mem (by linarith) <| h (a + ε / 2) (by linarith)] -@[deprecated (since := "2026-06-17")] alias gauge_le_eq := setOf_gauge_le_eq +@[deprecated (since := "2026-07-09")] +alias setOf_gauge_le_eq := setOfPred_gauge_le_eq + +@[deprecated (since := "2026-06-17")] alias gauge_le_eq := setOfPred_gauge_le_eq theorem setOf_gauge_lt_eq' (absorbs : Absorbent ℝ s) (a : ℝ) : { x | gauge s x < a } = ⋃ (r : ℝ) (_ : 0 < r) (_ : r < a), r • s := by ext - simp_rw [mem_setOf, mem_iUnion, exists_prop] + simp_rw [mem_ofPred, mem_iUnion, exists_prop] exact ⟨exists_lt_of_gauge_lt absorbs, fun ⟨r, hr₀, hr₁, hx⟩ => (gauge_le_of_mem hr₀.le hx).trans_lt hr₁⟩ @[deprecated (since := "2026-06-17")] alias gauge_lt_eq' := setOf_gauge_lt_eq' -theorem setOf_gauge_lt_eq (absorbs : Absorbent ℝ s) (a : ℝ) : +theorem setOfPred_gauge_lt_eq (absorbs : Absorbent ℝ s) (a : ℝ) : { x | gauge s x < a } = ⋃ r ∈ Set.Ioo 0 (a : ℝ), r • s := by ext - simp_rw [mem_setOf, mem_iUnion, exists_prop, mem_Ioo, and_assoc] + simp_rw [mem_ofPred, mem_iUnion, exists_prop, mem_Ioo, and_assoc] exact ⟨exists_lt_of_gauge_lt absorbs, fun ⟨r, hr₀, hr₁, hx⟩ => (gauge_le_of_mem hr₀.le hx).trans_lt hr₁⟩ -@[deprecated (since := "2026-06-17")] alias gauge_lt_eq := setOf_gauge_lt_eq +@[deprecated (since := "2026-07-09")] +alias setOf_gauge_lt_eq := setOfPred_gauge_lt_eq + +@[deprecated (since := "2026-06-17")] alias gauge_lt_eq := setOfPred_gauge_lt_eq theorem mem_openSegment_of_gauge_lt_one (absorbs : Absorbent ℝ s) (hgauge : gauge s x < 1) : ∃ y ∈ s, x ∈ openSegment ℝ 0 y := by @@ -176,13 +181,16 @@ theorem mem_openSegment_of_gauge_lt_one (absorbs : Absorbent ℝ s) (hgauge : ga refine ⟨y, hy, 1 - r, r, ?_⟩ simp [*] -theorem setOf_gauge_lt_one_subset_self (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) +theorem setOfPred_gauge_lt_one_subset_self (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) (absorbs : Absorbent ℝ s) : { x | gauge s x < 1 } ⊆ s := fun _x hx ↦ let ⟨_y, hys, hx⟩ := mem_openSegment_of_gauge_lt_one absorbs hx hs.openSegment_subset h₀ hys hx +@[deprecated (since := "2026-07-09")] +alias setOf_gauge_lt_one_subset_self := setOfPred_gauge_lt_one_subset_self + @[deprecated (since := "2026-06-17")] -alias gauge_lt_one_subset_self := setOf_gauge_lt_one_subset_self +alias gauge_lt_one_subset_self := setOfPred_gauge_lt_one_subset_self theorem gauge_le_one_of_mem {x : E} (hx : x ∈ s) : gauge s x ≤ 1 := gauge_le_of_mem zero_le_one <| by rwa [one_smul] @@ -205,20 +213,27 @@ theorem gauge_sum_le {ι : Type*} (hs : Convex ℝ s) (absorbs : Absorbent ℝ s (f : ι → E) : gauge s (∑ i ∈ t, f i) ≤ ∑ i ∈ t, gauge s (f i) := Finset.le_sum_of_subadditive _ gauge_zero.le (gauge_add_le hs absorbs) _ _ -theorem self_subset_setOf_gauge_le_one : s ⊆ { x | gauge s x ≤ 1 } := fun _ => gauge_le_one_of_mem +theorem self_subset_setOfPred_gauge_le_one : s ⊆ { x | gauge s x ≤ 1 } := + fun _ => gauge_le_one_of_mem + +@[deprecated (since := "2026-07-09")] +alias self_subset_setOf_gauge_le_one := self_subset_setOfPred_gauge_le_one @[deprecated (since := "2026-06-17")] -alias self_subset_gauge_le_one := self_subset_setOf_gauge_le_one +alias self_subset_gauge_le_one := self_subset_setOfPred_gauge_le_one -theorem Convex.setOf_gauge_le (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) (absorbs : Absorbent ℝ s) +theorem Convex.setOfPred_gauge_le (hs : Convex ℝ s) (h₀ : (0 : E) ∈ s) (absorbs : Absorbent ℝ s) (a : ℝ) : Convex ℝ { x | gauge s x ≤ a } := by by_cases ha : 0 ≤ a - · rw [setOf_gauge_le_eq hs h₀ absorbs ha] + · rw [setOfPred_gauge_le_eq hs h₀ absorbs ha] exact convex_iInter fun i => convex_iInter fun _ => hs.smul _ · convert! convex_empty (𝕜 := ℝ) - exact eq_empty_iff_forall_notMem.2 fun x hx => ha <| (gauge_nonneg _).trans hx + simpa using fun hx => ha <| (gauge_nonneg _).trans hx -@[deprecated (since := "2026-06-17")] alias Convex.gauge_le := Convex.setOf_gauge_le +@[deprecated (since := "2026-07-09")] +alias Convex.setOf_gauge_le := Convex.setOfPred_gauge_le + +@[deprecated (since := "2026-06-17")] alias Convex.gauge_le := Convex.setOfPred_gauge_le theorem le_gauge_of_notMem (hs₀ : StarConvex ℝ 0 s) (hs₂ : Absorbs ℝ s {x}) (hx : x ∉ a • s) : a ≤ gauge s x := by @@ -367,15 +382,18 @@ theorem interior_subset_gauge_lt_one (s : Set E) : interior s ⊆ { x | gauge s rcases H₂.exists with ⟨r, hxr, hr₀, hr₁⟩ exact (gauge_le_of_mem hr₀.le hxr).trans_lt hr₁ -theorem setOf_gauge_lt_one_eq_self_of_isOpen (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) +theorem setOfPred_gauge_lt_one_eq_self_of_isOpen (hs₁ : Convex ℝ s) (hs₀ : (0 : E) ∈ s) (hs₂ : IsOpen s) : { x | gauge s x < 1 } = s := by - refine (setOf_gauge_lt_one_subset_self hs₁ ‹_› <| absorbent_nhds_zero <| + refine (setOfPred_gauge_lt_one_subset_self hs₁ ‹_› <| absorbent_nhds_zero <| hs₂.mem_nhds hs₀).antisymm ?_ convert! interior_subset_gauge_lt_one s exact hs₂.interior_eq.symm +@[deprecated (since := "2026-07-09")] +alias setOf_gauge_lt_one_eq_self_of_isOpen := setOfPred_gauge_lt_one_eq_self_of_isOpen + @[deprecated (since := "2026-06-17")] -alias gauge_lt_one_eq_self_of_isOpen := setOf_gauge_lt_one_eq_self_of_isOpen +alias gauge_lt_one_eq_self_of_isOpen := setOfPred_gauge_lt_one_eq_self_of_isOpen theorem gauge_lt_one_of_mem_of_isOpen (hs₂ : IsOpen s) {x : E} (hx : x ∈ s) : gauge s x < 1 := @@ -392,8 +410,8 @@ theorem mem_closure_of_gauge_le_one (hc : Convex ℝ s) (hs₀ : 0 ∈ s) (ha : (h : gauge s x ≤ 1) : x ∈ closure s := by have : ∀ᶠ r : ℝ in 𝓝[<] 1, r • x ∈ s := by filter_upwards [Ico_mem_nhdsLT one_pos] with r ⟨hr₀, hr₁⟩ - apply setOf_gauge_lt_one_subset_self hc hs₀ ha - rw [mem_setOf_eq, gauge_smul_of_nonneg hr₀] + apply setOfPred_gauge_lt_one_subset_self hc hs₀ ha + rw [mem_ofPred_eq, gauge_smul_of_nonneg hr₀] exact mul_lt_one_of_nonneg_of_lt_one_left hr₀ hr₁ h refine mem_closure_of_tendsto ?_ this exact Filter.Tendsto.mono_left (Continuous.tendsto' (by fun_prop) _ _ (one_smul _ _)) @@ -460,18 +478,21 @@ is continuous. If the ambient space is a normed space, then `gauge s` is Lipschi theorem continuous_gauge (hc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0) : Continuous (gauge s) := continuous_iff_continuousAt.2 fun _ ↦ continuousAt_gauge hc hs₀ -theorem setOf_gauge_lt_one_eq_interior (hc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0) : +theorem setOfPred_gauge_lt_one_eq_interior (hc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0) : { x | gauge s x < 1 } = interior s := by refine Subset.antisymm (fun x hx ↦ ?_) (interior_subset_gauge_lt_one s) rcases mem_openSegment_of_gauge_lt_one (absorbent_nhds_zero hs₀) hx with ⟨y, hys, hxy⟩ exact hc.openSegment_interior_self_subset_interior (mem_interior_iff_mem_nhds.2 hs₀) hys hxy +@[deprecated (since := "2026-07-09")] +alias setOf_gauge_lt_one_eq_interior := setOfPred_gauge_lt_one_eq_interior + @[deprecated (since := "2026-06-17")] -alias gauge_lt_one_eq_interior := setOf_gauge_lt_one_eq_interior +alias gauge_lt_one_eq_interior := setOfPred_gauge_lt_one_eq_interior theorem gauge_lt_one_iff_mem_interior (hc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0) : gauge s x < 1 ↔ x ∈ interior s := - Set.ext_iff.1 (setOf_gauge_lt_one_eq_interior hc hs₀) _ + Set.ext_iff.1 (setOfPred_gauge_lt_one_eq_interior hc hs₀) _ theorem gauge_le_one_iff_mem_closure (hc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0) : gauge s x ≤ 1 ↔ x ∈ closure s := @@ -504,7 +525,7 @@ theorem gaugeSeminorm_lt_one_of_isOpen (hs : IsOpen s) {x : E} (hx : x ∈ s) : theorem gaugeSeminorm_ball_one (hs : IsOpen s) : (gaugeSeminorm hs₀ hs₁ hs₂).ball 0 1 = s := by rw [Seminorm.ball_zero_eq] - exact setOf_gauge_lt_one_eq_self_of_isOpen hs₁ hs₂.zero_mem hs + exact setOfPred_gauge_lt_one_eq_self_of_isOpen hs₁ hs₂.zero_mem hs end RCLike @@ -557,13 +578,9 @@ theorem gauge_ball (hr : 0 ≤ r) (x : E) : gauge (ball (0 : E) r) x = ‖x‖ / @[simp] theorem gauge_closure_zero : gauge (closure (0 : Set E)) = 0 := funext fun x ↦ by - simp only [← singleton_zero, gauge_def', mem_closure_zero_iff_norm, norm_smul, mul_eq_zero, - norm_eq_zero, inv_eq_zero] - rcases (norm_nonneg x).eq_or_lt' with hx | hx - · convert! csInf_Ioi (a := (0 : ℝ)) - exact Set.ext fun r ↦ and_iff_left (.inr hx) - · convert! Real.sInf_empty - exact eq_empty_of_forall_notMem fun r ⟨hr₀, hr⟩ ↦ hx.ne' <| hr.resolve_left hr₀.out.ne' + have (r : ℝ) : ¬ (0 < r ∧ r = 0) := by grind + obtain hx | hx := eq_or_ne (‖x‖) 0 <;> + simp [*, ← singleton_zero, gauge_def', mem_closure_zero_iff_norm, norm_smul, Ioi_def] @[simp] theorem gauge_closedBall (hr : 0 ≤ r) (x : E) : gauge (closedBall (0 : E) r) x = ‖x‖ / r := by diff --git a/Mathlib/Analysis/Convex/Integral.lean b/Mathlib/Analysis/Convex/Integral.lean index b3b35f2b7c8076..50c557ccf26cca 100644 --- a/Mathlib/Analysis/Convex/Integral.lean +++ b/Mathlib/Analysis/Convex/Integral.lean @@ -119,7 +119,7 @@ theorem ConcaveOn.average_mem_hypograph [IsFiniteMeasure μ] [NeZero μ] (hg : C (hgc : ContinuousOn g s) (hsc : IsClosed s) (hfs : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) (hgi : Integrable (g ∘ f) μ) : (⨍ x, f x ∂μ, ⨍ x, g (f x) ∂μ) ∈ {p : E × ℝ | p.1 ∈ s ∧ p.2 ≤ g p.1} := by - simpa only [mem_setOf_eq, Pi.neg_apply, average_neg, neg_le_neg_iff] using + simpa only [mem_ofPred_eq, Pi.neg_apply, average_neg, neg_le_neg_iff] using hg.neg.average_mem_epigraph hgc.neg hsc hfs hfi hgi.neg /-- **Jensen's inequality**: if a function `g : E → ℝ` is convex and continuous on a convex closed @@ -166,7 +166,7 @@ theorem ConcaveOn.set_average_mem_hypograph (hg : ConcaveOn ℝ s g) (hgc : Cont (hsc : IsClosed s) (h0 : μ t ≠ 0) (ht : μ t ≠ ∞) (hfs : ∀ᵐ x ∂μ.restrict t, f x ∈ s) (hfi : IntegrableOn f t μ) (hgi : IntegrableOn (g ∘ f) t μ) : (⨍ x in t, f x ∂μ, ⨍ x in t, g (f x) ∂μ) ∈ {p : E × ℝ | p.1 ∈ s ∧ p.2 ≤ g p.1} := by - simpa only [mem_setOf_eq, Pi.neg_apply, average_neg, neg_le_neg_iff] using + simpa only [mem_ofPred_eq, Pi.neg_apply, average_neg, neg_le_neg_iff] using hg.neg.set_average_mem_epigraph hgc.neg hsc h0 ht hfs hfi hgi.neg /-- **Jensen's inequality**: if a function `g : E → ℝ` is convex and continuous on a convex closed diff --git a/Mathlib/Analysis/Convex/Intrinsic.lean b/Mathlib/Analysis/Convex/Intrinsic.lean index 6c1f2aabafd068..68505c1655347d 100644 --- a/Mathlib/Analysis/Convex/Intrinsic.lean +++ b/Mathlib/Analysis/Convex/Intrinsic.lean @@ -117,7 +117,7 @@ alias ⟨Set.Nonempty.ofIntrinsicClosure, Set.Nonempty.intrinsicClosure⟩ := in @[simp] theorem intrinsicInterior_singleton (x : P) : intrinsicInterior 𝕜 ({x} : Set P) = {x} := by simp only [intrinsicInterior, preimage_coe_affineSpan_singleton, interior_univ, image_univ, - Subtype.range_coe_subtype, mem_affineSpan_singleton, setOf_eq_eq_singleton] + Subtype.range_coe_subtype, mem_affineSpan_singleton, ofPred_eq_eq_singleton] @[simp] theorem intrinsicFrontier_singleton (x : P) : intrinsicFrontier 𝕜 ({x} : Set P) = ∅ := by @@ -126,7 +126,7 @@ theorem intrinsicFrontier_singleton (x : P) : intrinsicFrontier 𝕜 ({x} : Set @[simp] theorem intrinsicClosure_singleton (x : P) : intrinsicClosure 𝕜 ({x} : Set P) = {x} := by simp only [intrinsicClosure, preimage_coe_affineSpan_singleton, closure_univ, image_univ, - Subtype.range_coe_subtype, mem_affineSpan_singleton, setOf_eq_eq_singleton] + Subtype.range_coe_subtype, mem_affineSpan_singleton, ofPred_eq_eq_singleton] /-! Note that neither `intrinsicInterior` nor `intrinsicFrontier` is monotone. diff --git a/Mathlib/Analysis/Convex/Quasiconvex.lean b/Mathlib/Analysis/Convex/Quasiconvex.lean index 2f6e3f05c870da..0961faa7380a84 100644 --- a/Mathlib/Analysis/Convex/Quasiconvex.lean +++ b/Mathlib/Analysis/Convex/Quasiconvex.lean @@ -97,13 +97,13 @@ variable {s : Set E} {f : E → β} {g : β → γ} theorem QuasiconvexOn.monotone_comp (hg : Monotone g) (hf : QuasiconvexOn 𝕜 s f) : QuasiconvexOn 𝕜 s (g ∘ f) := fun c x hx y hy ↦ by - simp only [Function.comp_apply, mem_setOf_eq] at hx hy + simp only [Function.comp_apply, mem_ofPred_eq] at hx hy intro a b ha hb hab - simp only [Function.comp_apply, mem_setOf_eq] + simp only [Function.comp_apply, mem_ofPred_eq] wlog h : f x ≤ f y · grind specialize hf (f y) ⟨hx.1, h⟩ ⟨hy.1, le_rfl⟩ ha hb hab - simp only [mem_setOf_eq] at hf + simp only [mem_ofPred_eq] at hf exact ⟨hf.1, le_trans (hg hf.2) hy.2⟩ theorem QuasiconvexOn.antitone_comp (hg : Antitone g) (hf : QuasiconvexOn 𝕜 s f) : diff --git a/Mathlib/Analysis/Convex/Segment.lean b/Mathlib/Analysis/Convex/Segment.lean index 59bbbd65c0192f..bbccf5514ac369 100644 --- a/Mathlib/Analysis/Convex/Segment.lean +++ b/Mathlib/Analysis/Convex/Segment.lean @@ -61,12 +61,12 @@ def openSegment (x y : E) : Set E := theorem segment_eq_image₂ (x y : E) : [x -[𝕜] y] = (fun p : 𝕜 × 𝕜 => p.1 • x + p.2 • y) '' { p | 0 ≤ p.1 ∧ 0 ≤ p.2 ∧ p.1 + p.2 = 1 } := by - simp only [segment, image, Prod.exists, mem_setOf_eq, and_assoc] + simp only [segment, image, Prod.exists, mem_ofPred_eq, and_assoc] theorem openSegment_eq_image₂ (x y : E) : openSegment 𝕜 x y = (fun p : 𝕜 × 𝕜 => p.1 • x + p.2 • y) '' { p | 0 < p.1 ∧ 0 < p.2 ∧ p.1 + p.2 = 1 } := by - simp only [openSegment, image, Prod.exists, mem_setOf_eq, and_assoc] + simp only [openSegment, image, Prod.exists, mem_ofPred_eq, and_assoc] theorem segment_symm (x y : E) : [x -[𝕜] y] = [y -[𝕜] x] := Set.ext fun _ => @@ -557,13 +557,13 @@ theorem segment_eq_uIcc (x y : 𝕜) : [x -[𝕜] y] = uIcc x y := /-- A point is in an `Icc` iff it can be expressed as a convex combination of the endpoints. -/ theorem Convex.mem_Icc (h : x ≤ y) : z ∈ Icc x y ↔ ∃ a b, 0 ≤ a ∧ 0 ≤ b ∧ a + b = 1 ∧ a * x + b * y = z := by - simp only [← segment_eq_Icc h, segment, mem_setOf_eq, smul_eq_mul, exists_and_left] + simp only [← segment_eq_Icc h, segment, mem_ofPred_eq, smul_eq_mul, exists_and_left] /-- A point is in an `Ioo` iff it can be expressed as a strict convex combination of the endpoints. -/ theorem Convex.mem_Ioo (h : x < y) : z ∈ Ioo x y ↔ ∃ a b, 0 < a ∧ 0 < b ∧ a + b = 1 ∧ a * x + b * y = z := by - simp only [← openSegment_eq_Ioo h, openSegment, smul_eq_mul, exists_and_left, mem_setOf_eq] + simp only [← openSegment_eq_Ioo h, openSegment, smul_eq_mul, exists_and_left, mem_ofPred_eq] /-- A point is in an `Ioc` iff it can be expressed as a semistrict convex combination of the endpoints. -/ diff --git a/Mathlib/Analysis/Convex/Side.lean b/Mathlib/Analysis/Convex/Side.lean index 6cf3ee3d020915..98d66877ec3cb2 100644 --- a/Mathlib/Analysis/Convex/Side.lean +++ b/Mathlib/Analysis/Convex/Side.lean @@ -691,10 +691,10 @@ theorem sOppSide_lineMap_right {s : AffineSubspace R P} {x y : P} (hx : x ∈ s) (ht : t < 0) : s.SOppSide y (lineMap x y t) := (sOppSide_lineMap_left hx hy ht).symm -theorem setOf_wSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : +theorem setOfPred_wSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : { y | s.WSameSide x y } = Set.image2 (fun (t : R) q => t • (x -ᵥ p) +ᵥ q) (Set.Ici 0) s := by ext y - simp_rw [Set.mem_setOf, Set.mem_image2, Set.mem_Ici] + simp_rw [Set.mem_ofPred, Set.mem_image2, Set.mem_Ici] constructor · rw [wSameSide_iff_exists_left hp, or_iff_right hx] rintro ⟨p₂, hp₂, h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩⟩ @@ -709,10 +709,13 @@ theorem setOf_wSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ · rintro ⟨t, ht, p', hp', rfl⟩ exact wSameSide_smul_vsub_vadd_right x hp hp' ht -theorem setOf_sSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : +@[deprecated (since := "2026-07-09")] +alias setOf_wSameSide_eq_image2 := setOfPred_wSameSide_eq_image2 + +theorem setOfPred_sSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : { y | s.SSameSide x y } = Set.image2 (fun (t : R) q => t • (x -ᵥ p) +ᵥ q) (Set.Ioi 0) s := by ext y - simp_rw [Set.mem_setOf, Set.mem_image2, Set.mem_Ioi] + simp_rw [Set.mem_ofPred, Set.mem_image2, Set.mem_Ioi] constructor · rw [sSameSide_iff_exists_left hp] rintro ⟨-, hy, p₂, hp₂, h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩⟩ @@ -726,10 +729,13 @@ theorem setOf_sSameSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ · rintro ⟨t, ht, p', hp', rfl⟩ exact sSameSide_smul_vsub_vadd_right hx hp hp' ht -theorem setOf_wOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : +@[deprecated (since := "2026-07-09")] +alias setOf_sSameSide_eq_image2 := setOfPred_sSameSide_eq_image2 + +theorem setOfPred_wOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : { y | s.WOppSide x y } = Set.image2 (fun (t : R) q => t • (x -ᵥ p) +ᵥ q) (Set.Iic 0) s := by ext y - simp_rw [Set.mem_setOf, Set.mem_image2, Set.mem_Iic] + simp_rw [Set.mem_ofPred, Set.mem_image2, Set.mem_Iic] constructor · rw [wOppSide_iff_exists_left hp, or_iff_right hx] rintro ⟨p₂, hp₂, h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩⟩ @@ -744,10 +750,13 @@ theorem setOf_wOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ · rintro ⟨t, ht, p', hp', rfl⟩ exact wOppSide_smul_vsub_vadd_right x hp hp' ht -theorem setOf_sOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : +@[deprecated (since := "2026-07-09")] +alias setOf_wOppSide_eq_image2 := setOfPred_wOppSide_eq_image2 + +theorem setOfPred_sOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ s) (hp : p ∈ s) : { y | s.SOppSide x y } = Set.image2 (fun (t : R) q => t • (x -ᵥ p) +ᵥ q) (Set.Iio 0) s := by ext y - simp_rw [Set.mem_setOf, Set.mem_image2, Set.mem_Iio] + simp_rw [Set.mem_ofPred, Set.mem_image2, Set.mem_Iio] constructor · rw [sOppSide_iff_exists_left hp] rintro ⟨-, hy, p₂, hp₂, h | h | ⟨r₁, r₂, hr₁, hr₂, h⟩⟩ @@ -761,6 +770,9 @@ theorem setOf_sOppSide_eq_image2 {s : AffineSubspace R P} {x p : P} (hx : x ∉ · rintro ⟨t, ht, p', hp', rfl⟩ exact sOppSide_smul_vsub_vadd_right hx hp hp' ht +@[deprecated (since := "2026-07-09")] +alias setOf_sOppSide_eq_image2 := setOfPred_sOppSide_eq_image2 + theorem wOppSide_pointReflection {s : AffineSubspace R P} {x : P} (y : P) (hx : x ∈ s) : s.WOppSide y (pointReflection R x y) := (wbtw_pointReflection R _ _).wOppSide₁₃ hx @@ -777,7 +789,8 @@ section Normed variable [SeminormedAddCommGroup V] [NormedSpace ℝ V] [PseudoMetricSpace P] variable [NormedAddTorsor V P] -theorem isConnected_setOf_wSameSide {s : AffineSubspace ℝ P} (x : P) (h : (s : Set P).Nonempty) : +theorem isConnected_setOfPred_wSameSide {s : AffineSubspace ℝ P} (x : P) + (h : (s : Set P).Nonempty) : IsConnected { y | s.WSameSide x y } := by obtain ⟨p, hp⟩ := h haveI : Nonempty s := ⟨⟨p, hp⟩⟩ @@ -785,29 +798,38 @@ theorem isConnected_setOf_wSameSide {s : AffineSubspace ℝ P} (x : P) (h : (s : · simp only [wSameSide_of_left_mem, hx] have := AddTorsor.connectedSpace V P exact isConnected_univ - · rw [setOf_wSameSide_eq_image2 hx hp, ← Set.image_prod] + · rw [setOfPred_wSameSide_eq_image2 hx hp, ← Set.image_prod] refine (isConnected_Ici.prod (isConnected_iff_connectedSpace.2 ?_)).image _ ((continuous_fst.smul continuous_const).vadd continuous_snd).continuousOn convert! AddTorsor.connectedSpace s.direction s -theorem isPreconnected_setOf_wSameSide (s : AffineSubspace ℝ P) (x : P) : +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_wSameSide := isConnected_setOfPred_wSameSide + +theorem isPreconnected_setOfPred_wSameSide (s : AffineSubspace ℝ P) (x : P) : IsPreconnected { y | s.WSameSide x y } := by rcases Set.eq_empty_or_nonempty (s : Set P) with (h | h) · rw [coe_eq_bot_iff] at h simp only [h, not_wSameSide_bot] exact isPreconnected_empty - · exact (isConnected_setOf_wSameSide x h).isPreconnected + · exact (isConnected_setOfPred_wSameSide x h).isPreconnected + +@[deprecated (since := "2026-07-09")] +alias isPreconnected_setOf_wSameSide := isPreconnected_setOfPred_wSameSide -theorem isConnected_setOf_sSameSide {s : AffineSubspace ℝ P} {x : P} (hx : x ∉ s) +theorem isConnected_setOfPred_sSameSide {s : AffineSubspace ℝ P} {x : P} (hx : x ∉ s) (h : (s : Set P).Nonempty) : IsConnected { y | s.SSameSide x y } := by obtain ⟨p, hp⟩ := h haveI : Nonempty s := ⟨⟨p, hp⟩⟩ - rw [setOf_sSameSide_eq_image2 hx hp, ← Set.image_prod] + rw [setOfPred_sSameSide_eq_image2 hx hp, ← Set.image_prod] refine (isConnected_Ioi.prod (isConnected_iff_connectedSpace.2 ?_)).image _ ((continuous_fst.smul continuous_const).vadd continuous_snd).continuousOn convert! AddTorsor.connectedSpace s.direction s -theorem isPreconnected_setOf_sSameSide (s : AffineSubspace ℝ P) (x : P) : +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_sSameSide := isConnected_setOfPred_sSameSide + +theorem isPreconnected_setOfPred_sSameSide (s : AffineSubspace ℝ P) (x : P) : IsPreconnected { y | s.SSameSide x y } := by rcases Set.eq_empty_or_nonempty (s : Set P) with (h | h) · rw [coe_eq_bot_iff] at h @@ -816,9 +838,12 @@ theorem isPreconnected_setOf_sSameSide (s : AffineSubspace ℝ P) (x : P) : · by_cases hx : x ∈ s · simp only [hx, SSameSide, not_true, false_and, and_false] exact isPreconnected_empty - · exact (isConnected_setOf_sSameSide hx h).isPreconnected + · exact (isConnected_setOfPred_sSameSide hx h).isPreconnected + +@[deprecated (since := "2026-07-09")] +alias isPreconnected_setOf_sSameSide := isPreconnected_setOfPred_sSameSide -theorem isConnected_setOf_wOppSide {s : AffineSubspace ℝ P} (x : P) (h : (s : Set P).Nonempty) : +theorem isConnected_setOfPred_wOppSide {s : AffineSubspace ℝ P} (x : P) (h : (s : Set P).Nonempty) : IsConnected { y | s.WOppSide x y } := by obtain ⟨p, hp⟩ := h haveI : Nonempty s := ⟨⟨p, hp⟩⟩ @@ -826,29 +851,38 @@ theorem isConnected_setOf_wOppSide {s : AffineSubspace ℝ P} (x : P) (h : (s : · simp only [wOppSide_of_left_mem, hx] have := AddTorsor.connectedSpace V P exact isConnected_univ - · rw [setOf_wOppSide_eq_image2 hx hp, ← Set.image_prod] + · rw [setOfPred_wOppSide_eq_image2 hx hp, ← Set.image_prod] refine (isConnected_Iic.prod (isConnected_iff_connectedSpace.2 ?_)).image _ ((continuous_fst.smul continuous_const).vadd continuous_snd).continuousOn convert! AddTorsor.connectedSpace s.direction s -theorem isPreconnected_setOf_wOppSide (s : AffineSubspace ℝ P) (x : P) : +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_wOppSide := isConnected_setOfPred_wOppSide + +theorem isPreconnected_setOfPred_wOppSide (s : AffineSubspace ℝ P) (x : P) : IsPreconnected { y | s.WOppSide x y } := by rcases Set.eq_empty_or_nonempty (s : Set P) with (h | h) · rw [coe_eq_bot_iff] at h simp only [h, not_wOppSide_bot] exact isPreconnected_empty - · exact (isConnected_setOf_wOppSide x h).isPreconnected + · exact (isConnected_setOfPred_wOppSide x h).isPreconnected -theorem isConnected_setOf_sOppSide {s : AffineSubspace ℝ P} {x : P} (hx : x ∉ s) +@[deprecated (since := "2026-07-09")] +alias isPreconnected_setOf_wOppSide := isPreconnected_setOfPred_wOppSide + +theorem isConnected_setOfPred_sOppSide {s : AffineSubspace ℝ P} {x : P} (hx : x ∉ s) (h : (s : Set P).Nonempty) : IsConnected { y | s.SOppSide x y } := by obtain ⟨p, hp⟩ := h haveI : Nonempty s := ⟨⟨p, hp⟩⟩ - rw [setOf_sOppSide_eq_image2 hx hp, ← Set.image_prod] + rw [setOfPred_sOppSide_eq_image2 hx hp, ← Set.image_prod] refine (isConnected_Iio.prod (isConnected_iff_connectedSpace.2 ?_)).image _ ((continuous_fst.smul continuous_const).vadd continuous_snd).continuousOn convert! AddTorsor.connectedSpace s.direction s -theorem isPreconnected_setOf_sOppSide (s : AffineSubspace ℝ P) (x : P) : +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_sOppSide := isConnected_setOfPred_sOppSide + +theorem isPreconnected_setOfPred_sOppSide (s : AffineSubspace ℝ P) (x : P) : IsPreconnected { y | s.SOppSide x y } := by rcases Set.eq_empty_or_nonempty (s : Set P) with (h | h) · rw [coe_eq_bot_iff] at h @@ -857,7 +891,10 @@ theorem isPreconnected_setOf_sOppSide (s : AffineSubspace ℝ P) (x : P) : · by_cases hx : x ∈ s · simp only [hx, SOppSide, not_true, false_and, and_false] exact isPreconnected_empty - · exact (isConnected_setOf_sOppSide hx h).isPreconnected + · exact (isConnected_setOfPred_sOppSide hx h).isPreconnected + +@[deprecated (since := "2026-07-09")] +alias isPreconnected_setOf_sOppSide := isPreconnected_setOfPred_sOppSide end Normed diff --git a/Mathlib/Analysis/Convex/SimplicialComplex/AffineIndependentUnion.lean b/Mathlib/Analysis/Convex/SimplicialComplex/AffineIndependentUnion.lean index 976c2afada058a..18ef039fd8fb41 100644 --- a/Mathlib/Analysis/Convex/SimplicialComplex/AffineIndependentUnion.lean +++ b/Mathlib/Analysis/Convex/SimplicialComplex/AffineIndependentUnion.lean @@ -43,7 +43,7 @@ def ofSimpleGraph {ι : Type*} [DecidableEq ι] (G : SimpleGraph ι) : faces := ({s : Finset ι | ∃ v, s = {v}}) ∪ Sym2.toFinset '' G.edgeSet isRelLowerSet_faces := by intro s hs - simp only [Set.mem_union, Set.mem_setOf_eq, Set.mem_image] at hs + simp only [Set.mem_union, Set.mem_ofPred_eq, Set.mem_image] at hs rcases hs with ⟨v, rfl⟩ | ⟨e, he, rfl⟩ · simp · constructor @@ -52,7 +52,7 @@ def ofSimpleGraph {ι : Type*} [DecidableEq ι] (G : SimpleGraph ι) : by_cases h : b.card = 1 <;> grind [Finset.card_eq_one, Finset.eq_of_subset_of_card_le hb_sub, Sym2.card_toFinset] singleton_mem := by - simp only [Set.mem_union, Set.mem_setOf_eq, Set.mem_image] + simp only [Set.mem_union, Set.mem_ofPred_eq, Set.mem_image] intro v exact Or.inl ⟨v, rfl⟩ diff --git a/Mathlib/Analysis/Convex/StdSimplex.lean b/Mathlib/Analysis/Convex/StdSimplex.lean index 46b59101d93b89..eee336db9ce856 100644 --- a/Mathlib/Analysis/Convex/StdSimplex.lean +++ b/Mathlib/Analysis/Convex/StdSimplex.lean @@ -37,7 +37,7 @@ def stdSimplex : Set (ι → 𝕜) := theorem stdSimplex_eq_inter : stdSimplex 𝕜 ι = (⋂ x, { f | 0 ≤ f x }) ∩ { f | ∑ x, f x = 1 } := by ext f - simp only [stdSimplex, Set.mem_inter_iff, Set.mem_iInter, Set.mem_setOf_eq] + simp only [stdSimplex, Set.mem_inter_iff, Set.mem_iInter, Set.mem_ofPred_eq] theorem convex_stdSimplex [IsOrderedRing 𝕜] : Convex 𝕜 (stdSimplex 𝕜 ι) := by refine fun f hf g hg a b ha hb hab => ⟨fun x => ?_, ?_⟩ diff --git a/Mathlib/Analysis/Distribution/TemperateGrowth.lean b/Mathlib/Analysis/Distribution/TemperateGrowth.lean index baf2162ae7318e..da91903523ff34 100644 --- a/Mathlib/Analysis/Distribution/TemperateGrowth.lean +++ b/Mathlib/Analysis/Distribution/TemperateGrowth.lean @@ -343,7 +343,7 @@ theorem hasTemperateGrowth_one_add_norm_sq_rpow (r : ℝ) : set t := {y : ℝ | 1 / 2 < y} have ht : Set.range (fun (x : H) ↦ (1 + ‖x‖ ^ 2)) ⊆ t := by rintro - ⟨y, rfl⟩ - simp only [Set.mem_setOf_eq, t] + simp only [Set.mem_ofPred_eq, t] exact lt_add_of_lt_add_left (c := 0) (by norm_num) (by positivity) have hdiff : ContDiffOn ℝ ∞ (fun x ↦ x ^ r) t := contDiffOn_fun_id.rpow_const_of_ne fun x hx ↦ (lt_trans (by norm_num) hx).ne' @@ -392,7 +392,7 @@ theorem hasTemperateGrowth_one_add_norm_sq_rpow (r : ℝ) : congr simpa using hx''.le _ ≤ (2 : ℝ) ^ (n - r) := by - simp only [one_div, Set.mem_setOf_eq, t] at hx + simp only [one_div, Set.mem_ofPred_eq, t] at hx rw [Real.rpow_neg_eq_inv_rpow] gcongr exact ((inv_lt_comm₀ hx'' (by norm_num)).mpr hx).le diff --git a/Mathlib/Analysis/Fourier/AddCircleMulti.lean b/Mathlib/Analysis/Fourier/AddCircleMulti.lean index 545f515ec4278c..f8718f368f24f7 100644 --- a/Mathlib/Analysis/Fourier/AddCircleMulti.lean +++ b/Mathlib/Analysis/Fourier/AddCircleMulti.lean @@ -180,7 +180,7 @@ lemma measurePreserving_equivPiIoc : · convert! (map_comap_subtype_coe (MeasurableSet.univ_pi' (fun i => measurableSet_Ioc (a := a i))) volume) convert! (Measure.restrict_pi_pi (fun i => volume) (fun i => Ioc (a i) (a i + 1))).symm - grind + simp theorem lintegral_preimage (f : UnitAddTorus d → ℝ≥0∞) (a : d → ℝ) : ∫⁻ x : UnitAddTorus d, f x = diff --git a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean index d45231572cf6f0..30df288d6592ab 100644 --- a/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean +++ b/Mathlib/Analysis/Fourier/RiemannLebesgueLemma.lean @@ -142,7 +142,7 @@ theorem tendsto_integral_exp_inner_smul_cocompact_of_continuous_compact_support have int_A : ∫ v : V, ‖f v - f (v + i w)‖ = ∫ v in A, ‖f v - f (v + i w)‖ := by refine (setIntegral_eq_integral_of_forall_compl_eq_zero fun v hv => ?_).symm dsimp only [A] at hv - simp only [mem_setOf, not_le] at hv + simp only [mem_ofPred, not_le] at hv rw [hR_bd v _, hR_bd (v + i w) _, sub_zero, norm_zero] · rw [← sub_neg_eq_add] refine le_trans ?_ (norm_sub_norm_le _ _) diff --git a/Mathlib/Analysis/InnerProductSpace/Defs.lean b/Mathlib/Analysis/InnerProductSpace/Defs.lean index 2bc916e9ff9f00..d0b7b95d1b20e1 100644 --- a/Mathlib/Analysis/InnerProductSpace/Defs.lean +++ b/Mathlib/Analysis/InnerProductSpace/Defs.lean @@ -515,7 +515,7 @@ lemma topology_eq simp have : p.ball 0 1 = {v | re (cd.inner v v) < 1} := by ext v - simp only [ball_normSeminorm, Metric.mem_ball, dist_eq_norm, sub_zero, Set.mem_setOf_eq, p] + simp only [ball_normSeminorm, Metric.mem_ball, dist_eq_norm, sub_zero, Set.mem_ofPred_eq, p] change √(re (cd.inner v v)) < 1 ↔ re (cd.inner v v) < 1 conv_lhs => rw [show (1 : ℝ) = √1 by simp] rw [sqrt_lt_sqrt_iff] diff --git a/Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean b/Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean index 94b9aeb598a00f..e13b9675e1c789 100644 --- a/Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean +++ b/Mathlib/Analysis/InnerProductSpace/Harmonic/Basic.lean @@ -88,9 +88,11 @@ variable (f) in /-- Harmonicity is an open property. -/ -theorem isOpen_setOf_harmonicAt : IsOpen { x : E | HarmonicAt f x } := +theorem isOpen_setOfPred_harmonicAt : IsOpen { x : E | HarmonicAt f x } := isOpen_iff_mem_nhds.2 (fun _ hx ↦ hx.eventually) +@[deprecated (since := "2026-07-09")] alias isOpen_setOf_harmonicAt := isOpen_setOfPred_harmonicAt + /-- If `f` is harmonic in a neighborhood of `s`, it is harmonic in a neighborhood of every subset. -/ diff --git a/Mathlib/Analysis/InnerProductSpace/LinearPMap.lean b/Mathlib/Analysis/InnerProductSpace/LinearPMap.lean index da112f39df47a6..fcbe73a5092364 100644 --- a/Mathlib/Analysis/InnerProductSpace/LinearPMap.lean +++ b/Mathlib/Analysis/InnerProductSpace/LinearPMap.lean @@ -90,11 +90,11 @@ This definition is needed to construct the adjoint operator and the preferred ve def adjointDomain : Submodule 𝕜 F where carrier := {y | Continuous ((innerₛₗ 𝕜 y).comp T.toFun)} zero_mem' := by - rw [Set.mem_setOf_eq, LinearMap.map_zero, LinearMap.zero_comp] + rw [Set.mem_ofPred_eq, LinearMap.map_zero, LinearMap.zero_comp] exact continuous_zero - add_mem' hx hy := by rw [Set.mem_setOf_eq, LinearMap.map_add] at *; exact hx.add hy + add_mem' hx hy := by rw [Set.mem_ofPred_eq, LinearMap.map_add] at *; exact hx.add hy smul_mem' a x hx := by - rw [Set.mem_setOf_eq, LinearMap.map_smulₛₗ] at * + rw [Set.mem_ofPred_eq, LinearMap.map_smulₛₗ] at * exact hx.const_smul (conj a) /-- The operator `fun x ↦ ⟪y, T x⟫` considered as a continuous linear operator diff --git a/Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean b/Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean index 17fc9ab9169928..4c44ed2b429896 100644 --- a/Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean +++ b/Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean @@ -62,7 +62,7 @@ theorem LinearMap.tendsto_birkhoffAverage_of_ker_subset_closure [NormedSpace By assumption, `LinearMap.range (f - 1)` is dense in the kernel of `g`, so it suffices to prove the theorem for `y = f x - x`. -/ have : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f _root_.id · x) atTop (𝓝 0)} := - isClosed_setOf_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const + isClosed_setOfPred_tendsto_birkhoffAverage 𝕜 hf uniformContinuous_id continuous_const refine closure_minimal (Set.forall_mem_range.2 fun x ↦ ?_) this (hg_ker hy) /- Finally, for `y = f x - x` the average is equal to the difference between averages along the orbits of `f x` and `x`, and most of the terms cancel. -/ diff --git a/Mathlib/Analysis/InnerProductSpace/PiL2.lean b/Mathlib/Analysis/InnerProductSpace/PiL2.lean index 297d9435e95b06..18f334623bf525 100644 --- a/Mathlib/Analysis/InnerProductSpace/PiL2.lean +++ b/Mathlib/Analysis/InnerProductSpace/PiL2.lean @@ -177,18 +177,18 @@ theorem EuclideanSpace.ball_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 Metric.ball (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 < r ^ 2} := by ext x have : (0 : ℝ) ≤ ∑ i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _ - simp_rw [mem_setOf, mem_ball_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_lt this hr] + simp_rw [mem_ofPred, mem_ball_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_lt this hr] theorem EuclideanSpace.closedBall_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 ≤ r) : Metric.closedBall (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 ≤ r ^ 2} := by ext - simp_rw [mem_setOf, mem_closedBall_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_le_left hr] + simp_rw [mem_ofPred, mem_closedBall_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_le_left hr] theorem EuclideanSpace.sphere_zero_eq {n : Type*} [Fintype n] (r : ℝ) (hr : 0 ≤ r) : Metric.sphere (0 : EuclideanSpace ℝ n) r = {x | ∑ i, x i ^ 2 = r ^ 2} := by ext x have : (0 : ℝ) ≤ ∑ i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _ - simp_rw [mem_setOf, mem_sphere_zero_iff_norm, norm_eq, norm_eq_abs, sq_abs, + simp_rw [mem_ofPred, mem_sphere_zero_iff_norm, norm_eq, norm_eq_abs, sq_abs, Real.sqrt_eq_iff_eq_sq this hr] section diff --git a/Mathlib/Analysis/InnerProductSpace/Rayleigh.lean b/Mathlib/Analysis/InnerProductSpace/Rayleigh.lean index d1eb401d913e89..05c76a7fef3657 100644 --- a/Mathlib/Analysis/InnerProductSpace/Rayleigh.lean +++ b/Mathlib/Analysis/InnerProductSpace/Rayleigh.lean @@ -213,9 +213,7 @@ theorem linearly_dependent_of_isLocalExtrOn (hT : IsSelfAdjoint T) {x₀ : F} (hextr : IsLocalExtrOn T.reApplyInnerSelf (sphere (0 : F) ‖x₀‖) x₀) : ∃ a b : ℝ, (a, b) ≠ 0 ∧ a • x₀ + b • T x₀ = 0 := by have H : IsLocalExtrOn T.reApplyInnerSelf {x : F | ‖x‖ ^ 2 = ‖x₀‖ ^ 2} x₀ := by - convert! hextr - ext x - simp + simpa [sphere] using hextr -- find Lagrange multipliers for the function `T.re_apply_inner_self` and the -- hypersurface-defining function `fun x ↦ ‖x‖ ^ 2` obtain ⟨a, b, h₁, h₂⟩ := diff --git a/Mathlib/Analysis/InnerProductSpace/l2Space.lean b/Mathlib/Analysis/InnerProductSpace/l2Space.lean index a4d66041103696..a3d6a5f73ea0dd 100644 --- a/Mathlib/Analysis/InnerProductSpace/l2Space.lean +++ b/Mathlib/Analysis/InnerProductSpace/l2Space.lean @@ -556,7 +556,7 @@ theorem _root_.Orthonormal.exists_hilbertBasis_extension {s : Set E} ∃ (w : Set E) (b : HilbertBasis w 𝕜 E), s ⊆ w ∧ ⇑b = ((↑) : w → E) := let ⟨w, hws, hw_ortho, hw_max⟩ := exists_maximal_orthonormal hs ⟨w, HilbertBasis.mkOfOrthogonalEqBot hw_ortho - (by simpa only [Subtype.range_coe_subtype, Set.setOf_mem_eq, + (by simpa only [Subtype.range_coe_subtype, Set.ofPred_mem_eq, maximal_orthonormal_iff_orthogonalComplement_eq_bot hw_ortho] using hw_max), hws, HilbertBasis.coe_mkOfOrthogonalEqBot _ _⟩ diff --git a/Mathlib/Analysis/LocallyConvex/AbsConvexOpen.lean b/Mathlib/Analysis/LocallyConvex/AbsConvexOpen.lean index 3ea3c4d5852ae0..2ad2056864869b 100644 --- a/Mathlib/Analysis/LocallyConvex/AbsConvexOpen.lean +++ b/Mathlib/Analysis/LocallyConvex/AbsConvexOpen.lean @@ -100,7 +100,7 @@ theorem gaugeSeminormFamily_ball (s : AbsConvexOpenSets 𝕜 E) : dsimp only [gaugeSeminormFamily] rw [Seminorm.ball_zero_eq] simp_rw [gaugeSeminorm_toFun] - exact setOf_gauge_lt_one_eq_self_of_isOpen (s.coe_convex.lift ℝ) s.coe_zero_mem s.coe_isOpen + exact setOfPred_gauge_lt_one_eq_self_of_isOpen (s.coe_convex.lift ℝ) s.coe_zero_mem s.coe_isOpen variable [IsTopologicalAddGroup E] [ContinuousSMul 𝕜 E] variable [LocallyConvexSpace 𝕜 E] diff --git a/Mathlib/Analysis/LocallyConvex/BalancedCoreHull.lean b/Mathlib/Analysis/LocallyConvex/BalancedCoreHull.lean index 820e9f6e004795..699db2b152b778 100644 --- a/Mathlib/Analysis/LocallyConvex/BalancedCoreHull.lean +++ b/Mathlib/Analysis/LocallyConvex/BalancedCoreHull.lean @@ -76,7 +76,7 @@ theorem balancedCore_empty : balancedCore 𝕜 (∅ : Set E) = ∅ := eq_empty_of_subset_empty (balancedCore_subset _) theorem mem_balancedCore_iff : x ∈ balancedCore 𝕜 s ↔ ∃ t, Balanced 𝕜 t ∧ t ⊆ s ∧ x ∈ t := by - simp_rw [balancedCore, mem_sUnion, mem_setOf_eq, and_assoc] + simp_rw [balancedCore, mem_sUnion, mem_ofPred_eq, and_assoc] theorem smul_balancedCore_subset (s : Set E) {a : 𝕜} (ha : ‖a‖ ≤ 1) : a • balancedCore 𝕜 s ⊆ balancedCore 𝕜 s := by @@ -244,7 +244,7 @@ protected theorem IsOpen.balancedHull [ContinuousConstSMul 𝕜 E] {s : Set E} ( · exact ⟨1, by simp, by simpa [Set.zero_smul_set ⟨0, hzero⟩]⟩ · use r rw [balancedHull, this] - exact isOpen_biUnion (fun r hr ↦ hs.smul₀ hr.2) + exact isOpen_biUnion (s := {r : 𝕜 | ‖r‖ ≤ 1 ∧ r ≠ 0}) (fun r hr ↦ hs.smul₀ hr.2) -- We don't have a `NontriviallyNormedDivisionRing`, so we use a `NeBot` assumption instead variable [NeBot (𝓝[≠] (0 : 𝕜))] diff --git a/Mathlib/Analysis/LocallyConvex/Bounded.lean b/Mathlib/Analysis/LocallyConvex/Bounded.lean index e566bef73d8e25..746107ccd4d81a 100644 --- a/Mathlib/Analysis/LocallyConvex/Bounded.lean +++ b/Mathlib/Analysis/LocallyConvex/Bounded.lean @@ -356,7 +356,7 @@ theorem isVonNBounded_sub : end IsTopologicalAddGroup /-- The union of all bounded set is the whole space. -/ -theorem sUnion_isVonNBounded_eq_univ : ⋃₀ setOf (IsVonNBounded 𝕜) = (Set.univ : Set E) := +theorem sUnion_isVonNBounded_eq_univ : ⋃₀ Set.ofPred (IsVonNBounded 𝕜) = (Set.univ : Set E) := Set.eq_univ_iff_forall.mpr fun x => Set.mem_sUnion.mpr ⟨{x}, isVonNBounded_singleton _, Set.mem_singleton _⟩ @@ -368,7 +368,7 @@ variable (𝕜 E) Note that this is not registered as an instance, in order to avoid diamonds with the metric bornology. -/ abbrev vonNBornology : Bornology E := - Bornology.ofBounded (setOf (IsVonNBounded 𝕜)) (isVonNBounded_empty 𝕜 E) + Bornology.ofBounded (Set.ofPred (IsVonNBounded 𝕜)) (isVonNBounded_empty 𝕜 E) (fun _ hs _ ht => hs.subset ht) (fun _ hs _ => hs.union) isVonNBounded_singleton variable {E} diff --git a/Mathlib/Analysis/LocallyConvex/Polar.lean b/Mathlib/Analysis/LocallyConvex/Polar.lean index 597edd8783ff7f..4a337e5df82833 100644 --- a/Mathlib/Analysis/LocallyConvex/Polar.lean +++ b/Mathlib/Analysis/LocallyConvex/Polar.lean @@ -82,7 +82,7 @@ theorem polar_nonempty (s : Set E) : Set.Nonempty (B.polar s) := by theorem polar_eq_iInter {s : Set E} : B.polar s = ⋂ x ∈ s, { y : F | ‖B x y‖ ≤ 1 } := by ext - simp only [polar_mem_iff, Set.mem_iInter, Set.mem_setOf_eq] + simp only [polar_mem_iff, Set.mem_iInter, Set.mem_ofPred_eq] /-- The map `B.polar : Set E → Set F` forms an order-reversing Galois connection with `B.flip.polar : Set F → Set E`. We use `OrderDual.toDual` and `OrderDual.ofDual` to express @@ -112,10 +112,10 @@ theorem polar_singleton {a : E} : B.polar {a} = { y | ‖B a y‖ ≤ 1 } := le_ (fun y hy => (polar_mem_iff _ _ _).mp (fun _ hb => by rw [Set.mem_singleton_iff.mp hb]; exact hy)) theorem mem_polar_singleton {x : E} (y : F) : y ∈ B.polar {x} ↔ ‖B x y‖ ≤ 1 := by - simp only [polar_singleton, Set.mem_setOf_eq] + simp only [polar_singleton, Set.mem_ofPred_eq] theorem polar_zero : B.polar ({0} : Set E) = Set.univ := by - simp only [polar_singleton, map_zero, zero_apply, norm_zero, zero_le_one, Set.setOf_true] + simp only [polar_singleton, map_zero, zero_apply, norm_zero, zero_le_one, Set.ofPred_true] theorem subset_bipolar (s : Set E) : s ⊆ B.flip.polar (B.polar s) := fun x hx y hy => by rw [B.flip_apply] @@ -128,7 +128,7 @@ theorem tripolar_eq_polar (s : Set E) : B.polar (B.flip.polar (B.polar s)) = B.p theorem sInter_polar_finite_subset_eq_polar (s : Set E) : ⋂₀ (B.polar '' { F | F.Finite ∧ F ⊆ s }) = B.polar s := by ext x - simp only [Set.sInter_image, Set.mem_setOf_eq, Set.mem_iInter, and_imp] + simp only [Set.sInter_image, Set.mem_ofPred_eq, Set.mem_iInter, and_imp] refine ⟨fun hx a ha ↦ ?_, fun hx F _ hF₂ => polar_antitone _ hF₂ hx⟩ simpa [mem_polar_singleton] using hx _ (Set.finite_singleton a) (Set.singleton_subset_iff.mpr ha) @@ -211,13 +211,16 @@ lemma polarSubmodule_eq_polar (m : SubMulAction 𝕜 E) : theorem mem_polar_iff {x' : StrongDual 𝕜 E} (s : Set E) : x' ∈ polar 𝕜 s ↔ ∀ z ∈ s, ‖x' z‖ ≤ 1 := Iff.rfl -lemma polarSubmodule_eq_setOf {S : Type*} [SetLike S E] [SMulMemClass S 𝕜 E] (m : S) : +lemma polarSubmodule_eq_setOfPred {S : Type*} [SetLike S E] [SMulMemClass S 𝕜 E] (m : S) : polarSubmodule 𝕜 m = { y : StrongDual 𝕜 E | ∀ x ∈ m, y x = 0 } := (topDualPairing 𝕜 E).flip.polar_subMulAction _ +@[deprecated (since := "2026-07-09")] +alias polarSubmodule_eq_setOf := polarSubmodule_eq_setOfPred + lemma mem_polarSubmodule {S : Type*} [SetLike S E] [SMulMemClass S 𝕜 E] (m : S) (y : StrongDual 𝕜 E) : y ∈ polarSubmodule 𝕜 m ↔ ∀ x ∈ m, y x = 0 := - propext_iff.mp congr($(polarSubmodule_eq_setOf 𝕜 m) y) + Set.ext_iff.mp (polarSubmodule_eq_setOfPred 𝕜 m) y @[simp] theorem zero_mem_polar (s : Set E) : (0 : StrongDual 𝕜 E) ∈ polar 𝕜 s := @@ -237,7 +240,7 @@ theorem polar_singleton {a : E} : polar 𝕜 {a} = { x | ‖x a‖ ≤ 1 } := by simp only [polar, LinearMap.polar_singleton, LinearMap.flip_apply, topDualPairing_apply] theorem mem_polar_singleton {a : E} (y : StrongDual 𝕜 E) : y ∈ polar 𝕜 {a} ↔ ‖y a‖ ≤ 1 := by - simp only [polar_singleton, mem_setOf_eq] + simp only [polar_singleton, mem_ofPred_eq] theorem polar_zero : polar 𝕜 ({0} : Set E) = Set.univ := LinearMap.polar_zero _ diff --git a/Mathlib/Analysis/LocallyConvex/Separation.lean b/Mathlib/Analysis/LocallyConvex/Separation.lean index 042f0b08b8fb9c..b0d41da762ef66 100644 --- a/Mathlib/Analysis/LocallyConvex/Separation.lean +++ b/Mathlib/Analysis/LocallyConvex/Separation.lean @@ -66,8 +66,8 @@ theorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [IsTopolo (hφ₂ x).trans_lt (gauge_lt_one_of_mem_of_isOpen hs₂ hx) refine ⟨⟨φ, ?_⟩, hφ₃, hφ₄⟩ refine - φ.continuous_of_nonzero_on_open _ (hs₂.vadd (-x₀)) (Nonempty.vadd_set ⟨0, hs₀⟩) - (vadd_set_subset_iff.mpr fun x hx => ?_) + φ.continuous_of_nonzero_on_open _ (hs₂.vadd (-x₀)) (Nonempty.vadd_set ⟨0, hs₀⟩) ?_ + rintro _ ⟨x, hx, rfl⟩ change φ (-x₀ + x) ≠ 0 rw [map_add, map_neg] specialize hφ₄ x hx @@ -245,7 +245,7 @@ theorem geometric_hahn_banach_point_point [T1Space E] (hxy : x ≠ y) : /-- A closed convex set is the intersection of the half-spaces containing it. -/ theorem iInter_halfSpaces_eq (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) : ⋂ l : StrongDual ℝ E, { x | ∃ y ∈ s, l x ≤ l y } = s := by - rw [Set.iInter_setOf] + rw [Set.iInter_ofPred] refine Set.Subset.antisymm (fun x hx => ?_) fun x hx l => ⟨x, hx, le_rfl⟩ by_contra h obtain ⟨l, s, hlA, hl⟩ := geometric_hahn_banach_closed_point hs₁ hs₂ h @@ -372,7 +372,7 @@ theorem geometric_hahn_banach_point_point [T1Space E] (hxy : x ≠ y) : theorem iInter_halfSpaces_eq (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) : ⋂ l : StrongDual 𝕜 E, { x | ∃ y ∈ s, re (l x) ≤ re (l y) } = s := by - rw [Set.iInter_setOf] + rw [Set.iInter_ofPred] refine Set.Subset.antisymm (fun x hx => ?_) fun x hx l => ⟨x, hx, le_rfl⟩ by_contra h obtain ⟨l, s, hlA, hl⟩ := geometric_hahn_banach_closed_point (𝕜 := 𝕜) hs₁ hs₂ h @@ -381,7 +381,7 @@ theorem iInter_halfSpaces_eq (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) : theorem iInter_halfSpaces_eq' (hs₁ : Convex ℝ s) (hs₂ : IsClosed s) : ⋂ (l : StrongDual 𝕜 E) (c : ℝ) (_ : ∀ y ∈ s, re (l y) ≤ c), { x | re (l x) ≤ c } = s := by - simp_rw [Set.iInter_setOf] + simp_rw [Set.iInter_ofPred] refine Set.Subset.antisymm (fun x hx => ?_) fun x hx l c hc => hc x hx by_contra h obtain ⟨l, c, hls, hl⟩ := geometric_hahn_banach_closed_point (𝕜 := 𝕜) hs₁ hs₂ h diff --git a/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean b/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean index ff1bccfc3716c5..fd1f731a8d294f 100644 --- a/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean +++ b/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean @@ -615,7 +615,7 @@ theorem withSeminorms_iff_mem_nhds_isVonNBounded [IsTopologicalAddGroup E] grw [← ts] rcases (SeminormFamily.basisSets_iff _).1 ht with ⟨w, r, r_pos, hw⟩ rcases eq_or_ne w ∅ with rfl | w_ne - · simp only [ball, Finset.sup_empty, sub_zero, coe_bot, Pi.zero_apply, r_pos, setOf_true] at hw + · simp only [ball, Finset.sup_empty, sub_zero, coe_bot, Pi.zero_apply, r_pos, ofPred_true] at hw simp [hw] have : t = p.ball 0 r := by have : w = Finset.univ := by diff --git a/Mathlib/Analysis/Matrix/Order.lean b/Mathlib/Analysis/Matrix/Order.lean index 20eec4b66f66bc..709c5647dfd71b 100644 --- a/Mathlib/Analysis/Matrix/Order.lean +++ b/Mathlib/Analysis/Matrix/Order.lean @@ -169,7 +169,7 @@ theorem posSemidef_iff_isHermitian_and_spectrum_nonneg [DecidableEq n] {A : Matr A.PosSemidef ↔ A.IsHermitian ∧ spectrum 𝕜 A ⊆ {a : 𝕜 | 0 ≤ a} := by refine ⟨fun h => ⟨h.isHermitian, fun a => ?_⟩, fun ⟨h1, h2⟩ => ?_⟩ · simp only [h.isHermitian.spectrum_eq_image_range, Set.mem_image, Set.mem_range, - exists_exists_eq_and, Set.mem_setOf_eq, forall_exists_index] + exists_exists_eq_and, Set.mem_ofPred_eq, forall_exists_index] rintro i rfl exact_mod_cast h.eigenvalues_nonneg _ · rw [h1.posSemidef_iff_eigenvalues_nonneg] diff --git a/Mathlib/Analysis/MeanInequalities.lean b/Mathlib/Analysis/MeanInequalities.lean index b6aba130f375d6..a6d84bb17d7a04 100644 --- a/Mathlib/Analysis/MeanInequalities.lean +++ b/Mathlib/Analysis/MeanInequalities.lean @@ -785,7 +785,7 @@ theorem isGreatest_Lp (f : ι → ℝ≥0) {p q : ℝ} (hpq : p.HolderConjugate have B : ∀ y : ℝ≥0, y * y ^ p / y = y ^ p := by refine fun y => mul_div_cancel_left_of_imp fun h => ?_ simp [h, hpq.ne_zero] - simp only [Set.mem_setOf_eq, div_rpow, ← sum_div, ← rpow_mul, + simp only [Set.mem_ofPred_eq, div_rpow, ← sum_div, ← rpow_mul, div_mul_cancel₀ _ hpq.symm.ne_zero, rpow_one, div_le_iff₀ hf, one_mul, hpq.mul_eq_add, ← rpow_sub' A, add_sub_cancel_right, le_refl, true_and, ← mul_div_assoc, B] rw [div_eq_iff, ← rpow_add hf.ne', one_div, one_div, hpq.inv_add_inv_eq_one, rpow_one] diff --git a/Mathlib/Analysis/Meromorphic/Basic.lean b/Mathlib/Analysis/Meromorphic/Basic.lean index 8986659627ce08..775a17e8b918a3 100644 --- a/Mathlib/Analysis/Meromorphic/Basic.lean +++ b/Mathlib/Analysis/Meromorphic/Basic.lean @@ -514,7 +514,7 @@ theorem congr_codiscreteWithin (hf : MeromorphicOn f U) (h₁ : f =ᶠ[codiscret apply mem_nhdsWithin.mpr use U, h₂, hx, Set.inter_subset_left filter_upwards [this, h₁ x hx] with a h₁a h₂a - simp only [Set.mem_compl_iff, Set.mem_sdiff, Set.mem_setOf_eq, not_and] at h₂a + simp only [Set.mem_compl_iff, Set.mem_sdiff, Set.mem_ofPred_eq, not_and] at h₂a tauto /-- diff --git a/Mathlib/Analysis/Meromorphic/Divisor.lean b/Mathlib/Analysis/Meromorphic/Divisor.lean index 9605d5ffb3dda6..7d32e485742c7d 100644 --- a/Mathlib/Analysis/Meromorphic/Divisor.lean +++ b/Mathlib/Analysis/Meromorphic/Divisor.lean @@ -48,8 +48,8 @@ noncomputable def divisor (f : 𝕜 → E) (U : Set 𝕜) : ← supportDiscreteWithin_iff_locallyFiniteWithin] by_cases hf : MeromorphicOn f U · filter_upwards [mem_codiscrete_subtype_iff_mem_codiscreteWithin.1 - hf.codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top] - simp only [Set.mem_image, Set.mem_setOf_eq, Subtype.exists, exists_and_left, exists_prop, + hf.codiscrete_setOfPred_meromorphicOrderAt_eq_zero_or_top] + simp only [Set.mem_image, Set.mem_ofPred_eq, Subtype.exists, exists_and_left, exists_prop, exists_eq_right_right, Pi.ofNat_apply, ite_eq_right_iff, WithTop.untop₀_eq_zero, and_imp] tauto · simp [hf, Pi.zero_def] @@ -164,7 +164,7 @@ theorem divisor_congr_codiscreteWithin {f₁ f₂ : 𝕜 → E} (h₁ : f₁ = apply mem_nhdsWithin.mpr use U, h₂, hx, Set.inter_subset_left filter_upwards [this, h₁ x hx] with a h₁a h₂a - simp only [Set.mem_compl_iff, Set.mem_sdiff, Set.mem_setOf_eq, not_and] at h₂a + simp only [Set.mem_compl_iff, Set.mem_sdiff, Set.mem_ofPred_eq, not_and] at h₂a tauto · simp [hx] · simp [divisor, hf₁, (meromorphicOn_congr_codiscreteWithin h₁ h₂).not.1 hf₁] diff --git a/Mathlib/Analysis/Meromorphic/IsolatedZeros.lean b/Mathlib/Analysis/Meromorphic/IsolatedZeros.lean index 3773c083891eff..8ffdcd91c1e7a3 100644 --- a/Mathlib/Analysis/Meromorphic/IsolatedZeros.lean +++ b/Mathlib/Analysis/Meromorphic/IsolatedZeros.lean @@ -68,14 +68,18 @@ theorem eventuallyEq_zero_nhdsNE_of_eventuallyEq_zero_codiscreteWithin (hf : Mer Variant of the principle of isolated zeros, formulated in terms of orders: If `f` is nowhere locally constant zero, then its zero set is discrete within its domain of meromorphicity. -/ -theorem MeromorphicOn.codiscreteWithin_setOf_ne_zero (h₁f : MeromorphicOn f U) +theorem MeromorphicOn.codiscreteWithin_setOfPred_ne_zero (h₁f : MeromorphicOn f U) (h₂f : ∀ u ∈ U, meromorphicOrderAt f u ≠ ⊤) : ∀ᶠ x in codiscreteWithin U, f x ≠ 0 := by filter_upwards [h₁f.analyticAt_mem_codiscreteWithin, - h₁f.codiscreteWithin_setOf_meromorphicOrderAt_eq_zero_or_top h₂f] with x h₁x h₂x + h₁f.codiscreteWithin_setOfPred_meromorphicOrderAt_eq_zero_or_top h₂f] with x h₁x h₂x have := h₂f x h₂x.1 simp_all [← h₁x.analyticOrderAt_eq_zero, h₁x.meromorphicOrderAt_eq] +@[deprecated (since := "2026-07-09")] +alias MeromorphicOn.codiscreteWithin_setOf_ne_zero := + MeromorphicOn.codiscreteWithin_setOfPred_ne_zero + /-! ## Identity Principles -/ @@ -120,11 +124,11 @@ theorem eventually_nhdsSet_eventuallyEq_codiscreteWithin (hf : MeromorphicOn f U ∀ᶠ x in 𝓝ˢ U, f =ᶠ[𝓝[≠] x] g := by rw [eventually_nhdsSet_iff_exists] use {x | f =ᶠ[𝓝[≠] x] g} - simp only [Set.mem_setOf_eq, imp_self, implies_true, and_true] + simp only [Set.mem_ofPred_eq, imp_self, implies_true, and_true] constructor - · apply isOpen_setOf_eventually_nhdsWithin + · apply isOpen_setOfPred_eventually_nhdsWithin · intro x hx - rw [Set.mem_setOf] + rw [Set.mem_ofPred] exact eventuallyEq_nhdsNE_of_eventuallyEq_codiscreteWithin (hf x hx) (hg x hx) hx (hU x hx) h end MeromorphicAt diff --git a/Mathlib/Analysis/Meromorphic/NormalForm.lean b/Mathlib/Analysis/Meromorphic/NormalForm.lean index 87a4d466bcb71e..5613f1682eebf0 100644 --- a/Mathlib/Analysis/Meromorphic/NormalForm.lean +++ b/Mathlib/Analysis/Meromorphic/NormalForm.lean @@ -393,7 +393,7 @@ theorem MeromorphicNFAt.comp_analyticAt (hf : MeromorphicNFAt f (g x)) (hg : Ana IsUnit.smul_eq_zero, true_and] filter_upwards [h₃p, hg.continuousAt.preimage_mem_nhds (hf.filter_mono (by simp))] with a h₁a h₂a - simp_all only [Pi.smul_apply', Pi.pow_apply, Set.preimage_setOf_eq, Set.mem_setOf_eq, + simp_all only [Pi.smul_apply', Pi.pow_apply, Set.preimage_ofPred_eq, Set.mem_ofPred_eq, Function.comp_apply, ← smul_assoc, mul_zpow, smul_eq_mul] congr 2 rw [mul_comm, zpow_mul, zpow_natCast] diff --git a/Mathlib/Analysis/Meromorphic/Order.lean b/Mathlib/Analysis/Meromorphic/Order.lean index 1579cfa70c8f60..18ed87b6de2495 100644 --- a/Mathlib/Analysis/Meromorphic/Order.lean +++ b/Mathlib/Analysis/Meromorphic/Order.lean @@ -680,7 +680,7 @@ variable {U : Set 𝕜} /-- The set where a meromorphic function has infinite order is clopen in its domain of meromorphy. -/ -theorem isClopen_setOf_meromorphicOrderAt_eq_top (hf : MeromorphicOn f U) : +theorem isClopen_setOfPred_meromorphicOrderAt_eq_top (hf : MeromorphicOn f U) : IsClopen { u : U | meromorphicOrderAt f u = ⊤ } := by constructor · rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open] @@ -708,14 +708,14 @@ theorem isClopen_setOf_meromorphicOrderAt_eq_top (hf : MeromorphicOn f U) : conv => arg 1; intro; left; right; arg 1; intro rw [meromorphicOrderAt_eq_top_iff, eventually_nhdsWithin_iff, eventually_nhds_iff] - simp only [mem_setOf_eq] at hz + simp only [mem_ofPred_eq] at hz rw [meromorphicOrderAt_eq_top_iff, eventually_nhdsWithin_iff, eventually_nhds_iff] at hz obtain ⟨t', h₁t', h₂t', h₃t'⟩ := hz use Subtype.val ⁻¹' t' simp only [mem_compl_iff, mem_singleton_iff, isOpen_induced h₂t', mem_preimage, h₃t', and_self, and_true] intro w hw - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] -- Trivial case: w = z by_cases h₁w : w = z · rw [h₁w] @@ -724,8 +724,10 @@ theorem isClopen_setOf_meromorphicOrderAt_eq_top (hf : MeromorphicOn f U) : use t' \ {z.1}, fun y h₁y _ ↦ h₁t' y (mem_of_mem_sdiff h₁y) (mem_of_mem_inter_right h₁y) constructor · exact h₂t'.sdiff isClosed_singleton - · apply (mem_sdiff w).1 - exact ⟨hw, mem_singleton_iff.not.1 (Subtype.coe_ne_coe.2 h₁w)⟩ + · exact ⟨hw, mem_singleton_iff.not.1 (Subtype.coe_ne_coe.2 h₁w)⟩ + +@[deprecated (since := "2026-07-09")] +alias isClopen_setOf_meromorphicOrderAt_eq_top := isClopen_setOfPred_meromorphicOrderAt_eq_top /-- On a connected set, there exists a point where a meromorphic function `f` has finite order iff `f` @@ -740,7 +742,7 @@ theorem exists_meromorphicOrderAt_ne_top_iff_forall (hf : MeromorphicOn f U) (hU constructor · intro h₂f have := isPreconnected_iff_preconnectedSpace.1 hU.isPreconnected - rcases isClopen_iff.1 hf.isClopen_setOf_meromorphicOrderAt_eq_top with h | h + rcases isClopen_iff.1 hf.isClopen_setOfPred_meromorphicOrderAt_eq_top with h | h · intro u have : u ∉ (∅ : Set U) := by exact fun a => a rw [← h] at this @@ -806,7 +808,7 @@ theorem analyticAt_mem_codiscreteWithin (hf : MeromorphicOn f U) : /-- The set where a meromorphic function has zero or infinite order is codiscrete within its domain of meromorphicity. -/ -theorem codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top (hf : MeromorphicOn f U) : +theorem codiscrete_setOfPred_meromorphicOrderAt_eq_zero_or_top (hf : MeromorphicOn f U) : {u : U | meromorphicOrderAt f u = 0 ∨ meromorphicOrderAt f u = ⊤} ∈ Filter.codiscrete U := by rw [mem_codiscrete_subtype_iff_mem_codiscreteWithin, mem_codiscreteWithin] intro x hx @@ -822,24 +824,32 @@ theorem codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top (hf : MeromorphicOn f use t \ {x}, fun y h₁y _ ↦ h₁t y h₁y.1 h₁y.2 exact ⟨h₂t.sdiff isClosed_singleton, Set.mem_sdiff_of_mem h₃t hax⟩ · filter_upwards [hf.eventually_analyticAt_or_mem_compl hx, h₁f] with a h₁a h'₁a - simp only [mem_compl_iff, Set.mem_sdiff, mem_image, mem_setOf_eq, Subtype.exists, + simp only [mem_compl_iff, Set.mem_sdiff, mem_image, mem_ofPred_eq, Subtype.exists, exists_and_right, exists_eq_right, not_exists, not_or, not_and, not_forall, Decidable.not_not] rcases h₁a with h' | h' · simp +contextual [h'.meromorphicOrderAt_eq, h'.analyticOrderAt_eq_zero.2, h'₁a] · exact fun ha ↦ (h' ha).elim +@[deprecated (since := "2026-07-09")] +alias codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top := + codiscrete_setOfPred_meromorphicOrderAt_eq_zero_or_top + /-- -Variant of `codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top`: The set where a meromorphic +Variant of `codiscrete_setOfPred_meromorphicOrderAt_eq_zero_or_top`: The set where a meromorphic function has zero or infinite order is codiscrete within its domain of meromorphicity. -/ -theorem codiscreteWithin_setOf_meromorphicOrderAt_eq_zero_or_top (h₁f : MeromorphicOn f U) +theorem codiscreteWithin_setOfPred_meromorphicOrderAt_eq_zero_or_top (h₁f : MeromorphicOn f U) (h₂f : ∀ u ∈ U, meromorphicOrderAt f u ≠ ⊤) : {u ∈ U | meromorphicOrderAt f u = 0 ∨ meromorphicOrderAt f u = ⊤} ∈ codiscreteWithin U := by convert! mem_codiscrete_subtype_iff_mem_codiscreteWithin.1 - h₁f.codiscrete_setOf_meromorphicOrderAt_eq_zero_or_top + h₁f.codiscrete_setOfPred_meromorphicOrderAt_eq_zero_or_top aesop +@[deprecated (since := "2026-07-09")] +alias codiscreteWithin_setOf_meromorphicOrderAt_eq_zero_or_top := + codiscreteWithin_setOfPred_meromorphicOrderAt_eq_zero_or_top + end MeromorphicOn section comp diff --git a/Mathlib/Analysis/Normed/Affine/AddTorsorBases.lean b/Mathlib/Analysis/Normed/Affine/AddTorsorBases.lean index 9ce6fe4f1ad9a8..e6a048577db7ed 100644 --- a/Mathlib/Analysis/Normed/Affine/AddTorsorBases.lean +++ b/Mathlib/Analysis/Normed/Affine/AddTorsorBases.lean @@ -65,12 +65,12 @@ theorem AffineBasis.interior_convexHull {ι E : Type*} [Finite ι] [NormedAddCom · -- The positive-dimensional case. haveI : FiniteDimensional ℝ E := b.finiteDimensional have : convexHull ℝ (range b) = ⋂ i, b.coord i ⁻¹' Ici 0 := by - rw [b.convexHull_eq_nonneg_coord, setOf_forall]; rfl + rw [b.convexHull_eq_nonneg_coord, ofPred_forall]; rfl ext simp only [this, interior_iInter_of_finite, ← IsOpenMap.preimage_interior_eq_interior_preimage (isOpenMap_barycentric_coord b _) (continuous_barycentric_coord b _), - interior_Ici, mem_iInter, mem_setOf_eq, mem_Ioi, mem_preimage] + interior_Ici, mem_iInter, mem_ofPred_eq, mem_Ioi, mem_preimage] variable {V P : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] @@ -127,7 +127,7 @@ theorem affineSpan_eq_top_of_nonempty_interior {s : Set V} theorem AffineBasis.centroid_mem_interior_convexHull {ι} [Fintype ι] (b : AffineBasis ι ℝ V) : Finset.univ.centroid ℝ b ∈ interior (convexHull ℝ (range b)) := by haveI := b.nonempty - simp only [b.interior_convexHull, mem_setOf_eq, b.coord_apply_centroid (Finset.mem_univ _), + simp only [b.interior_convexHull, mem_ofPred_eq, b.coord_apply_centroid (Finset.mem_univ _), inv_pos, Nat.cast_pos, Finset.card_pos, Finset.univ_nonempty, forall_true_iff] theorem interior_convexHull_nonempty_iff_affineSpan_eq_top [FiniteDimensional ℝ V] {s : Set V} : @@ -135,7 +135,7 @@ theorem interior_convexHull_nonempty_iff_affineSpan_eq_top [FiniteDimensional refine ⟨affineSpan_eq_top_of_nonempty_interior, fun h => ?_⟩ obtain ⟨t, hts, b, hb⟩ := AffineBasis.exists_affine_subbasis h suffices (interior (convexHull ℝ (range b))).Nonempty by - rw [hb, Subtype.range_coe_subtype, setOf_mem_eq] at this + rw [hb, Subtype.range_coe_subtype, ofPred_mem_eq] at this refine this.mono (by gcongr) lift t to Finset V using b.finite_set exact ⟨_, b.centroid_mem_interior_convexHull⟩ diff --git a/Mathlib/Analysis/Normed/Algebra/GelfandMazur.lean b/Mathlib/Analysis/Normed/Algebra/GelfandMazur.lean index 4ffd097b948af3..e89fe2a0b3e25c 100644 --- a/Mathlib/Analysis/Normed/Algebra/GelfandMazur.lean +++ b/Mathlib/Analysis/Normed/Algebra/GelfandMazur.lean @@ -153,7 +153,7 @@ lemma exists_isMinOn_norm_sub_smul (𝕜 : Type*) {F : Type*} [NormedField 𝕜] simp only [isMinOn_univ_iff] refine (show Continuous fun z : 𝕜 ↦ ‖x - algebraMap 𝕜 F z‖ by fun_prop) |>.exists_forall_le_of_isBounded 0 ?_ - simpa [isBounded_def, compl_setOf, Ioi] using this (Ioi_mem_atTop ‖x - (0 : 𝕜) • 1‖) + simpa [isBounded_def, compl_ofPred, Ioi] using this (Ioi_mem_atTop ‖x - (0 : 𝕜) • 1‖) /-! ### The complex case @@ -374,7 +374,7 @@ private lemma exists_isMinOn_norm_φ (x : F) : ∃ z : ℝ × ℝ, IsMinOn (‖ -- otherwise, use `tendsto_φ_cobounded`. simp only [isMinOn_univ_iff] at hu ⊢ refine (continuous_φ x).norm.exists_forall_le_of_isBounded (0, 0) ?_ - simpa [isBounded_def, compl_setOf, Ioi] + simpa [isBounded_def, compl_ofPred, Ioi] using tendsto_norm_cobounded_atTop.comp (tendsto_φ_cobounded hc₀ hu) (Ioi_mem_atTop _) open Algebra in diff --git a/Mathlib/Analysis/Normed/Algebra/MatrixExponential.lean b/Mathlib/Analysis/Normed/Algebra/MatrixExponential.lean index 3ac3080001d788..ebca3be5a8ee93 100644 --- a/Mathlib/Analysis/Normed/Algebra/MatrixExponential.lean +++ b/Mathlib/Analysis/Normed/Algebra/MatrixExponential.lean @@ -103,7 +103,7 @@ theorem IsHermitian.exp [StarRing 𝔸] [ContinuousStar 𝔸] {A : Matrix m m theorem BlockTriangular.exp [LinearOrder α] [Algebra ℚ 𝔸] {M : Matrix m m 𝔸} {b : m → α} (hM : BlockTriangular M b) : (exp M).BlockTriangular b := - exp_mem (s := blockTriangularSubalgebra ℚ _ b) isClosed_setOf_blockTriangular hM + exp_mem (s := blockTriangularSubalgebra ℚ _ b) isClosed_setOfPred_blockTriangular hM end Ring diff --git a/Mathlib/Analysis/Normed/Algebra/Spectrum.lean b/Mathlib/Analysis/Normed/Algebra/Spectrum.lean index 152771a3d46fe5..cdc8e9c95fe7b2 100644 --- a/Mathlib/Analysis/Normed/Algebra/Spectrum.lean +++ b/Mathlib/Analysis/Normed/Algebra/Spectrum.lean @@ -116,7 +116,7 @@ protected theorem isClosed (a : A) : IsClosed (σ a) := (isOpen_resolventSet a).isClosed_compl theorem mem_resolventSet_of_norm_lt_mul {a : A} {k : 𝕜} (h : ‖a‖ * ‖(1 : A)‖ < ‖k‖) : k ∈ ρ a := by - rw [resolventSet, Set.mem_setOf_eq, Algebra.algebraMap_eq_smul_one] + rw [resolventSet, Set.mem_ofPred_eq, Algebra.algebraMap_eq_smul_one] nontriviality A have hk : k ≠ 0 := ne_zero_of_norm_ne_zero ((mul_nonneg (norm_nonneg _) (norm_nonneg _)).trans_lt h).ne' diff --git a/Mathlib/Analysis/Normed/Field/Lemmas.lean b/Mathlib/Analysis/Normed/Field/Lemmas.lean index 63924b51505a9b..36bbe99969193c 100644 --- a/Mathlib/Analysis/Normed/Field/Lemmas.lean +++ b/Mathlib/Analysis/Normed/Field/Lemmas.lean @@ -106,7 +106,7 @@ theorem uniformContinuousOn_inv₀ {s : Set α} (hs : sᶜ ∈ 𝓝 0) : rw [Metric.uniformContinuousOn_iff_le] intro ε hε rcases NormedAddGroup.nhds_zero_basis_norm_lt.mem_iff.mp hs with ⟨r, hr₀, hr⟩ - simp only [Set.subset_compl_comm (t := s), Set.compl_setOf, not_lt] at hr + simp only [Set.subset_compl_comm (t := s), Set.compl_ofPred, not_lt] at hr have hs₀ : ∀ x ∈ s, x ≠ 0 := fun x hx ↦ norm_pos_iff.mp <| hr₀.trans_le (hr hx) refine ⟨ε * r ^ 2, by positivity, fun x hx y hy hxy ↦ ?_⟩ calc diff --git a/Mathlib/Analysis/Normed/Group/Basic.lean b/Mathlib/Analysis/Normed/Group/Basic.lean index f0789e63185df6..0d4b45e5fb3d1e 100644 --- a/Mathlib/Analysis/Normed/Group/Basic.lean +++ b/Mathlib/Analysis/Normed/Group/Basic.lean @@ -692,7 +692,7 @@ open Set in @[to_additive] lemma SeminormedGroup.disjoint_nhds (x : E) (f : Filter E) : Disjoint (𝓝 x) f ↔ ∃ δ > 0, ∀ᶠ y in f, δ ≤ ‖y⁻¹ * x‖ := by - simp [NormedGroup.nhds_basis_norm_lt x |>.disjoint_iff_left, compl_setOf, eventually_iff] + simp [NormedGroup.nhds_basis_norm_lt x |>.disjoint_iff_left, compl_ofPred, eventually_iff] @[to_additive] lemma SeminormedGroup.disjoint_nhds_one (f : Filter E) : diff --git a/Mathlib/Analysis/Normed/Group/Continuity.lean b/Mathlib/Analysis/Normed/Group/Continuity.lean index e4e9048e9eaae7..8b9b7ed8c4d28e 100644 --- a/Mathlib/Analysis/Normed/Group/Continuity.lean +++ b/Mathlib/Analysis/Normed/Group/Continuity.lean @@ -400,10 +400,8 @@ lemma tendsto_norm_nhdsNE_one : Tendsto (norm : E → ℝ) (𝓝[≠] 1) (𝓝[> @[to_additive] theorem tendsto_norm_inv_mul_self_nhdsNE (a : E) : - Tendsto (fun x => ‖x⁻¹ * a‖) (𝓝[≠] a) (𝓝[>] 0) := by - apply (tendsto_norm_inv_mul_self a).inf - apply tendsto_principal_principal.2 (fun _x hx => norm_pos_iff'.2 ?_) - simpa [inv_mul_eq_one] using hx + Tendsto (fun x => ‖x⁻¹ * a‖) (𝓝[≠] a) (𝓝[>] 0) := + (tendsto_norm_inv_mul_self a).inf <| by simp [inv_mul_eq_one] variable (E) diff --git a/Mathlib/Analysis/Normed/Group/Indicator.lean b/Mathlib/Analysis/Normed/Group/Indicator.lean index 6b68e51eaaf6f1..aebecf3f3ebc11 100644 --- a/Mathlib/Analysis/Normed/Group/Indicator.lean +++ b/Mathlib/Analysis/Normed/Group/Indicator.lean @@ -28,7 +28,7 @@ variable {α ε : Type*} [TopologicalSpace ε] [ESeminormedAddMonoid ε] lemma enorm_indicator_eq_indicator_enorm : ‖indicator s f a‖ₑ = indicator s (fun a => ‖f a‖ₑ) a := - flip congr_fun a (indicator_comp_of_zero (enorm_zero (E := ε))).symm + congr($((indicator_comp_of_zero (enorm_zero (E := ε))).symm) a) theorem enorm_indicator_le_of_subset (h : s ⊆ t) (f : α → ε) (a : α) : ‖indicator s f a‖ₑ ≤ ‖indicator t f a‖ₑ := by @@ -49,11 +49,11 @@ section SeminormedAddGroup variable {α E : Type*} [SeminormedAddGroup E] {s t : Set α} (f : α → E) (a : α) theorem norm_indicator_eq_indicator_norm : ‖indicator s f a‖ = indicator s (fun a => ‖f a‖) a := - flip congr_fun a (indicator_comp_of_zero norm_zero).symm + congr($((indicator_comp_of_zero norm_zero).symm) a) theorem nnnorm_indicator_eq_indicator_nnnorm : ‖indicator s f a‖₊ = indicator s (fun a => ‖f a‖₊) a := - flip congr_fun a (indicator_comp_of_zero nnnorm_zero).symm + congr($((indicator_comp_of_zero nnnorm_zero).symm) a) theorem norm_indicator_le_of_subset (h : s ⊆ t) (f : α → E) (a : α) : ‖indicator s f a‖ ≤ ‖indicator t f a‖ := by diff --git a/Mathlib/Analysis/Normed/Group/InfiniteSum.lean b/Mathlib/Analysis/Normed/Group/InfiniteSum.lean index 816bca12bd4191..32679e6e944d51 100644 --- a/Mathlib/Analysis/Normed/Group/InfiniteSum.lean +++ b/Mathlib/Analysis/Normed/Group/InfiniteSum.lean @@ -47,7 +47,7 @@ theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} : (CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff] - · simp only [ball_zero_eq, Set.mem_setOf_eq] + · simp only [ball_zero_eq, Set.mem_ofPred_eq] · rintro s t hst ⟨s', hs'⟩ exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩ diff --git a/Mathlib/Analysis/Normed/Group/NullSubmodule.lean b/Mathlib/Analysis/Normed/Group/NullSubmodule.lean index 732b933098ff31..96d92e63c44ff9 100644 --- a/Mathlib/Analysis/Normed/Group/NullSubmodule.lean +++ b/Mathlib/Analysis/Normed/Group/NullSubmodule.lean @@ -42,7 +42,7 @@ def nullSubgroup : Subgroup M where refine (norm_mul_le' x y).trans_eq ?_ rw [hx, hy, add_zero] one_mem' := norm_one' - inv_mem' {x} (hx : ‖x‖ = 0) := by simpa only [Set.mem_setOf_eq, norm_inv'] using hx + inv_mem' {x} (hx : ‖x‖ = 0) := by simpa only [Set.mem_ofPred_eq, norm_inv'] using hx @[to_additive] lemma isClosed_nullSubgroup : IsClosed (nullSubgroup M : Set M) := by diff --git a/Mathlib/Analysis/Normed/Group/Quotient.lean b/Mathlib/Analysis/Normed/Group/Quotient.lean index a2be9239e6f3e8..07beb22fe03bec 100644 --- a/Mathlib/Analysis/Normed/Group/Quotient.lean +++ b/Mathlib/Analysis/Normed/Group/Quotient.lean @@ -152,7 +152,8 @@ lemma norm_lt_iff : ‖x‖ < r ↔ ∃ m : M, ↑m = x ∧ ‖m‖ < r := by lemma nhds_one_hasBasis : (𝓝 (1 : M ⧸ S)).HasBasis (fun ε ↦ 0 < ε) fun ε ↦ {x | ‖x‖ < ε} := by have : ∀ ε : ℝ, mk '' ball (1 : M) ε = {x : M ⧸ S | ‖x‖ < ε} := by refine fun ε ↦ Set.ext <| forall_mk.2 fun x ↦ ?_ - rw [ball_one_eq, mem_setOf_eq, norm_lt_iff, mem_image] + rw [ball_one_eq] + simp only [mem_image, mem_ofPred_eq, norm_lt_iff] exact exists_congr fun _ ↦ and_comm rw [← mk_one, nhds_eq, ← funext this] exact .map _ Metric.nhds_basis_ball @@ -211,7 +212,7 @@ noncomputable instance instSeminormedCommGroup : SeminormedCommGroup (M ⧸ S) w __ := groupSeminorm.toSeminormedCommGroup uniformity_dist := by rw [uniformity_eq_comap_nhds_one_left, (nhds_one_hasBasis.comap _).eq_biInf] - simp only [dist, preimage_setOf_eq, norm_eq_groupSeminorm] + simp only [dist, preimage_ofPred_eq, norm_eq_groupSeminorm] variable (S) in /-- The quotient in the category of normed groups. -/ diff --git a/Mathlib/Analysis/Normed/Lp/lpSpace.lean b/Mathlib/Analysis/Normed/Lp/lpSpace.lean index 172f73b6945bf4..5b6eef9477fe4f 100644 --- a/Mathlib/Analysis/Normed/Lp/lpSpace.lean +++ b/Mathlib/Analysis/Normed/Lp/lpSpace.lean @@ -255,7 +255,7 @@ theorem add {f g : ∀ i, E i} (hf : Memℓp f p) (hg : Memℓp g p) : Memℓp ( rcases p.trichotomy with (rfl | rfl | hp) · apply memℓp_zero refine (hf.finite_dsupport.union hg.finite_dsupport).subset fun i => ?_ - simp only [Pi.add_apply, Ne, Set.mem_union, Set.mem_setOf_eq] + simp only [Pi.add_apply, Ne, Set.mem_union, Set.mem_ofPred_eq] contrapose! rintro ⟨hf', hg'⟩ simp [hf', hg'] @@ -508,7 +508,7 @@ theorem norm_eq_zero_iff {f : lp E p} : ‖f‖ = 0 ↔ f = 0 := by rcases p.trichotomy with (rfl | rfl | hp) · ext i have : { i : α | ¬f i = 0 } = ∅ := by simpa [lp.norm_eq_card_dsupport f] using! h - have : (¬f i = 0) = False := congr_fun this i + have : ¬¬f i = 0 := Set.eq_empty_iff_forall_notMem.mp this i tauto · rcases isEmpty_or_nonempty α with _i | _i · simp [eq_iff_true_of_subsingleton] @@ -1009,7 +1009,7 @@ protected def single (p) (i : α) (a : E i) : lp E p := refine (Set.finite_singleton i).subset ?_ intro j simp only [Set.mem_singleton_iff, Ne, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] rw [not_imp_comm] intro h exact Pi.single_eq_of_ne h _⟩ diff --git a/Mathlib/Analysis/Normed/Module/Connected.lean b/Mathlib/Analysis/Normed/Module/Connected.lean index d6856e77058738..c50c10f2e599c6 100644 --- a/Mathlib/Analysis/Normed/Module/Connected.lean +++ b/Mathlib/Analysis/Normed/Module/Connected.lean @@ -71,7 +71,7 @@ theorem Set.Countable.isPathConnected_compl_of_one_lt_rank obtain ⟨y, hy⟩ : ∃ y, LinearIndependent ℝ ![x, y] := exists_linearIndependent_pair_of_one_lt_rank h x_ne_zero have A : Set.Countable {t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty} := by - apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs + apply countable_ofPred_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs intro t t' htt' apply disjoint_iff_inter_eq_empty.2 have N : {c + x} ∩ s = ∅ := by @@ -81,7 +81,7 @@ theorem Set.Countable.isPathConnected_compl_of_one_lt_rank apply Eq.subset apply segment_inter_eq_endpoint_of_linearIndependent_of_ne hy htt'.symm have B : Set.Countable {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty} := by - apply countable_setOf_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs + apply countable_ofPred_nonempty_of_disjoint _ (fun t ↦ inter_subset_right) hs intro t t' htt' apply disjoint_iff_inter_eq_empty.2 have N : {c - x} ∩ s = ∅ := by @@ -96,7 +96,7 @@ theorem Set.Countable.isPathConnected_compl_of_one_lt_rank obtain ⟨t, ht⟩ : Set.Nonempty ({t : ℝ | ([c + x -[ℝ] c + t • y] ∩ s).Nonempty} ∪ {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ s).Nonempty})ᶜ := ((A.union B).dense_compl ℝ).nonempty let z := c + t • y - simp only [compl_union, mem_inter_iff, mem_compl_iff, mem_setOf_eq, not_nonempty_iff_eq_empty] + simp only [compl_union, mem_inter_iff, mem_compl_iff, mem_ofPred_eq, not_nonempty_iff_eq_empty] at ht have JA : JoinedIn sᶜ a z := by apply JoinedIn.of_segment_subset diff --git a/Mathlib/Analysis/Normed/Module/Convex.lean b/Mathlib/Analysis/Normed/Module/Convex.lean index f167dbde90f139..678d99dcc35dda 100644 --- a/Mathlib/Analysis/Normed/Module/Convex.lean +++ b/Mathlib/Analysis/Normed/Module/Convex.lean @@ -169,17 +169,23 @@ instance (priority := 100) NormedSpace.instPathConnectedSpace : PathConnectedSpa IsTopologicalAddGroup.pathConnectedSpace /-- The set of vectors in the same ray as `x` is connected. -/ -theorem isConnected_setOf_sameRay (x : E) : IsConnected { y | SameRay ℝ x y } := by +theorem isConnected_setOfPred_sameRay (x : E) : IsConnected { y | SameRay ℝ x y } := by by_cases hx : x = 0; · simpa [hx] using isConnected_univ (α := E) simp_rw [← exists_nonneg_left_iff_sameRay hx] exact isConnected_Ici.image _ (by fun_prop) +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_sameRay := isConnected_setOfPred_sameRay + /-- The set of nonzero vectors in the same ray as the nonzero vector `x` is connected. -/ -theorem isConnected_setOf_sameRay_and_ne_zero {x : E} (hx : x ≠ 0) : +theorem isConnected_setOfPred_sameRay_and_ne_zero {x : E} (hx : x ≠ 0) : IsConnected { y | SameRay ℝ x y ∧ y ≠ 0 } := by simp_rw [← exists_pos_left_iff_sameRay_and_ne_zero hx] exact isConnected_Ioi.image _ (by fun_prop) +@[deprecated (since := "2026-07-09")] +alias isConnected_setOf_sameRay_and_ne_zero := isConnected_setOfPred_sameRay_and_ne_zero + lemma norm_sub_le_of_mem_segment {x y z : E} (hy : y ∈ segment ℝ x z) : ‖y - x‖ ≤ ‖z - x‖ := by rw [segment_eq_image'] at hy diff --git a/Mathlib/Analysis/Normed/Module/FiniteDimension.lean b/Mathlib/Analysis/Normed/Module/FiniteDimension.lean index efa1834193c4dc..e57d5884af1397 100644 --- a/Mathlib/Analysis/Normed/Module/FiniteDimension.lean +++ b/Mathlib/Analysis/Normed/Module/FiniteDimension.lean @@ -327,19 +327,25 @@ protected theorem LinearIndependent.eventually {ι} [Finite ι] {f : ι → E} gcongr exact norm_le_pi_norm (v - u) i -theorem isOpen_setOf_linearIndependent {ι : Type*} [Finite ι] : +theorem isOpen_setOfPred_linearIndependent {ι : Type*} [Finite ι] : IsOpen { f : ι → E | LinearIndependent 𝕜 f } := isOpen_iff_mem_nhds.2 fun _ => LinearIndependent.eventually -theorem isOpen_setOf_nat_le_rank (n : ℕ) : +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_linearIndependent := isOpen_setOfPred_linearIndependent + +theorem isOpen_setOfPred_nat_le_rank (n : ℕ) : IsOpen { f : E →L[𝕜] F | ↑n ≤ (f : E →ₗ[𝕜] F).rank } := by - simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, setOf_exists, ← exists_prop] - refine isOpen_biUnion fun t _ => ?_ + simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, ofPred_exists, ← exists_prop] + refine isOpen_iUnion fun t => isOpen_iUnion fun _ => ?_ have : Continuous fun f : E →L[𝕜] F => fun x : (t : Set E) => f x := continuous_pi fun x => (ContinuousLinearMap.apply 𝕜 F (x : E)).continuous - exact isOpen_setOf_linearIndependent.preimage this + exact isOpen_setOfPred_linearIndependent.preimage this + +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_nat_le_rank := isOpen_setOfPred_nat_le_rank -theorem isOpen_setOf_affineIndependent {ι : Type*} [Finite ι] : +theorem isOpen_setOfPred_affineIndependent {ι : Type*} [Finite ι] : IsOpen {p : ι → E | AffineIndependent 𝕜 p} := by classical rcases isEmpty_or_nonempty ι with h | ⟨⟨i₀⟩⟩ @@ -350,7 +356,10 @@ theorem isOpen_setOf_affineIndependent {ι : Type*} [Finite ι] : haveI : Fintype ι' := Subtype.fintype _ convert_to! IsOpen ((fun (p : ι → E) (i : ι') ↦ p i -ᵥ p i₀) ⁻¹' {p : ι' → E | LinearIndependent 𝕜 p}) - exact isOpen_setOf_linearIndependent.preimage (by fun_prop) + exact isOpen_setOfPred_linearIndependent.preimage (by fun_prop) + +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_affineIndependent := isOpen_setOfPred_affineIndependent namespace Module.Basis diff --git a/Mathlib/Analysis/Normed/Module/Multilinear/Basic.lean b/Mathlib/Analysis/Normed/Module/Multilinear/Basic.lean index d179029f25fa13..61828d669bf201 100644 --- a/Mathlib/Analysis/Normed/Module/Multilinear/Basic.lean +++ b/Mathlib/Analysis/Normed/Module/Multilinear/Basic.lean @@ -369,7 +369,7 @@ theorem bounds_bddBelow {f : ContinuousMultilinearMap 𝕜 E G} : theorem isLeast_opNorm (f : ContinuousMultilinearMap 𝕜 E G) : IsLeast {c : ℝ | 0 ≤ c ∧ ∀ m, ‖f m‖ ≤ c * ∏ i, ‖m i‖} ‖f‖ := by refine IsClosed.isLeast_csInf ?_ bounds_nonempty bounds_bddBelow - simp only [Set.setOf_and, Set.setOf_forall] + simp only [Set.ofPred_and, Set.ofPred_forall] exact isClosed_Ici.inter (isClosed_iInter fun m ↦ isClosed_le continuous_const (by fun_prop)) theorem opNorm_nonneg (f : ContinuousMultilinearMap 𝕜 E G) : 0 ≤ ‖f‖ := diff --git a/Mathlib/Analysis/Normed/Module/PiTensorProduct/InjectiveSeminorm.lean b/Mathlib/Analysis/Normed/Module/PiTensorProduct/InjectiveSeminorm.lean index 6c07e93e422bf7..c06063239c9413 100644 --- a/Mathlib/Analysis/Normed/Module/PiTensorProduct/InjectiveSeminorm.lean +++ b/Mathlib/Analysis/Normed/Module/PiTensorProduct/InjectiveSeminorm.lean @@ -86,7 +86,7 @@ lemma dualSeminorms_bounded : BddAbove {p | ∃ (G : Type (max uι u𝕜 uE)) p = Seminorm.comp (normSeminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G →L[𝕜] G)) (toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E))} := by use projectiveSeminorm - simp only [mem_upperBounds, Set.mem_setOf_eq, forall_exists_index] + simp only [mem_upperBounds, Set.mem_ofPred_eq, forall_exists_index] intro p G _ _ hp x simpa [hp] using! toDualContinuousMultilinearMap_le_projectiveSeminorm _ @@ -98,7 +98,7 @@ theorem injectiveSeminorm_apply (x : ⨂[𝕜] i, E i) : (_ : SeminormedAddCommGroup G) (_ : NormedSpace 𝕜 G), p = Seminorm.comp (normSeminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G →L[𝕜] G)) (toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E))}, p.1 x := by - simpa only [injectiveSeminorm, Set.coe_setOf, Set.mem_setOf_eq] + simpa only [injectiveSeminorm, Set.coe_ofPred, Set.mem_ofPred_eq] using Seminorm.sSup_apply dualSeminorms_bounded attribute [-instance] instSeminormedAddCommGroup in @@ -150,7 +150,7 @@ theorem norm_eval_le_injectiveSeminorm (f : ContinuousMultilinearMap 𝕜 E F) ( (toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E)) ≤ injectiveSeminorm := by simp only [injectiveSeminorm] refine le_csSup dualSeminorms_bounded ?_ - rw [Set.mem_setOf] + rw [Set.mem_ofPred] existsi G, inferInstance, inferInstance rfl refine le_trans ?_ (mul_le_mul_of_nonneg_left (hle x) (norm_nonneg f')) @@ -166,14 +166,14 @@ theorem injectiveSeminorm_le_projectiveSeminorm : rw [injectiveSeminorm] refine csSup_le ?_ ?_ · existsi 0 - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] existsi PUnit, inferInstance, inferInstance ext x simp only [Seminorm.zero_apply, Seminorm.comp_apply, coe_normSeminorm] rw [Subsingleton.elim (toDualContinuousMultilinearMap PUnit.{(max (max uE uι) u𝕜) + 1} x) 0, norm_zero] · intro p hp - simp only [Set.mem_setOf_eq] at hp + simp only [Set.mem_ofPred_eq] at hp obtain ⟨G, _, _, h⟩ := hp rw [h]; intro x; simp only [Seminorm.comp_apply, coe_normSeminorm] exact toDualContinuousMultilinearMap_le_projectiveSeminorm _ diff --git a/Mathlib/Analysis/Normed/Module/WeakDual.lean b/Mathlib/Analysis/Normed/Module/WeakDual.lean index 99aeca6008b7bf..1cdbef09358800 100644 --- a/Mathlib/Analysis/Normed/Module/WeakDual.lean +++ b/Mathlib/Analysis/Normed/Module/WeakDual.lean @@ -287,7 +287,7 @@ theorem polar_def (s : Set M) : polar 𝕜 s = { f : WeakDual 𝕜 M | ∀ x ∈ /-- The polar `polar 𝕜 s` of a set `s : E` is a closed subset when the weak star topology is used. -/ theorem isClosed_polar (s : Set M) : IsClosed (polar 𝕜 s) := by - simp only [polar_def, setOf_forall] + simp only [polar_def, ofPred_forall] exact isClosed_biInter fun x hx => isClosed_Iic.preimage (WeakBilin.eval_continuous _ _).norm /-- Polar sets of neighborhoods of the origin are bounded in the weak dual. -/ diff --git a/Mathlib/Analysis/Normed/Operator/Basic.lean b/Mathlib/Analysis/Normed/Operator/Basic.lean index ada43ae7b633c5..de6448bdf39c75 100644 --- a/Mathlib/Analysis/Normed/Operator/Basic.lean +++ b/Mathlib/Analysis/Normed/Operator/Basic.lean @@ -192,7 +192,7 @@ theorem bounds_bddBelow {f : E →SL[σ₁₂] F} : BddBelow { c | 0 ≤ c ∧ theorem isLeast_opNorm [RingHomIsometric σ₁₂] (f : E →SL[σ₁₂] F) : IsLeast {c | 0 ≤ c ∧ ∀ x, ‖f x‖ ≤ c * ‖x‖} ‖f‖ := by refine IsClosed.isLeast_csInf ?_ bounds_nonempty bounds_bddBelow - simp only [setOf_and, setOf_forall] + simp only [ofPred_and, ofPred_forall] refine isClosed_Ici.inter <| isClosed_iInter fun _ ↦ isClosed_le ?_ ?_ <;> fun_prop /-- If one controls the norm of every `A x`, then one controls the norm of `A`. -/ diff --git a/Mathlib/Analysis/Normed/Operator/Compact/Basic.lean b/Mathlib/Analysis/Normed/Operator/Compact/Basic.lean index 9a8ca0e373bacc..f5d93f23e2ca3d 100644 --- a/Mathlib/Analysis/Normed/Operator/Compact/Basic.lean +++ b/Mathlib/Analysis/Normed/Operator/Compact/Basic.lean @@ -27,7 +27,7 @@ In this file we define compact linear operators between two topological vector s * `IsCompactOperator.clm_comp` : postcomposing a compact operator by a continuous linear map gives a compact operator * `IsCompactOperator.continuous` : compact operators are automatically continuous -* `isClosed_setOf_isCompactOperator` : the set of compact operators is closed for the operator +* `isClosed_setOfPred_isCompactOperator` : the set of compact operators is closed for the operator norm Note that results linking compact operators with `FiniteDimensional` are in a separate file @@ -415,7 +415,7 @@ end Continuous /-- The set of compact operators from a normed space to a complete topological vector space is closed. -/ -theorem isClosed_setOf_isCompactOperator {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] +theorem isClosed_setOfPred_isCompactOperator {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁] [AddCommGroup M₂] [NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂] [UniformSpace M₂] [IsUniformAddGroup M₂] [ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] : @@ -451,12 +451,15 @@ theorem isClosed_setOf_isCompactOperator {𝕜₁ 𝕜₂ : Type*} [Nontrivially rw [sub_apply] abel +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_isCompactOperator := isClosed_setOfPred_isCompactOperator + theorem compactOperator_topologicalClosure {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁] [AddCommGroup M₂] [NormedSpace 𝕜₁ M₁] [Module 𝕜₂ M₂] [UniformSpace M₂] [IsUniformAddGroup M₂] [ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] : (compactOperator σ₁₂ M₁ M₂).topologicalClosure = compactOperator σ₁₂ M₁ M₂ := - SetLike.ext' isClosed_setOf_isCompactOperator.closure_eq + SetLike.ext' isClosed_setOfPred_isCompactOperator.closure_eq theorem isCompactOperator_of_tendsto {ι 𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NormedField 𝕜₂] {σ₁₂ : 𝕜₁ →+* 𝕜₂} {M₁ M₂ : Type*} [SeminormedAddCommGroup M₁] @@ -464,4 +467,4 @@ theorem isCompactOperator_of_tendsto {ι 𝕜₁ 𝕜₂ : Type*} [NontriviallyN [ContinuousConstSMul 𝕜₂ M₂] [T2Space M₂] [CompleteSpace M₂] {l : Filter ι} [l.NeBot] {F : ι → M₁ →SL[σ₁₂] M₂} {f : M₁ →SL[σ₁₂] M₂} (hf : Tendsto F l (𝓝 f)) (hF : ∀ᶠ i in l, IsCompactOperator (F i)) : IsCompactOperator f := - isClosed_setOf_isCompactOperator.mem_of_tendsto hf hF + isClosed_setOfPred_isCompactOperator.mem_of_tendsto hf hF diff --git a/Mathlib/Analysis/Normed/Operator/NNNorm.lean b/Mathlib/Analysis/Normed/Operator/NNNorm.lean index f2ae9cbd2f6026..5510b8ea8c9b7c 100644 --- a/Mathlib/Analysis/Normed/Operator/NNNorm.lean +++ b/Mathlib/Analysis/Normed/Operator/NNNorm.lean @@ -40,7 +40,7 @@ namespace ContinuousLinearMap theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by ext rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image] - simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk, + simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_ofPred_eq, NNReal.coe_mk, exists_prop] @[simp, nontriviality] @@ -129,7 +129,7 @@ theorem lipschitz_apply (x : E) : LipschitzWith ‖x‖₊ fun f : E →SL[σ₁ theorem exists_mul_lt_apply_of_lt_opNNNorm (f : E →SL[σ₁₂] F) {r : ℝ≥0} (hr : r < ‖f‖₊) : ∃ x, r * ‖x‖₊ < ‖f x‖₊ := by - simpa only [not_forall, not_le, Set.mem_setOf] using + simpa only [not_forall, not_le, Set.mem_ofPred] using notMem_of_lt_csInf (nnnorm_def f ▸ hr : r < sInf { c : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ }) (OrderBot.bddBelow _) diff --git a/Mathlib/Analysis/Normed/Order/Lattice.lean b/Mathlib/Analysis/Normed/Order/Lattice.lean index dc4bd9ccc0a8b4..2f23e4812bd089 100644 --- a/Mathlib/Analysis/Normed/Order/Lattice.lean +++ b/Mathlib/Analysis/Normed/Order/Lattice.lean @@ -184,7 +184,7 @@ theorem isClosed_le_of_isClosed_nonneg {G} [ContinuousSub G] (h : IsClosed { x : G | 0 ≤ x }) : IsClosed { p : G × G | p.fst ≤ p.snd } := by have : { p : G × G | p.fst ≤ p.snd } = (fun p : G × G ↦ p.snd - p.fst) ⁻¹' { x : G | 0 ≤ x } := by - ext1 p; simp only [sub_nonneg, Set.preimage_setOf_eq] + ext1 p; simp only [sub_nonneg, Set.preimage_ofPred_eq] rw [this] exact IsClosed.preimage (continuous_snd.sub continuous_fst) h diff --git a/Mathlib/Analysis/Normed/Unbundled/SmoothingSeminorm.lean b/Mathlib/Analysis/Normed/Unbundled/SmoothingSeminorm.lean index 9e515e621bb23f..dac8aa822d6a8c 100644 --- a/Mathlib/Analysis/Normed/Unbundled/SmoothingSeminorm.lean +++ b/Mathlib/Analysis/Normed/Unbundled/SmoothingSeminorm.lean @@ -304,7 +304,7 @@ private theorem μ_bddBelow (s : ℕ → ℕ) {x : R} (ψ : ℕ → ℕ) : BddBelow {a : ℝ | ∀ᶠ n : ℝ in map (fun n : ℕ => μ x ^ (↑(s (ψ n)) * (1 / (ψ n : ℝ)))) atTop, n ≤ a} := by use 0 - simp only [mem_lowerBounds, eventually_map, eventually_atTop, Set.mem_setOf_eq, + simp only [mem_lowerBounds, eventually_map, eventually_atTop, Set.mem_ofPred_eq, forall_exists_index] intro r m hm exact le_trans (rpow_nonneg (apply_nonneg μ _) _) (hm m (le_refl _)) @@ -340,11 +340,11 @@ private theorem μ_nonempty {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ n) { n ≤ a}.Nonempty := by by_cases hμx : μ x < 1 · use 1 - simp only [eventually_map, eventually_atTop, Set.mem_setOf_eq] + simp only [eventually_map, eventually_atTop, Set.mem_ofPred_eq] exact ⟨0, fun _ _ ↦ rpow_le_one (apply_nonneg _ _) (le_of_lt hμx) (mul_nonneg (cast_nonneg _) (one_div_nonneg.mpr (cast_nonneg _)))⟩ · use μ x - simp only [eventually_map, eventually_atTop, Set.mem_setOf_eq] + simp only [eventually_map, eventually_atTop, Set.mem_ofPred_eq] use 0 intro b _ nth_rw 2 [← rpow_one (μ x)] @@ -358,7 +358,7 @@ private theorem μ_limsup_le_one {s : ℕ → ℕ} (hs_le : ∀ n : ℕ, s n ≤ simp only [limsup, limsSup] rw [csInf_le_iff (μ_bddBelow μ s ψ) (μ_nonempty μ hs_le ψ)] · intro c hc_bd - simp only [mem_lowerBounds, eventually_map, eventually_atTop, Set.mem_setOf_eq, + simp only [mem_lowerBounds, eventually_map, eventually_atTop, Set.mem_ofPred_eq, forall_exists_index] at hc_bd by_cases hμx : μ x < 1 · apply hc_bd (1 : ℝ) 0 @@ -390,7 +390,7 @@ private theorem limsup_mu_le (hμ1 : μ 1 ≤ 1) {s : ℕ → ℕ} (hs_le : ∀ limsup (fun n : ℕ => μ x ^ ((s (ψ n) : ℝ) * (1 / (ψ n : ℝ)))) atTop := by apply csInf_le_csInf _ (μ_nonempty μ hs_le ψ) · intro b hb - simp only [eventually_map, eventually_atTop, Set.mem_setOf_eq] at hb ⊢ + simp only [eventually_map, eventually_atTop, Set.mem_ofPred_eq] at hb ⊢ obtain ⟨m, hm⟩ := hb use m intro k hkm @@ -400,7 +400,7 @@ private theorem limsup_mu_le (hμ1 : μ 1 ≤ 1) {s : ℕ → ℕ} (hs_le : ∀ exact map_pow_le_pow' hμ1 x _ · use 0 simp only [mem_lowerBounds, eventually_map, eventually_atTop, - Set.mem_setOf_eq, forall_exists_index] + Set.mem_ofPred_eq, forall_exists_index] exact fun _ m hm ↦ le_trans (by positivity) (hm m (le_refl _)) _ ≤ 1 := (μ_limsup_le_one μ hs_le hψ_lim) _ = smoothingFun μ x ^ a := by rw [ha, rpow_zero] diff --git a/Mathlib/Analysis/ODE/PicardLindelof.lean b/Mathlib/Analysis/ODE/PicardLindelof.lean index 5f87041559c1a4..a692cd5696e93c 100644 --- a/Mathlib/Analysis/ODE/PicardLindelof.lean +++ b/Mathlib/Analysis/ODE/PicardLindelof.lean @@ -202,8 +202,8 @@ lemma range_toContinuousMap : instance [CompleteSpace E] : CompleteSpace (FunSpace t₀ x₀ r L) := by rw [completeSpace_iff_isComplete_range isUniformInducing_toContinuousMap] apply IsClosed.isComplete - rw [range_toContinuousMap, setOf_and] - apply isClosed_setOf_lipschitzWith L |>.preimage continuous_coeFun |>.inter + rw [range_toContinuousMap, ofPred_and] + apply isClosed_setOfPred_lipschitzWith L |>.preimage continuous_coeFun |>.inter simp_rw [mem_closedBall_iff_norm] exact isClosed_le (by fun_prop) (by fun_prop) diff --git a/Mathlib/Analysis/ODE/Transform.lean b/Mathlib/Analysis/ODE/Transform.lean index 9f7120d18118ff..f55d212fef3551 100644 --- a/Mathlib/Analysis/ODE/Transform.lean +++ b/Mathlib/Analysis/ODE/Transform.lean @@ -117,24 +117,29 @@ lemma isIntegralCurveOn_comp_mul_ne_zero {a : ℝ} (ha : a ≠ 0) : rw [mem_inv_smul_set_iff₀ ha, smul_eq_mul, mul_comm] rfl refine ⟨fun hγ ↦ ?_, heq ▸ fun hγ ↦ hγ.comp_mul a⟩ - convert! hγ.comp_mul a⁻¹ + have hs : {t | t * a⁻¹ ∈ a⁻¹ • s} = s := by + ext t + rw [mem_ofPred_eq, mul_comm _ a⁻¹, ← smul_eq_mul, mem_inv_smul_set_iff₀ ha, + smul_inv_smul₀ ha] + have h2 := hγ.comp_mul a⁻¹ + rw [hs] at h2 + convert! h2 · ext t simp only [comp_apply, mul_assoc, inv_mul_eq_div, div_self ha, mul_one] · ext t simp only [comp_apply, Pi.smul_apply, mul_assoc, inv_mul_eq_div, div_self ha, mul_one, smul_smul, one_smul] - · simp only [mul_comm _ a⁻¹, ← smul_eq_mul, mem_inv_smul_set_iff₀ ha, smul_inv_smul₀ ha, - setOf_mem_eq] lemma IsIntegralCurveAt.comp_mul_ne_zero (hγ : IsIntegralCurveAt γ v t₀) {a : ℝ} (ha : a ≠ 0) : IsIntegralCurveAt (γ ∘ (· * a)) (a • v ∘ (· * a)) (t₀ / a) := by rw [isIntegralCurveAt_iff_exists_pos] at * obtain ⟨ε, hε, h⟩ := hγ refine ⟨ε / |a|, by positivity, ?_⟩ - convert! h.comp_mul a - ext t - rw [mem_setOf_eq, Metric.mem_ball, Metric.mem_ball, Real.dist_eq, Real.dist_eq, - lt_div_iff₀ (abs_pos.mpr ha), ← abs_mul, sub_mul, div_mul_cancel₀ _ ha] + have hs : {t | t * a ∈ Metric.ball t₀ ε} = Metric.ball (t₀ / a) (ε / |a|) := by + ext t + rw [mem_ofPred_eq, Metric.mem_ball, Metric.mem_ball, Real.dist_eq, Real.dist_eq, + lt_div_iff₀ (abs_pos.mpr ha), ← abs_mul, sub_mul, div_mul_cancel₀ _ ha] + exact hs ▸ h.comp_mul a lemma isIntegralCurveAt_comp_mul_ne_zero {a : ℝ} (ha : a ≠ 0) : IsIntegralCurveAt (γ ∘ (· * a)) (a • v ∘ (· * a)) (t₀ / a) ↔ IsIntegralCurveAt γ v t₀ := by diff --git a/Mathlib/Analysis/Oscillation.lean b/Mathlib/Analysis/Oscillation.lean index 724add9e759f04..33c744849100d8 100644 --- a/Mathlib/Analysis/Oscillation.lean +++ b/Mathlib/Analysis/Oscillation.lean @@ -136,7 +136,7 @@ theorem uniform_oscillationWithin (comp : IsCompact K) (hK : ∀ x ∈ K, oscill have S_antitone : ∀ (r₁ r₂ : ℝ), r₁ ≤ r₂ → S r₂ ⊆ S r₁ := fun r₁ r₂ hr x ⟨a, ar₂, ha⟩ ↦ ⟨a, lt_of_le_of_lt hr ar₂, ha⟩ obtain ⟨δ, δ0, hδ⟩ : ∃ r > 0, K ⊆ S r := by - obtain ⟨T, Tb, Tfin, hT⟩ := comp.elim_finite_subcover_image S_open S_cover + obtain ⟨T, Tb, Tfin, hT⟩ := comp.elim_finite_subcover_image (b := Ioi 0) S_open S_cover by_cases T_nonempty : T.Nonempty · use Tfin.isWF.min T_nonempty, Tb (Tfin.isWF.min_mem T_nonempty) intro x hx diff --git a/Mathlib/Analysis/PSeries.lean b/Mathlib/Analysis/PSeries.lean index b8e4ee7b8c81ad..6499506f39f848 100644 --- a/Mathlib/Analysis/PSeries.lean +++ b/Mathlib/Analysis/PSeries.lean @@ -438,8 +438,8 @@ lemma Real.not_summable_indicator_one_div_natCast {m : ℕ} (hm : m ≠ 0) (k : rw [← summable_nat_add_iff 1] -- shift by one to avoid non-monotonicity at zero have h (n : ℕ) : {n : ℕ | (n : ZMod m) = k - 1}.indicator (fun n : ℕ ↦ (1 / (n + 1 :) : ℝ)) n = if (n : ZMod m) = k - 1 then (1 / (n + 1) : ℝ) else (0 : ℝ) := by - simp only [indicator_apply, mem_setOf_eq, cast_add, cast_one] - simp_rw [indicator_apply, mem_setOf, cast_add, cast_one, ← eq_sub_iff_add_eq, ← h] + simp only [indicator_apply, mem_ofPred_eq, cast_add, cast_one] + simp_rw [indicator_apply, mem_ofPred, cast_add, cast_one, ← eq_sub_iff_add_eq, ← h] rw [summable_indicator_mod_iff (fun n₁ n₂ h ↦ by gcongr) (k - 1)] exact mt (summable_nat_add_iff (f := fun n : ℕ ↦ 1 / (n : ℝ)) 1).mp not_summable_one_div_natCast diff --git a/Mathlib/Analysis/Polynomial/Basic.lean b/Mathlib/Analysis/Polynomial/Basic.lean index 7d91be3f9076fc..0fc260912dd989 100644 --- a/Mathlib/Analysis/Polynomial/Basic.lean +++ b/Mathlib/Analysis/Polynomial/Basic.lean @@ -34,12 +34,12 @@ namespace Polynomial variable {𝕜 : Type*} [NormedField 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] (P Q : 𝕜[X]) theorem eventually_atTop_not_isRoot (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := - atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite + atTop_le_cofinite <| (finite_setOfPred_isRoot hP).compl_mem_cofinite @[deprecated (since := "2026-02-05")] alias eventually_no_roots := eventually_atTop_not_isRoot theorem eventually_atBot_not_isRoot (hP : P ≠ 0) : ∀ᶠ x in atBot, ¬P.IsRoot x := - atBot_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite + atBot_le_cofinite <| (finite_setOfPred_isRoot hP).compl_mem_cofinite variable [OrderTopology 𝕜] @@ -334,7 +334,7 @@ section Cobounded lemma eventually_cofinite_not_isRoot {R : Type*} [CommRing R] [IsDomain R] {P : R[X]} (hP : P ≠ 0) : ∀ᶠ x in cofinite, ¬P.IsRoot x := - (finite_setOf_isRoot hP).compl_mem_cofinite + (finite_setOfPred_isRoot hP).compl_mem_cofinite open Bornology @@ -389,7 +389,7 @@ theorem dvd_of_infinite_eval_dvd_eval set R := P %ₘ Q apply eq_zero_of_infinite_isRoot refine (h.sdiff (finite_abs_eval_le_of_degree_lt degR)).mono fun x mx ↦ ?_ - simp only [Set.mem_sdiff, Set.mem_setOf_eq, not_le] at mx + simp only [Set.mem_sdiff, Set.mem_ofPred_eq, not_le] at mx rw [← eqR, eval_add, eval_mul, Int.dvd_add_self_mul, ← abs_dvd] at mx exact Int.eq_zero_of_abs_lt_dvd mx.1 mx.2 diff --git a/Mathlib/Analysis/Polynomial/MahlerMeasure.lean b/Mathlib/Analysis/Polynomial/MahlerMeasure.lean index d5261c5c7fdc98..9e926207b09947 100644 --- a/Mathlib/Analysis/Polynomial/MahlerMeasure.lean +++ b/Mathlib/Analysis/Polynomial/MahlerMeasure.lean @@ -137,12 +137,13 @@ theorem mahlerMeasure_mul (p q : ℂ[X]) : rw [MeasureTheory.ae_iff] apply Set.Finite.measure_zero _ MeasureTheory.volume simp only [Classical.not_imp] - apply Set.Finite.of_finite_image (f := circleMap 0 1) _ <| - (injOn_circleMap_of_abs_sub_le one_ne_zero (by simp [le_of_eq, pi_nonneg])).mono (fun _ h ↦ h.1) - apply (p * q).roots.finite_toSet.subset - rintro _ ⟨_, ⟨_, h⟩, _⟩ - contrapose h - simp_all [log_mul] + apply Set.Finite.of_finite_image (f := circleMap 0 1) + · apply (p * q).roots.finite_toSet.subset + rintro _ ⟨_, ⟨_, h⟩, _⟩ + contrapose h + simp_all [log_mul] + · exact (injOn_circleMap_of_abs_sub_le one_ne_zero (by simp [le_of_eq, pi_nonneg])).mono + fun _ h ↦ h.1 @[simp] theorem prod_mahlerMeasure_eq_mahlerMeasure_prod (s : Multiset ℂ[X]) : @@ -282,11 +283,13 @@ theorem mahlerMeasure_le_sum_norm_coeff (p : ℂ[X]) : p.mahlerMeasure ≤ p.sum constructor · rw [mem_ae_iff, compl_def, Measure.restrict_apply' (by simp)] apply (Finite.of_sdiff _ <| finite_singleton (2 * π)).measure_zero - simp only [ne_eq, mem_setOf_eq, Decidable.not_not, inter_sdiff_assoc, Icc_sdiff_right] - rw [setOf_inter_eq_sep] - apply Finite.of_finite_image (f := circleMap 0 1) ((Multiset.finite_toSet p.roots).subset _) - <| fun _ h _ k l ↦ injOn_circleMap_of_abs_sub_le' one_ne_zero (by linarith) h.1 k.1 l - simp [hp] + simp only [ne_eq, mem_ofPred_eq, Decidable.not_not, inter_sdiff_assoc, Icc_sdiff_right] + rw [ofPred_inter_eq_sep] + apply Finite.of_finite_image (f := circleMap 0 1) + · apply (Multiset.finite_toSet p.roots).subset + simp [hp] + · exact fun _ h _ k l ↦ + injOn_circleMap_of_abs_sub_le' one_ne_zero (by linarith) h.1 k.1 l · intro _ _ gcongr rw [eval_eq_sum] @@ -314,11 +317,11 @@ theorem mahlerMeasure_le_sqrt_sum_sq_norm_coeff (p : Polynomial ℂ) : have : ∀ᵐ (θ : ℝ) ∂volume.restrict (uIoc 0 (2 * π)), 0 < ‖p.eval (circleMap 0 1 θ)‖ := by rw [ae_restrict_iff' measurableSet_uIoc] refine Set.Finite.measure_zero ?_ _ - simp only [norm_pos_iff, ne_eq, compl_setOf, Classical.not_imp, Decidable.not_not] + simp only [norm_pos_iff, ne_eq, compl_ofPred, Classical.not_imp, Decidable.not_not] refine Finite.of_finite_image (f := circleMap 0 1) (p.roots.finite_toSet.subset ?_) ?_ · rintro z ⟨θ, ⟨_, heval⟩, rfl⟩ exact (mem_roots hp).mpr heval - · grw [setOf_and, inter_subset_left] + · grw [ofPred_and, inter_subset_left] exact injOn_circleMap_of_abs_sub_le one_ne_zero (by simp [abs_of_pos pi_pos]) have hlogAe : ∀ᵐ (θ : ℝ) ∂volume.restrict (uIoc 0 (2 * π)), exp (log ‖p.eval (circleMap 0 1 θ)‖) = ‖p.eval (circleMap 0 1 θ)‖ := by diff --git a/Mathlib/Analysis/RCLike/Basic.lean b/Mathlib/Analysis/RCLike/Basic.lean index 1c6678f62c54ab..36e3e26400ec8f 100644 --- a/Mathlib/Analysis/RCLike/Basic.lean +++ b/Mathlib/Analysis/RCLike/Basic.lean @@ -1225,7 +1225,7 @@ open scoped ComplexOrder in lemma instOrderClosedTopology : OrderClosedTopology K where isClosed_le' := by conv in _ ≤ _ => rw [RCLike.le_iff_re_im] - simp_rw [Set.setOf_and] + simp_rw [Set.ofPred_and] refine IsClosed.inter (isClosed_le ?_ ?_) (isClosed_eq ?_ ?_) <;> fun_prop scoped[ComplexOrder] attribute [instance] RCLike.instOrderClosedTopology diff --git a/Mathlib/Analysis/Seminorm.lean b/Mathlib/Analysis/Seminorm.lean index d306b69cbbf6ce..d2315fc6f8d45c 100644 --- a/Mathlib/Analysis/Seminorm.lean +++ b/Mathlib/Analysis/Seminorm.lean @@ -656,11 +656,11 @@ theorem closedBall_smul (p : Seminorm 𝕜 E) {c : NNReal} (hc : 0 < c) (r : ℝ theorem ball_sup (p : Seminorm 𝕜 E) (q : Seminorm 𝕜 E) (e : E) (r : ℝ) : ball (p ⊔ q) e r = ball p e r ∩ ball q e r := by - simp_rw [ball, ← Set.setOf_and, coe_sup, Pi.sup_apply, sup_lt_iff] + simp_rw [ball, ← Set.ofPred_and, coe_sup, Pi.sup_apply, sup_lt_iff] theorem closedBall_sup (p : Seminorm 𝕜 E) (q : Seminorm 𝕜 E) (e : E) (r : ℝ) : closedBall (p ⊔ q) e r = closedBall p e r ∩ closedBall q e r := by - simp_rw [closedBall, ← Set.setOf_and, coe_sup, Pi.sup_apply, sup_le_iff] + simp_rw [closedBall, ← Set.ofPred_and, coe_sup, Pi.sup_apply, sup_le_iff] theorem ball_finset_sup' (p : ι → Seminorm 𝕜 E) (s : Finset ι) (H : s.Nonempty) (e : E) (r : ℝ) : ball (s.sup' H p) e r = s.inf' H fun i => ball (p i) e r := by @@ -744,22 +744,22 @@ variable {σ₁₂ : 𝕜 →+* 𝕜₂} [RingHomIsometric σ₁₂] theorem ball_comp (p : Seminorm 𝕜₂ E₂) (f : E →ₛₗ[σ₁₂] E₂) (x : E) (r : ℝ) : (p.comp f).ball x r = f ⁻¹' p.ball (f x) r := by ext - simp_rw [ball, mem_preimage, comp_apply, Set.mem_setOf_eq, map_sub] + simp_rw [ball, mem_preimage, comp_apply, Set.mem_ofPred_eq, map_sub] theorem closedBall_comp (p : Seminorm 𝕜₂ E₂) (f : E →ₛₗ[σ₁₂] E₂) (x : E) (r : ℝ) : (p.comp f).closedBall x r = f ⁻¹' p.closedBall (f x) r := by ext - simp_rw [closedBall, mem_preimage, comp_apply, Set.mem_setOf_eq, map_sub] + simp_rw [closedBall, mem_preimage, comp_apply, Set.mem_ofPred_eq, map_sub] variable (p : Seminorm 𝕜 E) theorem preimage_metric_ball {r : ℝ} : p ⁻¹' Metric.ball 0 r = { x | p x < r } := by ext x - simp only [mem_setOf, mem_preimage, mem_ball_zero_iff, Real.norm_of_nonneg (apply_nonneg p _)] + simp only [mem_ofPred, mem_preimage, mem_ball_zero_iff, Real.norm_of_nonneg (apply_nonneg p _)] theorem preimage_metric_closedBall {r : ℝ} : p ⁻¹' Metric.closedBall 0 r = { x | p x ≤ r } := by ext x - simp only [mem_setOf, mem_preimage, mem_closedBall_zero_iff, + simp only [mem_ofPred, mem_preimage, mem_closedBall_zero_iff, Real.norm_of_nonneg (apply_nonneg p _)] theorem ball_zero_eq_preimage_ball {r : ℝ} : p.ball 0 r = p ⁻¹' Metric.ball 0 r := by @@ -797,13 +797,13 @@ theorem balanced_closedBall_zero (r : ℝ) : Balanced 𝕜 (closedBall p 0 r) := theorem ball_finset_sup_eq_iInter (p : ι → Seminorm 𝕜 E) (s : Finset ι) (x : E) {r : ℝ} (hr : 0 < r) : ball (s.sup p) x r = ⋂ i ∈ s, ball (p i) x r := by lift r to NNReal using hr.le - simp_rw [ball, iInter_setOf, finset_sup_apply, NNReal.coe_lt_coe, + simp_rw [ball, iInter_ofPred, finset_sup_apply, NNReal.coe_lt_coe, Finset.sup_lt_iff (show ⊥ < r from hr), ← NNReal.coe_lt_coe, NNReal.coe_mk] theorem closedBall_finset_sup_eq_iInter (p : ι → Seminorm 𝕜 E) (s : Finset ι) (x : E) {r : ℝ} (hr : 0 ≤ r) : closedBall (s.sup p) x r = ⋂ i ∈ s, closedBall (p i) x r := by lift r to NNReal using hr - simp_rw [closedBall, iInter_setOf, finset_sup_apply, NNReal.coe_le_coe, Finset.sup_le_iff, ← + simp_rw [closedBall, iInter_ofPred, finset_sup_apply, NNReal.coe_le_coe, Finset.sup_le_iff, ← NNReal.coe_le_coe, NNReal.coe_mk] theorem ball_finset_sup (p : ι → Seminorm 𝕜 E) (s : Finset ι) (x : E) {r : ℝ} (hr : 0 < r) : @@ -1002,10 +1002,7 @@ variable [Module ℝ E] [IsScalarTower ℝ 𝕜 E] (p : Seminorm 𝕜 E) (x : E) /-- Seminorm-balls are convex. -/ theorem convex_ball : Convex ℝ (ball p x r) := by - convert! (p.convexOn.translate_left (-x)).convex_lt r - ext y - rw [preimage_univ, sep_univ, p.mem_ball, sub_eq_add_neg] - rfl + simpa [ball, sub_eq_add_neg] using (p.convexOn.translate_left (-x)).convex_lt r /-- Closed seminorm-balls are convex. -/ theorem convex_closedBall : Convex ℝ (closedBall p x r) := by diff --git a/Mathlib/Analysis/SpecialFunctions/Bernstein.lean b/Mathlib/Analysis/SpecialFunctions/Bernstein.lean index b6bbf6d738c11c..0695dcf5a02d98 100644 --- a/Mathlib/Analysis/SpecialFunctions/Bernstein.lean +++ b/Mathlib/Analysis/SpecialFunctions/Bernstein.lean @@ -193,7 +193,8 @@ theorem bernsteinApproximation_uniform [LocallyConvexSpace ℝ E] (f : C(I, E)) |>.compactConvergenceUniformity_of_compact |> nhds_basis_uniformity |>.tendsto_right_iff] rintro U ⟨hU₀, hcU⟩ filter_upwards [this U hU₀ hcU] with n hn x - exact setOf_gauge_lt_one_subset_self hcU (mem_of_mem_nhds hU₀) (absorbent_nhds_zero hU₀) (hn x) + exact setOfPred_gauge_lt_one_subset_self hcU (mem_of_mem_nhds hU₀) (absorbent_nhds_zero hU₀) + (hn x) intro U hU₀ hUc /- Choose a constant `C` such that `‖f x - f y‖_U ≤ C` for all `x`, `y`. For a normed space, this would be twice the norm of `f`. -/ diff --git a/Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean b/Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean index 3b4689beba9938..78eca40bffb1e3 100644 --- a/Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean +++ b/Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean @@ -153,8 +153,9 @@ lemma AnalyticOnNhd.log (fs : AnalyticOnNhd ℝ f s) (m : ∀ x ∈ s, 0 < f x) fun z n ↦ (analyticAt_log (m z n)).comp (fs z n) lemma AnalyticOn.log (fs : AnalyticOn ℝ f s) (m : ∀ x ∈ s, 0 < f x) : - AnalyticOn ℝ (fun z ↦ Real.log (f z)) s := - fun z n ↦ (analyticAt_log (m z n)).analyticWithinAt.comp (fs z n) m + AnalyticOn ℝ (fun z ↦ Real.log (f z)) s := by + have hm : MapsTo f s {y | 0 < y} := m + exact fun z n ↦ (analyticAt_log (m z n)).analyticWithinAt.comp (fs z n) hm theorem iteratedDeriv_succ_log {n : ℕ} {x : ℂ} (hx : x ∈ slitPlane) : iteratedDeriv (n + 1) log x = (-1 : ℂ) ^ n * n.factorial * x ^ (-(n : ℤ) - 1) := by diff --git a/Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean b/Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean index fa3a40b9565e67..f31e5315e19282 100644 --- a/Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean +++ b/Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean @@ -558,7 +558,7 @@ theorem arg_eq_nhds_of_re_neg_of_im_pos (hx_re : x.re < 0) (hx_im : 0 < x.im) : arg =ᶠ[𝓝 x] fun x => Real.arcsin ((-x).im / ‖x‖) + π := by suffices h_forall_nhds : ∀ᶠ y : ℂ in 𝓝 x, y.re < 0 ∧ 0 < y.im from h_forall_nhds.mono fun y hy => arg_of_re_neg_of_im_nonneg hy.1 hy.2.le - refine IsOpen.eventually_mem ?_ (⟨hx_re, hx_im⟩ : x.re < 0 ∧ 0 < x.im) + refine IsOpen.eventually_mem (s := {z : ℂ | z.re < 0 ∧ 0 < z.im}) ?_ ⟨hx_re, hx_im⟩ exact IsOpen.and (isOpen_lt continuous_re continuous_zero) (isOpen_lt continuous_zero continuous_im) @@ -566,7 +566,7 @@ theorem arg_eq_nhds_of_re_neg_of_im_neg (hx_re : x.re < 0) (hx_im : x.im < 0) : arg =ᶠ[𝓝 x] fun x => Real.arcsin ((-x).im / ‖x‖) - π := by suffices h_forall_nhds : ∀ᶠ y : ℂ in 𝓝 x, y.re < 0 ∧ y.im < 0 from h_forall_nhds.mono fun y hy => arg_of_re_neg_of_im_neg hy.1 hy.2 - refine IsOpen.eventually_mem ?_ (⟨hx_re, hx_im⟩ : x.re < 0 ∧ x.im < 0) + refine IsOpen.eventually_mem (s := {z : ℂ | z.re < 0 ∧ z.im < 0}) ?_ ⟨hx_re, hx_im⟩ exact IsOpen.and (isOpen_lt continuous_re continuous_zero) (isOpen_lt continuous_im continuous_zero) diff --git a/Mathlib/Analysis/SpecialFunctions/Complex/Circle.lean b/Mathlib/Analysis/SpecialFunctions/Complex/Circle.lean index 33a581fdc10383..248e2bf1c56e3f 100644 --- a/Mathlib/Analysis/SpecialFunctions/Complex/Circle.lean +++ b/Mathlib/Analysis/SpecialFunctions/Complex/Circle.lean @@ -117,7 +117,7 @@ lemma exp_injOn_Ioc {a b : ℝ} (h : b - a ≤ 2 * π) : InjOn exp (Ioc a b) := exp_injOn_of_forall_sub_mem_Ioo <| fun x ⟨hx1, hx2⟩ y ⟨hy1, hy2⟩ ↦ by constructor <;> linarith /-- The image under `Circle.exp` of the interval of angles `(-r, r)`. -/ -def centeredArc (r : ℝ) : Set Circle := +noncomputable def centeredArc (r : ℝ) : Set Circle := exp '' {x | |x| < r} theorem bijOn_exp_Ioo_centeredArc {r : ℝ} (hr : r ≤ π) : @@ -505,9 +505,12 @@ theorem Circle.isQuotientCoveringMap_zpow (n : ℤ) [NeZero n] : IsUnit.isQuotientMap_zsmul (M := ℝ) (QuotientAddGroup.mk' (AddSubgroup.zmultiples (1 : ℝ))) isQuotientMap_quotient_mk' n hn ext; simp [zpowGroupHom, e, homeomorphCircle_apply, toCircle_zsmul] - · convert! finite_torsion_of_isSMulRegular_int (1 : ℝ) n fun _ ↦ by simp [NeZero.ne] - ext - simp [e, homeomorphCircle_apply, ← toCircle_zsmul, ← (injective_toCircle one_ne_zero).eq_iff] + · have key : ⇑e ⁻¹' ((zpowGroupHom (α := Circle) n).ker : Set Circle) = + {x : AddCircle 1 | n • x = 0} := by + ext + simp [e, homeomorphCircle_apply, ← toCircle_zsmul, + ← (injective_toCircle one_ne_zero).eq_iff] + exact key ▸ finite_torsion_of_isSMulRegular_int (1 : ℝ) n fun _ ↦ by simp [NeZero.ne] theorem Circle.isQuotientCoveringMap_npow (n : ℕ) [NeZero n] : IsQuotientCoveringMap (· ^ n : Circle → _) (powMonoidHom (α := Circle) n).ker := diff --git a/Mathlib/Analysis/SpecialFunctions/Complex/Log.lean b/Mathlib/Analysis/SpecialFunctions/Complex/Log.lean index 969f190fefacf8..ad59ce75e0c508 100644 --- a/Mathlib/Analysis/SpecialFunctions/Complex/Log.lean +++ b/Mathlib/Analysis/SpecialFunctions/Complex/Log.lean @@ -192,7 +192,7 @@ theorem countable_preimage_exp {s : Set ℂ} : (exp ⁻¹' s).Countable ↔ s.Co refine hs.biUnion fun z hz => ?_ by_cases! h : ∃ w, exp w = z · rcases h with ⟨w, rfl⟩ - simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.setOf_exists] + simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.ofPred_exists] exact Set.countable_iUnion fun m => Set.countable_singleton _ · simp [Set.preimage, h] @@ -303,7 +303,7 @@ noncomputable def expOpenPartialHomeomorph : OpenPartialHomeomorph ℂ ℂ where simp [exp_mem_slitPlane, h₂.ne, (toIocMod_eq_self Real.two_pi_pos).mpr ⟨h₁, by simpa [two_mul] using h₂.le⟩] map_target' z h := by - simp only [mem_setOf, log_im, mem_Ioo, neg_pi_lt_arg, arg_lt_pi_iff, true_and] + simp only [mem_ofPred, log_im, mem_Ioo, neg_pi_lt_arg, arg_lt_pi_iff, true_and] exact h.imp_left le_of_lt left_inv' _x hx := log_exp hx.1 (le_of_lt hx.2) right_inv' _x hx := exp_log <| slitPlane_ne_zero hx diff --git a/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/ExpLog/Order.lean b/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/ExpLog/Order.lean index b8dda31c967e0f..27829bb8786e55 100644 --- a/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/ExpLog/Order.lean +++ b/Mathlib/Analysis/SpecialFunctions/ContinuousFunctionalCalculus/ExpLog/Order.lean @@ -104,13 +104,13 @@ lemma CFC.concaveOn_log : ConcaveOn ℝ {a : A | IsStrictlyPositive a} log := by of any positive definite operator, which means that `CFC.log a = lim_{p → 0} p⁻¹ * (a ^ p - 1)` by the continuity of the continuous functional calculus (`tendsto_cfc_fun`). Then, we use the fact that `x^p` is concave for `p ∈ [0,1]` (`CFC.concaveOn_rpow`) and that the set of - concave functions is closed (`isClosed_setOf_concaveOn`) to conclude the proof. -/ + concave functions is closed (`isClosed_setOfPred_concaveOn`) to conclude the proof. -/ set s := {a : A | IsStrictlyPositive a} let f (p : ℝ) := fun a => if a ∈ s then cfc (A := A) (fun x => p⁻¹ * (x ^ p - 1)) a else 0 let g := fun a => if a ∈ s then log (A := A) a else 0 have hg : s.EqOn g (log (A := A)) := by simp +contextual [g, Set.EqOn] refine ConcaveOn.congr ?_ hg - apply isClosed_setOf_concaveOn.mem_of_tendsto (f := f) (b := (𝓝[>] (0 : ℝ))) + apply isClosed_setOfPred_concaveOn.mem_of_tendsto (f := f) (b := (𝓝[>] (0 : ℝ))) tendsto_ite_cfc_rpow_sub_one_ite_log ?_ have h₁ : ∀ᶠ (p : ℝ) in 𝓝[>] 0, 0 < p ∧ p < 1 := nhdsGT_basis 0 |>.mem_of_mem zero_lt_one filter_upwards [h₁] with p ⟨hp, hp'⟩ diff --git a/Mathlib/Analysis/SpecialFunctions/Exp.lean b/Mathlib/Analysis/SpecialFunctions/Exp.lean index f56bc3f95d4d05..8042b6b7f1f515 100644 --- a/Mathlib/Analysis/SpecialFunctions/Exp.lean +++ b/Mathlib/Analysis/SpecialFunctions/Exp.lean @@ -140,7 +140,7 @@ lemma UniformContinuousOn.cexp (a : ℝ) : UniformContinuousOn exp {x : ℂ | x. ring_nf rw [this, mul_comm] have hya : ‖cexp y‖ ≤ Real.exp a := by simpa only [norm_exp, Real.exp_le_exp] - simp only [gt_iff_lt, dist_zero_right, Set.mem_setOf_eq, norm_mul, Complex.norm_exp] at * + simp only [gt_iff_lt, dist_zero_right, Set.mem_ofPred_eq, norm_mul, Complex.norm_exp] at * apply lt_of_le_of_lt (mul_le_mul h3.le hya (Real.exp_nonneg y.re) ha.le) simp [field] diff --git a/Mathlib/Analysis/SpecialFunctions/Integrals/PosLogEqCircleAverage.lean b/Mathlib/Analysis/SpecialFunctions/Integrals/PosLogEqCircleAverage.lean index fc824bea709fd9..69f0f4ee5eb1f5 100644 --- a/Mathlib/Analysis/SpecialFunctions/Integrals/PosLogEqCircleAverage.lean +++ b/Mathlib/Analysis/SpecialFunctions/Integrals/PosLogEqCircleAverage.lean @@ -219,8 +219,8 @@ theorem circleAverage_log_norm_sub_const_eq_log_radius_add_posLog (hR : R ≠ 0) true_and] apply Set.Subsingleton.finite intro z₁ hz₁ z₂ hz₂ - simp_all only [ne_eq, abs_one, mem_sphere_iff_norm, sub_zero, Set.mem_sdiff, Set.mem_setOf_eq, - Decidable.not_not] + simp_all only [ne_eq, abs_one, mem_sphere_iff_norm, sub_zero, Set.mem_sdiff, + Set.mem_ofPred_eq, Decidable.not_not] rw [add_eq_zero_iff_eq_neg.1 hz₁.2, add_eq_zero_iff_eq_neg.1 hz₂.2] filter_upwards [this] with z hz rw [norm_mul, log_mul (norm_ne_zero_iff.2 (Complex.ofReal_ne_zero.mpr hR)) hz] diff --git a/Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean b/Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean index 52a2ab800666ac..7002ba9f72b6ff 100644 --- a/Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean +++ b/Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean @@ -106,7 +106,7 @@ theorem finite_integral_one_add_norm {r : ℝ} (hnr : (finrank ℝ E : ℝ) < r) μ (Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1)) := fun t ht ↦ by congr 1 ext x - simp only [mem_setOf_eq, mem_closedBall_zero_iff] + simp only [mem_ofPred_eq, mem_closedBall_zero_iff] exact le_rpow_one_add_norm_iff_norm_le hr (mem_Ioi.mp ht) x rw [setLIntegral_congr_fun measurableSet_Ioi h_int] set f := fun t : ℝ ↦ μ (Metric.closedBall (0 : E) (t ^ (-r⁻¹) - 1)) diff --git a/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean b/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean index fe745c1c5d5d34..db9a11f5252fc9 100644 --- a/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean +++ b/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean @@ -373,7 +373,8 @@ theorem continuous_log : Continuous fun x : { x : ℝ // x ≠ 0 } => log x := /-- The real logarithm is continuous as a function from positive reals. -/ @[fun_prop] theorem continuous_log' : Continuous fun x : { x : ℝ // 0 < x } => log x := - continuousOn_iff_continuous_restrict.1 <| continuousOn_log.mono fun _ hx => ne_of_gt hx + continuousOn_iff_continuous_restrict (s := {x : ℝ | 0 < x}) |>.1 <| + continuousOn_log.mono fun _ hx => ne_of_gt hx theorem continuousAt_log (hx : x ≠ 0) : ContinuousAt log x := (continuousOn_log x hx).continuousAt <| isOpen_compl_singleton.mem_nhds hx @@ -482,28 +483,32 @@ theorem image_log_Ici {a : ℝ} (ha : 0 < a) : log '' Ici a = Ici (log a) := @[simp] theorem image_log_Icc {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : log '' Icc a b = Icc (log a) (log b) := - (continuousOn_log.mono fun _ hx ↦ (ha.trans_le hx.1).ne').image_Icc_of_monotoneOn hab - (strictMonoOn_log.monotoneOn.mono fun _ hx ↦ ha.trans_le hx.1) + (continuousOn_log.mono fun x (hx : x ∈ Icc a b) ↦ (ha.trans_le hx.1).ne').image_Icc_of_monotoneOn + hab (strictMonoOn_log.monotoneOn.mono fun _ hx ↦ ha.trans_le hx.1) @[simp] theorem image_log_Ico {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : log '' Ico a b = Ico (log a) (log b) := - (continuousOn_log.mono fun _ hx ↦ (ha.trans_le hx.1).ne').image_Ico_of_strictMonoOn hab + (continuousOn_log.mono (fun x (hx : x ∈ Icc a b) ↦ + (ha.trans_le hx.1).ne')).image_Ico_of_strictMonoOn hab (strictMonoOn_log.mono fun _ hx ↦ ha.trans_le hx.1) @[simp] theorem image_log_Ioc {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : log '' Ioc a b = Ioc (log a) (log b) := - (continuousOn_log.mono fun _ hx ↦ (ha.trans_le hx.1).ne').image_Ioc_of_strictMonoOn hab + (continuousOn_log.mono (fun x (hx : x ∈ Icc a b) ↦ + (ha.trans_le hx.1).ne')).image_Ioc_of_strictMonoOn hab (strictMonoOn_log.mono fun _ hx ↦ ha.trans_le hx.1) @[simp] theorem image_log_Ioo {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : log '' Ioo a b = Ioo (log a) (log b) := - (continuousOn_log.mono fun _ hx ↦ (ha.trans_le hx.1).ne').image_Ioo_of_strictMonoOn hab + (continuousOn_log.mono (fun x (hx : x ∈ Icc a b) ↦ + (ha.trans_le hx.1).ne')).image_Ioo_of_strictMonoOn hab (strictMonoOn_log.mono fun _ hx ↦ ha.trans_le hx.1) @[simp] theorem image_log_uIcc {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : log '' uIcc a b = uIcc (log a) (log b) := - (continuousOn_log.mono fun _ hx ↦ ((lt_min ha hb).trans_le hx.1).ne').image_uIcc_of_monotoneOn + (continuousOn_log.mono (fun x (hx : x ∈ uIcc a b) ↦ + ((lt_min ha hb).trans_le hx.1).ne')).image_uIcc_of_monotoneOn (strictMonoOn_log.monotoneOn.mono fun _ hx ↦ (lt_min ha hb).trans_le hx.1) @[simp] diff --git a/Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean b/Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean index d41254b9cd1ef3..56c2032d5fbaf0 100644 --- a/Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean +++ b/Mathlib/Analysis/SpecialFunctions/Log/Deriv.lean @@ -388,7 +388,7 @@ theorem hasSum_log_sub_log_of_abs_lt_one {x : ℝ} (h : |x| < 1) : convert! h₁.add (hasSum_pow_div_log_of_abs_lt_one h) using 1 ring_nf · intro m hm - rw [range_two_mul, Set.mem_setOf_eq, ← Nat.even_add_one] at hm + rw [range_two_mul, Set.mem_ofPred_eq, ← Nat.even_add_one] at hm dsimp [term] rw [Even.neg_pow hm, neg_one_mul, neg_add_cancel] diff --git a/Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean b/Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean index 11c472c0be494e..daaa4ea85e67e9 100644 --- a/Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean +++ b/Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean @@ -71,7 +71,7 @@ theorem log_div_self_rpow_antitoneOn {a : ℝ} (ha : 0 < a) : log_rpow (rpow_pos_of_pos y_pos a), log_rpow (rpow_pos_of_pos x_pos a), mul_div_assoc, mul_div_assoc, mul_le_mul_iff_right₀ (one_div_pos.mpr ha)] have hbound {z : ℝ} (hz : z ∈ Ici (rexp a⁻¹)) : z ^ a ∈ {b | rexp 1 ≤ b} := by - rw [mem_setOf_eq] + rw [mem_ofPred_eq] convert! rpow_le_rpow _ hz (le_of_lt ha) using 1 · simp only [← exp_mul, Real.exp_eq_exp, field] positivity diff --git a/Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean b/Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean index f957e408e5bb5a..f8567d1528d353 100644 --- a/Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean +++ b/Mathlib/Analysis/SpecialFunctions/NonIntegrable.lean @@ -66,7 +66,7 @@ theorem not_integrableOn_of_tendsto_norm_atTop_of_deriv_isBigO_filter_aux ∀ y ∈ [[x.1, x.2]], (DifferentiableAt ℝ f y ∧ ‖deriv f y‖ ≤ C * ‖g y‖) ∧ y ∈ k := (tendsto_fst.uIcc tendsto_snd).eventually ((hd.and hC.bound).and hl).smallSets rcases mem_prod_self_iff.1 h with ⟨s, hsl, hs⟩ - simp only [prod_subset_iff, mem_setOf_eq] at hs + simp only [prod_subset_iff, mem_ofPred_eq] at hs exact ⟨C, C₀, s, hsl, fun x hx y hy z hz => (hs x hx y hy z hz).2, fun x hx y hy z hz => (hs x hx y hy z hz).1.1, fun x hx y hy z hz => (hs x hx y hy z hz).1.2⟩ replace hgi : IntegrableOn (fun x ↦ C * ‖g x‖) k := by exact hgi.norm.smul C @@ -164,7 +164,7 @@ theorem not_intervalIntegrable_of_tendsto_norm_atTop_of_deriv_isBigO_punctured { {g : ℝ → F} {a b c : ℝ} (h_deriv : ∀ᶠ x in 𝓝[≠] c, DifferentiableAt ℝ f x) (h_infty : Tendsto (fun x => ‖f x‖) (𝓝[≠] c) atTop) (hg : deriv f =O[𝓝[≠] c] g) (hne : a ≠ b) (hc : c ∈ [[a, b]]) : ¬IntervalIntegrable g volume a b := - have : 𝓝[[[a, b]] \ {c}] c ≤ 𝓝[≠] c := nhdsWithin_mono _ inter_subset_right + have : 𝓝[[[a, b]] \ {c}] c ≤ 𝓝[≠] c := nhdsWithin_mono _ fun _ hx => hx.2 not_intervalIntegrable_of_tendsto_norm_atTop_of_deriv_isBigO_within_sdiff_singleton hne hc (h_deriv.filter_mono this) (h_infty.mono_left this) (hg.mono this) diff --git a/Mathlib/Analysis/SpecialFunctions/PolarCoord.lean b/Mathlib/Analysis/SpecialFunctions/PolarCoord.lean index ae94fa6b17397c..0268cea54112a0 100644 --- a/Mathlib/Analysis/SpecialFunctions/PolarCoord.lean +++ b/Mathlib/Analysis/SpecialFunctions/PolarCoord.lean @@ -44,7 +44,7 @@ def polarCoord : OpenPartialHomeomorph (ℝ × ℝ) (ℝ × ℝ) where · simpa using! hr · right simp at hr - simpa only [ne_of_gt hr, Ne, mem_setOf_eq, mul_eq_zero, false_or, + simpa only [ne_of_gt hr, Ne, mem_ofPred_eq, mul_eq_zero, false_or, sin_eq_zero_iff_of_lt_of_lt hθ.1 hθ.2] using! h'θ map_source' := by rintro ⟨x, y⟩ hxy @@ -120,10 +120,10 @@ theorem det_fderivPolarCoordSymm (p : ℝ × ℝ) : instance : Measure.IsAddHaarMeasure volume (G := ℝ × ℝ) := Measure.prod.instIsAddHaarMeasure _ _ -theorem polarCoord_source_ae_eq_univ : polarCoord.source =ᵐ[volume] univ := by +theorem polarCoord_source_ae_eq_univ : polarCoord.source =ᵐˢ[volume] univ := by have A : polarCoord.sourceᶜ ⊆ LinearMap.ker (LinearMap.snd ℝ ℝ ℝ) := by intro x hx - simp only [polarCoord_source, compl_union, mem_inter_iff, mem_compl_iff, mem_setOf_eq, not_lt, + simp only [polarCoord_source, compl_union, mem_inter_iff, mem_compl_iff, mem_ofPred_eq, not_lt, Classical.not_not] at hx exact hx.2 have B : volume (LinearMap.ker (LinearMap.snd ℝ ℝ ℝ) : Set (ℝ × ℝ)) = 0 := by @@ -259,7 +259,7 @@ theorem det_fderivPiPolarCoordSymm (p : ι → ℝ × ℝ) : theorem pi_polarCoord_symm_target_ae_eq_univ : (Pi.map (fun _ : ι ↦ polarCoord.symm) '' Set.univ.pi fun _ ↦ polarCoord.target) - =ᵐ[volume] Set.univ := by + =ᵐˢ[volume] Set.univ := by rw [Set.piMap_image_univ_pi, polarCoord.symm_image_target_eq_source, volume_pi, ← Set.pi_univ] exact ae_eq_set_pi fun _ _ ↦ polarCoord_source_ae_eq_univ diff --git a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean index a4f209c1ff56de..82c11e2b416ee9 100644 --- a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean +++ b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean @@ -78,7 +78,7 @@ theorem continuous_tan : Continuous fun x : {x | cos x ≠ 0} => tan x := theorem continuousOn_tan_Ioo : ContinuousOn tan (Ioo (-(π / 2)) (π / 2)) := by refine ContinuousOn.mono continuousOn_tan fun x => ?_ - simp only [and_imp, mem_Ioo, mem_setOf_eq, Ne] + simp only [and_imp, mem_Ioo, mem_ofPred_eq, Ne] rw [cos_eq_zero_iff] rintro hx_gt hx_lt ⟨r, hxr_eq⟩ rcases le_or_gt 0 r with h | h diff --git a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean index 561dc570aa772d..660b110661726d 100644 --- a/Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean +++ b/Mathlib/Analysis/SpecialFunctions/Trigonometric/Bounds.lean @@ -192,7 +192,7 @@ theorem lt_tan {x : ℝ} (h1 : 0 < x) (h2 : x < π / 2) : x < tan x := by have tan_cts_U : ContinuousOn tan U := by apply ContinuousOn.mono continuousOn_tan intro z hz - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] exact (cos_pos hz).ne' have tan_minus_id_cts : ContinuousOn (fun y : ℝ => tan y - y) U := tan_cts_U.sub continuousOn_id have deriv_pos (y : ℝ) (hy : y ∈ interior U) : 0 < deriv (fun y' : ℝ => tan y' - y') y := by diff --git a/Mathlib/Analysis/SumOverResidueClass.lean b/Mathlib/Analysis/SumOverResidueClass.lean index bdc7e0dec25275..470ee87f165451 100644 --- a/Mathlib/Analysis/SumOverResidueClass.lean +++ b/Mathlib/Analysis/SumOverResidueClass.lean @@ -25,7 +25,7 @@ public section lemma Finset.sum_indicator_mod {R : Type*} [AddCommMonoid R] (m : ℕ) [NeZero m] (f : ℕ → R) : f = ∑ a : ZMod m, {n : ℕ | (n : ZMod m) = a}.indicator f := by ext n - simp only [Finset.sum_apply, Set.indicator_apply, Set.mem_setOf_eq, Finset.sum_ite_eq, + simp only [Finset.sum_apply, Set.indicator_apply, Set.mem_ofPred_eq, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte] open Set in @@ -36,8 +36,8 @@ lemma summable_indicator_mod_iff_summable {R : Type*} [AddCommGroup R] [Topologi Summable ({n : ℕ | (n : ZMod m) = k}.indicator f) ↔ Summable fun n ↦ f (m * n + k) := by trans Summable ({n : ℕ | (n : ZMod m) = k ∧ k ≤ n}.indicator f) · rw [← (finite_lt_nat k).summable_compl_iff (f := {n : ℕ | (n : ZMod m) = k}.indicator f)] - simp only [summable_subtype_iff_indicator, indicator_indicator, inter_comm, setOf_and, - compl_setOf, not_lt] + simp only [summable_subtype_iff_indicator, indicator_indicator, inter_comm, ofPred_and, + compl_ofPred, not_lt] · let g : ℕ → ℕ := fun n ↦ m * n + k have hg : Function.Injective g := fun m n hmn ↦ by simpa [g, hm.ne] using hmn have hg' : ∀ n ∉ range g, {n : ℕ | (n : ZMod m) = k ∧ k ≤ n}.indicator f n = 0 := by @@ -45,7 +45,7 @@ lemma summable_indicator_mod_iff_summable {R : Type*} [AddCommGroup R] [Topologi contrapose! hn exact (Nat.range_mul_add m k).symm ▸ mem_of_indicator_ne_zero hn convert (Function.Injective.summable_iff hg hg').symm - simp only [Function.comp_apply, mem_setOf_eq, Nat.cast_add, Nat.cast_mul, CharP.cast_eq_zero, + simp only [Function.comp_apply, mem_ofPred_eq, Nat.cast_add, Nat.cast_mul, CharP.cast_eq_zero, zero_mul, zero_add, le_add_iff_nonneg_left, zero_le, and_self, indicator_of_mem, g] /-- If `f : ℕ → ℝ` is decreasing and has a negative term, then `f` is not summable. -/ diff --git a/Mathlib/CategoryTheory/Abelian/Injective/Dimension.lean b/Mathlib/CategoryTheory/Abelian/Injective/Dimension.lean index 80480ea8fccd10..ae99bebc25e9b5 100644 --- a/Mathlib/CategoryTheory/Abelian/Injective/Dimension.lean +++ b/Mathlib/CategoryTheory/Abelian/Injective/Dimension.lean @@ -270,7 +270,7 @@ lemma injectiveDimension_eq_of_iso {X Y : C} (e : X ≅ Y) : lemma Retract.injectiveDimension_le {X Y : C} (h : Retract X Y) : injectiveDimension X ≤ injectiveDimension Y := sInf_le_sInf_of_subset_insert_top (fun n hn ↦ by - simp only [Set.mem_setOf_eq, not_top_lt, IsEmpty.forall_iff, implies_true, + simp only [Set.mem_ofPred_eq, not_top_lt, IsEmpty.forall_iff, implies_true, Set.insert_eq_of_mem] at hn ⊢ intro i hi have := hn i hi @@ -280,7 +280,7 @@ lemma injectiveDimension_lt_iff {X : C} {n : ℕ} : injectiveDimension X < n ↔ HasInjectiveDimensionLT X n := by refine ⟨fun h ↦ ?_, fun h ↦ sInf_lt_iff.2 ?_⟩ · have : injectiveDimension X ∈ _ := csInf_mem ⟨⊤, by simp⟩ - simp only [Set.mem_setOf_eq] at this + simp only [Set.mem_ofPred_eq] at this exact this _ h · obtain _ | n := n · exact ⟨⊥, fun _ _ ↦ hasInjectiveDimensionLT_of_ge _ 0 _ (by simp), by decide⟩ diff --git a/Mathlib/CategoryTheory/Abelian/Projective/Dimension.lean b/Mathlib/CategoryTheory/Abelian/Projective/Dimension.lean index 84d39c8c75290e..cc93f3d5ed05ac 100644 --- a/Mathlib/CategoryTheory/Abelian/Projective/Dimension.lean +++ b/Mathlib/CategoryTheory/Abelian/Projective/Dimension.lean @@ -275,7 +275,7 @@ lemma projectiveDimension_eq_of_iso {X Y : C} (e : X ≅ Y) : lemma Retract.projectiveDimension_le {X Y : C} (h : Retract X Y) : projectiveDimension X ≤ projectiveDimension Y := sInf_le_sInf_of_subset_insert_top (fun n hn ↦ by - simp only [Set.mem_setOf_eq, not_top_lt, IsEmpty.forall_iff, implies_true, + simp only [Set.mem_ofPred_eq, not_top_lt, IsEmpty.forall_iff, implies_true, Set.insert_eq_of_mem] at hn ⊢ intro i hi have := hn i hi @@ -285,7 +285,7 @@ lemma projectiveDimension_lt_iff {X : C} {n : ℕ} : projectiveDimension X < n ↔ HasProjectiveDimensionLT X n := by refine ⟨fun h ↦ ?_, fun h ↦ sInf_lt_iff.2 ?_⟩ · have : projectiveDimension X ∈ _ := csInf_mem ⟨⊤, by simp⟩ - simp only [Set.mem_setOf_eq] at this + simp only [Set.mem_ofPred_eq] at this exact this _ h · obtain _ | n := n · exact ⟨⊥, fun _ _ ↦ hasProjectiveDimensionLT_of_ge _ 0 _ (by simp), by decide⟩ diff --git a/Mathlib/CategoryTheory/CofilteredSystem.lean b/Mathlib/CategoryTheory/CofilteredSystem.lean index 3d73003635fa6c..239be65b5554aa 100644 --- a/Mathlib/CategoryTheory/CofilteredSystem.lean +++ b/Mathlib/CategoryTheory/CofilteredSystem.lean @@ -166,10 +166,7 @@ theorem isMittagLeffler_of_surjective (h : ∀ ⦃i j : J⦄ (f : i ⟶ j), Func def toPreimages : J ⥤ Type v where obj j := ⋂ f : j ⟶ i, F.map f ⁻¹' s map g := ↾(MapsTo.restrict (F.map g) _ _ fun x h => by - rw [mem_iInter] at h ⊢ - intro f - rw [← mem_preimage, preimage_preimage, mem_preimage] - convert! h (g ≫ f); rw [F.map_comp]; rfl) + rw [mem_iInter] at h ⊢; intro f; simpa using h (g ≫ f)) instance toPreimages_finite [∀ j, Finite (F.obj j)] : ∀ j, Finite ((F.toPreimages s).obj j) := fun _ => Subtype.finite diff --git a/Mathlib/CategoryTheory/Galois/Topology.lean b/Mathlib/CategoryTheory/Galois/Topology.lean index b3075869aaa53e..c78c0334433aa3 100644 --- a/Mathlib/CategoryTheory/Galois/Topology.lean +++ b/Mathlib/CategoryTheory/Galois/Topology.lean @@ -81,7 +81,7 @@ instance : TopologicalSpace (Aut F) := Set.range (autEmbedding F) = ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom = (a f.left).hom ≫ F.map f.hom } := by ext a - simp only [Set.mem_range, id_obj, Set.mem_iInter, Set.mem_setOf_eq] + simp only [Set.mem_range, id_obj, Set.mem_iInter, Set.mem_ofPred_eq] refine ⟨fun ⟨σ, h⟩ i ↦ h.symm ▸ σ.hom.naturality i.hom, fun h ↦ ?_⟩ · use NatIso.ofComponents a (fun {X Y} f ↦ h ⟨X, Y, f⟩) rfl-/ @@ -92,7 +92,7 @@ lemma autEmbedding_range : Set.range (autEmbedding F) = ⋂ (f : Arrow C), { a | F.map f.hom ≫ (a f.right).hom = (a f.left).hom ≫ F.map f.hom } := by ext a - simp +instances only [Set.mem_range, Set.mem_iInter, Set.mem_setOf_eq] + simp +instances only [Set.mem_range, Set.mem_iInter, Set.mem_ofPred_eq] refine ⟨fun ⟨σ, h⟩ i ↦ by cat_disch, fun h ↦ ?_⟩ exact ⟨NatIso.ofComponents a (fun {X Y} f ↦ by ext; simpa using ConcreteCategory.congr_hom (h ⟨X, Y, f⟩) _), rfl⟩ diff --git a/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean b/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean index d27f71fc9cc941..e19223cea2de64 100644 --- a/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean +++ b/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean @@ -381,10 +381,10 @@ by taking preimages. -/ def comap (S : Subgroupoid D) : Subgroupoid C where arrows c d := {f : c ⟶ d | φ.map f ∈ S.arrows (φ.obj c) (φ.obj d)} - inv hp := by rw [mem_setOf, inv_eq_inv, φ.map_inv, ← inv_eq_inv]; exact S.inv hp + inv hp := by rw [mem_ofPred, inv_eq_inv, φ.map_inv, ← inv_eq_inv]; exact S.inv hp mul := by intros - simp only [mem_setOf, Functor.map_comp] + simp only [mem_ofPred, Functor.map_comp] apply S.mul <;> assumption @[gcongr] @@ -392,9 +392,9 @@ theorem comap_mono (S T : Subgroupoid D) : S ≤ T → comap φ S ≤ comap φ T @ST ⟨_, _, _⟩ theorem isNormal_comap {S : Subgroupoid D} (Sn : IsNormal S) : IsNormal (comap φ S) where - wide c := by rw [comap, mem_setOf, Functor.map_id]; apply Sn.wide + wide c := by rw [comap, mem_ofPred, Functor.map_id]; apply Sn.wide conj f γ hγ := by - simp_rw [inv_eq_inv f, comap, mem_setOf, Functor.map_comp, Functor.map_inv, ← inv_eq_inv] + simp_rw [inv_eq_inv f, comap, mem_ofPred, Functor.map_comp, Functor.map_inv, ← inv_eq_inv] exact Sn.conj _ hγ @[simp] diff --git a/Mathlib/CategoryTheory/Limits/FinallySmall.lean b/Mathlib/CategoryTheory/Limits/FinallySmall.lean index e551669d855b26..1e95b1f87efaed 100644 --- a/Mathlib/CategoryTheory/Limits/FinallySmall.lean +++ b/Mathlib/CategoryTheory/Limits/FinallySmall.lean @@ -217,8 +217,7 @@ theorem initiallySmall_of_essentiallySmall_weakly_initial_objectProperty [IsCofilteredOrEmpty J] (P : ObjectProperty J) [ObjectProperty.EssentiallySmall.{v} P] (hP : ∀ i, ∃ j, P j ∧ Nonempty (j ⟶ i)) : InitiallySmall.{v} J := by obtain ⟨Q, H, hQ⟩ := ObjectProperty.EssentiallySmall.exists_small_le'.{v} P - have : Small.{v} (show Set _ from Q) := by assumption - refine initiallySmall_of_small_weakly_initial_set Q (fun i ↦ ?_) + refine initiallySmall_of_small_weakly_initial_set {j | Q j} fun i ↦ ?_ obtain ⟨j, hj, ⟨f⟩⟩ := hP i obtain ⟨k, hk, ⟨e⟩⟩ := hQ _ hj exact ⟨k, hk, ⟨e.inv ≫ f⟩⟩ diff --git a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean index d27c680a517aaa..f5ab60a20c426f 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Basic.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Basic.lean @@ -285,7 +285,7 @@ section variable (P : MorphismProperty C) /-- The set in `Set (Arrow C)` which corresponds to `P : MorphismProperty C`. -/ -def toSet : Set (Arrow C) := setOf (fun f ↦ P f.hom) +def toSet : Set (Arrow C) := Set.ofPred (fun f ↦ P f.hom) lemma mem_toSet_iff (f : Arrow C) : f ∈ P.toSet ↔ P f.hom := Iff.rfl diff --git a/Mathlib/CategoryTheory/MorphismProperty/Concrete.lean b/Mathlib/CategoryTheory/MorphismProperty/Concrete.lean index 083328e2b51d15..3ac953278a61be 100644 --- a/Mathlib/CategoryTheory/MorphismProperty/Concrete.lean +++ b/Mathlib/CategoryTheory/MorphismProperty/Concrete.lean @@ -119,7 +119,7 @@ map followed by an injective map. -/ def functorialSurjectiveInjectiveFactorizationData : FunctorialSurjectiveInjectiveFactorizationData (Type u) where Z := - { obj := fun f => Subtype (Set.range f.hom.hom) + { obj := fun f => ↥(Set.range f.hom.hom) map := fun φ => ↾fun y => ⟨φ.right y.1, by obtain ⟨_, x, rfl⟩ := y exact ⟨φ.left x, congr_hom φ.w x⟩ ⟩ } diff --git a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean index d4745dd6b9f4a7..9930f449d0d131 100644 --- a/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean +++ b/Mathlib/CategoryTheory/Presentable/CardinalDirectedPoset.lean @@ -336,11 +336,11 @@ protected lemma isCardinalPresentable_iff (h : κ ≤ κ') : obtain ⟨X, f, hf⟩ := IsCardinalPresentable.exists_hom_of_isColimit κ' (isColimitCoconeWithTop J κ') (ObjectProperty.homMk (PartOrdEmb.ofHom WithTop.coeOrderHom)) - replace hf : OrderEmbedding.subtype X.1 ∘ f = WithTop.coeOrderHom := by + replace hf : OrderEmbedding.subtype (· ∈ X.1) ∘ f = WithTop.coeOrderHom := by ext x exact ConcreteCategory.congr_hom hf x refine X.2.1.of_injective f (Function.Injective.of_comp - (f := OrderEmbedding.subtype X.1) ?_) + (f := OrderEmbedding.subtype (· ∈ X.1)) ?_) dsimp at hf ⊢ rw [hf] exact WithTop.coe_injective diff --git a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean index 5a9df97b791eff..51c979b8f4af2a 100644 --- a/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean +++ b/Mathlib/CategoryTheory/Presentable/SharplyLT/Basic.lean @@ -145,7 +145,7 @@ lemma hφ₀ (B : Set X) (hB : HasCardinalLT B κ₂) {T : Type w} (f : T → B) open scoped Classical in /-- This coincides with `φ₀` when `HasCardinalLT B κ₂` holds. -/ -def φ (B : Set X) : Set X := +noncomputable def φ (B : Set X) : Set X := if hB : HasCardinalLT B κ₂ then φ₀ Y m B hB else B omit [Fact κ₁.IsRegular] [Fact κ₂.IsRegular] [PartialOrder X] in diff --git a/Mathlib/CategoryTheory/Sites/Closed.lean b/Mathlib/CategoryTheory/Sites/Closed.lean index 7ae033f8ffa550..1e9a2af18c9cd1 100644 --- a/Mathlib/CategoryTheory/Sites/Closed.lean +++ b/Mathlib/CategoryTheory/Sites/Closed.lean @@ -232,7 +232,7 @@ lemma GrothendieckTopology.mem_iff_isSheafFor_closedSieves rw [Subtype.ext_iff] at this exact this refine H.isSeparatedFor.ext fun Y f hf ↦ ?_ - simp only [Subfunctor.toFunctor_obj, Functor.sieves_obj, Functor.closedSieves_obj, Set.coe_setOf] + simp only [Subfunctor.toFunctor_obj, Functor.sieves_obj, Functor.closedSieves_obj, Set.coe_ofPred] ext1 dsimp rw [Sieve.pullback_top, ← J.pullback_close, S.pullback_eq_top_of_mem hf, @@ -276,11 +276,11 @@ def topologyOfClosureOperator (c : ∀ X : C, ClosureOperator (Sieve X)) sieves X := { S | c X S = ⊤ } top_mem' X := top_unique ((c X).le_closure _) pullback_stable' X Y S f hS := by - rw [Set.mem_setOf_eq] at hS - rw [Set.mem_setOf_eq, hc, hS, Sieve.pullback_top] + rw [Set.mem_ofPred_eq] at hS + rw [Set.mem_ofPred_eq, hc, hS, Sieve.pullback_top] transitive' X S hS R hR := by - rw [Set.mem_setOf_eq] at hS - rw [Set.mem_setOf_eq, ← (c X).idempotent, eq_top_iff, ← hS] + rw [Set.mem_ofPred_eq] at hS + rw [Set.mem_ofPred_eq, ← (c X).idempotent, eq_top_iff, ← hS] apply (c X).monotone fun Y f hf => _ intro Y f hf rw [Sieve.mem_iff_pullback_eq_top, ← hc] diff --git a/Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean b/Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean index b09b1098ea1c02..6f90a4ba3c613d 100644 --- a/Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean +++ b/Mathlib/CategoryTheory/Sites/Coherent/Comparison.lean @@ -82,7 +82,7 @@ theorem extensive_regular_generate_coherent [Preregular C] [FinitaryPreExtensive (fun (_ : Unit) ↦ (∐ fun (i : I) => X i)) (fun (_ : Unit) ↦ Sigma.desc f))) · apply Coverage.Saturate.of simp only [Coverage.sup_covering, extensiveCoverage, regularCoverage, Set.mem_union, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] exact Or.inr ⟨_, Sigma.desc f, ⟨rfl, inferInstance⟩⟩ · rintro R g ⟨W, ψ, σ, ⟨⟩, rfl⟩ change _ ∈ ((extensiveCoverage C) ⊔ (regularCoverage C)).toGrothendieck R diff --git a/Mathlib/CategoryTheory/Sites/Coherent/RegularSheaves.lean b/Mathlib/CategoryTheory/Sites/Coherent/RegularSheaves.lean index 50b5cccb9a70d0..912f5e961e251a 100644 --- a/Mathlib/CategoryTheory/Sites/Coherent/RegularSheaves.lean +++ b/Mathlib/CategoryTheory/Sites/Coherent/RegularSheaves.lean @@ -89,7 +89,7 @@ def mapToEqualizer (P : Cᵒᵖ ⥤ Type*) {W X B : C} (f : X ⟶ B) (g₁ g₂ : W ⟶ X) (w : g₁ ≫ f = g₂ ≫ f) : P.obj (op B) ⟶ { x : P.obj (op X) | P.map g₁.op x = P.map g₂.op x } := ↾fun t ↦ - ⟨P.map f.op t, by simp only [Set.mem_setOf_eq, ← comp_apply, ← Functor.map_comp, ← op_comp, w]⟩ + ⟨P.map f.op t, by simp only [Set.mem_ofPred_eq, ← comp_apply, ← Functor.map_comp, ← op_comp, w]⟩ @[deprecated (since := "2025-11-23")] alias MapToEqualizer := mapToEqualizer diff --git a/Mathlib/CategoryTheory/Sites/Coverage.lean b/Mathlib/CategoryTheory/Sites/Coverage.lean index 832f1c3ae18087..5f9065e22302f0 100644 --- a/Mathlib/CategoryTheory/Sites/Coverage.lean +++ b/Mathlib/CategoryTheory/Sites/Coverage.lean @@ -255,7 +255,7 @@ associated Grothendieck topology is pullback stable, and so an additional constr in the inductive construction is not needed. -/ def toGrothendieck (K : Coverage C) : GrothendieckTopology C := - K.toPrecoverage.toGrothendieck.copy (fun X ↦ setOf (K.Saturate X)) <| by + K.toPrecoverage.toGrothendieck.copy (fun X ↦ Set.ofPred (K.Saturate X)) <| by ext exact K.saturate_iff_saturate_toPrecoverage.symm diff --git a/Mathlib/CategoryTheory/Sites/JointlySurjective.lean b/Mathlib/CategoryTheory/Sites/JointlySurjective.lean index 83220bdea62b09..5c12f87bced218 100644 --- a/Mathlib/CategoryTheory/Sites/JointlySurjective.lean +++ b/Mathlib/CategoryTheory/Sites/JointlySurjective.lean @@ -33,7 +33,7 @@ namespace Types /-- The jointly surjective precoverage in the category of types has the jointly surjective families as coverings. -/ def jointlySurjectivePrecoverage : Precoverage (Type u) where - coverings X R := ∀ x : X, ∃ (Y : Type u) (g : Y ⟶ X), R g ∧ x ∈ Set.range g + coverings X := {R | ∀ x : X, ∃ (Y : Type u) (g : Y ⟶ X), R g ∧ x ∈ Set.range g} lemma mem_jointlySurjectivePrecoverage_iff {X : Type u} {R : Presieve X} : R ∈ jointlySurjectivePrecoverage X ↔ @@ -73,7 +73,7 @@ instance : jointlySurjectivePrecoverage.IsStableUnderComposition where simp instance : jointlySurjectivePrecoverage.IsStableUnderSup where - sup_mem_coverings {X} R S hR _ x := by + sup_mem_coverings {X R S} hR _ x := by obtain ⟨Y, f, hf, hx⟩ := hR x use Y, f, .inl hf diff --git a/Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean b/Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean index fc344b9950c132..d4cc5d8d0760c5 100644 --- a/Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean +++ b/Mathlib/CategoryTheory/Sites/PrecoverageToGrothendieck.lean @@ -59,7 +59,7 @@ It is defined *inductively* as follows: 4. Add all sieves required by the *local character* axiom of a Grothendieck topology. -/ def toGrothendieck (J : Precoverage C) : GrothendieckTopology C where - sieves X := setOf (J.Saturate X) + sieves X := Set.ofPred (J.Saturate X) top_mem' := .top pullback_stable' _ _ _ _ hS := .pullback _ _ hS _ _ transitive' _ _ hS _ hR := .transitive _ _ _ hS hR diff --git a/Mathlib/CategoryTheory/Subfunctor/Equalizer.lean b/Mathlib/CategoryTheory/Subfunctor/Equalizer.lean index 364761364fe79d..4cfe2c22461cac 100644 --- a/Mathlib/CategoryTheory/Subfunctor/Equalizer.lean +++ b/Mathlib/CategoryTheory/Subfunctor/Equalizer.lean @@ -33,7 +33,7 @@ namespace Subfunctor `A.toFunctor ⟶ F₂` with `A : Subfunctor F₁`, as a subcomplex of `F₁`. -/ @[simps -isSimp] protected def equalizer : Subfunctor F₁ where - obj U := setOf (fun x ↦ ∃ (hx : x ∈ A.obj _), f.app _ ⟨x, hx⟩ = g.app _ ⟨x, hx⟩) + obj U := Set.ofPred (fun x ↦ ∃ (hx : x ∈ A.obj _), f.app _ ⟨x, hx⟩ = g.app _ ⟨x, hx⟩) map φ x := by rintro ⟨hx, h⟩ exact ⟨A.map _ hx, diff --git a/Mathlib/CategoryTheory/Subfunctor/OfSection.lean b/Mathlib/CategoryTheory/Subfunctor/OfSection.lean index fc2da55b41872d..a637d373889541 100644 --- a/Mathlib/CategoryTheory/Subfunctor/OfSection.lean +++ b/Mathlib/CategoryTheory/Subfunctor/OfSection.lean @@ -35,7 +35,7 @@ variable {F : Cᵒᵖ ⥤ Type w} {X : Cᵒᵖ} (x : F.obj X) by a section `x : F.obj X`. -/ @[simps -isSimp] def ofSection : Subfunctor F where - obj U := setOf (fun u ↦ ∃ (f : X ⟶ U), F.map f x = u) + obj U := Set.ofPred (fun u ↦ ∃ (f : X ⟶ U), F.map f x = u) map {U V} g := by rintro _ ⟨f, rfl⟩ exact ⟨f ≫ g, by simp⟩ @@ -69,7 +69,7 @@ variable {F : Cᵒᵖ ⥤ Type v} lemma ofSection_eq_range {X : Cᵒᵖ} (x : F.obj X) : ofSection x = range (yonedaEquiv.symm x) := by ext U y - simp only [ofSection_obj, Set.mem_setOf_eq, Opposite.op_unop, range_obj, + simp only [ofSection_obj, Set.mem_ofPred_eq, Opposite.op_unop, range_obj, Set.mem_range] constructor · rintro ⟨f, rfl⟩ diff --git a/Mathlib/Combinatorics/Additive/CauchyDavenport.lean b/Mathlib/Combinatorics/Additive/CauchyDavenport.lean index dc5fdf975a8fb2..300291b63d5faa 100644 --- a/Mathlib/Combinatorics/Additive/CauchyDavenport.lean +++ b/Mathlib/Combinatorics/Additive/CauchyDavenport.lean @@ -124,7 +124,7 @@ lemma cauchy_davenport_minOrder_mul (hs : s.Nonempty) (ht : t.Nonempty) : min (minOrder α) ↑(#x.1 + #x.2 - 1) ≤ #(x.1 * x.2)) ⟨hs, ht⟩ ?_ clear! x rintro ⟨s, t⟩ ⟨hs, ht⟩ ih - simp only [min_le_iff, tsub_le_iff_right, Prod.forall, Set.mem_setOf_eq, and_imp, + simp only [min_le_iff, tsub_le_iff_right, Prod.forall, Set.mem_ofPred_eq, and_imp, Nat.cast_le] at * -- If `#t < #s`, we're done by the induction hypothesis on `(t⁻¹, s⁻¹)`. obtain hts | hst := lt_or_ge #t #s diff --git a/Mathlib/Combinatorics/Additive/Dissociation.lean b/Mathlib/Combinatorics/Additive/Dissociation.lean index d50809f67c1099..fb6a16620d56c6 100644 --- a/Mathlib/Combinatorics/Additive/Dissociation.lean +++ b/Mathlib/Combinatorics/Additive/Dissociation.lean @@ -57,7 +57,7 @@ def MulDissociated (s : Set α) : Prop := {t : Finset α | ↑t ⊆ s}.InjOn ( @[to_additive (attr := simp)] lemma mulDissociated_singleton : MulDissociated ({a} : Set α) ↔ a ≠ 1 := by - simp [MulDissociated, setOf_or, -subset_singleton_iff, + simp [MulDissociated, ofPred_or, -subset_singleton_iff, Finset.coe_subset_singleton] @[to_additive (attr := simp)] diff --git a/Mathlib/Combinatorics/Compactness.lean b/Mathlib/Combinatorics/Compactness.lean index a1ae1640e0ae1a..ece779d509df87 100644 --- a/Mathlib/Combinatorics/Compactness.lean +++ b/Mathlib/Combinatorics/Compactness.lean @@ -73,7 +73,7 @@ theorem Finset.rado_selection (g : Finset α → (a : α) → β a) : exact (isClosed_discrete _).preimage (by fun_prop) have he'' (B : Finset (Finset α)) : (⋂ i ∈ B, e i).Nonempty := by refine ⟨g (B.biUnion id), ?_⟩ - simp only [Set.mem_iInter, Set.mem_setOf_eq, e] + simp only [Set.mem_iInter, Set.mem_ofPred_eq, e] intro i hi exact ⟨_, subset_biUnion_of_mem id hi, by simp⟩ simpa using! CompactSpace.iInter_nonempty he' he'' diff --git a/Mathlib/Combinatorics/Configuration.lean b/Mathlib/Combinatorics/Configuration.lean index 051a7cb6b3de49..e4c0fa893c9bff 100644 --- a/Mathlib/Combinatorics/Configuration.lean +++ b/Mathlib/Combinatorics/Configuration.lean @@ -147,7 +147,7 @@ theorem Nondegenerate.exists_injective_of_card_le [Nondegenerate P L] [Fintype P -- At most one line through two points of `s` refine Finset.card_le_one_iff.mpr @fun p₁ p₂ hp₁ hp₂ => ?_ simp_rw [t, Finset.mem_compl, Finset.mem_biUnion, not_exists, not_and, - Set.mem_toFinset, Set.mem_setOf_eq, Classical.not_not] at hp₁ hp₂ + Set.mem_toFinset, Set.mem_ofPred_eq, Classical.not_not] at hp₁ hp₂ obtain ⟨l₁, l₂, hl₁, hl₂, hl₃⟩ := Finset.one_lt_card_iff.mp (Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hs₀, hs₁⟩) exact (eq_or_eq (hp₁ l₁ hl₁) (hp₂ l₁ hl₁) (hp₁ l₂ hl₂) (hp₂ l₂ hl₂)).resolve_right hl₃ diff --git a/Mathlib/Combinatorics/Derangements/Basic.lean b/Mathlib/Combinatorics/Derangements/Basic.lean index 87cad0b77a04a2..a9292b6d1b108a 100644 --- a/Mathlib/Combinatorics/Derangements/Basic.lean +++ b/Mathlib/Combinatorics/Derangements/Basic.lean @@ -39,8 +39,8 @@ def derangements (α : Type*) : Set (Perm α) := variable {α β : Type*} theorem mem_derangements_iff_fixedPoints_eq_empty {f : Perm α} : - f ∈ derangements α ↔ fixedPoints f = ∅ := - Set.eq_empty_iff_forall_notMem.symm + f ∈ derangements α ↔ fixedPoints f = ∅ := by + simp [derangements, Set.eq_empty_iff_forall_notMem, IsFixedPt] /-- If `α` is equivalent to `β`, then `derangements α` is equivalent to `derangements β`. -/ def Equiv.derangementsCongr (e : α ≃ β) : derangements α ≃ derangements β := diff --git a/Mathlib/Combinatorics/Enumerative/Composition.lean b/Mathlib/Combinatorics/Enumerative/Composition.lean index 831a6111194d90..5feed9b7452236 100644 --- a/Mathlib/Combinatorics/Enumerative/Composition.lean +++ b/Mathlib/Combinatorics/Enumerative/Composition.lean @@ -825,7 +825,7 @@ def compositionAsSetEquiv (n : ℕ) : CompositionAsSet n ≃ Finset (Fin (n - 1) left_inv := by intro c ext i - simp only [add_comm, Set.toFinset_setOf, Finset.mem_univ, + simp only [add_comm, Set.toFinset_ofPred, Finset.mem_univ, Finset.mem_filter, true_and, exists_prop] constructor · rintro (rfl | rfl | ⟨j, hj1, hj2⟩) @@ -843,7 +843,7 @@ def compositionAsSetEquiv (n : ℕ) : CompositionAsSet n ≃ Finset (Fin (n - 1) intro s ext i have : (i : ℕ) + 1 ≠ n := by lia - simp_rw [add_comm, Fin.ext_iff, Fin.val_zero, Fin.val_last, exists_prop, Set.toFinset_setOf, + simp_rw [add_comm, Fin.ext_iff, Fin.val_zero, Fin.val_last, exists_prop, Set.toFinset_ofPred, Finset.mem_filter_univ, reduceCtorEq, this, false_or, add_left_inj, ← Fin.ext_iff, exists_eq_right'] diff --git a/Mathlib/Combinatorics/Graph/Basic.lean b/Mathlib/Combinatorics/Graph/Basic.lean index e75384bf6f60d2..b122a382a375cd 100644 --- a/Mathlib/Combinatorics/Graph/Basic.lean +++ b/Mathlib/Combinatorics/Graph/Basic.lean @@ -143,9 +143,12 @@ lemma isLink_comm : G.IsLink e x y ↔ G.IsLink e y x := lemma exists_isLink_of_mem_edgeSet (h : e ∈ E(G)) : ∃ x y, G.IsLink e x y := (edge_mem_iff_exists_isLink ..).1 h -lemma edgeSet_eq_setOf_exists_isLink : E(G) = {e | ∃ x y, G.IsLink e x y} := +lemma edgeSet_eq_setOfPred_exists_isLink : E(G) = {e | ∃ x y, G.IsLink e x y} := Set.ext G.edge_mem_iff_exists_isLink +@[deprecated (since := "2026-07-09")] +alias edgeSet_eq_setOf_exists_isLink := edgeSet_eq_setOfPred_exists_isLink + lemma IsLink.left_eq_or_eq (h : G.IsLink e x y) (h' : G.IsLink e z w) : x = z ∨ x = w := G.eq_or_eq_of_isLink_of_isLink h h' @@ -357,7 +360,7 @@ protected lemma ext {G₁ G₂ : Graph α β} (hV : V(G₁) = V(G₂)) convert! rfl using 2 · exact hV.symm · simp [funext_iff, h] - simp [edgeSet_eq_setOf_exists_isLink, h] + simp [edgeSet_eq_setOfPred_exists_isLink, h] /-- Two graphs with the same vertex set and unary incidences are equal. -/ lemma ext_inc {G₁ G₂ : Graph α β} (hV : V(G₁) = V(G₂)) (h : ∀ e x, G₁.Inc e x ↔ G₂.Inc e x) : diff --git a/Mathlib/Combinatorics/Graph/Delete.lean b/Mathlib/Combinatorics/Graph/Delete.lean index a20fe657b79bcc..cec0ab58d13829 100644 --- a/Mathlib/Combinatorics/Graph/Delete.lean +++ b/Mathlib/Combinatorics/Graph/Delete.lean @@ -189,7 +189,7 @@ lemma deleteVerts_isLink (G : Graph α β) (X : Set α) : @[simp] lemma edgeSet_deleteVerts (G : Graph α β) (X : Set α) : E(G.deleteVerts X) = {e | ∃ x y, G.IsLink e x y ∧ x ∉ X ∧ y ∉ X} := by - simp [edgeSet_eq_setOf_exists_isLink] + simp [edgeSet_eq_setOfPred_exists_isLink] @[simp, grind =] lemma deleteVerts_empty (G : Graph α β) : G.deleteVerts (∅ : Set α) = G := by diff --git a/Mathlib/Combinatorics/Graph/Lattice.lean b/Mathlib/Combinatorics/Graph/Lattice.lean index 016505e1cfb08e..c4d5f0c3583888 100644 --- a/Mathlib/Combinatorics/Graph/Lattice.lean +++ b/Mathlib/Combinatorics/Graph/Lattice.lean @@ -47,7 +47,7 @@ instance : SemilatticeInf (Graph α β) where isLink_symm _ _ := { symm _ _ h := ⟨h.1.symm, h.2.symm⟩ } eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h h' := h.1.left_eq_or_eq h'.1 edge_mem_iff_exists_isLink e := by - simp only [edgeSet_eq_setOf_exists_isLink, mem_inter_iff, mem_setOf_eq] + simp only [edgeSet_eq_setOfPred_exists_isLink, mem_inter_iff, mem_ofPred_eq] exact ⟨fun ⟨⟨⟨x, y, hexy⟩, ⟨z, w, hezw⟩⟩, h⟩ ↦ ⟨x, y, hexy, by rwa [← h]⟩, fun ⟨x, y, hfG, hfH⟩ ↦ ⟨⟨⟨_, _, hfG⟩, ⟨_, _, hfH⟩⟩, fun z w ↦ by rw [hfG.isLink_iff_sym2_eq, hfH.isLink_iff_sym2_eq]⟩⟩ diff --git a/Mathlib/Combinatorics/Hindman.lean b/Mathlib/Combinatorics/Hindman.lean index 1faeeab5012304..9cc0794f68a895 100644 --- a/Mathlib/Combinatorics/Hindman.lean +++ b/Mathlib/Combinatorics/Hindman.lean @@ -83,43 +83,52 @@ theorem Ultrafilter.continuous_mul_left {M} [Mul M] (V : Ultrafilter M) : namespace Hindman +/-- `MemFS a m` means that `m` is the sum of a nonempty subsequence of `a`. We give a direct +inductive definition instead of talking about subsequences. See `FS` for the set version. -/ +inductive MemFS {M} [AddSemigroup M] : Stream' M → M → Prop + | head' (a : Stream' M) : MemFS a a.head + | tail' (a : Stream' M) (m : M) (h : MemFS a.tail m) : MemFS a m + | cons' (a : Stream' M) (m : M) (h : MemFS a.tail m) : MemFS a (a.head + m) + +/-- `MemFP a m` means that `m` is the product of a nonempty subsequence of `a`. We give a direct +inductive definition instead of talking about subsequences. See `FP` for the set version. -/ +@[to_additive MemFS] +inductive MemFP {M} [Semigroup M] : Stream' M → M → Prop + | head' (a : Stream' M) : MemFP a a.head + | tail' (a : Stream' M) (m : M) (h : MemFP a.tail m) : MemFP a m + | cons' (a : Stream' M) (m : M) (h : MemFP a.tail m) : MemFP a (a.head * m) + /-- `FS a` is the set of finite sums in `a`, i.e. `m ∈ FS a` if `m` is the sum of a nonempty -subsequence of `a`. We give a direct inductive definition instead of talking about subsequences. -/ -inductive FS {M} [AddSemigroup M] : Stream' M → Set M - | head' (a : Stream' M) : FS a a.head - | tail' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m - | cons' (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m) - -/-- `FP a` is the set of finite products in `a`, i.e. `m ∈ FP a` if `m` is the product of a nonempty -subsequence of `a`. We give a direct inductive definition instead of talking about subsequences. -/ -@[to_additive FS] -inductive FP {M} [Semigroup M] : Stream' M → Set M - | head' (a : Stream' M) : FP a a.head - | tail' (a : Stream' M) (m : M) (h : FP a.tail m) : FP a m - | cons' (a : Stream' M) (m : M) (h : FP a.tail m) : FP a (a.head * m) +subsequence of `a`. -/ +def FS {M} [AddSemigroup M] (a : Stream' M) : Set M := {m | MemFS a m} + +/-- `FP a` is the set of finite products in `a`, i.e. `m ∈ FP a` if `m` is the product of a +nonempty subsequence of `a`. -/ +@[to_additive existing FS] +def FP {M} [Semigroup M] (a : Stream' M) : Set M := {m | MemFP a m} section Aliases /-! Since the constructors for `FS` and `FP` cheat using the `Set M = M → Prop` defeq, we provide match patterns that preserve the defeq correctly in their type. -/ -variable {M} [Semigroup M] (a : Stream' M) (m : M) (h : FP a.tail m) +variable {M} [Semigroup M] (a : Stream' M) (m : M) (h : m ∈ FP a.tail) set_option linter.defProp false in /-- Constructor for `FP`. This is the preferred spelling over `FP.head'`. -/ @[to_additive (attr := match_pattern) /-- Constructor for `FS`. This is the preferred spelling over `FS.head'`. -/] -abbrev FP.head : a.head ∈ FP a := FP.head' a +abbrev FP.head : a.head ∈ FP a := MemFP.head' a set_option linter.defProp false in /-- Constructor for `FP`. This is the preferred spelling over `FP.tail'`. -/ @[to_additive (attr := match_pattern) /-- Constructor for `FS`. This is the preferred spelling over `FS.tail'`. -/] -abbrev FP.tail : m ∈ FP a := FP.tail' a m h +abbrev FP.tail : m ∈ FP a := MemFP.tail' a m h set_option linter.defProp false in /-- Constructor for `FP`. This is the preferred spelling over `FP.cons'`. -/ @[to_additive (attr := match_pattern) /-- Constructor for `FS`. This is the preferred spelling over `FS.cons'`. -/] -abbrev FP.cons : a.head * m ∈ FP a := FP.cons' a m h +abbrev FP.cons : a.head * m ∈ FP a := MemFP.cons' a m h end Aliases @@ -166,7 +175,7 @@ theorem exists_idempotent_ultrafilter_le_FP {M} [Semigroup M] (a : Stream' M) : · intro U hU V hV rw [Set.mem_iInter] at * intro n - rw [Set.mem_setOf_eq, Ultrafilter.eventually_mul] + rw [Set.mem_ofPred_eq, Ultrafilter.eventually_mul] filter_upwards [hU n] with m hm obtain ⟨n', hn⟩ := FP.mul hm filter_upwards [hV (n' + n)] with m' hm' diff --git a/Mathlib/Combinatorics/Matroid/Basic.lean b/Mathlib/Combinatorics/Matroid/Basic.lean index 00acd4dc34c9d2..c9a9318101e705 100644 --- a/Mathlib/Combinatorics/Matroid/Basic.lean +++ b/Mathlib/Combinatorics/Matroid/Basic.lean @@ -533,15 +533,21 @@ variable {B B' I J D X : Set α} {e f : α} theorem indep_iff : M.Indep I ↔ ∃ B, M.IsBase B ∧ I ⊆ B := M.indep_iff' (I := I) -theorem setOf_indep_eq (M : Matroid α) : {I | M.Indep I} = lowerClosure ({B | M.IsBase B}) := by - simp_rw [indep_iff, lowerClosure, LowerSet.coe_mk, mem_setOf] +theorem setOfPred_indep_eq (M : Matroid α) : {I | M.Indep I} = lowerClosure ({B | M.IsBase B}) := by + simp_rw [indep_iff, lowerClosure, LowerSet.coe_mk, mem_ofPred] + +@[deprecated (since := "2026-07-09")] +alias setOf_indep_eq := setOfPred_indep_eq theorem Indep.exists_isBase_superset (hI : M.Indep I) : ∃ B, M.IsBase B ∧ I ⊆ B := indep_iff.1 hI theorem dep_iff : M.Dep D ↔ ¬M.Indep D ∧ D ⊆ M.E := Iff.rfl -theorem setOf_dep_eq (M : Matroid α) : {D | M.Dep D} = {I | M.Indep I}ᶜ ∩ Iic M.E := rfl +theorem setOfPred_dep_eq (M : Matroid α) : {D | M.Dep D} = {I | M.Indep I}ᶜ ∩ Iic M.E := rfl + +@[deprecated (since := "2026-07-09")] +alias setOf_dep_eq := setOfPred_dep_eq @[aesop unsafe 30% (rule_sets := [Matroid])] theorem Indep.subset_ground (hI : M.Indep I) : I ⊆ M.E := by @@ -1036,13 +1042,16 @@ theorem IsBasis.isBasis_sUnion {Xs : Set (Set α)} (hne : Xs.Nonempty) have := Iff.mpr nonempty_coe_sort hne exact IsBasis.isBasis_iUnion _ fun X ↦ h X X.prop -theorem Indep.isBasis_setOf_insert_isBasis (hI : M.Indep I) : +theorem Indep.isBasis_setOfPred_insert_isBasis (hI : M.Indep I) : M.IsBasis I {x | M.IsBasis I (insert x I)} := by refine hI.isBasis_of_forall_insert (fun e he ↦ (?_ : M.IsBasis _ _)) (fun e he ↦ ⟨fun hu ↦ he.2 ?_, he.1.subset_ground⟩) · rw [insert_eq_of_mem he]; exact hI.isBasis_self simpa using (hu.eq_of_isBasis he.1).symm +@[deprecated (since := "2026-07-09")] +alias Indep.isBasis_setOf_insert_isBasis := Indep.isBasis_setOfPred_insert_isBasis + theorem IsBasis.union_isBasis_union (hIX : M.IsBasis I X) (hJY : M.IsBasis J Y) (h : M.Indep (I ∪ J)) : M.IsBasis (I ∪ J) (X ∪ Y) := by rw [union_eq_iUnion, union_eq_iUnion] @@ -1104,7 +1113,8 @@ end IsBasis section Finite /-- For finite `E`, finitely many matroids have ground set contained in `E`. -/ -theorem finite_setOf_matroid {E : Set α} (hE : E.Finite) : {M : Matroid α | M.E ⊆ E}.Finite := by +theorem finite_setOfPred_matroid {E : Set α} (hE : E.Finite) : + {M : Matroid α | M.E ⊆ E}.Finite := by set f : Matroid α → Set α × (Set (Set α)) := fun M ↦ ⟨M.E, {B | M.IsBase B}⟩ have hf : f.Injective := by refine fun M M' hMM' ↦ ?_ @@ -1113,12 +1123,15 @@ theorem finite_setOf_matroid {E : Set α} (hE : E.Finite) : {M : Matroid α | M. rw [← Set.finite_image_iff hf.injOn] refine (hE.finite_subsets.prod hE.finite_subsets.finite_subsets).subset ?_ rintro _ ⟨M, hE : M.E ⊆ E, rfl⟩ - simp only [Set.mem_prod, Set.mem_setOf_eq] + simp only [Set.mem_prod, Set.mem_ofPred_eq] exact ⟨hE, fun B hB ↦ hB.subset_ground.trans hE⟩ +@[deprecated (since := "2026-07-09")] +alias finite_setOf_matroid := finite_setOfPred_matroid + /-- For finite `E`, finitely many matroids have ground set `E`. -/ theorem finite_setOf_matroid' {E : Set α} (hE : E.Finite) : {M : Matroid α | M.E = E}.Finite := - (finite_setOf_matroid hE).subset (fun M ↦ by rintro rfl; exact subset_refl M.E) + (finite_setOfPred_matroid hE).subset (fun M ↦ by rintro rfl; exact subset_refl M.E) end Finite diff --git a/Mathlib/Combinatorics/Matroid/Circuit.lean b/Mathlib/Combinatorics/Matroid/Circuit.lean index 777fe4b0b8a8c4..8cf4d6112a265c 100644 --- a/Mathlib/Combinatorics/Matroid/Circuit.lean +++ b/Mathlib/Combinatorics/Matroid/Circuit.lean @@ -107,7 +107,7 @@ lemma isCircuit_iff_forall_ssubset : M.IsCircuit C ↔ M.Dep C ∧ ∀ ⦃I⦄, exact fun h ↦ ⟨fun h' I hIC ↦ ((not_dep_iff (hIC.subset.trans h.subset_ground)).1 (h' hIC)), fun h I hIC ↦ (h hIC).not_dep⟩ -lemma isCircuit_antichain : IsAntichain (· ⊆ ·) (setOf M.IsCircuit) := +lemma isCircuit_antichain : IsAntichain (· ⊆ ·) (Set.ofPred M.IsCircuit) := fun _ hC _ hC' hne hss ↦ hne <| (IsCircuit.minimal hC').eq_of_subset hC.dep hss lemma IsCircuit.eq_of_not_indep_subset (hC : M.IsCircuit C) (hX : ¬ M.Indep X) (hXC : X ⊆ C) : @@ -256,7 +256,7 @@ lemma Indep.fundCircuit_isCircuit (hI : M.Indep I) (hecl : e ∈ M.closure I) (h · simp [show ∃ x ⊆ I, e ∈ M.closure x ∧ e ∉ x from ⟨I, by simp [hecl, heI]⟩] · rw [hI.closure_sInter_eq_biInter_closure_of_forall_subset ⟨I, by simpa⟩ (by simp +contextual)] simp - simp only [mem_sInter, mem_setOf_eq, and_imp] + simp only [mem_sInter, mem_ofPred_eq, and_imp] exact fun f hf hecl ↦ (hf _ (sdiff_subset.trans aux) hecl).2 rfl lemma Indep.mem_fundCircuit_iff (hI : M.Indep I) (hecl : e ∈ M.closure I) (heI : e ∉ I) : diff --git a/Mathlib/Combinatorics/Matroid/Closure.lean b/Mathlib/Combinatorics/Matroid/Closure.lean index ec24aa323ed492..56ac00514e01a0 100644 --- a/Mathlib/Combinatorics/Matroid/Closure.lean +++ b/Mathlib/Combinatorics/Matroid/Closure.lean @@ -167,11 +167,11 @@ lemma inter_ground_subset_closure (M : Matroid α) (X : Set α) : X ∩ M.E ⊆ lemma mem_closure_iff_forall_mem_isFlat (X : Set α) (hX : X ⊆ M.E := by aesop_mat) : e ∈ M.closure X ↔ ∀ F, M.IsFlat F → X ⊆ F → e ∈ F := by - simp_rw [M.closure_def' X, mem_sInter, mem_setOf, and_imp] + simp_rw [M.closure_def' X, mem_sInter, mem_ofPred, and_imp] lemma subset_closure_iff_forall_subset_isFlat (X : Set α) (hX : X ⊆ M.E := by aesop_mat) : Y ⊆ M.closure X ↔ ∀ F, M.IsFlat F → X ⊆ F → Y ⊆ F := by - simp_rw [M.closure_def' X, subset_sInter_iff, mem_setOf, and_imp] + simp_rw [M.closure_def' X, subset_sInter_iff, mem_ofPred, and_imp] lemma subset_closure (M : Matroid α) (X : Set α) (hX : X ⊆ M.E := by aesop_mat) : X ⊆ M.closure X := by @@ -317,10 +317,10 @@ section Indep variable {ι : Sort*} {I J B : Set α} {x : α} -lemma Indep.closure_eq_setOf_isBasis_insert (hI : M.Indep I) : +lemma Indep.closure_eq_setOfPred_isBasis_insert (hI : M.Indep I) : M.closure I = {x | M.IsBasis I (insert x I)} := by set F := {x | M.IsBasis I (insert x I)} - have hIF : M.IsBasis I F := hI.isBasis_setOf_insert_isBasis + have hIF : M.IsBasis I F := hI.isBasis_setOfPred_insert_isBasis have hF : M.IsFlat F := by refine ⟨fun J X hJF hJX e heX ↦ show M.IsBasis _ _ from ?_, hIF.subset_ground⟩ exact (hIF.isBasis_of_isBasis_of_subset_of_subset (hJX.isBasis_union hJF) hJF.subset @@ -333,16 +333,19 @@ lemma Indep.closure_eq_setOf_isBasis_insert (hI : M.Indep I) : exact (hF'.1 hJ (he.isBasis_union_of_subset hJ.indep hIJ)) (Or.inr (mem_insert _ _)) exact ⟨hF, inter_subset_left.trans hIF.subset⟩ +@[deprecated (since := "2026-07-09")] +alias Indep.closure_eq_setOf_isBasis_insert := Indep.closure_eq_setOfPred_isBasis_insert + lemma Indep.insert_isBasis_iff_mem_closure (hI : M.Indep I) : M.IsBasis I (insert e I) ↔ e ∈ M.closure I := by - rw [hI.closure_eq_setOf_isBasis_insert, mem_setOf] + rw [hI.closure_eq_setOfPred_isBasis_insert, mem_ofPred] lemma Indep.isBasis_closure (hI : M.Indep I) : M.IsBasis I (M.closure I) := by - rw [hI.closure_eq_setOf_isBasis_insert]; exact hI.isBasis_setOf_insert_isBasis + rw [hI.closure_eq_setOfPred_isBasis_insert]; exact hI.isBasis_setOfPred_insert_isBasis lemma IsBasis.closure_eq_closure (h : M.IsBasis I X) : M.closure I = M.closure X := by refine subset_antisymm (M.closure_subset_closure h.subset) ?_ - rw [← M.closure_closure I, h.indep.closure_eq_setOf_isBasis_insert] + rw [← M.closure_closure I, h.indep.closure_eq_setOfPred_isBasis_insert] exact M.closure_subset_closure fun e he ↦ (h.isBasis_subset (subset_insert _ _) (insert_subset he h.subset)) @@ -363,7 +366,7 @@ lemma IsBasis.isBasis_closure_right (h : M.IsBasis I X) : M.IsBasis I (M.closure lemma Indep.mem_closure_iff (hI : M.Indep I) : x ∈ M.closure I ↔ M.Dep (insert x I) ∨ x ∈ I := by - rwa [hI.closure_eq_setOf_isBasis_insert, mem_setOf, isBasis_insert_iff] + rwa [hI.closure_eq_setOfPred_isBasis_insert, mem_ofPred, isBasis_insert_iff] lemma Indep.mem_closure_iff' (hI : M.Indep I) : x ∈ M.closure I ↔ x ∈ M.E ∧ (M.Indep (insert x I) → x ∈ I) := by diff --git a/Mathlib/Combinatorics/Matroid/Dual.lean b/Mathlib/Combinatorics/Matroid/Dual.lean index 00b03e6b085eda..712df49aec0139 100644 --- a/Mathlib/Combinatorics/Matroid/Dual.lean +++ b/Mathlib/Combinatorics/Matroid/Dual.lean @@ -142,13 +142,15 @@ theorem dual_isBase_iff' : M✶.IsBase B ↔ M.IsBase (M.E \ B) ∧ B ⊆ M.E := (em (B ⊆ M.E)).elim (fun h ↦ by rw [dual_isBase_iff, and_iff_left h]) (fun h ↦ iff_of_false (h ∘ (fun h' ↦ h'.subset_ground)) (h ∘ And.right)) -theorem setOf_dual_isBase_eq : {B | M✶.IsBase B} = (fun X ↦ M.E \ X) '' {B | M.IsBase B} := by +theorem setOfPred_dual_isBase_eq : {B | M✶.IsBase B} = (fun X ↦ M.E \ X) '' {B | M.IsBase B} := by ext B - simp only [mem_setOf_eq, mem_image, dual_isBase_iff'] + simp only [mem_ofPred_eq, mem_image, dual_isBase_iff'] refine ⟨fun h ↦ ⟨_, h.1, sdiff_sdiff_cancel_left h.2⟩, fun ⟨B', hB', h⟩ ↦ ⟨?_,h.symm.trans_subset sdiff_subset⟩⟩ rwa [← h, sdiff_sdiff_cancel_left hB'.subset_ground] +@[deprecated (since := "2026-07-09")] alias setOf_dual_isBase_eq := setOfPred_dual_isBase_eq + @[simp] theorem dual_dual (M : Matroid α) : M✶✶ = M := ext_isBase rfl (fun B (h : B ⊆ M.E) ↦ by rw [dual_isBase_iff, dual_isBase_iff, dual_ground, sdiff_sdiff_cancel_left h]) diff --git a/Mathlib/Combinatorics/Matroid/Loop.lean b/Mathlib/Combinatorics/Matroid/Loop.lean index b77c09817dc236..40f1cb229eabb8 100644 --- a/Mathlib/Combinatorics/Matroid/Loop.lean +++ b/Mathlib/Combinatorics/Matroid/Loop.lean @@ -301,9 +301,12 @@ lemma not_isNonloop_iff (he : e ∈ M.E := by aesop_mat) : ¬M.IsNonloop e ↔ M lemma isNonloop_iff_mem_compl_loops : M.IsNonloop e ↔ e ∈ M.E \ M.loops := by rw [isNonloop_iff, IsLoop, and_comm, mem_sdiff] -lemma setOf_isNonloop_eq (M : Matroid α) : {e | M.IsNonloop e} = M.E \ M.loops := +lemma setOfPred_isNonloop_eq (M : Matroid α) : {e | M.IsNonloop e} = M.E \ M.loops := Set.ext (fun _ ↦ isNonloop_iff_mem_compl_loops) +@[deprecated (since := "2026-07-09")] +alias setOf_isNonloop_eq := setOfPred_isNonloop_eq + lemma not_isNonloop_iff_closure : ¬ M.IsNonloop e ↔ M.closure {e} = M.loops := by by_cases he : e ∈ M.E · simp [isLoop_iff_closure_eq_loops_and_mem_ground, he] @@ -446,9 +449,12 @@ lemma IsNonloop.exists_mem_isCocircuit (he : M.IsNonloop e) : ∃ K, M.IsCocircu exact ⟨_, fundCocircuit_isCocircuit heB hB, mem_fundCocircuit M e B⟩ @[simp] -lemma closure_inter_setOf_isNonloop_eq (M : Matroid α) (X : Set α) : +lemma closure_inter_setOfPred_isNonloop_eq (M : Matroid α) (X : Set α) : M.closure (X ∩ {e | M.IsNonloop e}) = M.closure X := by - rw [setOf_isNonloop_eq, ← inter_sdiff_assoc, closure_sdiff_loops_eq, closure_inter_ground] + rw [setOfPred_isNonloop_eq, ← inter_sdiff_assoc, closure_sdiff_loops_eq, closure_inter_ground] + +@[deprecated (since := "2026-07-09")] +alias closure_inter_setOf_isNonloop_eq := closure_inter_setOfPred_isNonloop_eq end IsNonloop @@ -866,7 +872,7 @@ lemma removeLoops_isBasis'_eq : M.removeLoops.IsBasis' = M.IsBasis' := by @[simp] lemma removeLoops_isNonloop_eq : M.removeLoops.IsNonloop = M.IsNonloop := by ext e - rw [removeLoops_eq_restrict, restrict_isNonloop_iff, mem_setOf, and_self] + rw [removeLoops_eq_restrict, restrict_isNonloop_iff, mem_ofPred, and_self] lemma IsNonloop.removeLoops_isNonloop (he : M.IsNonloop e) : M.removeLoops.IsNonloop e := by simpa diff --git a/Mathlib/Combinatorics/Matroid/Minor/Restrict.lean b/Mathlib/Combinatorics/Matroid/Minor/Restrict.lean index e733e8132f366e..6c3bce215c36ee 100644 --- a/Mathlib/Combinatorics/Matroid/Minor/Restrict.lean +++ b/Mathlib/Combinatorics/Matroid/Minor/Restrict.lean @@ -351,10 +351,13 @@ theorem IsRestriction.finitary {M : Matroid α} [Finitary M] (h : N ≤r M) : N. obtain ⟨R, -, rfl⟩ := h infer_instance -theorem finite_setOf_isRestriction (M : Matroid α) [M.Finite] : {N | N ≤r M}.Finite := +theorem finite_setOfPred_isRestriction (M : Matroid α) [M.Finite] : {N | N ≤r M}.Finite := (M.ground_finite.finite_subsets.image (fun R ↦ M ↾ R)).subset <| by rintro _ ⟨R, hR, rfl⟩; exact ⟨_, hR, rfl⟩ +@[deprecated (since := "2026-07-09")] +alias finite_setOf_isRestriction := finite_setOfPred_isRestriction + theorem Indep.of_isRestriction (hI : N.Indep I) (hNM : N ≤r M) : M.Indep I := by obtain ⟨R, -, rfl⟩ := hNM; exact hI.of_restrict diff --git a/Mathlib/Combinatorics/Quiver/Path/Vertices.lean b/Mathlib/Combinatorics/Quiver/Path/Vertices.lean index 16128af67e2017..9c74b8a36d528e 100644 --- a/Mathlib/Combinatorics/Quiver/Path/Vertices.lean +++ b/Mathlib/Combinatorics/Quiver/Path/Vertices.lean @@ -52,7 +52,7 @@ lemma mem_vertices_cons {a b c : V} (p : Path a b) lemma verticesSet_nil {a : V} : {v | v ∈ (nil : Path a a).vertices} = {a} := by simp only [vertices_nil, mem_singleton, Set.ext_iff, Set.mem_singleton_iff] - exact fun x ↦ Set.mem_setOf + exact fun x ↦ Set.mem_ofPred /-- The length of vertices list equals path length plus one -/ @[simp] diff --git a/Mathlib/Combinatorics/Schnirelmann.lean b/Mathlib/Combinatorics/Schnirelmann.lean index 46773c1f916759..3cc8328cb4a830 100644 --- a/Mathlib/Combinatorics/Schnirelmann.lean +++ b/Mathlib/Combinatorics/Schnirelmann.lean @@ -214,18 +214,24 @@ lemma schnirelmannDensity_finite {A : Set ℕ} [DecidablePred (· ∈ A)] (hA : @[simp] lemma schnirelmannDensity_univ : schnirelmannDensity Set.univ = 1 := (schnirelmannDensity_eq_one_iff_of_zero_mem (by simp)).2 (by simp) -lemma schnirelmannDensity_setOf_even : schnirelmannDensity (setOf Even) = 0 := +lemma schnirelmannDensity_setOfPred_even : schnirelmannDensity (Set.ofPred Even) = 0 := schnirelmannDensity_eq_zero_of_one_notMem <| by simp -lemma schnirelmannDensity_setOf_prime : schnirelmannDensity (setOf Nat.Prime) = 0 := +@[deprecated (since := "2026-07-09")] +alias schnirelmannDensity_setOf_even := schnirelmannDensity_setOfPred_even + +lemma schnirelmannDensity_setOfPred_prime : schnirelmannDensity (Set.ofPred Nat.Prime) = 0 := schnirelmannDensity_eq_zero_of_one_notMem <| by simp [Nat.not_prime_one] +@[deprecated (since := "2026-07-09")] +alias schnirelmannDensity_setOf_prime := schnirelmannDensity_setOfPred_prime + /-- The Schnirelmann density of the set of naturals which are `1 mod m` is `m⁻¹`, for any `m ≠ 1`. Note that if `m = 1`, this set is empty. -/ -lemma schnirelmannDensity_setOf_mod_eq_one {m : ℕ} (hm : m ≠ 1) : +lemma schnirelmannDensity_setOfPred_mod_eq_one {m : ℕ} (hm : m ≠ 1) : schnirelmannDensity {n | n % m = 1} = (m⁻¹ : ℝ) := by rcases m.eq_zero_or_pos with rfl | hm' · simp only [Nat.cast_zero, inv_zero] @@ -234,7 +240,7 @@ lemma schnirelmannDensity_setOf_mod_eq_one {m : ℕ} (hm : m ≠ 1) : apply le_antisymm (schnirelmannDensity_le_of_le m hm'.ne' _) _ · rw [← one_div, ← @Nat.cast_one ℝ] gcongr - simp only [Set.mem_setOf_eq, card_le_one_iff_subset_singleton, subset_iff, + simp only [Set.mem_ofPred_eq, card_le_one_iff_subset_singleton, subset_iff, mem_filter, mem_Ioc, mem_singleton, and_imp] use 1 intro x _ hxm h @@ -243,7 +249,7 @@ lemma schnirelmannDensity_setOf_mod_eq_one {m : ℕ} (hm : m ≠ 1) : rwa [Nat.mod_eq_of_lt hxm'] at h rw [le_schnirelmannDensity_iff] intro n hn - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] have : (Icc 0 ((n - 1) / m)).image (· * m + 1) ⊆ {x ∈ Ioc 0 n | x % m = 1} := by simp only [subset_iff, mem_image, forall_exists_index, mem_filter, mem_Ioc, mem_Icc, and_imp] rintro _ y _ hy' rfl @@ -260,17 +266,26 @@ lemma schnirelmannDensity_setOf_mod_eq_one {m : ℕ} (hm : m ≠ 1) : intro a b simp [hm'.ne'] -lemma schnirelmannDensity_setOf_modeq_one {m : ℕ} : +@[deprecated (since := "2026-07-09")] +alias schnirelmannDensity_setOf_mod_eq_one := schnirelmannDensity_setOfPred_mod_eq_one + +lemma schnirelmannDensity_setOfPred_modeq_one {m : ℕ} : schnirelmannDensity {n | n ≡ 1 [MOD m]} = (m⁻¹ : ℝ) := by rcases eq_or_ne m 1 with rfl | hm · simp [Nat.modEq_one] - rw [← schnirelmannDensity_setOf_mod_eq_one hm] + rw [← schnirelmannDensity_setOfPred_mod_eq_one hm] simp [Nat.ModEq, Nat.one_mod_eq_one.mpr hm] -lemma schnirelmannDensity_setOf_Odd : schnirelmannDensity (setOf Odd) = 2⁻¹ := by - have h : setOf Odd = {n | n % 2 = 1} := Set.ext fun _ => Nat.odd_iff +@[deprecated (since := "2026-07-09")] +alias schnirelmannDensity_setOf_modeq_one := schnirelmannDensity_setOfPred_modeq_one + +lemma schnirelmannDensity_setOfPred_Odd : schnirelmannDensity (Set.ofPred Odd) = 2⁻¹ := by + have h : Set.ofPred Odd = {n | n % 2 = 1} := Set.ext fun _ => Nat.odd_iff simp only [h] - rw [schnirelmannDensity_setOf_mod_eq_one (by norm_num1), Nat.cast_two] + rw [schnirelmannDensity_setOfPred_mod_eq_one (by norm_num1), Nat.cast_two] + +@[deprecated (since := "2026-07-09")] +alias schnirelmannDensity_setOf_Odd := schnirelmannDensity_setOfPred_Odd open scoped Pointwise diff --git a/Mathlib/Combinatorics/SetFamily/Shatter.lean b/Mathlib/Combinatorics/SetFamily/Shatter.lean index ddfc1fc015a6ea..28620ab66940e5 100644 --- a/Mathlib/Combinatorics/SetFamily/Shatter.lean +++ b/Mathlib/Combinatorics/SetFamily/Shatter.lean @@ -120,7 +120,7 @@ lemma card_le_card_shatterer (𝒜 : Finset (Finset α)) : #𝒜 ≤ #𝒜.shatt ((memberSubfamily a 𝒜).shatterer ∩ (nonMemberSubfamily a 𝒜).shatterer).image (insert a) have hℬ : #ℬ = #((memberSubfamily a 𝒜).shatterer ∩ (nonMemberSubfamily a 𝒜).shatterer) := by refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ - simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, + simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_ofPred_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] diff --git a/Mathlib/Combinatorics/SimpleGraph/Basic.lean b/Mathlib/Combinatorics/SimpleGraph/Basic.lean index 10e5a526660762..582579585b38a3 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Basic.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Basic.lean @@ -512,7 +512,10 @@ theorem edgeSet_subset_compl_diagSet : G.edgeSet ⊆ Sym2.diagSetᶜ := by simpa [Set.subset_compl_iff_disjoint_left, edgeSet, edgeSetEmbedding] using G.loopless @[deprecated (since := "2025-12-10")] -alias edgeSet_subset_setOf_not_isDiag := edgeSet_subset_compl_diagSet +alias edgeSet_subset_ofPred_not_isDiag := edgeSet_subset_compl_diagSet + +@[deprecated (since := "2026-07-03")] alias edgeSet_subset_setOf_not_isDiag := + edgeSet_subset_ofPred_not_isDiag @[simp] theorem edgeSet_sup : (G₁ ⊔ G₂).edgeSet = G₁.edgeSet ∪ G₂.edgeSet := by diff --git a/Mathlib/Combinatorics/SimpleGraph/Bipartite.lean b/Mathlib/Combinatorics/SimpleGraph/Bipartite.lean index db6aebddef53e0..8e9fc31b68d3c2 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Bipartite.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Bipartite.lean @@ -106,7 +106,7 @@ theorem IsBipartiteWith.mem_of_mem_adj theorem isBipartiteWith_neighborSet (h : G.IsBipartiteWith s t) (hv : v ∈ s) : G.neighborSet v = { w ∈ t | G.Adj v w } := by ext w - rw [mem_neighborSet, Set.mem_setOf_eq, iff_and_self] + rw [mem_neighborSet, Set.mem_ofPred_eq, iff_and_self] exact h.mem_of_mem_adj hv /-- If `G.IsBipartiteWith s t` and `v ∈ s`, then the neighbor set of `v` is a subset of `t`. -/ @@ -132,7 +132,7 @@ theorem IsBipartiteWith.mem_of_mem_adj' theorem isBipartiteWith_neighborSet' (h : G.IsBipartiteWith s t) (hw : w ∈ t) : G.neighborSet w = { v ∈ s | G.Adj v w } := by ext v - rw [mem_neighborSet, adj_comm, Set.mem_setOf_eq, iff_and_self] + rw [mem_neighborSet, adj_comm, Set.mem_ofPred_eq, iff_and_self] exact h.mem_of_mem_adj' hw /-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor set of `w` is a subset of `s`. -/ @@ -292,7 +292,7 @@ lemma IsBipartite.exists_isBipartiteWith (h : G.IsBipartite) : ∃ s t, G.IsBipa refine ⟨{v | c v = 0}, {v | c v = 1}, by aesop (add simp [Set.disjoint_left]), ?_⟩ rintro v w hvw apply hc at hvw - simp [Set.mem_setOf_eq] at hvw ⊢ + simp [Set.mem_ofPred_eq] at hvw ⊢ lia /-- If a simple graph `G` has a bipartition, then it is bipartite. -/ @@ -416,7 +416,7 @@ in `G`. -/ lemma neighborSet_subset_between_union (hv : v ∈ s) : G.neighborSet v ⊆ (G.between s sᶜ).neighborSet v ∪ s := by intro w hadj - rw [neighborSet, Set.mem_union, Set.mem_setOf, between_adj] + rw [neighborSet, Set.mem_union, Set.mem_ofPred, between_adj] by_cases hw : w ∈ s · exact Or.inr hw · exact Or.inl ⟨hadj, Or.inl ⟨hv, hw⟩⟩ @@ -426,7 +426,7 @@ in `G`. -/ lemma neighborSet_subset_between_union_compl (hw : w ∈ sᶜ) : G.neighborSet w ⊆ (G.between s sᶜ).neighborSet w ∪ sᶜ := by intro v hadj - rw [neighborSet, Set.mem_union, Set.mem_setOf, between_adj] + rw [neighborSet, Set.mem_union, Set.mem_ofPred, between_adj] by_cases hv : v ∈ s · exact Or.inl ⟨hadj, Or.inr ⟨hw, hv⟩⟩ · exact Or.inr hv diff --git a/Mathlib/Combinatorics/SimpleGraph/Coloring/EdgeLabeling.lean b/Mathlib/Combinatorics/SimpleGraph/Coloring/EdgeLabeling.lean index 0be490abb605b8..4f0e21ad25acdb 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Coloring/EdgeLabeling.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Coloring/EdgeLabeling.lean @@ -141,7 +141,7 @@ def labelGraph (C : EdgeLabeling G K) (k : K) : SimpleGraph V := theorem labelGraph_adj {C : EdgeLabeling G K} {k : K} (x y : V) : (C.labelGraph k).Adj x y ↔ ∃ H : G.Adj x y, C ⟨s(x, y), H⟩ = k := by rw [EdgeLabeling.labelGraph] - simp only [mem_edgeSet, fromEdgeSet_adj, Set.mem_setOf_eq, Ne.eq_def] + simp only [mem_edgeSet, fromEdgeSet_adj, Set.mem_ofPred_eq, Ne.eq_def] grind [Adj.ne] instance [DecidableRel G.Adj] [DecidableEq K] (k : K) {C : EdgeLabeling G K} : diff --git a/Mathlib/Combinatorics/SimpleGraph/Coloring/Vertex.lean b/Mathlib/Combinatorics/SimpleGraph/Coloring/Vertex.lean index 02d84e2d92cf0f..649280b8e6034b 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Coloring/Vertex.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Coloring/Vertex.lean @@ -216,7 +216,7 @@ variable (G) in This is `⊤` (infinity) iff `G` isn't colorable with finitely many colors. If `G` is colorable, then `ENat.toNat G.chromaticNumber` is the `ℕ`-valued chromatic number. -/ -noncomputable def chromaticNumber : ℕ∞ := ⨅ n ∈ setOf G.Colorable, (n : ℕ∞) +noncomputable def chromaticNumber : ℕ∞ := ⨅ n ∈ Set.ofPred G.Colorable, (n : ℕ∞) lemma le_chromaticNumber_iff_colorable : n ≤ G.chromaticNumber ↔ ∀ m, G.Colorable m → n ≤ m := by simp [chromaticNumber] @@ -230,7 +230,7 @@ lemma le_chromaticNumber_of_pairwise_adj (hn : n ≤ Nat.card ι) (f : ι → V) le_chromaticNumber_iff_colorable.2 fun _m hm ↦ hn.trans <| hm.card_le_of_pairwise_adj f hf variable (G) in -lemma chromaticNumber_eq_biInf : G.chromaticNumber = ⨅ n ∈ setOf G.Colorable, (n : ℕ∞) := rfl +lemma chromaticNumber_eq_biInf : G.chromaticNumber = ⨅ n ∈ Set.ofPred G.Colorable, (n : ℕ∞) := rfl variable (G) in lemma chromaticNumber_eq_iInf : G.chromaticNumber = ⨅ n : {m | G.Colorable m}, (n : ℕ∞) := by @@ -343,7 +343,7 @@ theorem chromaticNumber_le_iff_colorable {n : ℕ} : G.chromaticNumber ≤ n ↔ obtain ⟨m, hm⟩ := this rw [hm.chromaticNumber_eq_sInf, Nat.cast_le] at h have := Nat.sInf_mem (⟨m, hm⟩ : {n' | G.Colorable n'}.Nonempty) - rw [Set.mem_setOf_eq] at this + rw [Set.mem_ofPred_eq] at this exact this.mono h /-- If the chromatic number of `G` is `n + 1`, then `G` is colorable in no fewer than `n + 1` @@ -400,7 +400,7 @@ theorem chromaticNumber_le_of_forall_imp {V' : Type*} {G' : SimpleGraph V'} (h : ∀ n, G'.Colorable n → G.Colorable n) : G.chromaticNumber ≤ G'.chromaticNumber := by rw [chromaticNumber, chromaticNumber] - simp only [Set.mem_setOf_eq, le_iInf_iff] + simp only [Set.mem_ofPred_eq, le_iInf_iff] intro m hc have := h _ hc rw [← chromaticNumber_le_iff_colorable] at this @@ -424,7 +424,7 @@ lemma card_le_chromaticNumber_iff_forall_surjective [Fintype α] : classical exact Nat.notMem_of_lt_sInf ((Nat.sub_one_lt_of_lt <| card_pos_iff.2 ⟨i⟩).trans_le h) ⟨G.recolorOfEquiv (equivOfCardEq <| by simp) D⟩ - · simp only [chromaticNumber, Set.mem_setOf_eq, le_iInf_iff, Nat.cast_le] + · simp only [chromaticNumber, Set.mem_ofPred_eq, le_iInf_iff, Nat.cast_le] rintro i ⟨C⟩ contrapose! h refine ⟨G.recolorOfCardLE (by simpa using h.le) C, fun hC ↦ ?_⟩ diff --git a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean index d0cabb0db4a0e8..0727fb2eeea0ed 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean @@ -552,7 +552,7 @@ def supp (C : G.ConnectedComponent) := theorem supp_injective : Function.Injective (ConnectedComponent.supp : G.ConnectedComponent → Set V) := by refine ConnectedComponent.ind₂ ?_ - simp only [ConnectedComponent.supp, Set.ext_iff, ConnectedComponent.eq, Set.mem_setOf_eq] + simp only [ConnectedComponent.supp, Set.ext_iff, ConnectedComponent.eq, Set.mem_ofPred_eq] intro v w h rw [reachable_comm, h] diff --git a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Finite.lean b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Finite.lean index 0c265c4bdd44f5..eac6c3862c3e31 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Finite.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Finite.lean @@ -96,7 +96,7 @@ lemma ConnectedComponent.odd_oddComponents_ncard_subset_supp [Finite V] {G'} rw [Finset.odd_sum_iff_odd_card_odd, Nat.card_eq_fintype_card, Fintype.card_ofFinset] congr! 2 ext c - simp_rw [Set.toFinset_setOf, mem_filter, ← Set.ncard_coe_finset, coe_filter, + simp_rw [Set.toFinset_ofPred, mem_filter, ← Set.ncard_coe_finset, coe_filter, mem_supp_iff, mem_univ, true_and, supp, and_comm] lemma odd_ncard_oddComponents [Finite V] : Odd G.oddComponents.ncard ↔ Odd (Nat.card V) := by diff --git a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean index 5d25f8c3a90171..79defaff9ded7c 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Subgraph.lean @@ -364,7 +364,8 @@ theorem map_mapToSubgraph_eq_induce (s : Set V) {u v : V} : to its support. -/ theorem map_mapToSubgraph_eq_induce_id {u v : V} (w : G.Walk u v) : w.mapToSubgraph.map (⟨fun v ↦ ⟨v, w.mem_verts_toSubgraph.mp v.prop⟩, w.toSubgraph.adj_sub⟩ : - w.toSubgraph.coe →g G.induce _) = w.induce _ (fun _ ↦ id) := + w.toSubgraph.coe →g G.induce {x | x ∈ w.support}) = + w.induce {x | x ∈ w.support} (fun _ ↦ id) := w.map_mapToSubgraph_eq_induce .. theorem isInduced_toSubgraph {w : G.Walk u v} : w.toSubgraph.IsInduced ↔ w.IsChordless := by @@ -399,8 +400,8 @@ lemma neighborSet_toSubgraph_internal {u} {i : ℕ} {p : G.Walk u v} (hp : p.IsP Prod.swap_prod_mk] refine ⟨?_, by aesop⟩ rintro ⟨i', ⟨hl, _⟩ | ⟨_, hl⟩⟩ <;> - apply hp.getVert_injOn (by rw [Set.mem_setOf_eq]; lia) - (by rw [Set.mem_setOf_eq]; lia) at hl <;> aesop + apply hp.getVert_injOn (by rw [Set.mem_ofPred_eq]; lia) + (by rw [Set.mem_ofPred_eq]; lia) at hl <;> aesop lemma ncard_neighborSet_toSubgraph_internal_eq_two {u} {i : ℕ} {p : G.Walk u v} (hp : p.IsPath) (h : i ≠ 0) (h' : i < p.length) : @@ -408,7 +409,7 @@ lemma ncard_neighborSet_toSubgraph_internal_eq_two {u} {i : ℕ} {p : G.Walk u v rw [hp.neighborSet_toSubgraph_internal h h'] have : p.getVert (i - 1) ≠ p.getVert (i + 1) := by intro h - have := hp.getVert_injOn (by rw [Set.mem_setOf_eq]; lia) (by rw [Set.mem_setOf_eq]; lia) h + have := hp.getVert_injOn (by rw [Set.mem_ofPred_eq]; lia) (by rw [Set.mem_ofPred_eq]; lia) h lia simp_all @@ -418,11 +419,11 @@ lemma snd_of_toSubgraph_adj {u v v'} {p : G.Walk u v} (hp : p.IsPath) simp only [Sym2.eq, Sym2.rel_iff', Prod.mk.injEq, Prod.swap_prod_mk] at hi rcases hi.1 with ⟨hl1, rfl⟩ | ⟨hr1, hr2⟩ · have : i = 0 := by - apply hp.getVert_injOn (by rw [Set.mem_setOf]; lia) (by rw [Set.mem_setOf]; lia) + apply hp.getVert_injOn (by rw [Set.mem_ofPred]; lia) (by rw [Set.mem_ofPred]; lia) rw [p.getVert_zero, hl1] simp [this] · have : i + 1 = 0 := by - apply hp.getVert_injOn (by rw [Set.mem_setOf]; lia) (by rw [Set.mem_setOf]; lia) + apply hp.getVert_injOn (by rw [Set.mem_ofPred]; lia) (by rw [Set.mem_ofPred]; lia) rw [p.getVert_zero, hr2] contradiction @@ -449,11 +450,11 @@ lemma neighborSet_toSubgraph_internal {u} {i : ℕ} {p : G.Walk u u} (hpc : p.Is Prod.swap_prod_mk] refine ⟨?_, by aesop⟩ rintro ⟨i', ⟨hl1, hl2⟩ | ⟨hr1, hr2⟩⟩ - · apply hpc.getVert_injOn' (by rw [Set.mem_setOf_eq]; lia) - (by rw [Set.mem_setOf_eq]; lia) at hl1 + · apply hpc.getVert_injOn' (by rw [Set.mem_ofPred_eq]; lia) + (by rw [Set.mem_ofPred_eq]; lia) at hl1 simp_all - · apply hpc.getVert_injOn (by rw [Set.mem_setOf_eq]; lia) - (by rw [Set.mem_setOf_eq]; lia) at hr2 + · apply hpc.getVert_injOn (by rw [Set.mem_ofPred_eq]; lia) + (by rw [Set.mem_ofPred_eq]; lia) at hr2 aesop lemma ncard_neighborSet_toSubgraph_eq_two {u v} {p : G.Walk u u} (hpc : p.IsCycle) @@ -653,7 +654,7 @@ lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.N exact ⟨v, vt, Walk.end_mem_support _⟩ · apply G.induce_connected_of_patches u · simp only [Finset.coe_biUnion, Finset.mem_coe, List.coe_toFinset, Set.mem_iUnion, - Set.mem_setOf_eq, Walk.start_mem_support, exists_prop, and_true] + Set.mem_ofPred_eq, Walk.start_mem_support, exists_prop, and_true] exact ⟨u, ut⟩ intro v hv simp only [Finset.mem_coe, Finset.mem_biUnion, List.mem_toFinset] at hv @@ -661,7 +662,7 @@ lemma extend_finset_to_connected (Gpc : G.Preconnected) {t : Finset V} (tn : t.N refine ⟨{x | x ∈ (Gpc u w).some.support}, ?_, ?_⟩ · simp only [Finset.coe_biUnion, Finset.mem_coe, List.coe_toFinset] exact fun x xw => Set.mem_iUnion₂.mpr ⟨w, wt, xw⟩ - · simp only [Set.mem_setOf_eq, Walk.start_mem_support, exists_true_left] + · simp only [Set.mem_ofPred_eq, Walk.start_mem_support, exists_true_left] refine ⟨hw, Walk.connected_induce_support _ _ _⟩ end induced_subgraphs diff --git a/Mathlib/Combinatorics/SimpleGraph/DeleteEdges.lean b/Mathlib/Combinatorics/SimpleGraph/DeleteEdges.lean index 5e901085b73c54..e5f24b77358f5b 100644 --- a/Mathlib/Combinatorics/SimpleGraph/DeleteEdges.lean +++ b/Mathlib/Combinatorics/SimpleGraph/DeleteEdges.lean @@ -194,7 +194,7 @@ theorem edgeFinset_deleteIncidenceSet_eq_filter (G : SimpleGraph V) [DecidableRe apply filter_congr intro _ h rw [incidenceFinset, Set.mem_toFinset, incidenceSet, - Set.mem_setOf_eq, not_and, Classical.imp_iff_right_iff] + Set.mem_ofPred_eq, not_and, Classical.imp_iff_right_iff] left rwa [mem_edgeFinset] at h diff --git a/Mathlib/Combinatorics/SimpleGraph/Ends/Defs.lean b/Mathlib/Combinatorics/SimpleGraph/Ends/Defs.lean index ea9dd77576bfa3..b51005660430ba 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Ends/Defs.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Ends/Defs.lean @@ -44,7 +44,7 @@ theorem ComponentCompl.supp_injective : Function.Injective (ComponentCompl.supp : G.ComponentCompl K → Set V) := by refine ConnectedComponent.ind₂ ?_ rintro ⟨v, hv⟩ ⟨w, hw⟩ h - simp only [Set.ext_iff, ConnectedComponent.eq, Set.mem_setOf_eq, ComponentCompl.supp] at h ⊢ + simp only [Set.ext_iff, ConnectedComponent.eq, Set.mem_ofPred_eq, ComponentCompl.supp] at h ⊢ exact ((h v).mp ⟨hv, Reachable.refl _⟩).choose_spec theorem ComponentCompl.supp_inj {C D : G.ComponentCompl K} : C.supp = D.supp ↔ C = D := @@ -241,7 +241,7 @@ instance componentCompl_finite [LocallyFinite G] [Gpc : Fact G.Preconnected] (K have : Finite (Set.range touch) := by refine @Subtype.finite _ (Set.Finite.to_subtype ?_) _ apply Set.Finite.ofFinset (K.biUnion (fun v => G.neighborFinset v)) - simp only [Finset.mem_biUnion, mem_neighborFinset, Set.mem_setOf_eq, implies_true] + simp only [Finset.mem_biUnion, mem_neighborFinset, Set.mem_ofPred_eq, implies_true] -- hence `touch` has a finite domain apply Finite.of_injective_finite_range touch_inj diff --git a/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean b/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean index 968ebff9b9be06..6734395eb25e47 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean @@ -88,9 +88,12 @@ lemma IsHamiltonian.toFinset_support (hp : p.IsHamiltonian) : p.support.toFinset alias IsHamiltonian.support_toFinset := IsHamiltonian.toFinset_support omit [Fintype α] in -theorem IsHamiltonian.setOf_support (hp : p.IsHamiltonian) : {v | v ∈ p.support} = Set.univ := +theorem IsHamiltonian.setOfPred_support (hp : p.IsHamiltonian) : {v | v ∈ p.support} = Set.univ := Set.eq_univ_iff_forall.mpr hp.mem_support +@[deprecated (since := "2026-07-09")] +alias IsHamiltonian.setOf_support := IsHamiltonian.setOfPred_support + /-- The length of a Hamiltonian path is one less than the number of vertices of the graph. -/ lemma IsHamiltonian.length_eq (hp : p.IsHamiltonian) : p.length = Fintype.card α - 1 := eq_tsub_of_add_eq <| by @@ -129,7 +132,7 @@ theorem IsHamiltonian.getVert_surjective (hp : p.IsHamiltonian) : p.getVert.Surj omit [DecidableEq β] in theorem IsHamiltonian.injective_of_isPath_map (hp : p.IsHamiltonian) (h : (p.map f).IsPath) : Function.Injective f := by - rw [← Set.injOn_univ, ← hp.setOf_support] + rw [← Set.injOn_univ, ← hp.setOfPred_support] exact h.injOn_support_of_isPath_map lemma isHamiltonian_iff_isPath_and_length_eq [Fintype α] : diff --git a/Mathlib/Combinatorics/SimpleGraph/LapMatrix.lean b/Mathlib/Combinatorics/SimpleGraph/LapMatrix.lean index ee5bd217f3925c..e12b6498789108 100644 --- a/Mathlib/Combinatorics/SimpleGraph/LapMatrix.lean +++ b/Mathlib/Combinatorics/SimpleGraph/LapMatrix.lean @@ -55,7 +55,7 @@ theorem isHermitian_adjMatrix [NonAssocSemiring R] [StarRing R] : (G.adjMatrix R theorem degree_eq_sum_if_adj {R : Type*} [AddCommMonoidWithOne R] (i : V) : (G.degree i : R) = ∑ j : V, if G.Adj i j then 1 else 0 := by unfold degree neighborFinset neighborSet - rw [sum_boole, Set.toFinset_setOf] + rw [sum_boole, Set.toFinset_ofPred] variable [DecidableEq V] diff --git a/Mathlib/Combinatorics/SimpleGraph/Matching.lean b/Mathlib/Combinatorics/SimpleGraph/Matching.lean index 87b8654c30b185..18dcc54a8243ec 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Matching.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Matching.lean @@ -219,11 +219,11 @@ theorem IsMatching.verts_eq_biUnion_edgeSet {M : G.Subgraph} (h : M.IsMatching) exact ⟨s(v, u), he, Sym2.mem_mk_left ..⟩ · exact mem_verts_of_mem_edge he hv -theorem IsMatching.injOn_edgeSet : (setOf IsMatching).InjOn (edgeSet (G := G)) := by +theorem IsMatching.injOn_edgeSet : (Set.ofPred IsMatching).InjOn (edgeSet (G := G)) := by refine fun M₁ h₁ M₂ h₂ h ↦ Subgraph.ext ?_ <| Sym2.fromRel_eq_fromRel_iff_eq .. |>.mp h rw [h₁.verts_eq_biUnion_edgeSet, h₂.verts_eq_biUnion_edgeSet, h] -theorem IsMatching.strictMonoOn_edgeSet : StrictMonoOn (edgeSet (G := G)) (setOf IsMatching) := +theorem IsMatching.strictMonoOn_edgeSet : StrictMonoOn (edgeSet (G := G)) (Set.ofPred IsMatching) := edgeSet_monotone.monotoneOn _ |>.strictMonoOn_of_injOn injOn_edgeSet /-- diff --git a/Mathlib/Combinatorics/SimpleGraph/Partition.lean b/Mathlib/Combinatorics/SimpleGraph/Partition.lean index e4f586ed8d83d9..9a663c4a00aa34 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Partition.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Partition.lean @@ -82,7 +82,7 @@ variable {G} variable (P : G.Partition) /-- The part in the partition that `v` belongs to. -/ -def partOfVertex (v : V) : Set V := Classical.choose (P.isPartition.2 v) +noncomputable def partOfVertex (v : V) : Set V := Classical.choose (P.isPartition.2 v) theorem partOfVertex_mem (v : V) : P.partOfVertex v ∈ P.parts := by obtain ⟨h, -⟩ := (P.isPartition.2 v).choose_spec.1 @@ -100,13 +100,13 @@ theorem partOfVertex_ne_of_adj {v w : V} (h : G.Adj v w) : P.partOfVertex v ≠ /-- Create a coloring using the parts themselves as the colors. Each vertex is colored by the part it's contained in. -/ -def toColoring : G.Coloring P.parts := +noncomputable def toColoring : G.Coloring P.parts := Coloring.mk (fun v ↦ ⟨P.partOfVertex v, P.partOfVertex_mem v⟩) fun hvw ↦ by rw [Ne, Subtype.mk_eq_mk] exact P.partOfVertex_ne_of_adj hvw /-- Like `SimpleGraph.Partition.toColoring` but uses `Set V` as the coloring type. -/ -def toColoring' : G.Coloring (Set V) := +noncomputable def toColoring' : G.Coloring (Set V) := Coloring.mk P.partOfVertex fun hvw ↦ P.partOfVertex_ne_of_adj hvw theorem colorable [Fintype P.parts] : G.Colorable (Fintype.card P.parts) := diff --git a/Mathlib/Combinatorics/SimpleGraph/Paths.lean b/Mathlib/Combinatorics/SimpleGraph/Paths.lean index ada1da35a5daf0..0f3a343a724db4 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Paths.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Paths.lean @@ -413,7 +413,7 @@ lemma IsPath.getVert_injOn {p : G.Walk u v} (hp : p.IsPath) : induction p generalizing n m with | nil => simp_all | @cons v w u h p ihp => - simp only [length_cons, Set.mem_setOf_eq] at hn hm hnm + simp only [length_cons, Set.mem_ofPred_eq] at hn hm hnm by_cases hn0 : n = 0 <;> by_cases hm0 : m = 0 · lia · simp only [hn0, getVert_zero, Walk.getVert_cons p h hm0] at hnm @@ -431,7 +431,7 @@ lemma IsPath.getVert_eq_start_iff_of_not_nil {i : ℕ} {p : G.Walk u w} (hp : p. p.getVert i = u ↔ i = 0 := by refine ⟨fun h ↦ ?_, by simp_all⟩ by_cases h' : i ≤ p.length - · apply hp.getVert_injOn (by rw [Set.mem_setOf]; lia) (by rw [Set.mem_setOf]; lia) + · apply hp.getVert_injOn (by rw [Set.mem_ofPred]; lia) (by rw [Set.mem_ofPred]; lia) simp [h] · rw [p.getVert_of_length_le (le_of_not_ge h')] at h subst h @@ -460,7 +460,7 @@ lemma IsPath.getVert_injOn_iff (p : G.Walk u v) : Set.InjOn p.getVert {i | i ≤ rw [cons_isPath_iff] refine ⟨ih (by intro n hn m hm hnm - simp only [Set.mem_setOf_eq] at hn hm + simp only [Set.mem_ofPred_eq] at hn hm have := hinj (by rw [length_cons]; lia : n + 1 ≤ (q.cons h).length) (by rw [length_cons]; lia : m + 1 ≤ (q.cons h).length) @@ -503,7 +503,7 @@ lemma IsCycle.getVert_injOn {p : G.Walk u u} (hpc : p.IsCycle) : rw [← p.cons_tail_eq hpc.not_nil] at hpc intro n hn m hm hnm rw [← SimpleGraph.Walk.length_tail_add_one - (p.not_nil_of_tail_not_nil (not_nil_of_isCycle_cons hpc)), Set.mem_setOf] at hn hm + (p.not_nil_of_tail_not_nil (not_nil_of_isCycle_cons hpc)), Set.mem_ofPred] at hn hm have := ((Walk.cons_isCycle_iff _ _).mp hpc).1.getVert_injOn (by lia : n - 1 ≤ p.tail.length) (by lia : m - 1 ≤ p.tail.length) (by simp_all) @@ -512,11 +512,11 @@ lemma IsCycle.getVert_injOn {p : G.Walk u u} (hpc : p.IsCycle) : lemma IsCycle.getVert_injOn' {p : G.Walk u u} (hpc : p.IsCycle) : Set.InjOn p.getVert {i | i ≤ p.length - 1} := by intro n hn m hm hnm - simp only [Set.mem_setOf_eq] at * + simp only [Set.mem_ofPred_eq] at * have := hpc.three_le_length have : p.length - n = p.length - m := Walk.length_reverse _ ▸ hpc.reverse.getVert_injOn - (by simp only [Walk.length_reverse, Set.mem_setOf_eq]; lia) - (by simp only [Walk.length_reverse, Set.mem_setOf_eq]; lia) + (by simp only [Walk.length_reverse, Set.mem_ofPred_eq]; lia) + (by simp only [Walk.length_reverse, Set.mem_ofPred_eq]; lia) (by simp [Walk.getVert_reverse, show p.length - (p.length - n) = n by lia, hnm, show p.length - (p.length - m) = m by lia]) lia @@ -532,8 +532,8 @@ lemma IsCycle.getVert_endpoint_iff {i : ℕ} {p : G.Walk u u} (hpc : p.IsCycle) refine ⟨?_, by aesop⟩ rw [or_iff_not_imp_left] intro h hi - exact hpc.getVert_injOn (by simp only [Set.mem_setOf_eq]; lia) - (by simp only [Set.mem_setOf_eq]; lia) (h.symm ▸ (Walk.getVert_length p).symm) + exact hpc.getVert_injOn (by simp only [Set.mem_ofPred_eq]; lia) + (by simp only [Set.mem_ofPred_eq]; lia) (h.symm ▸ (Walk.getVert_length p).symm) lemma IsCycle.getVert_sub_one_ne_getVert_add_one {i : ℕ} {p : G.Walk u u} (hpc : p.IsCycle) (h : i ≤ p.length) : p.getVert (i - 1) ≠ p.getVert (i + 1) := by @@ -543,8 +543,8 @@ lemma IsCycle.getVert_sub_one_ne_getVert_add_one {i : ℕ} {p : G.Walk u u} (hpc · rw [p.getVert_of_length_le (by lia : p.length ≤ i + 1), hpc.getVert_endpoint_iff (by lia)] at h' lia - have := hpc.getVert_injOn' (by simp only [Set.mem_setOf_eq, Nat.sub_le_iff_le_add]; lia) - (by simp only [Set.mem_setOf_eq]; lia) h' + have := hpc.getVert_injOn' (by simp only [Set.mem_ofPred_eq, Nat.sub_le_iff_le_add]; lia) + (by simp only [Set.mem_ofPred_eq]; lia) h' lia theorem isCycle_iff_isPath_tail_and_le_length {p : G.Walk u u} : @@ -630,7 +630,7 @@ lemma endpoint_notMem_support_takeUntil {p : G.Walk u v} (hp : p.IsPath) (hw : w obtain ⟨n, ⟨hn, hnl⟩⟩ := hv rw [getVert_takeUntil hw hnl] at hn have := p.length_takeUntil_lt_length hw h.symm - have : n = p.length := hp.getVert_injOn (by rw [Set.mem_setOf]; lia) (by simp) + have : n = p.length := hp.getVert_injOn (by rw [Set.mem_ofPred]; lia) (by simp) (hn.symm ▸ p.getVert_length.symm) lia diff --git a/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean b/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean index bc9ccfecd07846..f7cca2f5d43ed5 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean @@ -1342,7 +1342,7 @@ set_option backward.isDefEq.respectTransparency false in /-- Equivalence between a subgraph with deleted vertices and its corresponding simple graph. -/ def coeDeleteVertsIso (s : Set V) : (G'.deleteVerts s).coe ≃g G'.coe.induce {v : G'.verts | ↑v ∉ s} where - toFun := fun ⟨v, hv⟩ ↦ ⟨⟨v, Set.mem_of_mem_inter_left hv⟩, by aesop⟩ + toFun := fun ⟨v, hv⟩ ↦ ⟨⟨v, Set.mem_of_mem_sdiff hv⟩, by aesop⟩ invFun := fun ⟨v, hv⟩ ↦ ⟨v, by simp_all⟩ map_rel_iff' := by simp diff --git a/Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean b/Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean index 61f15e3e39a34e..3d2191e25b5802 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Triangle/Basic.lean @@ -95,7 +95,7 @@ lemma edgeDisjointTriangles_iff_mem_sym2_subsingleton : = {s | G.Adj a b ∧ ∃ c, G.Adj a c ∧ G.Adj b c ∧ s = {a, b, c}} := by ext s simp only [mem_sym2_iff, Sym2.mem_iff, forall_eq_or_imp, forall_eq, - mem_cliqueSet_iff, Set.mem_setOf_eq, + mem_cliqueSet_iff, Set.mem_ofPred_eq, is3Clique_iff] constructor · rintro ⟨⟨c, d, e, hcd, hce, hde, rfl⟩, hab⟩ @@ -154,7 +154,7 @@ lemma EdgeDisjointTriangles.card_edgeFinset_le (hG : G.EdgeDisjointTriangles) : rw [← this] refine card_mono ?_ simp [insert_subset, *] - · simpa only [card_le_one, mem_bipartiteBelow, and_imp, Set.Subsingleton, Set.mem_setOf_eq, + · simpa only [card_le_one, mem_bipartiteBelow, and_imp, Set.Subsingleton, Set.mem_ofPred_eq, mem_cliqueFinset_iff, mem_cliqueSet_iff] using hG.mem_sym2_subsingleton (G.not_isDiag_of_mem_edgeSet <| mem_edgeFinset.1 he) diff --git a/Mathlib/Combinatorics/SimpleGraph/Walk/Counting.lean b/Mathlib/Combinatorics/SimpleGraph/Walk/Counting.lean index be97836049dd3c..54f76bc580fe4f 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Walk/Counting.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Walk/Counting.lean @@ -32,20 +32,26 @@ namespace SimpleGraph variable {V : Type u} (G : SimpleGraph V) -theorem Walk.setOf_length_eq_zero (u : V) : {p : G.Walk u u | p.length = 0} = {.nil} := by +theorem Walk.setOfPred_length_eq_zero (u : V) : {p : G.Walk u u | p.length = 0} = {.nil} := by simp [Walk.length_eq_zero_iff, ← Walk.eq_nil_iff_nil] +@[deprecated (since := "2026-07-09")] +alias Walk.setOf_length_eq_zero := Walk.setOfPred_length_eq_zero + @[deprecated (since := "2026-05-12")] -alias set_walk_self_length_zero_eq := Walk.setOf_length_eq_zero +alias set_walk_self_length_zero_eq := Walk.setOfPred_length_eq_zero -theorem Walk.setOf_length_eq_zero_of_ne {u v : V} (h : u ≠ v) : +theorem Walk.setOfPred_length_eq_zero_of_ne {u v : V} (h : u ≠ v) : {p : G.Walk u v | p.length = 0} = ∅ := Set.eq_empty_of_forall_notMem (h <| ·.eq_of_length_eq_zero ·) +@[deprecated (since := "2026-07-09")] +alias Walk.setOf_length_eq_zero_of_ne := Walk.setOfPred_length_eq_zero_of_ne + @[deprecated (since := "2026-05-12")] -alias set_walk_length_zero_eq_of_ne := Walk.setOf_length_eq_zero_of_ne +alias set_walk_length_zero_eq_of_ne := Walk.setOfPred_length_eq_zero_of_ne -theorem Walk.setOf_length_eq_add_one (u v : V) (n : ℕ) : +theorem Walk.setOfPred_length_eq_add_one (u v : V) (n : ℕ) : {p : G.Walk u v | p.length = n + 1} = ⋃ (w : V) (h : G.Adj u w), Walk.cons h '' {p' : G.Walk w v | p'.length = n} := by ext p @@ -53,7 +59,11 @@ theorem Walk.setOf_length_eq_add_one (u v : V) (n : ℕ) : | nil => simp [eq_comm] | cons huw pwv => grind [length_cons, Set.mem_iUnion] -@[deprecated (since := "2026-05-12")] alias set_walk_length_succ_eq := Walk.setOf_length_eq_add_one +@[deprecated (since := "2026-07-09")] +alias Walk.setOf_length_eq_add_one := Walk.setOfPred_length_eq_add_one + +@[deprecated (since := "2026-05-12")] +alias set_walk_length_succ_eq := Walk.setOfPred_length_eq_add_one /-- Walks of length two from `u` to `v` correspond bijectively to common neighbours of `u` and `v`. Note that `u` and `v` may be the same. -/ @@ -91,8 +101,8 @@ theorem coe_finsetWalkLength_eq (n : ℕ) (u v : V) : induction n generalizing u v with | zero => grind [finsetWalkLength, Walk.length_eq_zero_iff, Walk.eq_nil_iff_nil, Walk.Nil.eq] | succ n ih => - simp only [finsetWalkLength, Walk.setOf_length_eq_add_one, Finset.coe_biUnion, Finset.mem_coe, - Finset.mem_univ, Set.iUnion_true, Finset.coe_map, Set.iUnion_coe_set] + simp only [finsetWalkLength, Walk.setOfPred_length_eq_add_one, Finset.coe_biUnion, + Finset.mem_coe, Finset.mem_univ, Set.iUnion_true, Finset.coe_map, Set.iUnion_coe_set] congr! grind diff --git a/Mathlib/Combinatorics/SimpleGraph/Walk/Maps.lean b/Mathlib/Combinatorics/SimpleGraph/Walk/Maps.lean index c7c8b3304435ae..7582ed78288ded 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Walk/Maps.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Walk/Maps.lean @@ -220,7 +220,7 @@ protected def induce {u v : V} : | .cons (v := u') huu' w, hw => by simp [map_induce] lemma map_induce_induceHomOfLE (hs : s ⊆ s') {u v : V} : ∀ (w : G.Walk u v) (hw), - (w.induce s hw).map (G.induceHomOfLE hs).toHom = w.induce s' (subset_trans hw hs) + (w.induce s hw).map (G.induceHomOfLE hs).toHom = w.induce s' (fun x hx ↦ hs (hw x hx)) | .nil, hw => rfl | .cons (v := u') huu' w, hw => by simp [map_induce_induceHomOfLE] diff --git a/Mathlib/Computability/DFA.lean b/Mathlib/Computability/DFA.lean index ccaa5475694f7f..14376222d598c2 100644 --- a/Mathlib/Computability/DFA.lean +++ b/Mathlib/Computability/DFA.lean @@ -306,7 +306,7 @@ theorem acceptsFrom_union (M1 : DFA α σ1) (M2 : DFA α σ2) (s1 : σ1) (s2 : ext x simp only [acceptsFrom] rw [Language.add_def, Set.mem_union] - simp_rw [↑Set.mem_setOf] + simp_rw [↑Set.mem_ofPred] induction x generalizing s1 s2 with | nil => simp | cons a x ih => simp only [evalFrom_cons, union_step, ih] @@ -335,7 +335,7 @@ theorem acceptsFrom_inter (s1 : σ1) (s2 : σ2) : (M1.inter M2).acceptsFrom (s1, s2) = M1.acceptsFrom s1 ⊓ M2.acceptsFrom s2 := by ext x simp only [acceptsFrom, Language.mem_inf] - simp_rw [↑Set.mem_setOf] + simp_rw [↑Set.mem_ofPred] induction x generalizing s1 s2 with | nil => simp | cons a x ih => simp only [evalFrom_cons, inter_step, ih] diff --git a/Mathlib/Computability/EpsilonNFA.lean b/Mathlib/Computability/EpsilonNFA.lean index d1cae1a5758a8a..7605505fb9d3a6 100644 --- a/Mathlib/Computability/EpsilonNFA.lean +++ b/Mathlib/Computability/EpsilonNFA.lean @@ -50,15 +50,25 @@ variable {α : Type u} {σ : Type v} (M : εNFA α σ) {S : Set σ} {s t u : σ} namespace εNFA +/-- Membership in the `εClosure` of a set, namely reachability by taking a finite string of +ε-transitions from an element of the set. -/ +inductive MemεClosure (S : Set σ) : σ → Prop + | base : ∀ s ∈ S, MemεClosure S s + | step : ∀ (s), ∀ t ∈ M.step s none, MemεClosure S s → MemεClosure S t + /-- The `εClosure` of a set is the set of states which can be reached by taking a finite string of ε-transitions from an element of the set. -/ -inductive εClosure (S : Set σ) : Set σ - | base : ∀ s ∈ S, εClosure S s - | step : ∀ (s), ∀ t ∈ M.step s none, εClosure S s → εClosure S t +def εClosure (S : Set σ) : Set σ := {s | MemεClosure M S s} -@[simp] -theorem subset_εClosure (S : Set σ) : S ⊆ M.εClosure S := - εClosure.base +@[simp] lemma subset_εClosure (S : Set σ) : S ⊆ M.εClosure S := MemεClosure.base + +@[deprecated subset_εClosure (since := "2026-07-07")] alias εClosure.base := MemεClosure.base + +lemma mem_εClosure_of_mem_step (hts : t ∈ M.step s none) (hs : s ∈ M.εClosure S) : + t ∈ M.εClosure S := MemεClosure.step _ _ hts hs + +@[deprecated mem_εClosure_of_mem_step (since := "2026-07-07")] +alias εClosure.step := MemεClosure.step @[simp] theorem εClosure_empty : M.εClosure ∅ = ∅ := @@ -75,10 +85,10 @@ theorem mem_εClosure_iff_exists : s ∈ M.εClosure S ↔ ∃ t ∈ S, s ∈ M. | step _ _ _ _ ih => obtain ⟨s, _, _⟩ := ih use s - solve_by_elim [εClosure.step] + solve_by_elim [mem_εClosure_of_mem_step] mpr := by intro ⟨t, _, h⟩ - induction h <;> subst_vars <;> solve_by_elim [εClosure.step] + induction h <;> subst_vars <;> solve_by_elim [mem_εClosure_of_mem_step] /-- `M.stepSet S a` is the union of the ε-closure of `M.step s a` for all `s ∈ S`. -/ def stepSet (S : Set σ) (a : α) : Set σ := @@ -209,7 +219,7 @@ theorem mem_εClosure_iff_exists_path {s₁ s₂ : σ} : solve_by_elim · simp_rw [List.replicate_add, isPath_append, List.replicate_one, isPath_singleton] at h obtain ⟨t, _, _⟩ := h - solve_by_elim [εClosure.step] + solve_by_elim [mem_εClosure_of_mem_step] theorem mem_evalFrom_iff_exists_path {s₁ s₂ : σ} {x : List α} : s₂ ∈ M.evalFrom {s₁} x ↔ ∃ x', x'.reduceOption = x ∧ M.IsPath s₁ s₂ x' := by @@ -298,7 +308,7 @@ def toεNFA (M : NFA α σ) : εNFA α σ where @[simp] theorem toεNFA_εClosure (M : NFA α σ) (S : Set σ) : M.toεNFA.εClosure S = S := by ext a - refine ⟨?_, εNFA.εClosure.base _⟩ + refine ⟨?_, fun ha ↦ εNFA.subset_εClosure _ _ ha⟩ rintro (⟨_, h⟩ | ⟨_, _, h, _⟩) · exact h · cases h diff --git a/Mathlib/Computability/NFA.lean b/Mathlib/Computability/NFA.lean index ec0693bc70abda..77dada9f397956 100644 --- a/Mathlib/Computability/NFA.lean +++ b/Mathlib/Computability/NFA.lean @@ -219,7 +219,7 @@ theorem acceptsFrom_iUnion {ι : Sort*} (s : ι → Set σ) : M.acceptsFrom (⋃ i, s i) = ⋃ i, M.acceptsFrom (s i) := by ext x simp only [acceptsFrom, evalFrom_iUnion, mem_iUnion] - simp_rw [↑mem_iUnion, ↑mem_setOf_eq]; tauto + simp_rw [↑mem_iUnion, ↑mem_ofPred_eq]; tauto variable (M) in theorem acceptsFrom_iUnion₂ {ι : Sort*} {κ : ι → Sort*} (f : ∀ i, κ i → Set σ) : @@ -231,11 +231,11 @@ variable (M) in private theorem mem_acceptsFrom_sep_fact {S : Set σ} {p : Prop} {x : List α} : x ∈ M.acceptsFrom {s ∈ S | p} ↔ x ∈ M.acceptsFrom S ∧ p := by induction x generalizing S with - | nil => simp only [nil_mem_acceptsFrom, mem_setOf_eq]; tauto + | nil => simp only [nil_mem_acceptsFrom, mem_ofPred_eq]; tauto | cons a x ih => have h : M.stepSet {s ∈ S | p} a = {s ∈ M.stepSet S a | p} := by - ext s; simp only [stepSet, mem_setOf_eq, mem_iUnion, exists_prop]; tauto - simp [h, ih] + ext s; simp only [stepSet, mem_ofPred_eq, mem_iUnion, exists_prop]; tauto + simp [-sep_ofPred, *] variable (M) in /-- `M.eval x` computes all possible paths though `M` with input `x` starting at an element of @@ -385,7 +385,7 @@ theorem reverse_reverse : M.reverse.reverse = M := by theorem disjoint_stepSet_reverse {a : α} {S S' : Set σ} : Disjoint S (M.reverse.stepSet S' a) ↔ Disjoint S' (M.stepSet S a) := by rw [← not_iff_not] - simp only [Set.not_disjoint_iff, mem_stepSet, reverse_step, Set.mem_setOf_eq] + simp only [Set.not_disjoint_iff, mem_stepSet, reverse_step, Set.mem_ofPred_eq] tauto theorem disjoint_evalFrom_reverse {x : List α} {S S' : Set σ} diff --git a/Mathlib/Computability/Reduce.lean b/Mathlib/Computability/Reduce.lean index c7f16ff4f494d8..862530f164600e 100644 --- a/Mathlib/Computability/Reduce.lean +++ b/Mathlib/Computability/Reduce.lean @@ -125,7 +125,7 @@ open Computable theorem computable_of_manyOneReducible {p : α → Prop} {q : β → Prop} (h₁ : p ≤₀ q) (h₂ : ComputablePred q) : ComputablePred p := by rcases h₁ with ⟨f, c, hf⟩ - rw [show p = fun a => q (f a) from Set.ext hf] + rw [show p = fun a ↦ q (f a) by ext; exact hf _] rcases computable_iff.1 h₂ with ⟨g, hg, rfl⟩ exact ⟨by infer_instance, by simpa using hg.comp c⟩ @@ -282,58 +282,65 @@ variable {α : Type u} [Primcodable α] [Inhabited α] {β : Type v} [Primcodabl /-- Computable and injective mapping of predicates to sets of natural numbers. -/ def toNat (p : Set α) : Set ℕ := - { n | p ((Encodable.decode (α := α) n).getD default) } + { n | (Encodable.decode (α := α) n).getD default ∈ p } + +@[simp] lemma toNat_nat (p : Set ℕ) : toNat p = p := by ext n; simp [toNat] @[simp] -theorem toNat_manyOneReducible {p : Set α} : toNat p ≤₀ p := +theorem toNat_manyOneReducible {p : Set α} : (· ∈ toNat p) ≤₀ (· ∈ p) := ⟨fun n => (Encodable.decode (α := α) n).getD default, Computable.option_getD Computable.decode (Computable.const _), fun _ => Iff.rfl⟩ @[simp] -theorem manyOneReducible_toNat {p : Set α} : p ≤₀ toNat p := - ⟨Encodable.encode, Computable.encode, by simp [toNat, setOf]⟩ +theorem manyOneReducible_toNat {p : Set α} : (· ∈ p) ≤₀ (· ∈ toNat p) := + ⟨Encodable.encode, Computable.encode, by simp [toNat]⟩ @[simp] -theorem manyOneReducible_toNat_toNat {p : Set α} {q : Set β} : toNat p ≤₀ toNat q ↔ p ≤₀ q := +theorem manyOneReducible_toNat_toNat {p : Set α} {q : Set β} : + (· ∈ toNat p) ≤₀ (· ∈ toNat q) ↔ (· ∈ p) ≤₀ (· ∈ q) := ⟨fun h => manyOneReducible_toNat.trans (h.trans toNat_manyOneReducible), fun h => toNat_manyOneReducible.trans (h.trans manyOneReducible_toNat)⟩ @[simp] -theorem toNat_manyOneEquiv {p : Set α} : ManyOneEquiv (toNat p) p := by simp [ManyOneEquiv] +theorem toNat_manyOneEquiv {p : Set α} : ManyOneEquiv (· ∈ toNat p) (· ∈ p) := by + simp [ManyOneEquiv] @[simp] theorem manyOneEquiv_toNat (p : Set α) (q : Set β) : - ManyOneEquiv (toNat p) (toNat q) ↔ ManyOneEquiv p q := by simp [ManyOneEquiv] + ManyOneEquiv (· ∈ toNat p) (· ∈ toNat q) ↔ ManyOneEquiv (· ∈ p) (· ∈ q) := by + simp [ManyOneEquiv] /-- A many-one degree is an equivalence class of sets up to many-one equivalence. -/ def ManyOneDegree : Type := - Quotient (⟨ManyOneEquiv, equivalence_of_manyOneEquiv⟩ : Setoid (Set ℕ)) + Quotient (⟨fun p q => ManyOneEquiv (· ∈ p) (· ∈ q), + ⟨fun _ => manyOneEquiv_refl _, ManyOneEquiv.symm, ManyOneEquiv.trans⟩⟩ : Setoid (Set ℕ)) namespace ManyOneDegree /-- The many-one degree of a set on a primcodable type. -/ -def of (p : α → Prop) : ManyOneDegree := +def of (p : Set α) : ManyOneDegree := Quotient.mk'' (toNat p) @[elab_as_elim] protected theorem ind_on {C : ManyOneDegree → Prop} (d : ManyOneDegree) (h : ∀ p : Set ℕ, C (of p)) : C d := - Quotient.inductionOn' d h + Quotient.inductionOn' d fun p => by rw [← toNat_nat p]; exact h p /-- Lifts a function on sets of natural numbers to many-one degrees. -/ protected abbrev liftOn {φ} (d : ManyOneDegree) (f : Set ℕ → φ) - (h : ∀ p q, ManyOneEquiv p q → f p = f q) : φ := + (h : ∀ p q, ManyOneEquiv (· ∈ p) (· ∈ q) → f p = f q) : φ := Quotient.liftOn' d f h @[simp] protected theorem liftOn_eq {φ} (p : Set ℕ) (f : Set ℕ → φ) - (h : ∀ p q, ManyOneEquiv p q → f p = f q) : (of p).liftOn f h = f p := - rfl + (h : ∀ p q, ManyOneEquiv (· ∈ p) (· ∈ q) → f p = f q) : (of p).liftOn f h = f p := + h _ _ toNat_manyOneEquiv /-- Lifts a binary function on sets of natural numbers to many-one degrees. -/ @[reducible, simp] protected def liftOn₂ {φ} (d₁ d₂ : ManyOneDegree) (f : Set ℕ → Set ℕ → φ) - (h : ∀ p₁ p₂ q₁ q₂, ManyOneEquiv p₁ p₂ → ManyOneEquiv q₁ q₂ → f p₁ q₁ = f p₂ q₂) : φ := + (h : ∀ p₁ p₂ q₁ q₂, ManyOneEquiv (· ∈ p₁) (· ∈ p₂) → ManyOneEquiv (· ∈ q₁) (· ∈ q₂) → + f p₁ q₁ = f p₂ q₂) : φ := d₁.liftOn (fun p => d₂.liftOn (f p) fun _ _ hq => h _ _ _ _ (by rfl) hq) (by intro p₁ p₂ hp @@ -344,15 +351,16 @@ protected def liftOn₂ {φ} (d₁ d₂ : ManyOneDegree) (f : Set ℕ → Set @[simp] protected theorem liftOn₂_eq {φ} (p q : Set ℕ) (f : Set ℕ → Set ℕ → φ) - (h : ∀ p₁ p₂ q₁ q₂, ManyOneEquiv p₁ p₂ → ManyOneEquiv q₁ q₂ → f p₁ q₁ = f p₂ q₂) : + (h : ∀ p₁ p₂ q₁ q₂, ManyOneEquiv (· ∈ p₁) (· ∈ p₂) → ManyOneEquiv (· ∈ q₁) (· ∈ q₂) → + f p₁ q₁ = f p₂ q₂) : (of p).liftOn₂ (of q) f h = f p q := - rfl + h _ _ _ _ toNat_manyOneEquiv toNat_manyOneEquiv set_option backward.isDefEq.respectTransparency false in @[simp] -theorem of_eq_of {p : α → Prop} {q : β → Prop} : of p = of q ↔ ManyOneEquiv p q := by +theorem of_eq_of {p : Set α} {q : Set β} : of p = of q ↔ ManyOneEquiv (· ∈ p) (· ∈ q) := by rw [of, of, Quotient.eq''] - simp + exact manyOneEquiv_toNat p q instance instInhabited : Inhabited ManyOneDegree := ⟨of (∅ : Set ℕ)⟩ @@ -362,11 +370,11 @@ sets in `d₂`. -/ instance instLE : LE ManyOneDegree := ⟨fun d₁ d₂ => - ManyOneDegree.liftOn₂ d₁ d₂ (· ≤₀ ·) fun _p₁ _p₂ _q₁ _q₂ hp hq => + ManyOneDegree.liftOn₂ d₁ d₂ (fun p q => (· ∈ p) ≤₀ (· ∈ q)) fun _p₁ _p₂ _q₁ _q₂ hp hq => propext (hp.le_congr_left.trans hq.le_congr_right)⟩ @[simp] -theorem of_le_of {p : α → Prop} {q : β → Prop} : of p ≤ of q ↔ p ≤₀ q := +theorem of_le_of {p : Set α} {q : Set β} : of p ≤ of q ↔ (· ∈ p) ≤₀ (· ∈ q) := manyOneReducible_toNat_toNat set_option backward.privateInPublic true in @@ -385,7 +393,7 @@ private theorem le_trans {d₁ d₂ d₃ : ManyOneDegree} : d₁ ≤ d₂ → d induction d₁ using ManyOneDegree.ind_on induction d₂ using ManyOneDegree.ind_on induction d₃ using ManyOneDegree.ind_on - apply ManyOneReducible.trans + exact ManyOneReducible.trans set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in @@ -397,7 +405,7 @@ instance instPartialOrder : PartialOrder ManyOneDegree where /-- The join of two degrees, induced by the disjoint union of two underlying sets. -/ instance instAdd : Add ManyOneDegree := ⟨fun d₁ d₂ => - d₁.liftOn₂ d₂ (fun a b => of (a ⊕' b)) + d₁.liftOn₂ d₂ (fun a b => of {x | ((· ∈ a) ⊕' (· ∈ b)) x}) (by rintro a b c d ⟨hl₁, hr₁⟩ ⟨hl₂, hr₂⟩ rw [of_eq_of] @@ -408,7 +416,7 @@ instance instAdd : Add ManyOneDegree := (hr₂.trans OneOneReducible.disjoin_right.to_many_one)⟩)⟩ @[simp] -theorem add_of (p : Set α) (q : Set β) : of (p ⊕' q) = of p + of q := +theorem add_of (p : Set α) (q : Set β) : of {x | ((· ∈ p) ⊕' (· ∈ q)) x} = of p + of q := of_eq_of.mpr ⟨disjoin_manyOneReducible (manyOneReducible_toNat.trans OneOneReducible.disjoin_left.to_many_one) @@ -422,7 +430,7 @@ protected theorem add_le {d₁ d₂ d₃ : ManyOneDegree} : d₁ + d₂ ≤ d₃ induction d₁ using ManyOneDegree.ind_on induction d₂ using ManyOneDegree.ind_on induction d₃ using ManyOneDegree.ind_on - simpa only [← add_of, of_le_of] using disjoin_le + simpa only [← add_of, of_le_of, Set.mem_ofPred_eq] using disjoin_le @[simp] protected theorem le_add_left (d₁ d₂ : ManyOneDegree) : d₁ ≤ d₁ + d₂ := diff --git a/Mathlib/Condensed/TopComparison.lean b/Mathlib/Condensed/TopComparison.lean index 11985db7efee7a..d6f39be67677d1 100644 --- a/Mathlib/Condensed/TopComparison.lean +++ b/Mathlib/Condensed/TopComparison.lean @@ -70,17 +70,18 @@ theorem equalizerCondition_yonedaPresheaf intro Z B π _ _ refine ⟨fun a b h ↦ ?_, fun ⟨a, ha⟩ ↦ ?_⟩ · simp only [yonedaPresheaf, comp, Quiver.Hom.unop_op, TypeCat.Fun.coe_mk, - Set.coe_setOf, mapToEqualizer, Set.mem_setOf_eq, ConcreteCategory.hom_ofHom, Subtype.mk.injEq, - mk.injEq] at h + Set.coe_ofPred, mapToEqualizer, Set.mem_ofPred_eq, ConcreteCategory.hom_ofHom, + Subtype.mk.injEq, mk.injEq] at h simp only [yonedaPresheaf, unop_op] ext x obtain ⟨y, hy⟩ := (hq Z B π).surjective x rw [← hy] exact congr_fun h y · simp only [yonedaPresheaf, comp, Quiver.Hom.unop_op, ConcreteCategory.hom_ofHom, - TypeCat.Fun.coe_mk, mk.injEq, Set.mem_setOf_eq] at ha + TypeCat.Fun.coe_mk, mk.injEq, Set.mem_ofPred_eq] at ha simp only [yonedaPresheaf, comp, Quiver.Hom.unop_op, TypeCat.Fun.coe_mk, - Set.coe_setOf, mapToEqualizer, Set.mem_setOf_eq, ConcreteCategory.hom_ofHom, Subtype.mk.injEq] + Set.coe_ofPred, mapToEqualizer, Set.mem_ofPred_eq, ConcreteCategory.hom_ofHom, + Subtype.mk.injEq] simp only [yonedaPresheaf, unop_op] at a refine ⟨(hq Z B π).lift a (factorsThrough_of_pullbackCondition G X ha), ?_⟩ congr 1 diff --git a/Mathlib/Data/Analysis/Filter.lean b/Mathlib/Data/Analysis/Filter.lean index f3c51a4bcfeff2..ed9a4285d58a63 100644 --- a/Mathlib/Data/Analysis/Filter.lean +++ b/Mathlib/Data/Analysis/Filter.lean @@ -190,7 +190,7 @@ protected def map (m : α → β) {f : Filter α} (F : f.Realizer) : (map m f).R inf_le_left := fun _ _ ↦ image_mono (F.F.inf_le_left _ _) inf_le_right := fun _ _ ↦ image_mono (F.F.inf_le_right _ _) }, filter_eq <| Set.ext fun _ ↦ by - simp only [CFilter.toFilter, image_subset_iff, mem_setOf_eq, Filter.mem_sets, mem_map] + simp only [CFilter.toFilter, image_subset_iff, mem_ofPred_eq, Filter.mem_sets, mem_map] rw [F.mem_sets]⟩ @[simp] diff --git a/Mathlib/Data/DFinsupp/WellFounded.lean b/Mathlib/Data/DFinsupp/WellFounded.lean index 9826cab5551827..a8f749299c23cd 100644 --- a/Mathlib/Data/DFinsupp/WellFounded.lean +++ b/Mathlib/Data/DFinsupp/WellFounded.lean @@ -75,25 +75,25 @@ theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] : simp_rw [piecewise_apply] at hs hr split_ifs at hs with hp · refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩, - .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] + .fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_ofPred_eq] · simp only [if_pos hj] · split_ifs with hi · rwa [hr i hi, if_pos hp] at hs · assumption · ext1 j - simp only [piecewise_apply, Set.mem_setOf_eq] + simp only [piecewise_apply, Set.mem_ofPred_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₂, if_pos (h₁ h₂)] · rw [Classical.not_imp] at h₁ rw [hr j h₁.1, if_neg h₁.2] · refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩, - .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq] + .snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_ofPred_eq] · exact if_pos hj · split_ifs with hi · rwa [hr i hi, if_neg hp] at hs · assumption · ext1 j - simp only [piecewise_apply, Set.mem_setOf_eq] + simp only [piecewise_apply, Set.mem_ofPred_eq] split_ifs with h₁ h₂ <;> try rfl · rw [hr j h₁.1, if_pos h₁.2] · rw [hr j h₂, if_neg] diff --git a/Mathlib/Data/ENNReal/Inv.lean b/Mathlib/Data/ENNReal/Inv.lean index 5793d3e229d2bb..5c13ea042517da 100644 --- a/Mathlib/Data/ENNReal/Inv.lean +++ b/Mathlib/Data/ENNReal/Inv.lean @@ -65,7 +65,7 @@ theorem coe_inv_le : (↑r⁻¹ : ℝ≥0∞) ≤ (↑r)⁻¹ := @[simp, norm_cast] theorem coe_inv (hr : r ≠ 0) : (↑r⁻¹ : ℝ≥0∞) = (↑r)⁻¹ := - coe_inv_le.antisymm <| sInf_le <| mem_setOf.2 <| by rw [← coe_mul, mul_inv_cancel₀ hr, coe_one] + coe_inv_le.antisymm <| sInf_le <| mem_ofPred.2 <| by rw [← coe_mul, mul_inv_cancel₀ hr, coe_one] @[simp, norm_cast] theorem coe_inv' [NeZero r] : (↑r⁻¹ : ℝ≥0∞) = (↑r)⁻¹ := coe_inv (NeZero.ne r) diff --git a/Mathlib/Data/ENNReal/Operations.lean b/Mathlib/Data/ENNReal/Operations.lean index 6b159c27b59719..224eff81c4af1e 100644 --- a/Mathlib/Data/ENNReal/Operations.lean +++ b/Mathlib/Data/ENNReal/Operations.lean @@ -277,7 +277,7 @@ end Cancel section Sub theorem sub_eq_sInf {a b : ℝ≥0∞} : a - b = sInf { d | a ≤ d + b } := - le_antisymm (le_sInf fun _ h => tsub_le_iff_right.mpr h) <| sInf_le <| mem_setOf.2 le_tsub_add + le_antisymm (le_sInf fun _ h => tsub_le_iff_right.mpr h) <| sInf_le <| mem_ofPred.2 le_tsub_add /-- This is a special case of `WithTop.coe_sub` in the `ENNReal` namespace -/ @[simp, norm_cast] theorem coe_sub : (↑(r - p) : ℝ≥0∞) = ↑r - ↑p := WithTop.coe_sub diff --git a/Mathlib/Data/Fin/Tuple/Embedding.lean b/Mathlib/Data/Fin/Tuple/Embedding.lean index 663ec83b9a0a30..54a3e04d902559 100644 --- a/Mathlib/Data/Fin/Tuple/Embedding.lean +++ b/Mathlib/Data/Fin/Tuple/Embedding.lean @@ -96,7 +96,7 @@ variable {α : Type*} /-- The natural equivalence of `Fin 2 ↪ α` with pairs `(a, b)` of distinct elements of `α`. -/ def twoEmbeddingEquiv : (Fin 2 ↪ α) ≃ {(a, b) : α × α | a ≠ b} where toFun e := ⟨(e 0, e 1), by - simp only [ne_eq, Fin.isValue, mem_setOf_eq, EmbeddingLike.apply_eq_iff_eq, zero_eq_one_iff, + simp only [ne_eq, Fin.isValue, mem_ofPred_eq, EmbeddingLike.apply_eq_iff_eq, zero_eq_one_iff, succ_ne_self, not_false_eq_true]⟩ invFun := fun ⟨⟨a, b⟩, h⟩ ↦ { toFun i := if i = 0 then a else b diff --git a/Mathlib/Data/Finset/Basic.lean b/Mathlib/Data/Finset/Basic.lean index d438187eae57a5..7b6d9a8bb1aa9e 100644 --- a/Mathlib/Data/Finset/Basic.lean +++ b/Mathlib/Data/Finset/Basic.lean @@ -394,7 +394,7 @@ theorem subset_union_elim {s : Finset α} {t₁ t₂ : Set α} (h : ↑s ⊆ t · grind · grind · intro x - simp only [coe_filter, Set.mem_setOf_eq, and_imp] + simp only [coe_filter, Set.mem_ofPred_eq, and_imp] intro hx hx₂ exact ⟨Or.resolve_left (h hx) hx₂, hx₂⟩ diff --git a/Mathlib/Data/Finset/Defs.lean b/Mathlib/Data/Finset/Defs.lean index 4421e55d0a0215..0e12044c301289 100644 --- a/Mathlib/Data/Finset/Defs.lean +++ b/Mathlib/Data/Finset/Defs.lean @@ -127,9 +127,11 @@ theorem mem_coe {a : α} {s : Finset α} : a ∈ (s : Set α) ↔ a ∈ (s : Fin Iff.rfl @[simp] -theorem setOf_mem {α} {s : Finset α} : { a | a ∈ s } = s := +theorem setOfPred_mem {α} {s : Finset α} : { a | a ∈ s } = s := rfl +@[deprecated (since := "2026-07-09")] alias setOf_mem := setOfPred_mem + theorem coe_mem {s : Finset α} (x : (s : Set α)) : ↑x ∈ s := x.2 diff --git a/Mathlib/Data/Finset/Empty.lean b/Mathlib/Data/Finset/Empty.lean index d6c6804b82af3e..a5ce831552438d 100644 --- a/Mathlib/Data/Finset/Empty.lean +++ b/Mathlib/Data/Finset/Empty.lean @@ -157,7 +157,8 @@ theorem eq_empty_or_nonempty (s : Finset α) : s = ∅ ∨ s.Nonempty := theorem coe_empty : ((∅ : Finset α) : Set α) = ∅ := by grind @[simp, norm_cast] -theorem coe_eq_empty {s : Finset α} : (s : Set α) = ∅ ↔ s = ∅ := by grind +theorem coe_eq_empty {s : Finset α} : (s : Set α) = ∅ ↔ s = ∅ := by + rw [← coe_empty, coe_inj] @[simp] theorem isEmpty_coe_sort {s : Finset α} : IsEmpty (s : Type _) ↔ s = ∅ := by diff --git a/Mathlib/Data/Finset/Image.lean b/Mathlib/Data/Finset/Image.lean index bb0fd4f4d7885c..2d1a33ad93ed58 100644 --- a/Mathlib/Data/Finset/Image.lean +++ b/Mathlib/Data/Finset/Image.lean @@ -599,7 +599,7 @@ theorem mem_filterMap {b : β} : b ∈ s.filterMap f f_inj ↔ ∃ a ∈ s, f a @[simp, norm_cast] theorem coe_filterMap : (s.filterMap f f_inj : Set β) = {b | ∃ a ∈ s, f a = some b} := - Set.ext (by simp only [mem_coe, mem_filterMap, Set.mem_setOf_eq, implies_true]) + Set.ext (by simp only [mem_coe, mem_filterMap, Set.mem_ofPred_eq, implies_true]) @[simp] theorem filterMap_some : s.filterMap some (by simp) = s := diff --git a/Mathlib/Data/Finset/Insert.lean b/Mathlib/Data/Finset/Insert.lean index fbaa3b4dc10377..4d903713d6cf8f 100644 --- a/Mathlib/Data/Finset/Insert.lean +++ b/Mathlib/Data/Finset/Insert.lean @@ -111,16 +111,19 @@ theorem empty_ssubset_singleton : (∅ : Finset α) ⊂ {a} := (singleton_nonempty _).empty_ssubset @[simp, norm_cast] -theorem coe_singleton (a : α) : (({a} : Finset α) : Set α) = {a} := by grind +theorem coe_singleton (a : α) : (({a} : Finset α) : Set α) = {a} := by ext; simp @[simp, norm_cast] -theorem coe_eq_singleton {s : Finset α} {a : α} : (s : Set α) = {a} ↔ s = {a} := by grind +theorem coe_eq_singleton {s : Finset α} {a : α} : (s : Set α) = {a} ↔ s = {a} := by + rw [← coe_singleton, coe_inj] @[norm_cast] -lemma coe_subset_singleton : (s : Set α) ⊆ {a} ↔ s ⊆ {a} := by grind +lemma coe_subset_singleton : (s : Set α) ⊆ {a} ↔ s ⊆ {a} := by + rw [← coe_singleton, coe_subset] @[norm_cast] -lemma singleton_subset_coe : {a} ⊆ (s : Set α) ↔ {a} ⊆ s := by grind +lemma singleton_subset_coe : {a} ⊆ (s : Set α) ↔ {a} ⊆ s := by + rw [← coe_singleton, coe_subset] theorem eq_singleton_iff_unique_mem {s : Finset α} {a : α} : s = {a} ↔ a ∈ s ∧ ∀ x ∈ s, x = a := by grind diff --git a/Mathlib/Data/Finset/SMulAntidiagonal.lean b/Mathlib/Data/Finset/SMulAntidiagonal.lean index 4067af84dc3013..3449742d2fd2d1 100644 --- a/Mathlib/Data/Finset/SMulAntidiagonal.lean +++ b/Mathlib/Data/Finset/SMulAntidiagonal.lean @@ -73,8 +73,7 @@ noncomputable def SMulAntidiagonal {s : Set G} theorem mem_smulAntidiagonal {s : Set G} {t : Set P} (a : P) (h : (s.smulAntidiagonal t a).Finite) {x : G × P} : x ∈ SMulAntidiagonal a h ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ x.1 • x.2 = a := by - simp only [SMulAntidiagonal, Set.Finite.mem_toFinset] - exact Set.mem_sep_iff + simp [SMulAntidiagonal] @[to_additive] theorem smulAntidiagonal_mono_left {s u : Set G} {t : Set P} (a : P) (h : u ⊆ s) diff --git a/Mathlib/Data/Finset/Sort.lean b/Mathlib/Data/Finset/Sort.lean index 42d098fba84e1b..d3bfef678dcf7e 100644 --- a/Mathlib/Data/Finset/Sort.lean +++ b/Mathlib/Data/Finset/Sort.lean @@ -222,7 +222,7 @@ theorem range_orderEmbOfFin (s : Finset α) {k : ℕ} (h : s.card = k) : simp only [orderEmbOfFin, Set.range_comp ((↑) : _ → α) (s.orderIsoOfFin h), RelEmbedding.coe_trans, Set.image_univ, Finset.orderEmbOfFin, RelIso.range_eq, OrderEmbedding.coe_subtype, OrderIso.coe_toOrderEmbedding, - Subtype.range_coe_subtype, Finset.setOf_mem] + Subtype.range_coe_subtype, Finset.setOfPred_mem] @[simp] theorem image_orderEmbOfFin_univ (s : Finset α) {k : ℕ} (h : s.card = k) : diff --git a/Mathlib/Data/Finsupp/Basic.lean b/Mathlib/Data/Finsupp/Basic.lean index 063fcb3498d22a..7880b59f8472a5 100644 --- a/Mathlib/Data/Finsupp/Basic.lean +++ b/Mathlib/Data/Finsupp/Basic.lean @@ -672,7 +672,7 @@ theorem filter_eq_zero_iff : f.filter p = 0 ↔ ∀ x, p x → f x = 0 := by simp [DFunLike.ext_iff, filter_eq_indicator] theorem filter_eq_self_iff : f.filter p = f ↔ ∀ x, f x ≠ 0 → p x := by - simp only [DFunLike.ext_iff, filter_eq_indicator, Set.indicator_apply_eq_self, Set.mem_setOf_eq, + simp only [DFunLike.ext_iff, filter_eq_indicator, Set.indicator_apply_eq_self, Set.mem_ofPred_eq, not_imp_comm] @[simp] diff --git a/Mathlib/Data/Finsupp/Defs.lean b/Mathlib/Data/Finsupp/Defs.lean index 7e9bf12623e815..9ef32ecee0e264 100644 --- a/Mathlib/Data/Finsupp/Defs.lean +++ b/Mathlib/Data/Finsupp/Defs.lean @@ -349,7 +349,7 @@ theorem support_mapRange_of_injective {e : M → N} (he0 : e 0 = 0) (f : ι → lemma range_mapRange (e : M → N) (he₀ : e 0 = 0) : Set.range (Finsupp.mapRange (α := α) e he₀) = {g | ∀ i, g i ∈ Set.range e} := by ext g - simp only [Set.mem_range, Set.mem_setOf] + simp only [Set.mem_range, Set.mem_ofPred] constructor · grind · intro h diff --git a/Mathlib/Data/Finsupp/Ext.lean b/Mathlib/Data/Finsupp/Ext.lean index e7d14b42f9f12c..fcdbad0d388c47 100644 --- a/Mathlib/Data/Finsupp/Ext.lean +++ b/Mathlib/Data/Finsupp/Ext.lean @@ -17,7 +17,7 @@ These have been moved to their own file to avoid depending on submonoids when de ## Main results -* `Finsupp.add_closure_setOf_eq_single`: `Finsupp` is generated by all the `single`s +* `Finsupp.add_closure_setOfPred_eq_single`: `Finsupp` is generated by all the `single`s * `Finsupp.addHom_ext`: additive homomorphisms that are equal on each `single` are equal everywhere -/ @@ -30,17 +30,20 @@ namespace Finsupp variable [AddZeroClass M] @[simp] -theorem add_closure_setOf_eq_single : +theorem add_closure_setOfPred_eq_single : AddSubmonoid.closure { f : α →₀ M | ∃ a b, f = single a b } = ⊤ := top_unique fun x _hx => Finsupp.induction x (AddSubmonoid.zero_mem _) fun a b _f _ha _hb hf => AddSubmonoid.add_mem _ (AddSubmonoid.subset_closure <| ⟨a, b, rfl⟩) hf +@[deprecated (since := "2026-07-09")] +alias add_closure_setOf_eq_single := add_closure_setOfPred_eq_single + /-- If two additive homomorphisms from `α →₀ M` are equal on each `single a b`, then they are equal. -/ theorem addHom_ext [AddZeroClass N] ⦃f g : (α →₀ M) →+ N⦄ (H : ∀ x y, f (single x y) = g (single x y)) : f = g := by - refine AddMonoidHom.eq_of_eqOn_denseM add_closure_setOf_eq_single ?_ + refine AddMonoidHom.eq_of_eqOn_denseM add_closure_setOfPred_eq_single ?_ rintro _ ⟨x, y, rfl⟩ apply H diff --git a/Mathlib/Data/Fintype/Card.lean b/Mathlib/Data/Fintype/Card.lean index 953def12af2219..2f0aed6add9169 100644 --- a/Mathlib/Data/Fintype/Card.lean +++ b/Mathlib/Data/Fintype/Card.lean @@ -410,7 +410,7 @@ theorem Fintype.card_subtype_compl [Fintype α] (p : α → Prop) [Fintype { x / rw [Fintype.card_of_subtype (Set.toFinset { x | p x }ᶜ), Set.toFinset_compl, Finset.card_compl, Fintype.card_of_subtype] <;> · intro - simp only [Set.mem_toFinset, Set.mem_compl_iff, Set.mem_setOf] + simp only [Set.mem_toFinset, Set.mem_compl_iff, Set.mem_ofPred] theorem Fintype.card_subtype_mono (p q : α → Prop) (h : p ≤ q) [Fintype { x // p x }] [Fintype { x // q x }] : Fintype.card { x // p x } ≤ Fintype.card { x // q x } := diff --git a/Mathlib/Data/Fintype/Sets.lean b/Mathlib/Data/Fintype/Sets.lean index caeec87ea8355f..48eb5e562fdc54 100644 --- a/Mathlib/Data/Fintype/Sets.lean +++ b/Mathlib/Data/Fintype/Sets.lean @@ -176,11 +176,13 @@ theorem toFinset_eq_univ [Fintype α] [Fintype s] : s.toFinset = Finset.univ ↔ rw [← coe_inj, coe_toFinset, coe_univ] @[simp] -theorem toFinset_setOf [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype { x | p x }] : +theorem toFinset_ofPred [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype { x | p x }] : Set.toFinset {x | p x} = Finset.univ.filter p := by ext simp +@[deprecated (since := "2026-07-09")] alias toFinset_setOf := toFinset_ofPred + theorem toFinset_ssubset_univ [Fintype α] {s : Set α} [Fintype s] : s.toFinset ⊂ Finset.univ ↔ s ⊂ univ := by simp diff --git a/Mathlib/Data/Int/GCD.lean b/Mathlib/Data/Int/GCD.lean index e4b2aa4d982941..6cc9051fe51495 100644 --- a/Mathlib/Data/Int/GCD.lean +++ b/Mathlib/Data/Int/GCD.lean @@ -250,8 +250,8 @@ theorem gcd_least_linear {a b : ℤ} (ha : a ≠ 0) : IsLeast { n : ℕ | 0 < n ∧ ∃ x y : ℤ, ↑n = a * x + b * y } (a.gcd b) := by simp_rw [← gcd_dvd_iff] constructor - · simpa [and_true, dvd_refl, Set.mem_setOf_eq] using gcd_pos_of_ne_zero_left b ha - · simp only [lowerBounds, and_imp, Set.mem_setOf_eq] + · simpa [and_true, dvd_refl, Set.mem_ofPred_eq] using gcd_pos_of_ne_zero_left b ha + · simp only [lowerBounds, and_imp, Set.mem_ofPred_eq] exact fun n hn_pos hn => Nat.le_of_dvd hn_pos hn end Int diff --git a/Mathlib/Data/List/Lemmas.lean b/Mathlib/Data/List/Lemmas.lean index 81eee2bc466ca6..7048b465098851 100644 --- a/Mathlib/Data/List/Lemmas.lean +++ b/Mathlib/Data/List/Lemmas.lean @@ -20,17 +20,19 @@ variable {α β γ : Type*} namespace List @[simp] -theorem setOf_mem_eq_empty_iff {l : List α} : { x | x ∈ l } = ∅ ↔ l = [] := +theorem setOfPred_mem_eq_empty_iff {l : List α} : { x | x ∈ l } = ∅ ↔ l = [] := Set.eq_empty_iff_forall_notMem.trans eq_nil_iff_forall_not_mem.symm +@[deprecated (since := "2026-07-09")] alias setOf_mem_eq_empty_iff := setOfPred_mem_eq_empty_iff + theorem injOn_insertIdx_index_of_notMem (l : List α) (x : α) (hx : x ∉ l) : Set.InjOn (fun k => l.insertIdx k x) { n | n ≤ l.length } := by intro n hn m hm h induction l generalizing n m with | nil => - simp_all [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton, length] + simp_all [Set.mem_singleton_iff, Set.ofPred_eq_eq_singleton, length] | cons hd tl IH => - simp only [length, Set.mem_setOf_eq] at hn hm + simp only [length, Set.mem_ofPred_eq] at hn hm simp only [mem_cons, not_or] at hx cases n <;> cases m · rfl diff --git a/Mathlib/Data/List/Sym.lean b/Mathlib/Data/List/Sym.lean index fa67929e4b5a83..70100756c7c389 100644 --- a/Mathlib/Data/List/Sym.lean +++ b/Mathlib/Data/List/Sym.lean @@ -96,10 +96,12 @@ theorem mem_sym2_iff {xs : List α} {z : Sym2 α} : refine z.ind (fun a b => ?_) simp [mk_mem_sym2_iff] -lemma setOf_mem_sym2 {xs : List α} : +lemma setOfPred_mem_sym2 {xs : List α} : {z : Sym2 α | z ∈ xs.sym2} = {x : α | x ∈ xs}.sym2 := Set.ext fun z ↦ z.ind fun a b => by simp [mk_mem_sym2_iff] +@[deprecated (since := "2026-07-09")] alias setOf_mem_sym2 := setOfPred_mem_sym2 + protected theorem Nodup.sym2 {xs : List α} (h : xs.Nodup) : xs.sym2.Nodup := by induction xs with | nil => simp only [List.sym2, nodup_nil] diff --git a/Mathlib/Data/Multiset/Fintype.lean b/Mathlib/Data/Multiset/Fintype.lean index 86bbabe5f518f5..ca294f3c800ab8 100644 --- a/Mathlib/Data/Multiset/Fintype.lean +++ b/Mathlib/Data/Multiset/Fintype.lean @@ -86,7 +86,7 @@ instance : Fintype { p : α × ℕ | p.2 < m.count p.1 } := (by rintro ⟨x, i⟩ simp_rw [Finset.mem_disjiUnion, Multiset.mem_toFinset, Finset.mem_map, Finset.mem_range, - Function.Embedding.coeFn_mk, Prod.mk_inj, Set.mem_setOf_eq] + Function.Embedding.coeFn_mk, Prod.mk_inj, Set.mem_ofPred_eq] simp only [← and_assoc, exists_eq_right, and_iff_right_iff_imp] exact fun h ↦ Multiset.count_pos.mp (by lia)) diff --git a/Mathlib/Data/Multiset/Sym.lean b/Mathlib/Data/Multiset/Sym.lean index fe557531e167ba..624e6d49e4974b 100644 --- a/Mathlib/Data/Multiset/Sym.lean +++ b/Mathlib/Data/Multiset/Sym.lean @@ -70,10 +70,12 @@ theorem mem_sym2_iff {m : Multiset α} {z : Sym2 α} : z ∈ m.sym2 ↔ ∀ y ∈ z, y ∈ m := m.inductionOn fun xs => by simp [List.mem_sym2_iff] -lemma setOf_mem_sym2 {m : Multiset α} : +lemma setOfPred_mem_sym2 {m : Multiset α} : {z : Sym2 α | z ∈ m.sym2} = {x : α | x ∈ m}.sym2 := Set.ext fun z ↦ z.ind fun a b => by simp [mk_mem_sym2_iff] +@[deprecated (since := "2026-07-09")] alias setOf_mem_sym2 := setOfPred_mem_sym2 + protected theorem Nodup.sym2 {m : Multiset α} (h : m.Nodup) : m.sym2.Nodup := m.inductionOn (fun _ h => List.Nodup.sym2 h) h diff --git a/Mathlib/Data/NNReal/Basic.lean b/Mathlib/Data/NNReal/Basic.lean index 06bdfc1b60931d..42a3cf66a74f4d 100644 --- a/Mathlib/Data/NNReal/Basic.lean +++ b/Mathlib/Data/NNReal/Basic.lean @@ -237,7 +237,7 @@ section rify end rify @[simp] -theorem range_coe : range toReal = Ici 0 := Subtype.range_coe +theorem range_coe : range toReal = Ici 0 := Subtype.range_coe_subtype @[simp] theorem image_coe_Ici (x : ℝ≥0) : toReal '' Ici x = Ici ↑x := image_subtype_val_Ici_Ici .. diff --git a/Mathlib/Data/Nat/Count.lean b/Mathlib/Data/Nat/Count.lean index 3e7c42de143f4e..bf87e54d30f5c5 100644 --- a/Mathlib/Data/Nat/Count.lean +++ b/Mathlib/Data/Nat/Count.lean @@ -108,11 +108,11 @@ theorem count_injective {m n : ℕ} (hm : p m) (hn : p n) (heq : count p m = cou · exact this hn hm heq.symm h.symm (by grind) · simpa [heq] using count_strict_mono hm hmn -theorem count_le_card (hp : (setOf p).Finite) (n : ℕ) : count p n ≤ #hp.toFinset := by +theorem count_le_card (hp : (Set.ofPred p).Finite) (n : ℕ) : count p n ≤ #hp.toFinset := by rw [count_eq_card_filter_range] exact Finset.card_mono fun x hx ↦ hp.mem_toFinset.2 (mem_filter.1 hx).2 -theorem count_lt_card {n : ℕ} (hp : (setOf p).Finite) (hpn : p n) : count p n < #hp.toFinset := +theorem count_lt_card {n : ℕ} (hp : (Set.ofPred p).Finite) (hpn : p n) : count p n < #hp.toFinset := (count_lt_count_succ_iff.2 hpn).trans_le (count_le_card hp _) theorem count_iff_forall {n : ℕ} : count p n = n ↔ ∀ n' < n, p n' := by diff --git a/Mathlib/Data/Nat/Digits/Lemmas.lean b/Mathlib/Data/Nat/Digits/Lemmas.lean index b0ed2f0f1f05e1..3dfdcc873dd7b9 100644 --- a/Mathlib/Data/Nat/Digits/Lemmas.lean +++ b/Mathlib/Data/Nat/Digits/Lemmas.lean @@ -350,7 +350,7 @@ theorem lt_of_mem_digitsAppend {b : ℕ} (hb : 1 < b) (l i : ℕ) theorem mapsTo_ofDigits {b : ℕ} (hb : 1 < b) (l : ℕ) : Set.MapsTo (ofDigits b) {L : List ℕ | L.length = l ∧ ∀ x ∈ L, x < b} {n | n < b ^ l} := - fun _ h ↦ Set.mem_setOf.mpr h.1 ▸ Nat.ofDigits_lt_base_pow_length hb h.2 + fun _ h ↦ Set.mem_ofPred.mpr h.1 ▸ Nat.ofDigits_lt_base_pow_length hb h.2 theorem mapsTo_digitsAppend {b : ℕ} (hb : 1 < b) (l : ℕ) : Set.MapsTo (digitsAppend b l) {n | n < b ^ l} {L : List ℕ | L.length = l ∧ ∀ x ∈ L, x < b} := @@ -420,9 +420,8 @@ This spelling can be helpful for some proofs. -/ theorem _root_.Nat.bijOn_ofDigits' {b : ℕ} (hb : 1 < b) (l : ℕ) : Set.BijOn (ofDigits b) (fixedLengthDigits hb l) (Finset.range (b ^ l)) := by - rw [fixedLengthDigits, Set.coe_toFinset] - convert! bijOn_ofDigits hb l - ext; simp + rw [fixedLengthDigits, Set.coe_toFinset, Finset.coe_range] + exact bijOn_ofDigits hb l /-- The bijection `Nat.bijOn_digitsAppend` stated as a bijection between `Finset`. @@ -430,9 +429,8 @@ This spelling can be helpful for some proofs. -/ theorem _root_.Nat.bijOn_digitsAppend' {b : ℕ} (hb : 1 < b) (l : ℕ) : Set.BijOn (digitsAppend b l) (Finset.range (b ^ l)) (fixedLengthDigits hb l) := by - rw [fixedLengthDigits, Set.coe_toFinset] - convert! bijOn_digitsAppend hb l - ext; simp + rw [fixedLengthDigits, Set.coe_toFinset, Finset.coe_range] + exact bijOn_digitsAppend hb l @[simp] theorem fixedLengthDigits_zero {b : ℕ} (hb : 1 < b) : diff --git a/Mathlib/Data/Nat/Factorization/Basic.lean b/Mathlib/Data/Nat/Factorization/Basic.lean index ef73fda01a634c..754d9c2792659f 100644 --- a/Mathlib/Data/Nat/Factorization/Basic.lean +++ b/Mathlib/Data/Nat/Factorization/Basic.lean @@ -387,11 +387,14 @@ theorem prod_primeFactors_gcd_mul_prod_primeFactors_mul {β : Type*} [CommMonoid · simp · rw [primeFactors_mul hm₀ hn₀, primeFactors_gcd hm₀ hn₀, mul_comm, Finset.prod_union_inter] -theorem setOf_pow_dvd_eq_Icc_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) : +theorem setOfPred_pow_dvd_eq_Icc_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) : { i : ℕ | i ≠ 0 ∧ p ^ i ∣ n } = Set.Icc 1 (n.factorization p) := by ext simp [one_le_iff_ne_zero, pp.pow_dvd_iff_le_factorization hn] +@[deprecated (since := "2026-07-09")] +alias setOf_pow_dvd_eq_Icc_factorization := setOfPred_pow_dvd_eq_Icc_factorization + /-- The set of positive powers of prime `p` that divide `n` is exactly the set of positive natural numbers up to `n.factorization p`. -/ theorem Icc_factorization_eq_pow_dvd (n : ℕ) {p : ℕ} (pp : Prime p) : diff --git a/Mathlib/Data/Nat/Nth.lean b/Mathlib/Data/Nat/Nth.lean index 11e306887a5938..76de58841269a7 100644 --- a/Mathlib/Data/Nat/Nth.lean +++ b/Mathlib/Data/Nat/Nth.lean @@ -35,7 +35,7 @@ and provides lemmas that deal with this function and its connection to `Nat.coun ## Implementation details Much of the below was written before `Set.encard` existed and partly for this reason uses the -pattern `∀ hf : Set.Finite (setOf p), n < hf.toFinset.card` rather than `n < {x | p x}.encard`. +pattern `∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card` rather than `n < {x | p x}.encard`. We should consider changing this. There has been some discussion on the subject of whether both of `nth` and @@ -59,8 +59,8 @@ natural number satisfying `p`), or `0` if there is no such number. See also `Subtype.orderIsoOfNat` for the order isomorphism with ℕ when `p` is infinitely often true. -/ noncomputable def nth (p : ℕ → Prop) (n : ℕ) : ℕ := by classical exact - if h : Set.Finite (setOf p) then h.toFinset.sort.getD n 0 - else @Nat.Subtype.orderIsoOfNat (setOf p) (Set.Infinite.to_subtype h) n + if h : Set.Finite (Set.ofPred p) then h.toFinset.sort.getD n 0 + else @Nat.Subtype.orderIsoOfNat (Set.ofPred p) (Set.Infinite.to_subtype h) n variable {p} @@ -69,98 +69,101 @@ variable {p} -/ -theorem nth_of_card_le (hf : (setOf p).Finite) {n : ℕ} (hn : #hf.toFinset ≤ n) : +theorem nth_of_card_le (hf : (Set.ofPred p).Finite) {n : ℕ} (hn : #hf.toFinset ≤ n) : nth p n = 0 := by rw [nth, dif_pos hf, List.getD_eq_default]; rwa [Finset.length_sort] -theorem nth_eq_getD_sort (h : (setOf p).Finite) (n : ℕ) : +theorem nth_eq_getD_sort (h : (Set.ofPred p).Finite) (n : ℕ) : nth p n = h.toFinset.sort.getD n 0 := dif_pos h -theorem nth_eq_orderEmbOfFin (hf : (setOf p).Finite) {n : ℕ} (hn : n < #hf.toFinset) : +theorem nth_eq_orderEmbOfFin (hf : (Set.ofPred p).Finite) {n : ℕ} (hn : n < #hf.toFinset) : nth p n = hf.toFinset.orderEmbOfFin rfl ⟨n, hn⟩ := by rw [nth_eq_getD_sort hf, Finset.orderEmbOfFin_apply, List.getD_eq_getElem, Fin.getElem_fin] -theorem nth_strictMonoOn (hf : (setOf p).Finite) : +theorem nth_strictMonoOn (hf : (Set.ofPred p).Finite) : StrictMonoOn (nth p) (Set.Iio #hf.toFinset) := by rintro m (hm : m < _) n (hn : n < _) h simp only [nth_eq_orderEmbOfFin, *] exact OrderEmbedding.strictMono _ h -theorem nth_lt_nth_of_lt_card (hf : (setOf p).Finite) {m n : ℕ} (h : m < n) +theorem nth_lt_nth_of_lt_card (hf : (Set.ofPred p).Finite) {m n : ℕ} (h : m < n) (hn : n < #hf.toFinset) : nth p m < nth p n := nth_strictMonoOn hf (h.trans hn) hn h -theorem nth_le_nth_of_lt_card (hf : (setOf p).Finite) {m n : ℕ} (h : m ≤ n) +theorem nth_le_nth_of_lt_card (hf : (Set.ofPred p).Finite) {m n : ℕ} (h : m ≤ n) (hn : n < #hf.toFinset) : nth p m ≤ nth p n := (nth_strictMonoOn hf).monotoneOn (h.trans_lt hn) hn h -theorem lt_of_nth_lt_nth_of_lt_card (hf : (setOf p).Finite) {m n : ℕ} (h : nth p m < nth p n) +theorem lt_of_nth_lt_nth_of_lt_card (hf : (Set.ofPred p).Finite) {m n : ℕ} (h : nth p m < nth p n) (hm : m < #hf.toFinset) : m < n := not_le.1 fun hle => h.not_ge <| nth_le_nth_of_lt_card hf hle hm -theorem le_of_nth_le_nth_of_lt_card (hf : (setOf p).Finite) {m n : ℕ} (h : nth p m ≤ nth p n) +theorem le_of_nth_le_nth_of_lt_card (hf : (Set.ofPred p).Finite) {m n : ℕ} (h : nth p m ≤ nth p n) (hm : m < #hf.toFinset) : m ≤ n := not_lt.1 fun hlt => h.not_gt <| nth_lt_nth_of_lt_card hf hlt hm -theorem nth_injOn (hf : (setOf p).Finite) : (Set.Iio #hf.toFinset).InjOn (nth p) := +theorem nth_injOn (hf : (Set.ofPred p).Finite) : (Set.Iio #hf.toFinset).InjOn (nth p) := (nth_strictMonoOn hf).injOn -theorem range_nth_of_finite (hf : (setOf p).Finite) : Set.range (nth p) = insert 0 (setOf p) := by +theorem range_nth_of_finite (hf : (Set.ofPred p).Finite) : + Set.range (nth p) = insert 0 (Set.ofPred p) := by simpa only [← List.getD_eq_getElem?_getD, ← nth_eq_getD_sort hf, mem_sort, Set.Finite.mem_toFinset] using! Set.range_list_getD (hf.toFinset.sort (· ≤ ·)) 0 @[simp] -theorem image_nth_Iio_card (hf : (setOf p).Finite) : nth p '' Set.Iio #hf.toFinset = setOf p := +theorem image_nth_Iio_card (hf : (Set.ofPred p).Finite) : + nth p '' Set.Iio #hf.toFinset = Set.ofPred p := calc nth p '' Set.Iio #hf.toFinset = Set.range (hf.toFinset.orderEmbOfFin rfl) := by ext x simp only [Set.mem_image, Set.mem_range, Fin.exists_iff, ← nth_eq_orderEmbOfFin hf, Set.mem_Iio, exists_prop] - _ = setOf p := by rw [range_orderEmbOfFin, Set.Finite.coe_toFinset] + _ = Set.ofPred p := by rw [range_orderEmbOfFin, Set.Finite.coe_toFinset] -theorem nth_mem_of_lt_card {n : ℕ} (hf : (setOf p).Finite) (hlt : n < #hf.toFinset) : +theorem nth_mem_of_lt_card {n : ℕ} (hf : (Set.ofPred p).Finite) (hlt : n < #hf.toFinset) : p (nth p n) := (image_nth_Iio_card hf).subset <| Set.mem_image_of_mem _ hlt -theorem exists_lt_card_finite_nth_eq (hf : (setOf p).Finite) {x} (h : p x) : +theorem exists_lt_card_finite_nth_eq (hf : (Set.ofPred p).Finite) {x} (h : p x) : ∃ n, n < #hf.toFinset ∧ nth p n = x := by - rwa [← @Set.mem_setOf_eq _ _ p, ← image_nth_Iio_card hf] at h + rwa [← @Set.mem_ofPred_eq _ _ p, ← image_nth_Iio_card hf] at h /-! ### Lemmas about `Nat.nth` on an infinite set -/ /-- When `s` is an infinite set, `nth` agrees with `Nat.Subtype.orderIsoOfNat`. -/ -theorem nth_apply_eq_orderIsoOfNat (hf : (setOf p).Infinite) (n : ℕ) : - nth p n = @Nat.Subtype.orderIsoOfNat (setOf p) hf.to_subtype n := by rw [nth, dif_neg hf] +theorem nth_apply_eq_orderIsoOfNat (hf : (Set.ofPred p).Infinite) (n : ℕ) : + nth p n = @Nat.Subtype.orderIsoOfNat (Set.ofPred p) hf.to_subtype n := by rw [nth, dif_neg hf] /-- When `s` is an infinite set, `nth` agrees with `Nat.Subtype.orderIsoOfNat`. -/ -theorem nth_eq_orderIsoOfNat (hf : (setOf p).Infinite) : - nth p = (↑) ∘ @Nat.Subtype.orderIsoOfNat (setOf p) hf.to_subtype := +theorem nth_eq_orderIsoOfNat (hf : (Set.ofPred p).Infinite) : + nth p = (↑) ∘ @Nat.Subtype.orderIsoOfNat (Set.ofPred p) hf.to_subtype := funext <| nth_apply_eq_orderIsoOfNat hf -theorem nth_strictMono (hf : (setOf p).Infinite) : StrictMono (nth p) := by +theorem nth_strictMono (hf : (Set.ofPred p).Infinite) : StrictMono (nth p) := by rw [nth_eq_orderIsoOfNat hf] exact (Subtype.strictMono_coe _).comp (OrderIso.strictMono _) -theorem nth_injective (hf : (setOf p).Infinite) : Function.Injective (nth p) := +theorem nth_injective (hf : (Set.ofPred p).Infinite) : Function.Injective (nth p) := (nth_strictMono hf).injective -theorem nth_monotone (hf : (setOf p).Infinite) : Monotone (nth p) := +theorem nth_monotone (hf : (Set.ofPred p).Infinite) : Monotone (nth p) := (nth_strictMono hf).monotone -theorem nth_lt_nth (hf : (setOf p).Infinite) {k n} : nth p k < nth p n ↔ k < n := +theorem nth_lt_nth (hf : (Set.ofPred p).Infinite) {k n} : nth p k < nth p n ↔ k < n := (nth_strictMono hf).lt_iff_lt -theorem nth_le_nth (hf : (setOf p).Infinite) {k n} : nth p k ≤ nth p n ↔ k ≤ n := +theorem nth_le_nth (hf : (Set.ofPred p).Infinite) {k n} : nth p k ≤ nth p n ↔ k ≤ n := (nth_strictMono hf).le_iff_le -theorem range_nth_of_infinite (hf : (setOf p).Infinite) : Set.range (nth p) = setOf p := by +theorem range_nth_of_infinite (hf : (Set.ofPred p).Infinite) : + Set.range (nth p) = Set.ofPred p := by rw [nth_eq_orderIsoOfNat hf] haveI := hf.to_subtype classical exact Nat.Subtype.coe_comp_ofNat_range -theorem nth_mem_of_infinite (hf : (setOf p).Infinite) (n : ℕ) : p (nth p n) := +theorem nth_mem_of_infinite (hf : (Set.ofPred p).Infinite) (n : ℕ) : p (nth p n) := Set.range_subset_iff.1 (range_nth_of_infinite hf).le n /-! @@ -168,52 +171,52 @@ theorem nth_mem_of_infinite (hf : (setOf p).Infinite) (n : ℕ) : p (nth p n) := -/ theorem exists_lt_card_nth_eq {x} (h : p x) : - ∃ n, (∀ hf : (setOf p).Finite, n < #hf.toFinset) ∧ nth p n = x := by - refine (setOf p).finite_or_infinite.elim (fun hf => ?_) fun hf => ?_ + ∃ n, (∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) ∧ nth p n = x := by + refine (Set.ofPred p).finite_or_infinite.elim (fun hf => ?_) fun hf => ?_ · rcases exists_lt_card_finite_nth_eq hf h with ⟨n, hn, hx⟩ exact ⟨n, fun _ => hn, hx⟩ - · rw [← @Set.mem_setOf_eq _ _ p, ← range_nth_of_infinite hf] at h + · rw [← @Set.mem_ofPred_eq _ _ p, ← range_nth_of_infinite hf] at h rcases h with ⟨n, hx⟩ exact ⟨n, fun hf' => absurd hf' hf, hx⟩ -theorem subset_range_nth : setOf p ⊆ Set.range (nth p) := fun x (hx : p x) => +theorem subset_range_nth : Set.ofPred p ⊆ Set.range (nth p) := fun x (hx : p x) => let ⟨n, _, hn⟩ := exists_lt_card_nth_eq hx ⟨n, hn⟩ -theorem range_nth_subset : Set.range (nth p) ⊆ insert 0 (setOf p) := - (setOf p).finite_or_infinite.elim (fun h => (range_nth_of_finite h).subset) fun h => +theorem range_nth_subset : Set.range (nth p) ⊆ insert 0 (Set.ofPred p) := + (Set.ofPred p).finite_or_infinite.elim (fun h => (range_nth_of_finite h).subset) fun h => (range_nth_of_infinite h).trans_subset (Set.subset_insert _ _) -theorem nth_mem (n : ℕ) (h : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : p (nth p n) := - (setOf p).finite_or_infinite.elim (fun hf => nth_mem_of_lt_card hf (h hf)) fun h => +theorem nth_mem (n : ℕ) (h : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : p (nth p n) := + (Set.ofPred p).finite_or_infinite.elim (fun hf => nth_mem_of_lt_card hf (h hf)) fun h => nth_mem_of_infinite h n -theorem nth_lt_nth' {m n : ℕ} (hlt : m < n) (h : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : +theorem nth_lt_nth' {m n : ℕ} (hlt : m < n) (h : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : nth p m < nth p n := - (setOf p).finite_or_infinite.elim (fun hf => nth_lt_nth_of_lt_card hf hlt (h _)) fun hf => + (Set.ofPred p).finite_or_infinite.elim (fun hf => nth_lt_nth_of_lt_card hf hlt (h _)) fun hf => (nth_lt_nth hf).2 hlt -theorem nth_le_nth' {m n : ℕ} (hle : m ≤ n) (h : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : +theorem nth_le_nth' {m n : ℕ} (hle : m ≤ n) (h : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : nth p m ≤ nth p n := - (setOf p).finite_or_infinite.elim (fun hf => nth_le_nth_of_lt_card hf hle (h _)) fun hf => + (Set.ofPred p).finite_or_infinite.elim (fun hf => nth_le_nth_of_lt_card hf hle (h _)) fun hf => (nth_le_nth hf).2 hle -theorem le_nth {n : ℕ} (h : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : n ≤ nth p n := - (setOf p).finite_or_infinite.elim +theorem le_nth {n : ℕ} (h : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : n ≤ nth p n := + (Set.ofPred p).finite_or_infinite.elim (fun hf => ((nth_strictMonoOn hf).mono <| Set.Iic_subset_Iio.2 (h _)).Iic_id_le _ le_rfl) fun hf => (nth_strictMono hf).id_le _ -theorem isLeast_nth {n} (h : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : +theorem isLeast_nth {n} (h : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : IsLeast {i | p i ∧ ∀ k < n, nth p k < i} (nth p n) := ⟨⟨nth_mem n h, fun _k hk => nth_lt_nth' hk h⟩, fun _x hx => let ⟨k, hk, hkx⟩ := exists_lt_card_nth_eq hx.1 (lt_or_ge k n).elim (fun hlt => absurd hkx (hx.2 _ hlt).ne) fun hle => hkx ▸ nth_le_nth' hle hk⟩ -theorem isLeast_nth_of_lt_card {n : ℕ} (hf : (setOf p).Finite) (hn : n < #hf.toFinset) : +theorem isLeast_nth_of_lt_card {n : ℕ} (hf : (Set.ofPred p).Finite) (hn : n < #hf.toFinset) : IsLeast {i | p i ∧ ∀ k < n, nth p k < i} (nth p n) := isLeast_nth fun _ => hn -theorem isLeast_nth_of_infinite (hf : (setOf p).Infinite) (n : ℕ) : +theorem isLeast_nth_of_infinite (hf : (Set.ofPred p).Infinite) (n : ℕ) : IsLeast {i | p i ∧ ∀ k < n, nth p k < i} (nth p n) := isLeast_nth fun h => absurd h hf @@ -222,7 +225,7 @@ that `Nat.nth s k < x` for all `k < n`, if this set is nonempty. We do not assum nonempty because we use the same "garbage value" `0` both for `sInf` on `ℕ` and for `Nat.nth s n` for `n ≥ #s`. -/ theorem nth_eq_sInf (p : ℕ → Prop) (n : ℕ) : nth p n = sInf {x | p x ∧ ∀ k < n, nth p k < x} := by - by_cases! hn : ∀ hf : (setOf p).Finite, n < #hf.toFinset + by_cases! hn : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset · exact (isLeast_nth hn).csInf_eq.symm · rcases hn with ⟨hf, hn⟩ rw [nth_of_card_le _ hn] @@ -230,7 +233,7 @@ theorem nth_eq_sInf (p : ℕ → Prop) (n : ℕ) : nth p n = sInf {x | p x ∧ rcases exists_lt_card_nth_eq hk.1 with ⟨k, hlt, rfl⟩ exact (hk.2 _ ((hlt hf).trans_le hn)).false -theorem nth_zero : nth p 0 = sInf (setOf p) := by rw [nth_eq_sInf]; simp +theorem nth_zero : nth p 0 = sInf (Set.ofPred p) := by rw [nth_eq_sInf]; simp @[simp] theorem nth_zero_of_zero (h : p 0) : nth p 0 = 0 := by simp [nth_zero, h] @@ -239,14 +242,14 @@ theorem nth_zero_of_exists [DecidablePred p] (h : ∃ n, p n) : nth p 0 = Nat.fi rw [nth_zero]; convert! Nat.sInf_def h theorem nth_eq_zero {n} : - nth p n = 0 ↔ p 0 ∧ n = 0 ∨ ∃ hf : (setOf p).Finite, #hf.toFinset ≤ n := by + nth p n = 0 ↔ p 0 ∧ n = 0 ∨ ∃ hf : (Set.ofPred p).Finite, #hf.toFinset ≤ n := by refine ⟨fun h => ?_, ?_⟩ · simp only [or_iff_not_imp_right, not_exists, not_le] exact fun hn => ⟨h ▸ nth_mem _ hn, nonpos_iff_eq_zero.1 <| h ▸ le_nth hn⟩ · rintro (⟨h₀, rfl⟩ | ⟨hf, hle⟩) exacts [nth_zero_of_zero h₀, nth_of_card_le hf hle] -lemma lt_card_toFinset_of_nth_ne_zero {n : ℕ} (h : nth p n ≠ 0) (hf : (setOf p).Finite) : +lemma lt_card_toFinset_of_nth_ne_zero {n : ℕ} (h : nth p n ≠ 0) (hf : (Set.ofPred p).Finite) : n < #hf.toFinset := by simp only [ne_eq, nth_eq_zero, not_or, not_exists, not_le] at h exact h.2 hf @@ -262,7 +265,7 @@ lemma nth_ne_zero_anti (h₀ : ¬p 0) {a b : ℕ} (hab : a ≤ b) (hb : nth p b mt (nth_eq_zero_mono h₀ hab) hb theorem le_nth_of_lt_nth_succ {k a : ℕ} (h : a < nth p (k + 1)) (ha : p a) : a ≤ nth p k := by - rcases (setOf p).finite_or_infinite with hf | hf + rcases (Set.ofPred p).finite_or_infinite with hf | hf · rcases exists_lt_card_finite_nth_eq hf ha with ⟨n, hn, rfl⟩ rcases lt_or_ge (k + 1) #hf.toFinset with hk | hk · rwa [(nth_strictMonoOn hf).lt_iff_lt hn hk, Nat.lt_succ_iff, @@ -273,10 +276,10 @@ theorem le_nth_of_lt_nth_succ {k a : ℕ} (h : a < nth p (k + 1)) (ha : p a) : a rwa [nth_lt_nth hf, Nat.lt_succ_iff, ← nth_le_nth hf] at h lemma nth_mem_anti {a b : ℕ} (hab : a ≤ b) (h : p (nth p b)) : p (nth p a) := by - by_cases h' : ∀ hf : (setOf p).Finite, a < #hf.toFinset + by_cases h' : ∀ hf : (Set.ofPred p).Finite, a < #hf.toFinset · exact nth_mem a h' · simp only [not_forall, not_lt] at h' - have h'b : ∃ hf : (setOf p).Finite, #hf.toFinset ≤ b := by + have h'b : ∃ hf : (Set.ofPred p).Finite, #hf.toFinset ≤ b := by rcases h' with ⟨hf, ha⟩ exact ⟨hf, ha.trans hab⟩ have ha0 : nth p a = 0 := by simp [nth_eq_zero, h'] @@ -284,12 +287,15 @@ lemma nth_mem_anti {a b : ℕ} (hab : a ≤ b) (h : p (nth p b)) : p (nth p a) : rw [ha0] rwa [hb0] at h -/-- `Nat.nth p` is the least strictly monotone function whose image is contained in `setOf p` -/ +/-- `Nat.nth p` is the least strictly monotone function whose image is contained in +`Set.ofPred p` -/ lemma nth_le_of_strictMonoOn_of_mapsTo {p : ℕ → Prop} (f : ℕ → ℕ) - (hmaps : Set.MapsTo f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card } (setOf p)) - (hmono : StrictMonoOn f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card }) {n : ℕ} : + (hmaps : Set.MapsTo f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card } + (Set.ofPred p)) + (hmono : StrictMonoOn f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card }) + {n : ℕ} : nth p n ≤ f n := by - by_cases! hn : (∀ hf : Set.Finite (setOf p), n < hf.toFinset.card) + by_cases! hn : (∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card) · induction n using Nat.strong_induction_on with | _ n ih => rw [nth_eq_sInf] refine csInf_le (by simp) ⟨hmaps hn, fun k hk => ?_⟩ @@ -299,11 +305,13 @@ lemma nth_le_of_strictMonoOn_of_mapsTo {p : ℕ → Prop} (f : ℕ → ℕ) rw [nth, dif_pos hf, List.getD_eq_default _ _ (by simp [hn])] exact Nat.zero_le _ -/-- `Nat.nth p` is the greatest monotone function whose image contains `setOf p`. -/ +/-- `Nat.nth p` is the greatest monotone function whose image contains `Set.ofPred p`. -/ lemma le_nth_of_monotoneOn_of_surjOn {p : ℕ → Prop} (f : ℕ → ℕ) - (hsurj : Set.SurjOn f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card } (setOf p)) - (hmono : MonotoneOn f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card }) {n : ℕ} - (hn : ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card) : f n ≤ nth p n := by + (hsurj : Set.SurjOn f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card } + (Set.ofPred p)) + (hmono : MonotoneOn f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card }) + {n : ℕ} + (hn : ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card) : f n ≤ nth p n := by induction n with | zero => rw [Nat.nth_zero] @@ -321,21 +329,23 @@ lemma le_nth_of_monotoneOn_of_surjOn {p : ℕ → Prop} (f : ℕ → ℕ) rw [Nat.succ_le_iff] apply hmono.reflect_lt <;> grind -/-- `Nat.nth p` is the unique strictly monotone function whose image is `setOf p`. -/ +/-- `Nat.nth p` is the unique strictly monotone function whose image is `Set.ofPred p`. -/ lemma eq_nth_of_strictMonoOn_of_mapsTo_of_surjOn {p : ℕ → Prop} (f : ℕ → ℕ) - (hsurj : Set.SurjOn f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card } (setOf p)) - (hmaps : Set.MapsTo f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card } (setOf p)) - (hmono : StrictMonoOn f { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card }) : - Set.EqOn f (nth p) { n : ℕ | ∀ hf : Set.Finite (setOf p), n < hf.toFinset.card } := + (hsurj : Set.SurjOn f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card } + (Set.ofPred p)) + (hmaps : Set.MapsTo f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card } + (Set.ofPred p)) + (hmono : StrictMonoOn f { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card }) : + Set.EqOn f (nth p) { n : ℕ | ∀ hf : Set.Finite (Set.ofPred p), n < hf.toFinset.card } := fun _ hi => le_antisymm (Nat.le_nth_of_monotoneOn_of_surjOn _ hsurj hmono.monotoneOn hi) (Nat.nth_le_of_strictMonoOn_of_mapsTo _ hmaps hmono) lemma nth_comp_of_strictMono {n : ℕ} {f : ℕ → ℕ} (hf : StrictMono f) - (h0 : ∀ k, p k → k ∈ Set.range f) (h : ∀ hfi : (setOf p).Finite, n < hfi.toFinset.card) : + (h0 : ∀ k, p k → k ∈ Set.range f) (h : ∀ hfi : (Set.ofPred p).Finite, n < hfi.toFinset.card) : f (nth (fun i ↦ p (f i)) n) = nth p n := by have hs {p' : ℕ → Prop} (h0p' : ∀ k, p' k → k ∈ Set.range f) : - f '' {i | p' (f i)} = setOf p' := by + f '' {i | p' (f i)} = Set.ofPred p' := by ext i refine ⟨fun ⟨_, hi, h⟩ ↦ h ▸ hi, fun he ↦ ?_⟩ rcases h0p' _ he with ⟨t, rfl⟩ @@ -346,7 +356,7 @@ lemma nth_comp_of_strictMono {n : ℕ} {f : ℕ → ℕ} (hf : StrictMono f) replace h := nth_mem _ h rw [← hs h0, ← hf.monotone.map_csInf] rcases h0 _ h with ⟨t, ht⟩ - exact ⟨t, Set.mem_setOf_eq ▸ ht ▸ h⟩ + exact ⟨t, Set.mem_ofPred_eq ▸ ht ▸ h⟩ case _ n ih => repeat nth_rw 1 [nth_eq_sInf] have h0' : ∀ k', (p k' ∧ ∀ k < n + 1, nth p k < k') → k' ∈ Set.range f := fun _ h ↦ h0 _ h.1 @@ -396,7 +406,7 @@ theorem filter_range_nth_subset_insert (k : ℕ) : variable {p} theorem filter_range_nth_eq_insert {k : ℕ} - (hlt : ∀ hf : (setOf p).Finite, k + 1 < #hf.toFinset) : + (hlt : ∀ hf : (Set.ofPred p).Finite, k + 1 < #hf.toFinset) : {n ∈ range (nth p (k + 1)) | p n} = insert (nth p k) {n ∈ range (nth p k) | p n} := by refine (filter_range_nth_subset_insert p k).antisymm fun a ha => ?_ simp only [mem_insert, mem_filter, mem_range] at ha ⊢ @@ -405,16 +415,16 @@ theorem filter_range_nth_eq_insert {k : ℕ} · exact ⟨this, nth_mem _ fun hf => k.lt_succ_self.trans (hlt hf)⟩ · exact ⟨hlt.trans this, hpa⟩ -theorem filter_range_nth_eq_insert_of_finite (hf : (setOf p).Finite) {k : ℕ} +theorem filter_range_nth_eq_insert_of_finite (hf : (Set.ofPred p).Finite) {k : ℕ} (hlt : k + 1 < #hf.toFinset) : {n ∈ range (nth p (k + 1)) | p n} = insert (nth p k) {n ∈ range (nth p k) | p n} := filter_range_nth_eq_insert fun _ => hlt -theorem filter_range_nth_eq_insert_of_infinite (hp : (setOf p).Infinite) (k : ℕ) : +theorem filter_range_nth_eq_insert_of_infinite (hp : (Set.ofPred p).Infinite) (k : ℕ) : {n ∈ range (nth p (k + 1)) | p n} = insert (nth p k) {n ∈ range (nth p k) | p n} := filter_range_nth_eq_insert fun hf => absurd hf hp -theorem count_nth {n : ℕ} (hn : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : +theorem count_nth {n : ℕ} (hn : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : count p (nth p n) = n := by induction n with | zero => exact count_nth_zero _ @@ -423,27 +433,30 @@ theorem count_nth {n : ℕ} (hn : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : ← count_eq_card_filter_range, ihk fun hf => lt_of_succ_lt (hn hf)] simp -theorem count_nth_of_lt_card_finite {n : ℕ} (hp : (setOf p).Finite) (hlt : n < #hp.toFinset) : +theorem count_nth_of_lt_card_finite {n : ℕ} (hp : (Set.ofPred p).Finite) (hlt : n < #hp.toFinset) : count p (nth p n) = n := count_nth fun _ => hlt -theorem count_nth_of_infinite (hp : (setOf p).Infinite) (n : ℕ) : count p (nth p n) = n := +theorem count_nth_of_infinite (hp : (Set.ofPred p).Infinite) (n : ℕ) : count p (nth p n) = n := count_nth fun hf => absurd hf hp -theorem surjective_count_of_infinite_setOf (h : {n | p n}.Infinite) : +theorem surjective_count_of_infinite_setOfPred (h : {n | p n}.Infinite) : Function.Surjective (Nat.count p) := fun n => ⟨nth p n, count_nth_of_infinite h n⟩ -theorem count_nth_succ {n : ℕ} (hn : ∀ hf : (setOf p).Finite, n < #hf.toFinset) : +@[deprecated (since := "2026-07-09")] +alias surjective_count_of_infinite_setOf := surjective_count_of_infinite_setOfPred + +theorem count_nth_succ {n : ℕ} (hn : ∀ hf : (Set.ofPred p).Finite, n < #hf.toFinset) : count p (nth p n + 1) = n + 1 := by rw [count_succ, count_nth hn, if_pos (nth_mem _ hn)] -lemma count_nth_succ_of_infinite (hp : (setOf p).Infinite) (n : ℕ) : +lemma count_nth_succ_of_infinite (hp : (Set.ofPred p).Infinite) (n : ℕ) : count p (nth p n + 1) = n + 1 := by rw [count_succ, count_nth_of_infinite hp, if_pos (nth_mem_of_infinite hp _)] @[simp] theorem nth_count {n : ℕ} (hpn : p n) : nth p (count p n) = n := - have : ∀ hf : (setOf p).Finite, count p n < #hf.toFinset := fun hf => count_lt_card hf hpn + have : ∀ hf : (Set.ofPred p).Finite, count p n < #hf.toFinset := fun hf => count_lt_card hf hpn count_injective (nth_mem _ this) hpn (count_nth this) theorem nth_lt_of_lt_count {n k : ℕ} (h : k < count p n) : nth p k < n := by @@ -466,25 +479,28 @@ theorem nth_count_eq_sInf (n : ℕ) : nth p (count p n) = sInf {i : ℕ | p i rwa [nth_count hpa, lt_self_iff_false] at hn theorem le_nth_count' {n : ℕ} (hpn : ∃ k, p k ∧ n ≤ k) : n ≤ nth p (count p n) := - (le_csInf hpn fun _ => And.right).trans (nth_count_eq_sInf p n).ge + (le_csInf (s := {i : ℕ | p i ∧ n ≤ i}) hpn fun _ => And.right).trans + (nth_count_eq_sInf p n).ge -theorem le_nth_count (hp : (setOf p).Infinite) (n : ℕ) : n ≤ nth p (count p n) := +theorem le_nth_count (hp : (Set.ofPred p).Infinite) (n : ℕ) : n ≤ nth p (count p n) := let ⟨m, hp, hn⟩ := hp.exists_gt n le_nth_count' ⟨m, hp, hn.le⟩ /-- If a predicate `p : ℕ → Prop` is true for infinitely many numbers, then `Nat.count p` and `Nat.nth p` form a Galois insertion. -/ -noncomputable def giCountNth (hp : (setOf p).Infinite) : GaloisInsertion (count p) (nth p) := +noncomputable def giCountNth (hp : (Set.ofPred p).Infinite) : GaloisInsertion (count p) (nth p) := GaloisInsertion.monotoneIntro (nth_monotone hp) (count_monotone p) (le_nth_count hp) (count_nth_of_infinite hp) -theorem gc_count_nth (hp : (setOf p).Infinite) : GaloisConnection (count p) (nth p) := +theorem gc_count_nth (hp : (Set.ofPred p).Infinite) : GaloisConnection (count p) (nth p) := (giCountNth hp).gc -theorem count_le_iff_le_nth (hp : (setOf p).Infinite) {a b : ℕ} : count p a ≤ b ↔ a ≤ nth p b := +theorem count_le_iff_le_nth (hp : (Set.ofPred p).Infinite) {a b : ℕ} : + count p a ≤ b ↔ a ≤ nth p b := gc_count_nth hp _ _ -theorem lt_nth_iff_count_lt (hp : (setOf p).Infinite) {a b : ℕ} : a < count p b ↔ nth p a < b := +theorem lt_nth_iff_count_lt (hp : (Set.ofPred p).Infinite) {a b : ℕ} : + a < count p b ↔ nth p a < b := (gc_count_nth hp).lt_iff_lt end Count @@ -495,10 +511,10 @@ theorem nth_of_forall {n : ℕ} (hp : ∀ n' ≤ n, p n') : nth p n = n := by @[simp] theorem nth_true (n : ℕ) : nth (fun _ ↦ True) n = n := nth_of_forall fun _ _ ↦ trivial theorem nth_of_forall_not {n : ℕ} (hp : ∀ n' ≥ n, ¬p n') : nth p n = 0 := by - have : setOf p ⊆ Finset.range n := by + have : Set.ofPred p ⊆ Finset.range n := by intro n' hn' contrapose! hp - exact ⟨n', by simpa using hp, Set.mem_setOf.mp hn'⟩ + exact ⟨n', by simpa using hp, Set.mem_ofPred.mp hn'⟩ rw [nth_of_card_le ((finite_toSet _).subset this)] · refine (Finset.card_le_card ?_).trans_eq (Finset.card_range n) exact Set.Finite.toFinset_subset.mpr this diff --git a/Mathlib/Data/Nat/Prime/Infinite.lean b/Mathlib/Data/Nat/Prime/Infinite.lean index f9e54e918ade47..f7a007c806f2ba 100644 --- a/Mathlib/Data/Nat/Prime/Infinite.lean +++ b/Mathlib/Data/Nat/Prime/Infinite.lean @@ -13,8 +13,8 @@ public import Mathlib.Order.Bounds.Basic ## Notable Theorems - `Nat.exists_infinite_primes`: Euclid's theorem that there exist infinitely many prime numbers. - This also appears as `Nat.not_bddAbove_setOf_prime` and `Nat.infinite_setOf_prime` (the latter - in `Data.Nat.PrimeFin`). + This also appears as `Nat.not_bddAbove_setOfPred_prime` and `Nat.infinite_setOfPred_prime` + (the latter in `Data.Nat.PrimeFin`). -/ @@ -42,12 +42,14 @@ theorem exists_infinite_primes (n : ℕ) : ∃ p, n ≤ p ∧ Prime p := ⟨p, np, pp⟩ /-- A version of `Nat.exists_infinite_primes` using the `BddAbove` predicate. -/ -theorem not_bddAbove_setOf_prime : ¬BddAbove { p | Prime p } := by +theorem not_bddAbove_setOfPred_prime : ¬BddAbove { p | Prime p } := by rw [not_bddAbove_iff] intro n obtain ⟨p, hi, hp⟩ := exists_infinite_primes n.succ exact ⟨p, hp, hi⟩ +@[deprecated (since := "2026-07-09")] alias not_bddAbove_setOf_prime := not_bddAbove_setOfPred_prime + end Infinite end Nat diff --git a/Mathlib/Data/Nat/PrimeFin.lean b/Mathlib/Data/Nat/PrimeFin.lean index c41c68e716e921..91f5c33b25f84f 100644 --- a/Mathlib/Data/Nat/PrimeFin.lean +++ b/Mathlib/Data/Nat/PrimeFin.lean @@ -24,10 +24,12 @@ namespace Nat variable {a b k m n p : ℕ} /-- A version of `Nat.exists_infinite_primes` using the `Set.Infinite` predicate. -/ -theorem infinite_setOf_prime : { p | Prime p }.Infinite := - Set.infinite_of_not_bddAbove not_bddAbove_setOf_prime +theorem infinite_setOfPred_prime : { p | Prime p }.Infinite := + Set.infinite_of_not_bddAbove not_bddAbove_setOfPred_prime -instance Primes.infinite : Infinite Primes := infinite_setOf_prime.to_subtype +@[deprecated (since := "2026-07-09")] alias infinite_setOf_prime := infinite_setOfPred_prime + +instance Primes.infinite : Infinite Primes := infinite_setOfPred_prime.to_subtype instance Primes.countable : Countable Primes := ⟨⟨coeNat.coe, coe_nat_injective⟩⟩ diff --git a/Mathlib/Data/PFunctor/Multivariate/Basic.lean b/Mathlib/Data/PFunctor/Multivariate/Basic.lean index 76e39bff9afce8..b1f24cbdc603ac 100644 --- a/Mathlib/Data/PFunctor/Multivariate/Basic.lean +++ b/Mathlib/Data/PFunctor/Multivariate/Basic.lean @@ -181,7 +181,7 @@ open Set theorem supp_eq {α : TypeVec n} (a : P.A) (f : P.B a ⟹ α) (i) : @supp.{u} _ P.Obj _ α (⟨a, f⟩ : P α) i = f i '' univ := by - ext x; simp only [supp, image_univ, mem_range, mem_setOf_eq] + ext x; simp only [supp, image_univ, mem_range, mem_ofPred_eq] constructor <;> intro h · apply @h fun i x => ∃ y : P.B a i, f i y = x rw [liftP_iff'] diff --git a/Mathlib/Data/PFunctor/Univariate/Basic.lean b/Mathlib/Data/PFunctor/Univariate/Basic.lean index a7c35efe92bc64..3e9ae43ce00262 100644 --- a/Mathlib/Data/PFunctor/Univariate/Basic.lean +++ b/Mathlib/Data/PFunctor/Univariate/Basic.lean @@ -217,7 +217,7 @@ open Set theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) : @supp.{u} P.Obj _ α (⟨a, f⟩ : P α) = f '' univ := by - ext x; simp only [supp, image_univ, mem_range, mem_setOf_eq] + ext x; simp only [supp, image_univ, mem_range, mem_ofPred_eq] constructor <;> intro h · apply @h fun x => ∃ y : P.B a, f y = x rw [liftp_iff'] diff --git a/Mathlib/Data/Prod/TProd.lean b/Mathlib/Data/Prod/TProd.lean index 5331bd81ce5ca1..5188a52ccf1468 100644 --- a/Mathlib/Data/Prod/TProd.lean +++ b/Mathlib/Data/Prod/TProd.lean @@ -148,7 +148,7 @@ theorem mk_preimage_tprod : rw [mk_preimage_tprod l t] -- `simp [Set.TProd, TProd.mk, this]` can close this goal but is slow. rw [Set.tprod, TProd.mk, mem_preimage, mem_pi, prodMk_mem_set_prod_eq] - simp_rw [mem_setOf_eq, mem_cons] + simp_rw [mem_ofPred_eq, mem_cons] rw [forall_eq_or_imp, and_congr_right_iff] exact fun _ => h diff --git a/Mathlib/Data/QPF/Multivariate/Basic.lean b/Mathlib/Data/QPF/Multivariate/Basic.lean index 07695fc6ffe451..fe1f4a92ea92b9 100644 --- a/Mathlib/Data/QPF/Multivariate/Basic.lean +++ b/Mathlib/Data/QPF/Multivariate/Basic.lean @@ -174,7 +174,7 @@ theorem has_good_supp_iff {α : TypeVec n} (x : F α) : ∃ a f, abs ⟨a, f⟩ = x ∧ ∀ i a' f', abs ⟨a', f'⟩ = x → f i '' univ ⊆ f' i '' univ := by constructor · intro h - have : LiftP (supp x) x := by rw [h]; introv; exact id + have : LiftP (fun i u => u ∈ supp x i) x := by rw [h]; introv; exact id rw [liftP_iff] at this rcases this with ⟨a, f, xeq, h'⟩ refine ⟨a, f, xeq.symm, ?_⟩ @@ -256,7 +256,7 @@ theorem suppPreservation_iff_liftpPreservation : q.SuppPreservation ↔ q.LiftPP · rintro α ⟨a, f⟩ simp only [LiftPPreservation] at h ext - simp only [supp, h, mem_setOf_eq] + simp only [supp, h, mem_ofPred_eq] theorem liftpPreservation_iff_uniform : q.LiftPPreservation ↔ q.IsUniform := by rw [← suppPreservation_iff_liftpPreservation, suppPreservation_iff_isUniform] diff --git a/Mathlib/Data/Real/Embedding.lean b/Mathlib/Data/Real/Embedding.lean index b7afcbc8feaedf..d56cc74eb45fdf 100644 --- a/Mathlib/Data/Real/Embedding.lean +++ b/Mathlib/Data/Real/Embedding.lean @@ -70,14 +70,14 @@ abbrev ratLt (x : M) : Set ℚ := {r | r.num • 1 < r.den • x} theorem mkRat_mem_ratLt {num : ℤ} {den : ℕ} (hden : den ≠ 0) {x : M} : mkRat num den ∈ ratLt x ↔ num • 1 < den • x := by - rw [Set.mem_setOf] + rw [Set.mem_ofPred] obtain ⟨m, hm0, hnum, hden⟩ := Rat.mkRat_num_den hden (show mkRat num den = _ by rfl) conv in num • 1 => rw [hnum, mul_comm, ← smul_smul, natCast_zsmul] conv in den • x => rw [hden, mul_comm, ← smul_smul] exact (smul_lt_smul_iff_of_pos_left (Nat.zero_lt_of_ne_zero hm0)).symm /-- `ratLt` as a set of real numbers. -/ -abbrev ratLt' (x : M) : Set ℝ := (Rat.castHom ℝ) '' (ratLt x) +noncomputable abbrev ratLt' (x : M) : Set ℝ := (Rat.castHom ℝ) '' (ratLt x) /-- Mapping `M` to `ℝ`, defined as the supremum of `ratLt' x`. -/ noncomputable @@ -119,7 +119,7 @@ theorem ratLt_add (x y : M) : ratLt (x + y) = ratLt x + ratLt y := by To ensure a large enough denominator, we take `d * k`, where `1 + 1 ≤ k • (d • (x + y) - a.num • 1)`. -/ intro h - rw [Set.mem_setOf_eq] at h + rw [Set.mem_ofPred_eq] at h obtain ⟨k, hk⟩ := Archimedean.arch (1 + 1) <| sub_pos.mpr h have hk0 : k ≠ 0 := by contrapose! hk @@ -143,7 +143,7 @@ theorem ratLt_add (x y : M) : ratLt (x + y) = ratLt x + ratLt y := by · -- `u ∈ ratLt 1 x`, `v ∈ ratLt 1 y` → `u + v ∈ ratLt 1 (x + y)` intro ⟨u, hu, v, hv, huv⟩ rw [← huv] - rw [Set.mem_setOf_eq] at hu hv ⊢ + rw [Set.mem_ofPred_eq] at hu hv ⊢ exact num_smul_one_lt_den_smul_add hu hv theorem ratLt'_bddAbove (x : M) : BddAbove (ratLt' x) := diff --git a/Mathlib/Data/Set/Basic.lean b/Mathlib/Data/Set/Basic.lean index f351d53127ac98..d0f8405714c767 100644 --- a/Mathlib/Data/Set/Basic.lean +++ b/Mathlib/Data/Set/Basic.lean @@ -13,8 +13,8 @@ public import Mathlib.Tactic.Attr.Register # Basic properties of sets Sets in Lean are homogeneous; all their elements have the same type. Sets whose elements -have type `X` are thus defined as `Set X := X → Prop`. Note that this function need not -be decidable. The definition is in the module `Mathlib/Data/Set/Defs.lean`. +have type `X` are thus defined as a structure wrapping a predicate `X → Prop`. Note that this +predicate need not be decidable. The definition is in the module `Mathlib/Data/Set/Defs.lean`. This file provides some basic definitions related to sets and functions not present in the definitions file, as well as extra lemmas for functions defined in the definitions file and @@ -70,21 +70,35 @@ namespace Set variable {α : Type u} {s t : Set α} -protected theorem mem_injective : Injective (Membership.mem : Set α → α → Prop) := injective_id -protected theorem mem_surjective : Surjective (Membership.mem : Set α → α → Prop) := surjective_id -protected theorem mem_bijective : Bijective (Membership.mem : Set α → α → Prop) := bijective_id +protected theorem mem_injective : Injective (Membership.mem : Set α → α → Prop) := + fun _ _ h => congrArg ofPred h +protected theorem mem_surjective : Surjective (Membership.mem : Set α → α → Prop) := + fun p => ⟨ofPred p, rfl⟩ +protected theorem mem_bijective : Bijective (Membership.mem : Set α → α → Prop) := + ⟨Set.mem_injective, Set.mem_surjective⟩ instance instDistribLattice : DistribLattice (Set α) where - __ : DistribLattice (α → Prop) := inferInstance le := (· ≤ ·) lt := fun s t => s ⊆ t ∧ ¬t ⊆ s sup := (· ∪ ·) inf := (· ∩ ·) + le_refl _ _ := id + le_trans _ _ _ hst htu _ ha := htu (hst ha) + le_antisymm _ _ hst hts := Set.ext fun _ => ⟨fun h => hst h, fun h => hts h⟩ + le_sup_left _ _ _ := .inl + le_sup_right _ _ _ := .inr + sup_le _ _ _ hs ht _ ha := ha.elim (fun h => hs h) fun h => ht h + inf_le_left _ _ _ := And.left + inf_le_right _ _ _ := And.right + le_inf _ _ _ hs ht _ ha := ⟨hs ha, ht ha⟩ + le_sup_inf _ _ _ _ h := + h.1.elim .inl fun hy => h.2.elim .inl fun hz => .inr ⟨hy, hz⟩ instance instBoundedOrder : BoundedOrder (Set α) where - __ : BoundedOrder (α → Prop) := inferInstance bot := ∅ top := univ + le_top _ _ _ := trivial + bot_le _ _ := False.elim @[simp] theorem top_eq_univ : (⊤ : Set α) = univ := @@ -143,9 +157,11 @@ instance (s : Set α) : CoeTC s α := ⟨fun x => x.1⟩ theorem Set.coe_eq_subtype (s : Set α) : ↥s = { x // x ∈ s } := rfl -theorem Set.coe_setOf (p : α → Prop) : ↥{ x | p x } = { x // p x } := +theorem Set.coe_ofPred (p : α → Prop) : ↥{ x | p x } = { x // p x } := rfl +@[deprecated (since := "2026-07-09")] alias Set.coe_setOf := Set.coe_ofPred + theorem SetCoe.forall {s : Set α} {p : s → Prop} : (∀ x : s, p x) ↔ ∀ (x) (h : x ∈ s), p ⟨x, h⟩ := Subtype.forall @@ -189,34 +205,53 @@ instance : Inhabited (Set α) := theorem mem_of_mem_of_subset {x : α} {s t : Set α} (hx : x ∈ s) (h : s ⊆ t) : x ∈ t := h hx -theorem setOf_injective : Function.Injective (@setOf α) := injective_id +theorem ofPred_injective : Function.Injective (@ofPred α) := fun _ _ h => congrArg Set.Mem h + +@[deprecated (since := "2026-07-09")] alias setOf_injective := ofPred_injective + +theorem ofPred_inj {p q : α → Prop} : { x | p x } = { x | q x } ↔ p = q := ofPred_injective.eq_iff -theorem setOf_inj {p q : α → Prop} : { x | p x } = { x | q x } ↔ p = q := Iff.rfl +@[deprecated (since := "2026-07-09")] alias setOf_inj := ofPred_inj -/-! ### Lemmas about `mem` and `setOf` -/ +/-! ### Lemmas about `mem` and `ofPred` -/ -theorem setOf_bijective : Bijective (setOf : (α → Prop) → Set α) := - bijective_id +theorem ofPred_bijective : Bijective (ofPred : (α → Prop) → Set α) := + ⟨ofPred_injective, fun s => ⟨s.Mem, rfl⟩⟩ -theorem subset_setOf {p : α → Prop} {s : Set α} : s ⊆ setOf p ↔ ∀ x, x ∈ s → p x := +@[deprecated (since := "2026-07-09")] alias setOf_bijective := ofPred_bijective + +theorem subset_ofPred {p : α → Prop} {s : Set α} : s ⊆ ofPred p ↔ ∀ x, x ∈ s → p x := Iff.rfl -theorem setOf_subset {p : α → Prop} {s : Set α} : setOf p ⊆ s ↔ ∀ x, p x → x ∈ s := +@[deprecated (since := "2026-07-09")] alias subset_setOf := subset_ofPred + +theorem ofPred_subset {p : α → Prop} {s : Set α} : ofPred p ⊆ s ↔ ∀ x, p x → x ∈ s := Iff.rfl +@[deprecated (since := "2026-07-09")] alias setOf_subset := ofPred_subset + @[simp] -theorem setOf_subset_setOf {p q : α → Prop} : { a | p a } ⊆ { a | q a } ↔ ∀ a, p a → q a := +theorem ofPred_subset_ofPred {p q : α → Prop} : { a | p a } ⊆ { a | q a } ↔ ∀ a, p a → q a := Iff.rfl +@[deprecated (since := "2026-07-09")] alias setOf_subset_setOf := ofPred_subset_ofPred + @[gcongr] -alias ⟨_, setOf_subset_setOf_of_imp⟩ := setOf_subset_setOf +alias ⟨_, ofPred_subset_ofPred_of_imp⟩ := ofPred_subset_ofPred + +@[deprecated (since := "2026-07-09")] +alias setOf_subset_setOf_of_imp := ofPred_subset_ofPred_of_imp -theorem setOf_and {p q : α → Prop} : { a | p a ∧ q a } = { a | p a } ∩ { a | q a } := +theorem ofPred_and {p q : α → Prop} : { a | p a ∧ q a } = { a | p a } ∩ { a | q a } := rfl -theorem setOf_or {p q : α → Prop} : { a | p a ∨ q a } = { a | p a } ∪ { a | q a } := +@[deprecated (since := "2026-07-09")] alias setOf_and := ofPred_and + +theorem ofPred_or {p q : α → Prop} : { a | p a ∨ q a } = { a | p a } ∪ { a | q a } := rfl +@[deprecated (since := "2026-07-09")] alias setOf_or := ofPred_or + /-! ### Subset and strict subset relations -/ -- TODO(Jeremy): write a tactic to unfold specific instances of generic notation? @@ -402,10 +437,15 @@ theorem mem_empty_iff_false (x : α) : x ∈ (∅ : Set α) ↔ False := Iff.rfl @[simp, grind =] -theorem setOf_false : { _a : α | False } = ∅ := +theorem ofPred_false : { _a : α | False } = ∅ := rfl -@[simp] theorem setOf_bot : { _x : α | ⊥ } = ∅ := rfl +@[deprecated (since := "2026-07-09")] alias setOf_false := ofPred_false + +@[simp] theorem ofPred_bot : { _x : α | ⊥ } = ∅ := rfl + +@[deprecated (since := "2026-07-09")] +alias setOf_bot := ofPred_bot @[simp] theorem empty_subset (s : Set α) : ∅ ⊆ s := @@ -500,10 +540,15 @@ Mathematically it is the same as `α` but it has a different type. @[simp, grind =] -theorem setOf_true : { _x : α | True } = univ := +theorem ofPred_true : { _x : α | True } = univ := rfl -@[simp] theorem setOf_top : { _x : α | ⊤ } = univ := rfl +@[deprecated (since := "2026-07-09")] alias setOf_true := ofPred_true + +@[simp] theorem ofPred_top : { _x : α | ⊤ } = univ := rfl + +@[deprecated (since := "2026-07-09")] +alias setOf_top := ofPred_top @[simp] theorem univ_eq_empty_iff : (univ : Set α) = ∅ ↔ IsEmpty α := @@ -802,15 +847,20 @@ theorem union_inter_cancel_left {s t : Set α} : (s ∪ t) ∩ s = s := theorem union_inter_cancel_right {s t : Set α} : (s ∪ t) ∩ t = t := inter_eq_self_of_subset_right subset_union_right -theorem inter_setOf_eq_sep (s : Set α) (p : α → Prop) : s ∩ {a | p a} = {a ∈ s | p a} := +theorem inter_ofPred_eq_sep (s : Set α) (p : α → Prop) : s ∩ {a | p a} = {a ∈ s | p a} := rfl -theorem setOf_inter_eq_sep (p : α → Prop) (s : Set α) : {a | p a} ∩ s = {a ∈ s | p a} := +@[deprecated (since := "2026-07-09")] +alias inter_setOf_eq_sep := inter_ofPred_eq_sep + +theorem ofPred_inter_eq_sep (p : α → Prop) (s : Set α) : {a | p a} ∩ s = {a ∈ s | p a} := inter_comm _ _ +@[deprecated (since := "2026-07-09")] alias setOf_inter_eq_sep := ofPred_inter_eq_sep + theorem sep_eq_inter_sep {α : Type*} {s t : Set α} {p : α → Prop} (hst : s ⊆ t) : {x ∈ s | p x} = s ∩ {x ∈ t | p x} := by - rw [← inter_setOf_eq_sep s p, ← inter_setOf_eq_sep t p, + rw [← inter_ofPred_eq_sep s p, ← inter_ofPred_eq_sep t p, ← inter_assoc, ← left_eq_inter.mpr hst] @[deprecated (since := "2025-12-10")] alias sep_of_subset := sep_eq_inter_sep @@ -881,9 +931,12 @@ theorem sep_eq_of_subset (h : s ⊆ t) : { x ∈ t | x ∈ s } = s := @[simp] theorem sep_subset (s : Set α) (p : α → Prop) : { x ∈ s | p x } ⊆ s := fun _ => And.left -theorem sep_subset_setOf (s : Set α) (p : α → Prop) : { x ∈ s | p x } ⊆ { x | p x } := +theorem sep_subset_ofPred (s : Set α) (p : α → Prop) : { x ∈ s | p x } ⊆ { x | p x } := fun _ => And.right +@[deprecated (since := "2026-07-09")] +alias sep_subset_setOf := sep_subset_ofPred + @[simp] theorem sep_eq_self_iff_mem_true : { x ∈ s | p x } = s ↔ ∀ x ∈ s, p x := by simp_rw [Set.ext_iff, mem_sep_iff, and_iff_left_iff_imp] @@ -921,9 +974,12 @@ theorem sep_or : { x ∈ s | p x ∨ q x } = { x ∈ s | p x } ∪ { x ∈ s | q inter_union_distrib_left s {x | p x} {x | q x} @[simp] -theorem sep_setOf : { x ∈ { y | p y } | q x } = { x | p x ∧ q x } := +theorem sep_ofPred : { x ∈ { y | p y } | q x } = { x | p x ∧ q x } := rfl +@[deprecated (since := "2026-07-09")] +alias sep_setOf := sep_ofPred + end Sep /-! ### Powerset -/ @@ -1052,9 +1108,11 @@ instance decidableUniv : Decidable (a ∈ univ) := Decidable.isTrue (by simp) instance decidableInsert [Decidable (a = b)] [Decidable (a ∈ s)] : Decidable (a ∈ insert b s) := inferInstanceAs (Decidable (_ ∨ _)) -instance decidableSetOf (p : α → Prop) [Decidable (p a)] : Decidable (a ∈ { a | p a }) := by +instance decidableOfPred (p : α → Prop) [Decidable (p a)] : Decidable (a ∈ { a | p a }) := by assumption +@[deprecated (since := "2026-07-03")] alias decidableSetOf := decidableOfPred + /-- `Set α` almost never has decidable equality. In fact, for an inhabited type `α`, `Set α` has decidable equality iff all propositions are decidable. We add a global instance that `Set α` has decidable equality, diff --git a/Mathlib/Data/Set/Card.lean b/Mathlib/Data/Set/Card.lean index b3bbdde0aaf5aa..cdf533997b41a4 100644 --- a/Mathlib/Data/Set/Card.lean +++ b/Mathlib/Data/Set/Card.lean @@ -282,7 +282,7 @@ theorem Finite.encard_lt_encard (hs : s.Finite) (h : s ⊂ t) : s.encard < t.enc theorem encard_strictMono [Finite α] : StrictMono (encard : Set α → ℕ∞) := fun _ _ h ↦ (toFinite _).encard_lt_encard h -theorem Finite.encard_strictMonoOn : StrictMonoOn (α := Set α) encard (setOf Set.Finite) := +theorem Finite.encard_strictMonoOn : StrictMonoOn (α := Set α) encard (Set.ofPred Set.Finite) := fun _ hs _ _ hlt ↦ hs.encard_lt_encard hlt theorem Finite.encard_lt_card (hfin : s.Finite) (hne : s ≠ univ) : s.encard < ENat.card α := @@ -325,7 +325,7 @@ theorem encard_singleton_inter (s : Set α) (x : α) : ({x} ∩ s).encard ≤ 1 theorem encard_sdiff_singleton_add_one (h : a ∈ s) : (s \ {a}).encard + 1 = s.encard := by - rw [← encard_insert_of_notMem (fun h ↦ h.2 rfl), insert_sdiff_singleton, insert_eq_of_mem h] + rw [← encard_insert_of_notMem (a := a) (by simp), insert_sdiff_singleton, insert_eq_of_mem h] @[deprecated (since := "2026-06-03")] alias encard_diff_singleton_add_one := encard_sdiff_singleton_add_one @@ -417,7 +417,7 @@ theorem exists_ne_of_one_lt_encard (h : 1 < s.encard) (a : α) : ∃ b ∈ s, b theorem encard_eq_two : s.encard = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by refine ⟨fun h ↦ ?_, fun ⟨x, y, hne, hs⟩ ↦ by rw [hs, encard_pair hne]⟩ obtain ⟨x, hx⟩ := nonempty_of_encard_ne_zero (s := s) (by rw [h]; simp) - rw [← insert_eq_of_mem hx, ← insert_sdiff_singleton, encard_insert_of_notMem (fun h ↦ h.2 rfl), + rw [← insert_eq_of_mem hx, ← insert_sdiff_singleton, encard_insert_of_notMem (a := x) (by simp), ← one_add_one_eq_two, (ENat.addLECancellable_of_ne_top ENat.one_ne_top).inj_left, encard_eq_one] at h obtain ⟨y, h⟩ := h @@ -429,7 +429,7 @@ theorem encard_eq_three {α : Type u_1} {s : Set α} : refine ⟨fun h ↦ ?_, fun ⟨x, y, z, hxy, hyz, hxz, hs⟩ ↦ ?_⟩ · obtain ⟨x, hx⟩ := nonempty_of_encard_ne_zero (s := s) (by rw [h]; simp) rw [← insert_eq_of_mem hx, ← insert_sdiff_singleton, - encard_insert_of_notMem (fun h ↦ h.2 rfl), (by exact rfl : (3 : ℕ∞) = 2 + 1), + encard_insert_of_notMem (fun h : x ∈ s \ {x} ↦ h.2 rfl), (by exact rfl : (3 : ℕ∞) = 2 + 1), (ENat.addLECancellable_of_ne_top ENat.one_ne_top).inj_left, encard_eq_two] at h obtain ⟨y, z, hne, hs⟩ := h refine ⟨x, y, z, ?_, ?_, hne, ?_⟩ @@ -443,7 +443,7 @@ theorem encard_eq_four {α : Type u_1} {s : Set α} : refine ⟨fun h ↦ ?_, fun ⟨x, y, z, w, hxy, hxz, hxw, hyz, hyw, hzw, hs⟩ ↦ ?_⟩ · obtain ⟨x, hx⟩ := nonempty_of_encard_ne_zero (s := s) (by rw [h]; simp) rw [← insert_eq_of_mem hx, ← insert_sdiff_singleton, - encard_insert_of_notMem (fun h ↦ h.2 rfl), (by exact rfl : (4 : ℕ∞) = 3 + 1), + encard_insert_of_notMem (a := x) (by simp), (by exact rfl : (4 : ℕ∞) = 3 + 1), (ENat.addLECancellable_of_ne_top ENat.one_ne_top).inj_left, encard_eq_three] at h obtain ⟨y, z, w, hyz, hyw, hzw, hs⟩ := h refine ⟨x, y, z, w, ?_, ?_, ?_, hyz, hyw, hzw, ?_⟩ @@ -560,7 +560,7 @@ theorem Finite.exists_injOn_of_encard_le [Nonempty β] {s : Set α} {t : Set β} simp only [preimage_sdiff, subset_def, mem_sdiff, mem_singleton_iff, mem_preimage, and_imp] at hf₀s use Function.update f₀ a b - rw [← insert_eq_of_mem has, ← insert_sdiff_singleton, injOn_insert (fun h ↦ h.2 rfl)] + rw [← insert_eq_of_mem has, ← insert_sdiff_singleton, injOn_insert (a := a) (by simp)] simp only [mem_sdiff, mem_singleton_iff, insert_sdiff_singleton, subset_def, mem_insert_iff, mem_preimage, Function.update_apply, forall_eq_or_imp, ite_true, and_imp, mem_image, ite_eq_left_iff, not_exists, not_and, not_forall, exists_prop, and_iff_right hbt] @@ -846,7 +846,7 @@ theorem fiber_ncard_ne_zero_iff_mem_image {y : β} (hs : s.Finite := by toFinite ncard_image_of_injective _ f.inj' @[simp] theorem ncard_subtype (P : α → Prop) (s : Set α) : - { x : Subtype P | (x : α) ∈ s }.ncard = (s ∩ setOf P).ncard := by + { x : Subtype P | (x : α) ∈ s }.ncard = (s ∩ Set.ofPred P).ncard := by convert! (ncard_image_of_injective _ (@Subtype.coe_injective _ P)).symm ext x simp [← and_assoc, exists_eq_right] @@ -874,7 +874,7 @@ theorem map_eq_of_subset {f : α ↪ α} (h : f '' s ⊆ s) (hs : s.Finite := by theorem sep_of_ncard_eq {a : α} {P : α → Prop} (h : { x ∈ s | P x }.ncard = s.ncard) (ha : a ∈ s) (hs : s.Finite := by toFinite_tac) : P a := - sep_eq_self_iff_mem_true.mp (eq_of_subset_of_ncard_le (by simp) h.symm.le hs) _ ha + sep_eq_self_iff_mem_true.mp (eq_of_subset_of_ncard_le (sep_subset ..) h.symm.le hs) _ ha theorem ncard_lt_ncard (h : s ⊂ t) (ht : t.Finite := by toFinite_tac) : s.ncard < t.ncard := by @@ -887,7 +887,7 @@ theorem ncard_lt_card [Finite α] (h : s ≠ univ) : s.ncard < Nat.card α := theorem ncard_strictMono [Finite α] : @StrictMono (Set α) _ _ _ ncard := fun _ _ h ↦ ncard_lt_ncard h -theorem Finite.ncard_strictMonoOn : StrictMonoOn (α := Set α) ncard (setOf Set.Finite) := +theorem Finite.ncard_strictMonoOn : StrictMonoOn (α := Set α) ncard (Set.ofPred Set.Finite) := fun _ _ _ ht hlt ↦ ncard_lt_ncard hlt ht theorem ncard_eq_of_bijective {n : ℕ} (f : ∀ i, i < n → α) diff --git a/Mathlib/Data/Set/Constructions.lean b/Mathlib/Data/Set/Constructions.lean index 1fde47d3e54a09..5a2d37992c8dc6 100644 --- a/Mathlib/Data/Set/Constructions.lean +++ b/Mathlib/Data/Set/Constructions.lean @@ -38,15 +38,20 @@ structure FiniteInter : Prop where namespace FiniteInter +/-- The property of belonging to the smallest set of sets containing `S` which is closed under +finite intersections. -/ +inductive MemFiniteInterClosure : Set α → Prop + | basic {s} : s ∈ S → MemFiniteInterClosure s + | univ : MemFiniteInterClosure Set.univ + | inter {s t} : MemFiniteInterClosure s → MemFiniteInterClosure t → + MemFiniteInterClosure (s ∩ t) + /-- The smallest set of sets containing `S` which is closed under finite intersections. -/ -inductive finiteInterClosure : Set (Set α) - | basic {s} : s ∈ S → finiteInterClosure s - | univ : finiteInterClosure Set.univ - | inter {s t} : finiteInterClosure s → finiteInterClosure t → finiteInterClosure (s ∩ t) +@[expose] def finiteInterClosure : Set (Set α) := {s | MemFiniteInterClosure S s} theorem finiteInterClosure_finiteInter : FiniteInter (finiteInterClosure S) := - { univ_mem := finiteInterClosure.univ - inter_mem := fun _ h _ => finiteInterClosure.inter h } + { univ_mem := MemFiniteInterClosure.univ + inter_mem := fun _ h _ => MemFiniteInterClosure.inter h } variable {S} diff --git a/Mathlib/Data/Set/Countable.lean b/Mathlib/Data/Set/Countable.lean index 6aaf912cdda781..450ea953990da4 100644 --- a/Mathlib/Data/Set/Countable.lean +++ b/Mathlib/Data/Set/Countable.lean @@ -270,7 +270,7 @@ theorem countable_isBot (α : Type*) [PartialOrder α] : { x : α | IsBot x }.Co (finite_isBot α).countable /-- The set of finite subsets of a countable set is countable. -/ -theorem countable_setOf_finite_subset {s : Set α} (hs : s.Countable) : +theorem countable_ofPred_finite_subset {s : Set α} (hs : s.Countable) : { t | Set.Finite t ∧ t ⊆ s }.Countable := by have := hs.to_subtype refine (countable_range fun t : Finset s => Subtype.val '' (t : Set s)).mono ?_ @@ -279,9 +279,14 @@ theorem countable_setOf_finite_subset {s : Set α} (hs : s.Countable) : lift t to Finset s using ht.of_finite_image Subtype.val_injective.injOn exact mem_range_self _ +@[deprecated (since := "2026-07-09")] +alias countable_setOf_finite_subset := countable_ofPred_finite_subset + /-- The set of finite sets in a countable type is countable. -/ -theorem Countable.setOf_finite [Countable α] : {s : Set α | s.Finite}.Countable := by - simpa using countable_setOf_finite_subset countable_univ +theorem Countable.ofPred_finite [Countable α] : {s : Set α | s.Finite}.Countable := by + simpa using countable_ofPred_finite_subset countable_univ + +@[deprecated (since := "2026-07-09")] alias Countable.setOf_finite := Countable.ofPred_finite /-- If the codomain of a map is countable and the fibres are countable, the domain is countable. -/ @@ -309,7 +314,7 @@ theorem Countable.image2 {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Co /-- If a family of disjoint sets is included in a countable set, then only countably many of them are nonempty. -/ -theorem countable_setOf_nonempty_of_disjoint {f : β → Set α} +theorem countable_ofPred_nonempty_of_disjoint {f : β → Set α} (hf : Pairwise (Disjoint on f)) {s : Set α} (h'f : ∀ t, f t ⊆ s) (hs : s.Countable) : Set.Countable {t | (f t).Nonempty} := by rw [← Set.countable_coe_iff] at hs ⊢ @@ -328,6 +333,9 @@ theorem countable_setOf_nonempty_of_disjoint {f : β → Set α} exact not_disjoint_iff_nonempty_inter.2 A (hf H) exact Injective.countable A +@[deprecated (since := "2026-07-09")] +alias countable_setOf_nonempty_of_disjoint := countable_ofPred_nonempty_of_disjoint + end Set theorem Finset.countable_toSet (s : Finset α) : Set.Countable (↑s : Set α) := diff --git a/Mathlib/Data/Set/Defs.lean b/Mathlib/Data/Set/Defs.lean index 5f780c4092a23b..d584f8d058179f 100644 --- a/Mathlib/Data/Set/Defs.lean +++ b/Mathlib/Data/Set/Defs.lean @@ -5,6 +5,7 @@ Authors: Leonardo de Moura -/ module +public import Batteries.Tactic.Alias public import Batteries.Util.ExtendedBinder public import Mathlib.Tactic.SetNotationForOrder @@ -28,7 +29,7 @@ Given a type `X` and a predicate `p : X → Prop`: ## Implementation issues -As in Lean 3, `Set X := X → Prop` +`Set X` is a one-field structure wrapping a predicate `X → Prop`. This file is a port of the core Lean 3 file `lib/lean/library/init/data/set.lean`. -/ @@ -42,12 +43,15 @@ variable {α : Type u} /-- A set is a collection of elements of some type `α`. -Although `Set` is defined as `α → Prop`, this is an implementation detail which should not be -relied on. Instead, `setOf` and membership of a set (`∈`) should be used to convert between sets -and predicates. --/ +To build a set (an element of `Set α`) out of a predicate `p : α → Prop`, use the set builder +notation `{a | p a}`. To get a predicate `α → Prop` from a set `s : Set α`, use the `∈` notation, +as in `a ∈ s` or `(· ∈ s)`. -/ @[use_set_notation_for_order] -def Set (α : Type u) := α → Prop +structure Set (α : Type u) where + /-- Turn a predicate `p : α → Prop` into a set, also written as `{x | p x}` -/ + ofPred :: + /-- Membership in a set. Use the `∈` notation instead. -/ + protected Mem : α → Prop /- We don't translate the order on sets (i.e. turning `s ⊆ t` into `t ⊆ s`). @@ -61,22 +65,20 @@ But we would like to dualize set intervals such that e.g. `Ico a b` is dual to ` -/ attribute [to_dual_dont_translate] Set -/-- Turn a predicate `p : α → Prop` into a set, also written as `{x | p x}` -/ -def setOf {α : Type u} (p : α → Prop) : Set α := - p +@[deprecated (since := "2026-07-09")] alias setOf := Set.ofPred namespace Set -/-- Membership in a set -/ -protected def Mem (s : Set α) (a : α) : Prop := - s a - instance : Membership α (Set α) := ⟨Set.Mem⟩ +/-- One should always prefer the `∈` notation over `Set.Mem`. This simp lemma ensures that the +latter is removed from the goal as early as possible if accidentally exposed. -/ +@[simp] lemma mem_iff_mem {s : Set α} {a : α} : s.Mem a ↔ a ∈ s := .rfl + @[ext, grind ext] theorem ext {a b : Set α} (h : ∀ (x : α), x ∈ a ↔ x ∈ b) : a = b := - funext (fun x ↦ propext (h x)) + congrArg ofPred (funext fun x ↦ propext (h x)) /-- The subset relation on sets. `s ⊆ t` means that all elements of `s` are elements of `t`. @@ -89,9 +91,6 @@ to subset hypotheses. -/ instance : LE (Set α) := ⟨Set.Subset⟩ -instance : EmptyCollection (Set α) := - ⟨fun _ ↦ False⟩ - end Set namespace Mathlib.Meta @@ -112,8 +111,8 @@ syntax (name := setBuilder) "{" extBinder " | " term "}" : term /-- Elaborate set builder notation for `Set`. -* `{x | p x}` is elaborated as `Set.setOf fun x ↦ p x` -* `{x : α | p x}` is elaborated as `Set.setOf fun x : α ↦ p x` +* `{x | p x}` is elaborated as `Set.ofPred fun x ↦ p x` +* `{x : α | p x}` is elaborated as `Set.ofPred fun x : α ↦ p x` * `{binder x | p x}`, where `x` is bound by the `binder` binder, is elaborated as `{x | binder x ∧ p x}`. The typical example is `{x ∈ s | p x}`, which is elaborated as `{x | x ∈ s ∧ p x}`. The possible binders are @@ -135,16 +134,16 @@ See also @[term_elab setBuilder] meta def elabSetBuilder : TermElab | `({ $x:ident | $p }), expectedType? => do - elabTerm (← `(setOf fun $x:ident ↦ $p)) expectedType? + elabTerm (← `(Set.ofPred fun $x:ident ↦ $p)) expectedType? | `({ $x:ident : $t | $p }), expectedType? => do - elabTerm (← `(setOf fun $x:ident : $t ↦ $p)) expectedType? + elabTerm (← `(Set.ofPred fun $x:ident : $t ↦ $p)) expectedType? | `({ $x:ident $b:binderPred | $p }), expectedType? => do - elabTerm (← `(setOf fun $x:ident ↦ satisfies_binder_pred% $x $b ∧ $p)) expectedType? + elabTerm (← `(Set.ofPred fun $x:ident ↦ satisfies_binder_pred% $x $b ∧ $p)) expectedType? | _, _ => throwUnsupportedSyntax /-- Unexpander for set builder notation. -/ -@[app_unexpander setOf] -meta def setOf.unexpander : Lean.PrettyPrinter.Unexpander +@[app_unexpander Set.ofPred] +meta def ofPred.unexpander : Lean.PrettyPrinter.Unexpander | `($_ fun $x:ident ↦ $p) => `({ $x:ident | $p }) | `($_ fun ($x:ident : $ty:term) ↦ $p) => `({ $x:ident : $ty:term | $p }) | _ => throw () @@ -184,8 +183,8 @@ macro (priority := low - 1) "{" pat:term " | " p:term "}" : term => `({ x | match x with | $pat => $p }) /-- Pretty printing for set-builder notation with pattern matching. -/ -@[app_unexpander setOf] -meta def setOfPatternMatchUnexpander : Lean.PrettyPrinter.Unexpander +@[app_unexpander Set.ofPred] +meta def ofPredPatternMatchUnexpander : Lean.PrettyPrinter.Unexpander | `($_ fun $x:ident ↦ match $y:ident with | $pat => $p) => if x == y then `({ $pat:term | $p:term }) @@ -202,6 +201,9 @@ end Mathlib.Meta namespace Set +instance : EmptyCollection (Set α) := + ⟨{_a | False}⟩ + /-- The universal set on a type `α` is the set containing all elements of `α`. This is conceptually the "same as" `α` (in set theory, it is actually the same), but type theory @@ -263,8 +265,8 @@ def image {β : Type v} (f : α → β) (s : Set α) : Set β := {f a | a ∈ s} instance : Functor Set where map := @Set.image instance : LawfulFunctor Set where - id_map _ := funext fun _ ↦ propext ⟨fun ⟨_, sb, rfl⟩ ↦ sb, fun sb ↦ ⟨_, sb, rfl⟩⟩ - comp_map g h _ := funext <| fun c ↦ propext + id_map _ := ext fun _ ↦ ⟨fun ⟨_, sb, rfl⟩ ↦ sb, fun sb ↦ ⟨_, sb, rfl⟩⟩ + comp_map g h _ := ext fun c ↦ ⟨fun ⟨a, ⟨h₁, h₂⟩⟩ ↦ ⟨g a, ⟨⟨a, ⟨h₁, rfl⟩⟩, h₂⟩⟩, fun ⟨_, ⟨⟨a, ⟨h₁, h₂⟩⟩, h₃⟩⟩ ↦ ⟨a, ⟨h₁, show h (g a) = c from h₂ ▸ h₃⟩⟩⟩ map_const := rfl diff --git a/Mathlib/Data/Set/Finite/Basic.lean b/Mathlib/Data/Set/Finite/Basic.lean index 5c1a0dd85ed32e..1d9efb121c9665 100644 --- a/Mathlib/Data/Set/Finite/Basic.lean +++ b/Mathlib/Data/Set/Finite/Basic.lean @@ -158,9 +158,11 @@ protected alias ⟨_, toFinset_mono⟩ := Finite.toFinset_subset_toFinset protected alias ⟨_, toFinset_strictMono⟩ := Finite.toFinset_ssubset_toFinset @[simp high] -protected theorem toFinset_setOf [Fintype α] (p : α → Prop) [DecidablePred p] +protected theorem toFinset_ofPred [Fintype α] (p : α → Prop) [DecidablePred p] (h : { x | p x }.Finite) : h.toFinset = ({x | p x} : Finset α) := by simp +@[deprecated (since := "2026-07-09")] protected alias toFinset_setOf := Set.Finite.toFinset_ofPred + @[simp] nonrec theorem disjoint_toFinset {hs : s.Finite} {ht : t.Finite} : Disjoint hs.toFinset ht.toFinset ↔ Disjoint s t := @@ -817,7 +819,7 @@ theorem Finite.card_toFinset {s : Set α} [Fintype s] (h : s.Finite) : theorem card_ne_eq [Fintype α] (a : α) [Fintype { x : α | x ≠ a }] : Fintype.card { x : α | x ≠ a } = Fintype.card α - 1 := by haveI := Classical.decEq α - rw [← toFinset_card, toFinset_setOf, Finset.filter_ne', + rw [← toFinset_card, toFinset_ofPred, Finset.filter_ne', Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ] /-! ### Infinite sets -/ diff --git a/Mathlib/Data/Set/Finite/Lattice.lean b/Mathlib/Data/Set/Finite/Lattice.lean index 5722f01641983a..c69ef4bfd7045e 100644 --- a/Mathlib/Data/Set/Finite/Lattice.lean +++ b/Mathlib/Data/Set/Finite/Lattice.lean @@ -114,7 +114,7 @@ instance finite_biUnion' {ι : Type*} (s : Set ι) [Finite s] (t : ι → Set α -/ instance finite_biUnion'' {ι : Type*} (p : ι → Prop) [h : Finite { x | p x }] (t : ι → Set α) [∀ i, Finite (t i)] : Finite (⋃ (x) (_ : p x), t x) := - @Finite.Set.finite_biUnion' _ _ (setOf p) h t _ + @Finite.Set.finite_biUnion' _ _ (Set.ofPred p) h t _ instance finite_iInter {ι : Sort*} [Nonempty ι] (t : ι → Set α) [∀ i, Finite (t i)] : Finite (⋂ i, t i) := diff --git a/Mathlib/Data/Set/Finite/Lemmas.lean b/Mathlib/Data/Set/Finite/Lemmas.lean index fef6ca46061f72..bb9e2c30db108e 100644 --- a/Mathlib/Data/Set/Finite/Lemmas.lean +++ b/Mathlib/Data/Set/Finite/Lemmas.lean @@ -39,7 +39,7 @@ namespace Set theorem Finite.fin_embedding {s : Set α} (h : s.Finite) : ∃ (n : ℕ) (f : Fin n ↪ α), range f = s := ⟨_, (Fintype.equivFin (h.toFinset : Set α)).symm.asEmbedding, by - simp only [Finset.coe_sort_coe, Equiv.asEmbedding_range, Finite.coe_toFinset, setOf_mem_eq]⟩ + simp only [Finset.coe_sort_coe, Equiv.asEmbedding_range, Finite.coe_toFinset, ofPred_mem_eq]⟩ theorem Finite.fin_param {s : Set α} (h : s.Finite) : ∃ (n : ℕ) (f : Fin n → α), Injective f ∧ range f = s := diff --git a/Mathlib/Data/Set/Finite/List.lean b/Mathlib/Data/Set/Finite/List.lean index 2c876db304d957..0ef23a1a7654f2 100644 --- a/Mathlib/Data/Set/Finite/List.lean +++ b/Mathlib/Data/Set/Finite/List.lean @@ -29,7 +29,7 @@ variable (α : Type*) [Finite α] (n : ℕ) lemma finite_length_eq : {l : List α | l.length = n}.Finite := List.Vector.finite lemma finite_length_lt : {l : List α | l.length < n}.Finite := by - convert! (Finset.range n).finite_toSet.biUnion fun i _ ↦ finite_length_eq α i; ext; simp + convert (Finset.range n).finite_toSet.biUnion fun i _ ↦ finite_length_eq α i; simp lemma finite_length_le : {l : List α | l.length ≤ n}.Finite := by simpa [Nat.lt_succ_iff] using finite_length_lt α (n + 1) diff --git a/Mathlib/Data/Set/Finite/Powerset.lean b/Mathlib/Data/Set/Finite/Powerset.lean index e35e8dfbe343b6..7c974b6e7c7825 100644 --- a/Mathlib/Data/Set/Finite/Powerset.lean +++ b/Mathlib/Data/Set/Finite/Powerset.lean @@ -46,10 +46,9 @@ section SetFiniteConstructors /-- There are finitely many subsets of a given finite set -/ theorem Finite.finite_subsets {α : Type u} {a : Set α} (h : a.Finite) : { b | b ⊆ a }.Finite := by - convert! ((Finset.powerset h.toFinset).map Finset.coeEmb.1).finite_toSet - ext s - simpa [← @exists_finite_iff_finset α fun t => t ⊆ a ∧ t = s, Finite.subset_toFinset, - ← and_assoc, Finset.coeEmb] using h.subset + refine ((Finset.powerset h.toFinset).map Finset.coeEmb.1).finite_toSet.subset fun s hs => ?_ + simp only [Finset.coe_map, Set.mem_image, Finset.mem_coe, Finset.mem_powerset, Finset.coeEmb] + exact ⟨(h.subset hs).toFinset, by simp [show s ⊆ a from hs], by simp⟩ protected theorem Finite.powerset {s : Set α} (h : s.Finite) : (𝒫 s).Finite := h.finite_subsets diff --git a/Mathlib/Data/Set/Image.lean b/Mathlib/Data/Set/Image.lean index cfd6250f5185c2..f8aea15ea206cf 100644 --- a/Mathlib/Data/Set/Image.lean +++ b/Mathlib/Data/Set/Image.lean @@ -100,9 +100,11 @@ theorem preimage_ite (f : α → β) (s t₁ t₂ : Set β) : rfl @[simp] -theorem preimage_setOf_eq {p : α → Prop} {f : β → α} : f ⁻¹' { a | p a } = { a | p (f a) } := +theorem preimage_ofPred_eq {p : α → Prop} {f : β → α} : f ⁻¹' { a | p a } = { a | p (f a) } := rfl +@[deprecated (since := "2026-07-09")] alias preimage_setOf_eq := preimage_ofPred_eq + @[simp] theorem preimage_id_eq : preimage (id : α → α) = id := rfl @@ -433,12 +435,12 @@ theorem Nonempty.subset_preimage_const {s : Set α} (hs : Set.Nonempty s) (t : S @[simp] theorem preimage_injective : Injective (preimage f) ↔ Surjective f := by - rw [← Injective.of_comp_iff Set.mem_injective, ← Injective.of_comp_iff' _ Set.setOf_bijective] + rw [← Injective.of_comp_iff Set.mem_injective, ← Injective.of_comp_iff' _ Set.ofPred_bijective] exact injective_comp_right_iff_surjective @[simp] theorem preimage_surjective : Surjective (preimage f) ↔ Injective f := by - rw [← Surjective.of_comp_iff _ Set.setOf_bijective.surjective, + rw [← Surjective.of_comp_iff _ Set.ofPred_bijective.surjective, ← Surjective.of_comp_iff' Set.mem_bijective] exact surjective_comp_right_iff_injective @@ -869,7 +871,7 @@ theorem range_subtype_map {p : α → Prop} {q : β → Prop} (f : α → β) (h range (Subtype.map f h) = (↑) ⁻¹' f '' { x | p x } := by ext ⟨x, hx⟩ simp_rw [mem_preimage, mem_range, mem_image, Subtype.exists, Subtype.map] - simp only [Subtype.mk.injEq, exists_prop, mem_setOf_eq] + simp only [Subtype.mk.injEq, exists_prop, mem_ofPred_eq] theorem image_swap_eq_preimage_swap : image (@Prod.swap α β) = preimage Prod.swap := image_eq_preimage_of_inverse Prod.swap_leftInverse Prod.swap_rightInverse diff --git a/Mathlib/Data/Set/Insert.lean b/Mathlib/Data/Set/Insert.lean index 74410133de73aa..d217c805a8e3af 100644 --- a/Mathlib/Data/Set/Insert.lean +++ b/Mathlib/Data/Set/Insert.lean @@ -164,11 +164,13 @@ theorem notMem_singleton_iff {a b : α} : a ∉ ({b} : Set α) ↔ a ≠ b := Iff.rfl @[simp] -theorem setOf_eq_eq_singleton {a : α} : { n | n = a } = {a} := +theorem ofPred_eq_eq_singleton {a : α} : { n | n = a } = {a} := rfl +@[deprecated (since := "2026-07-09")] alias setOf_eq_eq_singleton := ofPred_eq_eq_singleton + @[simp] -theorem setOf_eq_eq_singleton' {a : α} : { x | a = x } = {a} := +theorem ofPred_eq_eq_singleton' {a : α} : { x | a = x } = {a} := ext fun _ => eq_comm -- TODO: again, annotation needed @@ -263,21 +265,27 @@ theorem eq_singleton_iff_nonempty_unique_mem : s = {a} ↔ s.Nonempty ∧ ∀ x theorem singleton_iff_unique_mem : (∃ a, s = {a}) ↔ ∃! a, a ∈ s := ⟨fun ⟨a, h⟩ ↦ ⟨a, by grind⟩, fun ⟨a, h⟩ ↦ ⟨a, by grind⟩⟩ -theorem setOf_mem_list_eq_replicate {l : List α} {a : α} : +theorem ofPred_mem_list_eq_replicate {l : List α} {a : α} : { x | x ∈ l } = {a} ↔ ∃ n > 0, l = List.replicate n a := by simpa +contextual [Set.ext_iff, iff_iff_implies_and_implies, forall_and, List.eq_replicate_iff, List.length_pos_iff_exists_mem] using ⟨fun _ _ ↦ ⟨_, ‹_›⟩, fun x hx h ↦ h _ hx ▸ hx⟩ -theorem setOf_mem_list_eq_singleton_of_nodup {l : List α} (H : l.Nodup) {a : α} : +@[deprecated (since := "2026-07-09")] +alias setOf_mem_list_eq_replicate := ofPred_mem_list_eq_replicate + +theorem ofPred_mem_list_eq_singleton_of_nodup {l : List α} (H : l.Nodup) {a : α} : { x | x ∈ l } = {a} ↔ l = [a] := by constructor - · rw [setOf_mem_list_eq_replicate] + · rw [ofPred_mem_list_eq_replicate] rintro ⟨n, hn, rfl⟩ simp only [List.nodup_replicate] at H simp [show n = 1 by lia] · rintro rfl simp +@[deprecated (since := "2026-07-09")] +alias setOf_mem_list_eq_singleton_of_nodup := ofPred_mem_list_eq_singleton_of_nodup + -- while `simp` is capable of proving this, it is not capable of turning the LHS into the RHS. @[simp] theorem default_coe_singleton (x : α) : (default : ({x} : Set α)) = ⟨x, rfl⟩ := @@ -354,10 +362,10 @@ theorem insert_inter_of_notMem (h : a ∉ t) : insert a s ∩ t = s ∩ t := by /-! ### Lemmas about pairs -/ theorem pair_eq_singleton (a : α) : ({a, a} : Set α) = {a} := - union_self _ + union_self {a} theorem pair_comm (a b : α) : ({a, b} : Set α) = {b, a} := - union_comm _ _ + union_comm {a} {b} theorem pair_eq_pair_iff {x y z w : α} : ({x, y} : Set α) = {z, w} ↔ x = z ∧ y = w ∨ x = w ∧ y = z := by diff --git a/Mathlib/Data/Set/Lattice.lean b/Mathlib/Data/Set/Lattice.lean index f83b4087cb7c9f..5bf2267815a49c 100644 --- a/Mathlib/Data/Set/Lattice.lean +++ b/Mathlib/Data/Set/Lattice.lean @@ -133,12 +133,16 @@ theorem nonempty_of_nonempty_iUnion_eq_univ {s : ι → Set α} [Nonempty α] (h_Union : ⋃ i, s i = univ) : Nonempty ι := nonempty_of_nonempty_iUnion (s := s) (by simpa only [h_Union] using univ_nonempty) -theorem setOf_exists (p : ι → β → Prop) : { x | ∃ i, p i x } = ⋃ i, { x | p i x } := +theorem ofPred_exists (p : ι → β → Prop) : { x | ∃ i, p i x } = ⋃ i, { x | p i x } := ext fun _ => .symm <| mem_iUnion -theorem setOf_forall (p : ι → β → Prop) : { x | ∀ i, p i x } = ⋂ i, { x | p i x } := +@[deprecated (since := "2026-07-09")] alias setOf_exists := ofPred_exists + +theorem ofPred_forall (p : ι → β → Prop) : { x | ∀ i, p i x } = ⋂ i, { x | p i x } := ext fun _ => .symm <| mem_iInter +@[deprecated (since := "2026-07-09")] alias setOf_forall := ofPred_forall + theorem iUnion_subset {s : ι → Set α} {t : Set α} (h : ∀ i, s i ⊆ t) : ⋃ i, s i ⊆ t := iSup_le h @@ -254,14 +258,18 @@ theorem iInter_subset_iInter₂ (κ : ι → Sort*) (s : ι → Set α) : ⋂ i, s i ⊆ ⋂ (i) (_ : κ i), s i := iInter_mono fun _ => subset_iInter fun _ => Subset.rfl -theorem iUnion_setOf (P : ι → α → Prop) : ⋃ i, { x : α | P i x } = { x : α | ∃ i, P i x } := by +theorem iUnion_ofPred (P : ι → α → Prop) : ⋃ i, { x : α | P i x } = { x : α | ∃ i, P i x } := by ext exact mem_iUnion -theorem iInter_setOf (P : ι → α → Prop) : ⋂ i, { x : α | P i x } = { x : α | ∀ i, P i x } := by +@[deprecated (since := "2026-07-09")] alias iUnion_setOf := iUnion_ofPred + +theorem iInter_ofPred (P : ι → α → Prop) : ⋂ i, { x : α | P i x } = { x : α | ∀ i, P i x } := by ext exact mem_iInter +@[deprecated (since := "2026-07-09")] alias iInter_setOf := iInter_ofPred + theorem iUnion_congr_of_surjective {f : ι → Set α} {g : ι₂ → Set α} (h : ι → ι₂) (h1 : Surjective h) (h2 : ∀ x, g (h x) = f x) : ⋃ x, f x = ⋃ y, g y := h1.iSup_congr h h2 @@ -1435,7 +1443,7 @@ theorem inter_iInter_nat_succ (u : ℕ → Set α) : (u 0 ∩ ⋂ i, u (i + 1)) theorem iUnion_le_nat : ⋃ n : ℕ, {i | i ≤ n} = Set.univ := subset_antisymm (Set.subset_univ _) - (fun i _ ↦ Set.mem_iUnion_of_mem i (Set.mem_setOf.mpr (le_refl _))) + (fun i _ ↦ Set.mem_iUnion_of_mem i (Set.mem_ofPred.mpr (le_refl _))) end Set diff --git a/Mathlib/Data/Set/List.lean b/Mathlib/Data/Set/List.lean index 42e52369b3c860..365b3d087ffa3c 100644 --- a/Mathlib/Data/Set/List.lean +++ b/Mathlib/Data/Set/List.lean @@ -39,7 +39,7 @@ theorem range_list_map_coe (s : Set α) : range (map ((↑) : s → α)) = { l | @[simp] theorem range_list_get : range l.get = { x | x ∈ l } := by ext x - rw [mem_setOf_eq, mem_iff_get, mem_range] + rw [mem_range, mem_ofPred_eq, mem_iff_get] theorem range_list_getElem? : range (l[·]? : ℕ → Option α) = insert none (some '' { x | x ∈ l }) := by diff --git a/Mathlib/Data/Set/MemPartition.lean b/Mathlib/Data/Set/MemPartition.lean index 55bef6ac416f99..02af93611c7d1f 100644 --- a/Mathlib/Data/Set/MemPartition.lean +++ b/Mathlib/Data/Set/MemPartition.lean @@ -96,7 +96,7 @@ lemma finite_memPartition (f : ℕ → Set α) (n : ℕ) : Set.Finite (memPartit rw [memPartition_succ] have : Finite (memPartition f n) := Set.finite_coe_iff.mp ih rw [← Set.finite_coe_iff] - simp_rw [setOf_exists, ← exists_prop, setOf_exists, setOf_or] + simp_rw [ofPred_exists, ← exists_prop, ofPred_exists, ofPred_or] refine Finite.Set.finite_biUnion (memPartition f n) _ (fun u _ ↦ ?_) rw [Set.finite_coe_iff] simp @@ -110,7 +110,7 @@ instance instFintype_memPartition (f : ℕ → Set α) (n : ℕ) : Fintype (memP open scoped Classical in /-- The set in `memPartition f n` to which `a : α` belongs. -/ -def memPartitionSet (f : ℕ → Set α) : ℕ → α → Set α +noncomputable def memPartitionSet (f : ℕ → Set α) : ℕ → α → Set α | 0 => fun _ ↦ univ | n + 1 => fun a ↦ if a ∈ f n then memPartitionSet f n a ∩ f n else memPartitionSet f n a \ f n diff --git a/Mathlib/Data/Set/Operations.lean b/Mathlib/Data/Set/Operations.lean index e67b3b4273a70a..3c874950ca9a90 100644 --- a/Mathlib/Data/Set/Operations.lean +++ b/Mathlib/Data/Set/Operations.lean @@ -73,28 +73,38 @@ namespace Set variable {α : Type u} {β : Type v} {γ : Type w} -/-! ### Lemmas about `mem` and `setOf` -/ +/-! ### Lemmas about `mem` and `Set.ofPred` -/ @[simp, mfld_simps, push] -theorem mem_setOf_eq {x : α} {p : α → Prop} : (x ∈ {y | p y}) = p x := rfl +theorem mem_ofPred_eq {x : α} {p : α → Prop} : (x ∈ {y | p y}) = p x := rfl -grind_pattern mem_setOf_eq => x ∈ setOf p +@[deprecated (since := "2026-07-09")] alias mem_setOf_eq := mem_ofPred_eq + +grind_pattern mem_ofPred_eq => x ∈ Set.ofPred p /-- This lemma is intended for use with `rw` where a membership predicate is needed, hence the explicit argument and the equality in the reverse direction from normal. -See also `Set.mem_setOf_eq` for the reverse direction applied to an argument. -/ -theorem eq_mem_setOf (p : α → Prop) : p = (· ∈ {a | p a}) := rfl +See also `Set.mem_ofPred_eq` for the reverse direction applied to an argument. -/ +theorem eq_mem_ofPred (p : α → Prop) : p = (· ∈ {a | p a}) := rfl + +@[deprecated (since := "2026-07-09")] alias eq_mem_setOf := eq_mem_ofPred + +theorem mem_ofPred {a : α} {p : α → Prop} : a ∈ { x | p x } ↔ p a := Iff.rfl -theorem mem_setOf {a : α} {p : α → Prop} : a ∈ { x | p x } ↔ p a := Iff.rfl +@[deprecated (since := "2026-07-09")] alias mem_setOf := mem_ofPred /-- If `h : a ∈ {x | p x}` then `h.out : p x`. These are definitionally equal, but this can nevertheless be useful for various reasons, e.g. to apply further projection notation or in an argument to `simp`. -/ -alias ⟨_root_.Membership.mem.out, _⟩ := mem_setOf +alias ⟨_root_.Membership.mem.out, _⟩ := mem_ofPred + +theorem notMem_ofPred_iff {a : α} {p : α → Prop} : a ∉ { x | p x } ↔ ¬p a := Iff.rfl + +@[deprecated (since := "2026-07-09")] alias notMem_setOf_iff := notMem_ofPred_iff -theorem notMem_setOf_iff {a : α} {p : α → Prop} : a ∉ { x | p x } ↔ ¬p a := Iff.rfl +@[simp] theorem ofPred_mem_eq {s : Set α} : { x | x ∈ s } = s := rfl -@[simp] theorem setOf_mem_eq {s : Set α} : { x | x ∈ s } = s := rfl +@[deprecated (since := "2026-07-09")] alias setOf_mem_eq := ofPred_mem_eq @[simp, mfld_simps, grind ←, push] theorem mem_univ (x : α) : x ∈ @univ α := trivial diff --git a/Mathlib/Data/Set/Order.lean b/Mathlib/Data/Set/Order.lean index 4711e21232b280..f5a0749752689b 100644 --- a/Mathlib/Data/Set/Order.lean +++ b/Mathlib/Data/Set/Order.lean @@ -108,12 +108,16 @@ theorem AntitoneOn.union [Preorder β] {f g : β → Set α} {s : Set β} (hf : namespace Set -theorem monotone_setOf [Preorder α] {p : α → β → Prop} (hp : ∀ b, Monotone fun a => p a b) : +theorem monotone_ofPred [Preorder α] {p : α → β → Prop} (hp : ∀ b, Monotone fun a => p a b) : Monotone fun a => { b | p a b } := fun _ _ h b => hp b h -theorem antitone_setOf [Preorder α] {p : α → β → Prop} (hp : ∀ b, Antitone fun a => p a b) : +@[deprecated (since := "2026-07-09")] alias monotone_setOf := monotone_ofPred + +theorem antitone_ofPred [Preorder α] {p : α → β → Prop} (hp : ∀ b, Antitone fun a => p a b) : Antitone fun a => { b | p a b } := fun _ _ h b => hp b h +@[deprecated (since := "2026-07-09")] alias antitone_setOf := antitone_ofPred + /-- Quantifying over a set is antitone in the set -/ theorem antitone_bforall {P : α → Prop} : Antitone fun s : Set α => ∀ x ∈ s, P x := fun _ _ hst h x hx => h x <| hst hx diff --git a/Mathlib/Data/Set/Pairwise/Basic.lean b/Mathlib/Data/Set/Pairwise/Basic.lean index 0aa1909479279b..f1bb1b4a50a058 100644 --- a/Mathlib/Data/Set/Pairwise/Basic.lean +++ b/Mathlib/Data/Set/Pairwise/Basic.lean @@ -443,11 +443,15 @@ lemma exists_lt_mem_inter_of_not_pairwise_disjoint [LinearOrder ι] theorem pairwise_disjoint_fiber (f : ι → α) : Pairwise (Disjoint on fun a : α => f ⁻¹' {a}) := pairwise_univ.1 <| Set.pairwiseDisjoint_fiber f univ -lemma subsingleton_setOf_mem_iff_pairwise_disjoint {f : ι → Set α} : +lemma subsingleton_setOfPred_mem_iff_pairwise_disjoint {f : ι → Set α} : (∀ a, {i | a ∈ f i}.Subsingleton) ↔ Pairwise (Disjoint on f) := ⟨fun h _ _ hij ↦ disjoint_left.2 fun a hi hj ↦ hij (h a hi hj), fun h _ _ hx _ hy ↦ by_contra fun hne ↦ disjoint_left.1 (h hne) hx hy⟩ +@[deprecated (since := "2026-07-09")] +alias subsingleton_setOf_mem_iff_pairwise_disjoint := + subsingleton_setOfPred_mem_iff_pairwise_disjoint + /-- Simp normal form of `pairwise_ne_iff_injective`. -/ @[simp] lemma pairwise_not_eq_iff_injective {f : ι → α} : Pairwise (fun i j ↦ ¬ f i = f j) ↔ f.Injective := by diff --git a/Mathlib/Data/Set/Pairwise/List.lean b/Mathlib/Data/Set/Pairwise/List.lean index 4c2bc5eceb3727..5fea4d78d4e59c 100644 --- a/Mathlib/Data/Set/Pairwise/List.lean +++ b/Mathlib/Data/Set/Pairwise/List.lean @@ -34,6 +34,6 @@ theorem Nodup.pairwise_coe [Std.Symm r] (hl : l.Nodup) : rw [List.nodup_cons] at hl have : ∀ b ∈ l, ¬a = b → r a b ↔ r a b := fun b hb => imp_iff_right (ne_of_mem_of_not_mem hb hl.1).symm - simp [Set.setOf_or, Set.pairwise_insert_of_symm, ih hl.2, and_comm, forall₂_congr this] + simp [Set.ofPred_or, Set.pairwise_insert_of_symm, ih hl.2, and_comm, forall₂_congr this] end List diff --git a/Mathlib/Data/Set/PowersetCard.lean b/Mathlib/Data/Set/PowersetCard.lean index f265c642600ca3..d4cc33918a1e48 100644 --- a/Mathlib/Data/Set/PowersetCard.lean +++ b/Mathlib/Data/Set/PowersetCard.lean @@ -40,7 +40,7 @@ open Finset Set Function @[simp] theorem mem_iff {s : Finset α} : s ∈ powersetCard α n ↔ s.card = n := by - rw [powersetCard, Set.mem_setOf_eq] + rw [powersetCard, Set.mem_ofPred_eq] instance : SetLike (powersetCard α n) α := SetLike.instSubtype diff --git a/Mathlib/Data/Set/Prod.lean b/Mathlib/Data/Set/Prod.lean index 14341437454387..9336c39a5c8a2e 100644 --- a/Mathlib/Data/Set/Prod.lean +++ b/Mathlib/Data/Set/Prod.lean @@ -266,7 +266,7 @@ theorem image_prodMk_subset_prod_left (hb : b ∈ t) : (fun a => (a, b)) '' s theorem image_prodMk_subset_prod_right (ha : a ∈ s) : Prod.mk a '' t ⊆ s ×ˢ t := by grind theorem prod_subset_preimage_fst (s : Set α) (t : Set β) : s ×ˢ t ⊆ Prod.fst ⁻¹' s := - inter_subset_left + inter_subset_left (s := Prod.fst ⁻¹' s) (t := Prod.snd ⁻¹' t) theorem fst_image_prod_subset (s : Set α) (t : Set β) : Prod.fst '' s ×ˢ t ⊆ s := image_subset_iff.2 <| prod_subset_preimage_fst s t @@ -280,7 +280,7 @@ lemma mapsTo_fst_prod {s : Set α} {t : Set β} : MapsTo Prod.fst (s ×ˢ t) s : fun _ hx ↦ (mem_prod.1 hx).1 theorem prod_subset_preimage_snd (s : Set α) (t : Set β) : s ×ˢ t ⊆ Prod.snd ⁻¹' t := - inter_subset_right + inter_subset_right (s := Prod.fst ⁻¹' s) (t := Prod.snd ⁻¹' t) theorem snd_image_prod_subset (s : Set α) (t : Set β) : Prod.snd '' s ×ˢ t ⊆ t := image_subset_iff.2 <| prod_subset_preimage_snd s t @@ -523,7 +523,7 @@ open Function.PullbackSelf Function.Pullback theorem preimage_map_fst_pullbackDiagonal {f : X → Y} {g : Z → Y} : @map_fst X Y Z f g ⁻¹' pullbackDiagonal f = pullbackDiagonal (@snd X Y Z f g) := by ext ⟨⟨p₁, p₂⟩, he⟩ - simp_rw [pullbackDiagonal, mem_setOf, Subtype.ext_iff, Prod.ext_iff] + simp_rw [pullbackDiagonal, mem_ofPred, Subtype.ext_iff, Prod.ext_iff] exact (and_iff_left he).symm theorem Function.Injective.preimage_pullbackDiagonal {f : X → Y} {g : Z → X} (inj : g.Injective) : @@ -723,7 +723,7 @@ theorem pi_if {p : ι → Prop} [h : DecidablePred p] (s : Set ι) (t₁ t₂ : by_cases p i <;> simp_all theorem union_pi : (s₁ ∪ s₂).pi t = s₁.pi t ∩ s₂.pi t := by - simp [pi, or_imp, forall_and, setOf_and] + simp [pi, or_imp, forall_and, ofPred_and] theorem union_pi_inter (ht₁ : ∀ i ∉ s₁, t₁ i = univ) (ht₂ : ∀ i ∉ s₂, t₂ i = univ) : diff --git a/Mathlib/Data/Set/Subset.lean b/Mathlib/Data/Set/Subset.lean index ec097dbab8d9b6..ac2372f08f5be3 100644 --- a/Mathlib/Data/Set/Subset.lean +++ b/Mathlib/Data/Set/Subset.lean @@ -91,7 +91,7 @@ lemma image_val_sdiff : (↑(D \ E) : Set α) = ↑D \ ↑E := image_sdiff Subty @[simp] lemma image_val_compl : ↑(Dᶜ) = A \ ↑D := by - rw [compl_eq_univ_sdiff, image_val_sdiff, image_univ, Subtype.range_coe_subtype, setOf_mem_eq] + rw [compl_eq_univ_sdiff, image_val_sdiff, image_univ, Subtype.range_coe_subtype, ofPred_mem_eq] @[simp] lemma image_val_sUnion : ↑(⋃₀ T) = ⋃₀ { (B : Set α) | B ∈ T} := by diff --git a/Mathlib/Data/SetLike/Basic.lean b/Mathlib/Data/SetLike/Basic.lean index f99140d7ea9d9a..a7af972e724f48 100644 --- a/Mathlib/Data/SetLike/Basic.lean +++ b/Mathlib/Data/SetLike/Basic.lean @@ -193,7 +193,9 @@ lemma mem_of_subset {s : Set B} (hp : s ⊆ p) {x : B} (hx : x ∈ s) : x ∈ p @[simp] protected theorem eta (x : p) (hx : (x : B) ∈ p) : (⟨x, hx⟩ : p) = x := rfl -@[simp] lemma setOf_mem_eq (a : A) : {b | b ∈ a} = a := rfl +@[simp] lemma setOfPred_mem_eq (a : A) : {b | b ∈ a} = a := rfl + +@[deprecated (since := "2026-07-09")] alias setOf_mem_eq := setOfPred_mem_eq @[nontriviality] lemma mem_of_subsingleton [Subsingleton B] (S : A) [h : Nonempty S] {b : B} : b ∈ S := by diff --git a/Mathlib/Data/Setoid/Partition.lean b/Mathlib/Data/Setoid/Partition.lean index 8f1be76aad388c..7cca12207d7cb7 100644 --- a/Mathlib/Data/Setoid/Partition.lean +++ b/Mathlib/Data/Setoid/Partition.lean @@ -441,7 +441,7 @@ theorem index_out (x : hs.Quotient) : hs.index x.out = hs.index (hs.out x) := theorem proj_out (x : hs.Quotient) : hs.proj (hs.out x) = x := Quotient.inductionOn' x fun x => Quotient.sound' <| hs.some_index x -theorem class_of {x : α} : setOf (hs.setoid x) = s (hs.index x) := +theorem class_of {x : α} : Set.ofPred (hs.setoid x) = s (hs.index x) := Set.ext fun _y => eq_comm.trans hs.mem_iff_index_eq.symm theorem proj_fiber (x : hs.Quotient) : hs.proj ⁻¹' {x} = s (hs.equivQuotient.symm x) := diff --git a/Mathlib/Data/Sym/Sym2.lean b/Mathlib/Data/Sym/Sym2.lean index 3e617857b0a269..26debcc4795a50 100644 --- a/Mathlib/Data/Sym/Sym2.lean +++ b/Mathlib/Data/Sym/Sym2.lean @@ -324,7 +324,7 @@ theorem mem_iff' {a b c : α} : Sym2.Mem a s(b, c) ↔ a = b ∨ a = c := instance : SetLike (Sym2 α) α where coe z := { x | z.Mem x } coe_injective z z' h := by - simp only [Set.ext_iff, Set.mem_setOf_eq] at h + simp only [Set.ext_iff, Set.mem_ofPred_eq] at h obtain ⟨x, y⟩ := z obtain ⟨x', y'⟩ := z' have hx := h x; have hy := h y; have hx' := h x'; have hy' := h y' @@ -559,11 +559,17 @@ theorem mem_diagSet_iff_isDiag (z : Sym2 α) : z ∈ diagSet ↔ z.IsDiag := .rf @[simp] lemma range_diag : .range (diag : α → Sym2 α) = diagSet := by ext ⟨a, b⟩; simp [diag, eq_comm] -theorem diagSet_eq_setOf_isDiag : diagSet = {z : Sym2 α | z.IsDiag} := rfl +theorem diagSet_eq_setOfPred_isDiag : diagSet = {z : Sym2 α | z.IsDiag} := rfl -@[deprecated Set.compl_setOf (since := "2025-12-10")] -theorem diagSet_compl_eq_setOf_not_isDiag : diagSetᶜ = {z : Sym2 α | ¬z.IsDiag} := - congrArg _ diagSet_eq_setOf_isDiag +@[deprecated (since := "2026-07-09")] +alias diagSet_eq_setOf_isDiag := diagSet_eq_setOfPred_isDiag + +@[deprecated Set.compl_ofPred (since := "2025-12-10")] +theorem diagSet_compl_eq_setOfPred_not_isDiag : diagSetᶜ = {z : Sym2 α | ¬z.IsDiag} := + congrArg _ diagSet_eq_setOfPred_isDiag + +@[deprecated (since := "2026-07-09")] +alias diagSet_compl_eq_setOf_not_isDiag := diagSet_compl_eq_setOfPred_not_isDiag theorem diagSet_eq_univ_of_subsingleton [Subsingleton α] : @diagSet α = Set.univ := by ext; simp @@ -591,7 +597,7 @@ variable {r r₁ r₂ : α → α → Prop} of elements that are related. -/ def fromRel (sym : Std.Symm r) : Set (Sym2 α) := - setOf <| lift ⟨r, fun _ _ ↦ propext ⟨symm, symm⟩⟩ + Set.ofPred <| lift ⟨r, fun _ _ ↦ propext ⟨symm, symm⟩⟩ @[simp] theorem fromRel_prop {sym : Std.Symm r} {a b : α} : s(a, b) ∈ fromRel sym ↔ r a b := diff --git a/Mathlib/Data/ZMod/Basic.lean b/Mathlib/Data/ZMod/Basic.lean index 492558652011b0..6bf445aa12e2c7 100644 --- a/Mathlib/Data/ZMod/Basic.lean +++ b/Mathlib/Data/ZMod/Basic.lean @@ -1279,7 +1279,7 @@ residue class of `k` mod `m`. -/ lemma Nat.range_mul_add (m k : ℕ) : Set.range (fun n : ℕ ↦ m * n + k) = {n : ℕ | (n : ZMod m) = k ∧ k ≤ n} := by ext n - simp only [Set.mem_range, Set.mem_setOf_eq] + simp only [Set.mem_range, Set.mem_ofPred_eq] conv => enter [1, 1, y]; rw [add_comm, eq_comm] refine ⟨fun ⟨a, ha⟩ ↦ ⟨?_, le_iff_exists_add.mpr ⟨_, ha⟩⟩, fun ⟨H₁, H₂⟩ ↦ ?_⟩ · simpa using congr_arg ((↑) : ℕ → ZMod m) ha diff --git a/Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean b/Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean index 191fe3bb458d88..45b0d101a9755c 100644 --- a/Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean +++ b/Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean @@ -130,7 +130,10 @@ theorem uniformEquicontinuous_birkhoffAverage (hf : LipschitzWith 1 f) (hg : Uni then the set of points `x` such that the Birkhoff average of `g` along the orbit of `x` tends to `l x` is a closed set. -/ -theorem isClosed_setOf_tendsto_birkhoffAverage +theorem isClosed_setOfPred_tendsto_birkhoffAverage (hf : LipschitzWith 1 f) (hg : UniformContinuous g) (hl : Continuous l) : IsClosed {x | Tendsto (birkhoffAverage 𝕜 f g · x) atTop (𝓝 (l x))} := - (uniformEquicontinuous_birkhoffAverage 𝕜 hf hg).equicontinuous.isClosed_setOf_tendsto hl + (uniformEquicontinuous_birkhoffAverage 𝕜 hf hg).equicontinuous.isClosed_setOfPred_tendsto hl + +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_tendsto_birkhoffAverage := isClosed_setOfPred_tendsto_birkhoffAverage diff --git a/Mathlib/Dynamics/Ergodic/Action/Basic.lean b/Mathlib/Dynamics/Ergodic/Action/Basic.lean index 229b01a0fb248a..e079684a042db8 100644 --- a/Mathlib/Dynamics/Ergodic/Action/Basic.lean +++ b/Mathlib/Dynamics/Ergodic/Action/Basic.lean @@ -31,7 +31,7 @@ then it is either null or conull. class ErgodicVAdd (G α : Type*) [VAdd G α] {_ : MeasurableSpace α} (μ : Measure α) : Prop extends VAddInvariantMeasure G α μ where aeconst_of_forall_preimage_vadd_ae_eq {s : Set α} : MeasurableSet s → - (∀ g : G, (g +ᵥ ·) ⁻¹' s =ᵐ[μ] s) → EventuallyConst s (ae μ) + (∀ g : G, (g +ᵥ ·) ⁻¹' s =ᵐˢ[μ] s) → EventuallyConst (· ∈ s) (ae μ) /-- A group action of `G` on a space `α` with measure `μ` is called *ergodic*, @@ -43,7 +43,7 @@ then it is either null or conull. class ErgodicSMul (G α : Type*) [SMul G α] {_ : MeasurableSpace α} (μ : Measure α) : Prop extends SMulInvariantMeasure G α μ where aeconst_of_forall_preimage_smul_ae_eq {s : Set α} : MeasurableSet s → - (∀ g : G, (g • ·) ⁻¹' s =ᵐ[μ] s) → EventuallyConst s (ae μ) + (∀ g : G, (g • ·) ⁻¹' s =ᵐˢ[μ] s) → EventuallyConst (· ∈ s) (ae μ) attribute [to_additive] ergodicSMul_iff @@ -53,8 +53,8 @@ variable (G : Type*) {α : Type*} {m : MeasurableSpace α} {μ : Measure α} @[to_additive] theorem aeconst_of_forall_preimage_smul_ae_eq [SMul G α] [ErgodicSMul G α μ] {s : Set α} - (hm : NullMeasurableSet s μ) (h : ∀ g : G, (g • ·) ⁻¹' s =ᵐ[μ] s) : - EventuallyConst s (ae μ) := by + (hm : NullMeasurableSet s μ) (h : ∀ g : G, (g • ·) ⁻¹' s =ᵐˢ[μ] s) : + EventuallyConst (· ∈ s) (ae μ) := by rcases hm with ⟨t, htm, hst⟩ refine .congr ?_ hst.symm refine ErgodicSMul.aeconst_of_forall_preimage_smul_ae_eq htm fun g : G ↦ ?_ @@ -66,20 +66,20 @@ section Group variable [Group G] [MulAction G α] [ErgodicSMul G α μ] {s : Set α} @[to_additive] -theorem aeconst_of_forall_smul_ae_eq (hm : NullMeasurableSet s μ) (h : ∀ g : G, g • s =ᵐ[μ] s) : - EventuallyConst s (ae μ) := +theorem aeconst_of_forall_smul_ae_eq (hm : NullMeasurableSet s μ) (h : ∀ g : G, g • s =ᵐˢ[μ] s) : + EventuallyConst (· ∈ s) (ae μ) := aeconst_of_forall_preimage_smul_ae_eq G hm fun g ↦ by simpa only [preimage_smul] using h g⁻¹ @[to_additive] theorem _root_.MulAction.aeconst_of_aestabilizer_eq_top - (hm : NullMeasurableSet s μ) (h : aestabilizer G μ s = ⊤) : EventuallyConst s (ae μ) := + (hm : NullMeasurableSet s μ) (h : aestabilizer G μ s = ⊤) : EventuallyConst (· ∈ s) (ae μ) := aeconst_of_forall_smul_ae_eq G hm <| (Subgroup.eq_top_iff' _).1 h end Group theorem _root_.ErgodicSMul.of_aestabilizer [Group G] [MulAction G α] [SMulInvariantMeasure G α μ] - (h : ∀ s, MeasurableSet s → aestabilizer G μ s = ⊤ → EventuallyConst s (ae μ)) : + (h : ∀ s, MeasurableSet s → aestabilizer G μ s = ⊤ → EventuallyConst (· ∈ s) (ae μ)) : ErgodicSMul G α μ := ⟨fun hm hs ↦ h _ hm <| (Subgroup.eq_top_iff' _).2 fun g ↦ by simpa only [preimage_smul_inv] using! hs g⁻¹⟩ diff --git a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean index 4387e479b994e7..b24a007a564499 100644 --- a/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean +++ b/Mathlib/Dynamics/Ergodic/Action/OfMinimal.lean @@ -52,19 +52,32 @@ Let `μ` be a finite inner regular measure on `X` which is ergodic with respect If a null measurable set `s` is a.e. equal to its preimages under the action of a dense set of elements of `M`, then it is either null or conull. -/] -theorem aeconst_of_dense_setOf_preimage_smul_ae (hsm : NullMeasurableSet s μ) - (hd : Dense {g : M | (g • ·) ⁻¹' s =ᵐ[μ] s}) : EventuallyConst s (ae μ) := by +theorem aeconst_of_dense_setOfPred_preimage_smul_ae (hsm : NullMeasurableSet s μ) + (hd : Dense {g : M | (g • ·) ⁻¹' s =ᵐˢ[μ] s}) : EventuallyConst (· ∈ s) (ae μ) := by borelize M refine aeconst_of_forall_preimage_smul_ae_eq M hsm ?_ rwa [dense_iff_closure_eq, IsClosed.closure_eq, eq_univ_iff_forall] at hd let f : C(M × X, X) := ⟨(· • ·).uncurry, continuous_smul⟩ - exact isClosed_setOf_preimage_ae_eq f.curry.continuous (measurePreserving_smul · μ) _ hsm + exact isClosed_setOfPred_preimage_ae_eq f.curry.continuous (measurePreserving_smul · μ) _ hsm (measure_ne_top _ _) +@[deprecated (since := "2026-07-09")] +alias aeconst_of_dense_setOf_preimage_smul_ae := aeconst_of_dense_setOfPred_preimage_smul_ae + +@[deprecated (since := "2026-07-09")] +alias aeconst_of_dense_setOf_preimage_vadd_ae := aeconst_of_dense_setOfPred_preimage_vadd_ae + @[to_additive] -theorem aeconst_of_dense_setOf_preimage_smul_eq (hsm : NullMeasurableSet s μ) - (hd : Dense {g : M | (g • ·) ⁻¹' s = s}) : EventuallyConst s (ae μ) := - aeconst_of_dense_setOf_preimage_smul_ae hsm <| hd.mono fun _ h ↦ mem_setOf.2 <| .of_eq h +theorem aeconst_of_dense_setOfPred_preimage_smul_eq (hsm : NullMeasurableSet s μ) + (hd : Dense {g : M | (g • ·) ⁻¹' s = s}) : EventuallyConst (· ∈ s) (ae μ) := + aeconst_of_dense_setOfPred_preimage_smul_ae hsm <| + hd.mono fun _ h ↦ mem_ofPred.2 <| .of_eq (congrArg Set.Mem h) + +@[deprecated (since := "2026-07-09")] +alias aeconst_of_dense_setOf_preimage_smul_eq := aeconst_of_dense_setOfPred_preimage_smul_eq + +@[deprecated (since := "2026-07-09")] +alias aeconst_of_dense_setOf_preimage_vadd_eq := aeconst_of_dense_setOfPred_preimage_vadd_eq /-- If a monoid `M` continuously acts on an R₁ topological space `X`, `g` is an element of `M` such that its natural powers are dense in `M`, @@ -80,9 +93,9 @@ theorem ergodic_smul_of_denseRange_pow {M : Type*} [Monoid M] [TopologicalSpace Ergodic (g • ·) μ := by borelize M refine ⟨measurePreserving_smul _ _, ⟨fun s hsm hs ↦ ?_⟩⟩ - refine aeconst_of_dense_setOf_preimage_smul_eq hsm.nullMeasurableSet (hg.mono ?_) + refine aeconst_of_dense_setOfPred_preimage_smul_eq hsm.nullMeasurableSet (hg.mono ?_) refine range_subset_iff.2 fun n ↦ ?_ - rw [mem_setOf, ← smul_iterate, preimage_iterate_eq, iterate_fixed hs] + rw [mem_ofPred, ← smul_iterate, preimage_iterate_eq, iterate_fixed hs] end SMul @@ -104,7 +117,7 @@ theorem ErgodicSMul.trans_isMinimal (N : Type*) [MulAction M N] measure_preimage_smul c s hsm := by simpa only [smul_one_smul] using SMulInvariantMeasure.measure_preimage_smul (c • 1 : N) hsm aeconst_of_forall_preimage_smul_ae_eq {s} hsm hs := by - refine aeconst_of_dense_setOf_preimage_smul_ae (M := N) hsm.nullMeasurableSet ?_ + refine aeconst_of_dense_setOfPred_preimage_smul_ae (M := N) hsm.nullMeasurableSet ?_ refine (MulAction.dense_orbit M 1).mono ?_ rintro _ ⟨g, rfl⟩ simpa using hs g @@ -120,8 +133,9 @@ variable {G : Type*} [Group G] [TopologicalSpace G] [ContinuousInv G] @[to_additive] theorem aeconst_of_dense_aestabilizer_smul (hsm : NullMeasurableSet s μ) - (hd : Dense (MulAction.aestabilizer G μ s : Set G)) : EventuallyConst s (ae μ) := - aeconst_of_dense_setOf_preimage_smul_ae hsm <| (hd.preimage (isOpenMap_inv _)).mono fun g hg ↦ by + (hd : Dense (MulAction.aestabilizer G μ s : Set G)) : EventuallyConst (· ∈ s) (ae μ) := + aeconst_of_dense_setOfPred_preimage_smul_ae hsm <| + (hd.preimage (isOpenMap_inv _)).mono fun g hg ↦ by simpa only [preimage_smul] using! hg /-- If a monoid `M` continuously acts on an R₁ topological space `X`, @@ -220,12 +234,13 @@ then it is pre-ergodic with respect to any finite inner regular left invariant m theorem preErgodic_of_dense_iUnion_preimage_one {μ : Measure G} [IsFiniteMeasure μ] [μ.InnerRegular] [μ.IsMulLeftInvariant] (f : G →* G) (hf : Dense (⋃ n, f^[n] ⁻¹' 1)) : PreErgodic f μ := by - refine ⟨fun s hsm hs ↦ aeconst_of_dense_setOf_preimage_smul_eq (M := G) hsm.nullMeasurableSet ?_⟩ + refine ⟨fun s hsm hs ↦ + aeconst_of_dense_setOfPred_preimage_smul_eq (M := G) hsm.nullMeasurableSet ?_⟩ refine hf.mono <| iUnion_subset fun n x hx ↦ ?_ have hsn : f^[n] ⁻¹' s = s := by rw [preimage_iterate_eq, iterate_fixed hs] rw [mem_preimage, Set.mem_one] at hx - rw [mem_setOf, ← hsn] + rw [mem_ofPred, ← hsn] ext y simp [hx] diff --git a/Mathlib/Dynamics/Ergodic/AddCircle.lean b/Mathlib/Dynamics/Ergodic/AddCircle.lean index 18cc7d4d865a22..5dc2545acd9926 100644 --- a/Mathlib/Dynamics/Ergodic/AddCircle.lean +++ b/Mathlib/Dynamics/Ergodic/AddCircle.lean @@ -46,8 +46,8 @@ rational angles with denominators tending to infinity, then it must be almost em -/ theorem ae_empty_or_univ_of_forall_vadd_ae_eq_self {s : Set <| AddCircle T} (hs : NullMeasurableSet s volume) {ι : Type*} {l : Filter ι} [l.NeBot] {u : ι → AddCircle T} - (hu₁ : ∀ i, (u i +ᵥ s : Set _) =ᵐ[volume] s) (hu₂ : Tendsto (addOrderOf ∘ u) l atTop) : - s =ᵐ[volume] (∅ : Set <| AddCircle T) ∨ s =ᵐ[volume] univ := by + (hu₁ : ∀ i, (u i +ᵥ s : Set _) =ᵐˢ[volume] s) (hu₂ : Tendsto (addOrderOf ∘ u) l atTop) : + s =ᵐˢ[volume] (∅ : Set <| AddCircle T) ∨ s =ᵐˢ[volume] univ := by /- Sketch of proof: Assume `T = 1` for simplicity and let `μ` be the Haar measure. We may assume `s` has positive measure since otherwise there is nothing to prove. In this case, by Lebesgue's density theorem, @@ -114,7 +114,7 @@ theorem ergodic_zsmul {n : ℤ} (hn : 1 < |n|) : Ergodic fun y : AddCircle T => have hnu : ∀ j, n ^ j • u j = 0 := fun j => by rw [← addOrderOf_dvd_iff_zsmul_eq_zero, hu₀, Int.natCast_pow, Int.natCast_natAbs, ← abs_pow, abs_dvd] - have hu₁ : ∀ j, (u j +ᵥ s : Set _) =ᵐ[volume] s := fun j => by + have hu₁ : ∀ j, (u j +ᵥ s : Set _) =ᵐˢ[volume] s := fun j => by rw [vadd_eq_self_of_preimage_zsmul_eq_self hs' (hnu j)] have hu₂ : Tendsto (fun j => addOrderOf <| u j) atTop atTop := by simp_rw [hu₀]; exact tendsto_pow_atTop_atTop_of_one_lt hn diff --git a/Mathlib/Dynamics/Ergodic/Conservative.lean b/Mathlib/Dynamics/Ergodic/Conservative.lean index 0a9c308321bc04..6132b29f967a0e 100644 --- a/Mathlib/Dynamics/Ergodic/Conservative.lean +++ b/Mathlib/Dynamics/Ergodic/Conservative.lean @@ -112,7 +112,7 @@ theorem frequently_measure_inter_ne_zero (hf : Conservative f μ) (hs : NullMeas obtain ⟨N, hN, hmax⟩ : ∃ N, μ (t N) ≠ 0 ∧ ∀ n > N, μ (t n) = 0 := by rw [Nat.frequently_atTop_iff_infinite, not_infinite] at H convert! exists_max_image _ (·) H ⟨0, by simpa⟩ using 4 - rw [gt_iff_lt, ← not_le, not_imp_comm, mem_setOf] + rw [gt_iff_lt, ← not_le, not_imp_comm, mem_ofPred] have htm {n : ℕ} : NullMeasurableSet (t n) μ := hs.inter <| hs.preimage <| hf.toQuasiMeasurePreserving.iterate n -- Then all `t n`, `n > N`, are null sets, hence `T = t N \ ⋃ n > N, t n` has positive measure. @@ -145,8 +145,8 @@ theorem measure_mem_forall_ge_image_notMem_eq_zero (hf : Conservative f μ) μ ({ x ∈ s | ∀ m ≥ n, f^[m] x ∉ s }) = 0 := by by_contra H have : NullMeasurableSet (s ∩ { x | ∀ m ≥ n, f^[m] x ∉ s }) μ := by - simp only [setOf_forall, ← compl_setOf] - exact hs.inter <| .biInter (to_countable _) fun m _ ↦ + simp only [ofPred_forall, ← compl_ofPred] + exact hs.inter <| .biInter (s := {m | m ≥ n}) (to_countable _) fun m _ ↦ (hs.preimage <| hf.toQuasiMeasurePreserving.iterate m).compl rcases (hf.exists_gt_measure_inter_ne_zero this H) n with ⟨m, hmn, hm⟩ rcases nonempty_of_measure_ne_zero hm with ⟨x, ⟨_, hxn⟩, hxm, -⟩ @@ -163,7 +163,7 @@ theorem ae_mem_imp_frequently_image_mem (hf : Conservative f μ) (hs : NullMeasu simp theorem inter_frequently_image_mem_ae_eq (hf : Conservative f μ) (hs : NullMeasurableSet s μ) : - (s ∩ { x | ∃ᶠ n in atTop, f^[n] x ∈ s } : Set α) =ᵐ[μ] s := + (s ∩ { x | ∃ᶠ n in atTop, f^[n] x ∈ s } : Set α) =ᵐˢ[μ] s := inter_eventuallyEq_left.2 <| hf.ae_mem_imp_frequently_image_mem hs theorem measure_inter_frequently_image_mem_eq (hf : Conservative f μ) (hs : NullMeasurableSet s μ) : diff --git a/Mathlib/Dynamics/Ergodic/Ergodic.lean b/Mathlib/Dynamics/Ergodic/Ergodic.lean index d0d2eb3aebaedd..6011e14536c7fa 100644 --- a/Mathlib/Dynamics/Ergodic/Ergodic.lean +++ b/Mathlib/Dynamics/Ergodic/Ergodic.lean @@ -42,7 +42,7 @@ variable {α : Type*} {m : MeasurableSpace α} {s : Set α} /-- A map `f : α → α` is said to be pre-ergodic with respect to a measure `μ` if any measurable strictly invariant set is either almost empty or full. -/ structure PreErgodic (f : α → α) (μ : Measure α := by volume_tac) : Prop where - aeconst_set ⦃s : Set α⦄ : MeasurableSet s → f ⁻¹' s = s → EventuallyConst s (ae μ) + aeconst_set ⦃s : Set α⦄ : MeasurableSet s → f ⁻¹' s = s → EventuallyConst (· ∈ s) (ae μ) /-- A map `f : α → α` is said to be ergodic with respect to a measure `μ` if it is measure preserving and pre-ergodic. -/ @@ -59,12 +59,12 @@ variable {f : α → α} {μ : Measure α} namespace PreErgodic theorem ae_empty_or_univ (hf : PreErgodic f μ) (hs : MeasurableSet s) (hfs : f ⁻¹' s = s) : - s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := by + s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := by simpa only [eventuallyConst_set'] using hf.aeconst_set hs hfs theorem measure_self_or_compl_eq_zero (hf : PreErgodic f μ) (hs : MeasurableSet s) (hs' : f ⁻¹' s = s) : μ s = 0 ∨ μ sᶜ = 0 := by - simpa using hf.ae_empty_or_univ hs hs' + simpa only [ae_eq_empty, ae_eq_univ] using hf.ae_empty_or_univ hs hs' theorem ae_mem_or_ae_notMem (hf : PreErgodic f μ) (hsm : MeasurableSet s) (hs : f ⁻¹' s = s) : (∀ᵐ x ∂μ, x ∈ s) ∨ ∀ᵐ x ∂μ, x ∉ s := @@ -125,22 +125,22 @@ end MeasureTheory.MeasurePreserving namespace QuasiErgodic -theorem aeconst_set₀ (hf : QuasiErgodic f μ) (hsm : NullMeasurableSet s μ) (hs : f ⁻¹' s =ᵐ[μ] s) : - EventuallyConst s (ae μ) := +theorem aeconst_set₀ (hf : QuasiErgodic f μ) (hsm : NullMeasurableSet s μ) + (hs : f ⁻¹' s =ᵐˢ[μ] s) : EventuallyConst (· ∈ s) (ae μ) := let ⟨_t, h₀, h₁, h₂⟩ := hf.toQuasiMeasurePreserving.exists_preimage_eq_of_preimage_ae hsm hs (hf.aeconst_set h₀ h₂).congr h₁ /-- For a quasi-ergodic map, sets that are almost invariant (rather than strictly invariant) are still either almost empty or full. -/ theorem ae_empty_or_univ₀ (hf : QuasiErgodic f μ) (hsm : NullMeasurableSet s μ) - (hs : f ⁻¹' s =ᵐ[μ] s) : - s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := + (hs : f ⁻¹' s =ᵐˢ[μ] s) : + s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := eventuallyConst_set'.mp <| hf.aeconst_set₀ hsm hs /-- For a quasi-ergodic map, sets that are almost invariant (rather than strictly invariant) are still either almost empty or full. -/ theorem ae_mem_or_ae_notMem₀ (hf : QuasiErgodic f μ) (hsm : NullMeasurableSet s μ) - (hs : f ⁻¹' s =ᵐ[μ] s) : + (hs : f ⁻¹' s =ᵐˢ[μ] s) : (∀ᵐ x ∂μ, x ∈ s) ∨ ∀ᵐ x ∂μ, x ∉ s := eventuallyConst_set.mp <| hf.aeconst_set₀ hsm hs @@ -163,22 +163,22 @@ theorem quasiErgodic (hf : Ergodic f μ) : QuasiErgodic f μ := /-- See also `Ergodic.ae_empty_or_univ_of_preimage_ae_le`. -/ theorem ae_empty_or_univ_of_preimage_ae_le' (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : f ⁻¹' s ≤ᵐ[μ] s) (h_fin : μ s ≠ ∞) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := by + (hs' : f ⁻¹' s ⊆ᵐ[μ] s) (h_fin : μ s ≠ ∞) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := by refine hf.quasiErgodic.ae_empty_or_univ₀ hs ?_ refine ae_eq_of_ae_subset_of_measure_ge hs' (hf.measure_preimage hs).ge ?_ h_fin exact hs.preimage hf.quasiMeasurePreserving /-- See also `Ergodic.ae_empty_or_univ_of_ae_le_preimage`. -/ theorem ae_empty_or_univ_of_ae_le_preimage' (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : s ≤ᵐ[μ] f ⁻¹' s) (h_fin : μ s ≠ ∞) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := by + (hs' : s ⊆ᵐ[μ] f ⁻¹' s) (h_fin : μ s ≠ ∞) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := by replace h_fin : μ (f ⁻¹' s) ≠ ∞ := by rwa [hf.measure_preimage hs] refine hf.quasiErgodic.ae_empty_or_univ₀ hs ?_ exact (ae_eq_of_ae_subset_of_measure_ge hs' (hf.measure_preimage hs).le hs h_fin).symm /-- See also `Ergodic.ae_empty_or_univ_of_image_ae_le`. -/ theorem ae_empty_or_univ_of_image_ae_le' (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : f '' s ≤ᵐ[μ] s) (h_fin : μ s ≠ ∞) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := by - replace hs' : s ≤ᵐ[μ] f ⁻¹' s := + (hs' : f '' s ⊆ᵐ[μ] s) (h_fin : μ s ≠ ∞) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := by + replace hs' : s ⊆ᵐ[μ] f ⁻¹' s := (LE.le.eventuallyLE (subset_preimage_image f s)).trans (hf.quasiMeasurePreserving.preimage_mono_ae hs') exact ae_empty_or_univ_of_ae_le_preimage' hf hs hs' h_fin @@ -205,15 +205,15 @@ section IsFiniteMeasure variable [IsFiniteMeasure μ] theorem ae_empty_or_univ_of_preimage_ae_le (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : f ⁻¹' s ≤ᵐ[μ] s) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := + (hs' : f ⁻¹' s ⊆ᵐ[μ] s) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := ae_empty_or_univ_of_preimage_ae_le' hf hs hs' <| measure_ne_top μ s theorem ae_empty_or_univ_of_ae_le_preimage (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : s ≤ᵐ[μ] f ⁻¹' s) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := + (hs' : s ⊆ᵐ[μ] f ⁻¹' s) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := ae_empty_or_univ_of_ae_le_preimage' hf hs hs' <| measure_ne_top μ s theorem ae_empty_or_univ_of_image_ae_le (hf : Ergodic f μ) (hs : NullMeasurableSet s μ) - (hs' : f '' s ≤ᵐ[μ] s) : s =ᵐ[μ] (∅ : Set α) ∨ s =ᵐ[μ] univ := + (hs' : f '' s ⊆ᵐ[μ] s) : s =ᵐˢ[μ] (∅ : Set α) ∨ s =ᵐˢ[μ] univ := ae_empty_or_univ_of_image_ae_le' hf hs hs' <| measure_ne_top μ s end IsFiniteMeasure diff --git a/Mathlib/Dynamics/Ergodic/MeasurePreserving.lean b/Mathlib/Dynamics/Ergodic/MeasurePreserving.lean index f032f13e6b867c..04f55b68b88db8 100644 --- a/Mathlib/Dynamics/Ergodic/MeasurePreserving.lean +++ b/Mathlib/Dynamics/Ergodic/MeasurePreserving.lean @@ -175,7 +175,7 @@ theorem aeconst_comp [MeasurableSingletonClass γ] {f : α → β} (hf : Measure theorem aeconst_preimage {f : α → β} (hf : MeasurePreserving f μa μb) {s : Set β} (hs : NullMeasurableSet s μb) : - Filter.EventuallyConst (f ⁻¹' s) (ae μa) ↔ Filter.EventuallyConst s (ae μb) := + Filter.EventuallyConst (· ∈ f ⁻¹' s) (ae μa) ↔ Filter.EventuallyConst (· ∈ s) (ae μb) := aeconst_comp hf hs.mem theorem add_measure {f μa' μb'} (hf : MeasurePreserving f μa μb) diff --git a/Mathlib/Dynamics/Ergodic/RadonNikodym.lean b/Mathlib/Dynamics/Ergodic/RadonNikodym.lean index cec2d32020fadd..f71e41cec533fe 100644 --- a/Mathlib/Dynamics/Ergodic/RadonNikodym.lean +++ b/Mathlib/Dynamics/Ergodic/RadonNikodym.lean @@ -86,7 +86,7 @@ theorem rnDeriv_comp_aeEq [IsFiniteMeasure ν] {f : X → X} have hν_sdiff : ν (f ⁻¹' s \ s) = ν (s \ f ⁻¹' s) := measure_sdiff_symm (hfν.measurable hsm).nullMeasurableSet hsm.nullMeasurableSet (hfν.measure_preimage hsm.nullMeasurableSet) (by finiteness) - suffices f ⁻¹' s =ᵐ[ν] s from this.mem_iff + suffices f ⁻¹' s =ᵐˢ[ν] s from this.mem_iff suffices ν (f ⁻¹' s \ s) = 0 from (ae_le_set.mpr this).antisymm (ae_le_set.mpr <| hν_sdiff ▸ this) contrapose! hμ_sdiff with h₀ apply ne_of_gt diff --git a/Mathlib/Dynamics/OmegaLimit.lean b/Mathlib/Dynamics/OmegaLimit.lean index 870d7fcb88d7fb..c87a44a1e6a57a 100644 --- a/Mathlib/Dynamics/OmegaLimit.lean +++ b/Mathlib/Dynamics/OmegaLimit.lean @@ -352,7 +352,7 @@ theorem omegaLimit_omegaLimit (hf : ∀ t, Tendsto (t + ·) f f) : ω f ϕ (ω f (inter_subset_inter_left _ ((isInvariant_iff_image _ _).mp (isInvariant_omegaLimit _ _ _ hf) _)) have l₂ : (closure (image2 ϕ u s) ∩ o).Nonempty := - l₁.mono fun b hb ↦ ⟨omegaLimit_subset_closure_image2 _ _ _ hu hb.1, hb.2⟩ + l₁.mono <| inter_subset_inter_left o <| omegaLimit_subset_closure_image2 _ _ _ hu have l₃ : (o ∩ image2 ϕ u s).Nonempty := by rcases l₂ with ⟨b, hb₁, hb₂⟩ exact mem_closure_iff_nhds.mp hb₁ o (IsOpen.mem_nhds ho₂ hb₂) diff --git a/Mathlib/Dynamics/SymbolicDynamics/Basic.lean b/Mathlib/Dynamics/SymbolicDynamics/Basic.lean index a4fc0e98d9f987..61234f326b2962 100644 --- a/Mathlib/Dynamics/SymbolicDynamics/Basic.lean +++ b/Mathlib/Dynamics/SymbolicDynamics/Basic.lean @@ -582,7 +582,7 @@ variable {A : Type*} [Fintype A] [Inhabited A] variable {G : Type*} /-- Patterns with support exactly `U` form a finite set. -/ -lemma finite_setOf_pattern_support_eq +lemma finite_setOfPred_pattern_support_eq {A G : Type*} [Finite A] [Inhabited A] (U : Finset G) : ({p : Pattern A G | p.support = U}).Finite := by @@ -608,6 +608,9 @@ lemma finite_setOf_pattern_support_eq let : Fintype { p : Pattern A G | p.support = U } := Fintype.ofEquiv (U → A) e.symm apply toFinite +@[deprecated (since := "2026-07-09")] +alias finite_setOf_pattern_support_eq := finite_setOfPred_pattern_support_eq + /-- The language of a set of configurations `X` on a finite shape `U`. This is the set of all finite patterns obtained by restricting some configuration diff --git a/Mathlib/Dynamics/TopologicalEntropy/DynamicalEntourage.lean b/Mathlib/Dynamics/TopologicalEntropy/DynamicalEntourage.lean index edd594e8e8adad..2c79f90c009f3b 100644 --- a/Mathlib/Dynamics/TopologicalEntropy/DynamicalEntourage.lean +++ b/Mathlib/Dynamics/TopologicalEntropy/DynamicalEntourage.lean @@ -95,7 +95,7 @@ lemma dynEntourage_comp_subset (T : X → X) (U V : SetRel X X) (n : ℕ) : (dynEntourage T U n) ○ (dynEntourage T V n) ⊆ dynEntourage T (U ○ V) n := by simp only [dynEntourage, map_iterate, subset_iInter_iff] intro k k_n xy xy_comp - simp only [SetRel.comp, mem_iInter, mem_preimage, map_apply, mem_setOf_eq] at xy_comp ⊢ + simp only [SetRel.comp, mem_iInter, mem_preimage, map_apply, mem_ofPred_eq] at xy_comp ⊢ rcases xy_comp with ⟨z, hz1, hz2⟩ exact mem_ball_comp (hz1 k k_n) (hz2 k k_n) diff --git a/Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean b/Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean index fd3269e6bc03fa..14dc7e28d3b6fe 100644 --- a/Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean +++ b/Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean @@ -125,24 +125,24 @@ lemma netMaxcard_finite_iff (T : X → X) (F : Set X) (U : SetRel X X) (n : ℕ) have : netMaxcard T F U n = sSup (WithTop.some '' Finset.card '' {s : Finset X | IsDynNetIn T F U n s}) := by rw [netMaxcard, ← image_comp, sSup_image] - simp only [mem_setOf_eq, ENat.some_eq_coe, Function.comp_apply] + simp only [mem_ofPred_eq, ENat.some_eq_coe, Function.comp_apply] exact biSup_congr (fun _ _ ↦ rfl) rw [this] at k_max have h_bdda : BddAbove (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}) := by refine ⟨k, mem_upperBounds.2 ?_⟩ - simp only [mem_image, mem_setOf_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] + simp only [mem_image, mem_ofPred_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro s h rw [← ENat.coe_le_coe, k_max] apply le_sSup - exact Filter.frequently_principal.mp fun a ↦ a (by simpa using ⟨_, h, rfl⟩) rfl + exact mem_image_of_mem _ (mem_image_of_mem Finset.card h) have h_nemp : (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}).Nonempty := by refine ⟨0, ?_⟩ - simp only [mem_image, mem_setOf_eq, Finset.card_eq_zero, exists_eq_right, Finset.coe_empty] + simp only [mem_image, mem_ofPred_eq, Finset.card_eq_zero, exists_eq_right, Finset.coe_empty] exact isDynNetIn_empty rw [← WithTop.coe_sSup' h_bdda] at k_max have key := Nat.sSup_mem h_nemp h_bdda rw [← Nat.cast_inj.mp k_max, mem_image] at key - simp only [mem_setOf_eq] at key + simp only [mem_ofPred_eq] at key exact key · obtain ⟨s, _, s_card⟩ := h rw [← s_card] diff --git a/Mathlib/Dynamics/TopologicalEntropy/Subset.lean b/Mathlib/Dynamics/TopologicalEntropy/Subset.lean index 721a6d24706bb2..81393d45db5f82 100644 --- a/Mathlib/Dynamics/TopologicalEntropy/Subset.lean +++ b/Mathlib/Dynamics/TopologicalEntropy/Subset.lean @@ -49,7 +49,7 @@ section Subset lemma IsDynCoverOf.monotone_subset (F_G : F ⊆ G) (h : IsDynCoverOf T G U n s) : IsDynCoverOf T F U n s := - F_G.trans h + fun _ hx ↦ h (F_G hx) lemma IsDynNetIn.monotone_subset (F_G : F ⊆ G) (h : IsDynNetIn T F U n s) : IsDynNetIn T G U n s := ⟨h.1.trans F_G, h.2⟩ diff --git a/Mathlib/FieldTheory/AxGrothendieck.lean b/Mathlib/FieldTheory/AxGrothendieck.lean index 94d369434cca0b..d1d13261570460 100644 --- a/Mathlib/FieldTheory/AxGrothendieck.lean +++ b/Mathlib/FieldTheory/AxGrothendieck.lean @@ -159,7 +159,7 @@ theorem realize_genericPolyMapSurjOnOfInjOn realize_bdEqual, Term.realize_relabel, Equiv.forall_congr_left (Equiv.curry (Fin 2) ι K), Equiv.curry_symm_apply, Fin.forall_fin_succ_pi, Fin.forall_fin_zero_pi, realize_iExs, realize_inf, Sum.forall_sum, - Set.MapsTo, Set.mem_setOf_eq, injOnAlt, funext_iff, Set.SurjOn, Set.image, + Set.MapsTo, Set.mem_ofPred_eq, injOnAlt, funext_iff, Set.SurjOn, Set.image, Set.subset_def, Equiv.forall_congr_left (mvPolynomialSupportLEEquiv mons)] simp +singlePass only [← Sum.elim_comp_inl_inr] -- was `simp` and very slow (https://github.com/leanprover-community/mathlib4/issues/19751) @@ -186,7 +186,7 @@ theorem ACF_models_genericPolyMapSurjOnOfInjOn_of_prime_or_zero rcases hp with hp | rfl · exact ACF_models_genericPolyMapSurjOnOfInjOn_of_prime hp φ mons · rw [ACF_zero_realize_iff_infinite_ACF_prime_realize] - convert! Set.infinite_univ (α := Nat.Primes) + convert Set.infinite_univ (α := Nat.Primes) using 1 rw [Set.eq_univ_iff_forall] intro ⟨p, hp⟩ exact ACF_models_genericPolyMapSurjOnOfInjOn_of_prime hp φ mons diff --git a/Mathlib/FieldTheory/CardinalEmb.lean b/Mathlib/FieldTheory/CardinalEmb.lean index 7530ef2bb6bb7d..531bb83766ccef 100644 --- a/Mathlib/FieldTheory/CardinalEmb.lean +++ b/Mathlib/FieldTheory/CardinalEmb.lean @@ -122,8 +122,8 @@ def leastExt : ι → ι := wellFounded_lt.fix fun i ih ↦ let s := range fun j : Iio i ↦ b (ih j j.2) wellFounded_lt.min {k | b k ∉ adjoin F s} <| by - rw [← compl_setOf, nonempty_compl]; by_contra! - simp_rw [eq_univ_iff_forall, mem_setOf] at this + rw [← compl_ofPred, nonempty_compl]; by_contra! + simp_rw [eq_univ_iff_forall, mem_ofPred] at this have := adjoin_le_iff.mpr (range_subset_iff.mpr this) rw [adjoin_basis_eq_top, ← eq_top_iff] at this apply_fun Module.rank F at this diff --git a/Mathlib/FieldTheory/Extension.lean b/Mathlib/FieldTheory/Extension.lean index 7406aef78c527b..0dc0a2a2c0dd26 100644 --- a/Mathlib/FieldTheory/Extension.lean +++ b/Mathlib/FieldTheory/Extension.lean @@ -193,7 +193,7 @@ theorem nonempty_algHom_of_exist_lifts_finset [alg : Algebra.IsAlgebraic F E] ⟨by simpa only [L, restrictScalars_adjoin_eq_sup, left_lt_sup, adjoin_simple_le_iff], AlgHom.coe_ringHom_injective σ.comp_algebraMap⟩ have ⟨(ϕ_ext : ϕ.IsExtendible), ϕ_max⟩ := maximal_iff_forall_gt.mp hϕ - simp_rw [Set.mem_setOf, IsExtendible] at ϕ_max; push Not at ϕ_max + simp_rw [Set.mem_ofPred, IsExtendible] at ϕ_max; push Not at ϕ_max choose S hS using fun σ : Λ ↦ ϕ_max (hL σ) classical have ⟨θ, hθϕ, hθ⟩ := ϕ_ext ({α} ∪ Finset.univ.biUnion S) diff --git a/Mathlib/FieldTheory/Finite/Polynomial.lean b/Mathlib/FieldTheory/Finite/Polynomial.lean index 79ff199c044ab2..a52952e6b8134f 100644 --- a/Mathlib/FieldTheory/Finite/Polynomial.lean +++ b/Mathlib/FieldTheory/Finite/Polynomial.lean @@ -175,7 +175,7 @@ noncomputable def evalᵢ [CommRing K] : R σ K →ₗ[K] (σ → K) → K := open scoped Classical in noncomputable instance decidableRestrictDegree (m : ℕ) : DecidablePred (· ∈ { n : σ →₀ ℕ | ∀ i, n i ≤ m }) := by - simp only [Set.mem_setOf_eq]; infer_instance + simp only [Set.mem_ofPred_eq]; infer_instance variable [Field K] diff --git a/Mathlib/FieldTheory/Galois/Infinite.lean b/Mathlib/FieldTheory/Galois/Infinite.lean index ad9b29753d6c4d..535b3f0ca54793 100644 --- a/Mathlib/FieldTheory/Galois/Infinite.lean +++ b/Mathlib/FieldTheory/Galois/Infinite.lean @@ -63,20 +63,17 @@ open FiniteGaloisIntermediateField AlgEquiv lemma fixingSubgroup_isClosed (L : IntermediateField k K) [IsGalois k K] : IsClosed (L.fixingSubgroup : Set Gal(K/k)) where isOpen_compl := isOpen_iff_mem_nhds.mpr fun σ h => by - apply mem_nhds_iff.mpr - rcases Set.not_subset.mp ((mem_fixingSubgroup_iff Gal(K/k)).not.mp h) with ⟨y, yL, ne⟩ - use σ • ((adjoin k {y}).1.fixingSubgroup : Set Gal(K/k)) - constructor - · intro f hf - rcases (Set.mem_smul_set.mp hf) with ⟨g, hg, eq⟩ - simp only [Set.mem_compl_iff, SetLike.mem_coe, ← eq] - apply (mem_fixingSubgroup_iff Gal(K/k)).not.mpr + obtain ⟨y, yL, ne⟩ : ∃ y ∈ L, σ y ≠ y := by + simpa using (mem_fixingSubgroup_iff Gal(K/k)).not.mp h + refine mem_nhds_iff.2 ⟨σ • (adjoin k {y}).1.fixingSubgroup, fun f hf ↦ ?_, ?_⟩ + · rw [Set.mem_smul_set_iff_inv_smul_mem, smul_eq_mul] at hf + simp only [Set.mem_compl_iff, SetLike.mem_coe, IntermediateField.mem_fixingSubgroup_iff, + not_forall, exists_prop] push Not - use y - simp only [yL, smul_eq_mul, AlgEquiv.smul_def, AlgEquiv.mul_apply, ne_eq, true_and] - have : g y = y := (mem_fixingSubgroup_iff Gal(K/k)).mp hg y <| - adjoin_simple_le_iff.mp le_rfl - simpa only [this, ne_eq, AlgEquiv.smul_def] using! ne + refine ⟨y, yL, ?_⟩ + contrapose! ne + simpa [ne, AlgEquiv.eq_symm_apply, eq_comm] using + (mem_fixingSubgroup_iff Gal(K/k)).mp hf y <| adjoin_simple_le_iff.mp le_rfl · simp only [(IntermediateField.fixingSubgroup_isOpen (adjoin k {y}).1).smul σ, true_and] use 1 simp only [SetLike.mem_coe, smul_eq_mul, mul_one, and_true, Subgroup.one_mem] diff --git a/Mathlib/FieldTheory/Minpoly/Basic.lean b/Mathlib/FieldTheory/Minpoly/Basic.lean index 60a802900b6e8f..5f9cd25023d49c 100644 --- a/Mathlib/FieldTheory/Minpoly/Basic.lean +++ b/Mathlib/FieldTheory/Minpoly/Basic.lean @@ -39,7 +39,9 @@ the minimal polynomial of `f` is `minpoly 𝕜 f`. -/ @[stacks 09GM] noncomputable def minpoly (x : B) : A[X] := - if hx : IsIntegral A x then degree_lt_wf.min _ hx else 0 + if hx : IsIntegral A x then + degree_lt_wf.min {p | p.Monic ∧ Polynomial.eval₂ (algebraMap A B) x p = 0} hx + else 0 end MinPolyDef @@ -54,7 +56,7 @@ variable {x : B} theorem monic (hx : IsIntegral A x) : Monic (minpoly A x) := by delta minpoly rw [dif_pos hx] - exact (degree_lt_wf.min_mem _ hx).1 + exact (degree_lt_wf.min_mem {p | p.Monic ∧ Polynomial.eval₂ (algebraMap A B) x p = 0} hx).1 /-- A minimal polynomial is nonzero. -/ theorem ne_zero [Nontrivial A] (hx : IsIntegral A x) : minpoly A x ≠ 0 := @@ -89,7 +91,7 @@ variable (A x) theorem aeval : aeval x (minpoly A x) = 0 := by delta minpoly split_ifs with hx - · exact (degree_lt_wf.min_mem _ hx).2 + · exact (degree_lt_wf.min_mem {p | p.Monic ∧ Polynomial.eval₂ (algebraMap A B) x p = 0} hx).2 · exact aeval_zero _ /-- Given any `f : B →ₐ[A] B'` and any `x : L`, the minimal polynomial of `x` vanishes at `f x`. -/ diff --git a/Mathlib/Geometry/Diffeology/Basic.lean b/Mathlib/Geometry/Diffeology/Basic.lean index 8262d574912185..caa4398bae32ee 100644 --- a/Mathlib/Geometry/Diffeology/Basic.lean +++ b/Mathlib/Geometry/Diffeology/Basic.lean @@ -204,10 +204,16 @@ end Defs @[ext] protected theorem _root_.DiffeologicalSpace.ext {X : Type*} {d₁ d₂ : DiffeologicalSpace X} (h : @IsPlot _ d₁ = @IsPlot _ d₂) : d₁ = d₂ := by + have hp : d₁.plots = d₂.plots := by + funext n + ext p + exact iff_of_eq (congrFun (congrFun h n) p) obtain ⟨p₁, _, _, _, t₁, h₁⟩ := d₁ obtain ⟨p₂, _, _, _, t₂, h₂⟩ := d₂ - congr 1; ext s - exact ((show p₁ = p₂ from h) ▸ @h₁ s).trans (@h₂ s).symm + obtain rfl : p₁ = p₂ := hp + congr 1 + ext s + exact (@h₁ s).trans (@h₂ s).symm @[fun_prop] lemma isPlot_const {n : ℕ} {x : X} : IsPlot (fun _ ↦ x : 𝔼ⁿ → X) := diff --git a/Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean b/Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean index 6e11b9084bc6e6..ab792de1c22873 100644 --- a/Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean +++ b/Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean @@ -696,7 +696,7 @@ theorem _root_.Collinear.oangle_sign_of_sameRay_vsub {p₁ p₂ p₃ p₄ : P} ( Set.univ ×ˢ {v | SameRay ℝ (p₂ -ᵥ p₁) v ∧ v ≠ 0} have hco : IsConnected s := haveI : ConnectedSpace line[ℝ, p₁, p₂] := AddTorsor.connectedSpace _ _ - (isConnected_univ.prod (isConnected_setOf_sameRay_and_ne_zero + (isConnected_univ.prod (isConnected_setOfPred_sameRay_and_ne_zero (vsub_ne_zero.2 hp₁p₂.symm))).image _ (by fun_prop) have hf : ContinuousOn (fun p : P × P × P => ∡ p.1 p.2.1 p.2.2) s := by refine continuousOn_of_forall_continuousAt fun p hp => continuousAt_oangle ?_ ?_ @@ -705,7 +705,7 @@ theorem _root_.Collinear.oangle_sign_of_sameRay_vsub {p₁ p₂ p₃ p₄ : P} ( obtain ⟨q₁, q₅, q₂⟩ := p dsimp only at hp ⊢ obtain ⟨⟨⟨q, hq⟩, v⟩, hv, rfl, rfl, rfl⟩ := hp - dsimp only [Subtype.coe_mk, Set.mem_setOf] at hv ⊢ + dsimp only [Subtype.coe_mk, Set.mem_ofPred] at hv ⊢ obtain ⟨hvr, -⟩ := hv rintro rfl refine hc₅₁₂ ((collinear_insert_iff_of_mem_affineSpan ?_).2 (collinear_pair _ _ _)) @@ -717,12 +717,12 @@ theorem _root_.Collinear.oangle_sign_of_sameRay_vsub {p₁ p₂ p₃ p₄ : P} ( exact smul_vsub_rev_mem_vectorSpan_pair _ _ _ have hsp : ∀ p : P × P × P, p ∈ s → ∡ p.1 p.2.1 p.2.2 ≠ 0 ∧ ∡ p.1 p.2.1 p.2.2 ≠ π := by intro p hp - simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and, + simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_ofPred, Set.mem_univ, true_and, Prod.ext_iff] at hp obtain ⟨q₁, q₅, q₂⟩ := p dsimp only at hp ⊢ obtain ⟨⟨⟨q, hq⟩, v⟩, hv, rfl, rfl, rfl⟩ := hp - dsimp only [Subtype.coe_mk, Set.mem_setOf] at hv ⊢ + dsimp only [Subtype.coe_mk, Set.mem_ofPred] at hv ⊢ obtain ⟨hvr, hv0⟩ := hv rw [← exists_nonneg_left_iff_sameRay (vsub_ne_zero.2 hp₁p₂.symm)] at hvr obtain ⟨r, -, rfl⟩ := hvr @@ -735,13 +735,13 @@ theorem _root_.Collinear.oangle_sign_of_sameRay_vsub {p₁ p₂ p₃ p₄ : P} ( rw [direction_affineSpan] exact smul_vsub_rev_mem_vectorSpan_pair _ _ _ have hp₁p₂s : (p₁, p₅, p₂) ∈ s := by - simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and, + simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_ofPred, Set.mem_univ, true_and, Prod.ext_iff] refine ⟨⟨⟨p₁, left_mem_affineSpan_pair ℝ _ _⟩, p₂ -ᵥ p₁⟩, ⟨SameRay.rfl, vsub_ne_zero.2 hp₁p₂.symm⟩, ?_⟩ simp have hp₃p₄s : (p₃, p₅, p₄) ∈ s := by - simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_setOf, Set.mem_univ, true_and, + simp_rw [s, Set.mem_image, Set.mem_prod, Set.mem_ofPred, Set.mem_univ, true_and, Prod.ext_iff] refine ⟨⟨⟨p₃, hc.mem_affineSpan_of_mem_of_ne (Set.mem_insert _ _) (Set.mem_insert_of_mem _ (Set.mem_insert _ _)) @@ -811,11 +811,11 @@ theorem _root_.AffineSubspace.SSameSide.oangle_sign_eq {s : AffineSubspace ℝ P by_cases h : p₁ = p₂; · simp [h] let sp : Set (P × P × P) := (fun p : P => (p₁, p, p₂)) '' {p | s.SSameSide p₃ p} have hc : IsConnected sp := - (isConnected_setOf_sSameSide hp₃p₄.2.1 hp₃p₄.nonempty).image _ (by fun_prop) + (isConnected_setOfPred_sSameSide hp₃p₄.2.1 hp₃p₄.nonempty).image _ (by fun_prop) have hf : ContinuousOn (fun p : P × P × P => ∡ p.1 p.2.1 p.2.2) sp := by refine continuousOn_of_forall_continuousAt fun p hp => continuousAt_oangle ?_ ?_ all_goals - simp_rw [sp, Set.mem_image, Set.mem_setOf] at hp + simp_rw [sp, Set.mem_image, Set.mem_ofPred] at hp obtain ⟨p', hp', rfl⟩ := hp dsimp only rintro rfl @@ -823,7 +823,7 @@ theorem _root_.AffineSubspace.SSameSide.oangle_sign_eq {s : AffineSubspace ℝ P · exact hp'.2.2 hp₂ have hsp : ∀ p : P × P × P, p ∈ sp → ∡ p.1 p.2.1 p.2.2 ≠ 0 ∧ ∡ p.1 p.2.1 p.2.2 ≠ π := by intro p hp - simp_rw [sp, Set.mem_image, Set.mem_setOf] at hp + simp_rw [sp, Set.mem_image, Set.mem_ofPred] at hp obtain ⟨p', hp', rfl⟩ := hp dsimp only rw [oangle_ne_zero_and_ne_pi_iff_affineIndependent] diff --git a/Mathlib/Geometry/Euclidean/Circumcenter.lean b/Mathlib/Geometry/Euclidean/Circumcenter.lean index 4f79e5b964beae..f089fbd691f958 100644 --- a/Mathlib/Geometry/Euclidean/Circumcenter.lean +++ b/Mathlib/Geometry/Euclidean/Circumcenter.lean @@ -163,7 +163,7 @@ theorem _root_.AffineIndependent.existsUnique_dist_eq {ι : Type*} [hne : Nonemp simp · simp haveI : Nonempty ι2 := Fintype.card_pos_iff.1 (hc.symm ▸ Nat.zero_lt_succ _) - have ha2 : AffineIndependent ℝ fun i2 : ι2 => p i2 := ha.subtype _ + have ha2 : AffineIndependent ℝ fun i2 : ι2 => p i2 := ha.subtype {x | x ≠ i} replace hm := hm ha2 _ hc have hr : Set.range p = insert (p i) (Set.range fun i2 : ι2 => p i2) := by change _ = insert _ (Set.range fun i2 : { x | x ≠ i } => p i2) diff --git a/Mathlib/Geometry/Euclidean/Sphere/Tangent.lean b/Mathlib/Geometry/Euclidean/Sphere/Tangent.lean index 44141b8669e0c3..c029f52fc2ea4e 100644 --- a/Mathlib/Geometry/Euclidean/Sphere/Tangent.lean +++ b/Mathlib/Geometry/Euclidean/Sphere/Tangent.lean @@ -259,7 +259,7 @@ lemma IsTangentAt.eq_orthogonalProjection {s : Sphere P} {p : P} {as : AffineSub rwa [isTangent_iff_isTangentAt_orthogonalProjection] at h' /-- The set of all maximal tangent spaces to the sphere `s`. -/ -def tangentSet (s : Sphere P) : Set (AffineSubspace ℝ P) := +noncomputable def tangentSet (s : Sphere P) : Set (AffineSubspace ℝ P) := s.orthRadius '' s lemma mem_tangentSet_iff {as : AffineSubspace ℝ P} {s : Sphere P} : @@ -292,7 +292,7 @@ lemma isTangent_of_mem_tangentsFrom {as : AffineSubspace ℝ P} {s : Sphere P} { isTangent_of_mem_tangentSet h.1 /-- The set of all maximal common tangent spaces to the spheres `s₁` and `s₂`. -/ -def commonTangents (s₁ s₂ : Sphere P) : Set (AffineSubspace ℝ P) := +noncomputable def commonTangents (s₁ s₂ : Sphere P) : Set (AffineSubspace ℝ P) := s₁.tangentSet ∩ s₂.tangentSet lemma mem_commonTangents_iff {as : AffineSubspace ℝ P} {s₁ s₂ : Sphere P} : diff --git a/Mathlib/Geometry/Group/Growth/QuotientInter.lean b/Mathlib/Geometry/Group/Growth/QuotientInter.lean index 32b41688f396bc..072887d3c13d8b 100644 --- a/Mathlib/Geometry/Group/Growth/QuotientInter.lean +++ b/Mathlib/Geometry/Group/Growth/QuotientInter.lean @@ -43,7 +43,7 @@ lemma card_pow_quotient_mul_pow_inter_subgroup_le : _ ≤ #(((A ^ m).image π).image φ * {x ∈ A ^ n | x ∈ H}) := by rw [Finset.card_mul_iff.2] simp only [Set.InjOn, coe_image, coe_pow, coe_filter, Set.mem_prod, Set.mem_image, - exists_exists_and_eq_and, Set.mem_setOf_eq, and_imp, forall_exists_index, Prod.forall, + exists_exists_and_eq_and, Set.mem_ofPred_eq, and_imp, forall_exists_index, Prod.forall, Prod.mk.injEq] rintro _ a₁ b₁ hb₁ rfl - ha₁ _ a₂ b₂ hb₂ rfl - ha₂ hab have hπa₁ : π a₁ = 1 := (QuotientGroup.eq_one_iff _).2 ha₁ diff --git a/Mathlib/Geometry/Manifold/Complex.lean b/Mathlib/Geometry/Manifold/Complex.lean index 0fb3067a0bda7b..c1bb4068698560 100644 --- a/Mathlib/Geometry/Manifold/Complex.lean +++ b/Mathlib/Geometry/Manifold/Complex.lean @@ -92,7 +92,9 @@ theorem norm_eqOn_of_isPreconnected_of_isMaxOn {f : M → F} {U : Set M} {c : M} set V := {z ∈ U | ‖f z‖ = ‖f c‖} suffices U ⊆ V from fun x hx ↦ (this hx).2 have hVo : IsOpen V := by - refine isOpen_iff_mem_nhds.2 fun x hx ↦ inter_mem (ho.mem_nhds hx.1) ?_ + refine isOpen_iff_mem_nhds.2 fun x hx ↦ ?_ + change U ∩ {z | ‖f z‖ = ‖f c‖} ∈ 𝓝 x + refine inter_mem (ho.mem_nhds hx.1) ?_ replace hm : IsLocalMax (‖f ·‖) x := mem_of_superset (ho.mem_nhds hx.1) fun z hz ↦ (hm hz).out.trans_eq hx.2.symm replace hd : ∀ᶠ y in 𝓝 x, MDiffAt f y := @@ -102,7 +104,7 @@ theorem norm_eqOn_of_isPreconnected_of_isMaxOn {f : M → F} {U : Set M} {c : M} have hVne : (U ∩ V).Nonempty := ⟨c, hcU, hcU, rfl⟩ set W := U ∩ {z | ‖f z‖ = ‖f c‖}ᶜ have hWo : IsOpen W := hd.continuousOn.norm.isOpen_inter_preimage ho isOpen_ne - have hdVW : Disjoint V W := disjoint_compl_right.mono inf_le_right inf_le_right + have hdVW : Disjoint V W := Set.disjoint_left.2 fun z hzV hzW => hzW.2 hzV.2 have hUVW : U ⊆ V ∪ W := fun x hx => (eq_or_ne ‖f x‖ ‖f c‖).imp (.intro hx) (.intro hx) exact hc.subset_left_of_subset_union hVo hWo hdVW hUVW hVne diff --git a/Mathlib/Geometry/Manifold/ContMDiff/Defs.lean b/Mathlib/Geometry/Manifold/ContMDiff/Defs.lean index 3e578df2a2dcbe..8353accd50d274 100644 --- a/Mathlib/Geometry/Manifold/ContMDiff/Defs.lean +++ b/Mathlib/Geometry/Manifold/ContMDiff/Defs.lean @@ -691,11 +691,11 @@ theorem ContMDiffWithinAt.mono (hf : ContMDiffWithinAt I I' n f s x) (hts : t ContMDiffWithinAt I I' n f t x := hf.mono_of_mem_nhdsWithin <| mem_of_superset self_mem_nhdsWithin hts -theorem contMDiffWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem contMDiffWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : ContMDiffWithinAt I I' n f s x ↔ ContMDiffWithinAt I I' n f t x := (contDiffWithinAt_localInvariantProp n).liftPropWithinAt_congr_set h -theorem ContMDiffWithinAt.congr_set (h : ContMDiffWithinAt I I' n f s x) (hst : s =ᶠ[𝓝 x] t) : +theorem ContMDiffWithinAt.congr_set (h : ContMDiffWithinAt I I' n f s x) (hst : s =ᶠˢ[𝓝 x] t) : ContMDiffWithinAt I I' n f t x := (contMDiffWithinAt_congr_set hst).1 h @@ -715,7 +715,7 @@ protected theorem ContMDiffWithinAt.insert (h : ContMDiffWithinAt I I' n f s x) /-- Being `C^n` in a set only depends on the germ of the set. Version where one only requires the two sets to coincide locally in the complement of a point `y`. -/ -theorem contMDiffWithinAt_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem contMDiffWithinAt_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : ContMDiffWithinAt I I' n f s x ↔ ContMDiffWithinAt I I' n f t x := by have : T1Space M := I.t1Space M rw [← contMDiffWithinAt_insert_self (s := s), ← contMDiffWithinAt_insert_self (s := t)] diff --git a/Mathlib/Geometry/Manifold/Instances/Real.lean b/Mathlib/Geometry/Manifold/Instances/Real.lean index 0ac71a8e87b7f7..06fdb8854b8e1d 100644 --- a/Mathlib/Geometry/Manifold/Instances/Real.lean +++ b/Mathlib/Geometry/Manifold/Instances/Real.lean @@ -116,7 +116,7 @@ instance : LocallyPathConnectedSpace (EuclideanQuadrant n) := theorem range_euclideanHalfSpace (n : ℕ) [NeZero n] : range (Subtype.val : EuclideanHalfSpace n → _) = { y | 0 ≤ y 0 } := - Subtype.range_val + Subtype.range_coe_subtype @[simp] theorem interior_halfSpace {n : ℕ} (p : ℝ≥0∞) (a : ℝ) (i : Fin n) : @@ -147,10 +147,10 @@ theorem frontier_halfSpace {n : ℕ} (p : ℝ≥0∞) (a : ℝ) (i : Fin n) : frontier { y : PiLp p (fun _ : Fin n ↦ ℝ) | a ≤ y i } = { y | a = y i } := by rw [frontier, closure_halfSpace, interior_halfSpace] ext y - simpa only [mem_sdiff, mem_setOf_eq, not_lt] using antisymm_iff + simpa only [mem_sdiff, mem_ofPred_eq, not_lt] using antisymm_iff theorem range_euclideanQuadrant (n : ℕ) : range (Subtype.val : EuclideanQuadrant n → _) = { y | ∀ i : Fin n, 0 ≤ y i } := - Subtype.range_val + Subtype.range_coe_subtype theorem interior_euclideanQuadrant (n : ℕ) (p : ℝ≥0∞) (a : ℝ) : interior { y : PiLp p (fun _ : Fin n ↦ ℝ) | ∀ i : Fin n, a ≤ y i } = @@ -249,16 +249,16 @@ lemma interior_range_modelWithCornersEuclideanHalfSpace (n : ℕ) [NeZero n] : interior (range (𝓡∂ n)) = { y | 0 < y 0 } := by calc interior (range (𝓡∂ n)) _ = interior ({ y | 0 ≤ y 0}) := by - congr! - apply range_euclideanHalfSpace + congr 1 + exact range_euclideanHalfSpace n _ = { y | 0 < y 0 } := interior_halfSpace _ _ _ lemma frontier_range_modelWithCornersEuclideanHalfSpace (n : ℕ) [NeZero n] : frontier (range (𝓡∂ n)) = { y | 0 = y 0 } := by calc frontier (range (𝓡∂ n)) _ = frontier ({ y | 0 ≤ y 0 }) := by - congr! - apply range_euclideanHalfSpace + congr 1 + exact range_euclideanHalfSpace n _ = { y | 0 = y 0 } := frontier_halfSpace 2 _ _ set_option backward.isDefEq.respectTransparency false in @@ -271,14 +271,14 @@ def IccLeftChart (x y : ℝ) [h : Fact (x < y)] : target := { z : EuclideanHalfSpace 1 | z.val 0 < y - x } toFun := fun z : Icc x y => ⟨toLp 2 fun _ ↦ z.val - x, sub_nonneg.mpr z.property.1⟩ invFun z := ⟨min (z.val 0 + x) y, by simp [z.prop, h.out.le]⟩ - map_source' := by simp only [mem_setOf_eq, Fin.isValue, sub_lt_sub_iff_right, + map_source' := by simp only [mem_ofPred_eq, Fin.isValue, sub_lt_sub_iff_right, imp_self, implies_true] map_target' := by - simp only [min_lt_iff, mem_setOf_eq]; intro z hz; left + simp only [min_lt_iff, mem_ofPred_eq]; intro z hz; left linarith left_inv' := by rintro ⟨z, hz⟩ h'z - simp only [mem_setOf_eq, mem_Icc] at hz h'z + simp only [mem_ofPred_eq, mem_Icc] at hz h'z simp only [Fin.isValue, sub_add_cancel, hz, inf_of_le_left] right_inv' := by rintro ⟨z, hz⟩ h'z @@ -324,7 +324,7 @@ lemma IccLeftChart_extend_interior_pos {p : Set.Icc x y} (hp : x < p.val ∧ p.v lemma IccLeftChart_extend_bot_mem_frontier : (IccLeftChart x y).extend (𝓡∂ 1) ⊥ ∈ frontier (range (𝓡∂ 1)) := by rw [IccLeftChart_extend_bot, frontier_range_modelWithCornersEuclideanHalfSpace, - mem_setOf, PiLp.zero_apply] + mem_ofPred, PiLp.zero_apply] set_option backward.isDefEq.respectTransparency false in /-- The right chart for the topological space `[x, y]`, defined on `(x,y]` and sending `y` to `0` in @@ -337,14 +337,14 @@ def IccRightChart (x y : ℝ) [h : Fact (x < y)] : toFun z := ⟨toLp 2 fun _ ↦ y - z.val, sub_nonneg.mpr z.property.2⟩ invFun z := ⟨max (y - z.val 0) x, by simp [z.prop, h.out.le, sub_eq_add_neg]⟩ - map_source' := by simp only [mem_setOf_eq, Fin.isValue, sub_lt_sub_iff_left, + map_source' := by simp only [mem_ofPred_eq, Fin.isValue, sub_lt_sub_iff_left, imp_self, implies_true] map_target' := by - simp only [lt_max_iff, mem_setOf_eq]; intro z hz; left + simp only [lt_max_iff, mem_ofPred_eq]; intro z hz; left linarith left_inv' := by rintro ⟨z, hz⟩ h'z - simp only [mem_setOf_eq, mem_Icc] at hz h'z + simp only [mem_ofPred_eq, mem_Icc] at hz h'z simp only [Fin.isValue, sub_eq_add_neg, neg_add_rev, neg_neg, add_neg_cancel_comm_assoc, hz, sup_of_le_left] right_inv' := by @@ -374,7 +374,7 @@ lemma IccRightChart_extend_top : lemma IccRightChart_extend_top_mem_frontier : (IccRightChart x y).extend (𝓡∂ 1) ⊤ ∈ frontier (range (𝓡∂ 1)) := by rw [IccRightChart_extend_top, frontier_range_modelWithCornersEuclideanHalfSpace, - mem_setOf, PiLp.zero_apply] + mem_ofPred, PiLp.zero_apply] /-- Charted space structure on `[x, y]`, using only two charts taking values in `EuclideanHalfSpace 1`. diff --git a/Mathlib/Geometry/Manifold/Instances/Sphere.lean b/Mathlib/Geometry/Manifold/Instances/Sphere.lean index bd2d69431eba6d..1a44bbd5e140ce 100644 --- a/Mathlib/Geometry/Manifold/Instances/Sphere.lean +++ b/Mathlib/Geometry/Manifold/Instances/Sphere.lean @@ -410,7 +410,8 @@ instance EuclideanSpace.instIsManifoldSphere OpenPartialHomeomorph.symm_toPartialEquiv, PartialEquiv.trans_source, PartialEquiv.symm_source, stereographic'_target, stereographic'_source] simp only [modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, - Set.range_id, Set.inter_univ, Set.univ_inter, Set.compl_singleton_eq, Set.preimage_setOf_eq] + Set.range_id, Set.inter_univ, Set.univ_inter, Set.compl_singleton_eq, + Set.preimage_ofPred_eq] simp only [id, comp_apply, OpenPartialHomeomorph.coe_toPartialEquiv_symm, innerSL_apply_apply, Ne, sphere_ext_iff, real_inner_comm (v' : E)] rfl) diff --git a/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean b/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean index 9091f15d9d70d3..66101d4d082b0e 100644 --- a/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean +++ b/Mathlib/Geometry/Manifold/IntegralCurve/ExistUnique.lean @@ -194,15 +194,15 @@ theorem isMIntegralCurveOn_Ioo_eqOn_of_contMDiff (ht₀ : t₀ ∈ Ioo a b) -- since `Ioo a b` is connected, we get `s = Ioo a b` by showing that `s` is clopen in `Ioo a b` -- in the subtype topology (`s` is also non-empty by assumption) -- here we use a slightly weaker alternative theorem - suffices hsub : Ioo a b ⊆ s from fun t ht ↦ mem_setOf.mp ((subset_def ▸ hsub) t ht).1 + suffices hsub : Ioo a b ⊆ s from fun t ht ↦ mem_ofPred.mp ((subset_def ▸ hsub) t ht).1 apply isPreconnected_Ioo.subset_of_closure_inter_subset (s := Ioo a b) (u := s) _ ⟨t₀, ⟨ht₀, ⟨h, ht₀⟩⟩⟩ · -- is this really the most convenient way to pass to subtype topology? -- TODO: shorten this when better API around subtype topology exists rw [hs, inter_comm, ← Subtype.image_preimage_val, inter_comm, ← Subtype.image_preimage_val, - image_subset_image_iff Subtype.val_injective, preimage_setOf_eq] + image_subset_image_iff Subtype.val_injective, preimage_ofPred_eq] intro t ht - rw [mem_preimage, ← closure_subtype] at ht + rw [mem_ofPred_eq, Set.mem_iff_mem, ← closure_subtype] at ht revert ht t apply IsClosed.closure_subset (isClosed_eq _ _) · rw [continuous_iff_continuousAt] diff --git a/Mathlib/Geometry/Manifold/IntegralCurve/Transform.lean b/Mathlib/Geometry/Manifold/IntegralCurve/Transform.lean index ceed7bccd5e562..772e5d7b106d8f 100644 --- a/Mathlib/Geometry/Manifold/IntegralCurve/Transform.lean +++ b/Mathlib/Geometry/Manifold/IntegralCurve/Transform.lean @@ -50,10 +50,10 @@ lemma IsMIntegralCurveOn.comp_add (hγ : IsMIntegralCurveOn γ v s) (dt : ℝ) : lemma isMIntegralCurveOn_comp_add {dt : ℝ} : IsMIntegralCurveOn (γ ∘ (· + dt)) v { t | t + dt ∈ s } ↔ IsMIntegralCurveOn γ v s := by refine ⟨fun hγ ↦ ?_, fun hγ ↦ hγ.comp_add _⟩ - convert! hγ.comp_add (-dt) - · ext t - simp - · simp + have h2 := hγ.comp_add (-dt) + rw [show {t : ℝ | t + -dt ∈ {t | t + dt ∈ s}} = s by ext t; simp, + show (γ ∘ (· + dt)) ∘ (· + -dt) = γ by ext t; simp] at h2 + exact h2 lemma isMIntegralCurveOn_comp_sub {dt : ℝ} : IsMIntegralCurveOn (γ ∘ (· - dt)) v { t | t - dt ∈ s } ↔ IsMIntegralCurveOn γ v s := by @@ -64,9 +64,10 @@ lemma IsMIntegralCurveAt.comp_add (hγ : IsMIntegralCurveAt γ v t₀) (dt : ℝ rw [isMIntegralCurveAt_iff'] at * obtain ⟨ε, hε, h⟩ := hγ refine ⟨ε, hε, ?_⟩ - convert! h.comp_add dt - rw [Metric.ball] - simp_rw [Metric.mem_ball, Real.dist_eq, ← sub_add, add_sub_right_comm] + have hs : {t | t + dt ∈ Metric.ball t₀ ε} = Metric.ball (t₀ - dt) ε := by + ext t + simp_rw [mem_ofPred_eq, Metric.mem_ball, Real.dist_eq, ← sub_add, add_sub_right_comm] + exact hs ▸ h.comp_add dt lemma isMIntegralCurveAt_comp_add {dt : ℝ} : IsMIntegralCurveAt (γ ∘ (· + dt)) v (t₀ - dt) ↔ IsMIntegralCurveAt γ v t₀ := by @@ -119,21 +120,24 @@ lemma IsMIntegralCurveOn.comp_mul (hγ : IsMIntegralCurveOn γ v s) (a : ℝ) : lemma isMIntegralCurveOn_comp_mul_ne_zero {a : ℝ} (ha : a ≠ 0) : IsMIntegralCurveOn (γ ∘ (· * a)) (a • v) { t | t * a ∈ s } ↔ IsMIntegralCurveOn γ v s := by refine ⟨fun hγ ↦ ?_, fun hγ ↦ hγ.comp_mul a⟩ - convert! hγ.comp_mul a⁻¹ + have h2 := hγ.comp_mul a⁻¹ + rw [show {t : ℝ | t * a⁻¹ ∈ {t | t * a ∈ s}} = s by + ext t; simp [mem_ofPred_eq, mul_assoc, inv_mul_eq_div, div_self ha]] at h2 + convert! h2 · ext t simp only [Function.comp_apply, mul_assoc, inv_mul_eq_div, div_self ha, mul_one] · simp only [smul_smul, inv_mul_eq_div, div_self ha, one_smul] - · simp only [mem_setOf_eq, mul_assoc, inv_mul_eq_div, div_self ha, mul_one, setOf_mem_eq] lemma IsMIntegralCurveAt.comp_mul_ne_zero (hγ : IsMIntegralCurveAt γ v t₀) {a : ℝ} (ha : a ≠ 0) : IsMIntegralCurveAt (γ ∘ (· * a)) (a • v) (t₀ / a) := by rw [isMIntegralCurveAt_iff'] at * obtain ⟨ε, hε, h⟩ := hγ refine ⟨ε / |a|, by positivity, ?_⟩ - convert! h.comp_mul a - ext t - rw [mem_setOf_eq, Metric.mem_ball, Metric.mem_ball, Real.dist_eq, Real.dist_eq, - lt_div_iff₀ (abs_pos.mpr ha), ← abs_mul, sub_mul, div_mul_cancel₀ _ ha] + have hs : {t | t * a ∈ Metric.ball t₀ ε} = Metric.ball (t₀ / a) (ε / |a|) := by + ext t + rw [mem_ofPred_eq, Metric.mem_ball, Metric.mem_ball, Real.dist_eq, Real.dist_eq, + lt_div_iff₀ (abs_pos.mpr ha), ← abs_mul, sub_mul, div_mul_cancel₀ _ ha] + exact hs ▸ h.comp_mul a lemma isMIntegralCurveAt_comp_mul_ne_zero {a : ℝ} (ha : a ≠ 0) : IsMIntegralCurveAt (γ ∘ (· * a)) (a • v) (t₀ / a) ↔ IsMIntegralCurveAt γ v t₀ := by diff --git a/Mathlib/Geometry/Manifold/IntegralCurve/UniformTime.lean b/Mathlib/Geometry/Manifold/IntegralCurve/UniformTime.lean index 95d84fa3c2f9ca..4b4ad1471634c5 100644 --- a/Mathlib/Geometry/Manifold/IntegralCurve/UniformTime.lean +++ b/Mathlib/Geometry/Manifold/IntegralCurve/UniformTime.lean @@ -178,7 +178,7 @@ lemma exists_isMIntegralCurve_of_isMIntegralCurveOn [BoundarylessManifold I M] -- another centred at 0 with domain up to `a ∈ S` with `t₀ < a < asup` obtain ⟨a, ha, hlt⟩ := Real.add_neg_lt_sSup (⟨ε, h x⟩ : Set.Nonempty s) (ε := - (ε / 2)) (by rw [neg_lt, neg_zero]; exact half_pos hε) - rw [mem_setOf] at ha + rw [mem_ofPred] at ha rw [← hasup, ← sub_eq_add_neg] at hlt -- integral curve defined on `Ioo (-a) a` obtain ⟨γ, h0, hγ⟩ := ha diff --git a/Mathlib/Geometry/Manifold/IsManifold/Basic.lean b/Mathlib/Geometry/Manifold/IsManifold/Basic.lean index 5dc7b8202b1ab3..0593d4cc3ffc33 100644 --- a/Mathlib/Geometry/Manifold/IsManifold/Basic.lean +++ b/Mathlib/Geometry/Manifold/IsManifold/Basic.lean @@ -508,7 +508,7 @@ def ModelWithCorners.prod {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Ty toFun := fun x => (I x.1, I' x.2) invFun := fun x => (I.symm x.1, I'.symm x.2) source := { x | x.1 ∈ I.source ∧ x.2 ∈ I'.source } - source_eq := by simp only [setOf_true, mfld_simps] + source_eq := by simp only [ofPred_true, mfld_simps] convex_range' := by have : range (fun (x : ModelProd H H') ↦ (I x.1, I' x.2)) = range (Prod.map I I') := rfl rw [this, Set.range_prodMap] diff --git a/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean b/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean index 0388d393f42a59..4abda0f8d13bab 100644 --- a/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean +++ b/Mathlib/Geometry/Manifold/IsManifold/ExtChartAt.lean @@ -185,7 +185,7 @@ theorem nhdsWithin_extend_target_eq {y : M} (hy : y ∈ f.source) : nhdsWithin_le_of_mem (extend_target_mem_nhdsWithin _ hy) theorem extend_target_eventuallyEq {y : M} (hy : y ∈ f.source) : - (f.extend I).target =ᶠ[𝓝 (f.extend I y)] range I := + (f.extend I).target =ᶠˢ[𝓝 (f.extend I y)] range I := nhdsWithin_eq_iff_eventuallyEq.1 (nhdsWithin_extend_target_eq _ hy) theorem continuousAt_extend_symm' {x : E} (h : x ∈ (f.extend I).target) : @@ -305,7 +305,7 @@ theorem extend_preimage_inter_eq : theorem extend_symm_preimage_inter_range_eventuallyEq {s : Set M} {x : M} (hs : s ⊆ f.source) (hx : x ∈ f.source) : - ((f.extend I).symm ⁻¹' s ∩ range I : Set _) =ᶠ[𝓝 (f.extend I x)] f.extend I '' s := by + ((f.extend I).symm ⁻¹' s ∩ range I : Set _) =ᶠˢ[𝓝 (f.extend I x)] f.extend I '' s := by rw [← nhdsWithin_eq_iff_eventuallyEq, ← map_extend_nhdsWithin _ hx, map_extend_nhdsWithin_eq_image_of_subset _ hx hs] @@ -602,17 +602,17 @@ theorem nhdsWithin_extChartAt_target_eq (x : M) : /-- Around the image of a point in the source, `(extChartAt I x).target` and `range I` coincide locally. -/ theorem extChartAt_target_eventuallyEq' {x y : M} (hy : y ∈ (extChartAt I x).source) : - (extChartAt I x).target =ᶠ[𝓝 (extChartAt I x y)] range I := + (extChartAt I x).target =ᶠˢ[𝓝 (extChartAt I x y)] range I := nhdsWithin_eq_iff_eventuallyEq.1 (nhdsWithin_extChartAt_target_eq' hy) /-- Around a point in the target, `(extChartAt I x).target` and `range I` coincide locally. -/ theorem extChartAt_target_eventuallyEq_of_mem {x : M} {z : E} (hz : z ∈ (extChartAt I x).target) : - (extChartAt I x).target =ᶠ[𝓝 z] range I := + (extChartAt I x).target =ᶠˢ[𝓝 z] range I := nhdsWithin_eq_iff_eventuallyEq.1 (nhdsWithin_extChartAt_target_eq_of_mem hz) /-- Around the image of the base point, `(extChartAt I x).target` and `range I` coincide locally. -/ theorem extChartAt_target_eventuallyEq {x : M} : - (extChartAt I x).target =ᶠ[𝓝 (extChartAt I x x)] range I := + (extChartAt I x).target =ᶠˢ[𝓝 (extChartAt I x x)] range I := nhdsWithin_eq_iff_eventuallyEq.1 (nhdsWithin_extChartAt_target_eq x) theorem continuousAt_extChartAt_symm'' {x : M} {y : E} (h : y ∈ (extChartAt I x).target) : @@ -769,7 +769,7 @@ theorem ContinuousWithinAt.nhdsWithin_extChartAt_symm_preimage_inter_range theorem ContinuousWithinAt.extChartAt_symm_preimage_inter_range_eventuallyEq {f : M → M'} {x : M} (hc : ContinuousWithinAt f s x) : - ((extChartAt I x).symm ⁻¹' s ∩ range I : Set E) =ᶠ[𝓝 (extChartAt I x x)] + ((extChartAt I x).symm ⁻¹' s ∩ range I : Set E) =ᶠˢ[𝓝 (extChartAt I x x)] ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' (f x)).source) : Set E) := by rw [← nhdsWithin_eq_iff_eventuallyEq] diff --git a/Mathlib/Geometry/Manifold/LocalInvariantProperties.lean b/Mathlib/Geometry/Manifold/LocalInvariantProperties.lean index f1e4df6bb2df8c..2475cdabf6df71 100644 --- a/Mathlib/Geometry/Manifold/LocalInvariantProperties.lean +++ b/Mathlib/Geometry/Manifold/LocalInvariantProperties.lean @@ -78,9 +78,9 @@ include hG namespace LocalInvariantProp -theorem congr_set {s t : Set H} {x : H} {f : H → H'} (hu : s =ᶠ[𝓝 x] t) : P f s x ↔ P f t x := by +theorem congr_set {s t : Set H} {x : H} {f : H → H'} (hu : s =ᶠˢ[𝓝 x] t) : P f s x ↔ P f t x := by obtain ⟨o, host, ho, hxo⟩ := mem_nhds_iff.mp hu.mem_iff - simp_rw [subset_def, mem_setOf, ← and_congr_left_iff, ← mem_inter_iff, ← Set.ext_iff] at host + simp_rw [subset_def, mem_ofPred, ← and_congr_left_iff, ← mem_inter_iff, ← Set.ext_iff] at host rw [hG.is_local ho hxo, host, ← hG.is_local ho hxo] theorem is_local_nhds {s u : Set H} {x : H} {f : H → H'} (hu : u ∈ 𝓝[s] x) : @@ -109,7 +109,7 @@ theorem congr {s : Set H} {x : H} {f g : H → H'} (h : f =ᶠ[𝓝 x] g) (hP : theorem congr' {s : Set H} {x : H} {f g : H → H'} (h : f =ᶠ[𝓝 x] g) (hP : P g s x) : P f s x := hG.congr h.symm hP -theorem congr_set_fun {s t : Set H} {x : H} {f g : H → H'} (hu : s =ᶠ[𝓝 x] t) (h : f =ᶠ[𝓝 x] g) : +theorem congr_set_fun {s t : Set H} {x : H} {f g : H → H'} (hu : s =ᶠˢ[𝓝 x] t) (h : f =ᶠ[𝓝 x] g) : P f s x ↔ P g t x := by rw [hG.congr_iff h, hG.congr_set hu] @@ -372,7 +372,7 @@ theorem liftPropWithinAt_inter (ht : t ∈ 𝓝 x) : LiftPropWithinAt P g (s ∩ t) x ↔ LiftPropWithinAt P g s x := hG.liftPropWithinAt_inter' (mem_nhdsWithin_of_mem_nhds ht) -theorem liftPropWithinAt_congr_set (hu : s =ᶠ[𝓝 x] t) : +theorem liftPropWithinAt_congr_set (hu : s =ᶠˢ[𝓝 x] t) : LiftPropWithinAt P g s x ↔ LiftPropWithinAt P g t x := by rw [← hG.liftPropWithinAt_inter (s := s) hu, ← hG.liftPropWithinAt_inter (s := t) hu, ← eq_iff_iff] diff --git a/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean b/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean index 04fc8658e10cff..0950d6ae24bfdb 100644 --- a/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean +++ b/Mathlib/Geometry/Manifold/MFDeriv/Basic.lean @@ -873,8 +873,8 @@ lemma tangentMap_snd {X : TangentSpace I x} : (tangentMap I I' f X).2 = (mfderiv /-- If two sets coincide locally around `x`, except maybe at a point `y`, then their preimage under `extChartAt x` coincide locally, except maybe at `extChartAt I x x`. -/ -theorem preimage_extChartAt_eventuallyEq_compl_singleton (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : - ((extChartAt I x).symm ⁻¹' s ∩ range I : Set E) =ᶠ[𝓝[{extChartAt I x x}ᶜ] (extChartAt I x x)] +theorem preimage_extChartAt_eventuallyEq_compl_singleton (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : + ((extChartAt I x).symm ⁻¹' s ∩ range I : Set E) =ᶠˢ[𝓝[{extChartAt I x x}ᶜ] (extChartAt I x x)] ((extChartAt I x).symm ⁻¹' t ∩ range I : Set E) := by have : T1Space M := I.t1Space M obtain ⟨u, u_mem, hu⟩ : ∃ u ∈ 𝓝 x, u ∩ {x}ᶜ ⊆ {y | (y ∈ s) = (y ∈ t)} := @@ -886,8 +886,7 @@ theorem preimage_extChartAt_eventuallyEq_compl_singleton (y : M) (h : s =ᶠ[ apply mem_nhdsWithin_iff_exists_mem_nhds_inter.2 ⟨_, Filter.inter_mem ((continuousAt_extChartAt_symm x).preimage_mem_nhds u_mem) B, ?_⟩ rintro z ⟨hz, h'z⟩ - simp only [eq_iff_iff, mem_setOf_eq] - change z ∈ (extChartAt I x).symm ⁻¹' s ∩ range I ↔ z ∈ (extChartAt I x).symm ⁻¹' t ∩ range I + simp only [eq_iff_iff, mem_ofPred_eq] by_cases hIz : z ∈ range I · simp only [mem_inter_iff, mem_preimage, mem_union, mem_compl_iff, hIz, not_true_eq_false, or_false, and_true] at hz ⊢ @@ -902,7 +901,7 @@ theorem preimage_extChartAt_eventuallyEq_compl_singleton (y : M) (h : s =ᶠ[ /-- If two sets coincide locally, except maybe at a point, then it is equivalent to have a manifold derivative within one or the other. -/ -theorem hasMFDerivWithinAt_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem hasMFDerivWithinAt_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : HasMFDerivWithinAt I I' f s x f' ↔ HasMFDerivWithinAt I I' f t x f' := by have : T1Space M := I.t1Space M simp only [HasMFDerivWithinAt] @@ -911,25 +910,25 @@ theorem hasMFDerivWithinAt_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : · apply hasFDerivWithinAt_congr_set' (extChartAt I x x) exact preimage_extChartAt_eventuallyEq_compl_singleton y h -theorem hasMFDerivWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem hasMFDerivWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : HasMFDerivWithinAt I I' f s x f' ↔ HasMFDerivWithinAt I I' f t x f' := hasMFDerivWithinAt_congr_set' x <| h.filter_mono inf_le_left /-- If two sets coincide around a point (except possibly at a single point `y`), then it is equivalent to be differentiable within one or the other set. -/ -theorem mdifferentiableWithinAt_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem mdifferentiableWithinAt_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : MDifferentiableWithinAt I I' f s x ↔ MDifferentiableWithinAt I I' f t x := by simp only [mdifferentiableWithinAt_iff_exists_hasMFDerivWithinAt] exact exists_congr fun _ => hasMFDerivWithinAt_congr_set' _ h -theorem mdifferentiableWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem mdifferentiableWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : MDifferentiableWithinAt I I' f s x ↔ MDifferentiableWithinAt I I' f t x := by simp only [mdifferentiableWithinAt_iff_exists_hasMFDerivWithinAt] exact exists_congr fun _ => hasMFDerivWithinAt_congr_set h /-- If two sets coincide locally, except maybe at a point, then derivatives within these sets are the same. -/ -theorem mfderivWithin_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem mfderivWithin_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : mfderivWithin I I' f s x = mfderivWithin I I' f t x := by by_cases hx : MDifferentiableWithinAt I I' f s x · simp only [mfderivWithin, hx, (mdifferentiableWithinAt_congr_set' y h).1 hx, ↓reduceIte] @@ -939,18 +938,18 @@ theorem mfderivWithin_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : /-- If two sets coincide locally, then derivatives within these sets are the same. -/ -theorem mfderivWithin_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem mfderivWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : mfderivWithin I I' f s x = mfderivWithin I I' f t x := mfderivWithin_congr_set' x <| h.filter_mono inf_le_left /-- If two sets coincide locally, except maybe at a point, then derivatives within these sets coincide locally. -/ -theorem mfderivWithin_eventually_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem mfderivWithin_eventually_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : ∀ᶠ y in 𝓝 x, mfderivWithin I I' f s y = mfderivWithin I I' f t y := (eventually_nhds_nhdsWithin.2 h).mono fun _ => mfderivWithin_congr_set' y /-- If two sets coincide locally, then derivatives within these sets coincide locally. -/ -theorem mfderivWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem mfderivWithin_eventually_congr_set (h : s =ᶠˢ[𝓝 x] t) : ∀ᶠ y in 𝓝 x, mfderivWithin I I' f s y = mfderivWithin I I' f t y := mfderivWithin_eventually_congr_set' x <| h.filter_mono inf_le_left @@ -1078,7 +1077,7 @@ theorem Filter.EventuallyEq.mfderivWithin_eq (hL : f₁ =ᶠ[𝓝[s] x] f) (hx : apply Filter.EventuallyEq.fderivWithin_eq; swap · simp [hx] filter_upwards [extChartAt_preimage_mem_nhdsWithin (I := I) hL] with y hy - simp only [preimage_setOf_eq, mem_setOf_eq] at hy + simp only [preimage_ofPred_eq, mem_ofPred_eq] at hy simp [-extChartAt, hy, hx] · unfold mfderivWithin rw [if_neg h, if_neg] diff --git a/Mathlib/Geometry/Manifold/PartitionOfUnity.lean b/Mathlib/Geometry/Manifold/PartitionOfUnity.lean index 9eea8726d755ad..111411f0d6d0f1 100644 --- a/Mathlib/Geometry/Manifold/PartitionOfUnity.lean +++ b/Mathlib/Geometry/Manifold/PartitionOfUnity.lean @@ -629,7 +629,7 @@ theorem exists_contMDiffSection_forall_mem_convex_of_local -- Future: can grind do this? apply ρ.locallyFinite.subset fun i x hx ↦ ?_ rw [support] - rw [mem_setOf_eq] at hx ⊢ + rw [mem_ofPred_eq] at hx ⊢ exact left_ne_zero_of_smul hx -- Construct the smooth section and prove it lies in the convex sets `t x`. refine ⟨⟨s, hs⟩, fun x ↦ ?_⟩ @@ -769,9 +769,9 @@ theorem IsOpen.exists_contMDiff_support_eq {s : Set M} (hs : IsOpen s) : simp [(chartAt H c).left_inv (hf c Hx), hx, (chartAt H c).map_source (hf c Hx)] apply finsum_pos (fun c ↦ h''g c x) B apply (f.locallyFinite.point_finite x).subset - apply compl_subset_compl.2 - rintro c (hc : f c x = 0) - simpa only [mul_eq_zero] using! Or.inl hc + intro c hc + refine fun h ↦ hc ?_ + simp [h] · apply finsum_eq_zero_of_forall_eq_zero intro c by_cases Hx : x ∈ tsupport (f c) diff --git a/Mathlib/Geometry/Manifold/Riemannian/Basic.lean b/Mathlib/Geometry/Manifold/Riemannian/Basic.lean index aca6592592b743..c3f129cfabb2c4 100644 --- a/Mathlib/Geometry/Manifold/Riemannian/Basic.lean +++ b/Mathlib/Geometry/Manifold/Riemannian/Basic.lean @@ -110,7 +110,7 @@ noncomputable def riemannianMetricVectorSpace : have : Metric.ball (0 : F) 1 = {v : F | ⟪v, v⟫ < 1} := by ext v simp only [Metric.mem_ball, dist_zero_right, norm_eq_sqrt_re_inner (𝕜 := ℝ), - RCLike.re_to_real, Set.mem_setOf_eq] + RCLike.re_to_real, Set.mem_ofPred_eq] conv_lhs => rw [show (1 : ℝ) = √1 by simp] rw [Real.sqrt_lt_sqrt_iff] exact real_inner_self_nonneg @@ -194,7 +194,7 @@ Moreover, we show that in this case the resulting emetric space satisfies the pr Showing that the distance topology coincides with the pre-existing topology is not trivial. The two inclusions are proved respectively in `eventually_riemannianEDist_lt` and -`setOf_riemannianEDist_lt_subset_nhds`. +`setOfPred_riemannianEDist_lt_subset_nhds`. For the first one, we have to show that points which are close for the topology are at small distance. For this, we use the path between the two points which is the pullback of the segment @@ -284,7 +284,7 @@ lemma eventually_norm_mfderivWithin_symm_extChartAt_lt (x : M) : filter_upwards [nhdsWithin_le_nhds (this.preimage_mem_nhds hC), extChartAt_target_mem_nhdsWithin x] with y hy h'y have : y = (extChartAt I x) ((extChartAt I x).symm y) := by simp [-extChartAt, h'y] - simp only [preimage_setOf_eq, mem_setOf_eq] at hy + simp only [preimage_ofPred_eq, mem_ofPred_eq] at hy convert! hy set_option backward.isDefEq.respectTransparency false in @@ -387,13 +387,16 @@ lemma eventually_riemannianEDist_lt (x : M) {c : ℝ≥0∞} (hc : 0 < c) : set_option backward.isDefEq.respectTransparency false in /-- Any neighborhood of `x` contains all the points which are close enough to `x` for the Riemannian distance, `ℝ≥0` version. -/ -lemma setOf_riemannianEDist_lt_subset_nhds [RegularSpace M] {x : M} {s : Set M} (hs : s ∈ 𝓝 x) : +lemma setOfPred_riemannianEDist_lt_subset_nhds [RegularSpace M] {x : M} {s : Set M} (hs : s ∈ 𝓝 x) : ∃ c > (0 : ℝ≥0), {y | riemannianEDist I x y < c} ⊆ s := by /- Consider a closed neighborhood `u` of `x` on which the derivative of the extended chart is bounded by some `C`, contained in `s`, then an open neighborhood `v` of `x` inside `u`, and finally `r` small enough that the ball of radius `r` in the extended chart is contained in the image of `v`. +@[deprecated (since := "2026-07-09")] +alias setOf_riemannianEDist_lt_subset_nhds := setOfPred_riemannianEDist_lt_subset_nhds + We claim that points at Riemannian distance at most `r / C` of `x` are inside `u` (and therefore inside `s`). To prove this, consider a path of length at most `r / C` starting from `x`. While it stays inside `u`, then by the derivative control its image in the extended chart has length @@ -501,7 +504,7 @@ lemma setOf_riemannianEDist_lt_subset_nhds [RegularSpace M] {x : M} {s : Set M} Riemannian distance, `ℝ≥0∞` version. -/ lemma setOf_riemannianEDist_lt_subset_nhds' [RegularSpace M] {x : M} {s : Set M} (hs : s ∈ 𝓝 x) : ∃ c > 0, {y | riemannianEDist I x y < c} ⊆ s := by - rcases setOf_riemannianEDist_lt_subset_nhds I hs with ⟨c, c_pos, hc⟩ + rcases setOfPred_riemannianEDist_lt_subset_nhds I hs with ⟨c, c_pos, hc⟩ exact ⟨c, mod_cast c_pos, hc⟩ variable (M) in diff --git a/Mathlib/Geometry/Manifold/Riemannian/PathELength.lean b/Mathlib/Geometry/Manifold/Riemannian/PathELength.lean index f41e39caaafe9b..0e26c7f3ae1020 100644 --- a/Mathlib/Geometry/Manifold/Riemannian/PathELength.lean +++ b/Mathlib/Geometry/Manifold/Riemannian/PathELength.lean @@ -230,7 +230,7 @@ lemma riemannianEDist_le_pathELength {γ : ℝ → M} (hγ : CMDiff[Icc a b] 1 refine ⟨⟨f, hf.continuous⟩, ?_, ?_⟩ <;> simp [f, η, ContinuousAffineMap.coe_lineMap_eq, ha, hb] have A : riemannianEDist I x y ≤ ∫⁻ x, ‖mfderiv% g x 1‖ₑ := by - rw [riemannianEDist]; exact biInf_le _ hf + rw [riemannianEDist]; exact iInf₂_le g hf apply A.trans_eq rw [lintegral_norm_mfderiv_Icc_eq_pathELength_projIcc] have E : pathELength I (g ∘ projIcc 0 1 zero_le_one) 0 1 = pathELength I (γ ∘ η) 0 1 := by diff --git a/Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean b/Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean index 31a4874663c1bd..915258ac19f893 100644 --- a/Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean +++ b/Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean @@ -76,9 +76,10 @@ theorem smoothSheafCommRing.isUnit_stalk_iff {x : M} have hUV : V ≤ U := Subtype.coe_image_subset (U : Set M) V₀ have hV : V₀ = Set.range (Set.inclusion hUV) := by convert! (Set.range_inclusion hUV).symm - ext y - change _ ↔ y ∈ Subtype.val ⁻¹' Subtype.val '' V₀ + rename_i y + change _ ↔ y ∈ Subtype.val ⁻¹' (Subtype.val '' V₀) rw [Set.preimage_image_eq _ Subtype.coe_injective] + exact Set.mem_iff_mem clear_value V subst hV have hxV : x ∈ (V : Set M) := by diff --git a/Mathlib/Geometry/Manifold/SmoothApprox.lean b/Mathlib/Geometry/Manifold/SmoothApprox.lean index 15c5e988a355e2..045a33a036ca7c 100644 --- a/Mathlib/Geometry/Manifold/SmoothApprox.lean +++ b/Mathlib/Geometry/Manifold/SmoothApprox.lean @@ -90,7 +90,7 @@ theorem Continuous.exists_contMDiff_approx_and_eqOn (n : ℕ∞) rcases this with ⟨g, hg⟩ exact ⟨g, fun x ↦ (hg x).1, fun x ↦ (hg x).2.1, fun x ↦ mt (hg x).2.2⟩ have t_conv (x) : Convex ℝ (t x) := (convex_ball (f x) (ε x)).inter <| - (convex_singleton _).setOf_const_imp.inter (convex_singleton _).setOf_const_imp + (convex_singleton _).setOfPred_const_imp.inter (convex_singleton _).setOfPred_const_imp apply exists_contMDiffMap_forall_mem_convex_of_local I t_conv intro x by_cases hx : x ∈ S diff --git a/Mathlib/Geometry/Manifold/StructureGroupoid.lean b/Mathlib/Geometry/Manifold/StructureGroupoid.lean index 2d489305dbddd2..b1639f21861cd2 100644 --- a/Mathlib/Geometry/Manifold/StructureGroupoid.lean +++ b/Mathlib/Geometry/Manifold/StructureGroupoid.lean @@ -233,7 +233,7 @@ def idGroupoid (H : Type*) [TopologicalSpace H] : StructureGroupoid H where have : s = univ := by rwa [open_s.interior_eq, univ_subset_iff] at this simpa only [this, restr_univ] using! hs · exfalso - rw [mem_setOf_eq] at hs + rw [mem_ofPred_eq] at hs rwa [hs] at x's mem_of_eqOnSource' e e' he he'e := by rcases he with he | he @@ -244,7 +244,7 @@ def idGroupoid (H : Type*) [TopologicalSpace H] : StructureGroupoid H where rwa [← this] · right have he : e.toPartialEquiv.source = ∅ := he - rwa [Set.mem_setOf_eq, EqOnSource.source_eq he'e] + rwa [Set.mem_ofPred_eq, EqOnSource.source_eq he'e] /-- Every structure groupoid contains the identity groupoid. -/ instance instStructureGroupoidOrderBot : OrderBot (StructureGroupoid H) where @@ -254,7 +254,7 @@ instance instStructureGroupoidOrderBot : OrderBot (StructureGroupoid H) where have hf : f ∈ {OpenPartialHomeomorph.refl H} ∪ { e : OpenPartialHomeomorph H H | e.source = ∅ } := hf - simp only [singleton_union, mem_setOf_eq, mem_insert_iff] at hf + simp only [singleton_union, mem_ofPred_eq, mem_insert_iff] at hf rcases hf with hf | hf · rw [hf] apply u.id_mem diff --git a/Mathlib/Geometry/Manifold/VectorBundle/ContMDiffSection.lean b/Mathlib/Geometry/Manifold/VectorBundle/ContMDiffSection.lean index 883566e408db34..a6593d1272ab0b 100644 --- a/Mathlib/Geometry/Manifold/VectorBundle/ContMDiffSection.lean +++ b/Mathlib/Geometry/Manifold/VectorBundle/ContMDiffSection.lean @@ -215,7 +215,7 @@ lemma ContMDiffWithinAt.sum_section_of_locallyFinite by_contra! h have : i ∈ s.toFinset := by refine Set.mem_toFinset.mpr ?_ - simp only [s, ne_eq, Set.mem_setOf_eq] + simp only [s, ne_eq, Set.mem_ofPred_eq] use x₀ simpa using ⟨h, mem_of_mem_nhds hu'⟩ exact hi this @@ -224,7 +224,7 @@ lemma ContMDiffWithinAt.sum_section_of_locallyFinite by_contra! h have : i ∈ s.toFinset := by refine Set.mem_toFinset.mpr ?_ - simp only [s, ne_eq, Set.mem_setOf_eq] + simp only [s, ne_eq, Set.mem_ofPred_eq] use y simpa using ⟨h, Set.mem_of_mem_inter_right hy⟩ exact hi this @@ -260,7 +260,7 @@ lemma ContMDiffWithinAt.finsum_section_of_locallyFinite choose U hu hfin using ht y have : {x | t x y ≠ 0} ⊆ {i | ((fun i ↦ {x | t i x ≠ 0}) i ∩ U).Nonempty} := by intro x hx - rw [Set.mem_setOf] at hx ⊢ + rw [Set.mem_ofPred] at hx ⊢ use y simpa using ⟨hx, mem_of_mem_nhds hu⟩ exact Set.Finite.subset hfin this diff --git a/Mathlib/Geometry/Manifold/VectorBundle/CovariantDerivative/Metric.lean b/Mathlib/Geometry/Manifold/VectorBundle/CovariantDerivative/Metric.lean index 021464573225ca..bf5ffc60ed37a1 100644 --- a/Mathlib/Geometry/Manifold/VectorBundle/CovariantDerivative/Metric.lean +++ b/Mathlib/Geometry/Manifold/VectorBundle/CovariantDerivative/Metric.lean @@ -100,12 +100,13 @@ theorem tensorial_derivMetricTensorAux₁ (τ : Π x, V x) (hτ : MDiffAt (T% τ smul hf hσ := by ext X₀ simp [mvfderiv_fun_mul hf (hσ.inner_bundle hτ), - cov.isCovariantDerivativeOn.leibniz hσ hf, inner_add_left, inner_smul_left] + (cov.isCovariantDerivativeOn (s := Set.univ)).leibniz hσ hf, inner_add_left, + inner_smul_left] ring add hσ hσ' := by ext X₀ simp [mvfderiv_fun_add (hσ.inner_bundle hτ) (hσ'.inner_bundle hτ), - cov.isCovariantDerivativeOn.add hσ hσ', inner_add_left] + (cov.isCovariantDerivativeOn (s := Set.univ)).add hσ hσ', inner_add_left] abel theorem tensorial_derivMetricTensorAux₂ (σ : Π x, V x) (hσ : MDiffAt (T% σ) x) : @@ -113,12 +114,13 @@ theorem tensorial_derivMetricTensorAux₂ (σ : Π x, V x) (hσ : MDiffAt (T% σ smul hf hτ := by ext X₀ simp [mvfderiv_fun_mul hf (hσ.inner_bundle hτ), - cov.isCovariantDerivativeOn.leibniz hτ hf, inner_add_right, inner_smul_right] + (cov.isCovariantDerivativeOn (s := Set.univ)).leibniz hτ hf, inner_add_right, + inner_smul_right] ring add hτ hτ' := by ext X₀ simp [mvfderiv_fun_add (hσ.inner_bundle hτ) (hσ.inner_bundle hτ'), - cov.isCovariantDerivativeOn.add hτ hτ', inner_add_right] + (cov.isCovariantDerivativeOn (s := Set.univ)).add hτ hτ', inner_add_right] abel variable {I} [ContMDiffVectorBundle 1 F V I] in diff --git a/Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean b/Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean index 5cdff3c88f91bc..08c6e1cbe53fcf 100644 --- a/Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean +++ b/Mathlib/Geometry/Manifold/VectorBundle/FiberwiseLinear.lean @@ -235,7 +235,7 @@ private theorem mem_aux {e : OpenPartialHomeomorph (B × F) (B × F)} {n : ℕ (h2φ : ContMDiffOn IB 𝓘(𝕜, F →L[𝕜] F) n (fun x => (φ x).symm : B → F →L[𝕜] F) U), e.EqOnSource (FiberwiseLinear.openPartialHomeomorph φ hU hφ.continuousOn h2φ.continuousOn) := by - simp only [mem_iUnion, mem_setOf_eq] + simp only [mem_iUnion, mem_ofPred_eq] variable (F B IB) diff --git a/Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean b/Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean index 417ace8c8b5fe6..3b7d06384948c8 100644 --- a/Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean +++ b/Mathlib/Geometry/Manifold/VectorBundle/MDifferentiable.lean @@ -519,7 +519,7 @@ lemma MDifferentiableWithinAt.sum_section_of_locallyFinite by_contra! h have : i ∈ s.toFinset := by refine Set.mem_toFinset.mpr ?_ - simp only [s, ne_eq, Set.mem_setOf_eq] + simp only [s, ne_eq, Set.mem_ofPred_eq] use y simp [h, hy] exact hi this @@ -556,7 +556,7 @@ lemma MDifferentiableWithinAt.finsum_section_of_locallyFinite choose U hu hfin using ht y have : {x | t x y ≠ 0} ⊆ {i | ((fun i ↦ {x | t i x ≠ 0}) i ∩ U).Nonempty} := by intro x hx - rw [Set.mem_setOf] at hx ⊢ + rw [Set.mem_ofPred] at hx ⊢ use y simpa using ⟨hx, mem_of_mem_nhds hu⟩ rw [tsum_eq_finsum (hfin.subset this)] diff --git a/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean b/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean index 40c611771099de..5b91d6fc9c6112 100644 --- a/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean +++ b/Mathlib/Geometry/Manifold/VectorField/LieBracket.lean @@ -168,17 +168,17 @@ lemma mlieBracket_zero_right : mlieBracket I W 0 = 0 := by simp [← mlieBracket /-- Variant of `mlieBracketWithin_congr_set` where one requires the sets to coincide only in the complement of a point. -/ -theorem mlieBracketWithin_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem mlieBracketWithin_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : mlieBracketWithin I V W s x = mlieBracketWithin I V W t x := by simp only [mlieBracketWithin_apply] congr 1 suffices A : ((extChartAt I x).symm ⁻¹' s ∩ range I : Set E) - =ᶠ[𝓝[{(extChartAt I x) x}ᶜ] (extChartAt I x x)] + =ᶠˢ[𝓝[{(extChartAt I x) x}ᶜ] (extChartAt I x x)] ((extChartAt I x).symm ⁻¹' t ∩ range I : Set E) by apply lieBracketWithin_congr_set' _ A exact preimage_extChartAt_eventuallyEq_compl_singleton y h -theorem mlieBracketWithin_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem mlieBracketWithin_congr_set (h : s =ᶠˢ[𝓝 x] t) : mlieBracketWithin I V W s x = mlieBracketWithin I V W t x := mlieBracketWithin_congr_set' x <| h.filter_mono inf_le_left @@ -186,7 +186,6 @@ theorem mlieBracketWithin_inter (ht : t ∈ 𝓝 x) : mlieBracketWithin I V W (s ∩ t) x = mlieBracketWithin I V W s x := by apply mlieBracketWithin_congr_set filter_upwards [ht] with y hy - change (y ∈ s ∩ t) = (y ∈ s) simp_all theorem mlieBracketWithin_of_mem_nhds (h : s ∈ 𝓝 x) : @@ -199,11 +198,11 @@ theorem mlieBracketWithin_of_isOpen (hs : IsOpen s) (hx : x ∈ s) : /-- Variant of `mlieBracketWithin_eventually_congr_set` where one requires the sets to coincide only in the complement of a point. -/ -theorem mlieBracketWithin_eventually_congr_set' (y : M) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : +theorem mlieBracketWithin_eventually_congr_set' (y : M) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : mlieBracketWithin I V W s =ᶠ[𝓝 x] mlieBracketWithin I V W t := (eventually_nhds_nhdsWithin.2 h).mono fun _ => mlieBracketWithin_congr_set' y -theorem mlieBracketWithin_eventually_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem mlieBracketWithin_eventually_congr_set (h : s =ᶠˢ[𝓝 x] t) : mlieBracketWithin I V W s =ᶠ[𝓝 x] mlieBracketWithin I V W t := mlieBracketWithin_eventually_congr_set' x <| h.filter_mono inf_le_left @@ -694,10 +693,9 @@ lemma mpullbackWithin_mlieBracketWithin_of_isSymmSndFDerivWithinAt have u_mem : u ∈ 𝓝 x₀ := u_open.mem_nhds x₀u -- apply the auxiliary version to `s ∩ u` set s' := s ∩ u with hs' - have s'_eq : s' =ᶠ[𝓝 x₀] s := by + have s'_eq : s' =ᶠˢ[𝓝 x₀] s := by filter_upwards [u_mem] with y hy - change (y ∈ s ∩ u) = (y ∈ s) - simp [hy] + simp [hs', hy] set t' := t ∩ (extChartAt I' (f x₀)).source with ht' calc mpullbackWithin I I' f (mlieBracketWithin I' V W t) s x₀ _ = mpullbackWithin I I' f (mlieBracketWithin I' V W t) s' x₀ := by @@ -713,8 +711,6 @@ lemma mpullbackWithin_mlieBracketWithin_of_isSymmSndFDerivWithinAt apply (continuousAt_extChartAt_symm x₀).preimage_mem_nhds apply u_open.mem_nhds (by simpa using x₀u) filter_upwards [this] with y hy - change (y ∈ (extChartAt I x₀).symm ⁻¹' s ∩ range I) = - (y ∈ (extChartAt I x₀).symm ⁻¹' (s ∩ u) ∩ range I) simp [-extChartAt, hy] _ = mlieBracketWithin I (mpullbackWithin I I' f V s') (mpullbackWithin I I' f W s') s x₀ := by simp only [hs', mlieBracketWithin_inter u_mem] @@ -753,7 +749,7 @@ lemma mpullbackWithin_mlieBracketWithin' apply mpullbackWithin_mlieBracketWithin_of_isSymmSndFDerivWithinAt hV hW hs ((hf.mono hsu).of_le (le_minSmoothness.trans hn)) hx₀ hst have : ((extChartAt I x₀).symm ⁻¹' s ∩ (extChartAt I x₀).target : Set E) - =ᶠ[𝓝 (extChartAt I x₀ x₀)] ((extChartAt I x₀).symm ⁻¹' s ∩ range I : Set E) := + =ᶠˢ[𝓝 (extChartAt I x₀ x₀)] ((extChartAt I x₀).symm ⁻¹' s ∩ range I : Set E) := EventuallyEq.inter (by rfl) extChartAt_target_eventuallyEq apply IsSymmSndFDerivWithinAt.congr_set _ this have : IsSymmSndFDerivWithinAt 𝕜 ((extChartAt I' (f x₀)) ∘ f ∘ (extChartAt I x₀).symm) diff --git a/Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean b/Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean index b5d34121cfec62..f2a7cea7af6db1 100644 --- a/Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean +++ b/Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean @@ -314,7 +314,7 @@ def emptyIsInitial : Limits.IsInitial (∅ : LocallyRingedSpace.{u}) := Limits.I theorem basicOpen_zero (X : LocallyRingedSpace.{u}) (U : Opens X.carrier) : X.toRingedSpace.basicOpen (0 : X.presheaf.obj <| op U) = ⊥ := by ext x - simp only [RingedSpace.basicOpen, Opens.coe_mk, Set.mem_setOf_eq, + simp only [RingedSpace.basicOpen, Opens.coe_mk, Set.mem_ofPred_eq, Opens.coe_bot, Set.mem_empty_iff_false, iff_false, not_exists] intro hx diff --git a/Mathlib/GroupTheory/Archimedean.lean b/Mathlib/GroupTheory/Archimedean.lean index 343242596c899c..7030d408988017 100644 --- a/Mathlib/GroupTheory/Archimedean.lean +++ b/Mathlib/GroupTheory/Archimedean.lean @@ -85,7 +85,7 @@ theorem Subgroup.exists_isLeast_one_lt {H : Subgroup G} (hbot : H ≠ ⊥) {a : exact ⟨n, _, (@mabs_mem_iff (Subgroup G) G _ _).2 hgH, hn⟩ classical rcases Nat.findX this with ⟨n, ⟨x, hxH, hnx, hxn⟩, hmin⟩ by_contra hxmin - simp only [IsLeast, not_and, mem_setOf_eq, mem_lowerBounds, not_exists, not_forall, + simp only [IsLeast, not_and, mem_ofPred_eq, mem_lowerBounds, not_exists, not_forall, not_le] at hxmin rcases hxmin x ⟨hxH, (one_le_pow_of_one_le' h₀.le _).trans_lt hnx⟩ with ⟨y, ⟨hyH, hy₀⟩, hxy⟩ obtain ⟨m, hm, hya⟩ := hex y hy₀ diff --git a/Mathlib/GroupTheory/ArchimedeanDensely.lean b/Mathlib/GroupTheory/ArchimedeanDensely.lean index 97dd541504d7b6..419be4786b54c0 100644 --- a/Mathlib/GroupTheory/ArchimedeanDensely.lean +++ b/Mathlib/GroupTheory/ArchimedeanDensely.lean @@ -157,7 +157,7 @@ lemma Subgroup.isLeast_of_closure_iff_eq_mabs {a b : G} : rw [mem_closure_singleton] at ha obtain ⟨n, rfl⟩ := ha have := h.left - simp only [mem_closure_singleton, mem_setOf_eq] at this + simp only [mem_closure_singleton, mem_ofPred_eq] at this obtain ⟨m, hm⟩ := this.left have key : m * n = 1 := by rw [← zpow_right_inj this.right, zpow_mul', hm, zpow_one] @@ -174,7 +174,7 @@ lemma Subgroup.isLeast_of_closure_iff_eq_mabs {a b : G} : refine ⟨?_, ?_⟩ · simp [h] · intro x - simp only [mem_closure_singleton, mem_setOf_eq, and_imp, forall_exists_index] + simp only [mem_closure_singleton, mem_ofPred_eq, and_imp, forall_exists_index] rintro k rfl hk rw [← zpow_one b, ← zpow_mul, one_mul, zpow_le_zpow_iff_right h, ← zero_add 1, ← Int.lt_iff_add_one_le] @@ -332,7 +332,7 @@ lemma LinearOrderedCommGroupWithZero.discrete_iff_not_denselyOrdered (G : Type*) section WellFounded set_option backward.isDefEq.respectTransparency false in -lemma LinearOrderedAddCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete +lemma LinearOrderedAddCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete {G : Type*} [AddCommGroup G] [LinearOrder G] [IsOrderedAddMonoid G] [Nontrivial G] {g : G} : Set.WellFoundedOn {x : G | g ≤ x} (· < ·) ↔ Nonempty (G ≃+o ℤ) := by suffices Set.WellFoundedOn {x : G | 0 ≤ x} (· < ·) ↔ Nonempty (G ≃+o ℤ) by @@ -366,39 +366,55 @@ lemma LinearOrderedAddCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete have : LocallyFiniteOrder G := LocallyFiniteOrder.ofOrderIsoClass f exact BddBelow.wellFoundedOn_lt ⟨0, by simp [mem_lowerBounds]⟩ -lemma LinearOrderedAddCommGroup.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete +@[deprecated (since := "2026-07-09")] +alias LinearOrderedAddCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete := + LinearOrderedAddCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete + +lemma LinearOrderedAddCommGroup.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete {G : Type*} [AddCommGroup G] [LinearOrder G] [IsOrderedAddMonoid G] [Nontrivial G] (g : G) : Set.WellFoundedOn {x : G | x ≤ g} (· > ·) ↔ Nonempty (G ≃+o ℤ) := by - rw [← wellFoundedOn_setOf_le_lt_iff_nonempty_discrete (g := -g)] + rw [← wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete (g := -g)] refine ⟨fun h ↦ (h.mapsTo (- ·) ?_).mono' ?_, fun h ↦ (h.mapsTo (- ·) ?_).mono' ?_⟩ <;> · intro simp [Function.onFun, neg_le] -lemma LinearOrderedCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete +@[deprecated (since := "2026-07-09")] +alias LinearOrderedAddCommGroup.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete := + LinearOrderedAddCommGroup.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete + +lemma LinearOrderedCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete {G : Type*} [CommGroup G] [LinearOrder G] [IsOrderedMonoid G] [Nontrivial G] {g : G} : Set.WellFoundedOn {x : G | g ≤ x} (· < ·) ↔ Nonempty (G ≃*o Multiplicative ℤ) := by let e : G ≃o Additive G := OrderIso.refl G suffices Set.WellFoundedOn {x : G | g ≤ x} (· < ·) ↔ Set.WellFoundedOn {x | e g ≤ x} (· < ·) by - rw [this, LinearOrderedAddCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete, + rw [this, LinearOrderedAddCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete, OrderAddMonoidIso.toMultiplicativeRight.nonempty_congr] refine ⟨fun h ↦ (h.mapsTo e.symm fun _ ↦ e.le_symm_apply.mpr).mono' ?_, fun h ↦ (h.mapsTo e fun _ ↦ ?_).mono' ?_⟩ <;> simp [Function.onFun] -lemma LinearOrderedCommGroup.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete +@[deprecated (since := "2026-07-09")] +alias LinearOrderedCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete := + LinearOrderedCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete + +lemma LinearOrderedCommGroup.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete {G : Type*} [CommGroup G] [LinearOrder G] [IsOrderedMonoid G] [Nontrivial G] (g : G) : Set.WellFoundedOn {x : G | x ≤ g} (· > ·) ↔ Nonempty (G ≃*o Multiplicative ℤ) := by - rw [← wellFoundedOn_setOf_le_lt_iff_nonempty_discrete (g := g⁻¹)] + rw [← wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete (g := g⁻¹)] refine ⟨fun h ↦ (h.mapsTo (·⁻¹) ?_).mono' ?_, fun h ↦ (h.mapsTo (·⁻¹) ?_).mono' ?_⟩ <;> · intro simp [Function.onFun, inv_le'] -lemma LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete_of_ne_zero +@[deprecated (since := "2026-07-09")] +alias LinearOrderedCommGroup.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete := + LinearOrderedCommGroup.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete + +lemma LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete_of_ne_zero {G₀ : Type*} [LinearOrderedCommGroupWithZero G₀] [Nontrivial G₀ˣ] {g : G₀} (hg : g ≠ 0) : Set.WellFoundedOn {x : G₀ | g ≤ x} (· < ·) ↔ Nonempty (G₀ ≃*o ℤᵐ⁰) := by suffices Set.WellFoundedOn {x : G₀ | g ≤ x} (· < ·) ↔ Set.WellFoundedOn {x : G₀ˣ | Units.mk0 g hg ≤ x} (· < ·) by - rw [this, LinearOrderedCommGroup.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete] + rw [this, LinearOrderedCommGroup.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete] refine Nonempty.congr (fun f ↦ ⟨?_, ?_⟩) (fun f ↦ ⟨?_, ?_⟩) · exact WithZero.withZeroUnitsEquiv.symm.trans f.withZero · intro a b @@ -419,44 +435,52 @@ lemma LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_le_lt_iff_nonempty_disc · simp [Function.onFun] · exact fun x ↦ if h : x = 0 then 1 else Units.mk0 x h · simp +contextual [← Units.val_le_val, MapsTo] - · simp only [mem_sdiff, mem_setOf_eq, mem_singleton_iff, Function.onFun, and_imp] + · simp only [mem_sdiff, mem_ofPred_eq, mem_singleton_iff, Function.onFun, and_imp] intro _ _ ha0 _ _ hb0 h simp [ha0, hb0, ← Units.val_lt_val, h] -lemma LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete_of_ne_zero +@[deprecated (since := "2026-07-09")] +alias LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_le_lt_iff_nonempty_discrete_of_ne_zero := + LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete_of_ne_zero + +lemma LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete_of_ne_zero {G₀ : Type*} [LinearOrderedCommGroupWithZero G₀] [Nontrivial G₀ˣ] {g : G₀} (hg : g ≠ 0) : Set.WellFoundedOn {x : G₀ | x ≤ g} (· > ·) ↔ Nonempty (G₀ ≃*o ℤᵐ⁰) := by have hg' : g⁻¹ ≠ 0 := by simp [hg] - rw [← wellFoundedOn_setOf_le_lt_iff_nonempty_discrete_of_ne_zero hg', + rw [← wellFoundedOn_setOfPred_le_lt_iff_nonempty_discrete_of_ne_zero hg', ← Set.wellFoundedOn_sdiff_singleton (a := 0)] refine ⟨fun h ↦ (h.mapsTo (·⁻¹) ?_).mono' ?_, fun h ↦ (h.mapsTo (·⁻¹) ?_).mono' ?_⟩ · intro x rcases eq_or_ne x 0 with rfl | hx · simp [hg] - simp only [mem_setOf_eq, mem_sdiff, mem_singleton_iff, inv_eq_zero, hx, not_false_eq_true, + simp only [mem_ofPred_eq, mem_sdiff, mem_singleton_iff, inv_eq_zero, hx, not_false_eq_true, and_true] refine (inv_le_comm₀ ?_ ?_).mp <;> simp [zero_lt_iff, hg, hx] - · simp only [mem_setOf_eq, Function.onFun, gt_iff_lt] + · simp only [mem_ofPred_eq, Function.onFun, gt_iff_lt] intro a ha b _ refine inv_strictAnti₀ ?_ contrapose! ha simp only [le_zero_iff] at ha simp [zero_lt_iff, ha, hg] · intro x - simp only [mem_sdiff, mem_setOf_eq, mem_singleton_iff, and_imp] + simp only [mem_sdiff, mem_ofPred_eq, mem_singleton_iff, and_imp] intro hxg hx refine inv_anti₀ ?_ hxg simp [zero_lt_iff, hx] - · simp only [mem_sdiff, mem_setOf_eq, mem_singleton_iff, gt_iff_lt, Function.onFun, and_imp] + · simp only [mem_sdiff, mem_ofPred_eq, mem_singleton_iff, gt_iff_lt, Function.onFun, and_imp] intro a _ _ b _ hb0 refine inv_strictAnti₀ ?_ simp [zero_lt_iff, hb0] +@[deprecated (since := "2026-07-09")] +alias LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete_of_ne_zero := + LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete_of_ne_zero + instance instWellFoundedGTWithZeroMultiplicativeIntLeOne : WellFoundedGT { v : ℤᵐ⁰ // v ≤ 1 } := { wf := - (LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete_of_ne_zero + (LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete_of_ne_zero one_ne_zero).mpr instNonemptyOfInhabited } end WellFounded diff --git a/Mathlib/GroupTheory/ClassEquation.lean b/Mathlib/GroupTheory/ClassEquation.lean index 0cb1257151298e..54a892bc6463c0 100644 --- a/Mathlib/GroupTheory/ClassEquation.lean +++ b/Mathlib/GroupTheory/ClassEquation.lean @@ -66,7 +66,7 @@ theorem Group.nat_card_center_add_sum_card_noncenter_eq_card [Finite G] : rw [Finset.card_eq_sum_ones] refine Finset.sum_congr rfl ?_ rintro ⟨g⟩ hg - simp only [noncenter, Set.toFinset_setOf, Finset.mem_univ, true_and, + simp only [noncenter, Set.toFinset_ofPred, Finset.mem_univ, true_and, Finset.mem_sdiff, Finset.mem_filter, Set.not_nontrivial_iff] at hg rw [eq_comm, ← Set.toFinset_card, Finset.card_eq_one] exact ⟨g, Finset.coe_injective <| by simpa using hg.eq_singleton_of_mem mem_carrier_mk⟩ diff --git a/Mathlib/GroupTheory/Commensurable.lean b/Mathlib/GroupTheory/Commensurable.lean index a3868568ee9971..bb5e89d4d4e8d9 100644 --- a/Mathlib/GroupTheory/Commensurable.lean +++ b/Mathlib/GroupTheory/Commensurable.lean @@ -93,11 +93,11 @@ theorem commensurable_inv (H : Subgroup G) (g : ConjAct G) : such that `Commensurable (g • H) H` -/ def commensurator' (H : Subgroup G) : Subgroup (ConjAct G) where carrier := { g : ConjAct G | Commensurable (g • H) H } - one_mem' := by rw [Set.mem_setOf_eq, one_smul] + one_mem' := by rw [Set.mem_ofPred_eq, one_smul] mul_mem' ha hb := by - rw [Set.mem_setOf_eq, mul_smul] + rw [Set.mem_ofPred_eq, mul_smul] exact trans ((commensurable_conj _).mp hb) ha - inv_mem' _ := by rwa [Set.mem_setOf_eq, comm, ← commensurable_inv] + inv_mem' _ := by rwa [Set.mem_ofPred_eq, comm, ← commensurable_inv] /-- For `H` a subgroup of `G`, this is the subgroup of all elements `g : G` such that `Commensurable (g H g⁻¹) H` -/ diff --git a/Mathlib/GroupTheory/Commutator/Basic.lean b/Mathlib/GroupTheory/Commutator/Basic.lean index bae1b8b7e53cd9..f27e40e9cf6ae1 100644 --- a/Mathlib/GroupTheory/Commutator/Basic.lean +++ b/Mathlib/GroupTheory/Commutator/Basic.lean @@ -461,13 +461,13 @@ open Subgroup /-- Representatives `(g₁, g₂) : G × G` of commutators `⁅g₁, g₂⁆ ∈ G`. -/ @[to_additive /-- Representatives `(g₁, g₂) : G × G` of additive commutators `⁅g₁, g₂⁆ ∈ G`. -/] -def commutatorRepresentatives : Set (G × G) := +noncomputable def commutatorRepresentatives : Set (G × G) := Set.range fun g : commutatorSet G => (g.2.choose, g.2.choose_spec.choose) /-- Subgroup generated by representatives `g₁ g₂ : G` of commutators `⁅g₁, g₂⁆ ∈ G`. -/ @[to_additive /-- Additive subgroup generated by representatives `g₁ g₂ : G` of additive commutators `⁅g₁, g₂⁆ ∈ G`. -/] -def closureCommutatorRepresentatives : Subgroup G := +noncomputable def closureCommutatorRepresentatives : Subgroup G := closure (Prod.fst '' commutatorRepresentatives G ∪ Prod.snd '' commutatorRepresentatives G) @[to_additive] diff --git a/Mathlib/GroupTheory/CommutingProbability.lean b/Mathlib/GroupTheory/CommutingProbability.lean index bb35843efbde61..08069325e3a9c6 100644 --- a/Mathlib/GroupTheory/CommutingProbability.lean +++ b/Mathlib/GroupTheory/CommutingProbability.lean @@ -82,7 +82,7 @@ variable {M} theorem commProb_eq_one_iff [h : Nonempty M] : commProb M = 1 ↔ IsMulCommutative M := by classical haveI := Fintype.ofFinite M - rw [commProb, ← Set.coe_setOf, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] + rw [commProb, ← Set.coe_ofPred, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] rw [div_eq_one_iff_eq, ← Nat.cast_pow, Nat.cast_inj, sq, ← card_prod, set_fintype_card_eq_univ_iff, Set.eq_univ_iff_forall] · exact ⟨fun h ↦ ⟨⟨fun x y ↦ h (x, y)⟩⟩, fun h x ↦ mul_comm' ..⟩ diff --git a/Mathlib/GroupTheory/Complement.lean b/Mathlib/GroupTheory/Complement.lean index 3fb2ddd35ed71d..e7abb9ed75be7c 100644 --- a/Mathlib/GroupTheory/Complement.lean +++ b/Mathlib/GroupTheory/Complement.lean @@ -608,11 +608,11 @@ theorem smul_apply_eq_smul_apply_inv_smul (f : F) (S : H.LeftTransversal) (q : G end Action @[to_additive] -instance : Inhabited H.LeftTransversal := +noncomputable instance : Inhabited H.LeftTransversal := ⟨⟨Set.range Quotient.out, isComplement_range_left Quotient.out_eq'⟩⟩ @[to_additive] -instance : Inhabited H.RightTransversal := +noncomputable instance : Inhabited H.RightTransversal := ⟨⟨Set.range Quotient.out, isComplement_range_right Quotient.out_eq'⟩⟩ theorem IsComplement'.isCompl (h : IsComplement' H K) : IsCompl H K := by diff --git a/Mathlib/GroupTheory/Coset/Basic.lean b/Mathlib/GroupTheory/Coset/Basic.lean index 896ebb56a467bd..5fce88bf8088e5 100644 --- a/Mathlib/GroupTheory/Coset/Basic.lean +++ b/Mathlib/GroupTheory/Coset/Basic.lean @@ -294,7 +294,7 @@ variable {s} {a b : α} theorem eq_class_eq_leftCoset (s : Subgroup α) (g : α) : { x : α | (x : α ⧸ s) = g } = g • s := Set.ext fun z => by - rw [mem_leftCoset_iff, Set.mem_setOf_eq, eq_comm, QuotientGroup.eq, SetLike.mem_coe] + rw [mem_leftCoset_iff, Set.mem_ofPred_eq, eq_comm, QuotientGroup.eq, SetLike.mem_coe] open MulAction in @[to_additive] diff --git a/Mathlib/GroupTheory/CosetCover.lean b/Mathlib/GroupTheory/CosetCover.lean index 5dc34f40e03b57..1edf638d1565fc 100644 --- a/Mathlib/GroupTheory/CosetCover.lean +++ b/Mathlib/GroupTheory/CosetCover.lean @@ -288,7 +288,7 @@ theorem leftCoset_cover_filter_FiniteIndex_aux intro h i hi j hj hij c hi' hj' x hx have hdisjoint := pairwiseDisjoint_leftCoset_cover_const_of_index_eq hcovers' h.symm -- We know the `f k • K k` are pairwise disjoint and need to prove that the `g i • H i` are. - rw [Set.mem_setOf_eq] at hi hj + rw [Set.mem_ofPred_eq] at hi hj have hk' (i) (hi : i ∈ s ∧ (H i).FiniteIndex) (hi' : c ≤ g i • (H i : Set G)) : ∃ (k : κ), k.1.1 = i ∧ K k = D ∧ x ∈ f k • (D : Set G) := by rw [← (ht i hi.1 hi.2).2] at hi' diff --git a/Mathlib/GroupTheory/DoubleCoset.lean b/Mathlib/GroupTheory/DoubleCoset.lean index 1b34f4dec5c52d..4a045c4a2995c0 100644 --- a/Mathlib/GroupTheory/DoubleCoset.lean +++ b/Mathlib/GroupTheory/DoubleCoset.lean @@ -106,7 +106,7 @@ lemma rel_bot_eq_right_group_rel (H : Subgroup G) : exact ⟨b * a⁻¹, h, 1, rfl, by rw [mul_one, inv_mul_cancel_right]⟩ /-- Create a double coset out of an element of `H \ G / K` -/ -def quotToDoubleCoset (H K : Subgroup G) (q : Quotient (H : Set G) K) : Set G := +noncomputable def quotToDoubleCoset (H K : Subgroup G) (q : Quotient (H : Set G) K) : Set G := doubleCoset q.out H K /-- Map from `G` to `H \ G / K` -/ diff --git a/Mathlib/GroupTheory/Finiteness.lean b/Mathlib/GroupTheory/Finiteness.lean index b23c7420082cfc..462d72e9364382 100644 --- a/Mathlib/GroupTheory/Finiteness.lean +++ b/Mathlib/GroupTheory/Finiteness.lean @@ -587,18 +587,18 @@ theorem Submonoid.fg_of_divisive {P : Submonoid M} (hP : ∀ x ∈ P, ∀ y, x * P.FG := by have hpwo := Set.isPWO_of_wellQuasiOrderedLE { x | x ∈ P ∧ x ≠ 1 } rw [fg_iff] - refine ⟨_, ?_, (setOf_minimal_antichain _).finite_of_partiallyWellOrderedOn - (hpwo.mono (setOf_minimal_subset _))⟩ + refine ⟨_, ?_, (setOfPred_minimal_antichain _).finite_of_partiallyWellOrderedOn + (hpwo.mono (setOfPred_minimal_subset _))⟩ ext x constructor · intro hx rw [← P.closure_eq] - exact closure_mono ((setOf_minimal_subset _).trans fun _ => And.left) hx + exact closure_mono ((setOfPred_minimal_subset _).trans fun _ => And.left) hx · intro hx₁ by_cases hx₂ : x = 1 · simp [hx₂] refine hpwo.wellFoundedOn.induction ⟨hx₁, hx₂⟩ fun y ⟨hy₁, hy₂⟩ ih => ?_ - simp only [Set.mem_setOf_eq, and_imp] at ih + simp only [Set.mem_ofPred_eq, and_imp] at ih by_cases hy₃ : Minimal (· ∈ { x | x ∈ P ∧ x ≠ 1 }) y · exact mem_closure_of_mem hy₃ rcases exists_lt_of_not_minimal ⟨hy₁, hy₂⟩ hy₃ with ⟨z, hz₁, hz₂, hz₃⟩ diff --git a/Mathlib/GroupTheory/FreeGroup/Orbit.lean b/Mathlib/GroupTheory/FreeGroup/Orbit.lean index 516448f05a7c3b..fdc6ee23999cbc 100644 --- a/Mathlib/GroupTheory/FreeGroup/Orbit.lean +++ b/Mathlib/GroupTheory/FreeGroup/Orbit.lean @@ -38,17 +38,17 @@ theorem startsWith.ne_one {w : α × Bool} (g : FreeGroup α) (h : g ∈ FreeGro lemma startsWith.disjoint_iff_ne {w w' : α × Bool} : Disjoint (startsWith w) (startsWith w') ↔ w ≠ w' := by simp_all only [ne_eq, startsWith, Set.disjoint_iff_inter_eq_empty, Set.ext_iff, Set.mem_inter_iff, - Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, not_and, Option.some.injEq] + Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and, Option.some.injEq] exact Iff.intro (fun h ↦ h (mk [w]) (by simp)) (by grind) lemma startsWith.Injective : @startsWith α _ |>.Injective := fun a b h ↦ by - simp only [startsWith, Set.ext_iff, Set.mem_setOf_eq] at h + simp only [startsWith, Set.ext_iff, Set.mem_ofPred_eq] at h simpa using h (mk [a]) theorem startsWith_mk_mul {w : α × Bool} (g : FreeGroup α) (h : ¬ g ∈ startsWith (w.1, !w.2)) : mk [w] * g ∈ startsWith w := by by_cases hC : 0 < g.toWord.length - · simp only [startsWith, Set.mem_setOf_eq, getElem?_pos, Option.some.injEq, + · simp only [startsWith, Set.mem_ofPred_eq, getElem?_pos, Option.some.injEq, Prod.eq_iff_fst_eq_snd_eq, not_and, Bool.not_eq_not, toWord_mul, toWord_mk, reduce.cons, reduce_nil, List.cons_append, List.nil_append, reduce_toWord, hC] at * rw [show g.toWord = g.toWord.head (by grind) :: g.toWord.tail by grind] diff --git a/Mathlib/GroupTheory/GroupAction/Blocks.lean b/Mathlib/GroupTheory/GroupAction/Blocks.lean index d86983c27ca447..6c00b44580c12c 100644 --- a/Mathlib/GroupTheory/GroupAction/Blocks.lean +++ b/Mathlib/GroupTheory/GroupAction/Blocks.lean @@ -711,7 +711,7 @@ theorem of_subset (a : X) (hfB : B.Finite) : · simp [hfB_e] have hB'₀ : ∀ (k : G) (_ : a ∈ k • B), B' ≤ k • B := by intro k hk - exact Set.biInter_subset_of_mem hk + exact Set.iInter₂_subset k hk have hfB' : B'.Finite := by obtain ⟨b, hb : b ∈ B⟩ := hfB_ne obtain ⟨k, hk : k • b = a⟩ := exists_smul_eq G b a diff --git a/Mathlib/GroupTheory/GroupAction/Defs.lean b/Mathlib/GroupTheory/GroupAction/Defs.lean index 6293a15c31103f..1ebc38b5b82468 100644 --- a/Mathlib/GroupTheory/GroupAction/Defs.lean +++ b/Mathlib/GroupTheory/GroupAction/Defs.lean @@ -476,7 +476,7 @@ def selfEquivSigmaOrbits' : α ≃ Σ ω : Ω, ω.orbit := /-- Decomposition of a type `X` as a disjoint union of its orbits under a group action. -/ @[to_additive /-- Decomposition of a type `X` as a disjoint union of its orbits under an additive group action. -/] -def selfEquivSigmaOrbits : α ≃ Σ ω : Ω, orbit G ω.out := +noncomputable def selfEquivSigmaOrbits : α ≃ Σ ω : Ω, orbit G ω.out := (selfEquivSigmaOrbits' G α).trans <| Equiv.sigmaCongrRight fun _ => Equiv.setCongr <| orbitRel.Quotient.orbit_eq_orbit_out _ Quotient.out_eq' diff --git a/Mathlib/GroupTheory/GroupAction/Primitive.lean b/Mathlib/GroupTheory/GroupAction/Primitive.lean index 9758266c463384..378d16762cd47e 100644 --- a/Mathlib/GroupTheory/GroupAction/Primitive.lean +++ b/Mathlib/GroupTheory/GroupAction/Primitive.lean @@ -388,7 +388,7 @@ theorem exists_mem_smul_and_notMem_smul [IsPreprimitive G X] exfalso; apply hA' suffices ∃ g : G, a ∈ g • A by obtain ⟨g, hg⟩ := this - have : B ⊆ g • A := Set.biInter_subset_of_mem hg + have : B ⊆ g • A := Set.iInter₂_subset g hg rw [hyp, Set.univ_subset_iff, ← eq_inv_smul_iff] at this rw [this, Set.smul_set_univ] -- ∃ (g : M), a ∈ g • A diff --git a/Mathlib/GroupTheory/HNNExtension.lean b/Mathlib/GroupTheory/HNNExtension.lean index 181ccc15c4e004..d07a7d7434cb90 100644 --- a/Mathlib/GroupTheory/HNNExtension.lean +++ b/Mathlib/GroupTheory/HNNExtension.lean @@ -124,7 +124,7 @@ theorem induction_on {motive : HNNExtension G A B φ → Prop} (t : motive t) (mul : ∀ x y, motive x → motive y → motive (x * y)) (inv : ∀ x, motive x → motive x⁻¹) : motive x := by let S : Subgroup (HNNExtension G A B φ) := - { carrier := setOf motive + { carrier := Set.ofPred motive one_mem' := by simpa using of 1 mul_mem' := mul _ _ inv_mem' := inv _ } diff --git a/Mathlib/GroupTheory/Nilpotent.lean b/Mathlib/GroupTheory/Nilpotent.lean index f8c36afe217b70..cbbdb7ed827256 100644 --- a/Mathlib/GroupTheory/Nilpotent.lean +++ b/Mathlib/GroupTheory/Nilpotent.lean @@ -192,7 +192,7 @@ theorem upperCentralSeries_zero : upperCentralSeries G 0 = ⊥ := rfl theorem upperCentralSeries_one : upperCentralSeries G 1 = center G := by ext simp only [upperCentralSeries, upperCentralSeriesAux, upperCentralSeriesStep, mem_bot, mem_mk, - Submonoid.mem_mk, Subsemigroup.mem_mk, Set.mem_setOf_eq, mem_center_iff] + Submonoid.mem_mk, Subsemigroup.mem_mk, Set.mem_ofPred_eq, mem_center_iff] exact forall_congr' fun y => by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul, eq_comm] @@ -201,7 +201,7 @@ theorem _root_.AddSubgroup.upperCentralSeries_one (G : Type*) [AddGroup G] : ext simp only [AddSubgroup.upperCentralSeries, AddSubgroup.upperCentralSeriesAux, AddSubgroup.upperCentralSeriesStep, AddSubgroup.mem_bot, AddSubgroup.mem_mk, - AddSubmonoid.mem_mk, AddSubsemigroup.mem_mk, Set.mem_setOf_eq, AddSubgroup.mem_center_iff] + AddSubmonoid.mem_mk, AddSubsemigroup.mem_mk, Set.mem_ofPred_eq, AddSubgroup.mem_center_iff] exact forall_congr' fun y => by rw [addCommutatorElement_def, add_neg_eq_zero, add_neg_eq_iff_eq_add, eq_comm] diff --git a/Mathlib/GroupTheory/Perm/Centralizer.lean b/Mathlib/GroupTheory/Perm/Centralizer.lean index 919c6f7deb3157..846327d651cd2b 100644 --- a/Mathlib/GroupTheory/Perm/Centralizer.lean +++ b/Mathlib/GroupTheory/Perm/Centralizer.lean @@ -174,12 +174,12 @@ def range_toPermHom' : Subgroup (Perm g.cycleFactorsFinset) where carrier := {τ | ∀ c, #(τ c).val.support = #c.val.support} one_mem' := by simp mul_mem' hσ hτ := by - simp only [Subtype.forall, Set.mem_setOf_eq, coe_mul, Function.comp_apply] - simp only [Subtype.forall, Set.mem_setOf_eq] at hσ hτ + simp only [Subtype.forall, Set.mem_ofPred_eq, coe_mul, Function.comp_apply] + simp only [Subtype.forall, Set.mem_ofPred_eq] at hσ hτ intro c hc rw [hσ, hτ] inv_mem' hσ := by - simp only [Subtype.forall, Set.mem_setOf_eq] at hσ ⊢ + simp only [Subtype.forall, Set.mem_ofPred_eq] at hσ ⊢ intro c hc rw [← hσ _ (by simp)] simp @@ -465,7 +465,7 @@ theorem nat_card_range_toPermHom : set sc := fun (c : g.cycleFactorsFinset) ↦ #c.val.support with hsc suffices Fintype.card (toPermHom g).range = Fintype.card { k : Perm g.cycleFactorsFinset | sc ∘ k = sc } by - simp only [Nat.card_eq_fintype_card, this, Set.coe_setOf, DomMulAct.stabilizer_card', hsc, + simp only [Nat.card_eq_fintype_card, this, Set.coe_ofPred, DomMulAct.stabilizer_card', hsc, Finset.univ_eq_attach] simp_rw [← CycleType.count_def] apply Finset.prod_congr _ (fun _ _ => rfl) @@ -476,7 +476,7 @@ theorem nat_card_range_toPermHom : simp only [Fintype.card_eq_nat_card] congr ext - rw [mem_range_toPermHom_iff', Set.mem_setOf_eq] + rw [mem_range_toPermHom_iff', Set.mem_ofPred_eq] section Kernel /- Here, we describe the kernel of `g.OnCycleFactors.toPermHom` -/ @@ -648,7 +648,7 @@ theorem card_isConj_mul_eq : rw [Subgroup.nat_card_centralizer_nat_card_stabilizer, Nat.card_eq_fintype_card] convert! MulAction.card_orbit_mul_card_stabilizer_eq_card_group (ConjAct (Perm α)) g · ext h - simp only [Set.mem_setOf_eq, ConjAct.mem_orbit_conjAct, isConj_comm] + simp only [Set.mem_ofPred_eq, ConjAct.mem_orbit_conjAct, isConj_comm] · rw [ConjAct.card, Fintype.card_perm] /-- Cardinality of a conjugacy class in `Equiv.Perm α` of a given `cycleType` -/ @@ -682,7 +682,7 @@ theorem card_of_cycleType_mul_eq (m : Multiset ℕ) : classical obtain ⟨g, rfl⟩ := (exists_with_cycleType_iff α).mpr hm convert! card_isConj_mul_eq g - simp_rw [Set.coe_setOf, Nat.card_eq_fintype_card, ← Fintype.card_coe, Finset.mem_filter, + simp_rw [Set.coe_ofPred, Nat.card_eq_fintype_card, ← Fintype.card_coe, Finset.mem_filter, Finset.mem_univ, true_and, ← isConj_iff_cycleType_eq, isConj_comm (g := g)] · -- empty case rw [(card_of_cycleType_eq_zero_iff α).mpr hm, zero_mul] diff --git a/Mathlib/GroupTheory/Perm/ClosureSwap.lean b/Mathlib/GroupTheory/Perm/ClosureSwap.lean index dcef20d0f5d7c1..7a8cb3d3f0dd39 100644 --- a/Mathlib/GroupTheory/Perm/ClosureSwap.lean +++ b/Mathlib/GroupTheory/Perm/ClosureSwap.lean @@ -94,7 +94,7 @@ theorem swap_mem_closure_isSwap {S : Set (Perm α)} (hS : ∀ f ∈ S, f.IsSwap) obtain rfl | rfl := this <;> simpa [swap_comm] using subset_closure hσ · obtain ⟨x, y, -, rfl⟩ := hS f hf; rwa [swap_inv] · exact orbit_eq_iff.mpr hf ▸ ⟨⟨swap z y, hz⟩, swap_apply_right z y⟩ - · rw [mem_setOf, swap_self]; apply one_mem + · rw [mem_ofPred, swap_self]; apply one_mem /-- If a subgroup is generated by transpositions, then a permutation `f` lies in the subgroup if and only if `f` has finite support and `f x` always lies in the same orbit as `x`. -/ diff --git a/Mathlib/GroupTheory/Perm/Cycle/Basic.lean b/Mathlib/GroupTheory/Perm/Cycle/Basic.lean index 4b876072012319..f4e888bcd44cf7 100644 --- a/Mathlib/GroupTheory/Perm/Cycle/Basic.lean +++ b/Mathlib/GroupTheory/Perm/Cycle/Basic.lean @@ -736,9 +736,11 @@ protected theorem IsCycleOn.subtypePerm (hf : f.IsCycleOn s) : obtain hs | hs := s.subsingleton_or_nontrivial · haveI := hs.coe_sort exact isCycleOn_of_subsingleton _ _ - convert! (hf.isCycle_subtypePerm hs).isCycleOn - rw [eq_comm, Set.eq_univ_iff_forall] - exact fun x => ne_of_apply_ne ((↑) : s → α) (hf.apply_ne hs x.2) + have h : { x : s | (f.subtypePerm fun _ => hf.apply_mem_iff : Perm s) x ≠ x } = + _root_.Set.univ := by + rw [Set.eq_univ_iff_forall] + exact fun x => ne_of_apply_ne ((↑) : s → α) (hf.apply_ne hs x.2) + exact h ▸ (hf.isCycle_subtypePerm hs).isCycleOn -- TODO: Theory of order of an element under an action theorem IsCycleOn.pow_apply_eq {s : Finset α} (hf : f.IsCycleOn s) (ha : a ∈ s) {n : ℕ} : @@ -820,7 +822,7 @@ theorem IsCycleOn.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ S protected theorem IsCycleOn.countable (hs : f.IsCycleOn s) : s.Countable := by obtain rfl | ⟨a, ha⟩ := s.eq_empty_or_nonempty · exact Set.countable_empty - · exact (Set.countable_range fun n : ℤ => (⇑(f ^ n) : α → α) a).mono (hs.2 ha) + · exact (Set.countable_range fun n : ℤ => (⇑(f ^ n) : α → α) a).mono fun y hy => hs.2 ha hy end IsCycleOn @@ -836,7 +838,7 @@ variable [DecidableEq α] {l : List α} theorem Nodup.isCycleOn_formPerm (h : l.Nodup) : l.formPerm.IsCycleOn { a | a ∈ l } := by refine ⟨l.formPerm.bijOn fun _ => List.formPerm_mem_iff_mem, fun a ha b hb => ?_⟩ - rw [Set.mem_setOf, ← List.idxOf_lt_length_iff] at ha hb + rw [Set.mem_ofPred, ← List.idxOf_lt_length_iff] at ha hb rw [← List.getElem_idxOf ha, ← List.getElem_idxOf hb] refine ⟨l.idxOf b - l.idxOf a, ?_⟩ simp only [sub_eq_neg_add, zpow_add, zpow_neg, Equiv.Perm.inv_eq_iff_eq, zpow_natCast, @@ -855,8 +857,8 @@ theorem exists_cycleOn (s : Finset α) : ∃ f : Perm α, f.IsCycleOn s ∧ f.support ⊆ s := by refine ⟨s.toList.formPerm, ?_, fun x hx => by simpa using List.mem_of_formPerm_apply_ne (Perm.mem_support.1 hx)⟩ - convert! s.nodup_toList.isCycleOn_formPerm - simp + have h : { a | a ∈ s.toList } = ↑s := by ext a; simp + exact h ▸ s.nodup_toList.isCycleOn_formPerm end Finset @@ -868,10 +870,11 @@ theorem Countable.exists_cycleOn (hs : s.Countable) : ∃ f : Perm α, f.IsCycleOn s ∧ { x | f x ≠ x } ⊆ s := by classical obtain hs' | hs' := s.finite_or_infinite - · refine ⟨hs'.toFinset.toList.formPerm, ?_, fun x hx => by + · obtain ⟨t, rfl⟩ : ∃ t : Finset α, ↑t = s := ⟨hs'.toFinset, hs'.coe_toFinset⟩ + refine ⟨t.toList.formPerm, ?_, fun x hx => by simpa using List.mem_of_formPerm_apply_ne hx⟩ - convert! hs'.toFinset.nodup_toList.isCycleOn_formPerm - simp + have h : { a | a ∈ t.toList } = ↑t := by ext a; simp + exact h ▸ t.nodup_toList.isCycleOn_formPerm · haveI := hs.to_subtype haveI := hs'.to_subtype obtain ⟨f⟩ : Nonempty (ℤ ≃ s) := inferInstance diff --git a/Mathlib/GroupTheory/Perm/DomMulAct.lean b/Mathlib/GroupTheory/Perm/DomMulAct.lean index a1ca74e4bf92a2..4de8e32868c344 100644 --- a/Mathlib/GroupTheory/Perm/DomMulAct.lean +++ b/Mathlib/GroupTheory/Perm/DomMulAct.lean @@ -112,7 +112,7 @@ theorem stabilizer_ncard [Finite α] [Fintype ι] : Set.ncard {g : Perm α | f ∘ g = f} = ∏ i, (Set.ncard {a | f a = i})! := by classical cases nonempty_fintype α - simp only [← Nat.card_coe_set_eq, Set.coe_setOf, card_eq_fintype_card] + simp only [← Nat.card_coe_set_eq, Set.coe_ofPred, card_eq_fintype_card] exact stabilizer_card f variable [DecidableEq α] [DecidableEq ι] diff --git a/Mathlib/GroupTheory/Perm/Finite.lean b/Mathlib/GroupTheory/Perm/Finite.lean index 4fbb18d909c321..b3a4e60b35ec32 100644 --- a/Mathlib/GroupTheory/Perm/Finite.lean +++ b/Mathlib/GroupTheory/Perm/Finite.lean @@ -287,10 +287,10 @@ lemma disjoint_closure_of_disjoint_support {S T : Set (Perm α)} exact h theorem mem_range_ofSubtype_iff {p : α → Prop} [DecidablePred p] {g : Perm α} : - g ∈ (ofSubtype : Perm (Subtype p) →* Perm α).range ↔ (g.support : Set α) ⊆ setOf p := by + g ∈ (ofSubtype : Perm (Subtype p) →* Perm α).range ↔ (g.support : Set α) ⊆ Set.ofPred p := by constructor · rintro ⟨k, rfl⟩ x - simp only [Finset.mem_coe, mem_support_ofSubtype, Set.mem_setOf_eq] + simp only [Finset.mem_coe, mem_support_ofSubtype, Set.mem_ofPred_eq] exact fun ⟨hx, _⟩ ↦ hx · intro hg refine ⟨g.subtypePerm fun x ↦ ?_, ofSubtype_subtypePerm _ fun x hx ↦ hg (mem_support.mpr hx)⟩ diff --git a/Mathlib/GroupTheory/Perm/List.lean b/Mathlib/GroupTheory/Perm/List.lean index baac42b4178be2..b6532effd0d0b8 100644 --- a/Mathlib/GroupTheory/Perm/List.lean +++ b/Mathlib/GroupTheory/Perm/List.lean @@ -198,7 +198,7 @@ theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, · intro x hx simp only [Finset.mem_coe, mem_toFinset] at hx obtain ⟨n, hn, rfl⟩ := getElem_of_mem hx - rw [Set.mem_setOf_eq, formPerm_apply_getElem _ h] + rw [Set.mem_ofPred_eq, formPerm_apply_getElem _ h] intro H rw [nodup_iff_injective_get, Function.Injective] at h specialize h H @@ -210,9 +210,7 @@ theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, theorem support_formPerm_of_nodup [Fintype α] (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) : support (formPerm l) = l.toFinset := by - rw [← Finset.coe_inj] - convert! support_formPerm_of_nodup' _ h h' - simp [Set.ext_iff] + rw [← Finset.coe_inj, coe_support_eq_set_support, support_formPerm_of_nodup' _ h h'] theorem formPerm_rotate_one (l : List α) (h : Nodup l) : formPerm (l.rotate 1) = formPerm l := by have h' : Nodup (l.rotate 1) := by simpa using h @@ -273,7 +271,7 @@ theorem formPerm_ext_iff {x y x' y' : α} {l l' : List α} (hd : Nodup (x :: y : rw [Equiv.Perm.ext_iff] at h have hx : x' ∈ x :: y :: l := by have : x' ∈ { z | formPerm (x :: y :: l) z ≠ z } := by - rw [Set.mem_setOf_eq, h x', formPerm_apply_head _ _ _ hd'] + rw [Set.mem_ofPred_eq, h x', formPerm_apply_head _ _ _ hd'] simp only [mem_cons, nodup_cons] at hd' push Not at hd' exact hd'.left.left.symm diff --git a/Mathlib/GroupTheory/Perm/Support.lean b/Mathlib/GroupTheory/Perm/Support.lean index 520542a620cae2..94ebb71c05053c 100644 --- a/Mathlib/GroupTheory/Perm/Support.lean +++ b/Mathlib/GroupTheory/Perm/Support.lean @@ -228,7 +228,7 @@ theorem set_support_apply_mem {p : Perm α} {a : α} : theorem set_support_zpow_subset (n : ℤ) : { x | (p ^ n) x ≠ x } ⊆ { x | p x ≠ x } := by intro x - simp only [Set.mem_setOf_eq, Ne] + simp only [Set.mem_ofPred_eq, Ne] intro hx H simp [zpow_apply_eq_self_of_apply_eq_self H] at hx diff --git a/Mathlib/GroupTheory/SchurZassenhaus.lean b/Mathlib/GroupTheory/SchurZassenhaus.lean index a65caa3d9f5101..563d50f6ab8e6d 100644 --- a/Mathlib/GroupTheory/SchurZassenhaus.lean +++ b/Mathlib/GroupTheory/SchurZassenhaus.lean @@ -42,7 +42,7 @@ def QuotientDiff := ⟨fun α => diff_self (MonoidHom.id H) α, fun h => by rw [← diff_inv, h, inv_one], fun h h' => by rw [← diff_mul_diff, h, h', one_mul]⟩) -instance : Inhabited H.QuotientDiff := +noncomputable instance : Inhabited H.QuotientDiff := inferInstanceAs (Inhabited <| Quotient _) theorem smul_diff_smul' [hH : Normal H] (g : Gᵐᵒᵖ) : diff --git a/Mathlib/GroupTheory/SpecificGroups/Alternating.lean b/Mathlib/GroupTheory/SpecificGroups/Alternating.lean index 13c0a8012a4303..9a59091907c5a9 100644 --- a/Mathlib/GroupTheory/SpecificGroups/Alternating.lean +++ b/Mathlib/GroupTheory/SpecificGroups/Alternating.lean @@ -240,7 +240,7 @@ theorem closure_cycleType_eq_two_two_eq_alternatingGroup (h5 : 5 ≤ Nat.card α apply le_antisymm · rw [Subgroup.closure_le] intro g hg - simp only [Set.mem_setOf_eq] at hg + simp only [Set.mem_ofPred_eq] at hg simp [mem_alternatingGroup, sign_of_cycleType, hg, ← Units.val_inj] · rw [← Equiv.Perm.closure_three_cycles_eq_alternating, Subgroup.closure_le] intro g hg3 @@ -263,7 +263,7 @@ alias closure_cycleType_eq_2_2_eq_alternatingGroup := theorem cycleType_eq_two_two_subset_alternatingGroup : {g : Perm α | g.cycleType = {2, 2}} ⊆ alternatingGroup α := by intro g hg - rw [Set.mem_setOf_eq] at hg + rw [Set.mem_ofPred_eq] at hg simp [sign_of_cycleType, hg, ← Units.val_inj] theorem _root_.alternatingGroup.closure_cycleType_eq_two_two_eq_top (h5 : 5 ≤ Nat.card α) : diff --git a/Mathlib/GroupTheory/SpecificGroups/Alternating/KleinFour.lean b/Mathlib/GroupTheory/SpecificGroups/Alternating/KleinFour.lean index 38f32ea1732143..64fbb887d2a2cb 100644 --- a/Mathlib/GroupTheory/SpecificGroups/Alternating/KleinFour.lean +++ b/Mathlib/GroupTheory/SpecificGroups/Alternating/KleinFour.lean @@ -123,7 +123,7 @@ theorem coe_two_sylow_of_card_eq_four · -- card (kleinFour α) ≤ card S simp_rw [← Nat.card_eq_fintype_card] refine (card_two_sylow_of_card_eq_four hα4 S).trans_ge ?_ - rw [Nat.card_eq_card_toFinset, Set.toFinset_union, Set.toFinset_singleton, Set.toFinset_setOf] + rw [Nat.card_eq_card_toFinset, Set.toFinset_union, Set.toFinset_singleton, Set.toFinset_ofPred] apply (Finset.card_union_le _ _).trans rw [Finset.card_singleton, AlternatingGroup.card_of_cycleType, ← Nat.card_eq_fintype_card, hα4] decide @@ -212,7 +212,7 @@ theorem kleinFour_eq_commutator (hα4 : Nat.card α = 4) : refine le_antisymm ?_ comm_le intro g hg rw [← SetLike.mem_coe, coe_kleinFour_of_card_eq_four hα4, - Set.mem_union, Set.mem_singleton_iff, Set.mem_setOf_eq] at hg + Set.mem_union, Set.mem_singleton_iff, Set.mem_ofPred_eq] at hg rcases hg with ⟨rfl⟩ | hg · exact Subgroup.one_mem _ · rw [← hg, ← Equiv.Perm.isConj_iff_cycleType_eq, isConj_iff] at hk22 @@ -227,7 +227,7 @@ theorem kleinFour_eq_commutator (hα4 : Nat.card α = 4) : simp have hk2 := comm_le hk rw [← SetLike.mem_coe, coe_kleinFour_of_card_eq_four hα4, - Set.mem_union, Set.mem_singleton_iff, Set.mem_setOf_eq] at hk2 + Set.mem_union, Set.mem_singleton_iff, Set.mem_ofPred_eq] at hk2 exact hk2.resolve_left hk' end alternatingGroup diff --git a/Mathlib/GroupTheory/SpecificGroups/Alternating/Simple.lean b/Mathlib/GroupTheory/SpecificGroups/Alternating/Simple.lean index 47abda9765ffbc..0815e1c4f5b5c2 100644 --- a/Mathlib/GroupTheory/SpecificGroups/Alternating/Simple.lean +++ b/Mathlib/GroupTheory/SpecificGroups/Alternating/Simple.lean @@ -167,7 +167,7 @@ def iwasawaStructure_four (h5 : 5 ≤ Nat.card α) : is_generator := by rw [eq_top_iff, ← closure_cycleType_eq_two_two_eq_top h5, Subgroup.closure_le] intro g hg - simp only [Set.mem_setOf_eq] at hg + simp only [Set.mem_ofPred_eq] at hg apply Subgroup.mem_iSup_of_mem ⟨(g : Perm α).support, by simp [← sum_cycleType, hg]⟩ rw [mem_map_kleinFour_ofSubtype] <;> simp [hg, ← sum_cycleType] diff --git a/Mathlib/GroupTheory/Subgroup/Center.lean b/Mathlib/GroupTheory/Subgroup/Center.lean index c6451bbeeb125f..9838e40b2f6ce9 100644 --- a/Mathlib/GroupTheory/Subgroup/Center.lean +++ b/Mathlib/GroupTheory/Subgroup/Center.lean @@ -141,7 +141,7 @@ namespace ConjClasses theorem mk_bijOn (G : Type*) [Group G] : Set.BijOn ConjClasses.mk (↑(Subgroup.center G)) (noncenter G)ᶜ := by refine ⟨fun g hg ↦ ?_, fun x hx y _ H ↦ ?_, ?_⟩ - · simp only [mem_noncenter, Set.compl_def, Set.mem_setOf, Set.not_nontrivial_iff] + · simp only [mem_noncenter, Set.compl_def, Set.mem_ofPred, Set.not_nontrivial_iff] intro x hx y hy simp only [mem_carrier_iff_mk_eq, mk_eq_mk_iff_isConj] at hx hy rw [hx.eq_of_right_mem_center hg, hy.eq_of_right_mem_center hg] @@ -149,7 +149,7 @@ theorem mk_bijOn (G : Type*) [Group G] : exact H.eq_of_left_mem_center hx · rintro ⟨g⟩ hg refine ⟨g, ?_, rfl⟩ - simp only [mem_noncenter, Set.compl_def, Set.mem_setOf, Set.not_nontrivial_iff] at hg + simp only [mem_noncenter, Set.compl_def, Set.mem_ofPred, Set.not_nontrivial_iff] at hg rw [SetLike.mem_coe, Subgroup.mem_center_iff] intro h rw [← mul_inv_eq_iff_eq_mul] diff --git a/Mathlib/GroupTheory/Transfer.lean b/Mathlib/GroupTheory/Transfer.lean index 1c16a59aae9e89..96b417fccff765 100644 --- a/Mathlib/GroupTheory/Transfer.lean +++ b/Mathlib/GroupTheory/Transfer.lean @@ -101,14 +101,14 @@ lemma coe_transferFunction (q : G ⧸ H) : ↑(transferFunction H g q) = q := by variable (H) in /-- The transfer transversal as a set. Contains elements of the form `g ^ k • g₀` for fixed choices of representatives `g₀` of fixed choices of representatives `q₀` of `⟨g⟩`-orbits in `G ⧸ H`. -/ -def transferSet : Set G := Set.range (transferFunction H g) +noncomputable def transferSet : Set G := Set.range (transferFunction H g) lemma mem_transferSet (q : G ⧸ H) : transferFunction H g q ∈ transferSet H g := ⟨q, rfl⟩ variable (H) in /-- The transfer transversal. Contains elements of the form `g ^ k • g₀` for fixed choices of representatives `g₀` of fixed choices of representatives `q₀` of `⟨g⟩`-orbits in `G ⧸ H`. -/ -def transferTransversal : H.LeftTransversal := +noncomputable def transferTransversal : H.LeftTransversal := ⟨transferSet H g, isComplement_range_left (coe_transferFunction g)⟩ lemma transferTransversal_apply (q : G ⧸ H) : diff --git a/Mathlib/LinearAlgebra/AffineSpace/Simplex/Basic.lean b/Mathlib/LinearAlgebra/AffineSpace/Simplex/Basic.lean index 734b662a501c96..a4c36c78fa2185 100644 --- a/Mathlib/LinearAlgebra/AffineSpace/Simplex/Basic.lean +++ b/Mathlib/LinearAlgebra/AffineSpace/Simplex/Basic.lean @@ -515,7 +515,7 @@ lemma closedInterior_subset_affineSpan {n : ℕ} {s : Simplex k P n} : @[simp] lemma interior_eq_empty (s : Simplex k P 0) : s.interior = ∅ := by ext p simp only [Simplex.interior, Simplex.setInterior, Nat.reduceAdd, univ_unique, Fin.default_eq_zero, - Fin.isValue, sum_singleton, Set.mem_Ioo, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false, + Fin.isValue, sum_singleton, Set.mem_Ioo, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_exists, not_and] intro w h hi simpa [h] using hi 0 @@ -524,7 +524,7 @@ lemma closedInterior_subset_affineSpan {n : ℕ} {s : Simplex k P n} : s.closedInterior = {s.points 0} := by ext p simp only [Simplex.closedInterior, Simplex.setInterior, Nat.reduceAdd, univ_unique, - Fin.default_eq_zero, Fin.isValue, sum_singleton, Set.mem_Icc, Set.mem_setOf_eq, + Fin.default_eq_zero, Fin.isValue, sum_singleton, Set.mem_Icc, Set.mem_ofPred_eq, Set.mem_singleton_iff] constructor · rintro ⟨w, h0, hi, rfl⟩ diff --git a/Mathlib/LinearAlgebra/Basis/Flag.lean b/Mathlib/LinearAlgebra/Basis/Flag.lean index a9860c9e1a9e38..26aec14210d3a9 100644 --- a/Mathlib/LinearAlgebra/Basis/Flag.lean +++ b/Mathlib/LinearAlgebra/Basis/Flag.lean @@ -31,7 +31,7 @@ variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] {n : ℕ} {b {i j : Fin (n + 1)} /-- The subspace spanned by the first `k` vectors of the basis `b`. -/ -def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M := +noncomputable def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M := .span R <| b '' {i | i.castSucc < k} @[simp] @@ -48,7 +48,7 @@ theorem flag_le_iff (b : Basis (Fin n) R M) {k p} : theorem flag_succ (b : Basis (Fin n) R M) (k : Fin n) : b.flag k.succ = R ∙ b k ⊔ b.flag k.castSucc := by simp only [flag, Fin.castSucc_lt_castSucc_iff] - simp [Fin.castSucc_lt_iff_succ_le, le_iff_eq_or_lt, setOf_or, image_insert_eq, span_insert] + simp [Fin.castSucc_lt_iff_succ_le, le_iff_eq_or_lt, ofPred_or, image_insert_eq, span_insert] theorem self_mem_flag (b : Basis (Fin n) R M) {i : Fin n} {k : Fin (n + 1)} (h : i.castSucc < k) : b i ∈ b.flag k := @@ -109,7 +109,7 @@ theorem flag_wcovBy (b : Basis (Fin n) K V) (i : Fin n) : /-- Range of `Basis.flag` as a `Flag`. -/ @[simps!] -def toFlag (b : Basis (Fin n) K V) : Flag (Submodule K V) := +noncomputable def toFlag (b : Basis (Fin n) K V) : Flag (Submodule K V) := .rangeFin b.flag b.flag_zero b.flag_last b.flag_wcovBy @[simp] diff --git a/Mathlib/LinearAlgebra/Basis/Submodule.lean b/Mathlib/LinearAlgebra/Basis/Submodule.lean index aa9d6ba203ab18..3bcabc07982d5e 100644 --- a/Mathlib/LinearAlgebra/Basis/Submodule.lean +++ b/Mathlib/LinearAlgebra/Basis/Submodule.lean @@ -130,7 +130,7 @@ lemma mem_center_iff {A} · intros exact ⟨h.2 _ _, h.3 _ _⟩ · intro h - rw [center, mem_setOf_eq] + rw [center, mem_ofPred_eq] constructor case comm => intro y diff --git a/Mathlib/LinearAlgebra/Basis/VectorSpace.lean b/Mathlib/LinearAlgebra/Basis/VectorSpace.lean index 8926b75a69fe96..aacdb657cc4886 100644 --- a/Mathlib/LinearAlgebra/Basis/VectorSpace.lean +++ b/Mathlib/LinearAlgebra/Basis/VectorSpace.lean @@ -64,12 +64,12 @@ theorem coe_extend (hs : LinearIndepOn K id s) : ⇑(Basis.extend hs) = ((↑) : theorem range_extend (hs : LinearIndepOn K id s) : range (Basis.extend hs) = hs.extend (subset_univ _) := by - rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq] + rw [coe_extend, Subtype.range_coe_subtype, ofPred_mem_eq] /-- Auxiliary definition: the index for the new basis vectors in `Basis.sumExtend`. The specific value of this definition should be considered an implementation detail. -/ -def sumExtendIndex (hs : LinearIndependent K v) : Set V := +noncomputable def sumExtendIndex (hs : LinearIndependent K v) : Set V := LinearIndepOn.extend hs.linearIndepOn_id (subset_univ _) \ range v /-- If `v` is a linear independent family of vectors, extend it to a basis indexed by a sum type. -/ @@ -107,7 +107,7 @@ theorem coe_extendLe (hs : LinearIndepOn K id s) (hst : s ⊆ t) (ht : ⊤ ≤ s theorem range_extendLe (hs : LinearIndepOn K id s) (hst : s ⊆ t) (ht : ⊤ ≤ span K t) : range (Basis.extendLe hs hst ht) = hs.extend hst := by - rw [coe_extendLe, Subtype.range_coe_subtype, setOf_mem_eq] + rw [coe_extendLe, Subtype.range_coe_subtype, ofPred_mem_eq] theorem subset_extendLe (hs : LinearIndepOn K id s) (hst : s ⊆ t) (ht : ⊤ ≤ span K t) : s ⊆ range (Basis.extendLe hs hst ht) := @@ -133,7 +133,7 @@ theorem coe_ofSpan (hs : ⊤ ≤ span K s) : ⇑(ofSpan hs) = ((↑) : _ → _) theorem range_ofSpan (hs : ⊤ ≤ span K s) : range (ofSpan hs) = (linearIndepOn_empty K id).extend (empty_subset s) := by - rw [coe_ofSpan, Subtype.range_coe_subtype, setOf_mem_eq] + rw [coe_ofSpan, Subtype.range_coe_subtype, ofPred_mem_eq] theorem ofSpan_subset (hs : ⊤ ≤ span K s) : range (ofSpan hs) ⊆ s := extendLe_subset (linearIndependent_empty K V) (empty_subset s) hs diff --git a/Mathlib/LinearAlgebra/CliffordAlgebra/Basic.lean b/Mathlib/LinearAlgebra/CliffordAlgebra/Basic.lean index 33ca6fe5da724c..5488b61cd9fc3e 100644 --- a/Mathlib/LinearAlgebra/CliffordAlgebra/Basic.lean +++ b/Mathlib/LinearAlgebra/CliffordAlgebra/Basic.lean @@ -193,7 +193,7 @@ theorem induction {C : CliffordAlgebra Q → Prop} (a : CliffordAlgebra Q) : C a := by -- the arguments are enough to construct a subalgebra, and a mapping into it from M let s : Subalgebra R (CliffordAlgebra Q) := - { carrier := C + { carrier := {a | C a} mul_mem' := @mul add_mem' := @add algebraMap_mem' := algebraMap } diff --git a/Mathlib/LinearAlgebra/Dimension/OrzechProperty.lean b/Mathlib/LinearAlgebra/Dimension/OrzechProperty.lean index e1bd2e7b61e1a2..1b9b35ac404514 100644 --- a/Mathlib/LinearAlgebra/Dimension/OrzechProperty.lean +++ b/Mathlib/LinearAlgebra/Dimension/OrzechProperty.lean @@ -78,7 +78,7 @@ provided `R` satisfies the Orzech property. -/ @[simps! repr_apply] noncomputable def setBasisOfTopLeSpanOfCardEqFinrank {s : Set M} [Fintype s] (le_span : ⊤ ≤ span R s) (card_eq : s.toFinset.card = finrank R M) : Basis s R M := - basisOfTopLeSpanOfCardEqFinrank ((↑) : s → M) ((@Subtype.range_coe_subtype _ s).symm ▸ le_span) - (_root_.trans s.toFinset_card.symm card_eq) + basisOfTopLeSpanOfCardEqFinrank ((↑) : s → M) (Subtype.range_coe_subtype ▸ le_span) + (s.toFinset_card.symm.trans card_eq) end Basis diff --git a/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean b/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean index 368c32cb3e9fed..60f4f7e764331f 100644 --- a/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean +++ b/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean @@ -383,7 +383,7 @@ theorem rank_span {v : ι → M} (hv : LinearIndependent R v) : Cardinal.mk_range_eq_of_injective (@LinearIndependent.injective ι R M v _ _ _ _ hv)] theorem rank_span_set {s : Set M} (hs : LinearIndepOn R id s) : Module.rank R ↑(span R s) = #s := by - rw [← @setOf_mem_eq _ s, ← Subtype.range_coe_subtype] + rw [← @ofPred_mem_eq _ s, ← Subtype.range_coe_subtype] exact rank_span hs theorem toENat_rank_span_set {v : ι → M} {s : Set ι} (hs : LinearIndepOn R v s) : diff --git a/Mathlib/LinearAlgebra/Dual/Basis.lean b/Mathlib/LinearAlgebra/Dual/Basis.lean index 8c652b22e163be..4f034d22b31c53 100644 --- a/Mathlib/LinearAlgebra/Dual/Basis.lean +++ b/Mathlib/LinearAlgebra/Dual/Basis.lean @@ -238,7 +238,7 @@ variable {e : ι → M} {ε : ι → Dual R M} def coeffs (h : DualBases e ε) (m : M) : ι →₀ R where toFun i := ε i m support := (h.finite m).toFinset - mem_support_toFun i := by rw [Set.Finite.mem_toFinset, Set.mem_setOf_eq] + mem_support_toFun i := by rw [Set.Finite.mem_toFinset, Set.mem_ofPred_eq] @[simp] theorem coeffs_apply (h : DualBases e ε) (m : M) (i : ι) : h.coeffs m i = ε i m := diff --git a/Mathlib/LinearAlgebra/Dual/Defs.lean b/Mathlib/LinearAlgebra/Dual/Defs.lean index 0323991b305053..8ce80686fc9861 100644 --- a/Mathlib/LinearAlgebra/Dual/Defs.lean +++ b/Mathlib/LinearAlgebra/Dual/Defs.lean @@ -458,7 +458,7 @@ theorem iSup_dualAnnihilator_le_iInf {ι : Sort*} (U : ι → Submodule R M) : lemma coe_dualAnnihilator_span (s : Set M) : ((span R s).dualAnnihilator : Set (Module.Dual R M)) = {f | s ⊆ LinearMap.ker f} := by ext f - simp only [SetLike.mem_coe, mem_dualAnnihilator, Set.mem_setOf_eq, ← LinearMap.mem_ker] + simp only [SetLike.mem_coe, mem_dualAnnihilator, Set.mem_ofPred_eq, ← LinearMap.mem_ker] exact span_le @[simp] @@ -466,7 +466,7 @@ lemma coe_dualCoannihilator_span (s : Set (Module.Dual R M)) : ((span R s).dualCoannihilator : Set M) = {x | ∀ f ∈ s, f x = 0} := by ext x have (φ : _) : x ∈ LinearMap.ker φ ↔ φ ∈ LinearMap.ker (Module.Dual.eval R M x) := by simp - simp only [SetLike.mem_coe, mem_dualCoannihilator, Set.mem_setOf_eq, ← LinearMap.mem_ker, this] + simp only [SetLike.mem_coe, mem_dualCoannihilator, Set.mem_ofPred_eq, ← LinearMap.mem_ker, this] exact span_le end Submodule diff --git a/Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean b/Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean index e3e6ed43a718f9..9b2a8f34273366 100644 --- a/Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean +++ b/Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean @@ -97,12 +97,10 @@ theorem hasEigenvalue_iff_isRoot : f.HasEigenvalue μ ↔ (minpoly R f).IsRoot variable (f) -lemma finite_hasEigenvalue : Set.Finite f.HasEigenvalue := by +lemma finite_hasEigenvalue : Set.Finite {μ | f.HasEigenvalue μ} := by have h : minpoly R f ≠ 0 := minpoly.ne_zero (Algebra.IsIntegral.isIntegral (R := R) f) - convert! (minpoly R f).rootSet_finite R - ext μ - change f.HasEigenvalue μ ↔ _ - rw [hasEigenvalue_iff_isRoot, mem_rootSet_of_ne h, IsRoot, coe_aeval_eq_eval] + refine ((minpoly R f).rootSet_finite R).subset ?_ + simp [Set.subset_def, hasEigenvalue_iff_isRoot, mem_rootSet, h] /-- An endomorphism of a finite-dimensional vector space has finitely many eigenvalues. -/ noncomputable instance : Fintype f.Eigenvalues := @@ -140,8 +138,8 @@ section FiniteSpectrum theorem Module.End.finite_spectrum {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] [FiniteDimensional K V] (f : Module.End K V) : Set.Finite (spectrum K f) := by - convert! f.finite_hasEigenvalue - ext f x + convert! f.finite_hasEigenvalue using 1 + ext x exact Module.End.hasEigenvalue_iff_mem_spectrum.symm variable {n R : Type*} [Field R] [Fintype n] [DecidableEq n] diff --git a/Mathlib/LinearAlgebra/ExteriorPower/Basic.lean b/Mathlib/LinearAlgebra/ExteriorPower/Basic.lean index ee7293cc18b41c..5b144500c0f91a 100644 --- a/Mathlib/LinearAlgebra/ExteriorPower/Basic.lean +++ b/Mathlib/LinearAlgebra/ExteriorPower/Basic.lean @@ -95,7 +95,7 @@ lemma ιMulti_span_fixedDegree_of_span_eq_top {s : Set M} (hs : span R s = ⊤) rintro x hx obtain ⟨f, rfl⟩ := Set.mem_pow.mp hx refine mem_span_of_mem ⟨ExteriorAlgebra.ιInv ∘ Subtype.val ∘ f, ?_, ?_⟩ - · rw [Set.mem_setOf_eq, Set.range_comp, Set.image_subset_iff] + · rw [Set.mem_ofPred_eq, Set.range_comp, Set.image_subset_iff] apply Subset.trans ?_ (s.image_subset_preimage_of_inverse ExteriorAlgebra.ι_leftInverse) grind · rw [ExteriorAlgebra.ιMulti_apply] @@ -372,7 +372,7 @@ lemma ιMulti_family_span_fixedDegree_of_span {I : Type*} [LinearOrder I] {v : I exact Submodule.coe_mem _ · rw [← ιMulti_span_fixedDegree_of_span_eq_top R n M hv, Submodule.span_le] rintro - ⟨f, ⟨f_range, rfl⟩⟩ - rw [Set.mem_setOf] at f_range + rw [Set.mem_ofPred] at f_range obtain ⟨α, rfl⟩ := Set.range_subset_range_iff_exists_comp.mp f_range exact ιMulti_family_span_fixedDegree_aux R v α diff --git a/Mathlib/LinearAlgebra/Finsupp/LinearCombination.lean b/Mathlib/LinearAlgebra/Finsupp/LinearCombination.lean index 925148ef6dc70f..9b386cc234870f 100644 --- a/Mathlib/LinearAlgebra/Finsupp/LinearCombination.lean +++ b/Mathlib/LinearAlgebra/Finsupp/LinearCombination.lean @@ -170,7 +170,7 @@ theorem linearCombination_equivMapDomain (f : α ≃ α') (l : α →₀ R) : direction -/ theorem span_eq_range_linearCombination (s : Set M) : span R s = LinearMap.range (linearCombination R ((↑) : s → M)) := by - rw [range_linearCombination, Subtype.range_coe_subtype, Set.setOf_mem_eq] + rw [range_linearCombination, Subtype.range_coe_subtype, Set.ofPred_mem_eq] theorem mem_span_iff_linearCombination (s : Set M) (x : M) : x ∈ span R s ↔ ∃ l : s →₀ R, linearCombination R (↑) l = x := @@ -514,7 +514,7 @@ lemma Submodule.span_eq_iUnion_nat (s : Set M) : (Submodule.span R s : Set M) = ⋃ (n : ℕ), (fun (f : Fin n → (R × M)) ↦ ∑ i, (f i).1 • (f i).2) '' ({f | ∀ i, (f i).2 ∈ s}) := by ext m - simp only [SetLike.mem_coe, mem_iUnion, mem_image, mem_setOf_eq, mem_span_set'] + simp only [SetLike.mem_coe, mem_iUnion, mem_image, mem_ofPred_eq, mem_span_set'] refine exists_congr (fun n ↦ ⟨?_, ?_⟩) · rintro ⟨f, g, rfl⟩ exact ⟨fun i ↦ (f i, g i), fun i ↦ (g i).2, rfl⟩ diff --git a/Mathlib/LinearAlgebra/Finsupp/Supported.lean b/Mathlib/LinearAlgebra/Finsupp/Supported.lean index a774d2ba9954e7..c76d219fb33628 100644 --- a/Mathlib/LinearAlgebra/Finsupp/Supported.lean +++ b/Mathlib/LinearAlgebra/Finsupp/Supported.lean @@ -48,7 +48,7 @@ def supported (s : Set α) : Submodule R (α →₀ M) where refine Subset.trans (Subset.trans (Finset.coe_subset.2 support_add) ?_) (union_subset hp hq) rw [Finset.coe_union] zero_mem' := by - simp only [subset_def, Finset.mem_coe, Set.mem_setOf_eq, mem_support_iff, zero_apply] + simp only [subset_def, Finset.mem_coe, Set.mem_ofPred_eq, mem_support_iff, zero_apply] intro h ha exact (ha rfl).elim smul_mem' _ _ hp := Subset.trans (Finset.coe_subset.2 support_smul) hp diff --git a/Mathlib/LinearAlgebra/LinearIndependent/Defs.lean b/Mathlib/LinearAlgebra/LinearIndependent/Defs.lean index 057bfa60361098..2ea6b9332e7b87 100644 --- a/Mathlib/LinearAlgebra/LinearIndependent/Defs.lean +++ b/Mathlib/LinearAlgebra/LinearIndependent/Defs.lean @@ -841,7 +841,7 @@ lemma linearIndepOn_iff' : LinearIndepOn R v s ↔ ∀ (t : Finset ι) (g : ι refine ⟨fun h t g hts h0 i hit ↦ ?_, fun h t g h0 i hit ↦ ?_⟩ · refine h (t.preimage _ Subtype.val_injective.injOn) (fun i ↦ g i) ?_ ⟨i, hts hit⟩ (by simpa) rwa [t.sum_preimage ((↑) : s → ι) Subtype.val_injective.injOn (fun i ↦ g i • v i)] - simp only [Subtype.range_coe_subtype, setOf_mem_eq] + simp only [Subtype.range_coe_subtype, ofPred_mem_eq] exact fun x hxt hxs ↦ (hxs (hts hxt)) |>.elim replace h : ∀ i (hi : i ∈ s), ⟨i, hi⟩ ∈ t → ∀ (h : i ∈ s), g ⟨i, h⟩ = 0 := by simpa [h0] using h (t.image (↑)) (fun i ↦ if hi : i ∈ s then g ⟨i, hi⟩ else 0) diff --git a/Mathlib/LinearAlgebra/Matrix/Diagonal.lean b/Mathlib/LinearAlgebra/Matrix/Diagonal.lean index f93a73bf8be827..af387a452e16ec 100644 --- a/Mathlib/LinearAlgebra/Matrix/Diagonal.lean +++ b/Mathlib/LinearAlgebra/Matrix/Diagonal.lean @@ -53,20 +53,22 @@ section Semifield variable {m : Type*} [Fintype m] {K : Type u} [Semifield K] -- maybe try to relax the universe constraint +set_option maxHeartbeats 800000 in +-- The `simp only [← this, ...]` rewrite needs heavy `Set`/subtype defeq since `Set` became a +-- structure. theorem ker_diagonal_toLin' [DecidableEq m] (w : m → K) : ker (toLin' (diagonal w)) = ⨆ i ∈ { i | w i = 0 }, LinearMap.range (LinearMap.single K (fun _ => K) i) := by rw [← comap_bot, ← iInf_ker_proj, comap_iInf] have := fun i : m => ker_comp (toLin' (diagonal w)) (proj i) simp only [← this, proj_diagonal, ker_smul'] - have : univ ⊆ { i : m | w i = 0 } ∪ { i : m | w i = 0 }ᶜ := by rw [Set.union_compl_self] - exact (iSup_range_single_eq_iInf_ker_proj K (fun _ : m => K) disjoint_compl_right this - (Set.toFinite _)).symm + exact (iSup_range_single_eq_iInf_ker_proj K (fun _ : m => K) isCompl_compl + (Set.toFinite {i : m | w i = 0})).symm theorem range_diagonal [DecidableEq m] (w : m → K) : LinearMap.range (toLin' (diagonal w)) = ⨆ i ∈ { i | w i ≠ 0 }, LinearMap.range (LinearMap.single K (fun _ => K) i) := by - dsimp only [mem_setOf_eq] + dsimp only [mem_ofPred_eq] rw [← Submodule.map_top, ← iSup_range_single, Submodule.map_iSup] congr; funext i rw [← LinearMap.range_comp, diagonal_comp_single, ← range_smul'] @@ -83,10 +85,10 @@ variable {m : Type*} [Fintype m] {K : Type u} [Field K] theorem rank_diagonal [DecidableEq m] [DecidableEq K] (w : m → K) : LinearMap.rank (toLin' (diagonal w)) = Fintype.card { i // w i ≠ 0 } := by - have hu : univ ⊆ { i : m | w i = 0 }ᶜ ∪ { i : m | w i = 0 } := by rw [Set.compl_union_self] - have hd : Disjoint { i : m | w i ≠ 0 } { i : m | w i = 0 } := disjoint_compl_left - have B₁ := iSup_range_single_eq_iInf_ker_proj K (fun _ : m => K) hd hu (Set.toFinite _) - have B₂ := iInfKerProjEquiv K (fun _ ↦ K) hd hu + have hIJ : IsCompl { i : m | w i ≠ 0 } { i : m | w i = 0 } := + (isCompl_compl (x := { i : m | w i = 0 })).symm + have B₁ := iSup_range_single_eq_iInf_ker_proj K (fun _ : m => K) hIJ (Set.toFinite _) + have B₂ := iInfKerProjEquiv K (fun _ ↦ K) hIJ.disjoint hIJ.codisjoint.top_le rw [LinearMap.rank, range_diagonal, B₁, ← @rank_fun' K] apply LinearEquiv.rank_eq apply B₂ diff --git a/Mathlib/LinearAlgebra/Matrix/FixedDetMatrices.lean b/Mathlib/LinearAlgebra/Matrix/FixedDetMatrices.lean index 3eae7751699643..8b2967c96805c3 100644 --- a/Mathlib/LinearAlgebra/Matrix/FixedDetMatrices.lean +++ b/Mathlib/LinearAlgebra/Matrix/FixedDetMatrices.lean @@ -188,7 +188,7 @@ lemma reduce_mem_reps {m : ℤ} (hm : m ≠ 0) (A : Δ m) : reduce A ∈ reps m suffices A.1 1 0 = 0 ∧ n * A.1 1 0 < A.1 0 0 ∧ n * A.1 1 1 ≤ A.1 0 1 ∧ |A.1 0 1 + -(n * A.1 1 1)| < |A.1 1 1| by simpa only [reps, Fin.isValue, cons_mul, Nat.succ_eq_add_one, Nat.reduceAdd, empty_mul, - Equiv.symm_apply_apply, Set.mem_setOf_eq, of_apply, cons_val', vecMul, cons_dotProduct, + Equiv.symm_apply_apply, Set.mem_ofPred_eq, of_apply, cons_val', vecMul, cons_dotProduct, vecHead, one_mul, vecTail, Function.comp_apply, Fin.succ_zero_eq_one, neg_mul, dotProduct_of_isEmpty, add_zero, zero_mul, zero_add, empty_val', cons_val_fin_one, cons_val_one, cons_val_zero, lt_add_neg_iff_add_lt, le_add_neg_iff_add_le] @@ -197,7 +197,7 @@ lemma reduce_mem_reps {m : ℤ} (hm : m ≠ 0) (A : Δ m) : reduce A ∈ reps m · simp only [reps, Fin.isValue, reduce_of_not_pos h h1, Int.ediv_neg, neg_neg, smul_def, ← mul_assoc, S_mul_S_eq, neg_mul, one_mul, coe_T_zpow, mul_neg, cons_mul, Nat.succ_eq_add_one, Nat.reduceAdd, empty_mul, Equiv.symm_apply_apply, neg_of, neg_cons, neg_empty, - Set.mem_setOf_eq, of_apply, cons_val', Pi.neg_apply, vecMul, cons_dotProduct, vecHead, + Set.mem_ofPred_eq, of_apply, cons_val', Pi.neg_apply, vecMul, cons_dotProduct, vecHead, vecTail, Function.comp_apply, Fin.succ_zero_eq_one, h, mul_zero, dotProduct_of_isEmpty, add_zero, zero_mul, neg_zero, empty_val', cons_val_fin_one, cons_val_one, cons_val_zero, lt_neg, neg_add_rev, zero_add, le_add_neg_iff_add_le, ← le_neg, abs_neg, true_and] diff --git a/Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean b/Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean index 1ba86b265e8534..60ce5f20c1043c 100644 --- a/Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean +++ b/Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean @@ -276,7 +276,7 @@ def center_equiv_rootsOfUnity' (i : n) : invFun a := ⟨⟨a • (1 : Matrix n n R), by aesop⟩, Subgroup.mem_center_iff.mpr fun B ↦ Subtype.val_injective <| by simp [coe_mul]⟩ left_inv A := by - refine SetCoe.ext <| SetCoe.ext ?_ + refine Subtype.ext <| Subtype.ext ?_ obtain ⟨r, _, hr⟩ := mem_center_iff.mp A.property simpa [← hr, Submonoid.smul_def, Units.smul_def] using! smul_one_eq_diagonal r right_inv a := by diff --git a/Mathlib/LinearAlgebra/Matrix/Stochastic.lean b/Mathlib/LinearAlgebra/Matrix/Stochastic.lean index 82360409824ceb..f6968859068b90 100644 --- a/Mathlib/LinearAlgebra/Matrix/Stochastic.lean +++ b/Mathlib/LinearAlgebra/Matrix/Stochastic.lean @@ -130,7 +130,7 @@ def colStochastic (R n : Type*) [Fintype n] [DecidableEq n] [Semiring R] [Partia [IsOrderedRing R] : Submonoid (Matrix n n R) where carrier := {M | (∀ i j, 0 ≤ M i j) ∧ 1 ᵥ* M = 1 } mul_mem' {M N} hM hN := by - refine Set.mem_sep ?_ ?_ + refine ⟨?_, ?_⟩ · intro i j apply Finset.sum_nonneg grind [mul_nonneg] diff --git a/Mathlib/LinearAlgebra/PerfectPairing/Restrict.lean b/Mathlib/LinearAlgebra/PerfectPairing/Restrict.lean index 45a4ac8ce887f9..4d6658bd865b23 100644 --- a/Mathlib/LinearAlgebra/PerfectPairing/Restrict.lean +++ b/Mathlib/LinearAlgebra/PerfectPairing/Restrict.lean @@ -165,7 +165,7 @@ lemma exists_basis_basis_of_span_eq_top_of_mem_algebraMap have : IsReflexive L N := .of_isPerfPair p.flip obtain ⟨v, hv₁, hv₂, hv₃⟩ := exists_linearIndependent L (M' : Set M) rw [hM] at hv₂ - let b : Basis _ L M := Basis.mk hv₃ <| by rw [← hv₂, Subtype.range_coe_subtype, Set.setOf_mem_eq] + let b : Basis _ L M := Basis.mk hv₃ <| by rw [← hv₂, Subtype.range_coe_subtype, Set.ofPred_mem_eq] have : Fintype v := Set.Finite.fintype <| Module.Finite.finite_basis b set v' : v → M' := fun i ↦ ⟨i, hv₁ (Subtype.coe_prop i)⟩ have hv' : LinearIndependent K v' := by @@ -185,7 +185,8 @@ lemma exists_basis_basis_of_span_eq_top_of_mem_algebraMap refine le_antisymm (Submodule.span_le.mpr hv₁) fun m hm ↦ ?_ obtain ⟨w, hw₁, hw₂, hw₃⟩ := exists_linearIndependent L (N' : Set N) rw [hN] at hw₂ - let bN : Basis _ L N := Basis.mk hw₃ <| by rw [← hw₂, Subtype.range_coe_subtype, Set.setOf_mem_eq] + let bN : Basis _ L N := Basis.mk hw₃ <| by + rw [← hw₂, Subtype.range_coe_subtype, Set.ofPred_mem_eq] have : Fintype w := Set.Finite.fintype <| Module.Finite.finite_basis bN have e : v ≃ w := Fintype.equivOfCardEq <| by rw [← Module.finrank_eq_card_basis b, ← Module.finrank_eq_card_basis bN, Module.finrank_of_isPerfPair p] diff --git a/Mathlib/LinearAlgebra/Pi.lean b/Mathlib/LinearAlgebra/Pi.lean index a431fec8662b6e..94ca2feada55d2 100644 --- a/Mathlib/LinearAlgebra/Pi.lean +++ b/Mathlib/LinearAlgebra/Pi.lean @@ -190,36 +190,28 @@ theorem iSup_range_single_le_iInf_ker_proj (I J : Set ι) (h : Disjoint I J) : rintro rfl exact h.le_bot ⟨hi, hj⟩ -theorem iInf_ker_proj_le_iSup_range_single {I : Finset ι} {J : Set ι} (hu : Set.univ ⊆ ↑I ∪ J) : - ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) ≤ ⨆ i ∈ I, range (single R φ i) := - SetLike.le_def.2 - (by - intro b hb - simp only [mem_iInf, mem_ker, proj_apply] at hb - rw [← - show (∑ i ∈ I, Pi.single i (b i)) = b by - ext i - rw [Finset.sum_apply, ← Pi.single_eq_same i (b i)] - refine Finset.sum_eq_single i (fun j _ ne => Pi.single_eq_of_ne ne.symm _) ?_ - intro hiI - rw [Pi.single_eq_same] - exact hb _ ((hu trivial).resolve_left hiI)] - exact sum_mem_biSup fun i _ => mem_range_self (single R φ i) (b i)) - -theorem iSup_range_single_eq_iInf_ker_proj {I J : Set ι} (hd : Disjoint I J) - (hu : Set.univ ⊆ I ∪ J) (hI : Set.Finite I) : - ⨆ i ∈ I, range (single R φ i) = ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) := by - refine le_antisymm (iSup_range_single_le_iInf_ker_proj _ _ _ _ hd) ?_ - have : Set.univ ⊆ ↑hI.toFinset ∪ J := by rwa [hI.coe_toFinset] - refine le_trans (iInf_ker_proj_le_iSup_range_single R φ this) (iSup_mono fun i => ?_) - rw [Set.Finite.mem_toFinset] +theorem iInf_ker_proj_le_iSup_range_single {I J : Set ι} (hI : I.Finite) (hIJ : Codisjoint ↑I J) : + ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) ≤ ⨆ i ∈ I, range (single R φ i) := by + lift I to Finset ι using hI + intro b hb + simp only [mem_iInf, mem_ker, proj_apply] at hb + rw [← + show (∑ i ∈ I, Pi.single i (b i)) = b by + ext i + rw [Finset.sum_apply, ← Pi.single_eq_same i (b i)] + refine Finset.sum_eq_single i (fun j _ ne => Pi.single_eq_of_ne ne.symm _) ?_ + intro hiI + rw [Pi.single_eq_same] + exact hb _ ((hIJ.top_le trivial).resolve_left hiI)] + exact sum_mem_biSup fun i _ => mem_range_self (single R φ i) (b i) + +theorem iSup_range_single_eq_iInf_ker_proj {I J : Set ι} (hIJ : IsCompl I J) (hI : I.Finite) : + ⨆ i ∈ I, range (single R φ i) = ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) := + le_antisymm (iSup_range_single_le_iInf_ker_proj _ _ _ _ hIJ.disjoint) <| + iInf_ker_proj_le_iSup_range_single R φ hI hIJ.codisjoint theorem iSup_range_single [Finite ι] : ⨆ i, range (single R φ i) = ⊤ := by - cases nonempty_fintype ι - convert! top_unique (iInf_emptyset.ge.trans <| iInf_ker_proj_le_iSup_range_single R φ _) - · rename_i i - exact ((@iSup_pos _ _ _ fun _ => range <| single R φ i) <| Finset.mem_univ i).symm - · rw [Finset.coe_univ, Set.union_empty] + simpa using iInf_ker_proj_le_iSup_range_single R φ Set.finite_univ isCompl_top_bot.codisjoint theorem disjoint_single_single (I J : Set ι) (h : Disjoint I J) : Disjoint (⨆ i ∈ I, range (single R φ i)) (⨆ i ∈ J, range (single R φ i)) := by diff --git a/Mathlib/LinearAlgebra/PiTensorProduct/Basic.lean b/Mathlib/LinearAlgebra/PiTensorProduct/Basic.lean index 1317cf6074135e..4594d3a055e835 100644 --- a/Mathlib/LinearAlgebra/PiTensorProduct/Basic.lean +++ b/Mathlib/LinearAlgebra/PiTensorProduct/Basic.lean @@ -316,7 +316,7 @@ if and only if `x` is equal to the sum of `a • ⨂ₜ[R] i, m i` over all the -/ lemma mem_lifts_iff (x : ⨂[R] i, s i) (p : FreeAddMonoid (R × Π i, s i)) : p ∈ lifts x ↔ List.sum (List.map (fun x ↦ x.1 • ⨂ₜ[R] i, x.2 i) p.toList) = x := by - simp only [lifts, Set.mem_setOf_eq, FreeAddMonoid.toPiTensorProduct] + simp only [lifts, Set.mem_ofPred_eq, FreeAddMonoid.toPiTensorProduct] /-- Every element of `⨂[R] i, s i` has a lift in `FreeAddMonoid (R × Π i, s i)`. -/ @@ -337,7 +337,7 @@ respectively, then `p + q` lifts `x + y`. -/ lemma lifts_add {x y : ⨂[R] i, s i} {p q : FreeAddMonoid (R × Π i, s i)} (hp : p ∈ lifts x) (hq : q ∈ lifts y) : p + q ∈ lifts (x + y) := by - simp only [lifts, Set.mem_setOf_eq, AddCon.coe_add] + simp only [lifts, Set.mem_ofPred_eq, AddCon.coe_add] rw [hp, hq] /-- If an element `p` of `FreeAddMonoid (R × Π i, s i)` lifts an element `x` of `⨂[R] i, s i`, @@ -492,7 +492,7 @@ theorem map_range_eq_span_tprod : Submodule.span R {t | ∃ (m : Π i, s i), tprod R (fun i ↦ f i (m i)) = t} := by rw [← Submodule.map_top, ← span_tprod_eq_top, Submodule.map_span, ← Set.range_comp] apply congrArg; ext x - simp only [Set.mem_range, comp_apply, map_tprod, Set.mem_setOf_eq] + simp only [Set.mem_range, comp_apply, map_tprod, Set.mem_ofPred_eq] /-- Given submodules `p i ⊆ s i`, this is the natural map: `⨂[R] i, p i → ⨂[R] i, s i`. This is `TensorProduct.mapIncl` for an arbitrary family of modules. diff --git a/Mathlib/LinearAlgebra/Projectivization/PSL/Stabilizer.lean b/Mathlib/LinearAlgebra/Projectivization/PSL/Stabilizer.lean index 2201a9a390797c..f3302b30f7cd12 100644 --- a/Mathlib/LinearAlgebra/Projectivization/PSL/Stabilizer.lean +++ b/Mathlib/LinearAlgebra/Projectivization/PSL/Stabilizer.lean @@ -36,7 +36,7 @@ def Matrix.SpecialLinearGroup.lineStab (L : Submodule F (ι → F)) : carrier := {A | ∀ w : ι → F, A • w - w ∈ L} one_mem' := by simp mul_mem' {A B} hA hB := fun w ↦ by - simp only [Set.mem_setOf_eq, mul_smul] at hA hB ⊢ + simp only [Set.mem_ofPred_eq, mul_smul] at hA hB ⊢ rw [show A • B • w - w = ((A • (B • w) - A • w) - (B • w - w)) + (B • w - w) + (A • w - w) by abel, ← smul_sub] exact add_mem (add_mem (hA _) (hB w)) (hA w) diff --git a/Mathlib/LinearAlgebra/Projectivization/Subspace.lean b/Mathlib/LinearAlgebra/Projectivization/Subspace.lean index bcc33f04603e05..4a872b040637b0 100644 --- a/Mathlib/LinearAlgebra/Projectivization/Subspace.lean +++ b/Mathlib/LinearAlgebra/Projectivization/Subspace.lean @@ -74,19 +74,19 @@ theorem mem_add (T : Subspace K V) (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) (hvw /-- The span of a set of points in a projective space is defined inductively to be the set of points which contains the original set, and contains all points determined by the (nonzero) sum of two nonzero vectors, each of which determine points in the span. -/ -inductive spanCarrier (S : Set (ℙ K V)) : Set (ℙ K V) - | of (x : ℙ K V) (hx : x ∈ S) : spanCarrier S x - | mem_add (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) (hvw : v + w ≠ 0) : - spanCarrier S (Projectivization.mk K v hv) → - spanCarrier S (Projectivization.mk K w hw) → spanCarrier S (Projectivization.mk K (v + w) hvw) +inductive MemSpan (S : Set (ℙ K V)) : ℙ K V → Prop + | of_mem (x : ℙ K V) (hx : x ∈ S) : MemSpan S x + | add (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) (hvw : v + w ≠ 0) : + MemSpan S (Projectivization.mk K v hv) → + MemSpan S (Projectivization.mk K w hw) → MemSpan S (Projectivization.mk K (v + w) hvw) /-- The span of a set of points in projective space is a subspace. -/ def span (S : Set (ℙ K V)) : Subspace K V where - carrier := spanCarrier S - mem_add' v w hv hw hvw := spanCarrier.mem_add v w hv hw hvw + carrier := {x | MemSpan S x} + mem_add' v w hv hw hvw := .add v w hv hw hvw /-- The span of a set of points contains the set of points. -/ -theorem subset_span (S : Set (ℙ K V)) : S ⊆ span S := fun _x hx => spanCarrier.of _ hx +theorem subset_span (S : Set (ℙ K V)) : S ⊆ span S := fun _x hx => .of_mem _ hx /-- The span of a set of points is a Galois insertion between sets of points of a projective space and subspaces of the projective space. -/ @@ -96,8 +96,8 @@ def gi : GaloisInsertion (span : Set (ℙ K V) → Subspace K V) SetLike.coe whe ⟨fun h => le_trans (subset_span _) h, by intro h x hx induction hx with - | of => apply h; assumption - | mem_add => apply B.mem_add; assumption'⟩ + | of_mem => apply h; assumption + | add => apply B.mem_add; assumption'⟩ le_l_u _ := subset_span _ choice_eq _ _ := rfl @@ -226,7 +226,7 @@ def submodule : Projectivization.Subspace K V ≃o Submodule K V where rw [Projectivization.mk_eq_mk_iff'] exact ⟨c, rfl⟩ } invFun s := - { carrier := setOf <| Projectivization.lift (↑· ∈ s) <| by + { carrier := Set.ofPred <| Projectivization.lift (↑· ∈ s) <| by rintro ⟨-, h⟩ ⟨y, -⟩ c rfl exact Iff.eq <| s.smul_mem_iff <| left_ne_zero_of_smul h mem_add' _ _ _ _ _ h₁ h₂ := s.add_mem h₁ h₂ } diff --git a/Mathlib/LinearAlgebra/Reflection.lean b/Mathlib/LinearAlgebra/Reflection.lean index e466bd0d0c813c..fa1d6a6bff53cc 100644 --- a/Mathlib/LinearAlgebra/Reflection.lean +++ b/Mathlib/LinearAlgebra/Reflection.lean @@ -393,7 +393,7 @@ lemma Dual.eq_of_preReflection_mapsTo' [CharZero R] [IsDomain R] [IsTorsionFree intro F hF ⟨y, hy⟩ hy' simp only [Φ'] at hy' ⊢ rw [range_inclusion] at hy' - simp only [SetLike.coe_sort_coe, mem_setOf_eq] at hy' ⊢ + simp only [SetLike.coe_sort_coe, mem_ofPred_eq] at hy' ⊢ rw [range_inclusion] exact hF hy' exact eq_of_preReflection_mapsTo hΦ'₁ hΦ'₂ hf₁ (this hf₂) hg₁ (this hg₂) diff --git a/Mathlib/LinearAlgebra/RootSystem/BaseChange.lean b/Mathlib/LinearAlgebra/RootSystem/BaseChange.lean index b72ee38e87d3ff..5aedafe008d98f 100644 --- a/Mathlib/LinearAlgebra/RootSystem/BaseChange.lean +++ b/Mathlib/LinearAlgebra/RootSystem/BaseChange.lean @@ -33,7 +33,7 @@ extension of scalars. noncomputable section open Set Function -open Submodule (span injective_subtype span subset_span span_setOf_mem_eq_top) +open Submodule (span injective_subtype span subset_span span_setOfPred_mem_eq_top) namespace RootPairing @@ -89,12 +89,12 @@ def restrictScalars' : instance : (P.restrictScalars' K).IsRootSystem where span_root_eq_top := by - rw [← span_setOf_mem_eq_top] + rw [← span_setOfPred_mem_eq_top] congr ext ⟨x, hx⟩ simp [restrictScalars'] span_coroot_eq_top := by - rw [← span_setOf_mem_eq_top] + rw [← span_setOfPred_mem_eq_top] congr ext ⟨x, hx⟩ simp [restrictScalars'] diff --git a/Mathlib/LinearAlgebra/RootSystem/Chain.lean b/Mathlib/LinearAlgebra/RootSystem/Chain.lean index 32e447d5562087..0d44f45a01597d 100644 --- a/Mathlib/LinearAlgebra/RootSystem/Chain.lean +++ b/Mathlib/LinearAlgebra/RootSystem/Chain.lean @@ -42,7 +42,7 @@ variable {P : RootPairing ι R M N} [P.IsCrystallographic] {i j : ι} /-- Note that it is often more convenient to use `RootPairing.root_add_zsmul_mem_range_iff` than to invoke this lemma directly. -/ -lemma setOf_root_add_zsmul_eq_Icc_of_linearIndependent +lemma setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent (h : LinearIndependent R ![P.root i, P.root j]) : ∃ᵉ (q ≤ 0) (p ≥ 0), {z : ℤ | P.root j + z • P.root i ∈ range P.root} = Icc q p := by replace h := LinearIndependent.pair_iff.mp <| h.restrict_scalars' ℤ @@ -63,7 +63,7 @@ lemma setOf_root_add_zsmul_eq_Icc_of_linearIndependent have hki_notMem : P.root k + P.root i ∉ range P.root := by replace hk : P.root k + P.root i = P.root j + (r + 1) • P.root i := by rw [hk]; module replace contra : r + 1 ∉ S := hrs.notMem_of_mem_left <| by simp [contra] - simpa only [hk, S_def, mem_setOf_eq, S] using contra + simpa only [hk, S_def, mem_ofPred_eq, S] using contra have hki_ne : P.root k ≠ -P.root i := by rw [hk] contrapose! h @@ -72,7 +72,7 @@ lemma setOf_root_add_zsmul_eq_Icc_of_linearIndependent have hli_notMem : P.root l - P.root i ∉ range P.root := by replace hl : P.root l - P.root i = P.root j + (s - 1) • P.root i := by rw [hl]; module replace contra : s - 1 ∉ S := hrs.notMem_of_mem_left <| by simp [lt_sub_right_of_add_lt contra] - simpa only [hl, S_def, mem_setOf_eq, S] using contra + simpa only [hl, S_def, mem_ofPred_eq, S] using contra have hli_ne : P.root l ≠ P.root i := by rw [hl] contrapose! h @@ -96,6 +96,10 @@ lemma setOf_root_add_zsmul_eq_Icc_of_linearIndependent simp lia +@[deprecated (since := "2026-07-09")] +alias setOf_root_add_zsmul_eq_Icc_of_linearIndependent := + setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent + variable (i j) open scoped Classical in @@ -105,7 +109,7 @@ open scoped Classical in In the absence of linear independence, it takes a junk value. -/ def chainTopCoeff : ℕ := if h : LinearIndependent R ![P.root i, P.root j] - then (P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose.toNat + then (P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose.toNat else 0 open scoped Classical in @@ -115,7 +119,7 @@ open scoped Classical in In the absence of linear independence, it takes a junk value. -/ def chainBotCoeff : ℕ := if h : LinearIndependent R ![P.root i, P.root j] - then (-(P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose).toNat + then (-(P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose).toNat else 0 variable {i j} @@ -135,26 +139,26 @@ lemma root_add_nsmul_mem_range_iff_le_chainTopCoeff {n : ℕ} : P.root j + n • P.root i ∈ range P.root ↔ n ≤ P.chainTopCoeff i j := by set S : Set ℤ := {z | P.root j + z • P.root i ∈ range P.root} with S_def suffices (n : ℤ) ∈ S ↔ n ≤ P.chainTopCoeff i j by - simpa only [S_def, mem_setOf_eq, natCast_zsmul] using this + simpa only [S_def, mem_ofPred_eq, natCast_zsmul] using this have aux : P.chainTopCoeff i j = - (P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose.toNat := by + (P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose.toNat := by simp [chainTopCoeff, h] obtain ⟨hp, h₂ : S = _⟩ := - (P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose_spec + (P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.2.choose_spec rw [aux, h₂, mem_Icc] - have := (P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.1 + have := (P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec.1 lia lemma root_sub_nsmul_mem_range_iff_le_chainBotCoeff {n : ℕ} : P.root j - n • P.root i ∈ range P.root ↔ n ≤ P.chainBotCoeff i j := by set S : Set ℤ := {z | P.root j + z • P.root i ∈ range P.root} with S_def suffices -(n : ℤ) ∈ S ↔ n ≤ P.chainBotCoeff i j by - simpa only [S_def, mem_setOf_eq, neg_smul, natCast_zsmul, ← sub_eq_add_neg] using this + simpa only [S_def, mem_ofPred_eq, neg_smul, natCast_zsmul, ← sub_eq_add_neg] using this have aux : P.chainBotCoeff i j = - (-(P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose).toNat := by + (-(P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose).toNat := by simp [chainBotCoeff, h] obtain ⟨hq, p, hp, h₂ : S = _⟩ := - (P.setOf_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec + (P.setOfPred_root_add_zsmul_eq_Icc_of_linearIndependent h).choose_spec rw [aux, h₂, mem_Icc] lia @@ -192,15 +196,21 @@ lemma root_sub_zsmul_mem_range_iff {z : ℤ} : rw [sub_eq_add_neg, ← neg_smul, P.root_add_zsmul_mem_range_iff h, mem_Icc, mem_Icc] grind -lemma setOf_root_add_zsmul_mem_eq_Icc : +lemma setOfPred_root_add_zsmul_mem_eq_Icc : {k : ℤ | P.root j + k • P.root i ∈ range P.root} = Icc (-P.chainBotCoeff i j : ℤ) (P.chainTopCoeff i j) := by ext; simp [← P.root_add_zsmul_mem_range_iff h] -lemma setOf_root_sub_zsmul_mem_eq_Icc : +@[deprecated (since := "2026-07-09")] +alias setOf_root_add_zsmul_mem_eq_Icc := setOfPred_root_add_zsmul_mem_eq_Icc + +lemma setOfPred_root_sub_zsmul_mem_eq_Icc : {k : ℤ | P.root j - k • P.root i ∈ range P.root} = Icc (-P.chainTopCoeff i j : ℤ) (P.chainBotCoeff i j) := by - ext; rw [← root_sub_zsmul_mem_range_iff h, mem_setOf_eq] + ext; rw [← root_sub_zsmul_mem_range_iff h, mem_ofPred_eq] + +@[deprecated (since := "2026-07-09")] +alias setOf_root_sub_zsmul_mem_eq_Icc := setOfPred_root_sub_zsmul_mem_eq_Icc lemma chainTopCoeff_eq_sSup : P.chainTopCoeff i j = sSup {k | P.root j + k • P.root i ∈ range P.root} := by @@ -212,12 +222,12 @@ lemma chainBotCoeff_eq_sSup : lemma coe_chainTopCoeff_eq_sSup : P.chainTopCoeff i j = sSup {k : ℤ | P.root j + k • P.root i ∈ range P.root} := by - rw [setOf_root_add_zsmul_mem_eq_Icc h] + rw [setOfPred_root_add_zsmul_mem_eq_Icc h] simp lemma coe_chainBotCoeff_eq_sSup : P.chainBotCoeff i j = sSup {k : ℤ | P.root j - k • P.root i ∈ range P.root} := by - rw [setOf_root_sub_zsmul_mem_eq_Icc h] + rw [setOfPred_root_sub_zsmul_mem_eq_Icc h] simp omit h @@ -304,7 +314,7 @@ lemma chainBotCoeff_eq_zero_iff : have : P.chainBotCoeff i j = 0 ↔ Iic (P.chainBotCoeff i j) = {0} := by simpa [Set.ext_iff, mem_Iic, mem_singleton_iff] using ⟨fun h ↦ by simp [h], fun h ↦ by rw [← h]⟩ simp only [h, not_true_eq_false, false_or, this, Iic_chainBotCoeff_eq h, Set.ext_iff, - mem_setOf_eq, mem_singleton_iff] + mem_ofPred_eq, mem_singleton_iff] refine ⟨fun h' ↦ by simpa using h' 1, fun h' n ↦ ⟨fun h'' ↦ ?_, fun h'' ↦ by simp [h'']⟩⟩ replace h' : 1 ∉ {k | P.root j - k • P.root i ∈ range P.root} := by simpa using h' rw [← Iic_chainBotCoeff_eq h, mem_Iic, not_le, Nat.lt_one_iff] at h' @@ -329,7 +339,7 @@ lemma chainBotCoeff_of_add {k : ι} (hk : P.root k = P.root j + P.root i) : OrderIso.addRight 1 '' {n | P.root j - n • P.root i ∈ range P.root} := by simp [this, sub_eq_add_neg] have bdd : BddAbove {z : ℤ | P.root j - z • P.root i ∈ range P.root} := by - rw [setOf_root_sub_zsmul_mem_eq_Icc h] + rw [setOfPred_root_sub_zsmul_mem_eq_Icc h] exact bddAbove_Icc rw [this, ← OrderIso.map_csSup' _ ⟨0, by simp⟩ bdd, OrderIso.addRight_apply] @@ -433,10 +443,10 @@ lemma chainCoeff_chainTopIdx_aux : have hS₁₂ : S₂ = (fun z ↦ (-P.chainTopCoeff i j : ℤ) + z) '' S₁ := by ext; simp [S₁_def, S₂_def, root_chainTopIdx, add_smul, add_assoc, natCast_zsmul] have hS₁ : S₁ = Icc (-P.chainBotCoeff i j : ℤ) (P.chainTopCoeff i j) := by - ext; rw [S₁_def, mem_setOf_eq, root_add_zsmul_mem_range_iff h] + ext; rw [S₁_def, mem_ofPred_eq, root_add_zsmul_mem_range_iff h] have hS₂ : S₂ = Icc (-P.chainBotCoeff i (P.chainTopIdx i j) : ℤ) (P.chainTopCoeff i (P.chainTopIdx i j)) := by - ext; rw [S₂_def, mem_setOf_eq, root_add_zsmul_mem_range_iff h'] + ext; rw [S₂_def, mem_ofPred_eq, root_add_zsmul_mem_range_iff h'] rw [hS₁, hS₂, image_const_add_Icc, neg_add_cancel, Icc_eq_Icc_iff (by simp), neg_eq_iff_eq_neg, neg_add_rev, neg_neg, neg_neg] at hS₁₂ norm_cast at hS₁₂ diff --git a/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean b/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean index e557a7f8d6b6e1..19b5962d0a143a 100644 --- a/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean +++ b/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean @@ -587,7 +587,7 @@ lemma card_index_eq_twelve : rw [← this] exact Nat.card_congr <| indexEquivAllRoots P -lemma setOf_index_eq_univ : +lemma setOfPred_index_eq_univ : letI _i := P.indexNeg { long P, -long P, short P, -short P, @@ -597,6 +597,8 @@ lemma setOf_index_eq_univ : threeShortAddTwoLong P, -threeShortAddTwoLong P } = univ := eq_univ_iff_forall.mpr fun i ↦ by simpa using mem_allRoots P i +@[deprecated (since := "2026-07-09")] alias setOf_index_eq_univ := setOfPred_index_eq_univ + end IsIrreducible end EmbeddedG2 diff --git a/Mathlib/LinearAlgebra/RootSystem/GeckConstruction/Semisimple.lean b/Mathlib/LinearAlgebra/RootSystem/GeckConstruction/Semisimple.lean index 80afc55a86c57b..f27a0ba28ee4ae 100644 --- a/Mathlib/LinearAlgebra/RootSystem/GeckConstruction/Semisimple.lean +++ b/Mathlib/LinearAlgebra/RootSystem/GeckConstruction/Semisimple.lean @@ -263,7 +263,8 @@ private lemma instIsIrreducible_aux₁ (U : LieSubmodule K H (b.support ⊕ ι contrapose! hU refine le_trans ?_ (map_genWeightSpace_le (f := U.incl)) suffices genWeightSpace U (0 : H → K) = ⊤ by simp [this] - have : ⨆ (χ : H → K), ⨆ (_ : χ ≠ 0), (⊥ : LieSubmodule K H U) = ⊥ := biSup_const ⟨1, one_ne_zero⟩ + have : ⨆ (χ : H → K), ⨆ (_ : χ ≠ 0), (⊥ : LieSubmodule K H U) = ⊥ := + biSup_const (s := {χ : H → K | χ ≠ 0}) ⟨1, one_ne_zero⟩ rw [← iSup_genWeightSpace_eq_top K H U, iSup_split_single _ 0, biSup_congr hU, this, sup_bot_eq] omit [P.IsRootSystem] in diff --git a/Mathlib/LinearAlgebra/RootSystem/Irreducible.lean b/Mathlib/LinearAlgebra/RootSystem/Irreducible.lean index db9d53ee6aad0c..4b907386c113de 100644 --- a/Mathlib/LinearAlgebra/RootSystem/Irreducible.lean +++ b/Mathlib/LinearAlgebra/RootSystem/Irreducible.lean @@ -219,7 +219,7 @@ lemma exist_set_root_not_disjoint_and_le_ker_coroot'_of_invtSubmodule (hq : ∀ i, q ∈ invtSubmodule (P.reflection i)) : ∃ Φ : Set ι, (∀ i ∈ Φ, ¬ Disjoint q (R ∙ P.root i)) ∧ (∀ i ∉ Φ, q ≤ ker (P.coroot' i)) := by refine ⟨{i | ¬ Disjoint q (R ∙ P.root i)}, by simp, fun i hi ↦ ?_⟩ - simp only [mem_setOf_eq, not_not] at hi + simp only [mem_ofPred_eq, not_not] at hi rw [← Submodule.mem_invtSubmodule_reflection_iff (by simp) hi] exact hq i diff --git a/Mathlib/LinearAlgebra/RootSystem/OfBilinear.lean b/Mathlib/LinearAlgebra/RootSystem/OfBilinear.lean index e2474956fc6557..0aeefbf98cd708 100644 --- a/Mathlib/LinearAlgebra/RootSystem/OfBilinear.lean +++ b/Mathlib/LinearAlgebra/RootSystem/OfBilinear.lean @@ -124,7 +124,7 @@ def ofBilinear [IsReflexive R M] (B : M →ₗ[R] M →ₗ[R] R) (hNB : LinearMa { toFun := fun x => IsReflective.coroot B x.2 inj' := by intro x y hxy - simp only [mem_setOf_eq] at hxy -- x* = y* + simp only [mem_ofPred_eq] at hxy -- x* = y* have h1 : ∀ z, IsReflective.coroot B x.2 z = IsReflective.coroot B y.2 z := fun z => congrFun (congrArg DFunLike.coe hxy) z have h2x : ∀ z, B x x * IsReflective.coroot B x.2 z = @@ -162,19 +162,19 @@ def ofBilinear [IsReflexive R M] (B : M →ₗ[R] M →ₗ[R] R) (hNB : LinearMa intro y simp [involutive_reflection (coroot_apply_self B x.2) y] } reflectionPerm_root := by - simp [coe_setOf, Module.reflection_apply] + simp [coe_ofPred, Module.reflection_apply] reflectionPerm_coroot x y := by - simp only [coe_setOf, mem_setOf_eq, Embedding.coeFn_mk, Embedding.subtype_apply, + simp only [coe_ofPred, mem_ofPred_eq, Embedding.coeFn_mk, Embedding.subtype_apply, Dual.eval_apply, Equiv.coe_fn_mk] ext z simp only [sub_apply, smul_apply, smul_eq_mul] refine y.2.1.1 ?_ - simp only [mem_setOf_eq, mul_sub, apply_self_mul_coroot_apply B y.2, ← mul_assoc] + simp only [mem_ofPred_eq, mul_sub, apply_self_mul_coroot_apply B y.2, ← mul_assoc] rw [← isOrthogonal_reflection B x.2 hSB y y, apply_self_mul_coroot_apply, ← hSB.eq z, ← hSB.eq z, RingHom.id_apply, RingHom.id_apply, Module.reflection_apply, map_sub, mul_sub, sub_eq_sub_iff_comm, sub_left_inj] refine x.2.1.1 ?_ - simp only [mem_setOf_eq, map_smul, smul_eq_mul] + simp only [mem_ofPred_eq, map_smul, smul_eq_mul] rw [← mul_assoc _ _ (B z x), ← mul_assoc _ _ (B z x), mul_left_comm, apply_self_mul_coroot_apply B x.2, mul_left_comm (B x x), apply_self_mul_coroot_apply B x.2, ← hSB.eq x y, RingHom.id_apply, ← hSB.eq x z, RingHom.id_apply] diff --git a/Mathlib/LinearAlgebra/Span/Defs.lean b/Mathlib/LinearAlgebra/Span/Defs.lean index 311ccc1120f7f8..04254e345acbd4 100644 --- a/Mathlib/LinearAlgebra/Span/Defs.lean +++ b/Mathlib/LinearAlgebra/Span/Defs.lean @@ -214,10 +214,12 @@ theorem span_span_coe_preimage : span R (((↑) : span R s → M) ⁻¹' s) = (fun _ _ _ ↦ smul_mem _ _) hx' @[simp] -lemma span_setOf_mem_eq_top : +lemma span_setOfPred_mem_eq_top : span R {x : span R s | (x : M) ∈ s} = ⊤ := span_span_coe_preimage +@[deprecated (since := "2026-07-09")] alias span_setOf_mem_eq_top := span_setOfPred_mem_eq_top + theorem span_nat_eq_addSubmonoidClosure (s : Set M) : (span ℕ s).toAddSubmonoid = AddSubmonoid.closure s := by refine Eq.symm (AddSubmonoid.closure_eq_of_le subset_span ?_) diff --git a/Mathlib/LinearAlgebra/StdBasis.lean b/Mathlib/LinearAlgebra/StdBasis.lean index 843555ee5da950..80f9735cd6e80a 100644 --- a/Mathlib/LinearAlgebra/StdBasis.lean +++ b/Mathlib/LinearAlgebra/StdBasis.lean @@ -136,7 +136,7 @@ theorem basisFun_equivFun : (Pi.basisFun R η).equivFun = LinearEquiv.refl _ _ : variable {η} /-- The `R`-submodule of `η → R` consisting of functions supported in the subset `s`. -/ -def spanSubset (s : Set η) : Submodule R (η → R) := +noncomputable def spanSubset (s : Set η) : Submodule R (η → R) := .span R (Pi.basisFun R η '' s) variable {R} {s : Set η} diff --git a/Mathlib/LinearAlgebra/SymplecticGroup.lean b/Mathlib/LinearAlgebra/SymplecticGroup.lean index b90e068e0c7209..9a817a301ba627 100644 --- a/Mathlib/LinearAlgebra/SymplecticGroup.lean +++ b/Mathlib/LinearAlgebra/SymplecticGroup.lean @@ -101,7 +101,7 @@ variable [Fintype l] def symplecticGroup : Submonoid (Matrix (l ⊕ l) (l ⊕ l) R) where carrier := { A | A * J l R * Aᵀ = J l R } mul_mem' {a b} ha hb := by - simp only [Set.mem_setOf_eq, transpose_mul] at * + simp only [Set.mem_ofPred_eq, transpose_mul] at * rw [← Matrix.mul_assoc, a.mul_assoc, a.mul_assoc, hb] exact ha one_mem' := by simp diff --git a/Mathlib/LinearAlgebra/Transvection/Basic.lean b/Mathlib/LinearAlgebra/Transvection/Basic.lean index b8fae2efc683c1..6fa4b3ef83fdf3 100644 --- a/Mathlib/LinearAlgebra/Transvection/Basic.lean +++ b/Mathlib/LinearAlgebra/Transvection/Basic.lean @@ -349,7 +349,7 @@ theorem dilatransvection.apply {f : Dual R V} {v : V} {h : IsUnit (1 + f v)} {x @[simp] theorem dilatransvection_mem_dilatransvections {f : Dual R V} {v : V} {h : IsUnit (1 + f v)} : dilatransvection h ∈ dilatransvections R V := by - simp only [dilatransvections, Set.mem_setOf_eq] + simp only [dilatransvections, Set.mem_ofPred_eq] refine ⟨f, v, by simp⟩ open scoped Pointwise in @@ -370,14 +370,14 @@ theorem mem_dilatransvections_iff_rank {e : V ≃ₗ[K] V} : Module.rank K (range ((e : V →ₗ[K] V) - LinearMap.id (R := K))) ≤ 1 := by simp only [dilatransvections] constructor - · simp only [Set.mem_setOf_eq] + · simp only [Set.mem_ofPred_eq] rintro ⟨f, v, he⟩ apply le_trans (rank_mono (t := K ∙ v) ?_) · apply le_trans (rank_span_le _) (by simp) rintro _ ⟨x, rfl⟩ simp [mem_span_singleton, he, LinearMap.transvection.apply] · intro he - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] set u := (e : V →ₗ[K] V) - LinearMap.id with hu rw [eq_sub_iff_add_eq] at hu by_cases hr : Module.rank K (range u) = 0 diff --git a/Mathlib/Logic/Embedding/Set.lean b/Mathlib/Logic/Embedding/Set.lean index d0136440aafa1c..f648184f7447ff 100644 --- a/Mathlib/Logic/Embedding/Set.lean +++ b/Mathlib/Logic/Embedding/Set.lean @@ -30,7 +30,7 @@ variable {α : Sort u} {β : Sort v} (f : α ≃ β) @[simp] theorem Equiv.asEmbedding_range {α β : Sort _} {p : β → Prop} (e : α ≃ Subtype p) : - Set.range e.asEmbedding = setOf p := + Set.range e.asEmbedding = Set.ofPred p := Set.ext fun x ↦ ⟨fun ⟨y, h⟩ ↦ h ▸ Subtype.coe_prop (e y), fun hs ↦ ⟨e.symm ⟨x, hs⟩, by simp⟩⟩ end Equiv diff --git a/Mathlib/Logic/Encodable/Basic.lean b/Mathlib/Logic/Encodable/Basic.lean index 33da624467b19e..208e3985d167c6 100644 --- a/Mathlib/Logic/Encodable/Basic.lean +++ b/Mathlib/Logic/Encodable/Basic.lean @@ -193,7 +193,7 @@ theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = som theorem decode₂_ne_none_iff [Encodable α] {n : ℕ} : decode₂ α n ≠ none ↔ n ∈ Set.range (encode : α → ℕ) := by - simp_rw [Set.range, Set.mem_setOf_eq, Ne, Option.eq_none_iff_forall_not_mem, + simp_rw [Set.range, Set.mem_ofPred_eq, Ne, Option.eq_none_iff_forall_not_mem, Encodable.mem_decode₂, not_forall, not_not] theorem decode₂_isPartialInv [Encodable α] : IsPartialInv encode (decode₂ α) := fun _ _ => diff --git a/Mathlib/Logic/Equiv/Fintype.lean b/Mathlib/Logic/Equiv/Fintype.lean index 9c332cc9109a10..f171a54da596c0 100644 --- a/Mathlib/Logic/Equiv/Fintype.lean +++ b/Mathlib/Logic/Equiv/Fintype.lean @@ -147,7 +147,6 @@ theorem extendSubtype_apply_of_not_mem (e : { x // p x } ≃ { x // q x }) (x) ( e.extendSubtype x = e.toCompl ⟨x, hx⟩ := by simp only [extendSubtype, subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply, sumCompl_symm_apply_of_neg hx, Sum.map_inr, sumCompl_apply_inr] - rfl theorem extendSubtype_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : ¬p x) : ¬q (e.extendSubtype x) := diff --git a/Mathlib/Logic/Equiv/Set.lean b/Mathlib/Logic/Equiv/Set.lean index b430f0e1e4d1cf..f7c24327cd745e 100644 --- a/Mathlib/Logic/Equiv/Set.lean +++ b/Mathlib/Logic/Equiv/Set.lean @@ -117,9 +117,12 @@ theorem preimage_eq_iff_eq_image {α β} (e : α ≃ β) (s t) : e ⁻¹' s = t theorem eq_preimage_iff_image_eq {α β} (e : α ≃ β) (s t) : s = e ⁻¹' t ↔ e '' s = t := Set.eq_preimage_iff_image_eq e.bijective -lemma setOf_apply_symm_eq_image_setOf {α β} (e : α ≃ β) (p : α → Prop) : +lemma setOfPred_apply_symm_eq_image_setOfPred {α β} (e : α ≃ β) (p : α → Prop) : {b | p (e.symm b)} = e '' {a | p a} := by - rw [Equiv.image_eq_preimage_symm, preimage_setOf_eq] + rw [Equiv.image_eq_preimage_symm, preimage_ofPred_eq] + +@[deprecated (since := "2026-07-09")] +alias setOf_apply_symm_eq_image_setOf := setOfPred_apply_symm_eq_image_setOfPred @[simp] theorem prod_assoc_preimage {α β γ} {s : Set α} {t : Set β} {u : Set γ} : diff --git a/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean b/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean index 6e103889210543..45e27cfcafbce0 100644 --- a/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean +++ b/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean @@ -95,7 +95,7 @@ theorem borel_eq_generateFrom_isClosed [TopologicalSpace α] : theorem borel_comap {f : α → β} {t : TopologicalSpace β} : @borel α (t.induced f) = (@borel β t).comap f := - comap_generateFrom.symm + (comap_generateFrom (s := {s | IsOpen[t] s})).symm theorem Continuous.borel_measurable [TopologicalSpace α] [TopologicalSpace β] {f : α → β} (hf : Continuous f) : @Measurable α β (borel α) (borel β) f := @@ -251,7 +251,7 @@ theorem IsGδ.measurableSet (h : IsGδ s) : MeasurableSet s := by theorem measurableSet_of_continuousAt {β} [PseudoEMetricSpace β] (f : α → β) : MeasurableSet { x | ContinuousAt f x } := - (IsGδ.setOf_continuousAt f).measurableSet + (IsGδ.setOfPred_continuousAt f).measurableSet theorem IsClosed.measurableSet (h : IsClosed s) : MeasurableSet s := h.isOpen_compl.measurableSet.of_compl @@ -379,7 +379,7 @@ instance Pi.opensMeasurableSpace_of_subsingleton {ι : Type*} {X : ι → Type*} rw [borel, MeasurableSpace.pi, ciSup_unique] refine MeasurableSpace.generateFrom_le fun s hs ↦ MeasurableSpace.measurableSet_comap.2 ?_ simp +instances only [Pi.topologicalSpace, ciInf_unique, isOpen_induced_eq, Set.mem_image, - Set.mem_setOf_eq] at hs + Set.mem_ofPred_eq] at hs obtain ⟨t, ht, rfl⟩ := hs exact ⟨t, ht.measurableSet, rfl⟩ @@ -452,7 +452,7 @@ instance Prod.opensMeasurableSpace [h : SecondCountableTopologyEither α β] : variable {α' : Type*} [TopologicalSpace α'] [MeasurableSpace α'] theorem interior_ae_eq_of_null_frontier {μ : Measure α'} {s : Set α'} (h : μ (frontier s) = 0) : - interior s =ᵐ[μ] s := + interior s =ᵐˢ[μ] s := interior_subset.eventuallyLE.antisymm <| subset_closure.eventuallyLE.trans (ae_le_set.2 h) theorem measure_interior_of_null_frontier {μ : Measure α'} {s : Set α'} (h : μ (frontier s) = 0) : @@ -464,7 +464,7 @@ theorem nullMeasurableSet_of_null_frontier {s : Set α} {μ : Measure α} (h : ⟨interior s, isOpen_interior.measurableSet, (interior_ae_eq_of_null_frontier h).symm⟩ theorem closure_ae_eq_of_null_frontier {μ : Measure α'} {s : Set α'} (h : μ (frontier s) = 0) : - closure s =ᵐ[μ] s := + closure s =ᵐˢ[μ] s := ((ae_le_set.2 h).trans interior_subset.eventuallyLE).antisymm <| subset_closure.eventuallyLE theorem measure_closure_of_null_frontier {μ : Measure α'} {s : Set α'} (h : μ (frontier s) = 0) : diff --git a/Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean b/Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean index 20c22dc9b98969..0e933c1a932f80 100644 --- a/Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean +++ b/Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean @@ -166,7 +166,7 @@ theorem measurableSet_le' : MeasurableSet { p : α × α | p.1 ≤ p.2 } := @[fun_prop] theorem measurable_le : Measurable fun p : α × α => p.1 ≤ p.2 := - measurableSet_setOf.mp measurableSet_le' + measurableSet_setOfPred.mp measurableSet_le' theorem measurableSet_le {f g : δ → α} (hf : Measurable f) (hg : Measurable g) : MeasurableSet { a | f a ≤ g a } := @@ -239,7 +239,7 @@ theorem measurableSet_lt' [SecondCountableTopology α] [OrderClosedTopology α] @[fun_prop] theorem measurable_lt [SecondCountableTopology α] [OrderClosedTopology α] : Measurable fun p : α × α => p.1 < p.2 := - measurableSet_setOf.mp measurableSet_lt' + measurableSet_setOfPred.mp measurableSet_lt' theorem measurableSet_lt [SecondCountableTopology α] [OrderClosedTopology α] {f g : δ → α} (hf : Measurable f) (hg : Measurable g) : @@ -475,7 +475,7 @@ theorem ext_of_Ico' {α : Type*} [TopologicalSpace α] {m : MeasurableSpace α} rcases exists_countable_dense_bot_top α with ⟨s, hsc, hsd, hsb, _⟩ have : (⋃ (l ∈ s) (u ∈ s) (_ : l < u), {Ico l u} : Set (Set α)).Countable := hsc.biUnion fun l _ => hsc.biUnion fun u _ => countable_iUnion fun _ => countable_singleton _ - simp only [← setOf_eq_eq_singleton, ← setOf_exists] at this + simp only [← ofPred_eq_eq_singleton, ← ofPred_exists] at this refine Measure.ext_of_generateFrom_of_cover_subset (BorelSpace.measurable_eq.trans (borel_eq_generateFrom_Ico α)) (isPiSystem_Ico id id) ?_ this @@ -548,7 +548,7 @@ theorem ext_of_Icc' {α : Type*} [TopologicalSpace α] {m : MeasurableSpace α} rcases exists_countable_dense_bot_top α with ⟨s, hsc, hsd, hsb, hst⟩ have : (⋃ (l ∈ s) (u ∈ s) (_ : l ≤ u), {Icc l u} : Set (Set α)).Countable := hsc.biUnion fun l _ => hsc.biUnion fun u _ => countable_iUnion fun _ => countable_singleton _ - simp only [← setOf_eq_eq_singleton, ← setOf_exists] at this + simp only [← ofPred_eq_eq_singleton, ← ofPred_exists] at this refine Measure.ext_of_generateFrom_of_cover_subset (BorelSpace.measurable_eq.trans (borel_eq_generateFrom_Icc α)) (isPiSystem_Icc id id) ?_ this @@ -704,7 +704,7 @@ theorem Measurable.isLUB {ι} [Countable ι] {f : ι → δ → α} {g : δ → rw [‹BorelSpace α›.measurable_eq, borel_eq_generateFrom_Ioi α] apply measurable_generateFrom rintro _ ⟨a, rfl⟩ - simp_rw [Set.preimage, mem_Ioi, lt_isLUB_iff (hg _), exists_range_iff, setOf_exists] + simp_rw [Set.preimage, mem_Ioi, lt_isLUB_iff (hg _), exists_range_iff, ofPred_exists] exact MeasurableSet.iUnion fun i => hf i (isOpen_lt' _).measurableSet /-- If a function is the least upper bound of countably many measurable functions on a measurable @@ -747,7 +747,7 @@ theorem AEMeasurable.isLUB {ι} {μ : Measure δ} [Countable ι] {f : ι → δ nontriviality α haveI hα : Nonempty α := inferInstance rcases isEmpty_or_nonempty ι with hι | hι - · simp only [IsEmpty.exists_iff, setOf_false, isLUB_empty_iff] at hg + · simp only [IsEmpty.exists_iff, ofPred_false, isLUB_empty_iff] at hg exact aemeasurable_const' (hg.mono fun a ha => hg.mono fun b hb => (ha _).antisymm (hb _)) let p : δ → (ι → α) → Prop := fun x f' => IsLUB { a | ∃ i, f' i = a } (g x) let g_seq := (aeSeqSet hf p).piecewise g fun _ => hα.some @@ -758,7 +758,7 @@ theorem AEMeasurable.isLUB {ι} {μ : Measure δ} [Countable ι] {f : ι → δ · have h_set_eq : { a : α | ∃ i : ι, (hf i).mk (f i) b = a } = { a : α | ∃ i : ι, f i b = a } := by ext x - simp_rw [Set.mem_setOf_eq, aeSeq.mk_eq_fun_of_mem_aeSeqSet hf h] + simp_rw [Set.mem_ofPred_eq, aeSeq.mk_eq_fun_of_mem_aeSeqSet hf h] rw [h_set_eq] exact aeSeq.fun_prop_of_mem_aeSeqSet hf h · exact IsGreatest.isLUB ⟨(@exists_const (hα.some = hα.some) ι _).2 rfl, fun x ⟨i, hi⟩ => hi.ge⟩ @@ -857,7 +857,7 @@ lemma measurableSet_bddAbove_range {ι} [Countable ι] {f : ι → δ → α} (h exact measurableSet_le (hf i) measurable_const have B : ∀ (c : α), MeasurableSet {x | ∀ i, f i x ≤ c} := by intro c - rw [setOf_forall] + rw [ofPred_forall] exact MeasurableSet.iInter (fun i ↦ A i c) obtain ⟨u, hu⟩ : ∃ (u : ℕ → α), Tendsto u atTop atTop := exists_seq_tendsto (atTop : Filter α) have : {b | BddAbove (range (fun i ↦ f i b))} = {x | ∃ n, ∀ i, f i x ≤ u n} := by @@ -869,7 +869,7 @@ lemma measurableSet_bddAbove_range {ι} [Countable ι] {f : ι → δ → α} (h refine ⟨u n, ?_⟩ rintro - ⟨i, rfl⟩ exact hn i - rw [this, setOf_exists] + rw [this, ofPred_exists] exact MeasurableSet.iUnion (fun n ↦ B (u n)) lemma measurableSet_bddBelow_range {ι} [Countable ι] {f : ι → δ → α} (hf : ∀ i, Measurable (f i)) : @@ -1015,7 +1015,7 @@ theorem Measurable.liminf' {ι ι'} {f : ι → δ → α} {v : Filter ι} (hf : have m_meas : ∀ j, MeasurableSet (m j) := fun j ↦ measurableSet_bddBelow_range (fun (i : s j) ↦ hf i) have mc_meas : MeasurableSet {x | ∀ (j : Subtype p), x ∉ m j} := by - rw [setOf_forall] + rw [ofPred_forall] exact MeasurableSet.iInter (fun j ↦ (m_meas j).compl) refine measurable_const.piecewise mc_meas <| .iSup fun j ↦ ?_ let reparam : δ → Subtype p → Subtype p := fun x ↦ liminf_reparam (fun i ↦ f i x) s p diff --git a/Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean b/Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean index ef30b4946bc384..8d8c28e3867088 100644 --- a/Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean +++ b/Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean @@ -88,7 +88,6 @@ theorem borel_eq_generateFrom_Ici_rat : borel ℝ = .generateFrom (⋃ a : ℚ, theorem isPiSystem_Ioo_rat : IsPiSystem (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) := by convert! isPiSystem_Ioo ((↑) : ℚ → ℝ) ((↑) : ℚ → ℝ) - ext x simp [eq_comm] theorem isPiSystem_Iio_rat : IsPiSystem (⋃ a : ℚ, {Iio (a : ℝ)}) := by @@ -551,7 +550,7 @@ theorem exists_spanning_measurableSet_le {f : α → ℝ≥0} (hf : Measurable f · have : ⋃ i, sigma_finite_sets i ∩ norm_sets i = (⋃ i, sigma_finite_sets i) ∩ ⋃ i, norm_sets i := by refine Set.iUnion_inter_of_monotone (monotone_spanningSets μ) fun i j hij x => ?_ - simp only [norm_sets, Set.mem_setOf_eq] + simp only [norm_sets, Set.mem_ofPred_eq] refine fun hif => hif.trans ?_ exact mod_cast hij rw [this, norm_sets_spanning, iUnion_spanningSets μ, Set.inter_univ] diff --git a/Mathlib/MeasureTheory/Constructions/ClosedCompactCylinders.lean b/Mathlib/MeasureTheory/Constructions/ClosedCompactCylinders.lean index 2321bf6e04aa32..21f87aaee01cee 100644 --- a/Mathlib/MeasureTheory/Constructions/ClosedCompactCylinders.lean +++ b/Mathlib/MeasureTheory/Constructions/ClosedCompactCylinders.lean @@ -55,7 +55,7 @@ noncomputable def closedCompactCylinders.finset (ht : t ∈ closedCompactCylinde ((mem_closedCompactCylinders t).mp ht).choose /-- A set `S` such that `t = cylinder s S`. `s` is given by `closedCompactCylinders.finset`. -/ -def closedCompactCylinders.set (ht : t ∈ closedCompactCylinders X) : +noncomputable def closedCompactCylinders.set (ht : t ∈ closedCompactCylinders X) : Set (Π i : closedCompactCylinders.finset ht, X i) := ((mem_closedCompactCylinders t).mp ht).choose_spec.choose diff --git a/Mathlib/MeasureTheory/Constructions/Cylinders.lean b/Mathlib/MeasureTheory/Constructions/Cylinders.lean index b112f3470a309c..9118aa845e50c0 100644 --- a/Mathlib/MeasureTheory/Constructions/Cylinders.lean +++ b/Mathlib/MeasureTheory/Constructions/Cylinders.lean @@ -62,7 +62,7 @@ def squareCylinders (C : ∀ i, Set (Set (α i))) : Set (Set (∀ i, α i)) := theorem squareCylinders_eq_iUnion_image (C : ∀ i, Set (Set (α i))) : squareCylinders C = ⋃ s : Finset ι, (fun t ↦ (s : Set ι).pi t) '' univ.pi C := by ext1 f - simp only [squareCylinders, mem_iUnion, mem_image, mem_univ_pi, mem_setOf_eq, + simp only [squareCylinders, mem_iUnion, mem_image, mem_univ_pi, mem_ofPred_eq, eq_comm (a := f)] theorem isPiSystem_squareCylinders {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) @@ -117,7 +117,7 @@ theorem comap_eval_le_generateFrom_squareCylinders_singleton simp only [singleton_pi] rw [MeasurableSpace.comap_eq_generateFrom] refine MeasurableSpace.generateFrom_mono fun S ↦ ?_ - simp only [mem_setOf_eq, mem_image, mem_univ_pi, forall_exists_index, and_imp] + simp only [mem_ofPred_eq, mem_image, mem_univ_pi, forall_exists_index, and_imp] intro t ht h classical refine ⟨fun j ↦ if hji : j = i then by convert! t else univ, fun j ↦ ?_, ?_⟩ @@ -139,7 +139,7 @@ theorem generateFrom_squareCylinders [∀ i, MeasurableSpace (α i)] : apply le_antisymm · rw [MeasurableSpace.generateFrom_le_iff] rintro S ⟨s, t, h, rfl⟩ - simp only [mem_univ_pi, mem_setOf_eq] at h + simp only [mem_univ_pi, mem_ofPred_eq] at h exact MeasurableSet.pi (Finset.countable_toSet _) (fun i _ ↦ h i) · refine iSup_le fun i ↦ ?_ refine (comap_eval_le_generateFrom_squareCylinders_singleton α i).trans ?_ @@ -147,7 +147,7 @@ theorem generateFrom_squareCylinders [∀ i, MeasurableSpace (α i)] : rw [← Finset.coe_singleton, squareCylinders_eq_iUnion_image] exact subset_iUnion (fun (s : Finset ι) ↦ - (fun t : ∀ i, Set (α i) ↦ (s : Set ι).pi t) '' univ.pi (fun i ↦ setOf MeasurableSet)) + (fun t : ∀ i, Set (α i) ↦ (s : Set ι).pi t) '' univ.pi (fun i ↦ Set.ofPred MeasurableSet)) ({i} : Finset ι) end squareCylinders @@ -294,7 +294,7 @@ noncomputable def measurableCylinders.finset (ht : t ∈ measurableCylinders α) ((mem_measurableCylinders t).mp ht).choose /-- A set `S` such that `t = cylinder s S`. `s` is given by `measurableCylinders.finset`. -/ -def measurableCylinders.set (ht : t ∈ measurableCylinders α) : +noncomputable def measurableCylinders.set (ht : t ∈ measurableCylinders α) : Set (∀ i : measurableCylinders.finset ht, α i) := ((mem_measurableCylinders t).mp ht).choose_spec.choose @@ -320,7 +320,7 @@ theorem inter_mem_measurableCylinders (hs : s ∈ measurableCylinders α) classical refine ⟨s₁ ∪ s₂, Finset.restrict₂ Finset.subset_union_left ⁻¹' S₁ ∩ - {f | Finset.restrict₂ Finset.subset_union_right f ∈ S₂}, ?_, ?_⟩ + Finset.restrict₂ Finset.subset_union_right ⁻¹' S₂, ?_, ?_⟩ · refine MeasurableSet.inter ?_ ?_ · exact measurable_pi_lambda _ (fun _ ↦ measurable_pi_apply _) hS₁ · exact measurable_pi_lambda _ (fun _ ↦ measurable_pi_apply _) hS₂ @@ -366,12 +366,13 @@ theorem generateFrom_measurableCylinders : · refine iSup_le fun i ↦ ?_ refine (comap_eval_le_generateFrom_squareCylinders_singleton α i).trans ?_ refine MeasurableSpace.generateFrom_mono (fun x ↦ ?_) - simp only [singleton_pi, mem_image, mem_pi, mem_univ, mem_setOf_eq, + simp only [singleton_pi, mem_image, mem_pi, mem_univ, mem_ofPred_eq, forall_true_left, mem_measurableCylinders, forall_exists_index, and_imp] rintro t ht rfl - refine ⟨{i}, {f | f ⟨i, Finset.mem_singleton_self i⟩ ∈ t i}, measurable_pi_apply _ (ht i), ?_⟩ + refine ⟨{i}, {f | f ⟨i, Finset.mem_singleton_self i⟩ ∈ t i}, + measurable_pi_apply (⟨i, Finset.mem_singleton_self i⟩ : ({i} : Finset ι)) (ht i), ?_⟩ ext1 x - simp only [mem_preimage, Function.eval, mem_cylinder, mem_setOf_eq, Finset.restrict] + simp only [mem_preimage, Function.eval, mem_cylinder, mem_ofPred_eq, Finset.restrict] /-- The cylinders of a product space indexed by `ℕ` can be seen as depending on the first coordinates. -/ diff --git a/Mathlib/MeasureTheory/Constructions/HaarToSphere.lean b/Mathlib/MeasureTheory/Constructions/HaarToSphere.lean index 63ebf1c46e112e..88741fd12812cf 100644 --- a/Mathlib/MeasureTheory/Constructions/HaarToSphere.lean +++ b/Mathlib/MeasureTheory/Constructions/HaarToSphere.lean @@ -224,7 +224,7 @@ theorem toSphereBallBound_mul_measure_unitBall_le_toSphere_ball {ε : ℝ} using this (ε := min ε 2) (by simp [hε]) (by simp) · gcongr simp - rw [μ.toSphere_apply' measurableSet_ball, Subtype.image_ball, setOf_mem_eq] + rw [μ.toSphere_apply' measurableSet_ball, Subtype.image_ball, ofPred_mem_eq] grw [← ball_subset_sector_of_small_epsilon] <;> try assumption · have hdim : Module.finrank ℝ E ≠ 0 := Module.finrank_pos.ne' have : min (ENNReal.ofReal ε) 2 = ENNReal.ofReal ε := by simpa diff --git a/Mathlib/MeasureTheory/Constructions/Pi.lean b/Mathlib/MeasureTheory/Constructions/Pi.lean index c025ed63bbb813..fe4a8e474ad339 100644 --- a/Mathlib/MeasureTheory/Constructions/Pi.lean +++ b/Mathlib/MeasureTheory/Constructions/Pi.lean @@ -439,13 +439,13 @@ theorem ae_le_pi {β : ι → Type*} [∀ i, Preorder (β i)] {f f' : ∀ i, α (fun (x : ∀ i, α i) i => f i (x i)) ≤ᵐ[Measure.pi μ] fun x i => f' i (x i) := (eventually_all.2 fun i => tendsto_eval_ae_ae.eventually (h i)).mono fun _ hx => hx -theorem ae_le_set_pi {I : Set ι} {s t : ∀ i, Set (α i)} (h : ∀ i ∈ I, s i ≤ᵐ[μ i] t i) : - Set.pi I s ≤ᵐ[Measure.pi μ] Set.pi I t := +theorem ae_le_set_pi {I : Set ι} {s t : ∀ i, Set (α i)} (h : ∀ i ∈ I, s i ⊆ᵐ[μ i] t i) : + Set.pi I s ⊆ᵐ[Measure.pi μ] Set.pi I t := ((eventually_all_finite I.toFinite).2 fun i hi => tendsto_eval_ae_ae.eventually (h i hi)).mono fun _ hst hx i hi => hst i hi <| hx i hi -theorem ae_eq_set_pi {I : Set ι} {s t : ∀ i, Set (α i)} (h : ∀ i ∈ I, s i =ᵐ[μ i] t i) : - Set.pi I s =ᵐ[Measure.pi μ] Set.pi I t := +theorem ae_eq_set_pi {I : Set ι} {s t : ∀ i, Set (α i)} (h : ∀ i ∈ I, s i =ᵐˢ[μ i] t i) : + Set.pi I s =ᵐˢ[Measure.pi μ] Set.pi I t := (ae_le_set_pi fun i hi => (h i hi).le).antisymm (ae_le_set_pi fun i hi => (h i hi).symm.le) lemma pi_map_piOptionEquivProd {β : Option ι → Type*} [∀ i, MeasurableSpace (β i)] @@ -469,47 +469,47 @@ section Intervals variable [∀ i, PartialOrder (α i)] [∀ i, NullSingletonClass (μ i)] theorem pi_Iio_ae_eq_pi_Iic {s : Set ι} {f : ∀ i, α i} : - (pi s fun i => Iio (f i)) =ᵐ[Measure.pi μ] pi s fun i => Iic (f i) := + (pi s fun i => Iio (f i)) =ᵐˢ[Measure.pi μ] pi s fun i => Iic (f i) := ae_eq_set_pi fun _ _ => Iio_ae_eq_Iic theorem pi_Ioi_ae_eq_pi_Ici {s : Set ι} {f : ∀ i, α i} : - (pi s fun i => Ioi (f i)) =ᵐ[Measure.pi μ] pi s fun i => Ici (f i) := + (pi s fun i => Ioi (f i)) =ᵐˢ[Measure.pi μ] pi s fun i => Ici (f i) := ae_eq_set_pi fun _ _ => Ioi_ae_eq_Ici theorem univ_pi_Iio_ae_eq_Iic {f : ∀ i, α i} : - (pi univ fun i => Iio (f i)) =ᵐ[Measure.pi μ] Iic f := by + (pi univ fun i => Iio (f i)) =ᵐˢ[Measure.pi μ] Iic f := by rw [← pi_univ_Iic]; exact pi_Iio_ae_eq_pi_Iic theorem univ_pi_Ioi_ae_eq_Ici {f : ∀ i, α i} : - (pi univ fun i => Ioi (f i)) =ᵐ[Measure.pi μ] Ici f := by + (pi univ fun i => Ioi (f i)) =ᵐˢ[Measure.pi μ] Ici f := by rw [← pi_univ_Ici]; exact pi_Ioi_ae_eq_pi_Ici theorem pi_Ioo_ae_eq_pi_Icc {s : Set ι} {f g : ∀ i, α i} : - (pi s fun i => Ioo (f i) (g i)) =ᵐ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := + (pi s fun i => Ioo (f i) (g i)) =ᵐˢ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := ae_eq_set_pi fun _ _ => Ioo_ae_eq_Icc theorem pi_Ioo_ae_eq_pi_Ioc {s : Set ι} {f g : ∀ i, α i} : - (pi s fun i => Ioo (f i) (g i)) =ᵐ[Measure.pi μ] pi s fun i => Ioc (f i) (g i) := + (pi s fun i => Ioo (f i) (g i)) =ᵐˢ[Measure.pi μ] pi s fun i => Ioc (f i) (g i) := ae_eq_set_pi fun _ _ => Ioo_ae_eq_Ioc theorem univ_pi_Ioo_ae_eq_Icc {f g : ∀ i, α i} : - (pi univ fun i => Ioo (f i) (g i)) =ᵐ[Measure.pi μ] Icc f g := by + (pi univ fun i => Ioo (f i) (g i)) =ᵐˢ[Measure.pi μ] Icc f g := by rw [← pi_univ_Icc]; exact pi_Ioo_ae_eq_pi_Icc theorem pi_Ioc_ae_eq_pi_Icc {s : Set ι} {f g : ∀ i, α i} : - (pi s fun i => Ioc (f i) (g i)) =ᵐ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := + (pi s fun i => Ioc (f i) (g i)) =ᵐˢ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := ae_eq_set_pi fun _ _ => Ioc_ae_eq_Icc theorem univ_pi_Ioc_ae_eq_Icc {f g : ∀ i, α i} : - (pi univ fun i => Ioc (f i) (g i)) =ᵐ[Measure.pi μ] Icc f g := by + (pi univ fun i => Ioc (f i) (g i)) =ᵐˢ[Measure.pi μ] Icc f g := by rw [← pi_univ_Icc]; exact pi_Ioc_ae_eq_pi_Icc theorem pi_Ico_ae_eq_pi_Icc {s : Set ι} {f g : ∀ i, α i} : - (pi s fun i => Ico (f i) (g i)) =ᵐ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := + (pi s fun i => Ico (f i) (g i)) =ᵐˢ[Measure.pi μ] pi s fun i => Icc (f i) (g i) := ae_eq_set_pi fun _ _ => Ico_ae_eq_Icc theorem univ_pi_Ico_ae_eq_Icc {f g : ∀ i, α i} : - (pi univ fun i => Ico (f i) (g i)) =ᵐ[Measure.pi μ] Icc f g := by + (pi univ fun i => Ico (f i) (g i)) =ᵐˢ[Measure.pi μ] Icc f g := by rw [← pi_univ_Icc]; exact pi_Ico_ae_eq_pi_Icc end Intervals diff --git a/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean b/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean index d571c9ee50a733..a477ce1a9030b5 100644 --- a/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean +++ b/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean @@ -928,7 +928,7 @@ theorem MeasurableSet.image_of_monotoneOn_of_continuousOn Therefore, we need to remove the points where the map is not injective. There are only countably many points that have several preimages, so this set is also measurable. -/ let u : Set β := {c | ∃ x, ∃ y, x ∈ t ∧ y ∈ t ∧ x < y ∧ g x = c ∧ g y = c} - have hu : Set.Countable u := MonotoneOn.countable_setOf_two_preimages hg + have hu : Set.Countable u := MonotoneOn.countable_setOfPred_two_preimages hg let t' := t ∩ g ⁻¹' u have ht' : MeasurableSet t' := by have : t' = ⋃ c ∈ u, t ∩ g ⁻¹' {c} := by ext; simp [t'] @@ -961,14 +961,14 @@ theorem MeasurableSet.image_of_monotoneOn [SecondCountableTopology β] rw [← image_union] congr! ext - simp only [sdiff_sep_self, not_not, mem_union, mem_setOf_eq, t'] + simp only [sdiff_sep_self, not_not, mem_union, mem_ofPred_eq, t'] tauto rw [this] apply MeasurableSet.union _ (ht'.image g).measurableSet apply MeasurableSet.image_of_monotoneOn_of_continuousOn (ht.diff ht'.measurableSet) (hg.mono sdiff_subset) intro x hx - simp only [sdiff_sep_self, not_not, mem_setOf_eq, t'] at hx + simp only [sdiff_sep_self, not_not, mem_ofPred_eq, t'] at hx exact hx.2.mono sdiff_subset /-- The image of a measurable set under an antitone map is measurable. -/ @@ -1008,11 +1008,11 @@ theorem MeasureTheory.measurableSet_exists_tendsto [TopologicalSpace γ] ((f · x) '' u n) ×ˢ ((f · x) '' u n) := fun x => (hu.map _).prod (hu.map _) simp_rw [and_iff_right (hl.map _), Filter.HasBasis.le_basis_iff (this _).toHasBasis Metric.uniformity_basis_dist_inv_nat_succ, - Set.setOf_forall] + Set.ofPred_forall] refine MeasurableSet.biInter Set.countable_univ fun K _ => ?_ - simp_rw [Set.setOf_exists, true_and] + simp_rw [Set.ofPred_exists, true_and] refine MeasurableSet.iUnion fun N => ?_ - simp_rw [prod_image_image_eq, image_subset_iff, prod_subset_iff, Set.setOf_forall] + simp_rw [prod_image_image_eq, image_subset_iff, prod_subset_iff, Set.ofPred_forall] exact MeasurableSet.biInter (to_countable (u N)) fun i _ => MeasurableSet.biInter (to_countable (u N)) fun j _ => diff --git a/Mathlib/MeasureTheory/Covering/Besicovitch.lean b/Mathlib/MeasureTheory/Covering/Besicovitch.lean index efe2280ce46e21..9fc4d08a1aedbf 100644 --- a/Mathlib/MeasureTheory/Covering/Besicovitch.lean +++ b/Mathlib/MeasureTheory/Covering/Besicovitch.lean @@ -286,7 +286,7 @@ theorem lastStep_nonempty : wlog x_le_y : x ≤ y generalizing x y · exact (this hxy.symm (le_of_not_ge x_le_y)).symm rcases eq_or_lt_of_le x_le_y with (rfl | H); · rfl - simp only [nonempty_def, not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, + simp only [nonempty_def, not_exists, exists_prop, not_and, not_lt, not_le, mem_ofPred_eq, not_forall] at h specialize h y have A : p.c (p.index y) ∉ p.iUnionUpTo y := by @@ -307,7 +307,7 @@ theorem mem_iUnionUpTo_lastStep (x : β) : p.c x ∈ p.iUnionUpTo p.lastStep := have A : ∀ z : β, p.c z ∈ p.iUnionUpTo p.lastStep ∨ p.τ * p.r z < p.R p.lastStep := by have : p.lastStep ∈ {i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b} := csInf_mem p.lastStep_nonempty - simpa only [not_exists, mem_setOf_eq, not_and_or, not_le, not_notMem] + simpa only [not_exists, mem_ofPred_eq, not_and_or, not_le, not_notMem] by_contra h rcases A x with (H | H); · exact h H have Rpos : 0 < p.R p.lastStep := by @@ -389,7 +389,7 @@ theorem color_lt {i : Ordinal.{u}} (hi : i < p.lastStep) {N : ℕ} rw [index]; rfl rw [this] have : ∃ t, p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by - simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] using + simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_ofPred_eq, not_forall] using notMem_of_lt_csInf (G_lt_last n hn) (OrderBot.bddBelow _) exact Classical.epsilon_spec this -- the balls with indices `G k` satisfy the characteristic property of satellite configurations. @@ -570,7 +570,7 @@ theorem exist_finset_disjoint_balls_large_measure (μ : Measure α) [IsFiniteMea intro x hx obtain ⟨i, y, hxy, h'⟩ : ∃ (i : Fin N) (i_1 : ↥s), i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) := by - have : x ∈ range a.c := by simpa only [a, Subtype.range_coe_subtype, setOf_mem_eq] + have : x ∈ range a.c := by simpa only [a, Subtype.range_coe_subtype, ofPred_mem_eq] simpa only [mem_iUnion, bex_def] using hu' this refine mem_iUnion.2 ⟨i, ⟨hx, ?_⟩⟩ simp only [v, exists_prop, mem_iUnion, SetCoe.exists, exists_and_right] @@ -945,7 +945,7 @@ theorem exists_closedBall_covering_tsum_measure_le (μ : Measure α) [SFinite μ · obtain ⟨i, y, ySi, xy⟩ : ∃ (i : Fin N) (y : ↥s'), y ∈ S i ∧ x ∈ ball (y : α) (r1 y) := by have A : x ∈ range q.c := by simpa only [q, not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, - not_le, mem_setOf_eq, Subtype.range_coe_subtype, Set.mem_sdiff] using h'x + not_le, mem_ofPred_eq, Subtype.range_coe_subtype, Set.mem_sdiff] using h'x simpa only [mem_iUnion, mem_image, bex_def] using hS A refine mem_iUnion₂.2 ⟨y, Or.inr ?_, ?_⟩ · simp only [mem_iUnion, mem_image] diff --git a/Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean b/Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean index 2d53c3ab68fcff..30036d8b034b08 100644 --- a/Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean +++ b/Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean @@ -160,7 +160,7 @@ theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2) · refine ⟨5 ^ finrank ℝ E, ?_⟩ rintro _ ⟨s, ⟨rfl, h⟩⟩ exact Besicovitch.card_le_of_separated s h.1 h.2 - · simp only [mem_setOf_eq, Ne] + · simp only [mem_ofPred_eq, Ne] exact ⟨s, rfl, hs, h's⟩ variable (E) diff --git a/Mathlib/MeasureTheory/Covering/DensityTheorem.lean b/Mathlib/MeasureTheory/Covering/DensityTheorem.lean index f1e975f25ca496..c7b88a5764cad5 100644 --- a/Mathlib/MeasureTheory/Covering/DensityTheorem.lean +++ b/Mathlib/MeasureTheory/Covering/DensityTheorem.lean @@ -71,7 +71,7 @@ contain all balls `closedBall y r` when `dist x y ≤ K * r`. -/ theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r) (rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by let R := scalingScaleOf μ (max (4 * K + 3) 3) - simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq, + simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_ofPred_eq, isClosed_closedBall, true_and, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall, measurableSet_closedBall] /- The measure is doubling on scales smaller than `R`. Therefore, we treat differently small diff --git a/Mathlib/MeasureTheory/Covering/Differentiation.lean b/Mathlib/MeasureTheory/Covering/Differentiation.lean index 7daede20a4718e..7f6da516b29a45 100644 --- a/Mathlib/MeasureTheory/Covering/Differentiation.lean +++ b/Mathlib/MeasureTheory/Covering/Differentiation.lean @@ -103,7 +103,7 @@ theorem ae_eventually_measure_pos [SecondCountableTopology α] : have h : v.FineSubfamilyOn f s := by intro x hx ε εpos rw [hs] at hx - simp only [frequently_filterAt_iff, gt_iff_lt, mem_setOf_eq] at hx + simp only [frequently_filterAt_iff, gt_iff_lt, mem_ofPred_eq] at hx rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩ exact ⟨a, ⟨a_sets, μa⟩, ax⟩ refine le_antisymm ?_ bot_le @@ -183,7 +183,7 @@ theorem ae_eventually_measure_zero_of_singular (hρ : ρ ⟂ₘ μ) : refine v.measure_le_of_frequently_le ρ smul_absolutelyContinuous _ ?_ intro x hx rw [hs] at hx - simp only [mem_inter_iff, not_lt, not_eventually, mem_setOf_eq] at hx + simp only [mem_inter_iff, not_lt, not_eventually, mem_ofPred_eq] at hx exact hx.1 _ ≤ (ε : ℝ≥0∞)⁻¹ * ρ o := by gcongr; apply inter_subset_right _ = 0 := by rw [ρo, mul_zero] @@ -239,13 +239,13 @@ theorem ae_tendsto_div : ∀ᵐ x ∂μ, ∃ c, Tendsto (fun a => ρ a / μ a) ( lift d to ℝ≥0 using I d hd apply v.null_of_frequently_le_of_frequently_ge hρ (ENNReal.coe_lt_coe.1 hcd) · simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually, - mem_setOf_eq, mem_compl_iff, not_forall] + mem_ofPred_eq, mem_compl_iff, not_forall] intro x h1x _ apply h1x.mono fun a ha => ?_ refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff] · simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually, - mem_setOf_eq, mem_compl_iff, not_forall] + mem_ofPred_eq, mem_compl_iff, not_forall] intro x _ h2x apply h2x.mono fun a ha => ?_ exact ENNReal.mul_le_of_le_div ha.le @@ -479,7 +479,7 @@ theorem measure_limRatioMeas_top : μ {x | v.limRatioMeas hρ x = ∞} = 0 := by · apply v.mul_measure_le_of_subset_lt_limRatioMeas hρ intro y hy have : v.limRatioMeas hρ y = ∞ := hy.1 - simp only [this, ENNReal.coe_lt_top, mem_setOf_eq] + simp only [this, ENNReal.coe_lt_top, mem_ofPred_eq] · simp only [(zero_lt_one.trans_le hq).ne', true_or, ENNReal.coe_eq_zero, Ne, not_false_iff] have B : Tendsto (fun q : ℝ≥0 => (q : ℝ≥0∞)⁻¹ * ρ s) atTop (𝓝 (∞⁻¹ * ρ s)) := by @@ -502,7 +502,7 @@ theorem measure_limRatioMeas_zero : ρ (v.limRatioMeas hρ ⁻¹' {0}) = 0 := by apply v.measure_le_mul_of_subset_limRatioMeas_lt hρ intro y hy have : v.limRatioMeas hρ y = 0 := hy.1 - simp only [this, mem_setOf_eq, hq, ENNReal.coe_pos] + simp only [this, mem_ofPred_eq, hq, ENNReal.coe_pos] have B : Tendsto (fun q : ℝ≥0 => (q : ℝ≥0∞) * μ s) (𝓝[>] (0 : ℝ≥0)) (𝓝 ((0 : ℝ≥0) * μ s)) := by apply ENNReal.Tendsto.mul_const _ (Or.inr μs) rw [ENNReal.tendsto_coe] diff --git a/Mathlib/MeasureTheory/Covering/LiminfLimsup.lean b/Mathlib/MeasureTheory/Covering/LiminfLimsup.lean index 7fb8db25c9b16e..93d32764ff563e 100644 --- a/Mathlib/MeasureTheory/Covering/LiminfLimsup.lean +++ b/Mathlib/MeasureTheory/Covering/LiminfLimsup.lean @@ -44,7 +44,7 @@ https://github.com/leanprover-community/mathlib/issues/16932. -/ theorem blimsup_cthickening_ae_le_of_eventually_mul_le_aux (p : ℕ → Prop) {s : ℕ → Set α} (hs : ∀ i, IsClosed (s i)) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0)) (hrp : 0 ≤ r₁) {M : ℝ} (hM : 0 < M) (hM' : M < 1) (hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) : - (blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ] + (blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ⊆ᵐ[μ] (blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by /- Sketch of proof: @@ -123,8 +123,8 @@ theorem blimsup_cthickening_ae_le_of_eventually_mul_le_aux (p : ℕ → Prop) {s apply hMr.mp rw [eventually_atTop] refine - ⟨i, fun j hj hj' => Disjoint.inf_right (B j) <| Disjoint.inf_right' (blimsup Y₁ atTop p) ?_⟩ - change Disjoint (b j) (Z i)ᶜ + ⟨i, fun j hj hj' => Disjoint.inf_right (c := B j) <| + Disjoint.inf_right' (c := blimsup Y₁ atTop p) (?_ : Disjoint (b j) (Z i)ᶜ)⟩ rw [disjoint_compl_right_iff_subset] refine (closedBall_subset_cthickening (hw j) (M * r₁ (f j))).trans ((cthickening_mono hj' _).trans fun a ha => ?_) @@ -157,7 +157,7 @@ https://github.com/leanprover-community/mathlib/issues/16932. -/ theorem blimsup_cthickening_ae_le_of_eventually_mul_le (p : ℕ → Prop) {s : ℕ → Set α} {M : ℝ} (hM : 0 < M) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0)) (hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) : - (blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ] + (blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ⊆ᵐ[μ] (blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by let R₁ i := max 0 (r₁ i) let R₂ i := max 0 (r₂ i) @@ -190,10 +190,10 @@ NB: The `: Set α` type ascription is present because of https://github.com/leanprover-community/mathlib/issues/16932. -/ theorem blimsup_cthickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ) (hr : Tendsto r atTop (𝓝 0)) : - (blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ] + (blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐˢ[μ] (blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) := by have : ∀ (p : ℕ → Prop) {r : ℕ → ℝ} (_ : Tendsto r atTop (𝓝[>] 0)), - (blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ] + (blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐˢ[μ] (blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) := by clear p hr r; intro p r hr have hr' : Tendsto (fun i => M * r i) atTop (𝓝[>] 0) := by @@ -228,7 +228,7 @@ theorem blimsup_cthickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M theorem blimsup_cthickening_ae_eq_blimsup_thickening {p : ℕ → Prop} {s : ℕ → Set α} {r : ℕ → ℝ} (hr : Tendsto r atTop (𝓝 0)) (hr' : ∀ᶠ i in atTop, p i → 0 < r i) : - (blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) =ᵐ[μ] + (blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) =ᵐˢ[μ] (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by refine eventuallyLE_antisymm_iff.mpr ⟨?_, LE.le.eventuallyLE ?_⟩ · rw [eventuallyLE_congr (blimsup_cthickening_mul_ae_eq μ p s (one_half_pos (α := ℝ)) r hr).symm @@ -241,7 +241,7 @@ theorem blimsup_cthickening_ae_eq_blimsup_thickening {p : ℕ → Prop} {s : ℕ /-- An auxiliary result en route to `blimsup_thickening_mul_ae_eq`. -/ theorem blimsup_thickening_mul_ae_eq_aux (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ) (hr : Tendsto r atTop (𝓝 0)) (hr' : ∀ᶠ i in atTop, p i → 0 < r i) : - (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ] + (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐˢ[μ] (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by have h₁ := blimsup_cthickening_ae_eq_blimsup_thickening (s := s) μ hr hr' have h₂ := blimsup_cthickening_mul_ae_eq μ p s hM r hr @@ -264,7 +264,7 @@ NB: The `: Set α` type ascription is present because of https://github.com/leanprover-community/mathlib/issues/16932. -/ theorem blimsup_thickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ) (hr : Tendsto r atTop (𝓝 0)) : - (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ] + (blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐˢ[μ] (blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by let q : ℕ → Prop := fun i => p i ∧ 0 < r i have hq {u : ℕ → Set α} (hu : ∀ i, u i ≠ ∅ → 0 < r i) : diff --git a/Mathlib/MeasureTheory/Covering/Vitali.lean b/Mathlib/MeasureTheory/Covering/Vitali.lean index f708ea56c5007e..f0bb93fac9b5a3 100644 --- a/Mathlib/MeasureTheory/Covering/Vitali.lean +++ b/Mathlib/MeasureTheory/Covering/Vitali.lean @@ -81,7 +81,7 @@ theorem exists_disjoint_subfamily_covering_enlargement (B : ι → Set α) (t : refine zorn_subset _ fun U UT hU => ?_ refine ⟨⋃₀ U, ?_, fun s hs => subset_sUnion_of_mem hs⟩ simp only [T, Set.sUnion_subset_iff, and_imp, forall_exists_index, mem_sUnion, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] refine ⟨fun u hu => (UT hu).1, (pairwiseDisjoint_sUnion hU.directedOn).2 fun u hu => (UT hu).2.1, fun a hat b u uU hbu hab => ?_⟩ diff --git a/Mathlib/MeasureTheory/Covering/VitaliFamily.lean b/Mathlib/MeasureTheory/Covering/VitaliFamily.lean index 23e8f94328afe5..add6dda92b5161 100644 --- a/Mathlib/MeasureTheory/Covering/VitaliFamily.lean +++ b/Mathlib/MeasureTheory/Covering/VitaliFamily.lean @@ -117,7 +117,7 @@ theorem exists_disjoint_covering_ae : /-- Given `h : v.FineSubfamilyOn f s`, then `h.index` is a set parametrizing a disjoint covering of almost every `s`. -/ -protected def index : Set (X × Set X) := +protected noncomputable def index : Set (X × Set X) := h.exists_disjoint_covering_ae.choose /-- Given `h : v.FineSubfamilyOn f s`, then `h.covering p` is a set in the family, @@ -209,7 +209,7 @@ def filterAt (x : X) : Filter (Set X) := (𝓝 x).smallSets ⊓ 𝓟 (v.setsAt x theorem _root_.Filter.HasBasis.vitaliFamily {ι : Sort*} {p : ι → Prop} {s : ι → Set X} {x : X} (h : (𝓝 x).HasBasis p s) : (v.filterAt x).HasBasis p (fun i ↦ {t ∈ v.setsAt x | t ⊆ s i}) := by - simpa only [← Set.setOf_inter_eq_sep] using! h.smallSets.inf_principal _ + simpa only [← Set.ofPred_inter_eq_sep] using! h.smallSets.inf_principal _ theorem filterAt_basis_closedBall (x : X) : (v.filterAt x).HasBasis (0 < ·) ({t ∈ v.setsAt x | t ⊆ closedBall x ·}) := @@ -217,7 +217,7 @@ theorem filterAt_basis_closedBall (x : X) : theorem mem_filterAt_iff {x : X} {s : Set (Set X)} : s ∈ v.filterAt x ↔ ∃ ε > (0 : ℝ), ∀ t ∈ v.setsAt x, t ⊆ closedBall x ε → t ∈ s := by - simp only [(v.filterAt_basis_closedBall x).mem_iff, ← and_imp, subset_def, mem_setOf] + simp only [(v.filterAt_basis_closedBall x).mem_iff, ← and_imp, subset_def, mem_ofPred] instance filterAt_neBot (x : X) : (v.filterAt x).NeBot := (v.filterAt_basis_closedBall x).neBot_iff.2 <| v.nontrivial _ _ @@ -244,7 +244,7 @@ theorem eventually_filterAt_measurableSet (x : X) : ∀ᶠ t in v.filterAt x, Me theorem frequently_filterAt_iff {x : X} {P : Set X → Prop} : (∃ᶠ t in v.filterAt x, P t) ↔ ∀ ε > (0 : ℝ), ∃ t ∈ v.setsAt x, t ⊆ closedBall x ε ∧ P t := by - simp only [(v.filterAt_basis_closedBall x).frequently_iff, ← and_assoc, subset_def, mem_setOf] + simp only [(v.filterAt_basis_closedBall x).frequently_iff, ← and_assoc, subset_def, mem_ofPred] theorem eventually_filterAt_subset_of_nhds {x : X} {o : Set X} (hx : o ∈ 𝓝 x) : ∀ᶠ t in v.filterAt x, t ⊆ o := diff --git a/Mathlib/MeasureTheory/Function/AEEqOfLIntegral.lean b/Mathlib/MeasureTheory/Function/AEEqOfLIntegral.lean index 08a6152b377272..5cb80314e9b013 100644 --- a/Mathlib/MeasureTheory/Function/AEEqOfLIntegral.lean +++ b/Mathlib/MeasureTheory/Function/AEEqOfLIntegral.lean @@ -81,7 +81,7 @@ theorem ae_le_of_forall_setLIntegral_le_of_sigmaFinite₀ [SigmaFinite μ] have μs : ∀ n, μ (s n) = 0 := fun n => A _ _ _ (u_pos n) have B : {x | f x ≤ g x}ᶜ ⊆ ⋃ n, s n := by intro x hx - simp only [Set.mem_compl_iff, Set.mem_setOf, not_le] at hx + simp only [Set.mem_compl_iff, Set.mem_ofPred, not_le] at hx have L1 : ∀ᶠ n in atTop, g x + u n ≤ f x := by have : Tendsto (fun n => g x + u n) atTop (𝓝 (g x + (0 : ℝ≥0))) := tendsto_const_nhds.add (ENNReal.tendsto_coe.2 u_lim) diff --git a/Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean b/Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean index 6162320fd09227..8a5655b5f8714b 100644 --- a/Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean +++ b/Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean @@ -77,7 +77,7 @@ theorem MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets {α : Type change μ _ = 0 convert! this ext y - simp only [mem_setOf_eq, mem_compl_iff, not_notMem] + simp only [mem_ofPred_eq, mem_compl_iff, not_notMem] filter_upwards [this] with x hx apply (iInf_eq_of_forall_ge_of_forall_gt_exists_lt _ _).symm · intro i diff --git a/Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean b/Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean index 857b773485759a..7761a2be951858 100644 --- a/Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean +++ b/Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean @@ -32,7 +32,7 @@ variable {ι : Sort*} {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace /-- If we have the additional hypothesis `∀ᵐ x ∂μ, p x (fun n ↦ f n x)`, this is a measurable set whose complement has measure 0 such that for all `x ∈ aeSeqSet`, `f i x` is equal to `(hf i).mk (f i) x` for all `i` and we have the pointwise property `p x (fun n ↦ f n x)`. -/ -def aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : Set α := +noncomputable def aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : Set α := (toMeasurable μ { x | (∀ i, f i x = (hf i).mk (f i) x) ∧ p x fun n => f n x }ᶜ)ᶜ open scoped Classical in diff --git a/Mathlib/MeasureTheory/Function/AbsolutelyContinuous.lean b/Mathlib/MeasureTheory/Function/AbsolutelyContinuous.lean index eaecee77b5c49d..5ba2a331eda751 100644 --- a/Mathlib/MeasureTheory/Function/AbsolutelyContinuous.lean +++ b/Mathlib/MeasureTheory/Function/AbsolutelyContinuous.lean @@ -83,7 +83,7 @@ lemma hasBasis_totalLengthFilter : totalLengthFilter.HasBasis (fun (ε : ℝ) => {E : ℕ × (ℕ → X × X) | ∑ i ∈ Finset.range E.1, dist (E.2 i).1 (E.2 i).2 < ε}) := by convert! Filter.HasBasis.comap (α := ℝ) _ (nhds_basis_Ioo_pos _) using 1 ext ε E - simp only [mem_setOf_eq, zero_sub, zero_add, mem_preimage, mem_Ioo, iff_and_self] + simp only [mem_ofPred_eq, zero_sub, zero_add, mem_preimage, mem_Ioo, iff_and_self] suffices 0 ≤ ∑ i ∈ Finset.range E.1, dist (E.2 i).1 (E.2 i).2 by grind exact Finset.sum_nonneg (fun _ _ ↦ dist_nonneg) @@ -105,7 +105,7 @@ lemma disjWithin_mono {a b c d : ℝ} (habcd : uIcc c d ⊆ uIcc a b) : lemma uIoc_subset_of_mem_disjWithin {a b : ℝ} {n : ℕ} {I : ℕ → ℝ × ℝ} (hnI : (n, I) ∈ disjWithin a b) {i : ℕ} (hi : i < n) : uIoc (I i).1 (I i).2 ⊆ uIoc a b := by - simp only [disjWithin, Finset.mem_range, mem_setOf_eq, uIcc, mem_Icc] at hnI + simp only [disjWithin, Finset.mem_range, mem_ofPred_eq, uIcc, mem_Icc] at hnI grind lemma biUnion_uIoc_subset_of_mem_disjWithin {a b : ℝ} {n : ℕ} {I : ℕ → ℝ × ℝ} @@ -233,8 +233,8 @@ theorem uniformContinuousOn (hf : AbsolutelyContinuousOnInterval f a b) : · simp only [comap_inf, comap_principal] congr ext p - simp only [disjWithin, Finset.mem_range, preimage_setOf_eq, Nat.lt_one_iff, - forall_eq, mem_setOf_eq, mem_prod] + simp only [disjWithin, Finset.mem_range, preimage_ofPred_eq, Nat.lt_one_iff, + forall_eq, mem_ofPred_eq, mem_prod] simp · simp [totalLengthFilter, comap_comap, Function.comp_def] @@ -271,7 +271,7 @@ theorem smul {M : Type*} [SeminormedRing M] [Module M F] [NormSMulClass M F] trans dist (f (I i).1 • g (I i).1) (f (I i).1 • g (I i).2) + dist (f (I i).1 • g (I i).2) (f (I i).2 • g (I i).2) · exact dist_triangle _ _ _ - · simp only [disjWithin, mem_setOf_eq] at hnI + · simp only [disjWithin, mem_ofPred_eq] at hnI gcongr · rw [dist_smul₀] gcongr @@ -433,7 +433,7 @@ theorem _root_.IntervalIntegrable.absolutelyContinuousOnInterval_intervalIntegra E ∈ disjWithin a b := eventually_inf_principal.mpr (by simp) filter_upwards [this] with (n, I) hnI - obtain ⟨hnI1, hnI2⟩ := mem_setOf_eq ▸ hnI + obtain ⟨hnI1, hnI2⟩ := mem_ofPred_eq ▸ hnI simp only rw [← integral_norm_eq_lintegral_enorm (h.aestronglyMeasurable_restrict_uIoc.restrict), integral_biUnion_finset _ (by simp +contextual [uIoc]) hnI2] diff --git a/Mathlib/MeasureTheory/Function/ConditionalExpectation/AEMeasurable.lean b/Mathlib/MeasureTheory/Function/ConditionalExpectation/AEMeasurable.lean index 3fb364c2e5c72c..901ddf9ebb3292 100644 --- a/Mathlib/MeasureTheory/Function/ConditionalExpectation/AEMeasurable.lean +++ b/Mathlib/MeasureTheory/Function/ConditionalExpectation/AEMeasurable.lean @@ -96,11 +96,11 @@ variable {F 𝕜} theorem mem_lpMeasSubgroup_iff_aestronglyMeasurable {m m0 : MeasurableSpace α} {μ : Measure α} {f : Lp F p μ} : f ∈ lpMeasSubgroup F m p μ ↔ AEStronglyMeasurable[m] f μ := by - rw [← AddSubgroup.mem_carrier, lpMeasSubgroup, Set.mem_setOf_eq] + rw [← AddSubgroup.mem_carrier, lpMeasSubgroup, Set.mem_ofPred_eq] theorem mem_lpMeas_iff_aestronglyMeasurable {m m0 : MeasurableSpace α} {μ : Measure α} {f : Lp F p μ} : f ∈ lpMeas F 𝕜 m p μ ↔ AEStronglyMeasurable[m] f μ := by - rw [← SetLike.mem_coe, ← Submodule.mem_carrier, lpMeas, Set.mem_setOf_eq] + rw [← SetLike.mem_coe, ← Submodule.mem_carrier, lpMeas, Set.mem_ofPred_eq] theorem lpMeas.aestronglyMeasurable {m _ : MeasurableSpace α} {μ : Measure α} (f : lpMeas F 𝕜 m p μ) : AEStronglyMeasurable[m] (f : α → F) μ := @@ -419,19 +419,19 @@ theorem Lp.induction_stronglyMeasurable (hm : m ≤ m0) (hp_ne_top : p ≠ ∞) intro f g hf hg hfm hgm h_disj hPf hPg let s_f : Set α := Function.support (hfm.mk f) have hs_f : MeasurableSet[m] s_f := hfm.stronglyMeasurable_mk.measurableSet_support - have hs_f_eq : s_f =ᵐ[μ] Function.support f := hfm.ae_eq_mk.symm.support + have hs_f_eq : s_f =ᵐˢ[μ] Function.support f := hfm.ae_eq_mk.symm.support let s_g : Set α := Function.support (hgm.mk g) have hs_g : MeasurableSet[m] s_g := hgm.stronglyMeasurable_mk.measurableSet_support - have hs_g_eq : s_g =ᵐ[μ] Function.support g := hgm.ae_eq_mk.symm.support - have h_inter_empty : (s_f ∩ s_g : Set α) =ᵐ[μ] (∅ : Set α) := by + have hs_g_eq : s_g =ᵐˢ[μ] Function.support g := hgm.ae_eq_mk.symm.support + have h_inter_empty : (s_f ∩ s_g : Set α) =ᵐˢ[μ] (∅ : Set α) := by refine (hs_f_eq.inter hs_g_eq).trans ?_ suffices Function.support f ∩ Function.support g = ∅ by rw [this] exact Set.disjoint_iff_inter_eq_empty.mp h_disj let f' := (s_f \ s_g).indicator (hfm.mk f) have hff' : f =ᵐ[μ] f' := by - have : s_f \ s_g =ᵐ[μ] s_f := by + have : s_f \ s_g =ᵐˢ[μ] s_f := by rw [← Set.sdiff_inter_self_eq_sdiff, Set.inter_comm] - refine ((ae_eq_refl s_f).diff h_inter_empty).trans ?_ + refine ((ae_eq_refl (· ∈ s_f)).diff h_inter_empty).trans ?_ rw [Set.sdiff_empty] refine ((indicator_ae_eq_of_ae_eq_set this).trans ?_).symm rw [Set.indicator_support] @@ -440,9 +440,9 @@ theorem Lp.induction_stronglyMeasurable (hm : m ≤ m0) (hp_ne_top : p ≠ ∞) have hf'_Lp : MemLp f' p μ := hf.ae_eq hff' let g' := (s_g \ s_f).indicator (hgm.mk g) have hgg' : g =ᵐ[μ] g' := by - have : s_g \ s_f =ᵐ[μ] s_g := by + have : s_g \ s_f =ᵐˢ[μ] s_g := by rw [← Set.sdiff_inter_self_eq_sdiff] - refine ((ae_eq_refl s_g).diff h_inter_empty).trans ?_ + refine ((ae_eq_refl (· ∈ s_g)).diff h_inter_empty).trans ?_ rw [Set.sdiff_empty] refine ((indicator_ae_eq_of_ae_eq_set this).trans ?_).symm rw [Set.indicator_support] diff --git a/Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean b/Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean index 24c3958e3457f9..58c792403511d1 100644 --- a/Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean +++ b/Mathlib/MeasureTheory/Function/ConditionalExpectation/Real.lean @@ -169,7 +169,7 @@ theorem ae_bdd_condExp_of_ae_bdd {R : ℝ≥0} {f : α → ℝ} (hbdd : ∀ᵐ x exact (abs_nonneg _).trans hx by_contra h change μ _ ≠ 0 at h - simp only [← pos_iff_ne_zero, Set.compl_def, Set.mem_setOf_eq, not_le] at h + simp only [← pos_iff_ne_zero, Set.compl_def, Set.mem_ofPred_eq, not_le] at h suffices μ.real {x | ↑R < |(μ[f|m]) x|} * ↑R < μ.real {x | ↑R < |(μ[f|m]) x|} * ↑R by exact this.ne rfl refine lt_of_lt_of_le (setIntegral_gt_gt R.coe_nonneg ?_ h.ne') ?_ diff --git a/Mathlib/MeasureTheory/Function/ConvergenceInMeasure.lean b/Mathlib/MeasureTheory/Function/ConvergenceInMeasure.lean index f148a1ad721cb9..41ea198ef0dd05 100644 --- a/Mathlib/MeasureTheory/Function/ConvergenceInMeasure.lean +++ b/Mathlib/MeasureTheory/Function/ConvergenceInMeasure.lean @@ -177,7 +177,6 @@ protected theorem congr' (h_left : ∀ᶠ i in l, f i =ᵐ[μ] f' i) (h_right : refine measure_congr ?_ filter_upwards [h_ae_eq, h_right] with x hxf hxg rw [eq_iff_iff] - change ε ≤ edist (f' i x) (g' x) ↔ ε ≤ edist (f i x) (g x) rw [hxg, hxf] protected theorem congr (h_left : ∀ i, f i =ᵐ[μ] f' i) (h_right : g =ᵐ[μ] g') @@ -216,7 +215,7 @@ theorem tendstoInMeasure_of_tendsto_ae_of_measurable_edist [IsFiniteMeasure μ] suffices { x : α | ε ≤ edist (f n x) (g x) } ⊆ t from (measure_mono this).trans ht rw [← Set.compl_subset_compl] intro x hx - rw [Set.mem_compl_iff, Set.notMem_setOf_iff, edist_comm, not_le] + rw [Set.mem_compl_iff, Set.notMem_ofPred_iff, edist_comm, not_le] exact hN n hn x hx /-- Convergence a.e. implies convergence in measure in a finite measure space. -/ @@ -302,7 +301,7 @@ theorem TendstoInMeasure.exists_seq_tendsto_ae (hfg : TendstoInMeasure μ f atTo refine fun x hx => EMetric.tendsto_atTop.mpr fun ε hε => ?_ rw [hs, limsup_eq_iInf_iSup_of_nat] at hx simp only [S, Set.iSup_eq_iUnion, Set.iInf_eq_iInter, Set.compl_iInter, Set.compl_iUnion, - Set.mem_iUnion, Set.mem_iInter, Set.mem_compl_iff, Set.mem_setOf_eq, not_le] at hx + Set.mem_iUnion, Set.mem_iInter, Set.mem_compl_iff, Set.mem_ofPred_eq, not_le] at hx obtain ⟨N, hNx⟩ := hx obtain ⟨k, hk_lt_ε⟩ := h_lt_ε_real ε hε refine ⟨max N (k - 1), fun n hn_ge => lt_of_le_of_lt ?_ hk_lt_ε⟩ @@ -318,7 +317,7 @@ theorem TendstoInMeasure.exists_seq_tendsto_ae (hfg : TendstoInMeasure μ f atTo exact le_trans hNx.le h_inv_n_le_k rw [ae_iff] refine ⟨ExistsSeqTendstoAe.seqTendstoAeSeq_strictMono hfg, measure_mono_null (fun x => ?_) hμs⟩ - rw [Set.mem_setOf_eq, ← @Classical.not_not (x ∈ s), not_imp_not] + rw [Set.mem_ofPred_eq, ← @Classical.not_not (x ∈ s), not_imp_not] exact h_tendsto x theorem TendstoInMeasure.exists_seq_tendstoInMeasure_atTop {u : Filter ι} [NeBot u] diff --git a/Mathlib/MeasureTheory/Function/Egorov.lean b/Mathlib/MeasureTheory/Function/Egorov.lean index 3788930266fdf1..c082381b5d8e03 100644 --- a/Mathlib/MeasureTheory/Function/Egorov.lean +++ b/Mathlib/MeasureTheory/Function/Egorov.lean @@ -49,7 +49,7 @@ variable {n : ℕ} {j : ι} {s : Set α} {ε : ℝ} {f : ι → α → β} {g : theorem mem_notConvergentSeq_iff [Preorder ι] {x : α} : x ∈ notConvergentSeq f g n j ↔ ∃ k ≥ j, (n : ℝ≥0∞)⁻¹ < edist (f k x) (g x) := by - simp_rw [notConvergentSeq, Set.mem_iUnion, exists_prop, mem_setOf] + simp_rw [notConvergentSeq, Set.mem_iUnion, exists_prop, mem_ofPred] theorem notConvergentSeq_antitone [Preorder ι] : Antitone (notConvergentSeq f g n) := fun _ _ hjk => Set.iUnion₂_mono' fun l hl => ⟨l, le_trans hjk hl, Set.Subset.rfl⟩ diff --git a/Mathlib/MeasureTheory/Function/EssSup.lean b/Mathlib/MeasureTheory/Function/EssSup.lean index daae5e3c3a3c57..f5bbf0cc0ef88c 100644 --- a/Mathlib/MeasureTheory/Function/EssSup.lean +++ b/Mathlib/MeasureTheory/Function/EssSup.lean @@ -369,9 +369,9 @@ theorem essSup_liminf_le {ι} [Countable ι] [Preorder ι] (f : ι → α → theorem coe_essSup {f : α → ℝ≥0} (hf : IsBoundedUnder (· ≤ ·) (ae μ) f) : ((essSup f μ : ℝ≥0) : ℝ≥0∞) = essSup (fun x => (f x : ℝ≥0∞)) μ := - (ENNReal.coe_sInf <| hf).trans <| + (ENNReal.coe_sInf (s := {a | ∀ᶠ n in Filter.map f (ae μ), n ≤ a}) hf).trans <| eq_of_forall_le_iff fun r => by - simp [essSup, limsup, limsSup, eventually_map, ENNReal.forall_ennreal]; rfl + simp [essSup, limsup, limsSup, eventually_map, ENNReal.forall_ennreal] lemma ofReal_essSup {f : α → ℝ} (h₁ : IsCoboundedUnder (· ≤ ·) (ae μ) f) (h₂ : IsBoundedUnder (· ≤ ·) (ae μ) f) : diff --git a/Mathlib/MeasureTheory/Function/Intersectivity.lean b/Mathlib/MeasureTheory/Function/Intersectivity.lean index 37866f81f6c846..caa14504cf0229 100644 --- a/Mathlib/MeasureTheory/Function/Intersectivity.lean +++ b/Mathlib/MeasureTheory/Function/Intersectivity.lean @@ -56,7 +56,7 @@ lemma bergelson' {s : ℕ → Set α} (hs : ∀ n, MeasurableSet (s n)) (hr₀ : simp_rw [pos_iff_ne_zero] rintro ⟨x, hx⟩ hu refine hx.2 (mem_iUnion.2 ⟨u, ?_⟩) - rw [mem_setOf, indicator_of_mem hx.1, eLpNormEssSup_eq_zero_iff.2] + rw [mem_ofPred, indicator_of_mem hx.1, eLpNormEssSup_eq_zero_iff.2] · simp · rwa [indicator_ae_eq_zero, Function.support_one, inter_univ] -- Define `f n` to be the average of the first `n + 1` indicators of the `s k`. diff --git a/Mathlib/MeasureTheory/Function/Jacobian.lean b/Mathlib/MeasureTheory/Function/Jacobian.lean index 4df52b8c00a28a..42b94465f6d57f 100644 --- a/Mathlib/MeasureTheory/Function/Jacobian.lean +++ b/Mathlib/MeasureTheory/Function/Jacobian.lean @@ -655,7 +655,8 @@ theorem addHaar_image_eq_zero_of_det_fderivWithin_eq_zero have A : ∀ (ε : ℝ≥0), 0 < ε → μ (f '' (s ∩ closedBall 0 R)) ≤ ε * μ (closedBall 0 R) := fun ε εpos => addHaar_image_eq_zero_of_det_fderivWithin_eq_zero_aux μ - (fun x hx => (hf' x hx.1).mono inter_subset_left) R inter_subset_right ε εpos + (fun x (hx : x ∈ s ∩ closedBall 0 R) => (hf' x hx.1).mono inter_subset_left) R + inter_subset_right ε εpos fun x hx => h'f' x hx.1 have B : Tendsto (fun ε : ℝ≥0 => (ε : ℝ≥0∞) * μ (closedBall 0 R)) (𝓝[>] 0) (𝓝 0) := by have : @@ -767,7 +768,7 @@ theorem nullMeasurable_image_of_fderivWithin (hs : NullMeasurableSet s μ) (hf' : ∀ x ∈ s, HasFDerivWithinAt f (f' x) s x) (hf : InjOn f s) : NullMeasurableSet (f '' s) μ := by rcases hs.exists_measurable_subset_ae_eq with ⟨t, ts, ht, t_eq_s⟩ - have A : f '' s =ᵐ[μ] f '' t := by + have A : f '' s =ᵐˢ[μ] f '' t := by have : s = t ∪ (s \ t) := by simp [union_eq_self_of_subset_left ts] rw [this, image_union] refine union_ae_eq_left_of_ae_eq_empty (ae_eq_empty.mpr ?_) diff --git a/Mathlib/MeasureTheory/Function/JacobianOneDim.lean b/Mathlib/MeasureTheory/Function/JacobianOneDim.lean index c7a11c2bb0c144..35d43c5d0e9acf 100644 --- a/Mathlib/MeasureTheory/Function/JacobianOneDim.lean +++ b/Mathlib/MeasureTheory/Function/JacobianOneDim.lean @@ -84,11 +84,11 @@ theorem exists_decomposition_of_monotoneOn_hasDerivWithinAt (hs : MeasurableSet (∀ x ∈ b, f' x = 0) ∧ (∀ x ∈ c, 0 ≤ f' x) ∧ InjOn f c := by let a := {x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥} ∪ {x ∈ s | 𝓝[s ∩ Iio x] x = ⊥} have a_count : a.Countable := - countable_setOf_isolated_right_within.union countable_setOf_isolated_left_within + countable_setOfPred_isolated_right_within.union countable_setOfPred_isolated_left_within let s₁ := s \ a have hs₁ : MeasurableSet s₁ := hs.diff a_count.measurableSet let u : Set ℝ := {c | ∃ x y, x ∈ s₁ ∧ y ∈ s₁ ∧ x < y ∧ f x = c ∧ f y = c} - have hu : Set.Countable u := MonotoneOn.countable_setOf_two_preimages (hf.mono sdiff_subset) + have hu : Set.Countable u := MonotoneOn.countable_setOfPred_two_preimages (hf.mono sdiff_subset) let b := s₁ ∩ f ⁻¹' u have hb : MeasurableSet b := by have : b = ⋃ z ∈ u, s₁ ∩ f ⁻¹' {z} := by ext; simp [b] @@ -101,7 +101,7 @@ theorem exists_decomposition_of_monotoneOn_hasDerivWithinAt (hs : MeasurableSet have hc : MeasurableSet c := hs₁.diff hb refine ⟨a, b, c, ?_, a_count.measurableSet, hb, hc, ?_, ?_, a_count, ?_, ?_, ?_, ?_⟩ · ext x - simp only [sdiff_self_inter, inter_union_sdiff, union_sdiff_self, mem_union, mem_setOf_eq, + simp only [sdiff_self_inter, inter_union_sdiff, union_sdiff_self, mem_union, mem_ofPred_eq, or_iff_right_iff_imp, a, b, s₁, c] tauto · simpa [b, c, s₁] using disjoint_sdiff_right @@ -135,7 +135,7 @@ theorem exists_decomposition_of_monotoneOn_hasDerivWithinAt (hs : MeasurableSet have J2 : 𝓝[s ∩ Ioo p x] x = 𝓝[s ∩ Iio x] x := by simp [nhdsWithin_inter, nhdsWithin_Ioo_eq_nhdsLT px] rw [uniqueDiffWithinAt_iff_accPt, accPt_principal_iff_nhdsWithin, J1, J2] - simp only [mem_inter_iff, Set.mem_sdiff, hx.1.1, mem_union, mem_setOf_eq, true_and, not_or, + simp only [mem_inter_iff, Set.mem_sdiff, hx.1.1, mem_union, mem_ofPred_eq, true_and, not_or, mem_preimage, b, s₁, a] at hx exact neBot_iff.2 hx.1.2 · have K : HasDerivWithinAt f 0 (s ∩ Ioo x p) x := by @@ -153,14 +153,14 @@ theorem exists_decomposition_of_monotoneOn_hasDerivWithinAt (hs : MeasurableSet have J2 : 𝓝[s ∩ Ioo x p] x = 𝓝[s ∩ Ioi x] x := by simp [nhdsWithin_inter, nhdsWithin_Ioo_eq_nhdsGT px] rw [uniqueDiffWithinAt_iff_accPt, accPt_principal_iff_nhdsWithin, J1, J2] - simp only [mem_inter_iff, Set.mem_sdiff, hx.1.1, mem_union, mem_setOf_eq, true_and, not_or, + simp only [mem_inter_iff, Set.mem_sdiff, hx.1.1, mem_union, mem_ofPred_eq, true_and, not_or, mem_preimage, b, s₁, a] at hx exact neBot_iff.2 hx.1.1 · /- We have to show that the derivative is nonnegative at points of `c`. As these points are not isolated in `s`, this follows from the fact that `f` is monotone on `s`. -/ intro x hx apply (hf' x hx.1.1).nonneg_of_monotoneOn _ hf - simp only [Set.mem_sdiff, hx.1.1, mem_union, mem_setOf_eq, true_and, not_or, c, s₁, a, b] at hx + simp only [Set.mem_sdiff, hx.1.1, mem_union, mem_ofPred_eq, true_and, not_or, c, s₁, a, b] at hx rw [accPt_principal_iff_nhdsWithin] have : (𝓝[s ∩ Iio x] x).NeBot := neBot_iff.2 hx.1.2 apply this.mono @@ -195,10 +195,10 @@ theorem lintegral_image_eq_lintegral_deriv_mul_of_monotoneOn (hs : MeasurableSet have J : ∫⁻ x in f '' s, u x = ∫⁻ x in f '' c, u x := by apply setLIntegral_congr rw [← h_union, image_union, image_union] - have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐ[volume] (f '' b ∪ f '' c : Set ℝ) := by + have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐˢ[volume] (f '' b ∪ f '' c : Set ℝ) := by refine union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr ?_) exact (a_count.image _).measure_zero _ - have B : (f '' b ∪ f '' c : Set ℝ) =ᵐ[volume] f '' c := + have B : (f '' b ∪ f '' c : Set ℝ) =ᵐˢ[volume] f '' c := union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr (fb_count.measure_zero _)) exact A.trans B rw [I, J] @@ -243,10 +243,10 @@ theorem integrableOn_image_iff_integrableOn_deriv_smul_of_monotoneOn (hs : Measu have J : IntegrableOn g (f '' s) ↔ IntegrableOn g (f '' c) := by apply integrableOn_congr_set_ae rw [← h_union, image_union, image_union] - have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐ[volume] (f '' b ∪ f '' c : Set ℝ) := by + have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐˢ[volume] (f '' b ∪ f '' c : Set ℝ) := by refine union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr ?_) exact (a_count.image _).measure_zero _ - have B : (f '' b ∪ f '' c : Set ℝ) =ᵐ[volume] f '' c := + have B : (f '' b ∪ f '' c : Set ℝ) =ᵐˢ[volume] f '' c := union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr (fb_count.measure_zero _)) exact A.trans B rw [I, J] @@ -288,10 +288,10 @@ theorem integral_image_eq_integral_deriv_smul_of_monotoneOn (hs : MeasurableSet have J : ∫ x in f '' s, g x = ∫ x in f '' c, g x := by apply setIntegral_congr_set rw [← h_union, image_union, image_union] - have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐ[volume] (f '' b ∪ f '' c : Set ℝ) := by + have A : (f '' a ∪ (f '' b ∪ f '' c) : Set ℝ) =ᵐˢ[volume] (f '' b ∪ f '' c : Set ℝ) := by refine union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr ?_) exact (a_count.image _).measure_zero _ - have B : (f '' b ∪ f '' c : Set ℝ) =ᵐ[volume] f '' c := + have B : (f '' b ∪ f '' c : Set ℝ) =ᵐˢ[volume] f '' c := union_ae_eq_right_of_ae_eq_empty (ae_eq_empty.mpr (fb_count.measure_zero _)) exact A.trans B rw [I, J] diff --git a/Mathlib/MeasureTheory/Function/L1Space/Integrable.lean b/Mathlib/MeasureTheory/Function/L1Space/Integrable.lean index cc312fd5c05404..edffc341d175a9 100644 --- a/Mathlib/MeasureTheory/Function/L1Space/Integrable.lean +++ b/Mathlib/MeasureTheory/Function/L1Space/Integrable.lean @@ -685,14 +685,15 @@ lemma Integrable.measure_norm_gt_lt_top_enorm {E : Type*} [TopologicalSpace E] [ {f : α → E} (hf : Integrable f μ) {ε : ℝ≥0∞} (hε : 0 < ε) : μ {x | ε < ‖f x‖ₑ} < ∞ := by by_cases hε' : ε = ∞ · simp [hε'] - exact lt_of_le_of_lt (measure_mono (fun _ h ↦ (Set.mem_setOf_eq ▸ h).le)) + exact lt_of_le_of_lt (measure_mono (fun _ h ↦ (Set.mem_ofPred_eq ▸ h).le)) (hf.measure_enorm_ge_lt_top hε hε') /-- A non-quantitative version of Markov inequality for integrable functions: the measure of points where `‖f x‖ > ε` is finite for all positive `ε`. -/ lemma Integrable.measure_norm_gt_lt_top {f : α → β} (hf : Integrable f μ) {ε : ℝ} (hε : 0 < ε) : μ {x | ε < ‖f x‖} < ∞ := - lt_of_le_of_lt (measure_mono (fun _ h ↦ (Set.mem_setOf_eq ▸ h).le)) (hf.measure_norm_ge_lt_top hε) + lt_of_le_of_lt (measure_mono (fun _ h ↦ (Set.mem_ofPred_eq ▸ h).le)) + (hf.measure_norm_ge_lt_top hε) /-- If `f` is integrable, then for any `c > 0` the set `{x | f x ≥ c}` has finite measure. -/ @@ -718,7 +719,7 @@ measure. -/ lemma Integrable.measure_gt_lt_top {f : α → β} [Lattice β] [HasSolidNorm β] [AddLeftMono β] (hf : Integrable f μ) {ε : β} (ε_pos : 0 < ε) : μ {a : α | ε < f a} < ∞ := - lt_of_le_of_lt (measure_mono (fun _ hx ↦ (Set.mem_setOf_eq ▸ hx).le)) + lt_of_le_of_lt (measure_mono (fun _ hx ↦ (Set.mem_ofPred_eq ▸ hx).le)) (Integrable.measure_ge_lt_top hf ε_pos) /-- If `f` is `ℝ`-valued and integrable, then for any `c < 0` the set `{x | f x < c}` has finite @@ -726,7 +727,7 @@ measure. -/ lemma Integrable.measure_lt_lt_top {f : α → β} [Lattice β] [HasSolidNorm β] [AddLeftMono β] (hf : Integrable f μ) {c : β} (c_neg : c < 0) : μ {a : α | f a < c} < ∞ := - lt_of_le_of_lt (measure_mono (fun _ hx ↦ (Set.mem_setOf_eq ▸ hx).le)) + lt_of_le_of_lt (measure_mono (fun _ hx ↦ (Set.mem_ofPred_eq ▸ hx).le)) (Integrable.measure_le_lt_top hf c_neg) theorem LipschitzWith.integrable_comp_iff_of_antilipschitz {K K'} {f : α → β} {g : β → γ} diff --git a/Mathlib/MeasureTheory/Function/LocallyIntegrable.lean b/Mathlib/MeasureTheory/Function/LocallyIntegrable.lean index 14d1260b68cf3c..0d6e307f7044e7 100644 --- a/Mathlib/MeasureTheory/Function/LocallyIntegrable.lean +++ b/Mathlib/MeasureTheory/Function/LocallyIntegrable.lean @@ -521,7 +521,9 @@ theorem integrableOn_Iic_iff_integrableAtFilter_atBot [LinearOrder X] [CompactIc refine ⟨fun h ↦ ⟨⟨Iic a, Iic_mem_atBot a, h⟩, h.locallyIntegrableOn⟩, fun ⟨⟨s, hsl, hs⟩, h⟩ ↦ ?_⟩ haveI : Nonempty X := Nonempty.intro a obtain ⟨a', ha'⟩ := mem_atBot_sets.mp hsl - refine (integrableOn_union.mpr ⟨hs.mono ha' le_rfl, ?_⟩).mono Iic_subset_Iic_union_Icc le_rfl + have ha'' : Iic a' ⊆ s := fun b hb ↦ ha' b hb + refine (integrableOn_union.mpr ⟨hs.mono ha'' le_rfl, ?_⟩).mono + Iic_subset_Iic_union_Icc le_rfl exact h.integrableOn_compact_subset Icc_subset_Iic_self isCompact_Icc theorem integrableOn_Ici_iff_integrableAtFilter_atTop [LinearOrder X] [CompactIccSpace X] : diff --git a/Mathlib/MeasureTheory/Function/LpSeminorm/Indicator.lean b/Mathlib/MeasureTheory/Function/LpSeminorm/Indicator.lean index 4bfab0e33c6d3a..1540b803fae179 100644 --- a/Mathlib/MeasureTheory/Function/LpSeminorm/Indicator.lean +++ b/Mathlib/MeasureTheory/Function/LpSeminorm/Indicator.lean @@ -83,7 +83,7 @@ lemma eLpNormEssSup_indicator_const_eq (s : Set α) (c : ε) (hμs : μ s ≠ 0) have h' := ae_iff.mp (ae_lt_of_essSup_lt h) push Not at h' refine hμs (measure_mono_null (fun x hx_mem => ?_) h') - rw [Set.mem_setOf_eq, Set.indicator_of_mem hx_mem] + rw [Set.mem_ofPred_eq, Set.indicator_of_mem hx_mem] lemma eLpNorm_indicator_const₀ (hs : NullMeasurableSet s μ) (hp : p ≠ 0) (hp_top : p ≠ ∞) : eLpNorm (s.indicator fun _ => c) p μ = ‖c‖ₑ * μ s ^ (1 / p.toReal) := diff --git a/Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean b/Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean index 5e0ecf96434ff7..f1d6a55299a0e2 100644 --- a/Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean +++ b/Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean @@ -37,7 +37,7 @@ theorem limsup_trim (hm : m ≤ m0) {f : α → ℝ≥0∞} (hf : Measurable[m] rw [h_set_eq] ext1 a suffices h_meas_eq : μ { x | ¬f x ≤ a } = μ.trim hm { x | ¬f x ≤ a } by - simp_rw [Set.mem_setOf_eq, ae_iff, h_meas_eq] + simp_rw [Set.mem_ofPred_eq, ae_iff, h_meas_eq] refine (trim_measurableSet_eq hm ?_).symm exact (measurableSet_le hf measurable_const).compl diff --git a/Mathlib/MeasureTheory/Function/LpSpace/Basic.lean b/Mathlib/MeasureTheory/Function/LpSpace/Basic.lean index da03fba965ce30..155f06b044e266 100644 --- a/Mathlib/MeasureTheory/Function/LpSpace/Basic.lean +++ b/Mathlib/MeasureTheory/Function/LpSpace/Basic.lean @@ -93,7 +93,7 @@ def Lp {α} (E : Type*) {m : MeasurableSpace α} [NormedAddCommGroup E] (p : ℝ add_mem' {f g} hf hg := by simp [eLpNorm_congr_ae (AEEqFun.coeFn_add f g), eLpNorm_add_lt_top ⟨f.aestronglyMeasurable, hf⟩ ⟨g.aestronglyMeasurable, hg⟩] - neg_mem' {f} hf := by rwa [Set.mem_setOf_eq, eLpNorm_congr_ae (AEEqFun.coeFn_neg f), eLpNorm_neg] + neg_mem' {f} hf := by rwa [Set.mem_ofPred_eq, eLpNorm_congr_ae (AEEqFun.coeFn_neg f), eLpNorm_neg] /-- `α →₁[μ] E` is the type of `L¹` or integrable functions from `α` to `E`. -/ scoped notation:25 α' " →₁[" μ "] " E => MeasureTheory.Lp (α := α') E 1 μ diff --git a/Mathlib/MeasureTheory/Function/LpSpace/Indicator.lean b/Mathlib/MeasureTheory/Function/LpSpace/Indicator.lean index a3afde2ca260c0..95c9ae19bbcb36 100644 --- a/Mathlib/MeasureTheory/Function/LpSpace/Indicator.lean +++ b/Mathlib/MeasureTheory/Function/LpSpace/Indicator.lean @@ -200,7 +200,7 @@ theorem indicatorConstLp_empty : theorem indicatorConstLp_inj {s t : Set α} (hs : MeasurableSet s) (hsμ : μ s ≠ ∞) (ht : MeasurableSet t) (htμ : μ t ≠ ∞) {c : E} (hc : c ≠ 0) : - indicatorConstLp p hs hsμ c = indicatorConstLp p ht htμ c ↔ s =ᵐ[μ] t := by + indicatorConstLp p hs hsμ c = indicatorConstLp p ht htμ c ↔ s =ᵐˢ[μ] t := by simp_rw [← indicator_const_eventuallyEq hc, indicatorConstLp, MemLp.toLp_eq_toLp_iff] theorem memLp_add_of_disjoint {f g : α → E} (h : Disjoint (support f) (support g)) diff --git a/Mathlib/MeasureTheory/Function/SimpleFunc.lean b/Mathlib/MeasureTheory/Function/SimpleFunc.lean index 3778440c72a4c4..6ae3f687f1ff2a 100644 --- a/Mathlib/MeasureTheory/Function/SimpleFunc.lean +++ b/Mathlib/MeasureTheory/Function/SimpleFunc.lean @@ -831,7 +831,7 @@ theorem approx_apply [TopologicalSpace β] [OrderClosedTopology β] [MeasurableS congr funext k rw [restrict_apply] - · simp only [coe_const, mem_setOf_eq, indicator_apply, Function.const_apply] + · simp only [coe_const, mem_ofPred_eq, indicator_apply, Function.const_apply] · exact hf measurableSet_Ici theorem monotone_approx (i : ℕ → β) (f : α → β) : Monotone (approx i f) := fun _ _ h => diff --git a/Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean b/Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean index 26cd321dd22ecd..1dd508c9cc7cc5 100644 --- a/Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean +++ b/Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean @@ -726,7 +726,7 @@ theorem denseRange_coeSimpleFuncNonnegToLpNonneg [hp : Fact (1 ≤ p)] (hp_ne_to have hg_memLp : MemLp (g : α → G) p μ := Lp.memLp (g : Lp G p μ) have zero_mem : (0 : G) ∈ (range (g : α → G) ∪ {0} : Set G) ∩ { y | 0 ≤ y } := by simp only [union_singleton, mem_inter_iff, mem_insert_iff, true_or, - mem_setOf_eq, le_refl, and_self_iff] + mem_ofPred_eq, le_refl, and_self_iff] have : SeparableSpace ((range (g : α → G) ∪ {0}) ∩ { y | 0 ≤ y } : Set G) := by apply IsSeparable.separableSpace apply IsSeparable.mono _ Set.inter_subset_left diff --git a/Mathlib/MeasureTheory/Function/StronglyMeasurable/AEStronglyMeasurable.lean b/Mathlib/MeasureTheory/Function/StronglyMeasurable/AEStronglyMeasurable.lean index 2159a038b2d446..f664ce47836008 100644 --- a/Mathlib/MeasureTheory/Function/StronglyMeasurable/AEStronglyMeasurable.lean +++ b/Mathlib/MeasureTheory/Function/StronglyMeasurable/AEStronglyMeasurable.lean @@ -573,7 +573,6 @@ theorem nullMeasurableSet_eq_fun {E} [TopologicalSpace E] [MetrizableSpace E] {f (hf.stronglyMeasurable_mk.measurableSet_eq_fun hg.stronglyMeasurable_mk).nullMeasurableSet.congr filter_upwards [hf.ae_eq_mk, hg.ae_eq_mk] with x hfx hgx - change (hf.mk f x = hg.mk g x) = (f x = g x) simp only [hfx, hgx] @[to_additive] @@ -587,7 +586,6 @@ theorem nullMeasurableSet_lt [Preorder β] [OrderClosedTopology β] [PseudoMetri apply (hf.stronglyMeasurable_mk.measurableSet_lt hg.stronglyMeasurable_mk).nullMeasurableSet.congr filter_upwards [hf.ae_eq_mk, hg.ae_eq_mk] with x hfx hgx - change (hf.mk f x < hg.mk g x) = (f x < g x) simp only [hfx, hgx] theorem nullMeasurableSet_le [Preorder β] [OrderClosedTopology β] [PseudoMetrizableSpace β] @@ -596,7 +594,6 @@ theorem nullMeasurableSet_le [Preorder β] [OrderClosedTopology β] [PseudoMetri apply (hf.stronglyMeasurable_mk.measurableSet_le hg.stronglyMeasurable_mk).nullMeasurableSet.congr filter_upwards [hf.ae_eq_mk, hg.ae_eq_mk] with x hfx hgx - change (hf.mk f x ≤ hg.mk g x) = (f x ≤ g x) simp only [hfx, hgx] theorem _root_.aestronglyMeasurable_of_aestronglyMeasurable_trim {α} {m m0 : MeasurableSpace α} @@ -947,7 +944,7 @@ theorem exists_set_sigmaFinite (hf : AEFinStronglyMeasurable f μ) : exact Eventually.of_forall hgt_zero /-- A measurable set `t` such that `f =ᵐ[μ.restrict tᶜ] 0` and `sigma_finite (μ.restrict t)`. -/ -def sigmaFiniteSet (hf : AEFinStronglyMeasurable f μ) : Set α := +noncomputable def sigmaFiniteSet (hf : AEFinStronglyMeasurable f μ) : Set α := hf.exists_set_sigmaFinite.choose protected theorem measurableSet (hf : AEFinStronglyMeasurable f μ) : diff --git a/Mathlib/MeasureTheory/Function/StronglyMeasurable/Basic.lean b/Mathlib/MeasureTheory/Function/StronglyMeasurable/Basic.lean index 3258e70d0b2e8f..42b43c83acee0f 100644 --- a/Mathlib/MeasureTheory/Function/StronglyMeasurable/Basic.lean +++ b/Mathlib/MeasureTheory/Function/StronglyMeasurable/Basic.lean @@ -423,12 +423,12 @@ protected theorem inv₀ [GroupWithZero β] [ContinuousInv₀ β] [MetrizableSpa refine ⟨fun n => ((hf.approx n).restrict {x | f x ≠ 0})⁻¹, fun x => ?_⟩ have : MeasurableSet {x | f x ≠ 0} := ((MeasurableSet.singleton 0).preimage hf.measurable).compl by_cases h : f x = 0 - · simp_all only [ne_eq, measurableSet_setOf, SimpleFunc.coe_inv, SimpleFunc.coe_restrict, - Pi.inv_apply, mem_setOf_eq, not_true_eq_false, not_false_eq_true, indicator_of_notMem, + · simp_all only [ne_eq, measurableSet_setOfPred, SimpleFunc.coe_inv, SimpleFunc.coe_restrict, + Pi.inv_apply, mem_ofPred_eq, not_true_eq_false, not_false_eq_true, indicator_of_notMem, _root_.inv_zero] exact tendsto_const_nhds - · simp_all only [ne_eq, measurableSet_setOf, SimpleFunc.coe_inv, SimpleFunc.coe_restrict, - Pi.inv_apply, mem_setOf_eq, not_false_eq_true, indicator_of_mem] + · simp_all only [ne_eq, measurableSet_setOfPred, SimpleFunc.coe_inv, SimpleFunc.coe_restrict, + Pi.inv_apply, mem_ofPred_eq, not_false_eq_true, indicator_of_mem] apply (hf.tendsto_approx x).inv₀ h @[to_additive (attr := to_fun (attr := fun_prop)) sub] @@ -450,11 +450,11 @@ theorem div [GroupWithZero β] [ContinuousMul β] [ContinuousInv₀ β] [Metriza refine ⟨fun n => hf.approx n / (hg.approx n).restrict {x | g x ≠ 0}, fun x => ?_⟩ have : MeasurableSet {x | g x ≠ 0} := ((MeasurableSet.singleton 0).preimage hg.measurable).compl by_cases h : g x = 0 - · simp_all only [ne_eq, SimpleFunc.coe_div, SimpleFunc.coe_restrict, Pi.div_apply, mem_setOf_eq, + · simp_all only [ne_eq, SimpleFunc.coe_div, SimpleFunc.coe_restrict, Pi.div_apply, mem_ofPred_eq, not_true_eq_false, not_false_eq_true, indicator_of_notMem, _root_.div_zero] exact tendsto_const_nhds · simp_all only [ne_eq, SimpleFunc.coe_div, SimpleFunc.coe_restrict, - Pi.div_apply, mem_setOf_eq, not_false_eq_true, indicator_of_mem] + Pi.div_apply, mem_ofPred_eq, not_false_eq_true, indicator_of_mem] exact (hf.tendsto_approx x).div (hg.tendsto_approx x) h @[to_additive] diff --git a/Mathlib/MeasureTheory/Function/StronglyMeasurable/Lemmas.lean b/Mathlib/MeasureTheory/Function/StronglyMeasurable/Lemmas.lean index f861c5f6d0e688..77f935aff7bc7b 100644 --- a/Mathlib/MeasureTheory/Function/StronglyMeasurable/Lemmas.lean +++ b/Mathlib/MeasureTheory/Function/StronglyMeasurable/Lemmas.lean @@ -98,7 +98,7 @@ theorem aestronglyMeasurable_withDensity_iff {E : Type*} [NormedAddCommGroup E] have : (f a : ℝ≥0∞) ≠ 0 := by simpa only [Ne, ENNReal.coe_eq_zero] using h'a rw [ha this] · filter_upwards [ae_restrict_mem A.compl] with x hx - simp only [Classical.not_not, mem_setOf_eq, mem_compl_iff] at hx + simp only [Classical.not_not, mem_ofPred_eq, mem_compl_iff] at hx simp [hx] · rintro ⟨g', g'meas, hg'⟩ refine ⟨fun x => (f x : ℝ)⁻¹ • g' x, hf.coe_nnreal_real.inv.stronglyMeasurable.smul g'meas, ?_⟩ diff --git a/Mathlib/MeasureTheory/Function/UniformIntegrable.lean b/Mathlib/MeasureTheory/Function/UniformIntegrable.lean index 8d2058fb69dd68..4ef928052efa8f 100644 --- a/Mathlib/MeasureTheory/Function/UniformIntegrable.lean +++ b/Mathlib/MeasureTheory/Function/UniformIntegrable.lean @@ -177,7 +177,7 @@ theorem tendsto_indicator_ge (f : α → β) (x : α) : Tendsto (fun M : ℕ => { x | (M : ℝ) ≤ ‖f x‖₊ }.indicator f x) atTop (𝓝 0) := by refine tendsto_atTop_of_eventually_const (i₀ := Nat.ceil (‖f x‖₊ : ℝ) + 1) fun n hn => ?_ rw [Set.indicator_of_notMem] - simp only [not_le, Set.mem_setOf_eq] + simp only [not_le, Set.mem_ofPred_eq] refine lt_of_le_of_lt (Nat.le_ceil _) ?_ refine lt_of_lt_of_le (lt_add_one _) ?_ norm_cast @@ -239,7 +239,7 @@ theorem MemLp.integral_indicator_norm_ge_nonneg_le (hf : MemLp f 1 μ) {ε : ℝ refine ⟨M, hM_pos, (le_of_eq ?_).trans hfM⟩ refine lintegral_congr_ae ?_ filter_upwards [hf.1.ae_eq_mk] with x hx - simp only [Set.indicator_apply, coe_nnnorm, Set.mem_setOf_eq, hx.symm] + simp only [Set.indicator_apply, coe_nnnorm, Set.mem_ofPred_eq, hx.symm] theorem MemLp.eLpNormEssSup_indicator_norm_ge_eq_zero (hf : MemLp f ∞ μ) (hmeas : StronglyMeasurable f) : @@ -252,7 +252,7 @@ theorem MemLp.eLpNormEssSup_indicator_norm_ge_eq_zero (hf : MemLp f ∞ μ) have : { x : α | (eLpNormEssSup f μ + 1).toReal ≤ ‖f x‖ } ⊆ { x : α | eLpNormEssSup f μ < ‖f x‖₊ } := by intro x hx - rw [Set.mem_setOf_eq, ← ENNReal.toReal_lt_toReal hbdd.ne ENNReal.coe_lt_top.ne, + rw [Set.mem_ofPred_eq, ← ENNReal.toReal_lt_toReal hbdd.ne ENNReal.coe_lt_top.ne, ENNReal.coe_toReal, coe_nnnorm] refine lt_of_lt_of_le ?_ hx rw [ENNReal.toReal_lt_toReal hbdd.ne] @@ -295,11 +295,11 @@ theorem MemLp.eLpNorm_indicator_norm_ge_le (hf : MemLp f p μ) (hmeas : Strongly by_cases hx : x ∈ { x : α | M ^ (1 / p.toReal) ≤ ‖f x‖₊ } · rw [Set.indicator_of_mem hx, Set.indicator_of_mem, Real.enorm_of_nonneg (by positivity), ← ENNReal.ofReal_rpow_of_nonneg (norm_nonneg _) ENNReal.toReal_nonneg, ofReal_norm] - rw [Set.mem_setOf_eq] + rw [Set.mem_ofPred_eq] rwa [← hiff] · rw [Set.indicator_of_notMem hx, Set.indicator_of_notMem] · simp [ENNReal.toReal_pos hp_ne_zero hp_ne_top] - · rw [Set.mem_setOf_eq] + · rw [Set.mem_ofPred_eq] rwa [← hiff] /-- This lemma implies that a single function is uniformly integrable (in the probability sense). -/ @@ -623,7 +623,7 @@ theorem unifIntegrable_of' (hp : 1 ≤ p) (hp' : p ≠ ∞) {f : ι → α → · refine (Disjoint.inf_right' _ ?_).inf_left' _ rw [disjoint_iff_inf_le] rintro x ⟨hx₁, hx₂⟩ - rw [Set.mem_setOf_eq] at hx₁ hx₂ + rw [Set.mem_ofPred_eq] at hx₁ hx₂ exact False.elim (hx₂.ne (eq_of_le_of_not_lt hx₁ (not_lt.2 hx₂.le)).symm) _ ≤ eLpNorm (Set.indicator { x | C ≤ ‖f i x‖₊ } (f i)) p μ + (C : ℝ≥0∞) * μ s ^ (1 / ENNReal.toReal p) := by @@ -665,9 +665,9 @@ theorem unifIntegrable_of (hp : 1 ≤ p) (hp' : p ≠ ∞) {f : ι → α → β filter_upwards [(Exists.choose_spec <| hf i).2] with x hx by_cases hfx : x ∈ { x | C ≤ ‖f i x‖₊ } · rw [Set.indicator_of_mem hfx, Set.indicator_of_mem, hx] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx · rw [Set.indicator_of_notMem hfx, Set.indicator_of_notMem] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx refine ⟨max C 1, lt_max_of_lt_right one_pos, fun i => le_trans (eLpNorm_mono fun x => ?_) (hCg i)⟩ rw [norm_indicator_eq_indicator_norm, norm_indicator_eq_indicator_norm] grw [← le_max_left] @@ -818,9 +818,9 @@ theorem uniformIntegrable_of [IsFiniteMeasure μ] (hp : 1 ≤ p) (hp' : p ≠ filter_upwards [(Exists.choose_spec <| hf i).2] with x hx by_cases hfx : x ∈ { x | C ≤ ‖f i x‖₊ } · rw [Set.indicator_of_mem hfx, Set.indicator_of_mem, hx] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx · rw [Set.indicator_of_notMem hfx, Set.indicator_of_notMem] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx /-- This lemma is superseded by `UniformIntegrable.spec` which does not require measurability. -/ theorem UniformIntegrable.spec' (hp : p ≠ 0) (hp' : p ≠ ∞) (hf : ∀ i, StronglyMeasurable (f i)) @@ -869,9 +869,9 @@ theorem UniformIntegrable.spec (hp : p ≠ 0) (hp' : p ≠ ∞) (hfu : UniformIn filter_upwards [(Exists.choose_spec <| hfu.1 i).2] with x hx by_cases hfx : x ∈ { x | C ≤ ‖f i x‖₊ } · rw [Set.indicator_of_mem hfx, Set.indicator_of_mem, hx] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx · rw [Set.indicator_of_notMem hfx, Set.indicator_of_notMem] - rwa [Set.mem_setOf, hx] at hfx + rwa [Set.mem_ofPred, hx] at hfx /-- The definition of uniform integrable in mathlib is equivalent to the definition commonly found in literature. -/ diff --git a/Mathlib/MeasureTheory/Group/AEStabilizer.lean b/Mathlib/MeasureTheory/Group/AEStabilizer.lean index 063144fc54b2bf..83c7c0f07afc7c 100644 --- a/Mathlib/MeasureTheory/Group/AEStabilizer.lean +++ b/Mathlib/MeasureTheory/Group/AEStabilizer.lean @@ -41,7 +41,7 @@ namespace MulAction /-- A.e. stabilizer of a set under a group action. -/ @[to_additive (attr := simps) /-- A.e. stabilizer of a set under an additive group action. -/] def aestabilizer (s : Set α) : Subgroup G where - carrier := {g | g • s =ᵐ[μ] s} + carrier := {g | g • s =ᵐˢ[μ] s} one_mem' := by simp -- TODO: `calc` would be more readable but fails because of defeq abuse mul_mem' {g₁ g₂} h₁ h₂ := by simpa only [smul_smul] using! ((smul_set_ae_eq g₁).2 h₂).trans h₁ @@ -51,7 +51,7 @@ variable {G μ} variable {g : G} {s t : Set α} @[to_additive (attr := simp)] -lemma mem_aestabilizer : g ∈ aestabilizer G μ s ↔ g • s =ᵐ[μ] s := .rfl +lemma mem_aestabilizer : g ∈ aestabilizer G μ s ↔ g • s =ᵐˢ[μ] s := .rfl @[to_additive] lemma stabilizer_le_aestabilizer (s : Set α) : stabilizer G s ≤ aestabilizer G μ s := by @@ -65,11 +65,11 @@ lemma aestabilizer_empty : aestabilizer G μ ∅ = ⊤ := top_unique fun _ _ ↦ lemma aestabilizer_univ : aestabilizer G μ univ = ⊤ := top_unique fun _ _ ↦ by simp @[to_additive] -lemma aestabilizer_congr (h : s =ᵐ[μ] t) : aestabilizer G μ s = aestabilizer G μ t := by +lemma aestabilizer_congr (h : s =ᵐˢ[μ] t) : aestabilizer G μ s = aestabilizer G μ t := by ext g rw [mem_aestabilizer, mem_aestabilizer, h.congr_right, ((smul_set_ae_eq g).2 h).congr_left] -lemma aestabilizer_of_aeconst (hs : EventuallyConst s (ae μ)) : aestabilizer G μ s = ⊤ := by +lemma aestabilizer_of_aeconst (hs : EventuallyConst (· ∈ s) (ae μ)) : aestabilizer G μ s = ⊤ := by refine top_unique fun g _ ↦ ?_ cases eventuallyConst_set'.mp hs with | inl h => simp [aestabilizer_congr h] @@ -83,13 +83,13 @@ variable {x y : G} {s : Set α} namespace MeasureTheory @[to_additive] -theorem smul_ae_eq_self_of_mem_zpowers (hs : (x • s : Set α) =ᵐ[μ] s) - (hy : y ∈ Subgroup.zpowers x) : (y • s : Set α) =ᵐ[μ] s := by +theorem smul_ae_eq_self_of_mem_zpowers (hs : (x • s : Set α) =ᵐˢ[μ] s) + (hy : y ∈ Subgroup.zpowers x) : (y • s : Set α) =ᵐˢ[μ] s := by rw [← MulAction.mem_aestabilizer, ← Subgroup.zpowers_le] at hs exact hs hy @[to_additive] -theorem inv_smul_ae_eq_self (hs : (x • s : Set α) =ᵐ[μ] s) : (x⁻¹ • s : Set α) =ᵐ[μ] s := +theorem inv_smul_ae_eq_self (hs : (x • s : Set α) =ᵐˢ[μ] s) : (x⁻¹ • s : Set α) =ᵐˢ[μ] s := inv_mem (s := MulAction.aestabilizer G μ s) hs end MeasureTheory diff --git a/Mathlib/MeasureTheory/Group/Action.lean b/Mathlib/MeasureTheory/Group/Action.lean index eeb56066690caa..5b3a11ef74af41 100644 --- a/Mathlib/MeasureTheory/Group/Action.lean +++ b/Mathlib/MeasureTheory/Group/Action.lean @@ -84,7 +84,8 @@ theorem measure_preimage_smul_of_nullMeasurableSet (hs : NullMeasurableSet s μ) μ ((c • ·) ⁻¹' s) = μ s := by rw [← measure_toMeasurable s, ← SMulInvariantMeasure.measure_preimage_smul c (measurableSet_toMeasurable μ s)] - exact measure_congr (tendsto_smul_ae μ c hs.toMeasurable_ae_eq) |>.symm + exact measure_congr (s := (c • ·) ⁻¹' toMeasurable μ s) (t := (c • ·) ⁻¹' s) + (tendsto_smul_ae μ c hs.toMeasurable_ae_eq) |>.symm end AE_smul @@ -155,15 +156,15 @@ theorem smul_ae (c : G) : c • ae μ = ae μ := by @[to_additive (attr := simp)] theorem eventuallyConst_smul_set_ae (c : G) {s : Set α} : - EventuallyConst (c • s : Set α) (ae μ) ↔ EventuallyConst s (ae μ) := by + EventuallyConst (· ∈ c • s) (ae μ) ↔ EventuallyConst (· ∈ s) (ae μ) := by rw [← preimage_smul_inv, eventuallyConst_preimage, Filter.map_smul, smul_ae] @[to_additive (attr := simp)] -theorem smul_set_ae_le (c : G) {s t : Set α} : c • s ≤ᵐ[μ] c • t ↔ s ≤ᵐ[μ] t := by +theorem smul_set_ae_le (c : G) {s t : Set α} : c • s ⊆ᵐ[μ] c • t ↔ s ⊆ᵐ[μ] t := by simp only [ae_le_set, ← smul_set_sdiff, measure_smul_eq_zero_iff] @[to_additive (attr := simp)] -theorem smul_set_ae_eq (c : G) {s t : Set α} : c • s =ᵐ[μ] c • t ↔ s =ᵐ[μ] t := by +theorem smul_set_ae_eq (c : G) {s t : Set α} : c • s =ᵐˢ[μ] c • t ↔ s =ᵐˢ[μ] t := by simp only [Filter.eventuallyLE_antisymm_iff, smul_set_ae_le] end AE diff --git a/Mathlib/MeasureTheory/Group/AddCircle.lean b/Mathlib/MeasureTheory/Group/AddCircle.lean index 1274c8372799de..25e0c5597015ed 100644 --- a/Mathlib/MeasureTheory/Group/AddCircle.lean +++ b/Mathlib/MeasureTheory/Group/AddCircle.lean @@ -33,7 +33,7 @@ namespace AddCircle variable {T : ℝ} [hT : Fact (0 < T)] -theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐ[volume] ball x ε := by +theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε =ᵐˢ[volume] ball x ε := by rcases le_or_gt ε 0 with hε | hε · rw [ball_eq_empty.mpr hε, ae_eq_empty, volume_closedBall, min_eq_right (by linarith [hT.out] : 2 * ε ≤ T), ENNReal.ofReal_eq_zero] @@ -52,7 +52,7 @@ theorem closedBall_ae_eq_ball {x : AddCircle T} {ε : ℝ} : closedBall x ε = any set `I` that is almost equal to a ball of radius `T / 2n` is a fundamental domain for the action of `G` on `AddCircle T` by left addition. -/ theorem isAddFundamentalDomain_of_ae_ball (I : Set <| AddCircle T) (u x : AddCircle T) - (hu : IsOfFinAddOrder u) (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : + (hu : IsOfFinAddOrder u) (hI : I =ᵐˢ[volume] ball x (T / (2 * addOrderOf u))) : IsAddFundamentalDomain (AddSubgroup.zmultiples u) I := by set G := AddSubgroup.zmultiples u set n := addOrderOf u @@ -92,12 +92,12 @@ theorem isAddFundamentalDomain_of_ae_ball (I : Set <| AddCircle T) (u x : AddCir exact two_ne_zero theorem volume_of_add_preimage_eq (s I : Set <| AddCircle T) (u x : AddCircle T) - (hu : IsOfFinAddOrder u) (hs : (u +ᵥ s : Set <| AddCircle T) =ᵐ[volume] s) - (hI : I =ᵐ[volume] ball x (T / (2 * addOrderOf u))) : + (hu : IsOfFinAddOrder u) (hs : (u +ᵥ s : Set <| AddCircle T) =ᵐˢ[volume] s) + (hI : I =ᵐˢ[volume] ball x (T / (2 * addOrderOf u))) : volume s = addOrderOf u • volume (s ∩ I) := by let G := AddSubgroup.zmultiples u haveI : Fintype G := @Fintype.ofFinite _ hu.finite_zmultiples.to_subtype - have hsG : ∀ g : G, (g +ᵥ s : Set <| AddCircle T) =ᵐ[volume] s := by + have hsG : ∀ g : G, (g +ᵥ s : Set <| AddCircle T) =ᵐˢ[volume] s := by rintro ⟨y, hy⟩; exact (vadd_ae_eq_self_of_mem_zmultiples hs hy :) rw [(isAddFundamentalDomain_of_ae_ball I u x hu hI).measure_eq_card_smul_of_vadd_ae_eq_self s hsG, ← Nat.card_zmultiples u] diff --git a/Mathlib/MeasureTheory/Group/FundamentalDomain.lean b/Mathlib/MeasureTheory/Group/FundamentalDomain.lean index 02badc202cc9f3..a281fae0e2210f 100644 --- a/Mathlib/MeasureTheory/Group/FundamentalDomain.lean +++ b/Mathlib/MeasureTheory/Group/FundamentalDomain.lean @@ -124,14 +124,14 @@ theorem mk_of_measure_univ_le [IsFiniteMeasure μ] [Countable G] (h_meas : NullM replace h_meas : ∀ g : G, NullMeasurableSet (g • s) μ := fun g => by rw [← inv_inv g, ← preimage_smul]; exact h_meas.preimage (h_qmp g⁻¹) have h_meas' : NullMeasurableSet {a | ∃ g : G, g • a ∈ s} μ := by - rw [← iUnion_smul_eq_setOf_exists]; exact .iUnion h_meas - rw [ae_iff_measure_eq h_meas', ← iUnion_smul_eq_setOf_exists] + rw [← iUnion_smul_eq_ofPred_exists]; exact .iUnion h_meas + rw [ae_iff_measure_eq h_meas', ← iUnion_smul_eq_ofPred_exists] refine le_antisymm (measure_mono <| subset_univ _) ?_ rw [measure_iUnion₀ aedisjoint h_meas] exact h_measure_univ_le } @[to_additive] -theorem iUnion_smul_ae_eq (h : IsFundamentalDomain G s μ) : ⋃ g : G, g • s =ᵐ[μ] univ := +theorem iUnion_smul_ae_eq (h : IsFundamentalDomain G s μ) : ⋃ g : G, g • s =ᵐˢ[μ] univ := eventuallyEq_univ.2 <| h.ae_covers.mono fun _ ⟨g, hg⟩ => mem_iUnion.2 ⟨g⁻¹, _, hg, inv_smul_smul _ _⟩ @@ -286,11 +286,11 @@ is determined by the measure of its intersection with a fundamental domain for t finite additive group `G`, the measure of any `G`-invariant set is determined by the measure of its intersection with a fundamental domain for the action of `G`. -/] theorem measure_eq_card_smul_of_smul_ae_eq_self [Finite G] (h : IsFundamentalDomain G s μ) - (t : Set α) (ht : ∀ g : G, (g • t : Set α) =ᵐ[μ] t) : μ t = Nat.card G • μ (t ∩ s) := by + (t : Set α) (ht : ∀ g : G, (g • t : Set α) =ᵐˢ[μ] t) : μ t = Nat.card G • μ (t ∩ s) := by haveI : Fintype G := Fintype.ofFinite G rw [h.measure_eq_tsum] - replace ht : ∀ g : G, (g • t ∩ s : Set α) =ᵐ[μ] (t ∩ s : Set α) := fun g => - ae_eq_set_inter (ht g) (ae_eq_refl s) + replace ht : ∀ g : G, (g • t ∩ s : Set α) =ᵐˢ[μ] (t ∩ s : Set α) := fun g => + ae_eq_set_inter (ht g) (ae_eq_refl (· ∈ s)) simp_rw [measure_congr (ht _), tsum_fintype, Finset.sum_const, Nat.card_eq_fintype_card, Finset.card_univ] @@ -465,7 +465,7 @@ theorem essSup_measure_restrict (hs : IsFundamentalDomain G s μ) {f : α → intro γ ext x rw [mem_smul_set_iff_inv_smul_mem] - simp only [mem_setOf_eq, hf γ⁻¹ x] + simp only [mem_ofPred_eq, hf γ⁻¹ x] end IsFundamentalDomain @@ -593,8 +593,8 @@ variable [MeasurableConstSMul G α] [SMulInvariantMeasure G α μ] protected theorem fundamentalInterior : IsFundamentalDomain G (fundamentalInterior G s) μ where nullMeasurableSet := hs.nullMeasurableSet.fundamentalInterior _ _ ae_covers := by - simp_rw [ae_iff, not_exists, ← mem_inv_smul_set_iff, setOf_forall, ← compl_setOf, - setOf_mem_eq, ← compl_iUnion] + simp_rw [ae_iff, not_exists, ← mem_inv_smul_set_iff, ofPred_forall, ← compl_ofPred, + ofPred_mem_eq, ← compl_iUnion] have : ((⋃ g : G, g⁻¹ • s) \ ⋃ g : G, g⁻¹ • fundamentalFrontier G s) ⊆ ⋃ g : G, g⁻¹ • fundamentalInterior G s := by @@ -602,7 +602,7 @@ protected theorem fundamentalInterior : IsFundamentalDomain G (fundamentalInteri fundamentalFrontier_union_fundamentalInterior]; rfl refine eq_bot_mono (μ.mono <| compl_subset_compl.2 this) ?_ simp only [iUnion_inv_smul, compl_sdiff, ENNReal.bot_eq_zero, - @iUnion_smul_eq_setOf_exists _ _ _ _ s] + @iUnion_smul_eq_ofPred_exists _ _ _ _ s] exact measure_union_null (measure_iUnion_null fun _ => measure_smul_null hs.measure_fundamentalFrontier _) hs.ae_covers aedisjoint := (pairwise_disjoint_fundamentalInterior _ _).mono fun _ _ => Disjoint.aedisjoint @@ -827,7 +827,7 @@ lemma QuotientMeasureEqMeasurePreimage.sigmaFiniteQuotient SigmaFinite μ := by rw [sigmaFinite_iff] obtain ⟨A, hA_meas, hA, hA'⟩ := Measure.toFiniteSpanningSetsIn (h := i) - simp only [mem_setOf_eq] at hA_meas + simp only [mem_ofPred_eq] at hA_meas refine ⟨⟨fun n ↦ π '' (A n), by simp, fun n ↦ ?_, ?_⟩⟩ · obtain ⟨s, fund_dom_s⟩ := i' have : π ⁻¹' π '' (A n) = _ := MulAction.quotient_preimage_image_eq_union_mul (A n) (G := G) diff --git a/Mathlib/MeasureTheory/Group/Prod.lean b/Mathlib/MeasureTheory/Group/Prod.lean index f5676f16cc5dd7..723c81e2c2ed81 100644 --- a/Mathlib/MeasureTheory/Group/Prod.lean +++ b/Mathlib/MeasureTheory/Group/Prod.lean @@ -167,7 +167,7 @@ theorem inv_ae : (ae μ)⁻¹ = ae μ := by @[to_additive (attr := simp)] theorem eventuallyConst_inv_set_ae : - EventuallyConst (s⁻¹ : Set G) (ae μ) ↔ EventuallyConst s (ae μ) := by + EventuallyConst (· ∈ (s⁻¹ : Set G)) (ae μ) ↔ EventuallyConst (· ∈ s) (ae μ) := by rw [← inv_preimage, eventuallyConst_preimage, Filter.map_inv, inv_ae] @[to_additive] diff --git a/Mathlib/MeasureTheory/Integral/Average.lean b/Mathlib/MeasureTheory/Integral/Average.lean index 4e604f32d5840e..2f150d6a734c07 100644 --- a/Mathlib/MeasureTheory/Integral/Average.lean +++ b/Mathlib/MeasureTheory/Integral/Average.lean @@ -136,7 +136,7 @@ variable {μ} theorem laverage_congr {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ⨍⁻ x, f x ∂μ = ⨍⁻ x, g x ∂μ := by simp only [laverage_eq, lintegral_congr_ae h] -theorem setLAverage_congr (h : s =ᵐ[μ] t) : ⨍⁻ x in s, f x ∂μ = ⨍⁻ x in t, f x ∂μ := by +theorem setLAverage_congr (h : s =ᵐˢ[μ] t) : ⨍⁻ x in s, f x ∂μ = ⨍⁻ x in t, f x ∂μ := by simp only [setLAverage_eq, setLIntegral_congr h, measure_congr h] theorem setLAverage_congr_fun_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : @@ -357,7 +357,7 @@ variable {μ} theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by simp only [average_eq, integral_congr_ae h] -theorem setAverage_congr (h : s =ᵐ[μ] t) : ⨍ x in s, f x ∂μ = ⨍ x in t, f x ∂μ := by +theorem setAverage_congr (h : s =ᵐˢ[μ] t) : ⨍ x in s, f x ∂μ = ⨍ x in t, f x ∂μ := by simp only [setAverage_eq, setIntegral_congr_set h, measureReal_congr h] theorem setAverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) : @@ -504,7 +504,7 @@ theorem measure_le_setAverage_pos (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf refine (integral_sub_average (μ.restrict s) f).not_gt ?_ refine (setIntegral_pos_iff_support_of_nonneg_ae ?_ ?_).2 ?_ · refine measure_mono_null (fun x hx ↦ ?_) H - simp only [Pi.zero_apply, sub_nonneg, mem_compl_iff, mem_setOf_eq, not_le] at hx + simp only [Pi.zero_apply, sub_nonneg, mem_compl_iff, mem_ofPred_eq, not_le] at hx exact hx.le · exact hf.sub (integrableOn_const hμ₁) · rwa [pos_iff_ne_zero, inter_comm, ← sdiff_compl, ← sdiff_inter_self_eq_sdiff, @@ -626,9 +626,9 @@ theorem measure_le_setLAverage_pos (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) obtain h | h := eq_or_ne (∫⁻ a in s, f a ∂μ) ∞ · simpa [mul_top, hμ₁, laverage, h, top_div_of_ne_top hμ₁, pos_iff_ne_zero] using hμ have := measure_le_setAverage_pos hμ hμ₁ (integrable_toReal_of_lintegral_ne_top hf h) - rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀ + rw [← ofPred_inter_eq_sep, ← Measure.restrict_apply₀ (hf.aestronglyMeasurable.nullMeasurableSet_le aestronglyMeasurable_const)] - rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀ + rw [← ofPred_inter_eq_sep, ← Measure.restrict_apply₀ (hf.ennreal_toReal.aestronglyMeasurable.nullMeasurableSet_le aestronglyMeasurable_const), ← measure_sdiff_null (measure_eq_top_of_lintegral_ne_top hf h)] at this refine this.trans_le (measure_mono ?_) @@ -649,8 +649,8 @@ theorem measure_setLAverage_le_pos (hμ : μ s ≠ 0) (hs : NullMeasurableSet s rw [hfg] at hint have := measure_setAverage_le_pos hμ hμ₁ (integrable_toReal_of_lintegral_ne_top hg.aemeasurable hint) - simp_rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀' hs, hfg'] - rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀' hs, ← + simp_rw [← ofPred_inter_eq_sep, ← Measure.restrict_apply₀' hs, hfg'] + rw [← ofPred_inter_eq_sep, ← Measure.restrict_apply₀' hs, ← measure_sdiff_null (measure_eq_top_of_lintegral_ne_top hg.aemeasurable hint)] at this refine this.trans_le (measure_mono ?_) rintro x ⟨hfx, hx⟩ diff --git a/Mathlib/MeasureTheory/Integral/Bochner/L1.lean b/Mathlib/MeasureTheory/Integral/Bochner/L1.lean index f11b2590553452..6af0ee965a42bb 100644 --- a/Mathlib/MeasureTheory/Integral/Bochner/L1.lean +++ b/Mathlib/MeasureTheory/Integral/Bochner/L1.lean @@ -334,7 +334,7 @@ lemma integral_nonneg {f : α →ₛ F} (hf : 0 ≤ᵐ[μ] f) : · suffices μ (f ⁻¹' {f y}) = 0 by simp [this, measureReal_def] rw [← nonpos_iff_eq_zero] refine le_of_le_of_eq (measure_mono fun x hx ↦ ?_) (ae_iff.mp hf) - simp only [Set.mem_preimage, mem_singleton_iff, mem_setOf_eq] at hx ⊢ + simp only [Set.mem_preimage, mem_singleton_iff, mem_ofPred_eq] at hx ⊢ exact hx ▸ hy lemma integral_mono {f g : α →ₛ F} (h : f ≤ᵐ[μ] g) (hf : Integrable f μ) (hg : Integrable g μ) : diff --git a/Mathlib/MeasureTheory/Integral/Bochner/Set.lean b/Mathlib/MeasureTheory/Integral/Bochner/Set.lean index b1dce490b5b59a..0c0fd9b3c6b0c4 100644 --- a/Mathlib/MeasureTheory/Integral/Bochner/Set.lean +++ b/Mathlib/MeasureTheory/Integral/Bochner/Set.lean @@ -74,7 +74,7 @@ theorem setIntegral_congr_fun (hs : MeasurableSet s) (h : EqOn f g s) : ∫ x in s, f x ∂μ = ∫ x in s, g x ∂μ := setIntegral_congr_ae hs <| Eventually.of_forall h -theorem setIntegral_congr_set (hst : s =ᵐ[μ] t) : ∫ x in s, f x ∂μ = ∫ x in t, f x ∂μ := by +theorem setIntegral_congr_set (hst : s =ᵐˢ[μ] t) : ∫ x in s, f x ∂μ = ∫ x in t, f x ∂μ := by rw [Measure.restrict_congr_set hst] theorem setIntegral_union₀ (hst : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) @@ -423,7 +423,6 @@ theorem setIntegral_eq_of_subset_of_ae_sdiff_eq_zero_aux (hts : s ⊆ t) _ = ∫ x in s \ k, f x ∂μ := by apply setIntegral_congr_set filter_upwards [h't] with x hx - change (x ∈ t \ k) = (x ∈ s \ k) simp only [eq_iff_iff, and_congr_left_iff, Set.mem_sdiff] intro h'x by_cases xs : x ∈ s @@ -494,7 +493,7 @@ theorem setIntegral_neg_eq_setIntegral_nonpos [PartialOrder E] {f : X → E} (hf : AEStronglyMeasurable f μ) : ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by - simp_rw [le_iff_lt_or_eq, setOf_or] + simp_rw [le_iff_lt_or_eq, ofPred_or] rw [h_union] have B : NullMeasurableSet {x | f x = 0} μ := hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero @@ -519,10 +518,10 @@ theorem integral_norm_eq_pos_sub_neg {f : X → ℝ} (hfi : Integrable f μ) : rw [← integral_neg] refine setIntegral_congr_fun₀ h_meas.compl fun x hx => ?_ rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _] - rw [Set.mem_compl_iff, Set.notMem_setOf_iff] at hx + rw [Set.mem_compl_iff, Set.notMem_ofPred_iff] at hx linarith _ = ∫ x in {x | 0 ≤ f x}, f x ∂μ - ∫ x in {x | f x ≤ 0}, f x ∂μ := by - rw [← setIntegral_neg_eq_setIntegral_nonpos hfi.1, compl_setOf]; simp only [not_le] + rw [← setIntegral_neg_eq_setIntegral_nonpos hfi.1, compl_ofPred]; simp only [not_le] theorem setIntegral_const [CompleteSpace E] (c : E) : ∫ _ in s, c ∂μ = μ.real s • c := by rw [integral_const, measureReal_restrict_apply_univ] @@ -738,7 +737,7 @@ variable [NormedAddCommGroup E] [NormedSpace ℝ E] [PartialOrder E] {μ : Measure X} {f g : X → E} {s t : Set X} theorem setIntegral_mono_set [OrderClosedTopology E] (hfi : IntegrableOn f t μ) - (hf : 0 ≤ᵐ[μ.restrict t] f) (hst : s ≤ᵐ[μ] t) : + (hf : 0 ≤ᵐ[μ.restrict t] f) (hst : s ⊆ᵐ[μ] t) : ∫ x in s, f x ∂μ ≤ ∫ x in t, f x ∂μ := integral_mono_measure (Measure.restrict_mono_ae hst) hf hfi diff --git a/Mathlib/MeasureTheory/Integral/CurveIntegral/Basic.lean b/Mathlib/MeasureTheory/Integral/CurveIntegral/Basic.lean index dd62fc98ff3080..eda1fee0ded04f 100644 --- a/Mathlib/MeasureTheory/Integral/CurveIntegral/Basic.lean +++ b/Mathlib/MeasureTheory/Integral/CurveIntegral/Basic.lean @@ -220,7 +220,7 @@ theorem curveIntegralFun_trans_of_lt_half (ω : E → E →L[𝕜] F) (γab : Pa let instE := NormedSpace.restrictScalars ℝ 𝕜 E have H₁ : (γab.trans γbc).extend =ᶠ[𝓝 t] (fun s ↦ γab.extend (2 * s)) := (eventually_le_nhds ht).mono fun _ ↦ Path.extend_trans_of_le_half _ _ - have H₂ : (2 : ℝ) • I =ᶠ[𝓝 (2 * t)] I := by + have H₂ : (2 : ℝ) • I =ᶠˢ[𝓝 (2 * t)] I := by rw [LinearOrderedField.smul_Icc two_pos, mul_zero, mul_one, ← nhdsWithin_eq_iff_eventuallyEq] rcases lt_trichotomy t 0 with ht₀ | rfl | ht₀ · rw [notMem_closure_iff_nhdsWithin_eq_bot.mp, notMem_closure_iff_nhdsWithin_eq_bot.mp] <;> @@ -519,7 +519,7 @@ theorem HasFDerivWithinAt.curveIntegral_segment_source' (hs : Convex ℝ s) intro ε hε obtain ⟨δ, hδ₀, hδ⟩ : ∃ δ > 0, ball a δ ∩ s ⊆ {z | ContinuousWithinAt ω s z ∧ dist (ω z) (ω a) ≤ ε} := by - rw [← Metric.mem_nhdsWithin_iff, setOf_and, inter_mem_iff] + rw [← Metric.mem_nhdsWithin_iff, ofPred_and, inter_mem_iff] exact ⟨hω, (hω.self_of_nhdsWithin ha).eventually <| closedBall_mem_nhds _ hε⟩ rw [eventually_nhdsWithin_iff] filter_upwards [Metric.ball_mem_nhds _ hδ₀] with b hb hbs diff --git a/Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean b/Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean index 018872f8d0a00e..d2564f00d9a70b 100644 --- a/Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean +++ b/Mathlib/MeasureTheory/Integral/DivergenceTheorem.lean @@ -281,7 +281,7 @@ theorem integral_divergence_of_hasFDerivAt_off_countable (hle : a ≤ b) rcases eq_or_ne i j with (rfl | hne) · simp [hi] · rcases Fin.exists_succAbove_eq hne with ⟨i, rfl⟩ - have : Icc (a ∘ j.succAbove) (b ∘ j.succAbove) =ᵐ[volume] (∅ : Set ℝⁿ) := by + have : Icc (a ∘ j.succAbove) (b ∘ j.succAbove) =ᵐˢ[volume] (∅ : Set ℝⁿ) := by rw [ae_eq_empty, Real.volume_Icc_pi, prod_eq_zero (Finset.mem_univ i)] simp [hi] rw [setIntegral_congr_set this, setIntegral_congr_set this, setIntegral_empty, diff --git a/Mathlib/MeasureTheory/Integral/FinMeasAdditive.lean b/Mathlib/MeasureTheory/Integral/FinMeasAdditive.lean index 1a9b39c030e3d8..030ab7f20ac38b 100644 --- a/Mathlib/MeasureTheory/Integral/FinMeasAdditive.lean +++ b/Mathlib/MeasureTheory/Integral/FinMeasAdditive.lean @@ -394,7 +394,7 @@ theorem setToSimpleFunc_congr (T : Set α → E →L[ℝ] F) refine fun x y hxy => h_zero _ ((measurableSet_fiber f x).inter (measurableSet_fiber g y)) ?_ rw [EventuallyEq, ae_iff] at h refine measure_mono_null (fun z => ?_) h - simp_rw [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_preimage, Set.mem_singleton_iff] + simp_rw [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_preimage, Set.mem_singleton_iff] intro h rwa [h.1, h.2] diff --git a/Mathlib/MeasureTheory/Integral/IntegrableOn.lean b/Mathlib/MeasureTheory/Integral/IntegrableOn.lean index f487a4f34cfd7c..251168864dfe8e 100644 --- a/Mathlib/MeasureTheory/Integral/IntegrableOn.lean +++ b/Mathlib/MeasureTheory/Integral/IntegrableOn.lean @@ -135,13 +135,14 @@ theorem IntegrableOn.mono_measure' (h : IntegrableOn f s ν) (hμ : μ.restrict IntegrableOn f s μ := Integrable.mono_measure h hμ -theorem IntegrableOn.mono_set_ae (h : IntegrableOn f t μ) (hst : s ≤ᵐ[μ] t) : IntegrableOn f s μ := +theorem IntegrableOn.mono_set_ae (h : IntegrableOn f t μ) (hst : s ⊆ᵐ[μ] t) : IntegrableOn f s μ := h.integrable.mono_measure <| Measure.restrict_mono_ae hst -theorem IntegrableOn.congr_set_ae (h : IntegrableOn f t μ) (hst : s =ᵐ[μ] t) : IntegrableOn f s μ := +theorem IntegrableOn.congr_set_ae (h : IntegrableOn f t μ) (hst : s =ᵐˢ[μ] t) : + IntegrableOn f s μ := h.mono_set_ae hst.le -theorem integrableOn_congr_set_ae (hst : s =ᵐ[μ] t) : IntegrableOn f s μ ↔ IntegrableOn f t μ := +theorem integrableOn_congr_set_ae (hst : s =ᵐˢ[μ] t) : IntegrableOn f s μ ↔ IntegrableOn f t μ := ⟨fun h ↦ h.congr_set_ae hst.symm, fun h ↦ h.congr_set_ae hst⟩ theorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s μ) (hst : f =ᵐ[μ.restrict s] g) : diff --git a/Mathlib/MeasureTheory/Integral/IntervalAverage.lean b/Mathlib/MeasureTheory/Integral/IntervalAverage.lean index 455b155d94887c..87c99eff99739c 100644 --- a/Mathlib/MeasureTheory/Integral/IntervalAverage.lean +++ b/Mathlib/MeasureTheory/Integral/IntervalAverage.lean @@ -87,7 +87,7 @@ theorem exists_eq_interval_average_of_nullSingletonClass have h : a ≠ b := by intro hab; simp [hab] at hμ0 let s := uIoo a b have hs' : s ⊆ Ι a b := by intro x hx; rcases hx with ⟨h1, h2⟩; grind - have hs_ev : s =ᵐ[μ] Ι a b := by simpa using! Ioo_ae_eq_Ioc + have hs_ev : s =ᵐˢ[μ] Ι a b := by simpa using! Ioo_ae_eq_Ioc have hμ0' : μ s ≠ 0 := by have hμ : μ s = μ (Ι a b) := by rw [measure_congr hs_ev] rwa [hμ] diff --git a/Mathlib/MeasureTheory/Integral/IntervalIntegral/AbsolutelyContinuousFun.lean b/Mathlib/MeasureTheory/Integral/IntervalIntegral/AbsolutelyContinuousFun.lean index f3dc5eb2192ae7..c1cdd43bc12fc3 100644 --- a/Mathlib/MeasureTheory/Integral/IntervalIntegral/AbsolutelyContinuousFun.lean +++ b/Mathlib/MeasureTheory/Integral/IntervalIntegral/AbsolutelyContinuousFun.lean @@ -69,14 +69,13 @@ lemma exists_dist_slope_lt_pairwiseDisjoint_hasSum {f f' : ℝ → F} {d b η : have evn_bound {α : ℝ} (hα : 0 < α) : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, ε < α := by rw [eventually_nhdsWithin_iff, eventually_nhds_iff] exact ⟨Ioo (-α) α, by grind, isOpen_Ioo, by grind⟩ - have evn_pos : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, 0 < ε := - eventually_mem_of_tendsto_nhdsWithin (fun _ a ↦ a) + have evn_pos : ∀ᶠ (ε : ℝ) in 𝓝[>] 0, 0 < ε := eventually_mem_nhdsWithin filter_upwards [evn_pos, evn_bound hη, evn_bound hδ₁, evn_bound (α := (b - x) / 2) (by simp [hx.left.right])] with ε hε₁ hε₂ hε₃ hε₄ refine ⟨(x, x + ε), ⟨⟨hx.1.1, by linarith, by linarith⟩, ?_⟩, by simp, rfl⟩ exact hδ₂ (by grind) (by simp [abs_eq_self.mpr hε₁.le, hε₃]) - simp only [t, subset_def, mem_setOf_eq] at hu₁ + simp only [t, subset_def, mem_ofPred_eq] at hu₁ refine ⟨u, ⟨hu₁, hu₃, ?_⟩⟩ have : Countable u := by simp [hu₂] have : Pairwise (Disjoint on fun (z : u) ↦ Icc z.val.1 z.val.2) := diff --git a/Mathlib/MeasureTheory/Integral/IntervalIntegral/Basic.lean b/Mathlib/MeasureTheory/Integral/IntervalIntegral/Basic.lean index e7b07212a97022..672261a5713ee7 100644 --- a/Mathlib/MeasureTheory/Integral/IntervalIntegral/Basic.lean +++ b/Mathlib/MeasureTheory/Integral/IntervalIntegral/Basic.lean @@ -263,7 +263,7 @@ theorem mono_set (hf : IntervalIntegrable f μ a b) (h : [[c, d]] ⊆ [[a, b]]) IntervalIntegrable f μ c d := hf.mono h le_rfl -theorem mono_set_ae (hf : IntervalIntegrable f μ a b) (h : Ι c d ≤ᵐ[μ] Ι a b) : +theorem mono_set_ae (hf : IntervalIntegrable f μ a b) (h : Ι c d ⊆ᵐ[μ] Ι a b) : IntervalIntegrable f μ c d := intervalIntegrable_iff.mpr <| hf.def'.mono_set_ae h @@ -1343,7 +1343,7 @@ theorem intervalIntegral_pos_of_pos {f : ℝ → ℝ} {a b : ℝ} /-- If `f` and `g` are two functions that are interval integrable on `a..b`, `a ≤ b`, `f x ≤ g x` for a.e. `x ∈ Set.Ioc a b`, and `f x < g x` on a subset of `Set.Ioc a b` of nonzero measure, then `∫ x in a..b, f x ∂μ < ∫ x in a..b, g x ∂μ`. -/ -theorem integral_lt_integral_of_ae_le_of_measure_setOf_lt_ne_zero (hab : a ≤ b) +theorem integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero (hab : a ≤ b) (hfi : IntervalIntegrable f μ a b) (hgi : IntervalIntegrable g μ a b) (hle : f ≤ᵐ[μ.restrict (Ioc a b)] g) (hlt : μ.restrict (Ioc a b) {x | f x < g x} ≠ 0) : (∫ x in a..b, f x ∂μ) < ∫ x in a..b, g x ∂μ := by @@ -1353,13 +1353,17 @@ theorem integral_lt_integral_of_ae_le_of_measure_setOf_lt_ne_zero (hab : a ≤ b exact fun x hx => (sub_pos.2 hx.out).ne' exacts [hle.mono fun x => sub_nonneg.2, hgi.1.sub hfi.1] +@[deprecated (since := "2026-07-09")] +alias integral_lt_integral_of_ae_le_of_measure_setOf_lt_ne_zero := + integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero + /-- If `f` and `g` are continuous on `[a, b]`, `a < b`, `f x ≤ g x` on this interval, and `f c < g c` at some point `c ∈ [a, b]`, then `∫ x in a..b, f x < ∫ x in a..b, g x`. -/ theorem integral_lt_integral_of_continuousOn_of_le_of_exists_lt {f g : ℝ → ℝ} {a b : ℝ} (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (hgc : ContinuousOn g (Icc a b)) (hle : ∀ x ∈ Ioc a b, f x ≤ g x) (hlt : ∃ c ∈ Icc a b, f c < g c) : (∫ x in a..b, f x) < ∫ x in a..b, g x := by - apply integral_lt_integral_of_ae_le_of_measure_setOf_lt_ne_zero hab.le + apply integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero hab.le (hfc.intervalIntegrable_of_Icc hab.le) (hgc.intervalIntegrable_of_Icc hab.le) · simpa only [measurableSet_Ioc, ae_restrict_eq] using! (ae_restrict_mem measurableSet_Ioc).mono hle diff --git a/Mathlib/MeasureTheory/Integral/IntervalIntegral/DistLEIntegral.lean b/Mathlib/MeasureTheory/Integral/IntervalIntegral/DistLEIntegral.lean index 19e966083ae3d0..903e0459517832 100644 --- a/Mathlib/MeasureTheory/Integral/IntervalIntegral/DistLEIntegral.lean +++ b/Mathlib/MeasureTheory/Integral/IntervalIntegral/DistLEIntegral.lean @@ -104,7 +104,7 @@ lemma norm_sub_le_mul_volume_of_norm_deriv_le_of_le {C : ℝ} (hab : a ≤ b) setIntegral_const, smul_eq_mul, mul_comm] simp only [s, Measure.real, Measure.measure_toMeasurable_inter_of_sFinite measurableSet_Ioo] - simp only [inter_def, mem_setOf_eq, and_comm] + simp only [inter_def, mem_ofPred_eq, and_comm] end Line @@ -166,7 +166,7 @@ lemma norm_sub_le_mul_volume_of_norm_fderiv_le (hs : IsOpen s) (hf : DiffContOnC · exact hf.differentiableAt hs <| hmem_s t ht refine norm_sub_le_mul_volume_of_norm_lineDeriv_le hfc hfd (.of_forall hfC) |>.trans ?_ gcongr - · refine ne_top_of_le_ne_top ?_ (measure_mono inter_subset_left) + · refine ne_top_of_le_ne_top ?_ (measure_mono fun t ht ↦ ht.1) simp · simp +contextual [(hf.differentiableAt hs <| hmem_s _ ‹_›).lineDeriv_eq_fderiv] diff --git a/Mathlib/MeasureTheory/Integral/IntervalIntegral/FundThmCalculus.lean b/Mathlib/MeasureTheory/Integral/IntervalIntegral/FundThmCalculus.lean index 4faffca6cfa62f..b32a8f4646a257 100644 --- a/Mathlib/MeasureTheory/Integral/IntervalIntegral/FundThmCalculus.lean +++ b/Mathlib/MeasureTheory/Integral/IntervalIntegral/FundThmCalculus.lean @@ -993,7 +993,7 @@ theorem sub_le_integral_of_hasDeriv_right_of_le_Ico (hab : a ≤ b) -- with `t < b` admits another point in `s` slightly to its right -- (this is a sort of real induction). refine s_closed.Icc_subset_of_forall_exists_gt - (by simp only [integral_same, mem_setOf_eq, sub_self, le_rfl]) fun t ht v t_lt_v => ?_ + (by simp only [integral_same, mem_ofPred_eq, sub_self, le_rfl]) fun t ht v t_lt_v => ?_ obtain ⟨y, g'_lt_y', y_lt_G'⟩ : ∃ y : ℝ, (g' t : EReal) < y ∧ (y : EReal) < G' t := EReal.lt_iff_exists_real_btwn.1 ((EReal.coe_le_coe_iff.2 (hφg t ht.2)).trans_lt (f_lt_G' t)) -- bound from below the increase of `∫ x in a..u, G' x` on the right of `t`, using the lower diff --git a/Mathlib/MeasureTheory/Integral/Layercake.lean b/Mathlib/MeasureTheory/Integral/Layercake.lean index 59e6abe4dd4696..4f092ee4239f97 100644 --- a/Mathlib/MeasureTheory/Integral/Layercake.lean +++ b/Mathlib/MeasureTheory/Integral/Layercake.lean @@ -369,7 +369,9 @@ theorem lintegral_comp_eq_lintegral_meas_le_mul_of_measurable (μ : Measure α) apply setLIntegral_congr_fun measurableSet_Ioi (fun t ht ↦ ?_) rw [Measure.restrict_apply (measurableSet_le measurable_const f_mble)] congr 3 - exact (inter_eq_left.2 (fun a ha ↦ (mem_Ioi.1 ht).trans_le ha)).symm + funext a + simp only [eq_iff_iff, mem_ofPred_eq, iff_self_and] + exact fun h ↦ (mem_Ioi.1 ht).trans_le h have I : Ioi (0 : ℝ) = Ioc (0 : ℝ) M ∪ Ioi M := (Ioc_union_Ioi_eq_Ioi M_nonneg).symm have J : Disjoint (Ioc 0 M) (Ioi M) := Ioc_disjoint_Ioi le_rfl rw [I, lintegral_union measurableSet_Ioi J, lintegral_union measurableSet_Ioi J, B1, B2] @@ -420,7 +422,7 @@ theorem lintegral_comp_eq_lintegral_meas_le_mul (μ : Measure α) (f_nn : 0 ≤ rw [ht] congr 1 apply measure_congr - filter_upwards [f_eq_F] with a ha using by simp [setOf, ha] + filter_upwards [f_eq_F] with a ha using by simp [ha] have eq₂ : ∀ᵐ ω ∂μ, ENNReal.ofReal (∫ t in 0..f ω, g t) = ENNReal.ofReal (∫ t in 0..F ω, G t) := by filter_upwards [f_eq_F] with ω fω_nn diff --git a/Mathlib/MeasureTheory/Integral/Lebesgue/Add.lean b/Mathlib/MeasureTheory/Integral/Lebesgue/Add.lean index e8cd3a16964476..0835d3dd47f237 100644 --- a/Mathlib/MeasureTheory/Integral/Lebesgue/Add.lean +++ b/Mathlib/MeasureTheory/Integral/Lebesgue/Add.lean @@ -62,7 +62,7 @@ theorem lintegral_iSup {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, Measurable ( have mono : ∀ r : ℝ≥0∞, Monotone fun n => rs.map c ⁻¹' {r} ∩ { a | r ≤ f n a } := by intro r i j h refine inter_subset_inter_right _ ?_ - simp_rw [subset_def, mem_setOf] + simp_rw [subset_def, mem_ofPred] intro x hx exact le_trans hx (h_mono h x) have h_meas : ∀ n, MeasurableSet {a : α | map c rs a ≤ f n a} := fun n => @@ -143,7 +143,7 @@ theorem lintegral_iSup_ae {f : ℕ → α → ℝ≥0∞} (hf : ∀ n, Measurabl split_ifs with h · rfl · have := Set.notMem_subset hs.1 h - simp only [not_forall, not_le, mem_setOf_eq, not_exists, not_lt] at this + simp only [not_forall, not_le, mem_ofPred_eq, not_exists, not_lt] at this exact this n open Encodable in @@ -205,8 +205,9 @@ private theorem lintegral_liminf_nat_le' {f : ℕ → α → ℝ≥0∞} (h_meas ∫⁻ a, liminf (fun n => f n a) atTop ∂μ = ∫⁻ a, ⨆ n : ℕ, ⨅ i ≥ n, f i a ∂μ := by simp only [liminf_eq_iSup_iInf_of_nat] _ = ⨆ n : ℕ, ∫⁻ a, ⨅ i ≥ n, f i a ∂μ := - (lintegral_iSup' (fun _ => .biInf _ (to_countable _) (fun i _ ↦ h_meas i)) - (ae_of_all μ fun _ _ _ hnm => iInf_le_iInf_of_subset fun _ hi => le_trans hnm hi)) + (lintegral_iSup' (fun n => .biInf {i | i ≥ n} (to_countable _) (fun i _ ↦ h_meas i)) + (ae_of_all μ fun _ n m hnm => iInf_le_iInf_of_subset (s := {i | i ≥ m}) + (t := {i | i ≥ n}) fun _ hi => le_trans hnm hi)) _ ≤ ⨆ n : ℕ, ⨅ i ≥ n, ∫⁻ a, f i a ∂μ := iSup_mono fun _ => le_iInf₂_lintegral _ _ = atTop.liminf fun n => ∫⁻ a, f n a ∂μ := Filter.liminf_eq_iSup_iInf_of_nat.symm diff --git a/Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean b/Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean index 2ea6517fac6fcb..15bbc34dc57c69 100644 --- a/Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean +++ b/Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean @@ -100,7 +100,7 @@ theorem lintegral_mono_set {_ : MeasurableSpace α} ⦃μ : Measure α⦄ {s t : lintegral_mono' (Measure.restrict_mono hst (le_refl μ)) (le_refl f) theorem lintegral_mono_set' {_ : MeasurableSpace α} ⦃μ : Measure α⦄ {s t : Set α} {f : α → ℝ≥0∞} - (hst : s ≤ᵐ[μ] t) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in t, f x ∂μ := + (hst : s ⊆ᵐ[μ] t) : ∫⁻ x in s, f x ∂μ ≤ ∫⁻ x in t, f x ∂μ := lintegral_mono' (Measure.restrict_mono' hst (le_refl μ)) (le_refl f) theorem monotone_lintegral {_ : MeasurableSpace α} (μ : Measure α) : Monotone (lintegral μ) := @@ -184,7 +184,7 @@ theorem exists_simpleFunc_forall_lintegral_sub_lt_of_pos {f : α → ℝ≥0∞} ∀ ψ : α →ₛ ℝ≥0, (∀ x, ↑(ψ x) ≤ f x) → (map (↑) (ψ - φ)).lintegral μ < ε := by rw [lintegral_eq_nnreal] at h have := ENNReal.lt_add_right h hε - erw [ENNReal.biSup_add] at this <;> [skip; exact ⟨0, fun x => zero_le⟩] + rw [ENNReal.biSup_add' ⟨0, fun x => by simp⟩] at this simp_rw [lt_iSup_iff, iSup_lt_iff, iSup_le_iff] at this rcases this with ⟨φ, hle : ∀ x, ↑(φ x) ≤ f x, b, hbφ, hb⟩ refine ⟨φ, hle, fun ψ hψ => ?_⟩ @@ -278,7 +278,7 @@ theorem lintegral_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ∫⁻ theorem lintegral_congr {f g : α → ℝ≥0∞} (h : ∀ a, f a = g a) : ∫⁻ a, f a ∂μ = ∫⁻ a, g a ∂μ := by simp only [h] -theorem setLIntegral_congr {f : α → ℝ≥0∞} {s t : Set α} (h : s =ᵐ[μ] t) : +theorem setLIntegral_congr {f : α → ℝ≥0∞} {s t : Set α} (h : s =ᵐˢ[μ] t) : ∫⁻ x in s, f x ∂μ = ∫⁻ x in t, f x ∂μ := by rw [Measure.restrict_congr_set h] theorem setLIntegral_congr_fun_ae {f g : α → ℝ≥0∞} {s : Set α} (hs : MeasurableSet s) @@ -322,7 +322,7 @@ theorem lintegral_eq_zero_iff' {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) obtain ⟨u, -, bu, tu⟩ := exists_seq_strictAnti_tendsto' (α := ℝ≥0∞) zero_lt_one have u_union : {x | f x ≠ 0} = ⋃ n, {x | u n ≤ f x} := by ext x - rw [mem_iUnion, mem_setOf_eq, ← pos_iff_ne_zero] + rw [mem_iUnion, mem_ofPred_eq, ← pos_iff_ne_zero] rw [ENNReal.tendsto_atTop_zero] at tu constructor <;> intro h' · obtain ⟨n, hn⟩ := tu _ h'; use n, hn _ le_rfl @@ -653,7 +653,7 @@ theorem lintegral_max {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measur ∫⁻ x in { x | f x ≤ g x }, g x ∂μ + ∫⁻ x in { x | g x < f x }, f x ∂μ := by have hm : MeasurableSet { x | f x ≤ g x } := measurableSet_le hf hg rw [← lintegral_add_compl (fun x => max (f x) (g x)) hm] - simp only [← compl_setOf, ← not_le] + simp only [← compl_ofPred, ← not_le] refine congr_arg₂ (· + ·) (setLIntegral_congr_fun hm ?_) (setLIntegral_congr_fun hm.compl ?_) exacts [fun x => max_eq_right (a := f x) (b := g x), fun x (hx : ¬ f x ≤ g x) => max_eq_left (not_le.1 hx).le] diff --git a/Mathlib/MeasureTheory/Integral/Lebesgue/DominatedConvergence.lean b/Mathlib/MeasureTheory/Integral/Lebesgue/DominatedConvergence.lean index 808e09449c5376..312bdbbe6c77b0 100644 --- a/Mathlib/MeasureTheory/Integral/Lebesgue/DominatedConvergence.lean +++ b/Mathlib/MeasureTheory/Integral/Lebesgue/DominatedConvergence.lean @@ -34,9 +34,10 @@ theorem limsup_lintegral_le {f : ℕ → α → ℝ≥0∞} (g : α → ℝ≥0 _ = ∫⁻ a, ⨅ n : ℕ, ⨆ i ≥ n, f i a ∂μ := by refine (lintegral_iInf ?_ ?_ ?_).symm · intro n - exact .biSup _ (Set.to_countable _) (fun i _ ↦ hf_meas i) + exact .biSup {i | i ≥ n} (Set.to_countable _) (fun i _ ↦ hf_meas i) · intro n m hnm a - exact iSup_le_iSup_of_subset fun i hi => le_trans hnm hi + exact iSup_le_iSup_of_subset (s := {i | i ≥ m}) (t := {i | i ≥ n}) + fun i hi => le_trans hnm hi · refine ne_top_of_le_ne_top h_fin (lintegral_mono_ae ?_) refine (ae_all_iff.2 h_bound).mono fun n hn => ?_ exact iSup_le fun i => iSup_le fun _ => hn i diff --git a/Mathlib/MeasureTheory/Integral/Lebesgue/Markov.lean b/Mathlib/MeasureTheory/Integral/Lebesgue/Markov.lean index d677cc096087b1..1d7d0e59670eb3 100644 --- a/Mathlib/MeasureTheory/Integral/Lebesgue/Markov.lean +++ b/Mathlib/MeasureTheory/Integral/Lebesgue/Markov.lean @@ -89,7 +89,7 @@ theorem setLIntegral_eq_top_of_measure_eq_top_ne_zero {f : α → ℝ≥0∞} {s (hf : AEMeasurable f (μ.restrict s)) (hμf : μ ({x ∈ s | f x = ∞}) ≠ 0) : ∫⁻ x in s, f x ∂μ = ∞ := lintegral_eq_top_of_measure_eq_top_ne_zero hf <| - mt (eq_bot_mono <| by rw [← setOf_inter_eq_sep]; exact Measure.le_restrict_apply _ _) hμf + mt (eq_bot_mono <| by rw [← ofPred_inter_eq_sep]; exact Measure.le_restrict_apply _ _) hμf theorem measure_eq_top_of_lintegral_ne_top {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hμf : ∫⁻ x, f x ∂μ ≠ ∞) : μ {x | f x = ∞} = 0 := diff --git a/Mathlib/MeasureTheory/Integral/LebesgueNormedSpace.lean b/Mathlib/MeasureTheory/Integral/LebesgueNormedSpace.lean index c0d3e47d862755..83d04034ae2d0b 100644 --- a/Mathlib/MeasureTheory/Integral/LebesgueNormedSpace.lean +++ b/Mathlib/MeasureTheory/Integral/LebesgueNormedSpace.lean @@ -37,7 +37,7 @@ theorem aemeasurable_withDensity_iff {E : Type*} [NormedAddCommGroup E] [NormedS rw [ha this] · filter_upwards [ae_restrict_mem A.compl] intro x hx - simp only [Classical.not_not, mem_setOf_eq, mem_compl_iff] at hx + simp only [Classical.not_not, mem_ofPred_eq, mem_compl_iff] at hx simp [hx] · rintro ⟨g', g'meas, hg'⟩ refine ⟨fun x => (f x : ℝ)⁻¹ • g' x, hf.coe_nnreal_real.inv.smul g'meas, ?_⟩ diff --git a/Mathlib/MeasureTheory/Integral/RieszMarkovKakutani/Real.lean b/Mathlib/MeasureTheory/Integral/RieszMarkovKakutani/Real.lean index 1ce3bc6e7b5db6..5a2fba65aa9851 100644 --- a/Mathlib/MeasureTheory/Integral/RieszMarkovKakutani/Real.lean +++ b/Mathlib/MeasureTheory/Integral/RieszMarkovKakutani/Real.lean @@ -96,7 +96,7 @@ lemma rieszMeasure_le_of_eq_one {f : C_c(X, ℝ)} (hf : ∀ x, 0 ≤ f x) {K : S apply csInf_le' rw [Set.mem_image] use f.nnrealPart - simp_rw [Set.mem_setOf_eq, nnrealPart_apply, Real.one_le_toNNReal] + simp_rw [Set.mem_ofPred_eq, nnrealPart_apply, Real.one_le_toNNReal] refine ⟨(fun x hx ↦ Eq.ge (hfK x hx)), ?_⟩ apply NNReal.eq rw [toNNRealLinear_apply, show f.nnrealPart.toReal = f by ext z; simp [hf z], hp] @@ -134,16 +134,12 @@ lemma range_cut_partition (f : C_c(X, ℝ)) (a : ℝ) {ε : ℝ} (hε : 0 < ε) exact fun x _ ↦ partition_aux (mem_range_self x) · -- The sets `E n` are pairwise disjoint. intro m _ n _ hmn - apply Disjoint.preimage - simp_rw [mem_preimage, mem_Ioc, disjoint_left] - intro x hx - rw [mem_setOf_eq, and_assoc] at hx - simp_rw [mem_setOf_eq, not_and_or, not_lt, not_le, or_assoc] + change Disjoint (E m) (E n) + rw [disjoint_left] + intro x hx hx' rcases (by lia : m < n ∨ n < m) with hc | hc - · left - exact le_trans hx.2.1 (le_tsub_of_add_le_right (hy hc)) - · right; left - exact lt_of_le_of_lt (le_tsub_of_add_le_right (hy hc)) hx.1 + · exact absurd hx'.1.1 (not_lt.2 (hx.1.2.trans (le_tsub_of_add_le_right (hy hc)))) + · exact absurd hx.1.1 (not_lt.2 (hx'.1.2.trans (le_tsub_of_add_le_right (hy hc)))) · -- Upper and lower bound on `f x` follow from the definition of `E n` . intro _ _ hx simp only [mem_inter_iff, mem_preimage, mem_Ioc, E, y] at hx diff --git a/Mathlib/MeasureTheory/Integral/SetToL1.lean b/Mathlib/MeasureTheory/Integral/SetToL1.lean index 4dd785826d3770..f3d5cce9c3e076 100644 --- a/Mathlib/MeasureTheory/Integral/SetToL1.lean +++ b/Mathlib/MeasureTheory/Integral/SetToL1.lean @@ -1433,7 +1433,7 @@ theorem StronglyMeasurable.setToFun_prod_right {β : Type*} {mβ : MeasurableSpa apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable filter_upwards with y simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n - simp only [mem_setOf_eq, hfx, indicator_of_mem, this, + simp only [mem_ofPred_eq, hfx, indicator_of_mem, this, ← setToFun_simpleFunc_eq_setToSimpleFunc hT, f'] refine tendsto_setToFun_of_dominated_convergence hT (fun y => ‖f x y‖ + ‖f x y‖) diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean b/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean index 9b3c601b13e101..27745d1a91384d 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean @@ -105,7 +105,7 @@ theorem measurable_findGreatest' {p : α → ℕ → Prop} [∀ x, DecidablePred theorem measurable_findGreatest {p : α → ℕ → Prop} [∀ x, DecidablePred (p x)] {N} (hN : ∀ k ≤ N, MeasurableSet { x | p x k }) : Measurable fun x => Nat.findGreatest (p x) N := by refine measurable_findGreatest' fun k hk => ?_ - simp only [Nat.findGreatest_eq_iff, setOf_and, setOf_forall, ← compl_setOf] + simp only [Nat.findGreatest_eq_iff, ofPred_and, ofPred_forall, ← compl_ofPred] repeat' apply_rules [MeasurableSet.inter, MeasurableSet.const, MeasurableSet.iInter, MeasurableSet.compl, hN] <;> try intros @@ -860,53 +860,59 @@ instance Sigma.instMeasurableSpace {α} {β : α → Type*} [m : ∀ a, Measurab section prop variable [MeasurableSpace α] {p q : α → Prop} -@[simp] theorem measurableSet_setOf : MeasurableSet {a | p a} ↔ Measurable p := +@[simp] theorem measurableSet_setOfPred : MeasurableSet {a | p a} ↔ Measurable p := ⟨fun h ↦ measurable_to_prop <| by simpa only [preimage_singleton_true], fun h => by simpa using h (measurableSet_singleton True)⟩ -@[simp] theorem measurable_mem : Measurable (· ∈ s) ↔ MeasurableSet s := measurableSet_setOf.symm +@[deprecated (since := "2026-07-09")] alias measurableSet_setOf := measurableSet_setOfPred -alias ⟨_, Measurable.setOf⟩ := measurableSet_setOf +@[simp] theorem measurable_mem : Measurable (· ∈ s) ↔ MeasurableSet s := + measurableSet_setOfPred.symm + +alias ⟨_, Measurable.setOf⟩ := measurableSet_setOfPred @[fun_prop] alias ⟨_, MeasurableSet.mem⟩ := measurable_mem @[fun_prop] lemma Measurable.not (hp : Measurable p) : Measurable (¬ p ·) := - measurableSet_setOf.1 hp.setOf.compl + measurableSet_setOfPred.1 hp.setOf.compl @[fun_prop] lemma Measurable.and (hp : Measurable p) (hq : Measurable q) : Measurable fun a ↦ p a ∧ q a := - measurableSet_setOf.1 <| hp.setOf.inter hq.setOf + measurableSet_setOfPred.1 <| hp.setOf.inter hq.setOf @[fun_prop] lemma Measurable.or (hp : Measurable p) (hq : Measurable q) : Measurable fun a ↦ p a ∨ q a := - measurableSet_setOf.1 <| hp.setOf.union hq.setOf + measurableSet_setOfPred.1 <| hp.setOf.union hq.setOf @[fun_prop] lemma Measurable.imp (hp : Measurable p) (hq : Measurable q) : Measurable fun a ↦ p a → q a := - measurableSet_setOf.1 <| hp.setOf.himp hq.setOf + measurableSet_setOfPred.1 <| hp.setOf.himp hq.setOf @[fun_prop] lemma Measurable.iff (hp : Measurable p) (hq : Measurable q) : Measurable fun a ↦ p a ↔ q a := - measurableSet_setOf.1 <| by simp_rw [iff_iff_implies_and_implies]; exact hq.setOf.bihimp hp.setOf + measurableSet_setOfPred.1 <| by + simp_rw [iff_iff_implies_and_implies]; exact hq.setOf.bihimp hp.setOf @[fun_prop] lemma Measurable.forall [Countable ι] {p : ι → α → Prop} (hp : ∀ i, Measurable (p i)) : Measurable fun a ↦ ∀ i, p i a := - measurableSet_setOf.1 <| by rw [setOf_forall]; exact MeasurableSet.iInter fun i ↦ (hp i).setOf + measurableSet_setOfPred.1 <| by + rw [ofPred_forall]; exact MeasurableSet.iInter fun i ↦ (hp i).setOf @[fun_prop] lemma Measurable.exists [Countable ι] {p : ι → α → Prop} (hp : ∀ i, Measurable (p i)) : Measurable fun a ↦ ∃ i, p i a := - measurableSet_setOf.1 <| by rw [setOf_exists]; exact MeasurableSet.iUnion fun i ↦ (hp i).setOf + measurableSet_setOfPred.1 <| by + rw [ofPred_exists]; exact MeasurableSet.iUnion fun i ↦ (hp i).setOf end prop @[fun_prop] lemma Measurable.eq_const {_ : MeasurableSpace α} [MeasurableSpace β] [MeasurableSingletonClass β] {f : α → β} (hf : Measurable f) (a : β) : Measurable fun x => f x = a := - measurableSet_setOf.mp (measurableSet_eq.preimage hf) + measurableSet_setOfPred.mp (measurableSet_eq.preimage hf) @[fun_prop] lemma Measurable.const_eq {_ : MeasurableSpace α} [MeasurableSpace β] [MeasurableSingletonClass β] @@ -920,45 +926,62 @@ variable [MeasurableSpace β] {g : β → Set α} /-- This instance is useful when talking about Bernoulli sequences of random variables or binomial random graphs. -/ instance Set.instMeasurableSpace : MeasurableSpace (Set α) := - inferInstanceAs <| MeasurableSpace (α → Prop) + .comap (fun s ↦ ((· ∈ s))) inferInstance -instance Set.instMeasurableSingletonClass [Countable α] : MeasurableSingletonClass (Set α) := - inferInstanceAs <| MeasurableSingletonClass (α → Prop) +@[simp, fun_prop] lemma measurable_setOfPred : + Measurable fun p : α → Prop ↦ {a | p a} := measurable_comap_iff.2 measurable_id -@[simp, fun_prop] lemma measurable_setOf : Measurable fun p : α → Prop ↦ {a | p a} := measurable_id +@[deprecated (since := "2026-07-09")] +alias measurable_setOf := measurable_setOfPred -lemma measurable_set_iff : Measurable g ↔ ∀ a, Measurable fun x ↦ a ∈ g x := measurable_pi_iff +lemma measurable_set_iff : Measurable g ↔ ∀ a, Measurable fun x ↦ a ∈ g x := + measurable_comap_iff.trans measurable_pi_iff @[fun_prop] -lemma measurable_set_mem (a : α) : Measurable fun s : Set α ↦ a ∈ s := measurable_pi_apply _ +lemma measurable_set_mem (a : α) : Measurable fun s : Set α ↦ a ∈ s := + (measurable_pi_apply a).comp (comap_measurable _) + +instance Set.instMeasurableSingletonClass [Countable α] : MeasurableSingletonClass (Set α) where + measurableSet_singleton s := by + have h : ({s} : Set (Set α)) = {t | ∀ a, a ∈ t ↔ a ∈ s} := by + ext t + simp [Set.ext_iff] + rw [h] + exact measurableSet_setOfPred.2 <| .forall fun a ↦ .iff (measurable_set_mem a) measurable_const lemma measurable_set_notMem (a : α) : Measurable fun s : Set α ↦ a ∉ s := (Measurable.of_discrete (f := Not)).comp <| measurable_set_mem a lemma measurableSet_mem (a : α) : MeasurableSet {s : Set α | a ∈ s} := - measurableSet_setOf.2 <| measurable_set_mem _ + measurableSet_setOfPred.2 <| measurable_set_mem _ lemma measurableSet_notMem (a : α) : MeasurableSet {s : Set α | a ∉ s} := - measurableSet_setOf.2 <| measurable_set_notMem _ + measurableSet_setOfPred.2 <| measurable_set_notMem _ lemma measurable_compl : Measurable ((·ᶜ) : Set α → Set α) := measurable_set_iff.2 fun _ ↦ measurable_set_notMem _ variable [Countable α] -lemma MeasurableSet.setOf_finite : MeasurableSet {s : Set α | s.Finite} := - Countable.setOf_finite.measurableSet +lemma MeasurableSet.setOfPred_finite : MeasurableSet {s : Set α | s.Finite} := + Countable.ofPred_finite.measurableSet + +@[deprecated (since := "2026-07-09")] +alias MeasurableSet.setOf_finite := MeasurableSet.setOfPred_finite + +lemma MeasurableSet.setOfPred_infinite : MeasurableSet {s : Set α | s.Infinite} := + .setOfPred_finite |> .compl -lemma MeasurableSet.setOf_infinite : MeasurableSet {s : Set α | s.Infinite} := - .setOf_finite |> .compl +@[deprecated (since := "2026-07-09")] +alias MeasurableSet.setOf_infinite := MeasurableSet.setOfPred_infinite lemma MeasurableSet.sep_finite {S : Set (Set α)} (hS : MeasurableSet S) : MeasurableSet {s ∈ S | s.Finite} := - hS.inter .setOf_finite + hS.inter .setOfPred_finite lemma MeasurableSet.sep_infinite {S : Set (Set α)} (hS : MeasurableSet S) : MeasurableSet {s ∈ S | s.Infinite} := - hS.inter .setOf_infinite + hS.inter .setOfPred_infinite @[fun_prop] protected lemma Measurable.subset {s t : β → Set α} (hs : Measurable s) (hs : Measurable t) : @@ -995,10 +1018,10 @@ lemma measurable_finset_notMem (a : α) : Measurable fun s : Finset α ↦ a ∉ (measurable_set_notMem a).comp (comap_measurable _) lemma measurableSet_mem_finset (a : α) : MeasurableSet {s : Finset α | a ∈ s} := - measurableSet_setOf.2 <| measurable_finset_mem _ + measurableSet_setOfPred.2 <| measurable_finset_mem _ lemma measurableSet_notMem_finset (a : α) : MeasurableSet {s : Finset α | a ∉ s} := - measurableSet_setOf.2 <| measurable_finset_notMem _ + measurableSet_setOfPred.2 <| measurable_finset_notMem _ variable [Countable α] @@ -1070,11 +1093,11 @@ theorem measurableSet_eq_fun {m : MeasurableSpace α} [MeasurableSpace β] [Meas @[fun_prop] theorem Measurable.eq {m : MeasurableSpace α} [MeasurableSpace β] [MeasurableEq β] {f g : α → β} (hf : Measurable f) (hg : Measurable g) : Measurable fun x => f x = g x := - measurableSet_setOf.mp (measurableSet_eq_fun hf hg) + measurableSet_setOfPred.mp (measurableSet_eq_fun hf hg) instance [MeasurableSpace α] [MeasurableEq α] : MeasurableSingletonClass α := by constructor - simp_rw [← setOf_eq_eq_singleton, measurableSet_setOf] + simp_rw [← ofPred_eq_eq_singleton, measurableSet_setOfPred] measurability instance [MeasurableSpace α] [MeasurableSingletonClass α] [Countable α] : MeasurableEq α := by diff --git a/Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean b/Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean index cdb6f9017c6a3c..a997c7cdccb1ab 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean @@ -57,6 +57,7 @@ class CountablyGenerated (α : Type*) [m : MeasurableSpace α] : Prop where /-- A countable set of sets that generate the measurable space. We insert `∅` to ensure it is nonempty. -/ +noncomputable def countableGeneratingSet (α : Type*) [MeasurableSpace α] [h : CountablyGenerated α] : Set (Set α) := insert ∅ h.isCountablyGenerated.choose @@ -83,6 +84,7 @@ lemma measurableSet_countableGeneratingSet [MeasurableSpace α] [CountablyGenera exact measurableSet_generateFrom hs /-- A countable sequence of sets generating the measurable space. -/ +noncomputable def natGeneratingSequence (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : ℕ → (Set α) := enumerateCountable (countable_countableGeneratingSet (α := α)) ∅ @@ -143,6 +145,7 @@ open scoped Classical in Some of those sets may be empty, but the nonempty ones are the atoms of the measurable space. See `measurableAtom_eq_countablyGeneratedAtom_natGeneratingSequence`. -/ +noncomputable def countablyGeneratedAtom (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : (ℕ → Prop) → Set α := fun p ↦ ⋂ n, if p n then natGeneratingSequence α n else (natGeneratingSequence α n)ᶜ @@ -403,7 +406,7 @@ theorem measurable_mapNatBool [MeasurableSpace α] [CountablyGenerated α] : rw [measurable_pi_iff] refine fun n ↦ measurable_to_bool ?_ simp only [preimage, mem_singleton_iff, mapNatBool, - Bool.decide_iff, setOf_mem_eq] + Bool.decide_iff, ofPred_mem_eq] apply measurableSet_natGeneratingSequence theorem injective_mapNatBool [MeasurableSpace α] [CountablyGenerated α] @@ -528,7 +531,7 @@ lemma generateFrom_iUnion_memPartition (t : ℕ → Set α) : rw [hun] exact MeasurableSet.univ | succ n ih => - simp only [memPartition_succ, mem_setOf_eq] at hun + simp only [memPartition_succ, mem_ofPred_eq] at hun obtain ⟨v, hv, huv⟩ := hun rcases huv with rfl | rfl · exact (ih v hv).inter (measurableSet_generateFrom ⟨n, rfl⟩) @@ -571,7 +574,8 @@ variable [m : MeasurableSpace α] [h : CountablyGenerated α] /-- For each `n : ℕ`, `countablePartition α n` is a partition of the space in at most `2^n` sets. Each partition is finer than the preceding one. The measurable space generated by the union of all those partitions is the measurable space on `α`. -/ -def countablePartition (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : ℕ → Set (Set α) := +noncomputable def countablePartition (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : + ℕ → Set (Set α) := memPartition (enumerateCountable countable_countableGeneratingSet ∅) lemma measurableSet_enumerateCountable_countableGeneratingSet @@ -627,7 +631,7 @@ lemma measurableSet_countablePartition (n : ℕ) {s : Set α} (hs : s ∈ counta generateFrom_countablePartition_le α n _ (measurableSet_generateFrom hs) /-- The set in `countablePartition α n` to which `a : α` belongs. -/ -def countablePartitionSet (n : ℕ) (a : α) : Set α := +noncomputable def countablePartitionSet (n : ℕ) (a : α) : Set α := memPartitionSet (enumerateCountable countable_countableGeneratingSet ∅) n a lemma countablePartitionSet_mem (n : ℕ) (a : α) : diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean b/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean index ab6c6ea9a1084a..2a821017b012b1 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean @@ -466,7 +466,7 @@ theorem measurableSet_sSup {ms : Set (MeasurableSpace α)} {s : Set α} : MeasurableSet[sSup ms] s ↔ GenerateMeasurable { s : Set α | ∃ m ∈ ms, MeasurableSet[m] s } s := by change GenerateMeasurable (⋃₀ _) _ ↔ _ - simp [← setOf_exists] + simp [← ofPred_exists] theorem measurableSet_iSup {ι} {m : ι → MeasurableSpace α} {s : Set α} : MeasurableSet[iSup m] s ↔ GenerateMeasurable { s : Set α | ∃ i, MeasurableSet[m i] s } s := by diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Embedding.lean b/Mathlib/MeasureTheory/MeasurableSpace/Embedding.lean index 15d886f920a57e..fbec4d77798b84 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Embedding.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Embedding.lean @@ -638,13 +638,20 @@ def ofInvolutive (f : α → α) (hf : Involutive f) (hf' : Measurable f) : α @[simp] theorem ofInvolutive_symm (f : α → α) (hf : Involutive f) (hf' : Measurable f) : (ofInvolutive f hf hf').symm = ofInvolutive f hf hf' := rfl -/-- `setOf` as a `MeasurableEquiv`. -/ +/-- `Set.ofPred` as a `MeasurableEquiv`. -/ @[simps] -protected def setOf {α : Type*} : (α → Prop) ≃ᵐ Set α where +protected def setOfPred {α : Type*} : (α → Prop) ≃ᵐ Set α where toFun p := {a | p a} invFun s a := a ∈ s -@[simp, norm_cast] lemma coe_setOf {α : Type*} : ⇑MeasurableEquiv.setOf = setOf (α := α) := rfl +@[deprecated (since := "2026-07-09")] +protected alias setOf := MeasurableEquiv.setOfPred + +@[simp, norm_cast] lemma coe_setOfPred {α : Type*} : + ⇑MeasurableEquiv.setOfPred = Set.ofPred (α := α) := rfl + +@[deprecated (since := "2026-07-09")] +alias coe_setOf := coe_setOfPred end MeasurableEquiv diff --git a/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean b/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean index e199fd48bbffd0..e15942feb12a6f 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean @@ -42,7 +42,7 @@ variable {α : Type*} (m : MeasurableSpace α) {s t : Set α} on `α`, modulo a given σ-filter `l` on `α`. -/ @[implicit_reducible] def eventuallyMeasurableSpace (l : Filter α) [CountableInterFilter l] : MeasurableSpace α where - MeasurableSet' s := ∃ t, MeasurableSet t ∧ s =ᶠ[l] t + MeasurableSet' s := ∃ t, MeasurableSet t ∧ s =ᶠˢ[l] t measurableSet_empty := ⟨∅, MeasurableSet.empty, EventuallyEq.refl _ _ ⟩ measurableSet_compl := fun _ ⟨t, ht, hts⟩ => ⟨tᶜ, ht.compl, hts.compl⟩ measurableSet_iUnion s hs := by @@ -71,7 +71,7 @@ theorem eventuallyMeasurableSet_of_mem_filter (hs : s ∈ l) : EventuallyMeasura /-- A set which is `EventuallyEq` to an `EventuallyMeasurableSet` is an `EventuallyMeasurableSet`. -/ theorem EventuallyMeasurableSet.congr - (ht : EventuallyMeasurableSet m l t) (hst : s =ᶠ[l] t) : EventuallyMeasurableSet m l s := by + (ht : EventuallyMeasurableSet m l t) (hst : s =ᶠˢ[l] t) : EventuallyMeasurableSet m l s := by rcases ht with ⟨t', ht', htt'⟩ exact ⟨t', ht', hst.trans htt'⟩ diff --git a/Mathlib/MeasureTheory/MeasurableSpace/MeasurablyGenerated.lean b/Mathlib/MeasureTheory/MeasurableSpace/MeasurablyGenerated.lean index 5c6f705086b839..671130d4eb2d97 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/MeasurablyGenerated.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/MeasurablyGenerated.lean @@ -149,7 +149,7 @@ lemma measurableSet_tendsto {_ : MeasurableSpace β} [MeasurableSpace γ] rcases l.exists_antitone_basis with ⟨u, hu⟩ rcases (Filter.hasBasis_self.mpr hl'.exists_measurable_subset).exists_antitone_subbasis with ⟨v, v_meas, hv⟩ - simp only [hu.tendsto_iff hv.toHasBasis, true_imp_iff, true_and, setOf_forall, setOf_exists] + simp only [hu.tendsto_iff hv.toHasBasis, true_imp_iff, true_and, ofPred_forall, ofPred_exists] exact .iInter fun n ↦ .iUnion fun _ ↦ .biInter (to_countable _) fun i _ ↦ (v_meas n).2.preimage (hf i) diff --git a/Mathlib/MeasureTheory/MeasurableSpace/NCard.lean b/Mathlib/MeasureTheory/MeasurableSpace/NCard.lean index 3c0a42348306c6..83fe980b14f8c0 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/NCard.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/NCard.lean @@ -23,7 +23,7 @@ variable {α : Type*} [Countable α] @[fun_prop] theorem measurable_encard : Measurable (Set.encard : Set α → ℕ∞) := - ENat.measurable_iff.2 fun _n ↦ Countable.measurableSet <| Countable.setOf_finite.mono fun _s hs ↦ + ENat.measurable_iff.2 fun _n ↦ Countable.measurableSet <| Countable.ofPred_finite.mono fun _s hs ↦ finite_of_encard_eq_coe hs @[fun_prop] diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Pi.lean b/Mathlib/MeasureTheory/MeasurableSpace/Pi.lean index 5e83d91a39cb5f..4137c0d7abecaa 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Pi.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Pi.lean @@ -31,7 +31,7 @@ variable {ι : Type*} {α : ι → Type*} lemma MeasurableSpace.pi_eq_generateFrom_projections {mα : ∀ i, MeasurableSpace (α i)} : pi = generateFrom {B | ∃ (i : ι) (A : Set (α i)), MeasurableSet A ∧ eval i ⁻¹' A = B} := by - simp only [pi, ← generateFrom_iUnion_measurableSet, iUnion_setOf, measurableSet_comap] + simp only [pi, ← generateFrom_iUnion_measurableSet, iUnion_ofPred, measurableSet_comap] /-- Boxes formed by π-systems form a π-system. -/ theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : diff --git a/Mathlib/MeasureTheory/Measure/AEDisjoint.lean b/Mathlib/MeasureTheory/Measure/AEDisjoint.lean index 564050c6820771..eb7dec2ba192de 100644 --- a/Mathlib/MeasureTheory/Measure/AEDisjoint.lean +++ b/Mathlib/MeasureTheory/Measure/AEDisjoint.lean @@ -76,13 +76,13 @@ protected theorem _root_.Set.PairwiseDisjoint.aedisjoint {f : ι → Set α} {s (hf : s.PairwiseDisjoint f) : s.Pairwise (AEDisjoint μ on f) := hf.mono' fun _i _j h => h.aedisjoint -theorem mono_ae (h : AEDisjoint μ s t) (hu : u ≤ᵐ[μ] s) (hv : v ≤ᵐ[μ] t) : AEDisjoint μ u v := +theorem mono_ae (h : AEDisjoint μ s t) (hu : u ⊆ᵐ[μ] s) (hv : v ⊆ᵐ[μ] t) : AEDisjoint μ u v := measure_mono_null_ae (hu.inter hv) h protected theorem mono (h : AEDisjoint μ s t) (hu : u ⊆ s) (hv : v ⊆ t) : AEDisjoint μ u v := mono_ae h (LE.le.eventuallyLE hu) (LE.le.eventuallyLE hv) -protected theorem congr (h : AEDisjoint μ s t) (hu : u =ᵐ[μ] s) (hv : v =ᵐ[μ] t) : +protected theorem congr (h : AEDisjoint μ s t) (hu : u =ᵐˢ[μ] s) (hv : v =ᵐˢ[μ] t) : AEDisjoint μ u v := mono_ae h (Filter.EventuallyEq.le hu) (Filter.EventuallyEq.le hv) @@ -110,12 +110,12 @@ theorem union_left (hs : AEDisjoint μ s u) (ht : AEDisjoint μ t u) : AEDisjoin theorem union_right (ht : AEDisjoint μ s t) (hu : AEDisjoint μ s u) : AEDisjoint μ s (t ∪ u) := union_right_iff.2 ⟨ht, hu⟩ -theorem sdiff_ae_eq_left (h : AEDisjoint μ s t) : (s \ t : Set α) =ᵐ[μ] s := +theorem sdiff_ae_eq_left (h : AEDisjoint μ s t) : (s \ t : Set α) =ᵐˢ[μ] s := @sdiff_self_inter _ s t ▸ sdiff_null_ae_eq_self h @[deprecated (since := "2026-06-03")] alias diff_ae_eq_left := sdiff_ae_eq_left -theorem sdiff_ae_eq_right (h : AEDisjoint μ s t) : (t \ s : Set α) =ᵐ[μ] t := +theorem sdiff_ae_eq_right (h : AEDisjoint μ s t) : (t \ s : Set α) =ᵐˢ[μ] t := sdiff_ae_eq_left <| AEDisjoint.symm h @[deprecated (since := "2026-06-03")] alias diff_ae_eq_right := sdiff_ae_eq_right diff --git a/Mathlib/MeasureTheory/Measure/AEMeasurable.lean b/Mathlib/MeasureTheory/Measure/AEMeasurable.lean index 3905185f5bf840..8ab61886563c3d 100644 --- a/Mathlib/MeasureTheory/Measure/AEMeasurable.lean +++ b/Mathlib/MeasureTheory/Measure/AEMeasurable.lean @@ -212,7 +212,7 @@ theorem exists_ae_eq_range_subset (H : AEMeasurable f μ) {t : Set β} (ht : ∀ · simp only [g, hx, piecewise_eq_of_notMem, not_false_iff] contrapose hx apply subset_toMeasurable - simp +contextual only [hx, mem_compl_iff, mem_setOf_eq, not_and, + simp +contextual only [hx, mem_compl_iff, mem_ofPred_eq, not_and, not_false_iff, imp_true_iff] · have A : μ (toMeasurable μ { x | f x = H.mk f x ∧ f x ∈ t }ᶜ) = 0 := by rw [measure_toMeasurable, ← compl_mem_ae_iff, compl_compl] @@ -222,11 +222,12 @@ theorem exists_ae_eq_range_subset (H : AEMeasurable f μ) {t : Set β} (ht : ∀ simp only [s, g, hx, piecewise_eq_of_notMem, not_false_iff] contrapose! hx apply subset_toMeasurable - simp only [hx, mem_compl_iff, mem_setOf_eq, false_and, not_false_iff] + simp only [hx, mem_compl_iff, mem_ofPred_eq, false_and, not_false_iff] theorem exists_measurable_nonneg {β} [Preorder β] [Zero β] {mβ : MeasurableSpace β} {f : α → β} (hf : AEMeasurable f μ) (f_nn : ∀ᵐ t ∂μ, 0 ≤ f t) : ∃ g, Measurable g ∧ 0 ≤ g ∧ f =ᵐ[μ] g := by - obtain ⟨G, hG_meas, hG_mem, hG_ae_eq⟩ := hf.exists_ae_eq_range_subset f_nn ⟨0, le_rfl⟩ + obtain ⟨G, hG_meas, hG_mem, hG_ae_eq⟩ := + hf.exists_ae_eq_range_subset (t := {b | 0 ≤ b}) f_nn ⟨0, le_rfl⟩ exact ⟨G, hG_meas, fun x => hG_mem (mem_range_self x), hG_ae_eq⟩ theorem subtype_mk (h : AEMeasurable f μ) {s : Set β} {hfs : ∀ x, f x ∈ s} : diff --git a/Mathlib/MeasureTheory/Measure/Comap.lean b/Mathlib/MeasureTheory/Measure/Comap.lean index be9da9dd21bcf1..d37d5f22a79bfa 100644 --- a/Mathlib/MeasureTheory/Measure/Comap.lean +++ b/Mathlib/MeasureTheory/Measure/Comap.lean @@ -109,15 +109,15 @@ theorem measure_image_eq_zero_of_comap_eq_zero (f : α → β) (μ : Measure β) theorem ae_eq_image_of_ae_eq_comap (f : α → β) (μ : Measure β) (hfi : Injective f) (hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ) - {s t : Set α} (hst : s =ᵐ[comap f μ] t) : f '' s =ᵐ[μ] f '' t := by + {s t : Set α} (hst : s =ᵐˢ[comap f μ] t) : f '' s =ᵐˢ[μ] f '' t := by rw [EventuallyEq, ae_iff] at hst ⊢ - have h_eq_α : { a : α | ¬s a = t a } = s \ t ∪ t \ s := by + have h_eq_α : { a : α | ¬(a ∈ s) = (a ∈ t) } = s \ t ∪ t \ s := by ext1 x - simp only [eq_iff_iff, mem_setOf_eq, mem_union, Set.mem_sdiff] + simp only [eq_iff_iff, mem_ofPred_eq, mem_union, Set.mem_sdiff] tauto - have h_eq_β : { a : β | ¬(f '' s) a = (f '' t) a } = f '' s \ f '' t ∪ f '' t \ f '' s := by + have h_eq_β : { a : β | ¬(a ∈ f '' s) = (a ∈ f '' t) } = f '' s \ f '' t ∪ f '' t \ f '' s := by ext1 x - simp only [eq_iff_iff, mem_setOf_eq, mem_union, Set.mem_sdiff] + simp only [eq_iff_iff, mem_ofPred_eq, mem_union, Set.mem_sdiff] tauto rw [← Set.image_sdiff hfi, ← Set.image_sdiff hfi, ← Set.image_union] at h_eq_β rw [h_eq_β] @@ -131,7 +131,7 @@ theorem NullMeasurableSet.image (f : α → β) (μ : Measure β) (hfi : Injecti refine EventuallyEq.trans ?_ (NullMeasurableSet.toMeasurable_ae_eq ?_).symm swap · exact hf _ (measurableSet_toMeasurable _ _) - have h : toMeasurable (comap f μ) s =ᵐ[comap f μ] s := + have h : toMeasurable (comap f μ) s =ᵐˢ[comap f μ] s := NullMeasurableSet.toMeasurable_ae_eq hs exact ae_eq_image_of_ae_eq_comap f μ hfi hf h.symm diff --git a/Mathlib/MeasureTheory/Measure/ContinuousPreimage.lean b/Mathlib/MeasureTheory/Measure/ContinuousPreimage.lean index f89c769332a53e..a1fed55eaaefb1 100644 --- a/Mathlib/MeasureTheory/Measure/ContinuousPreimage.lean +++ b/Mathlib/MeasureTheory/Measure/ContinuousPreimage.lean @@ -107,10 +107,10 @@ is a closed set. In particular, if `X = Y` and `s = t`, then we see that the a.e. stabilizer of a set is a closed set. -/ -theorem isClosed_setOf_preimage_ae_eq {f : Z → C(X, Y)} (hf : Continuous f) +theorem isClosed_setOfPred_preimage_ae_eq {f : Z → C(X, Y)} (hf : Continuous f) (hfm : ∀ z, MeasurePreserving (f z) μ ν) (s : Set X) {t : Set Y} (htm : NullMeasurableSet t ν) (ht : ν t ≠ ∞) : - IsClosed {z | f z ⁻¹' t =ᵐ[μ] s} := by + IsClosed {z | f z ⁻¹' t =ᵐˢ[μ] s} := by rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] intro z hz replace hz : ∀ᶠ ε : ℝ≥0∞ in 𝓝 0, ε < μ ((f z ⁻¹' t) ∆ s) := by @@ -118,8 +118,11 @@ theorem isClosed_setOf_preimage_ae_eq {f : Z → C(X, Y)} (hf : Continuous f) rwa [pos_iff_ne_zero, ne_eq, measure_symmDiff_eq_zero_iff] filter_upwards [(tendsto_measure_symmDiff_preimage_nhds_zero (hf.tendsto z) (.of_forall hfm) (hfm z) htm ht).eventually hz] with w hw - intro (hw' : f w ⁻¹' t =ᵐ[μ] s) - rw [measure_congr (hw'.symmDiff (ae_eq_refl _)), symmDiff_comm] at hw + intro (hw' : f w ⁻¹' t =ᵐˢ[μ] s) + rw [measure_congr (hw'.symmDiff (ae_eq_refl (· ∈ ⇑(f z) ⁻¹' t))), symmDiff_comm] at hw exact hw.false +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_preimage_ae_eq := isClosed_setOfPred_preimage_ae_eq + end MeasureTheory diff --git a/Mathlib/MeasureTheory/Measure/Decomposition/Exhaustion.lean b/Mathlib/MeasureTheory/Measure/Decomposition/Exhaustion.lean index 0bc097a039a1c1..1c025c54579d99 100644 --- a/Mathlib/MeasureTheory/Measure/Decomposition/Exhaustion.lean +++ b/Mathlib/MeasureTheory/Measure/Decomposition/Exhaustion.lean @@ -62,7 +62,7 @@ variable {α : Type*} {mα : MeasurableSpace α} {μ ν : Measure α} {s t : Set open scoped Classical in /-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetWRT ν)` is sigma-finite and for all measurable sets `t ⊆ sᶜ`, either `ν t = 0` or `μ t = ∞`. -/ -def Measure.sigmaFiniteSetWRT (μ ν : Measure α) : Set α := +noncomputable def Measure.sigmaFiniteSetWRT (μ ν : Measure α) : Set α := if h : ∃ s : Set α, MeasurableSet s ∧ SigmaFinite (μ.restrict s) ∧ (∀ t, t ⊆ sᶜ → ν t ≠ 0 → μ t = ∞) then h.choose @@ -123,7 +123,7 @@ lemma exists_isSigmaFiniteSet_measure_ge (μ ν : Measure α) [IsFiniteMeasure /-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetGE ν n)` is sigma-finite and for `C` the supremum of `ν s` over all measurable sets `s` with `μ.restrict s` sigma-finite, `ν (μ.sigmaFiniteSetGE ν n) ≥ C - 1/n`. -/ -def Measure.sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) : Set α := +noncomputable def Measure.sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) : Set α := (exists_isSigmaFiniteSet_measure_ge μ ν n).choose lemma measurableSet_sigmaFiniteSetGE [IsFiniteMeasure ν] (n : ℕ) : @@ -159,7 +159,7 @@ lemma tendsto_measure_sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] /-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetWRT' ν)` is sigma-finite and `ν (μ.sigmaFiniteSetWRT' ν)` has maximal measure among such sets. -/ -def Measure.sigmaFiniteSetWRT' (μ ν : Measure α) [IsFiniteMeasure ν] : Set α := +noncomputable def Measure.sigmaFiniteSetWRT' (μ ν : Measure α) [IsFiniteMeasure ν] : Set α := ⋃ n, μ.sigmaFiniteSetGE ν n lemma measurableSet_sigmaFiniteSetWRT' [IsFiniteMeasure ν] : @@ -304,7 +304,7 @@ section SigmaFiniteSet /-- A measurable set such that `μ.restrict μ.sigmaFiniteSet` is sigma-finite, and for all measurable sets `s ⊆ μ.sigmaFiniteSetᶜ`, either `μ s = 0` or `μ s = ∞`. -/ -def Measure.sigmaFiniteSet (μ : Measure α) : Set α := μ.sigmaFiniteSetWRT μ +noncomputable def Measure.sigmaFiniteSet (μ : Measure α) : Set α := μ.sigmaFiniteSetWRT μ @[measurability] lemma measurableSet_sigmaFiniteSet : MeasurableSet μ.sigmaFiniteSet := diff --git a/Mathlib/MeasureTheory/Measure/Decomposition/IntegralRNDeriv.lean b/Mathlib/MeasureTheory/Measure/Decomposition/IntegralRNDeriv.lean index 1a0daa3c7fba7e..c0208fbb633ae9 100644 --- a/Mathlib/MeasureTheory/Measure/Decomposition/IntegralRNDeriv.lean +++ b/Mathlib/MeasureTheory/Measure/Decomposition/IntegralRNDeriv.lean @@ -168,7 +168,7 @@ lemma _root_.ConvexOn.apply_rnDeriv_ae_le_integral (hf : StronglyMeasurable f) have h_compProd : (fun p ↦ μ.rnDeriv ν p.1 * (μ ⊗ₘ κ).rnDeriv (μ ⊗ₘ η) p) =ᵐ[ν ⊗ₘ η] (μ ⊗ₘ κ).rnDeriv (ν ⊗ₘ η) := (rnDeriv_compProd hκη ν).symm rwa [Filter.EventuallyEq, Measure.ae_compProd_iff] at h_compProd - simp only [measurableSet_setOf] + simp only [measurableSet_setOfPred] fun_prop filter_upwards [h_ae1, h_ae2, h_lt_top, h_integrable.1, h_int.1] with a h_eq_one h_mul_eq h_lt_top h_int' h_int diff --git a/Mathlib/MeasureTheory/Measure/Decomposition/Lebesgue.lean b/Mathlib/MeasureTheory/Measure/Decomposition/Lebesgue.lean index 810ec64d0ba490..4a4440baecdf5c 100644 --- a/Mathlib/MeasureTheory/Measure/Decomposition/Lebesgue.lean +++ b/Mathlib/MeasureTheory/Measure/Decomposition/Lebesgue.lean @@ -779,7 +779,7 @@ theorem sup_mem_measurableLE {f g : α → ℝ≥0∞} (hf : f ∈ measurableLE have h₂ := hA.inter (measurableSet_lt hg.1 hf.1) rw [setLIntegral_max hf.1 hg.1] refine (add_le_add (hg.2 _ h₁) (hf.2 _ h₂)).trans_eq ?_ - simp only [← not_le, ← compl_setOf, ← sdiff_eq] + simp only [← not_le, ← compl_ofPred, ← sdiff_eq] exact measure_inter_add_sdiff _ (measurableSet_le hf.1 hg.1) theorem iSup_succ_eq_sup {α} (f : ℕ → α → ℝ≥0∞) (m : ℕ) (a : α) : @@ -833,7 +833,7 @@ theorem iSup_le_le {α : Type*} (f : ℕ → α → ℝ≥0∞) (n k : ℕ) (hk end SuprLemmas /-- `measurableLEEval μ ν` is the set of `∫⁻ x, f x ∂μ` for all `f ∈ measurableLE μ ν`. -/ -def measurableLEEval (μ ν : Measure α) : Set ℝ≥0∞ := +noncomputable def measurableLEEval (μ ν : Measure α) : Set ℝ≥0∞ := (fun f : α → ℝ≥0∞ ↦ ∫⁻ x, f x ∂μ) '' measurableLE μ ν end LebesgueDecomposition diff --git a/Mathlib/MeasureTheory/Measure/EverywherePos.lean b/Mathlib/MeasureTheory/Measure/EverywherePos.lean index e0c8061995c45e..b2e22c7d119aae 100644 --- a/Mathlib/MeasureTheory/Measure/EverywherePos.lean +++ b/Mathlib/MeasureTheory/Measure/EverywherePos.lean @@ -116,7 +116,7 @@ lemma measure_eq_zero_of_subset_sdiff_everywherePosSubset /-- In a space with an inner regular measure, any measurable set coincides almost everywhere with its everywhere positive subset. -/ lemma everywherePosSubset_ae_eq [OpensMeasurableSpace α] [InnerRegular μ] (hs : MeasurableSet s) : - μ.everywherePosSubset s =ᵐ[μ] s := by + μ.everywherePosSubset s =ᵐˢ[μ] s := by simp only [ae_eq_set, sdiff_eq_empty.mpr (everywherePosSubset_subset μ s), measure_empty, true_and, (hs.diff hs.everywherePosSubset).measure_eq_iSup_isCompact, ENNReal.iSup_eq_zero] intro k hk h'k @@ -126,7 +126,7 @@ lemma everywherePosSubset_ae_eq [OpensMeasurableSpace α] [InnerRegular μ] (hs measure coincides almost everywhere with its everywhere positive subset. -/ lemma everywherePosSubset_ae_eq_of_measure_ne_top [OpensMeasurableSpace α] [InnerRegularCompactLTTop μ] (hs : MeasurableSet s) (h's : μ s ≠ ∞) : - μ.everywherePosSubset s =ᵐ[μ] s := by + μ.everywherePosSubset s =ᵐˢ[μ] s := by have A : μ (s \ μ.everywherePosSubset s) ≠ ∞ := ((measure_mono sdiff_subset).trans_lt h's.lt_top).ne simp only [ae_eq_set, sdiff_eq_empty.mpr (everywherePosSubset_subset μ s), measure_empty, @@ -147,8 +147,8 @@ lemma isEverywherePos_everywherePosSubset have A : 0 < μ (u ∩ s) := by have : u ∩ s ∈ 𝓝[s] x := by rw [inter_comm]; exact inter_mem_nhdsWithin s u_mem exact hx.2 _ this - have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐ[μ] (u ∩ s : Set α) := - ae_eq_set_inter (ae_eq_refl _) (everywherePosSubset_ae_eq hs) + have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐˢ[μ] (u ∩ s : Set α) := + ae_eq_set_inter (ae_eq_refl (· ∈ u)) (everywherePosSubset_ae_eq hs) rw [← B.measure_eq] at A exact A.trans_le (measure_mono hu) @@ -165,8 +165,8 @@ lemma isEverywherePos_everywherePosSubset_of_measure_ne_top have A : 0 < μ (u ∩ s) := by have : u ∩ s ∈ 𝓝[s] x := by rw [inter_comm]; exact inter_mem_nhdsWithin s u_mem exact hx.2 _ this - have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐ[μ] (u ∩ s : Set α) := - ae_eq_set_inter (ae_eq_refl _) (everywherePosSubset_ae_eq_of_measure_ne_top hs h's) + have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐˢ[μ] (u ∩ s : Set α) := + ae_eq_set_inter (ae_eq_refl (· ∈ u)) (everywherePosSubset_ae_eq_of_measure_ne_top hs h's) rw [← B.measure_eq] at A exact A.trans_le (measure_mono hu) diff --git a/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean b/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean index 76562fe0173c36..ca91283927d66f 100644 --- a/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean +++ b/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean @@ -338,7 +338,7 @@ lemma measurableSet_isFiniteMeasure : MeasurableSet { μ : Measure Ω | IsFinite rw [this] exact Measure.measurable_coe MeasurableSet.univ measurableSet_Ico ext μ - simp only [mem_setOf_eq, mem_preimage, mem_Ico, zero_le, true_and] + simp only [mem_ofPred_eq, mem_preimage, mem_Ico, zero_le, true_and] exact isFiniteMeasure_iff μ /-- The monoidal product is a measurable function from the product of finite measures over @@ -354,7 +354,7 @@ theorem measurable_fun_prod {α β : Type*} [MeasurableSpace α] [MeasurableSpac ((Measure.measurable_coe Hv).comp (measurable_subtype_coe.comp measurable_snd)) apply Measurable.measure_of_isPiSystem generateFrom_prod.symm isPiSystem_prod _ · simp_rw [← Set.univ_prod_univ, Measure.prod_prod, Heval MeasurableSet.univ MeasurableSet.univ] - simp only [mem_image2, mem_setOf_eq, forall_exists_index, and_imp] + simp only [mem_image2, mem_ofPred_eq, forall_exists_index, and_imp] intro _ _ Hu _ Hv Heq simp_rw [← Heq, Measure.prod_prod, Heval Hu Hv] @@ -990,7 +990,7 @@ lemma Topology.IsClosedEmbedding.isEmbedding_map_finiteMeasure {Ω : Type*} let B : FiniteMeasure Ω ≃ₜ M := { toFun μ := by refine ⟨μ.map f, ?_⟩ - simp only [null_iff_toMeasure_null, mem_setOf_eq, toMeasure_map, M] + simp only [null_iff_toMeasure_null, mem_ofPred_eq, toMeasure_map, M] rw [Measure.map_apply hf.continuous.measurable hf.isClosed_range.isOpen_compl.measurableSet] simp invFun := M.restrict (fun μ ↦ μ.comap f) diff --git a/Mathlib/MeasureTheory/Measure/Haar/Basic.lean b/Mathlib/MeasureTheory/Measure/Haar/Basic.lean index 43a481127a239a..9f0318ba78dbbb 100644 --- a/Mathlib/MeasureTheory/Measure/Haar/Basic.lean +++ b/Mathlib/MeasureTheory/Measure/Haar/Basic.lean @@ -125,7 +125,7 @@ def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) := @[to_additive (attr := simp)] theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} : f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by - simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq] + simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_ofPred_eq] /-- The closure of the collection of elements of the form `prehaar K₀ U`, for `U` open neighbourhoods of `1`, contained in `V`. The closure is taken in the space @@ -166,7 +166,7 @@ theorem le_index_mul (K₀ : PositiveCompacts G) (K : Compacts G) {V : Set G} obtain ⟨t, h1t, h2t⟩ := index_elim K₀.isCompact hV rw [← h2s, ← h2t, mul_comm] refine le_trans ?_ Finset.card_mul_le - apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq]; refine Subset.trans h1s ?_ + apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_ofPred_eq]; refine Subset.trans h1s ?_ apply iUnion₂_subset; intro g₁ hg₁; rw [preimage_subset_iff]; intro g₂ hg₂ have := h1t hg₂ rcases this with ⟨_, ⟨g₃, rfl⟩, A, ⟨hg₃, rfl⟩, h2V⟩; rw [mem_preimage, ← mul_assoc] at h2V @@ -198,7 +198,7 @@ theorem index_union_le (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).N rcases index_elim K₂.2 hV with ⟨t, h1t, h2t⟩ rw [← h2s, ← h2t] refine le_trans (Nat.sInf_le ⟨_, ?_, rfl⟩) (Finset.card_union_le _ _) - rw [mem_setOf_eq, Finset.set_biUnion_union] + rw [mem_ofPred_eq, Finset.set_biUnion_union] gcongr @[to_additive addIndex_union_eq] @@ -210,7 +210,7 @@ theorem index_union_eq (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).N rcases index_elim (K₁.2.union K₂.2) hV with ⟨s, h1s, h2s⟩; rw [← h2s] have (K : Set G) (hK : K ⊆ ⋃ g ∈ s, (g * ·) ⁻¹' V) : index K V ≤ {g ∈ s | ((g * ·) ⁻¹' V ∩ K).Nonempty}.card := by - apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq] + apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_ofPred_eq] intro g hg; rcases hK hg with ⟨_, ⟨g₀, rfl⟩, _, ⟨h1g₀, rfl⟩, h2g₀⟩ simp only [mem_preimage] at h2g₀ simp only [mem_iUnion]; use g₀; constructor; swap @@ -241,7 +241,7 @@ theorem mul_left_index_le {K : Set G} (hK : IsCompact K) {V : Set G} (hV : (inte rcases index_elim hK hV with ⟨s, h1s, h2s⟩; rw [← h2s] apply Nat.sInf_le; rw [mem_image] refine ⟨s.map (Equiv.mulRight g⁻¹).toEmbedding, ?_, Finset.card_map _⟩ - simp only [mem_setOf_eq]; refine Subset.trans (image_mono h1s) ?_ + simp only [mem_ofPred_eq]; refine Subset.trans (image_mono h1s) ?_ rintro _ ⟨g₁, ⟨_, ⟨g₂, rfl⟩, ⟨_, ⟨hg₂, rfl⟩, hg₁⟩⟩, rfl⟩ simp only [mem_preimage] at hg₁ simp only [exists_prop, mem_iUnion, Finset.mem_map, Equiv.coe_mulRight, @@ -333,7 +333,7 @@ theorem nonempty_iInter_clPrehaar (K₀ : PositiveCompacts G) : constructor · apply prehaar_mem_haarProduct K₀; use 1; rwa [h1V₀.interior_eq] · simp only [mem_iInter]; rintro ⟨V, hV⟩ h2V; apply subset_closure - apply mem_image_of_mem; rw [mem_setOf_eq] + apply mem_image_of_mem; rw [mem_ofPred_eq] exact ⟨Subset.trans (iInter_subset _ ⟨V, hV⟩) (iInter_subset _ h2V), h1V₀, h2V₀⟩ /-! diff --git a/Mathlib/MeasureTheory/Measure/Haar/Extension.lean b/Mathlib/MeasureTheory/Measure/Haar/Extension.lean index 263f6c3b681fd6..efad2244d7c371 100644 --- a/Mathlib/MeasureTheory/Measure/Haar/Extension.lean +++ b/Mathlib/MeasureTheory/Measure/Haar/Extension.lean @@ -117,7 +117,7 @@ noncomputable def pushforward : have h (a) (ha : a ∈ S) : edist (H.pullback f (t * b) a) (H.pullback f b a) ≤ .ofReal δ := by rw [edist_dist] exact ENNReal.ofReal_le_ofReal (@hf ⟨t * b * φ a, b * φ a⟩ (by simpa)).le - grw [Set.mem_setOf_eq, dist_integral_le_lintegral_edist (H.pullback f (t * b)).integrable + grw [Set.mem_ofPred_eq, dist_integral_le_lintegral_edist (H.pullback f (t * b)).integrable (H.pullback f b).integrable, ← setLIntegral_eq_of_support_subset] · refine ENNReal.toReal_lt_of_lt_ofReal ((setLIntegral_mono measurable_const h).trans_lt ?_) rwa [lintegral_const, restrict_apply_univ] diff --git a/Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean b/Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean index 7d99663857af69..3b37fa5afdb388 100644 --- a/Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean +++ b/Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean @@ -58,7 +58,7 @@ theorem parallelepiped_basis_eq (b : Basis ι ℝ E) : parallelepiped b = {x | ∀ i, b.repr x i ∈ Set.Icc 0 1} := by classical ext x - simp_rw [mem_parallelepiped_iff, mem_setOf_eq, b.ext_elem_iff, _root_.map_sum, + simp_rw [mem_parallelepiped_iff, mem_ofPred_eq, b.ext_elem_iff, _root_.map_sum, map_smul, Finset.sum_apply', Basis.repr_self, Finsupp.smul_single, smul_eq_mul, mul_one, Finsupp.single_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true, mem_Icc, Pi.le_def, Pi.zero_apply, Pi.one_apply, ← forall_and] diff --git a/Mathlib/MeasureTheory/Measure/Haar/Unique.lean b/Mathlib/MeasureTheory/Measure/Haar/Unique.lean index 870fefd7dbc122..1942ac909717c5 100644 --- a/Mathlib/MeasureTheory/Measure/Haar/Unique.lean +++ b/Mathlib/MeasureTheory/Measure/Haar/Unique.lean @@ -742,7 +742,7 @@ theorem measure_isHaarMeasure_eq_smul_of_isEverywherePos [LocallyCompactSpace G] refine ⟨⋃ a ∈ c, a, ⟨?_, ?_⟩, ?_⟩ · simp only [iUnion_subset_iff] intro a ac x hx - simp only [A, subset_def, mem_setOf_eq] at cA + simp only [A, subset_def, mem_ofPred_eq] at cA exact (cA _ ac).1 x hx · rintro x hx y hy hxy simp only [mem_iUnion, exists_prop] at hx hy diff --git a/Mathlib/MeasureTheory/Measure/HasOuterApproxClosedProd.lean b/Mathlib/MeasureTheory/Measure/HasOuterApproxClosedProd.lean index ade03081e94b2a..b862f58d038247 100644 --- a/Mathlib/MeasureTheory/Measure/HasOuterApproxClosedProd.lean +++ b/Mathlib/MeasureTheory/Measure/HasOuterApproxClosedProd.lean @@ -90,9 +90,9 @@ lemma ext_of_lintegral_prod_mul_prod_boundedContinuousFunction rintro - ⟨-, ⟨s₁, hs₁, rfl⟩, -, ⟨t₁, ht₁, rfl⟩, rfl⟩ - ⟨-, ⟨s₂, hs₂, rfl⟩, -, ⟨t₂, ht₂, rfl⟩, rfl⟩ - refine ⟨_, ⟨fun i ↦ s₁ i ∩ s₂ i, ?_, rfl⟩, _, ⟨fun j ↦ t₁ j ∩ t₂ j, ?_, rfl⟩, ?_⟩ - · simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at hs₁ hs₂ ⊢ + · simp only [Set.mem_pi, mem_univ, mem_ofPred_eq, forall_const] at hs₁ hs₂ ⊢ exact fun i ↦ (hs₁ i).inter (hs₂ i) - · simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at ht₁ ht₂ ⊢ + · simp only [Set.mem_pi, mem_univ, mem_ofPred_eq, forall_const] at ht₁ ht₂ ⊢ exact fun j ↦ (ht₁ j).inter (ht₂ j) simp [Set.pi_inter_distrib, Set.prod_inter_prod] have hπ2 : Prod.instMeasurableSpace = generateFrom π := by @@ -108,7 +108,7 @@ lemma ext_of_lintegral_prod_mul_prod_boundedContinuousFunction · exact ⟨fun _ ↦ Set.univ, fun _ ↦ ⟨fun _ ↦ Set.univ, by simp, by simp⟩, iUnion_const _⟩ refine ext_of_generate_finite π hπ2 hπ1 ?_ hμν rintro - ⟨-, ⟨s, hs, rfl⟩, -, ⟨t, ht, rfl⟩, rfl⟩ - simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at hs ht + simp only [Set.mem_pi, mem_univ, mem_ofPred_eq, forall_const] at hs ht have (p : (Π i, X i) × (Π j, Y j)) := ENNReal.continuous_coe.tendsto _ |>.comp <| (tendsto_finsetProd Finset.univ (fun i _ ↦ tendsto_pi_nhds.1 (HasOuterApproxClosed.tendsto_apprSeq (hs i)) (p.1 i))).mul diff --git a/Mathlib/MeasureTheory/Measure/Hausdorff.lean b/Mathlib/MeasureTheory/Measure/Hausdorff.lean index 8a42736fa80c53..4f3f2fe90903da 100644 --- a/Mathlib/MeasureTheory/Measure/Hausdorff.lean +++ b/Mathlib/MeasureTheory/Measure/Hausdorff.lean @@ -167,8 +167,8 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory : fun x hx y hy ↦ hx.2.trans <| infEDist_le_edist_of_mem hy⟩ have Ssep' : ∀ n, Metric.AreSeparated (S n) (s ∩ t) := fun n => (Ssep n).mono Subset.rfl inter_subset_right - have S_sub : ∀ n, S n ⊆ s \ t := fun n => - subset_inter inter_subset_left (Ssep n).subset_compl_right + have S_sub : ∀ n, S n ⊆ s \ t := fun n x hx => + ⟨hx.1, (Ssep n).subset_compl_right hx⟩ have hSs : ∀ n, μ (s ∩ t) + μ (S n) ≤ μ s := fun n => calc μ (s ∩ t) + μ (S n) = μ (s ∩ t ∪ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm @@ -211,8 +211,8 @@ theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory : · exact μ.mono (iUnion_subset fun i => iUnion_subset fun _ x hx => mem_iUnion.2 ⟨_, hx.1⟩) suffices ∀ i j, i < j → Metric.AreSeparated (S (2 * i + 1 + r)) (s \ S (2 * j + r)) from fun i _ j _ hij => hij.lt_or_gt.elim - (fun h => (this i j h).mono inter_subset_left fun x hx => by exact ⟨hx.1.1, hx.2⟩) - fun h => (this j i h).symm.mono (fun x hx => by exact ⟨hx.1.1, hx.2⟩) inter_subset_left + (fun h => (this i j h).mono sdiff_subset fun x hx => by exact ⟨hx.1.1, hx.2⟩) + fun h => (this j i h).symm.mono (fun x hx => by exact ⟨hx.1.1, hx.2⟩) sdiff_subset intro i j hj have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ := by rw [ENNReal.inv_lt_inv, Nat.cast_lt]; lia @@ -328,7 +328,7 @@ theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0 le_of_tendsto_of_tendsto (mkMetric'.tendsto_pre _ s) (ENNReal.Tendsto.const_mul (mkMetric'.tendsto_pre _ s) (Or.inr hc)) (mem_of_superset (Ioo_mem_nhdsGT hr0) fun r' hr' => ?_) - simp only [mem_setOf_eq, mkMetric'.pre] + simp only [mem_ofPred_eq, mkMetric'.pre] rw [← smul_eq_mul, ← smul_apply, smul_boundedBy hc] refine le_boundedBy.2 (fun t => (boundedBy_le _).trans ?_) _ simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if] diff --git a/Mathlib/MeasureTheory/Measure/IntegralCharFun.lean b/Mathlib/MeasureTheory/Measure/IntegralCharFun.lean index cae25b2ff94c6a..a147f659357e92 100644 --- a/Mathlib/MeasureTheory/Measure/IntegralCharFun.lean +++ b/Mathlib/MeasureTheory/Measure/IntegralCharFun.lean @@ -98,7 +98,7 @@ lemma measureReal_abs_gt_le_integral_charFun [IsProbabilityMeasure μ] (hr : 0 < calc μ.real {x | r < |x|} _ = μ.real {x | 2 < |2 * r⁻¹ * x|} := by congr 1 with x - simp only [Set.mem_setOf_eq, abs_mul, Nat.abs_ofNat] + simp only [Set.mem_ofPred_eq, abs_mul, Nat.abs_ofNat] rw [abs_of_nonneg (a := r⁻¹) (by positivity), mul_assoc, ← inv_mul_lt_iff₀ (by positivity), inv_mul_cancel₀ (by positivity), lt_inv_mul_iff₀ (by positivity), mul_one] _ = ∫ x in {x | 2 < |2 * r⁻¹ * x|}, 1 ∂μ := by simp @@ -111,10 +111,11 @@ lemma measureReal_abs_gt_le_integral_charFun [IsProbabilityMeasure μ] (hr : 0 < refine setIntegral_mono_on ?_ ((integrable_const _).sub (integrable_sinc_const_mul _)).integrableOn ?_ fun x hx ↦ ?_ · exact Integrable.integrableOn <| by fun_prop - · exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop) + · exact MeasurableSet.preimage (f := fun x : ℝ ↦ |2 * r⁻¹ * x|) measurableSet_Ioi + (by fun_prop) · have hx_ne : 2 * r⁻¹ * x ≠ 0 := by intro hx0 - simp only [hx0, Set.mem_setOf_eq, abs_zero] at hx + simp only [hx0, Set.mem_ofPred_eq, abs_zero] at hx linarith rw [le_sub_iff_add_le, ← le_sub_iff_add_le'] norm_num @@ -155,7 +156,7 @@ lemma measureReal_abs_dual_gt_le_integral_charFunDual {E : Type*} [NormedAddComm convert! measureReal_abs_gt_le_integral_charFun (μ := μ.map L) hr with x · rw [map_measureReal_apply (by fun_prop)] · simp - · exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop) + · exact MeasurableSet.preimage (f := fun x : ℝ ↦ |x|) measurableSet_Ioi (by fun_prop) · rw [charFun_map_eq_charFunDual_smul] /-- A bound on the measure of the set `{x | r < |⟪a, x⟫|}` in terms of the integral of @@ -169,7 +170,7 @@ lemma measureReal_abs_inner_gt_le_integral_charFun {E : Type*} [SeminormedAddCom convert! measureReal_abs_gt_le_integral_charFun (μ := μ.map (fun x ↦ ⟪a, x⟫)) hr with x · rw [map_measureReal_apply (by fun_prop)] · simp - · exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop) + · exact MeasurableSet.preimage (f := fun x : ℝ ↦ |x|) measurableSet_Ioi (by fun_prop) · simp only [charFun_apply, inner_smul_right, conj_trivial, ofReal_mul, RCLike.inner_apply] rw [integral_map (by fun_prop) (by fun_prop)] simp_rw [real_inner_comm a] diff --git a/Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean b/Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean index 817ddd25d63ce9..a5b08be5b50168 100644 --- a/Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean +++ b/Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean @@ -453,14 +453,14 @@ def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) := { p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) } theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by - simpa only [prod_univ, regionBetween, Set.preimage, setOf_subset_setOf] using fun a => And.left + simpa only [prod_univ, regionBetween, Set.preimage, ofPred_subset_ofPred] using fun a => And.left variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α} /-- The region between two measurable functions on a measurable set is measurable. -/ theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) : MeasurableSet (regionBetween f g s) := by - dsimp only [regionBetween, Ioo, mem_setOf_eq, setOf_and] + dsimp only [regionBetween, Ioo, mem_ofPred_eq, ofPred_and] refine MeasurableSet.inter ?_ ((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter @@ -472,7 +472,7 @@ a version for the region together with the graph of the upper function. -/ theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) : MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst) } := by - dsimp only [regionBetween, Ioc, mem_setOf_eq, setOf_and] + dsimp only [regionBetween, Ioc, mem_ofPred_eq, ofPred_and] refine MeasurableSet.inter ?_ ((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter @@ -484,7 +484,7 @@ a version for the region together with the graph of the lower function. -/ theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) : MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst) } := by - dsimp only [regionBetween, Ico, mem_setOf_eq, setOf_and] + dsimp only [regionBetween, Ico, mem_ofPred_eq, ofPred_and] refine MeasurableSet.inter ?_ ((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter @@ -496,7 +496,7 @@ a version for the region together with the graphs of both functions. -/ theorem measurableSet_region_between_cc (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) : MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst) } := by - dsimp only [regionBetween, Icc, mem_setOf_eq, setOf_and] + dsimp only [regionBetween, Icc, mem_ofPred_eq, ofPred_and] refine MeasurableSet.inter ?_ ((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter @@ -523,7 +523,7 @@ theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable simp only [hx, Real.volume_Ioo] · have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = ∅ := by simp [h] simp only [hx, measure_empty] - dsimp only [regionBetween, preimage_setOf_eq] + dsimp only [regionBetween, preimage_ofPred_eq] rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply] · exact measurableSet_regionBetween hf hg hs @@ -541,10 +541,10 @@ theorem volume_regionBetween_eq_lintegral [SFinite μ] (hf : AEMeasurable f (μ. (μ.restrict s).prod volume (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s) := by apply measure_congr - apply EventuallyEq.rfl.inter - exact - ((quasiMeasurePreserving_fst.ae_eq_comp hf.ae_eq_mk).comp₂ _ EventuallyEq.rfl).inter - (EventuallyEq.rfl.comp₂ _ <| quasiMeasurePreserving_fst.ae_eq_comp hg.ae_eq_mk) + filter_upwards [quasiMeasurePreserving_fst.ae_eq_comp hf.ae_eq_mk, + quasiMeasurePreserving_fst.ae_eq_comp hg.ae_eq_mk] with p hpf hpg + simp only [Function.comp_apply] at hpf hpg + simp only [regionBetween, mem_ofPred_eq, mem_Ioo, hpf, hpg] rw [lintegral_congr_ae h₁, ← volume_regionBetween_eq_lintegral' hf.measurable_mk hg.measurable_mk hs] convert! h₂ using 1 @@ -560,10 +560,14 @@ lemma nullMeasurableSet_regionBetween (μ : Measure α) {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ) {s : Set α} (s_mble : NullMeasurableSet s μ) : NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioo (f p.fst) (g p.fst)} (μ.prod volume) := by + change NullMeasurableSet + (Prod.fst ⁻¹' s ∩ ({p : α × ℝ | f p.fst < p.snd} ∩ {p : α × ℝ | p.snd < g p.fst})) _ refine NullMeasurableSet.inter (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_) - · exact nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable - · exact nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop) + · exact nullMeasurableSet_lt (f := fun p : α × ℝ ↦ f p.fst) (by fun_prop) + measurable_snd.aemeasurable + · exact nullMeasurableSet_lt (g := fun p : α × ℝ ↦ g p.fst) measurable_snd.aemeasurable + (by fun_prop) /-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable; a version for the region together with the graph of the upper function. -/ @@ -571,14 +575,17 @@ lemma nullMeasurableSet_region_between_oc (μ : Measure α) {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ) {s : Set α} (s_mble : NullMeasurableSet s μ) : NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst)} (μ.prod volume) := by + change NullMeasurableSet + (Prod.fst ⁻¹' s ∩ ({p : α × ℝ | f p.fst < p.snd} ∩ {p : α × ℝ | p.snd ≤ g p.fst})) _ refine NullMeasurableSet.inter (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_) - · exact nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable - · change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume) - rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by + · exact nullMeasurableSet_lt (f := fun p : α × ℝ ↦ f p.fst) (by fun_prop) + measurable_snd.aemeasurable + · rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by ext p simp] - exact (nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable).compl + exact (nullMeasurableSet_lt (f := fun p : α × ℝ ↦ g p.fst) (by fun_prop) + measurable_snd.aemeasurable).compl /-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable; a version for the region together with the graph of the lower function. -/ @@ -586,14 +593,17 @@ lemma nullMeasurableSet_region_between_co (μ : Measure α) {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ) {s : Set α} (s_mble : NullMeasurableSet s μ) : NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst)} (μ.prod volume) := by + change NullMeasurableSet + (Prod.fst ⁻¹' s ∩ ({p : α × ℝ | f p.fst ≤ p.snd} ∩ {p : α × ℝ | p.snd < g p.fst})) _ refine NullMeasurableSet.inter (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_) - · change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume) - rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by + · rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by ext p simp] - exact (nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)).compl - · exact nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop) + exact (nullMeasurableSet_lt (g := fun p : α × ℝ ↦ f p.fst) measurable_snd.aemeasurable + (by fun_prop)).compl + · exact nullMeasurableSet_lt (g := fun p : α × ℝ ↦ g p.fst) measurable_snd.aemeasurable + (by fun_prop) /-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable; a version for the region together with the graphs of both functions. -/ @@ -601,18 +611,20 @@ lemma nullMeasurableSet_region_between_cc (μ : Measure α) {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ) {s : Set α} (s_mble : NullMeasurableSet s μ) : NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst)} (μ.prod volume) := by + change NullMeasurableSet + (Prod.fst ⁻¹' s ∩ ({p : α × ℝ | f p.fst ≤ p.snd} ∩ {p : α × ℝ | p.snd ≤ g p.fst})) _ refine NullMeasurableSet.inter (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_) - · change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume) - rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by + · rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by ext p simp] - exact (nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)).compl - · change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume) - rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by + exact (nullMeasurableSet_lt (g := fun p : α × ℝ ↦ f p.fst) measurable_snd.aemeasurable + (by fun_prop)).compl + · rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by ext p simp] - exact (nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable).compl + exact (nullMeasurableSet_lt (f := fun p : α × ℝ ↦ g p.fst) (by fun_prop) + measurable_snd.aemeasurable).compl end regionBetween diff --git a/Mathlib/MeasureTheory/Measure/Lebesgue/VolumeOfBalls.lean b/Mathlib/MeasureTheory/Measure/Lebesgue/VolumeOfBalls.lean index 81fef1f10b6d72..a04496e261e128 100644 --- a/Mathlib/MeasureTheory/Measure/Lebesgue/VolumeOfBalls.lean +++ b/Mathlib/MeasureTheory/Measure/Lebesgue/VolumeOfBalls.lean @@ -192,11 +192,11 @@ theorem MeasureTheory.volume_sum_rpow_lt [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) · have : {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) < r} = ∅ := by ext x refine ⟨fun hx => ?_, fun hx => hx.elim⟩ - exact not_le.mpr (lt_of_lt_of_le (Set.mem_setOf.mp hx) hr) (h₂ x) + exact not_le.mpr (lt_of_lt_of_le (Set.mem_ofPred.mp hx) hr) (h₂ x) rw [this, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow Fin.pos'.ne', zero_mul] · rw [← volume_sum_rpow_lt_one _ hp, ← ofReal_pow (le_of_lt hr), ← finrank_pi ℝ] convert! addHaar_smul_of_nonneg volume (le_of_lt hr) {x : ι → ℝ | ∑ i, |x i| ^ p < 1} using 2 - simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_setOf_eq, Pi.smul_apply, + simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_ofPred_eq, Pi.smul_apply, smul_eq_mul, abs_mul, mul_rpow (abs_nonneg _) (abs_nonneg _), abs_inv, inv_rpow (abs_nonneg _), ← Finset.mul_sum, abs_eq_self.mpr (le_of_lt hr), inv_mul_lt_iff₀ (rpow_pos_of_pos hr _), mul_one, ← rpow_lt_rpow_iff @@ -267,11 +267,11 @@ theorem Complex.volume_sum_rpow_lt [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) (r : · have : {x : ι → ℂ | (∑ i, ‖x i‖ ^ p) ^ (1 / p) < r} = ∅ := by ext x refine ⟨fun hx => ?_, fun hx => hx.elim⟩ - exact not_le.mpr (lt_of_lt_of_le (Set.mem_setOf.mp hx) hr) (h₂ x) + exact not_le.mpr (lt_of_lt_of_le (Set.mem_ofPred.mp hx) hr) (h₂ x) rw [this, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow Fin.pos'.ne', zero_mul] · rw [← Complex.volume_sum_rpow_lt_one _ hp, ← ENNReal.ofReal_pow (le_of_lt hr)] convert! addHaar_smul_of_nonneg volume (le_of_lt hr) {x : ι → ℂ | ∑ i, ‖x i‖ ^ p < 1} using 2 - · simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_setOf_eq, Pi.smul_apply, + · simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_ofPred_eq, Pi.smul_apply, norm_smul, mul_rpow (norm_nonneg _) (norm_nonneg _), Real.norm_eq_abs, abs_inv, inv_rpow (abs_nonneg _), ← Finset.mul_sum, abs_eq_self.mpr (le_of_lt hr), inv_mul_lt_iff₀ (rpow_pos_of_pos hr _), mul_one, ← rpow_lt_rpow_iff (rpow_nonneg (h₁ _) _) @@ -319,7 +319,7 @@ theorem volume_ball (x : EuclideanSpace ℝ ι) (r : ℝ) : rw [Measure.addHaar_ball _ _ hr, this, ofReal_pow hr, finrank_euclideanSpace] rw [← (PiLp.volume_preserving_toLp ι).measure_preimage measurableSet_ball.nullMeasurableSet] - simp only [Set.preimage, ball_zero_eq _ zero_le_one, one_pow, Set.mem_setOf_eq] + simp only [Set.preimage, ball_zero_eq _ zero_le_one, one_pow, Set.mem_ofPred_eq] convert! volume_sum_rpow_lt_one ι one_le_two using 4 · simp [sq_abs] · rw [Gamma_add_one (by simp), Gamma_one_half_eq, ← mul_assoc, mul_div_cancel₀ _ diff --git a/Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean b/Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean index c33e6c53d47498..305898f15c6256 100644 --- a/Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean +++ b/Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean @@ -528,7 +528,7 @@ lemma ProbabilityMeasure.toMeasure_add_pos_gt_mem_nhds (P : ProbabilityMeasure · exact ε_pos.ne.symm filter_upwards [gt_mem_sets_of_limsInf_gt (α := ℝ≥0∞) isBounded_ge_of_bot (show P.toMeasure G - ε < limsInf ((𝓝 P).map (fun Q ↦ Q.toMeasure G)) from aux)] with Q hQ - simp only [preimage_setOf_eq, mem_setOf_eq] at hQ + simp only [preimage_ofPred_eq, mem_ofPred_eq] at hQ convert! ENNReal.add_lt_add_right ε_top hQ exact (tsub_add_cancel_of_le easy).symm @@ -609,7 +609,7 @@ lemma continuous_ofMeasure_probabilityMeasure : -- we have `P (Gs J) < Q (Gs J) + ε/3`. filter_upwards [(Finset.iInter_mem_sets Js_finite.toFinset).mpr <| fun J _ ↦ mem_nhds_P _ (Gs_open J)] with Q hQ - simp only [Finite.mem_toFinset, mem_setOf_eq, thickening_iUnion, mem_iInter] at hQ + simp only [Finite.mem_toFinset, mem_ofPred_eq, thickening_iUnion, mem_iInter] at hQ -- Note that in order to show that the Lévy-Prokhorov distance between `P` and `Q` is small -- (`≤ 2*ε/3`), it suffices to show that for arbitrary subsets `B ⊆ Ω`, the measure `P B` is -- bounded above up to a small error by the `Q`-measure of a small thickening of `B`. @@ -639,7 +639,7 @@ lemma continuous_ofMeasure_probabilityMeasure : simp only [mem_Ici, mem_union, mem_iUnion, exists_prop] by_cases i_small : i ∈ Iio N · refine Or.inl ⟨i, ?_, self_subset_thickening third_ε_pos _ hi⟩ - simp only [mem_Iio, mem_setOf_eq, JB] + simp only [mem_Iio, mem_ofPred_eq, JB] exact ⟨Set.nonempty_of_mem <| mem_inter ω_in_B hi, i_small⟩ · exact Or.inr ⟨i, by simpa only [mem_Iio, not_lt] using i_small, hi⟩ have subset_thickB : ⋃ i ∈ JB, thickening (ε / 3) (Es i) ⊆ thickening δ B := by diff --git a/Mathlib/MeasureTheory/Measure/MeasureSpace.lean b/Mathlib/MeasureTheory/Measure/MeasureSpace.lean index 11af89700356d5..f1b36e118b675b 100644 --- a/Mathlib/MeasureTheory/Measure/MeasureSpace.lean +++ b/Mathlib/MeasureTheory/Measure/MeasureSpace.lean @@ -345,7 +345,7 @@ lemma measure_inter_conull (ht : μ tᶜ = 0) : μ (s ∩ t) = μ s := by rw [← sdiff_compl, measure_sdiff_null ht] @[simp] -theorem union_ae_eq_left_iff_ae_subset : (s ∪ t : Set α) =ᵐ[μ] s ↔ t ≤ᵐ[μ] s := by +theorem union_ae_eq_left_iff_ae_subset : (s ∪ t : Set α) =ᵐˢ[μ] s ↔ t ⊆ᵐ[μ] s := by rw [ae_le_set] refine ⟨fun h => by simpa only [union_sdiff_left] using (ae_eq_set.mp h).1, fun h => @@ -354,19 +354,19 @@ theorem union_ae_eq_left_iff_ae_subset : (s ∪ t : Set α) =ᵐ[μ] s ↔ t ≤ LE.le.eventuallyLE subset_union_left⟩⟩ @[simp] -theorem union_ae_eq_right_iff_ae_subset : (s ∪ t : Set α) =ᵐ[μ] t ↔ s ≤ᵐ[μ] t := by +theorem union_ae_eq_right_iff_ae_subset : (s ∪ t : Set α) =ᵐˢ[μ] t ↔ s ⊆ᵐ[μ] t := by rw [union_comm, union_ae_eq_left_iff_ae_subset] -theorem ae_eq_of_ae_subset_of_measure_ge (h₁ : s ≤ᵐ[μ] t) (h₂ : μ t ≤ μ s) - (hsm : NullMeasurableSet s μ) (ht : μ t ≠ ∞) : s =ᵐ[μ] t := by +theorem ae_eq_of_ae_subset_of_measure_ge (h₁ : s ⊆ᵐ[μ] t) (h₂ : μ t ≤ μ s) + (hsm : NullMeasurableSet s μ) (ht : μ t ≠ ∞) : s =ᵐˢ[μ] t := by refine eventuallyLE_antisymm_iff.mpr ⟨h₁, ae_le_set.mpr ?_⟩ replace h₂ : μ t = μ s := h₂.antisymm (measure_mono_ae h₁) replace ht : μ s ≠ ∞ := h₂ ▸ ht rw [measure_sdiff' t hsm ht, measure_congr (union_ae_eq_left_iff_ae_subset.mpr h₁), h₂, tsub_self] -/-- If `s ⊆ t`, `μ t ≤ μ s`, `μ t ≠ ∞`, and `s` is measurable, then `s =ᵐ[μ] t`. -/ +/-- If `s ⊆ t`, `μ t ≤ μ s`, `μ t ≠ ∞`, and `s` is measurable, then `s =ᵐˢ[μ] t`. -/ theorem ae_eq_of_subset_of_measure_ge (h₁ : s ⊆ t) (h₂ : μ t ≤ μ s) (hsm : NullMeasurableSet s μ) - (ht : μ t ≠ ∞) : s =ᵐ[μ] t := + (ht : μ t ≠ ∞) : s =ᵐˢ[μ] t := ae_eq_of_ae_subset_of_measure_ge h₁.eventuallyLE h₂ hsm ht theorem measure_iUnion_congr_of_subset {ι : Sort*} [Countable ι] {s : ι → Set α} {t : ι → Set α} @@ -379,7 +379,7 @@ theorem measure_iUnion_congr_of_subset {ι : Sort*} [Countable ι] {s : ι → S _ ≤ μ (s i) := hi ▸ h_le i _ ≤ μ (⋃ i, s i) := measure_mono <| subset_iUnion _ _ set M := toMeasurable μ - have H : ∀ b, (M (t b) ∩ M (⋃ b, s b) : Set α) =ᵐ[μ] M (t b) := by + have H : ∀ b, (M (t b) ∩ M (⋃ b, s b) : Set α) =ᵐˢ[μ] M (t b) := by refine fun b => ae_eq_of_subset_of_measure_ge inter_subset_left ?_ ?_ ?_ · calc μ (M (t b)) = μ (t b) := measure_toMeasurable _ @@ -598,7 +598,7 @@ theorem measure_iInter_of_ae_monotone [Preorder ι] [IsCodirectedOrder ι] obtain ⟨i, hi⟩ := hfin have : Nonempty ι := ⟨i⟩ let t : ι → Set α := fun i ↦ s i ∩ {ω | Monotone (ω ∈ s ·)} - have hst (i : ι) : s i =ᵐ[μ] t i := by + have hst (i : ι) : s i =ᵐˢ[μ] t i := by filter_upwards [hs] with ω hω suffices ω ∈ s i ↔ ω ∈ t i from propext this simpa [t] using fun _ ↦ hω @@ -639,7 +639,7 @@ theorem measure_iInter_eq_iInf_measure_iInter_le {α ι : Type*} {_ : Measurable · rw [iInter_comm] exact congrArg μ <| iInter_congr fun i ↦ (biInf_const nonempty_Ici).symm · exact fun i j h ↦ biInter_mono (Iic_subset_Iic.2 h) fun _ _ ↦ Set.Subset.rfl - · exact fun i ↦ .biInter (to_countable _) fun _ _ ↦ h _ + · exact fun i ↦ .biInter (s := {j | j ≤ i}) (to_countable _) fun _ _ ↦ h _ · refine hfin.imp fun k hk ↦ ne_top_of_le_ne_top hk <| measure_mono <| iInter₂_subset k ?_ rfl @@ -694,8 +694,9 @@ theorem tendsto_measure_iInter_le {α ι : Type*} {_ : MeasurableSpace α} {μ : refine .of_neBot_imp fun hne ↦ ?_ cases atTop_neBot_iff.mp hne rw [measure_iInter_eq_iInf_measure_iInter_le hm hf] - exact tendsto_atTop_iInf - fun i j hij ↦ measure_mono <| biInter_subset_biInter_left fun k hki ↦ le_trans hki hij + exact tendsto_atTop_iInf fun i j hij ↦ measure_mono <| + biInter_subset_biInter_left (s := {k | k ≤ j}) (s' := {k | k ≤ i}) + fun k hki ↦ le_trans hki hij /-- Some version of continuity of a measure in the empty set using the intersection along a set of sets. -/ @@ -704,8 +705,9 @@ theorem exists_measure_iInter_lt {α ι : Type*} {_ : MeasurableSpace α} {μ : (hm : ∀ i, NullMeasurableSet (f i) μ) {ε : ℝ≥0∞} (hε : 0 < ε) (hfin : ∃ i, μ (f i) ≠ ∞) (hfem : ⋂ n, f n = ∅) : ∃ m, μ (⋂ n ≤ m, f n) < ε := by let F m := μ (⋂ n ≤ m, f n) - have hFAnti : Antitone F := - fun i j hij => measure_mono (biInter_subset_biInter_left fun k hki => le_trans hki hij) + have hFAnti : Antitone F := fun i j hij => measure_mono <| + biInter_subset_biInter_left (s := {k | k ≤ j}) (s' := {k | k ≤ i}) + fun k hki => le_trans hki hij suffices Filter.Tendsto F Filter.atTop (𝓝 0) by let _ := hfin.nonempty rw [ENNReal.tendsto_atTop_zero_iff_lt_of_antitone hFAnti] at this @@ -1226,7 +1228,7 @@ lemma inf_apply {s : Set α} (hs : MeasurableSet s) : obtain ⟨i, hi⟩ := mem_iUnion.1 <| ht' hx₂ refine ⟨i, ?_, hi⟩ by_contra h - simp only [mem_setOf_eq, not_lt] at h + simp only [mem_ofPred_eq, not_lt] at h exact mem_iInter₂.1 hx₁ i h hi have hle₂ : ν (tᶜ ∩ s) ≤ ∑' (n : {k | ν (t' k) < μ (t' k)}), ν (t' n) := (measure_mono hcap).trans (measure_biUnion_le ν (to_countable {k | ν (t' k) < μ (t' k)}) _) @@ -1240,11 +1242,11 @@ lemma inf_apply {s : Set α} (hs : MeasurableSet s) : intro n hn; simpa · rw [Subtype.forall] intro n hn - rw [mem_setOf_eq] at hn + rw [mem_ofPred_eq] at hn simp [le_of_lt hn] · rw [Set.disjoint_iff] rintro k ⟨hk₁, hk₂⟩ - rw [mem_setOf_eq] at hk₁ hk₂ + rw [mem_ofPred_eq] at hk₁ hk₂ exact False.elim <| hk₂.not_ge hk₁ @[simp] @@ -1511,28 +1513,28 @@ theorem tendsto_measure_Ici_atBot [Preorder α] [(atBot : Filter α).IsCountably variable [PartialOrder α] {a b : α} -theorem Iio_ae_eq_Iic' (ha : μ {a} = 0) : Iio a =ᵐ[μ] Iic a := by +theorem Iio_ae_eq_Iic' (ha : μ {a} = 0) : Iio a =ᵐˢ[μ] Iic a := by rw [← Iic_sdiff_right, sdiff_ae_eq_self, measure_mono_null Set.inter_subset_right ha] -theorem Ioi_ae_eq_Ici' (ha : μ {a} = 0) : Ioi a =ᵐ[μ] Ici a := +theorem Ioi_ae_eq_Ici' (ha : μ {a} = 0) : Ioi a =ᵐˢ[μ] Ici a := Iio_ae_eq_Iic' (α := αᵒᵈ) ha -theorem Ioo_ae_eq_Ioc' (hb : μ {b} = 0) : Ioo a b =ᵐ[μ] Ioc a b := - (ae_eq_refl _).inter (Iio_ae_eq_Iic' hb) +theorem Ioo_ae_eq_Ioc' (hb : μ {b} = 0) : Ioo a b =ᵐˢ[μ] Ioc a b := + (ae_eq_refl (· ∈ Ioi a)).inter (Iio_ae_eq_Iic' hb) -theorem Ioc_ae_eq_Icc' (ha : μ {a} = 0) : Ioc a b =ᵐ[μ] Icc a b := - (Ioi_ae_eq_Ici' ha).inter (ae_eq_refl _) +theorem Ioc_ae_eq_Icc' (ha : μ {a} = 0) : Ioc a b =ᵐˢ[μ] Icc a b := + (Ioi_ae_eq_Ici' ha).inter (ae_eq_refl (· ∈ Iic b)) -theorem Ioo_ae_eq_Ico' (ha : μ {a} = 0) : Ioo a b =ᵐ[μ] Ico a b := - (Ioi_ae_eq_Ici' ha).inter (ae_eq_refl _) +theorem Ioo_ae_eq_Ico' (ha : μ {a} = 0) : Ioo a b =ᵐˢ[μ] Ico a b := + (Ioi_ae_eq_Ici' ha).inter (ae_eq_refl (· ∈ Iio b)) -theorem Ioo_ae_eq_Icc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ioo a b =ᵐ[μ] Icc a b := +theorem Ioo_ae_eq_Icc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ioo a b =ᵐˢ[μ] Icc a b := (Ioi_ae_eq_Ici' ha).inter (Iio_ae_eq_Iic' hb) -theorem Ico_ae_eq_Icc' (hb : μ {b} = 0) : Ico a b =ᵐ[μ] Icc a b := - (ae_eq_refl _).inter (Iio_ae_eq_Iic' hb) +theorem Ico_ae_eq_Icc' (hb : μ {b} = 0) : Ico a b =ᵐˢ[μ] Icc a b := + (ae_eq_refl (· ∈ Ici a)).inter (Iio_ae_eq_Iic' hb) -theorem Ico_ae_eq_Ioc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ico a b =ᵐ[μ] Ioc a b := +theorem Ico_ae_eq_Ioc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ico a b =ᵐˢ[μ] Ioc a b := (Ioo_ae_eq_Ico' ha).symm.trans (Ioo_ae_eq_Ioc' hb) end Intervals diff --git a/Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean b/Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean index 6218e85fbdea7e..a441d6efde7697 100644 --- a/Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean +++ b/Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean @@ -321,10 +321,10 @@ any measurable set `u` if `μ s ≠ ∞`, see `measure_toMeasurable_inter`. This property holds without the assumption `μ s ≠ ∞` when the space is s-finite (for example σ-finite); see `measure_toMeasurable_inter_of_sFinite`. If `s` is a null measurable set, then -we also have `t =ᵐ[μ] s`, see `NullMeasurableSet.toMeasurable_ae_eq`. +we also have `t =ᵐˢ[μ] s`, see `NullMeasurableSet.toMeasurable_ae_eq`. This notion is sometimes called a "measurable hull" in the literature. -/ irreducible_def toMeasurable (μ : Measure α) (s : Set α) : Set α := - if h : ∃ t, t ⊇ s ∧ MeasurableSet t ∧ t =ᵐ[μ] s then h.choose else + if h : ∃ t, t ⊇ s ∧ MeasurableSet t ∧ t =ᵐˢ[μ] s then h.choose else if h' : ∃ t, t ⊇ s ∧ MeasurableSet t ∧ ∀ u, MeasurableSet u → μ (t ∩ u) = μ (s ∩ u) then h'.choose else (exists_measurable_superset μ s).choose @@ -333,7 +333,7 @@ theorem subset_toMeasurable (μ : Measure α) (s : Set α) : s ⊆ toMeasurable rw [toMeasurable_def]; split_ifs with hs h's exacts [hs.choose_spec.1, h's.choose_spec.1, (exists_measurable_superset μ s).choose_spec.1] -theorem ae_le_toMeasurable : s ≤ᵐ[μ] toMeasurable μ s := +theorem ae_le_toMeasurable : s ⊆ᵐ[μ] toMeasurable μ s := LE.le.eventuallyLE (subset_toMeasurable _ _) @[simp] diff --git a/Mathlib/MeasureTheory/Measure/MutuallySingular.lean b/Mathlib/MeasureTheory/Measure/MutuallySingular.lean index 302749961949c7..9ec8796d00d639 100644 --- a/Mathlib/MeasureTheory/Measure/MutuallySingular.lean +++ b/Mathlib/MeasureTheory/Measure/MutuallySingular.lean @@ -53,7 +53,7 @@ theorem mk {s t : Set α} (hs : μ s = 0) (ht : ν t = 0) (hst : univ ⊆ s ∪ exact subset_toMeasurable _ _ hxs /-- A set such that `μ h.nullSet = 0` and `ν h.nullSetᶜ = 0`. -/ -def nullSet (h : μ ⟂ₘ ν) : Set α := h.choose +noncomputable def nullSet (h : μ ⟂ₘ ν) : Set α := h.choose lemma measurableSet_nullSet (h : μ ⟂ₘ ν) : MeasurableSet h.nullSet := h.choose_spec.1 diff --git a/Mathlib/MeasureTheory/Measure/NullMeasurable.lean b/Mathlib/MeasureTheory/Measure/NullMeasurable.lean index 32f7c49a57ec86..41c4f36128a056 100644 --- a/Mathlib/MeasureTheory/Measure/NullMeasurable.lean +++ b/Mathlib/MeasureTheory/Measure/NullMeasurable.lean @@ -18,9 +18,9 @@ public import Mathlib.MeasureTheory.Measure.AEDisjoint A set `s : Set α` is called *null measurable* (`MeasureTheory.NullMeasurableSet`) if it satisfies any of the following equivalent conditions: -* there exists a measurable set `t` such that `s =ᵐ[μ] t` (this is used as a definition); -* `MeasureTheory.toMeasurable μ s =ᵐ[μ] s`; -* there exists a measurable subset `t ⊆ s` such that `t =ᵐ[μ] s` (in this case the latter equality +* there exists a measurable set `t` such that `s =ᵐˢ[μ] t` (this is used as a definition); +* `MeasureTheory.toMeasurable μ s =ᵐˢ[μ] s`; +* there exists a measurable subset `t ⊆ s` such that `t =ᵐˢ[μ] s` (in this case the latter equality means that `μ (s \ t) = 0`); * `s` can be represented as a union of a measurable set and a set of measure zero; * `s` can be represented as a difference of a measurable set and a set of measure zero. @@ -125,7 +125,7 @@ theorem compl_iff : NullMeasurableSet sᶜ μ ↔ NullMeasurableSet s μ := theorem of_subsingleton [Subsingleton α] : NullMeasurableSet s μ := Subsingleton.measurableSet -protected theorem congr (hs : NullMeasurableSet s μ) (h : s =ᵐ[μ] t) : NullMeasurableSet t μ := by +protected theorem congr (hs : NullMeasurableSet s μ) (h : s =ᵐˢ[μ] t) : NullMeasurableSet t μ := by rw [nullMeasurableSet_iff_eventuallyMeasurableSet] exact EventuallyMeasurableSet.congr hs h.symm @@ -197,22 +197,25 @@ protected theorem insert [MeasurableSingletonClass (NullMeasurableSpace α μ)] MeasurableSet.insert hs a theorem exists_measurable_superset_ae_eq (h : NullMeasurableSet s μ) : - ∃ t ⊇ s, MeasurableSet t ∧ t =ᵐ[μ] s := by + ∃ t ⊇ s, MeasurableSet t ∧ t =ᵐˢ[μ] s := by rcases h with ⟨t, htm, hst⟩ refine ⟨t ∪ toMeasurable μ (s \ t), ?_, htm.union (measurableSet_toMeasurable _ _), ?_⟩ · exact sdiff_subset_iff.1 (subset_toMeasurable _ _) - · have : toMeasurable μ (s \ t) =ᵐ[μ] (∅ : Set α) := by simp [ae_le_set.1 hst.le] + · have : toMeasurable μ (s \ t) =ᵐˢ[μ] (∅ : Set α) := by + rw [ae_eq_empty, measure_toMeasurable] + exact ae_le_set.1 hst.le simpa only [union_empty] using hst.symm.union this -theorem toMeasurable_ae_eq (h : NullMeasurableSet s μ) : toMeasurable μ s =ᵐ[μ] s := by +theorem toMeasurable_ae_eq (h : NullMeasurableSet s μ) : toMeasurable μ s =ᵐˢ[μ] s := by rw [toMeasurable_def, dif_pos] exact (exists_measurable_superset_ae_eq h).choose_spec.2.2 -theorem compl_toMeasurable_compl_ae_eq (h : NullMeasurableSet s μ) : (toMeasurable μ sᶜ)ᶜ =ᵐ[μ] s := +theorem compl_toMeasurable_compl_ae_eq (h : NullMeasurableSet s μ) : + (toMeasurable μ sᶜ)ᶜ =ᵐˢ[μ] s := Iff.mpr ae_eq_set_compl <| toMeasurable_ae_eq h.compl theorem exists_measurable_subset_ae_eq (h : NullMeasurableSet s μ) : - ∃ t ⊆ s, MeasurableSet t ∧ t =ᵐ[μ] s := + ∃ t ⊆ s, MeasurableSet t ∧ t =ᵐˢ[μ] s := ⟨(toMeasurable μ sᶜ)ᶜ, compl_subset_comm.2 <| subset_toMeasurable _ _, (measurableSet_toMeasurable _ _).compl, compl_toMeasurable_compl_ae_eq h⟩ @@ -224,12 +227,12 @@ open scoped Function -- required for scoped `on` notation /-- If `sᵢ` is a countable family of (null) measurable pairwise `μ`-a.e. disjoint sets, then there exists a subordinate family `tᵢ ⊆ sᵢ` of measurable pairwise disjoint sets such that -`tᵢ =ᵐ[μ] sᵢ`. -/ +`tᵢ =ᵐˢ[μ] sᵢ`. -/ theorem exists_subordinate_pairwise_disjoint [Countable ι] {s : ι → Set α} (h : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AEDisjoint μ on s)) : ∃ t : ι → Set α, (∀ i, t i ⊆ s i) ∧ - (∀ i, s i =ᵐ[μ] t i) ∧ (∀ i, MeasurableSet (t i)) ∧ Pairwise (Disjoint on t) := by + (∀ i, s i =ᵐˢ[μ] t i) ∧ (∀ i, MeasurableSet (t i)) ∧ Pairwise (Disjoint on t) := by choose t ht_sub htm ht_eq using fun i => exists_measurable_subset_ae_eq (h i) rcases exists_null_pairwise_disjoint_sdiff hd with ⟨u, hum, hu₀, hud⟩ exact diff --git a/Mathlib/MeasureTheory/Measure/OpenPos.lean b/Mathlib/MeasureTheory/Measure/OpenPos.lean index 46c9fb552b916b..de4426c1866b2e 100644 --- a/Mathlib/MeasureTheory/Measure/OpenPos.lean +++ b/Mathlib/MeasureTheory/Measure/OpenPos.lean @@ -79,7 +79,7 @@ theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) : ⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩ theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) : - U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by + U =ᵐˢ[μ] (∅ : Set X) ↔ U = ∅ := by rw [ae_eq_empty, hU.measure_zero_iff_eq_empty] /-- An open null set w.r.t. an `IsOpenPosMeasure` is empty. -/ @@ -87,7 +87,7 @@ theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (h₀ : μ U = 0) (hU.measure_eq_zero_iff μ).mp h₀ theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) : - F =ᵐ[μ] univ ↔ F = univ := by + F =ᵐˢ[μ] univ ↔ F = univ := by refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩ rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff μ, compl_empty_iff] at h diff --git a/Mathlib/MeasureTheory/Measure/Portmanteau.lean b/Mathlib/MeasureTheory/Measure/Portmanteau.lean index e64bd9c2ba8bb3..7a1154613a3242 100644 --- a/Mathlib/MeasureTheory/Measure/Portmanteau.lean +++ b/Mathlib/MeasureTheory/Measure/Portmanteau.lean @@ -213,7 +213,7 @@ theorem tendsto_measure_of_le_liminf_measure_of_limsup_measure_le {ι : Type*} { (nulldiff : μ (E₁ \ E₀) = 0) (h_E₀ : μ E₀ ≤ L.liminf fun i ↦ μs i E₀) (h_E₁ : (L.limsup fun i ↦ μs i E₁) ≤ μ E₁) : L.Tendsto (fun i ↦ μs i E) (𝓝 (μ E)) := by apply tendsto_of_le_liminf_of_limsup_le - · have E₀_ae_eq_E : E₀ =ᵐ[μ] E := + · have E₀_ae_eq_E : E₀ =ᵐˢ[μ] E := EventuallyLE.antisymm E₀_subset.eventuallyLE (subset_E₁.eventuallyLE.trans (ae_le_set.mpr nulldiff)) calc @@ -221,7 +221,7 @@ theorem tendsto_measure_of_le_liminf_measure_of_limsup_measure_le {ι : Type*} { _ ≤ L.liminf fun i ↦ μs i E₀ := h_E₀ _ ≤ L.liminf fun i ↦ μs i E := liminf_le_liminf (.of_forall fun _ ↦ measure_mono E₀_subset) - · have E_ae_eq_E₁ : E =ᵐ[μ] E₁ := + · have E_ae_eq_E₁ : E =ᵐˢ[μ] E₁ := EventuallyLE.antisymm subset_E₁.eventuallyLE ((ae_le_set.mpr nulldiff).trans E₀_subset.eventuallyLE) calc diff --git a/Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean b/Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean index 6546d9f12b53b9..ffe9cfaf88798c 100644 --- a/Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean +++ b/Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean @@ -233,7 +233,7 @@ theorem mass_toFiniteMeasure (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure.m @[simp] lemma range_toFiniteMeasure : range toFiniteMeasure = {μ : FiniteMeasure Ω | μ.mass = 1} := by ext μ - simp only [mem_range, mem_setOf_eq] + simp only [mem_range, mem_ofPred_eq] refine ⟨fun ⟨ν, hν⟩ ↦ by simp [← hν], fun h ↦ ?_⟩ refine ⟨⟨μ, isProbabilityMeasure_iff_real.2 (by simpa using! h)⟩, ?_⟩ ext s hs @@ -262,7 +262,7 @@ theorem measurable_fun_prod {α β : Type*} [MeasurableSpace α] [MeasurableSpac ↦ μ.1.toMeasure.prod μ.2.toMeasure) := by apply Measurable.measure_of_isPiSystem_of_isProbabilityMeasure generateFrom_prod.symm isPiSystem_prod _ - simp only [mem_image2, mem_setOf_eq, forall_exists_index, and_imp] + simp only [mem_image2, mem_ofPred_eq, forall_exists_index, and_imp] intro _ u Hu v Hv Heq simp_rw [← Heq, Measure.prod_prod] apply Measurable.mul diff --git a/Mathlib/MeasureTheory/Measure/Prod.lean b/Mathlib/MeasureTheory/Measure/Prod.lean index 2f3c5ca3e1db60..c296bd661f0397 100644 --- a/Mathlib/MeasureTheory/Measure/Prod.lean +++ b/Mathlib/MeasureTheory/Measure/Prod.lean @@ -467,8 +467,8 @@ theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.prod ν rw [h2s, mul_zero] omit [SFinite ν] in -lemma set_prod_ae_eq {s s' : Set α} {t t' : Set β} (hs : s =ᵐ[μ] s') (ht : t =ᵐ[ν] t') : - (s ×ˢ t : Set (α × β)) =ᵐ[μ.prod ν] (s' ×ˢ t' : Set (α × β)) := +lemma set_prod_ae_eq {s s' : Set α} {t t' : Set β} (hs : s =ᵐˢ[μ] s') (ht : t =ᵐˢ[ν] t') : + (s ×ˢ t : Set (α × β)) =ᵐˢ[μ.prod ν] (s' ×ˢ t' : Set (α × β)) := (quasiMeasurePreserving_fst.preimage_ae_eq hs).inter (quasiMeasurePreserving_snd.preimage_ae_eq ht) @@ -490,7 +490,7 @@ lemma _root_.MeasureTheory.NullMeasurableSet.prod {s : Set α} {t : Set β} lemma _root_.MeasureTheory.NullMeasurableSet.right_of_prod {s : Set α} {t : Set β} (h : NullMeasurableSet (s ×ˢ t) (μ.prod ν)) (hs : μ s ≠ 0) : NullMeasurableSet t ν := by rcases h with ⟨u, hum, hu⟩ - obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, (Prod.mk x ⁻¹' (s ×ˢ t)) =ᵐ[ν] (Prod.mk x ⁻¹' u) := + obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, (Prod.mk x ⁻¹' (s ×ˢ t)) =ᵐˢ[ν] (Prod.mk x ⁻¹' u) := ((frequently_ae_iff.2 hs).and_eventually (ae_ae_eq_curry_of_prod hu)).exists refine ⟨Prod.mk x ⁻¹' u, measurable_prodMk_left hum, ?_⟩ rwa [mk_preimage_prod_right hxs] at hx @@ -763,7 +763,7 @@ theorem prodAssoc_prod [SFinite τ] : isPiSystem_measurableSet isPiSystem_prod ((sfiniteSeq μ i.1.1)).toFiniteSpanningSetsIn ((sfiniteSeq ν i.1.2).toFiniteSpanningSetsIn.prod (sfiniteSeq τ i.2).toFiniteSpanningSetsIn) ?_).symm - rintro s hs _ ⟨t, ht, u, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu + rintro s hs _ ⟨t, ht, u, hu, rfl⟩; rw [mem_ofPred_eq] at hs ht hu simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)), MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod, mul_assoc] diff --git a/Mathlib/MeasureTheory/Measure/Prokhorov.lean b/Mathlib/MeasureTheory/Measure/Prokhorov.lean index f7b79b06bdbf1e..2d61af6c4a4610 100644 --- a/Mathlib/MeasureTheory/Measure/Prokhorov.lean +++ b/Mathlib/MeasureTheory/Measure/Prokhorov.lean @@ -22,7 +22,7 @@ notably several versions of Prokhorov theorem on tight sets of probability measu * `instCompactSpaceProbabilityMeasure` proves that the space of probability measures on a compact space is itself compact -* `isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le`: Given a sequence of compact +* `isCompact_setOfPred_probabilityMeasure_mass_eq_compl_isCompact_le`: Given a sequence of compact sets `Kₙ` and a sequence `uₙ` tending to zero, the probability measures giving mass at most `uₙ` to the complement of `Kₙ` form a compact set. * `isCompact_closure_of_isTightMeasureSet`: Given a tight set of probability measures, its closure @@ -40,7 +40,7 @@ For the compactness of the space of probability measures in a compact space, we ultrafilter converges, using the Riesz-Markov-Kakutani theorem to construct the limiting measure in terms of its integrals against continuous functions. -For Prokhorov theorem `isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le`, +For Prokhorov theorem `isCompact_setOfPred_probabilityMeasure_mass_eq_compl_isCompact_le`, we rely on the compactness of the space of measures inside each compact set to get convergence of the restriction there, and argue that the full measure converges to the sum of the individual limits of the disjointed components. There is a subtlety that the space of finite measures @@ -66,7 +66,7 @@ variable {E : Type*} [MeasurableSpace E] [TopologicalSpace E] [T2Space E] [Borel variable (E) in /-- In a compact space, the set of finite measures with mass at most `C` is compact. -/ -theorem isCompact_setOf_finiteMeasure_le_of_compactSpace [CompactSpace E] (C : ℝ≥0) : +theorem isCompact_setOfPred_finiteMeasure_le_of_compactSpace [CompactSpace E] (C : ℝ≥0) : IsCompact {μ : FiniteMeasure E | μ.mass ≤ C} := by /- To prove the compactness, we will show that any sequence has a converging subsequence, in ultrafilters terms as things are not second countable. The integral against any bounded continuous @@ -141,7 +141,7 @@ theorem isCompact_setOf_finiteMeasure_le_of_compactSpace [CompactSpace E] (C : filter_upwards [hf] with μ hμ using by simpa [o] using! hμ let μlim' : FiniteMeasure E := ⟨μlim, ⟨μlim_le.trans_lt (by simp)⟩⟩ refine ⟨μlim', ?_, ?_⟩ - · simp only [mem_setOf_eq, FiniteMeasure.mk_apply, μlim', FiniteMeasure.mass] + · simp only [mem_ofPred_eq, FiniteMeasure.mk_apply, μlim', FiniteMeasure.mass] rw [show C = (ENNReal.ofReal ↑C).toNNReal by simp] exact ENNReal.toNNReal_mono (by simp) μlim_le change Tendsto id f (𝓝 μlim') @@ -154,24 +154,32 @@ theorem isCompact_setOf_finiteMeasure_le_of_compactSpace [CompactSpace E] (C : simp only [FiniteMeasure.toMeasure_mk, RealRMK.integral_rieszMeasure, μlim', μlim] rfl +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_finiteMeasure_le_of_compactSpace := + isCompact_setOfPred_finiteMeasure_le_of_compactSpace + variable (E) in /-- In a compact space, the set of finite measures with mass `C` is compact. -/ -lemma isCompact_setOf_finiteMeasure_eq_of_compactSpace [CompactSpace E] (C : ℝ≥0) : +lemma isCompact_setOfPred_finiteMeasure_eq_of_compactSpace [CompactSpace E] (C : ℝ≥0) : IsCompact {μ : FiniteMeasure E | μ.mass = C} := by have : {μ : FiniteMeasure E | μ.mass = C} = {μ | μ.mass ≤ C} ∩ {μ | μ.mass = C} := by grind rw [this] - apply IsCompact.inter_right (isCompact_setOf_finiteMeasure_le_of_compactSpace E C) + apply IsCompact.inter_right (isCompact_setOfPred_finiteMeasure_le_of_compactSpace E C) exact isClosed_eq (by fun_prop) (by fun_prop) +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_finiteMeasure_eq_of_compactSpace := + isCompact_setOfPred_finiteMeasure_eq_of_compactSpace + /-- In a compact space, the space of probability measures is also compact. -/ instance [CompactSpace E] : CompactSpace (ProbabilityMeasure E) := by constructor apply (ProbabilityMeasure.toFiniteMeasure_isEmbedding E).isCompact_iff.2 - simpa using isCompact_setOf_finiteMeasure_eq_of_compactSpace E 1 + simpa using isCompact_setOfPred_finiteMeasure_eq_of_compactSpace E 1 /-- The set of finite measures of mass at most `C` supported on a given compact set `K` is compact. -/ -lemma isCompact_setOf_finiteMeasure_le_of_isCompact +lemma isCompact_setOfPred_finiteMeasure_le_of_isCompact (C : ℝ≥0) {K : Set E} (hK : IsCompact K) : IsCompact {μ : FiniteMeasure E | μ.mass ≤ C ∧ μ Kᶜ = 0} := by let f : K → E := Subtype.val @@ -195,20 +203,24 @@ lemma isCompact_setOf_finiteMeasure_le_of_isCompact exact hμ.2 · exact fun t ht ↦ hf.measurableEmbedding.measurableSet_image' ht · exact hf.continuous.measurable hs - · simp only [null_iff_toMeasure_null, image_subset_iff, preimage_setOf_eq, toMeasure_map, - setOf_subset_setOf, F, T] + · simp only [null_iff_toMeasure_null, image_subset_iff, preimage_ofPred_eq, toMeasure_map, + ofPred_subset_ofPred, F, T] intro μ hμ rw [Measure.map_apply hf.continuous.measurable hK.measurableSet.compl] refine ⟨(mass_map_le _ _).trans hμ, by simp [f]⟩ rw [this] apply IsCompact.image _ (by fun_prop) have : CompactSpace K := isCompact_iff_compactSpace.mp hK - exact isCompact_setOf_finiteMeasure_le_of_compactSpace _ _ + exact isCompact_setOfPred_finiteMeasure_le_of_compactSpace _ _ + +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_finiteMeasure_le_of_isCompact := + isCompact_setOfPred_finiteMeasure_le_of_isCompact /-- **Prokhorov theorem**: Given a sequence of compact sets `Kₙ` and a sequence `uₙ` tending to zero, the finite measures of mass at most `C` giving mass at most `uₙ` to the complement of `Kₙ` form a compact set. -/ -lemma isCompact_setOf_finiteMeasure_mass_le_compl_isCompact_le +lemma isCompact_setOfPred_finiteMeasure_mass_le_compl_isCompact_le {u : ℕ → ℝ≥0} {K : ℕ → Set E} (C : ℝ≥0) (hu : Tendsto u atTop (𝓝 0)) (hK : ∀ n, IsCompact (K n)) (h : NormalSpace E ∨ Monotone K) : IsCompact {μ : FiniteMeasure E | μ.mass ≤ C ∧ ∀ n, μ (K n)ᶜ ≤ u n} := by @@ -250,8 +262,8 @@ lemma isCompact_setOf_finiteMeasure_mass_le_compl_isCompact_le simp only [Tendsto] rw [← Ultrafilter.coe_map] apply IsCompact.ultrafilter_le_nhds' - (isCompact_setOf_finiteMeasure_le_of_isCompact C (A n)) - simp only [null_iff_toMeasure_null, Ultrafilter.mem_map, preimage_setOf_eq] + (isCompact_setOfPred_finiteMeasure_le_of_isCompact C (A n)) + simp only [null_iff_toMeasure_null, Ultrafilter.mem_map, preimage_ofPred_eq] filter_upwards [hf] with ρ hρ simp only [restrict_mass, restrict_measure_eq, Measure.restrict_apply (A n).measurableSet.compl] @@ -464,23 +476,32 @@ lemma isCompact_setOf_finiteMeasure_mass_le_compl_isCompact_le rw [this, restrict_mass] exact le_trans (apply_mono _ (sdiff_subset_compl (K m) (K n))) (hμ.2 n) +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_finiteMeasure_mass_le_compl_isCompact_le := + isCompact_setOfPred_finiteMeasure_mass_le_compl_isCompact_le + /-- **Prokhorov theorem**: Given a sequence of compact sets `Kₙ` and a sequence `uₙ` tending to zero, the finite measures of mass `C` giving mass at most `uₙ` to the complement of `Kₙ` form a compact set. -/ -lemma isCompact_setOf_finiteMeasure_mass_eq_compl_isCompact_le {u : ℕ → ℝ≥0} +lemma isCompact_setOfPred_finiteMeasure_mass_eq_compl_isCompact_le {u : ℕ → ℝ≥0} {K : ℕ → Set E} (C : ℝ≥0) (hu : Tendsto u atTop (𝓝 0)) (hK : ∀ n, IsCompact (K n)) (h : NormalSpace E ∨ Monotone K) : IsCompact {μ : FiniteMeasure E | μ.mass = C ∧ ∀ n, μ (K n)ᶜ ≤ u n} := by have : {μ : FiniteMeasure E | μ.mass = C ∧ ∀ n, μ (K n)ᶜ ≤ u n} = {μ | μ.mass ≤ C ∧ ∀ n, μ (K n)ᶜ ≤ u n} ∩ {μ | μ.mass = C} := by ext; grind rw [this] - apply IsCompact.inter_right (isCompact_setOf_finiteMeasure_mass_le_compl_isCompact_le C hu hK h) + apply IsCompact.inter_right + (isCompact_setOfPred_finiteMeasure_mass_le_compl_isCompact_le C hu hK h) exact isClosed_eq (by fun_prop) (by fun_prop) +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_finiteMeasure_mass_eq_compl_isCompact_le := + isCompact_setOfPred_finiteMeasure_mass_eq_compl_isCompact_le + /-- **Prokhorov theorem**: Given a sequence of compact sets `Kₙ` and a sequence `uₙ` tending to zero, the probability measures giving mass at most `uₙ` to the complement of `Kₙ` form a compact set. -/ -lemma isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le {u : ℕ → ℝ≥0} +lemma isCompact_setOfPred_probabilityMeasure_mass_eq_compl_isCompact_le {u : ℕ → ℝ≥0} {K : ℕ → Set E} (hu : Tendsto u atTop (𝓝 0)) (hK : ∀ n, IsCompact (K n)) (h : NormalSpace E ∨ Monotone K) : IsCompact {μ : ProbabilityMeasure E | ∀ n, μ (K n)ᶜ ≤ u n} := by @@ -488,7 +509,7 @@ lemma isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le {u : ℕ → have : ProbabilityMeasure.toFiniteMeasure '' {μ | ∀ (n : ℕ), μ (K n)ᶜ ≤ u n} = {μ : FiniteMeasure E | μ.mass = 1 ∧ ∀ n, μ (K n)ᶜ ≤ u n} := by ext μ - simp only [mem_image, mem_setOf_eq] + simp only [mem_image, mem_ofPred_eq] refine ⟨?_, ?_⟩ · rintro ⟨ν, hν, rfl⟩ simpa using! hν @@ -497,7 +518,11 @@ lemma isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le {u : ℕ → have : ν.toFiniteMeasure = μ := by ext; rfl exact ⟨ν, by simpa [← this] using! h'μ , this⟩ rw [this] - exact isCompact_setOf_finiteMeasure_mass_eq_compl_isCompact_le 1 hu hK h + exact isCompact_setOfPred_finiteMeasure_mass_eq_compl_isCompact_le 1 hu hK h + +@[deprecated (since := "2026-07-09")] +alias isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le := + isCompact_setOfPred_probabilityMeasure_mass_eq_compl_isCompact_le /-- **Prokhorov theorem**: the closure of a tight set of probability measures is compact. We only require the space to be T2. -/ @@ -516,12 +541,12 @@ lemma isCompact_closure_of_isTightMeasureSet {S : Set (ProbabilityMeasure E)} choose K K_comp hK using A let K' n := ⋃ i ∈ Iic n, K i have h'K : IsCompact {μ : ProbabilityMeasure E | ∀ n, μ (K' n)ᶜ ≤ u n} := by - apply isCompact_setOf_probabilityMeasure_mass_eq_compl_isCompact_le u_lim + apply isCompact_setOfPred_probabilityMeasure_mass_eq_compl_isCompact_le u_lim · exact fun n ↦ (finite_Iic n).isCompact_biUnion (fun i hi ↦ K_comp i) · right simp only [Monotone, mem_Iic, iUnion_subset_iff, K'] intro a b hab i hi - apply subset_biUnion_of_mem + apply subset_biUnion_of_mem (s := {i | i ≤ b}) (u := K) exact hi.trans hab apply IsCompact.closure_of_subset h'K intro μ hμ n @@ -529,7 +554,7 @@ lemma isCompact_closure_of_isTightMeasureSet {S : Set (ProbabilityMeasure E)} _ ≤ μ (K n)ᶜ := by gcongr simp only [mem_Iic, K'] - apply subset_biUnion_of_mem + apply subset_biUnion_of_mem (s := {i | i ≤ n}) (u := K) exact le_rfl (a := n) _ ≤ u n := by grind @@ -560,7 +585,8 @@ lemma exists_measure_iUnion_gt_of_isCompact_closure have Measurebound n : (μlim (⋃ (i ≤ n), U i) : ℝ) ≤ 1 - ε := calc (μlim (⋃ (i ≤ n), U i) : ℝ) _ ≤ liminf (fun k ↦ (μ (sub k) (⋃ (i ≤ n), U i) : ℝ)) atTop := by - have hopen : IsOpen (⋃ i ≤ n, U i) := isOpen_biUnion fun i a ↦ O i + have hopen : IsOpen (⋃ i ≤ n, U i) := + isOpen_biUnion (s := {i | i ≤ n}) fun i a ↦ O i have := ProbabilityMeasure.le_liminf_measure_open_of_tendsto hμconverges hopen simp_rw [Function.comp_apply, ← ennreal_coeFn_eq_coeFn_toMeasure] at this rw [← ofNNReal_liminf] at this @@ -573,8 +599,9 @@ lemma exists_measure_iUnion_gt_of_isCompact_closure · simp only [NNReal.coe_le_coe, eventually_atTop] use n + 1 intro b hypo - refine (μ (sub b)).apply_mono - <| Set.biUnion_mono (fun i (hi : i ≤ n) ↦ hi.trans ?_) fun _ _ ↦ le_rfl + refine (μ (sub b)).apply_mono <| + Set.biUnion_mono (s := {i | i ≤ sub b}) (s' := {i | i ≤ n}) + (fun i (hi : i ≤ n) ↦ hi.trans ?_) fun _ _ ↦ le_rfl exact le_trans (Nat.le_add_right n 1) (le_trans hypo (StrictMono.le_apply hsubmono)) · use 0; simp · use 1 @@ -621,7 +648,7 @@ theorem isTightMeasureSet_of_isCompact_closure (hcomp : IsCompact (closure S)) : intro ε εpos rcases lt_or_ge 1 ε with hεbound | hεbound · refine ⟨∅, isCompact_empty, fun μ hμ ↦ ?_⟩ - simp only [mem_setOf_eq] at hμ + simp only [mem_ofPred_eq] at hμ obtain ⟨μ', hμ', rfl⟩ := hμ rw [compl_empty, measure_univ] exact le_of_lt hεbound diff --git a/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean b/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean index a17cd73c32ecf7..6e05665f836fbb 100644 --- a/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean +++ b/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean @@ -118,13 +118,13 @@ theorem preimage_null (h : QuasiMeasurePreserving f μa μb) {s : Set β} (hs : μa (f ⁻¹' s) = 0 := preimage_null_of_map_null h.aemeasurable (h.2 hs) -theorem preimage_mono_ae {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s ≤ᵐ[μb] t) : - f ⁻¹' s ≤ᵐ[μa] f ⁻¹' t := +theorem preimage_mono_ae {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s ⊆ᵐ[μb] t) : + f ⁻¹' s ⊆ᵐ[μa] f ⁻¹' t := eventually_map.mp <| Eventually.filter_mono (tendsto_ae_map hf.aemeasurable) (Eventually.filter_mono hf.ae_map_le h) -theorem preimage_ae_eq {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s =ᵐ[μb] t) : - f ⁻¹' s =ᵐ[μa] f ⁻¹' t := +theorem preimage_ae_eq {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s =ᵐˢ[μb] t) : + f ⁻¹' s =ᵐˢ[μa] f ⁻¹' t := EventuallyLE.antisymm (hf.preimage_mono_ae h.le) (hf.preimage_mono_ae h.symm.le) /-- The preimage of a null measurable set under a (quasi-)measure-preserving map is a null @@ -135,7 +135,7 @@ theorem _root_.MeasureTheory.NullMeasurableSet.preimage {s : Set β} (hs : NullM ⟨f ⁻¹' t, hf.measurable htm, hf.preimage_ae_eq hst⟩ theorem preimage_iterate_ae_eq {s : Set α} {f : α → α} (hf : QuasiMeasurePreserving f μ μ) (k : ℕ) - (hs : f ⁻¹' s =ᵐ[μ] s) : f^[k] ⁻¹' s =ᵐ[μ] s := by + (hs : f ⁻¹' s =ᵐˢ[μ] s) : f^[k] ⁻¹' s =ᵐˢ[μ] s := by induction k with | zero => rfl | succ k ih => @@ -143,29 +143,29 @@ theorem preimage_iterate_ae_eq {s : Set α} {f : α → α} (hf : QuasiMeasurePr exact EventuallyEq.trans (hf.preimage_ae_eq ih) hs theorem image_zpow_ae_eq {s : Set α} {e : α ≃ α} (he : QuasiMeasurePreserving e μ μ) - (he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐ[μ] s) : - (⇑(e ^ k)) '' s =ᵐ[μ] s := by + (he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐˢ[μ] s) : + (⇑(e ^ k)) '' s =ᵐˢ[μ] s := by rw [Equiv.image_eq_preimage_symm] obtain ⟨k, rfl | rfl⟩ := k.eq_nat_or_neg - · replace hs : (⇑e⁻¹) ⁻¹' s =ᵐ[μ] s := by rwa [Equiv.image_eq_preimage_symm] at hs - replace he' : (⇑e⁻¹)^[k] ⁻¹' s =ᵐ[μ] s := he'.preimage_iterate_ae_eq k hs + · replace hs : (⇑e⁻¹) ⁻¹' s =ᵐˢ[μ] s := by rwa [Equiv.image_eq_preimage_symm] at hs + replace he' : (⇑e⁻¹)^[k] ⁻¹' s =ᵐˢ[μ] s := he'.preimage_iterate_ae_eq k hs rwa [Equiv.Perm.iterate_eq_pow e⁻¹ k, inv_pow e k] at he' · rw [zpow_neg, zpow_natCast] - replace hs : e ⁻¹' s =ᵐ[μ] s := by + replace hs : e ⁻¹' s =ᵐˢ[μ] s := by convert! he.preimage_ae_eq hs.symm rw [Equiv.preimage_image] - replace he : (⇑e)^[k] ⁻¹' s =ᵐ[μ] s := he.preimage_iterate_ae_eq k hs + replace he : (⇑e)^[k] ⁻¹' s =ᵐˢ[μ] s := he.preimage_iterate_ae_eq k hs rwa [Equiv.Perm.iterate_eq_pow e k] at he -- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941 theorem limsup_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ) - (hs : f ⁻¹' s =ᵐ[μ] s) : limsup (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s := + (hs : f ⁻¹' s =ᵐˢ[μ] s) : limsup (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐˢ[μ] s := limsup_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs -- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941 theorem liminf_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ) - (hs : f ⁻¹' s =ᵐ[μ] s) : liminf (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s := + (hs : f ⁻¹' s =ᵐˢ[μ] s) : liminf (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐˢ[μ] s := liminf_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs @@ -173,12 +173,12 @@ theorem liminf_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreservi then it is a.e. equal to a measurable invariant set. -/ theorem exists_preimage_eq_of_preimage_ae {f : α → α} (h : QuasiMeasurePreserving f μ μ) - (hs : NullMeasurableSet s μ) (hs' : f ⁻¹' s =ᵐ[μ] s) : - ∃ t : Set α, MeasurableSet t ∧ t =ᵐ[μ] s ∧ f ⁻¹' t = t := by + (hs : NullMeasurableSet s μ) (hs' : f ⁻¹' s =ᵐˢ[μ] s) : + ∃ t : Set α, MeasurableSet t ∧ t =ᵐˢ[μ] s ∧ f ⁻¹' t = t := by obtain ⟨t, htm, ht⟩ := hs refine ⟨limsup (f^[·] ⁻¹' t) atTop, ?_, ?_, ?_⟩ · exact .measurableSet_limsup fun n ↦ h.measurable.iterate n htm - · have : f ⁻¹' t =ᵐ[μ] t := (h.preimage_ae_eq ht.symm).trans (hs'.trans ht) + · have : f ⁻¹' t =ᵐˢ[μ] t := (h.preimage_ae_eq ht.symm).trans (hs'.trans ht) exact limsup_ae_eq_of_forall_ae_eq _ fun n ↦ .trans (h.preimage_iterate_ae_eq _ this) ht.symm · simp only [Set.preimage_iterate_eq] exact CompleteLatticeHom.apply_limsup_iterate (CompleteLatticeHom.setPreimage f) t @@ -189,7 +189,7 @@ open scoped Pointwise theorem smul_ae_eq_of_ae_eq {G α : Type*} [Group G] [MulAction G α] {_ : MeasurableSpace α} {s t : Set α} {μ : Measure α} (g : G) (h_qmp : QuasiMeasurePreserving (g⁻¹ • · : α → α) μ μ) - (h_ae_eq : s =ᵐ[μ] t) : (g • s : Set α) =ᵐ[μ] (g • t : Set α) := by + (h_ae_eq : s =ᵐˢ[μ] t) : (g • s : Set α) =ᵐˢ[μ] (g • t : Set α) := by simpa only [← preimage_smul_inv] using! h_qmp.ae_eq h_ae_eq end QuasiMeasurePreserving diff --git a/Mathlib/MeasureTheory/Measure/Real.lean b/Mathlib/MeasureTheory/Measure/Real.lean index ec1f88b8aa8fe4..48b8f3c6bfb3d5 100644 --- a/Mathlib/MeasureTheory/Measure/Real.lean +++ b/Mathlib/MeasureTheory/Measure/Real.lean @@ -179,7 +179,7 @@ theorem measureReal_union_null_iff fun h ↦ measureReal_union_null h.1 h.2⟩ /-- If two sets are equal modulo a set of measure zero, then `μ.real s = μ.real t`. -/ -theorem measureReal_congr (H : s =ᵐ[μ] t) : μ.real s = μ.real t := by +theorem measureReal_congr (H : s =ᵐˢ[μ] t) : μ.real s = μ.real t := by simp [Measure.real, measure_congr H] theorem measureReal_inter_add_sdiff₀ (ht : NullMeasurableSet t μ) diff --git a/Mathlib/MeasureTheory/Measure/Restrict.lean b/Mathlib/MeasureTheory/Measure/Restrict.lean index 8c50c7c32662ea..bebbb97b8bf7a6 100644 --- a/Mathlib/MeasureTheory/Measure/Restrict.lean +++ b/Mathlib/MeasureTheory/Measure/Restrict.lean @@ -73,7 +73,7 @@ theorem restrict_apply (ht : MeasurableSet t) : μ.restrict s t = μ (t ∩ s) : restrict_apply₀ ht.nullMeasurableSet /-- Restriction of a measure to a subset is monotone both in set and in measure. -/ -theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s') +theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ⊆ᵐ[μ] s') (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' := Measure.le_iff.2 fun t ht => calc μ.restrict s t = μ (t ∩ s) := restrict_apply ht @@ -95,10 +95,10 @@ theorem restrict_mono_set {_ : MeasurableSpace α} (μ : Measure α) {s t : Set μ.restrict s ≤ μ.restrict t := restrict_mono h le_rfl -theorem restrict_mono_ae (h : s ≤ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t := +theorem restrict_mono_ae (h : s ⊆ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t := restrict_mono' h (le_refl μ) -theorem restrict_congr_set (h : s =ᵐ[μ] t) : μ.restrict s = μ.restrict t := +theorem restrict_congr_set (h : s =ᵐˢ[μ] t) : μ.restrict s = μ.restrict t := le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le) /-- If `s` is a measurable set, then the outer measure of `t` with respect to the restriction of @@ -123,7 +123,8 @@ theorem forall_measure_inter_isCountablySpanning_eq_zero {C : Set (Set α)} mpr h t _ := measure_inter_null_of_null_left t h theorem _root_.IsCountablySpanning.null_of_forall_restrict_null {C : Set (Set α)} - (hC : IsCountablySpanning C) (hm : C ⊆ MeasurableSet) (ht : ∀ t ∈ C, μ.restrict t s = 0) : + (hC : IsCountablySpanning C) (hm : C ⊆ {t | MeasurableSet t}) + (ht : ∀ t ∈ C, μ.restrict t s = 0) : μ s = 0 := by rw [← forall_measure_inter_isCountablySpanning_eq_zero hC] intro t htc @@ -132,7 +133,7 @@ theorem _root_.IsCountablySpanning.null_of_forall_restrict_null {C : Set (Set α theorem restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by rw [← restrict_congr_set hs.toMeasurable_ae_eq, restrict_apply' (measurableSet_toMeasurable _ _), - measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)] + measure_congr ((ae_eq_refl (· ∈ t)).inter hs.toMeasurable_ae_eq)] theorem restrict_le_self : μ.restrict s ≤ μ := Measure.le_iff.2 fun t ht => calc @@ -605,7 +606,7 @@ theorem ae_restrict_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} : theorem ae_restrict_iff₀ {p : α → Prop} (hp : NullMeasurableSet { x | p x } (μ.restrict s)) : (∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x := by - simp only [ae_iff, ← compl_setOf, Measure.restrict_apply₀ hp.compl] + simp only [ae_iff, ← compl_ofPred, Measure.restrict_apply₀ hp.compl] rw [iff_iff_eq]; congr with x; simp [and_comm] theorem ae_restrict_iff {p : α → Prop} (hp : MeasurableSet { x | p x }) : @@ -615,11 +616,13 @@ theorem ae_restrict_iff {p : α → Prop} (hp : MeasurableSet { x | p x }) : theorem ae_imp_of_ae_restrict {s : Set α} {p : α → Prop} (h : ∀ᵐ x ∂μ.restrict s, p x) : ∀ᵐ x ∂μ, x ∈ s → p x := by simp only [ae_iff] at h ⊢ - simpa [setOf_and, inter_comm] using measure_inter_eq_zero_of_restrict h + convert measure_inter_eq_zero_of_restrict h using 2 + ext a + simp [and_comm] theorem ae_restrict_iff'₀ {p : α → Prop} (hs : NullMeasurableSet s μ) : (∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x := by - simp only [ae_iff, ← compl_setOf, restrict_apply₀' hs] + simp only [ae_iff, ← compl_ofPred, restrict_apply₀' hs] rw [iff_iff_eq]; congr with x; simp [and_comm] theorem ae_restrict_iff' {p : α → Prop} (hs : MeasurableSet s) : @@ -708,7 +711,7 @@ theorem le_ae_restrict : ae μ ⊓ 𝓟 s ≤ ae (μ.restrict s) := fun _s hs => @[simp] theorem ae_restrict_eq (hs : MeasurableSet s) : ae (μ.restrict s) = ae μ ⊓ 𝓟 s := by ext t - simp only [mem_inf_principal, mem_ae_iff, restrict_apply_eq_zero' hs, compl_setOf, + simp only [mem_inf_principal, mem_ae_iff, restrict_apply_eq_zero' hs, compl_ofPred, Classical.not_imp, fun a => and_comm (a := a ∈ s) (b := a ∉ t)] rfl @@ -727,12 +730,12 @@ theorem self_mem_ae_restrict {s} (hs : MeasurableSet s) : s ∈ ae (μ.restrict /-- If two measurable sets are `ae_eq` then any proposition that is almost everywhere true on one is almost everywhere true on the other -/ -theorem ae_restrict_of_ae_eq_of_ae_restrict {s t} (hst : s =ᵐ[μ] t) {p : α → Prop} : +theorem ae_restrict_of_ae_eq_of_ae_restrict {s t} (hst : s =ᵐˢ[μ] t) {p : α → Prop} : (∀ᵐ x ∂μ.restrict s, p x) → ∀ᵐ x ∂μ.restrict t, p x := by simp [Measure.restrict_congr_set hst] /-- If two measurable sets are `ae_eq` then any proposition that is almost everywhere true on one is almost everywhere true on the other -/ -theorem ae_restrict_congr_set {s t} (hst : s =ᵐ[μ] t) {p : α → Prop} : +theorem ae_restrict_congr_set {s t} (hst : s =ᵐˢ[μ] t) {p : α → Prop} : (∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ.restrict t, p x := ⟨ae_restrict_of_ae_eq_of_ae_restrict hst, ae_restrict_of_ae_eq_of_ae_restrict hst.symm⟩ @@ -755,17 +758,16 @@ lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_e lemma nullMeasurableSet_restrict (hs : NullMeasurableSet s μ) {t : Set α} : NullMeasurableSet t (μ.restrict s) ↔ NullMeasurableSet (t ∩ s) μ := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ - · obtain ⟨t', -, ht', t't⟩ : ∃ t' ⊇ t, MeasurableSet t' ∧ t' =ᵐ[μ.restrict s] t := + · obtain ⟨t', -, ht', t't⟩ : ∃ t' ⊇ t, MeasurableSet t' ∧ t' =ᵐˢ[μ.restrict s] t := h.exists_measurable_superset_ae_eq - have A : (t' ∩ s : Set α) =ᵐ[μ] (t ∩ s : Set α) := by + have A : (t' ∩ s : Set α) =ᵐˢ[μ] (t ∩ s : Set α) := by have : ∀ᵐ x ∂μ, x ∈ s → (x ∈ t') = (x ∈ t) := (ae_restrict_iff'₀ hs).1 t't filter_upwards [this] with y hy - change (y ∈ t' ∩ s) = (y ∈ t ∩ s) simpa only [eq_iff_iff, mem_inter_iff, and_congr_left_iff] using hy - obtain ⟨s', -, hs', s's⟩ : ∃ s' ⊇ s, MeasurableSet s' ∧ s' =ᵐ[μ] s := + obtain ⟨s', -, hs', s's⟩ : ∃ s' ⊇ s, MeasurableSet s' ∧ s' =ᵐˢ[μ] s := hs.exists_measurable_superset_ae_eq - have B : (t' ∩ s' : Set α) =ᵐ[μ] (t' ∩ s : Set α) := + have B : (t' ∩ s' : Set α) =ᵐˢ[μ] (t' ∩ s : Set α) := ae_eq_set_inter (EventuallyEq.refl _ _) s's exact (ht'.inter hs').nullMeasurableSet.congr (B.trans A) · have A : NullMeasurableSet (t \ s) (μ.restrict s) := by @@ -779,14 +781,13 @@ lemma nullMeasurableSet_restrict (hs : NullMeasurableSet s μ) {t : Set α} : lemma nullMeasurableSet_restrict_of_subset {t : Set α} (ht : t ⊆ s) : NullMeasurableSet t (μ.restrict s) ↔ NullMeasurableSet t μ := by refine ⟨fun h ↦ ?_, fun h ↦ h.mono_ac absolutelyContinuous_restrict⟩ - obtain ⟨t', t'_subs, ht', t't⟩ : ∃ t' ⊆ t, MeasurableSet t' ∧ t' =ᵐ[μ.restrict s] t := + obtain ⟨t', t'_subs, ht', t't⟩ : ∃ t' ⊆ t, MeasurableSet t' ∧ t' =ᵐˢ[μ.restrict s] t := h.exists_measurable_subset_ae_eq have : ∀ᵐ x ∂μ, x ∈ s → (x ∈ t' ↔ x ∈ t) := by apply ae_imp_of_ae_restrict filter_upwards [t't] with x hx using by simpa using! hx - have : t' =ᵐ[μ] t := by + have : t' =ᵐˢ[μ] t := by filter_upwards [this] with x hx - change (x ∈ t') = (x ∈ t) simp only [eq_iff_iff] tauto exact ht'.nullMeasurableSet.congr this @@ -809,7 +810,7 @@ theorem MeasurableSet.nullMeasurableSet_subtype_coe {t : Set s} (hs : NullMeasur exact hs.inter (hs'.nullMeasurableSet) | empty => simp only [image_empty, nullMeasurableSet_empty] | compl t' _ ht' => - simp only [← range_sdiff_image Subtype.coe_injective, Subtype.range_coe_subtype, setOf_mem_eq] + simp only [← range_sdiff_image Subtype.coe_injective, Subtype.range_coe_subtype, ofPred_mem_eq] exact hs.diff ht' | iUnion f _ hf => rw [image_iUnion] @@ -850,7 +851,7 @@ theorem Subtype.volume_def : (volume : Measure u) = volume.comap Subtype.val := theorem Subtype.volume_univ (hu : NullMeasurableSet u) : volume (univ : Set u) = volume u := by rw [Subtype.volume_def, comap_apply₀ _ _ _ _ MeasurableSet.univ.nullMeasurableSet] - · simp only [image_univ, Subtype.range_coe_subtype, setOf_mem_eq] + · simp only [image_univ, Subtype.range_coe_subtype, ofPred_mem_eq] · exact Subtype.coe_injective · exact fun t => MeasurableSet.nullMeasurableSet_subtype_coe hu @@ -898,7 +899,7 @@ theorem comap_map (μ : Measure α) : (map f μ).comap f = μ := by rw [hf.comap_apply, hf.map_apply, preimage_image_eq _ hf.injective] theorem ae_map_iff {p : β → Prop} {μ : Measure α} : (∀ᵐ x ∂μ.map f, p x) ↔ ∀ᵐ x ∂μ, p (f x) := by - simp only [ae_iff, hf.map_apply, preimage_setOf_eq] + simp only [ae_iff, hf.map_apply, preimage_ofPred_eq] theorem restrict_map (μ : Measure α) (s : Set β) : (μ.map f).restrict s = (μ.restrict <| f ⁻¹' s).map f := @@ -1000,7 +1001,7 @@ theorem piecewise_ae_eq_restrict_compl [DecidablePred (· ∈ s)] (hs : Measurab exact (piecewise_eqOn_compl s f g).eventuallyEq.filter_mono inf_le_right theorem piecewise_ae_eq_of_ae_eq_set [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] - (hst : s =ᵐ[μ] t) : s.piecewise f g =ᵐ[μ] t.piecewise f g := + (hst : s =ᵐˢ[μ] t) : s.piecewise f g =ᵐ[μ] t.piecewise f g := hst.mem_iff.mono fun x hx => by simp [piecewise, hx] end Piecewise @@ -1062,7 +1063,7 @@ theorem indicator_ae_eq_zero_of_restrict_ae_eq_zero (hs : MeasurableSet s) · simp only [hxs, hx hxs, Set.indicator_of_mem] · simp [hxs] -theorem indicator_ae_eq_of_ae_eq_set (hst : s =ᵐ[μ] t) : s.indicator f =ᵐ[μ] t.indicator f := by +theorem indicator_ae_eq_of_ae_eq_set (hst : s =ᵐˢ[μ] t) : s.indicator f =ᵐ[μ] t.indicator f := by classical exact piecewise_ae_eq_of_ae_eq_set hst theorem indicator_meas_zero (hs : μ s = 0) : indicator s f =ᵐ[μ] 0 := @@ -1140,7 +1141,7 @@ lemma MeasureTheory.Measure.sum_restrict_le {_ : MeasurableSpace α} · simp [hPC] have hCM : (C : Set ι).encard ≤ M := have ⟨x, hx⟩ := Set.nonempty_iff_ne_empty.mpr hPC - (encard_mono (mem_iInter₂.mp hx.1)).trans (hs x) + (encard_mono (b := {i | x ∈ s i}) (mem_iInter₂.mp hx.1)).trans (hs x) exact nsmul_le_nsmul_left zero_le <| calc {a ∈ F | a ∈ C}.card _ ≤ C.card := card_mono <| fun i hi ↦ (F.mem_filter.mp hi).2 _ = (C : Set ι).ncard := (ncard_coe_finset C).symm diff --git a/Mathlib/MeasureTheory/Measure/SeparableMeasure.lean b/Mathlib/MeasureTheory/Measure/SeparableMeasure.lean index 0b8a1675ab1f86..8d95d19a940c79 100644 --- a/Mathlib/MeasureTheory/Measure/SeparableMeasure.lean +++ b/Mathlib/MeasureTheory/Measure/SeparableMeasure.lean @@ -281,7 +281,8 @@ theorem Measure.MeasureDense.of_generateFrom_isSetAlgebra_sigmaFinite (h𝒜 : I -- We use the fact that we already know this is true for finite measures. As `⋃ n, T n = X`, -- we have that `μ ((T n) ∩ s) ⟶ μ s`. have mono : Monotone (fun n ↦ (T n) ∩ s) := fun m n hmn ↦ inter_subset_inter_left s - (biUnion_subset_biUnion_left fun k hkm ↦ Nat.le_trans hkm hmn) + (biUnion_subset_biUnion_left (s := {k | k ≤ m}) (s' := {k | k ≤ n}) + fun k hkm ↦ Nat.le_trans hkm hmn) have := tendsto_measure_iUnion_atTop (μ := μ) mono rw [← tendsto_toReal_iff] at this · -- We can therefore choose `N` such that `μ s - μ ((S N) ∩ s) < ε/2`. @@ -366,7 +367,8 @@ theorem isSeparable_of_sigmaFinite [CountablyGenerated X] [SigmaFinite μ] : · rw [← hgen] exact generateFrom_mono <| le_trans self_subset_generateSetAlgebra <| generateSetAlgebra_mono <| subset_union_left .. - · induction hs with + · replace hs : GenerateSetAlgebra _ s := hs + induction hs with | base t t_mem => rcases t_mem with t_mem | ⟨n, rfl⟩ · exact hgen ▸ measurableSet_generateFrom t_mem diff --git a/Mathlib/MeasureTheory/Measure/Sub.lean b/Mathlib/MeasureTheory/Measure/Sub.lean index 4a40e904818f3d..f3544b76ac46f9 100644 --- a/Mathlib/MeasureTheory/Measure/Sub.lean +++ b/Mathlib/MeasureTheory/Measure/Sub.lean @@ -92,7 +92,7 @@ theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ simp [add_comm, h_measure_sub_add] apply le_sInf intro d h_d - rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d + rw [← h_measure_sub_add, mem_ofPred_eq, add_comm d] at h_d apply Measure.le_of_add_le_add_left h_d rw [h_measure_sub_eq] apply Measure.ofMeasurable_apply _ h₁ @@ -115,10 +115,10 @@ theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) : apply le_antisymm · refine sInf_le_sInf_of_isCoinitialFor ?_ intro ν' h_ν'_in - rw [mem_setOf_eq] at h_ν'_in + rw [mem_ofPred_eq] at h_ν'_in refine ⟨ν'.restrict s, ?_, restrict_le_self⟩ refine ⟨ν' + (⊤ : Measure α).restrict sᶜ, ?_, ?_⟩ - · rw [mem_setOf_eq, add_right_comm, Measure.le_iff] + · rw [mem_ofPred_eq, add_right_comm, Measure.le_iff] intro t h_meas_t repeat rw [← measure_inter_add_sdiff t h_meas_s] refine add_le_add ?_ ?_ @@ -135,7 +135,7 @@ theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) : simp [restrict_apply h_meas_t, restrict_apply (h_meas_t.inter h_meas_s), inter_assoc] · refine sInf_le_sInf_of_isCoinitialFor ?_ refine forall_mem_image.2 fun t h_t_in => ⟨t.restrict s, ?_, le_rfl⟩ - rw [Set.mem_setOf_eq, ← restrict_add] + rw [Set.mem_ofPred_eq, ← restrict_add] exact restrict_mono Subset.rfl h_t_in theorem sub_apply_eq_zero_of_restrict_le_restrict (h_le : μ.restrict s ≤ ν.restrict s) diff --git a/Mathlib/MeasureTheory/Measure/SubFinite.lean b/Mathlib/MeasureTheory/Measure/SubFinite.lean index 6e0c40c30c160e..4256367ec6d6b6 100644 --- a/Mathlib/MeasureTheory/Measure/SubFinite.lean +++ b/Mathlib/MeasureTheory/Measure/SubFinite.lean @@ -84,7 +84,7 @@ lemma withDensity_sub {f g : α → ℝ≥0∞} [IsFiniteMeasure (μ.withDensity infer_instance rw [withDensity_sub_of_le hg] refine ae_restrict_of_forall_mem ht.compl fun x hx ↦ ?_ - simp only [Set.mem_compl_iff, Set.mem_setOf_eq, not_le, t] at hx + simp only [Set.mem_compl_iff, Set.mem_ofPred_eq, not_le, t] at hx exact hx.le · refine sub_le_of_le_add ?_ rw [← withDensity_add_right _ hg] diff --git a/Mathlib/MeasureTheory/Measure/Support.lean b/Mathlib/MeasureTheory/Measure/Support.lean index 6a25a568568afd..37c3278a70dab6 100644 --- a/Mathlib/MeasureTheory/Measure/Support.lean +++ b/Mathlib/MeasureTheory/Measure/Support.lean @@ -126,7 +126,7 @@ lemma support_subset_of_isClosed {t : Set X} (ht : IsClosed t) (h : t ∈ ae μ) lemma compl_support_eq_sUnion : μ.supportᶜ = ⋃₀ {t : Set X | IsOpen t ∧ μ t = 0} := by ext x - simp only [Set.mem_compl_iff, Set.mem_sUnion, Set.mem_setOf_eq, and_right_comm, + simp only [Set.mem_compl_iff, Set.mem_sUnion, Set.mem_ofPred_eq, and_right_comm, nhds_basis_opens x |>.notMem_measureSupport, fun t ↦ and_comm (b := x ∈ t)] lemma support_eq_sInter : μ.support = ⋂₀ {t : Set X | IsClosed t ∧ μ tᶜ = 0} := by diff --git a/Mathlib/MeasureTheory/Measure/TightNormed.lean b/Mathlib/MeasureTheory/Measure/TightNormed.lean index 92f5f85bc93bf2..f36cc612b49be4 100644 --- a/Mathlib/MeasureTheory/Measure/TightNormed.lean +++ b/Mathlib/MeasureTheory/Measure/TightNormed.lean @@ -153,7 +153,7 @@ lemma isTightMeasureSet_of_forall_basis_tendsto (b : OrthonormalBasis ι 𝕜 E) _ ≤ ⨆ μ ∈ S, μ (⋃ i, {x : E | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖}) := by gcongr with μ hμS intro x hx - simp only [Set.mem_setOf_eq, Set.mem_iUnion] at hx ⊢ + simp only [Set.mem_ofPred_eq, Set.mem_iUnion] at hx ⊢ have hx' : r < √(Fintype.card ι) * ⨆ i, ‖⟪b i, x⟫_𝕜‖ := hx.trans_le (b.norm_le_card_mul_iSup_norm_inner x) rw [← div_lt_iff₀' (by positivity)] at hx' @@ -199,7 +199,7 @@ lemma isTightMeasureSet_iff_inner_tendsto : intro r have h_le (μ : Measure E) : μ {x | r < ‖⟪y, x⟫_𝕜‖} ≤ μ {x | r * ‖y‖⁻¹ < ‖x‖} := by refine measure_mono fun x hx ↦ ?_ - simp only [Set.mem_setOf_eq] at hx ⊢ + simp only [Set.mem_ofPred_eq] at hx ⊢ rw [mul_inv_lt_iff₀] · rw [mul_comm] exact hx.trans_le (norm_inner_le_norm y x) @@ -220,7 +220,7 @@ lemma isTightMeasureSet_range_of_tendsto_limsup_inner have h_map r : (μ n).map (fun x ↦ ⟪z, x⟫_𝕜) {x | r < ‖x‖} = μ n {x | r < ‖⟪z, x⟫_𝕜‖} := by rw [Measure.map_apply (by fun_prop)] · simp - · exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop) + · exact MeasurableSet.preimage (f := fun x : 𝕜 ↦ ‖x‖) measurableSet_Ioi (by fun_prop) simpa [h_map] using h_tight /-- In a finite-dimensional inner product space, the range of a sequence of measures diff --git a/Mathlib/MeasureTheory/Measure/Typeclasses/Finite.lean b/Mathlib/MeasureTheory/Measure/Typeclasses/Finite.lean index 18fff318c3ff61..a4a9a5aeaf292d 100644 --- a/Mathlib/MeasureTheory/Measure/Typeclasses/Finite.lean +++ b/Mathlib/MeasureTheory/Measure/Typeclasses/Finite.lean @@ -169,7 +169,7 @@ theorem summable_measure_toReal [hμ : IsFiniteMeasure μ] {f : ℕ → Set α} exact ne_of_lt (measure_lt_top _ _) theorem ae_eq_univ_iff_measure_eq [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) : - s =ᵐ[μ] univ ↔ μ s = μ univ := + s =ᵐˢ[μ] univ ↔ μ s = μ univ := ⟨measure_congr, fun h ↦ ae_eq_of_subset_of_measure_ge (subset_univ _) h.ge hs (by finiteness)⟩ theorem ae_iff_measure_eq [IsFiniteMeasure μ] {p : α → Prop} @@ -185,8 +185,9 @@ lemma tendsto_measure_biUnion_Ici_zero_of_pairwise_disjoint {Es : ℕ → Set X} (Es_mble : ∀ i, NullMeasurableSet (Es i) μ) (Es_disj : Pairwise fun n m ↦ Disjoint (Es n) (Es m)) : Tendsto (μ ∘ fun n ↦ ⋃ i ≥ n, Es i) atTop (𝓝 0) := by - have decr : Antitone fun n ↦ ⋃ i ≥ n, Es i := - fun n m hnm ↦ biUnion_mono (fun _ hi ↦ le_trans hnm hi) (fun _ _ ↦ subset_rfl) + have decr : Antitone fun n ↦ ⋃ i ≥ n, Es i := fun n m hnm ↦ + biUnion_mono (s := {i | i ≥ n}) (s' := {i | i ≥ m}) + (fun _ hi ↦ le_trans hnm hi) (fun _ _ ↦ subset_rfl) have nothing : ⋂ n, ⋃ i ≥ n, Es i = ∅ := by apply subset_antisymm _ (empty_subset _) intro x hx @@ -563,7 +564,8 @@ theorem isFiniteMeasure_iff_isFiniteMeasureOnCompacts_of_compactSpace [Topologic /-- Compact covering of a `σ`-compact topological space as `MeasureTheory.Measure.FiniteSpanningSetsIn`. -/ -def MeasureTheory.Measure.finiteSpanningSetsInCompact [TopologicalSpace α] [SigmaCompactSpace α] +noncomputable def MeasureTheory.Measure.finiteSpanningSetsInCompact + [TopologicalSpace α] [SigmaCompactSpace α] {_ : MeasurableSpace α} (μ : Measure α) [IsLocallyFiniteMeasure μ] : μ.FiniteSpanningSetsIn { K | IsCompact K } where set := compactCovering α @@ -573,7 +575,8 @@ def MeasureTheory.Measure.finiteSpanningSetsInCompact [TopologicalSpace α] [Sig /-- A locally finite measure on a `σ`-compact topological space admits a finite spanning sequence of open sets. -/ -def MeasureTheory.Measure.finiteSpanningSetsInOpen [TopologicalSpace α] [SigmaCompactSpace α] +noncomputable def MeasureTheory.Measure.finiteSpanningSetsInOpen + [TopologicalSpace α] [SigmaCompactSpace α] {_ : MeasurableSpace α} (μ : Measure α) [IsLocallyFiniteMeasure μ] : μ.FiniteSpanningSetsIn { K | IsOpen K } where set n := ((isCompact_compactCovering α n).exists_open_superset_measure_lt_top μ).choose diff --git a/Mathlib/MeasureTheory/Measure/Typeclasses/NullSingletonClass.lean b/Mathlib/MeasureTheory/Measure/Typeclasses/NullSingletonClass.lean index 05a501fdba695a..13bda0c251ce9c 100644 --- a/Mathlib/MeasureTheory/Measure/Typeclasses/NullSingletonClass.lean +++ b/Mathlib/MeasureTheory/Measure/Typeclasses/NullSingletonClass.lean @@ -84,7 +84,7 @@ theorem _root_.Finset.measure_zero (s : Finset α) (μ : Measure α) [NullSingle μ s = 0 := s.finite_toSet.measure_zero μ -theorem insert_ae_eq_self (a : α) (s : Set α) : (insert a s : Set α) =ᵐ[μ] s := +theorem insert_ae_eq_self (a : α) (s : Set α) : (insert a s : Set α) =ᵐˢ[μ] s := union_ae_eq_right.2 <| measure_mono_null sdiff_subset (measure_singleton _) /- @@ -104,28 +104,28 @@ section variable [PartialOrder α] {a b : α} -theorem Iio_ae_eq_Iic : Iio a =ᵐ[μ] Iic a := +theorem Iio_ae_eq_Iic : Iio a =ᵐˢ[μ] Iic a := Iio_ae_eq_Iic' (measure_singleton a) -theorem Ioi_ae_eq_Ici : Ioi a =ᵐ[μ] Ici a := +theorem Ioi_ae_eq_Ici : Ioi a =ᵐˢ[μ] Ici a := Ioi_ae_eq_Ici' (measure_singleton a) -theorem Ioo_ae_eq_Ioc : Ioo a b =ᵐ[μ] Ioc a b := +theorem Ioo_ae_eq_Ioc : Ioo a b =ᵐˢ[μ] Ioc a b := Ioo_ae_eq_Ioc' (measure_singleton b) -theorem Ioc_ae_eq_Icc : Ioc a b =ᵐ[μ] Icc a b := +theorem Ioc_ae_eq_Icc : Ioc a b =ᵐˢ[μ] Icc a b := Ioc_ae_eq_Icc' (measure_singleton a) -theorem Ioo_ae_eq_Ico : Ioo a b =ᵐ[μ] Ico a b := +theorem Ioo_ae_eq_Ico : Ioo a b =ᵐˢ[μ] Ico a b := Ioo_ae_eq_Ico' (measure_singleton a) -theorem Ioo_ae_eq_Icc : Ioo a b =ᵐ[μ] Icc a b := +theorem Ioo_ae_eq_Icc : Ioo a b =ᵐˢ[μ] Icc a b := Ioo_ae_eq_Icc' (measure_singleton a) (measure_singleton b) -theorem Ico_ae_eq_Icc : Ico a b =ᵐ[μ] Icc a b := +theorem Ico_ae_eq_Icc : Ico a b =ᵐˢ[μ] Icc a b := Ico_ae_eq_Icc' (measure_singleton b) -theorem Ico_ae_eq_Ioc : Ico a b =ᵐ[μ] Ioc a b := +theorem Ico_ae_eq_Ioc : Ico a b =ᵐˢ[μ] Ioc a b := Ico_ae_eq_Ioc' (measure_singleton a) (measure_singleton b) theorem restrict_Iio_eq_restrict_Iic : μ.restrict (Iio a) = μ.restrict (Iic a) := @@ -157,7 +157,7 @@ end open Interval open scoped Interval in -theorem uIoc_ae_eq_interval [LinearOrder α] {a b : α} : Ι a b =ᵐ[μ] [[a, b]] := +theorem uIoc_ae_eq_interval [LinearOrder α] {a b : α} : Ι a b =ᵐˢ[μ] [[a, b]] := Ioc_ae_eq_Icc end MeasureTheory diff --git a/Mathlib/MeasureTheory/Measure/Typeclasses/SFinite.lean b/Mathlib/MeasureTheory/Measure/Typeclasses/SFinite.lean index 4be87e7cb30e9e..f9775b6e855990 100644 --- a/Mathlib/MeasureTheory/Measure/Typeclasses/SFinite.lean +++ b/Mathlib/MeasureTheory/Measure/Typeclasses/SFinite.lean @@ -105,7 +105,7 @@ theorem SigmaFinite.out (h : SigmaFinite μ) : Nonempty (μ.FiniteSpanningSetsIn h.1 /-- If `μ` is σ-finite it has finite spanning sets in the collection of all measurable sets. -/ -def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] : +noncomputable def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] : μ.FiniteSpanningSetsIn { s | MeasurableSet s } where set n := toMeasurable μ (h.out.some.set n) set_mem _ := measurableSet_toMeasurable _ _ @@ -117,7 +117,7 @@ def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] : /-- A noncomputable way to get a monotone collection of sets that span `univ` and have finite measure using `Classical.choose`. This definition satisfies monotonicity in addition to all other properties in `SigmaFinite`. -/ -def spanningSets (μ : Measure α) [SigmaFinite μ] (i : ℕ) : Set α := +noncomputable def spanningSets (μ : Measure α) [SigmaFinite μ] (i : ℕ) : Set α := accumulate μ.toFiniteSpanningSetsIn.set i theorem monotone_spanningSets (μ : Measure α) [SigmaFinite μ] : Monotone (spanningSets μ) := @@ -285,7 +285,7 @@ theorem countable_meas_pos_of_disjoint_iUnion₀ {ι : Type*} {_ : MeasurableSpa ⊆ ⋃ n, { i : ι | 0 < sfiniteSeq μ n (As i) } := by intro i hi by_contra con - simp only [mem_iUnion, mem_setOf_eq, not_exists, not_lt, nonpos_iff_eq_zero] at * + simp only [mem_iUnion, mem_ofPred_eq, not_exists, not_lt, nonpos_iff_eq_zero] at * rw [sum_apply₀] at hi · simp_rw [con] at hi simp at hi @@ -321,7 +321,7 @@ theorem countable_meas_level_set_pos {α β : Type*} {_ : MeasurableSpace α} { private lemma exists_ae_subset_biUnion_countable_of_isFiniteMeasure [IsFiniteMeasure μ] {C : Set (Set α)} (hC : ∀ s ∈ C, MeasurableSet s) : - ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ≤ᵐ[μ] (⋃₀ D) := by + ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ⊆ᵐ[μ] (⋃₀ D) := by let m := ⨆ D ∈ {D : Set (Set α) | D ⊆ C ∧ D.Countable}, μ (⋃₀ D) obtain ⟨D, D_mem, hD⟩ : ∃ D ∈ {D : Set (Set α) | D ⊆ C ∧ D.Countable}, μ (⋃₀ D) = m := by rcases eq_bot_or_bot_lt m with hm | hm @@ -354,8 +354,8 @@ This lemma shows the existence of a measurable union, writing it as the union of subfamily. -/ lemma exists_ae_subset_biUnion_countable [SFinite μ] {C : Set (Set α)} (hC : ∀ s ∈ C, MeasurableSet s) : - ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ≤ᵐ[μ] (⋃₀ D) := by - have A n : ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ≤ᵐ[sfiniteSeq μ n] (⋃₀ D) := + ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ⊆ᵐ[μ] (⋃₀ D) := by + have A n : ∃ D ⊆ C, D.Countable ∧ ∀ s ∈ C, s ⊆ᵐ[sfiniteSeq μ n] (⋃₀ D) := exists_ae_subset_biUnion_countable_of_isFiniteMeasure hC choose D DC D_count hD using A refine ⟨⋃ n, D n, by simp [DC], by simp [D_count], fun s hs ↦ ?_⟩ diff --git a/Mathlib/MeasureTheory/Measure/WithDensity.lean b/Mathlib/MeasureTheory/Measure/WithDensity.lean index a142193dbad040..845c1f91a922d2 100644 --- a/Mathlib/MeasureTheory/Measure/WithDensity.lean +++ b/Mathlib/MeasureTheory/Measure/WithDensity.lean @@ -257,14 +257,14 @@ theorem withDensity_apply_eq_zero' {f : α → ℝ≥0∞} {s : Set α} (hf : AE simp only [Pi.zero_apply] at A convert! A using 2 ext x - simp only [and_comm, exists_prop, mem_inter_iff, mem_setOf_eq, + simp only [and_comm, exists_prop, mem_inter_iff, mem_ofPred_eq, not_forall] · intro hs let t := toMeasurable μ ({ x | f x ≠ 0 } ∩ s) have A : s ⊆ t ∪ { x | f x = 0 } := by intro x hx rcases eq_or_ne (f x) 0 with (fx | fx) - · simp only [fx, mem_union, mem_setOf_eq, or_true] + · simp only [fx, mem_union, mem_ofPred_eq, or_true] · left apply subset_toMeasurable _ _ exact ⟨fx, hx⟩ @@ -272,7 +272,7 @@ theorem withDensity_apply_eq_zero' {f : α → ℝ≥0∞} {s : Set α} (hf : AE · apply withDensity_absolutelyContinuous rwa [measure_toMeasurable] rcases hf with ⟨g, hg, hfg⟩ - have t : {x | f x = 0} =ᵐ[μ.withDensity f] {x | g x = 0} := by + have t : {x | f x = 0} =ᵐˢ[μ.withDensity f] {x | g x = 0} := by apply withDensity_absolutelyContinuous filter_upwards [hfg] with a ha rw [eq_iff_iff] @@ -293,7 +293,7 @@ theorem ae_withDensity_iff' {p : α → Prop} {f : α → ℝ≥0∞} (hf : AEMe rw [ae_iff, ae_iff, withDensity_apply_eq_zero' hf, iff_iff_eq] congr ext x - simp only [exists_prop, mem_inter_iff, mem_setOf_eq, not_forall] + simp only [exists_prop, mem_inter_iff, mem_ofPred_eq, not_forall] theorem ae_withDensity_iff {p : α → Prop} {f : α → ℝ≥0∞} (hf : Measurable f) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ, f x ≠ 0 → p x := @@ -303,9 +303,9 @@ theorem ae_withDensity_iff_ae_restrict' {p : α → Prop} {f : α → ℝ≥0∞ (hf : AEMeasurable f μ) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ.restrict { x | f x ≠ 0 }, p x := by rw [ae_withDensity_iff' hf, ae_restrict_iff'₀] - · simp only [mem_setOf] + · simp only [mem_ofPred] · rcases hf with ⟨g, hg, hfg⟩ - have nonneg_eq_ae : {x | g x ≠ 0} =ᵐ[μ] {x | f x ≠ 0} := by + have nonneg_eq_ae : {x | g x ≠ 0} =ᵐˢ[μ] {x | f x ≠ 0} := by filter_upwards [hfg] with a ha simp only [eq_iff_iff] exact ⟨fun (h : g a ≠ 0) ↦ by rwa [← ha] at h, @@ -439,7 +439,7 @@ theorem lintegral_withDensity_eq_lintegral_mul₀' {μ : Measure α} {f : α → (hf.measurable_mk (measurableSet_singleton 0).compl).compl filter_upwards [ae_restrict_mem M] intro x hx - simp only [Classical.not_not, mem_setOf_eq, mem_compl_iff] at hx + simp only [Classical.not_not, mem_ofPred_eq, mem_compl_iff] at hx simp only [hx, zero_mul, Pi.mul_apply] _ = ∫⁻ a : α, (f * g) a ∂μ := by apply lintegral_congr_ae diff --git a/Mathlib/MeasureTheory/Order/UpperLower.lean b/Mathlib/MeasureTheory/Order/UpperLower.lean index a0fb96c8e8f241..ac7f9c2b05b854 100644 --- a/Mathlib/MeasureTheory/Order/UpperLower.lean +++ b/Mathlib/MeasureTheory/Order/UpperLower.lean @@ -125,7 +125,7 @@ theorem IsUpperSet.null_frontier (hs : IsUpperSet s) : volume (frontier s) = 0 : (Besicovitch.ae_tendsto_measure_inter_div_of_measurableSet _ (isClosed_closure (s := s)).measurableSet) by_cases h : x ∈ closure s <;> - simp only [mem_compl_iff, mem_setOf, h, not_false_eq_true, indicator_of_notMem, + simp only [mem_compl_iff, mem_ofPred, h, not_false_eq_true, indicator_of_notMem, indicator_of_mem, Pi.one_apply] · refine aux₁ fun _ ↦ hs.compl.exists_subset_ball <| frontier_subset_closure ?_ rwa [frontier_compl] @@ -136,7 +136,7 @@ theorem IsLowerSet.null_frontier (hs : IsLowerSet s) : volume (frontier s) = 0 : (Besicovitch.ae_tendsto_measure_inter_div_of_measurableSet _ (isClosed_closure (s := s)).measurableSet) by_cases h : x ∈ closure s <;> - simp only [mem_compl_iff, mem_setOf, h, not_false_eq_true, indicator_of_notMem, + simp only [mem_compl_iff, mem_ofPred, h, not_false_eq_true, indicator_of_notMem, indicator_of_mem, Pi.one_apply] · refine aux₁ fun _ ↦ hs.compl.exists_subset_ball <| frontier_subset_closure ?_ rwa [frontier_compl] diff --git a/Mathlib/MeasureTheory/OuterMeasure/AE.lean b/Mathlib/MeasureTheory/OuterMeasure/AE.lean index 2f87f493baf968..ad341ecae6dccd 100644 --- a/Mathlib/MeasureTheory/OuterMeasure/AE.lean +++ b/Mathlib/MeasureTheory/OuterMeasure/AE.lean @@ -45,7 +45,7 @@ variable {α β F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F /-- The “almost everywhere” filter of co-null sets. -/ def ae (μ : F) : Filter α := - .ofCountableUnion (μ · = 0) (fun _S hSc ↦ (measure_sUnion_null_iff hSc).2) fun _t ht _s hs ↦ + .ofCountableUnion {s | μ s = 0} (fun _S hSc ↦ (measure_sUnion_null_iff hSc).2) fun _t ht _s hs ↦ measure_mono_null hs ht deriving CountableInterFilter @@ -72,6 +72,18 @@ i.e. `f ≤ g` away from a null set. This is notation for `Filter.EventuallyLE (MeasureTheory.ae μ) f g`. -/ notation3:50 f " ≤ᵐ[" μ:50 "] " g:50 => Filter.EventuallyLE (MeasureTheory.ae μ) f g +/-- `s =ᵐˢ[μ] t` means that the sets `s` and `t` are equal away from a `μ`-null set. + +This is notation for `Filter.EventuallyEq (MeasureTheory.ae μ) (· ∈ s) (· ∈ t)`. -/ +notation:50 s " =ᵐˢ[" μ:50 "] " t:50 => + Filter.EventuallyEq (MeasureTheory.ae μ) (fun x => x ∈ s) (fun x => x ∈ t) + +/-- `s ⊆ᵐ[μ] t` means that the set `s` is contained in `t` away from a `μ`-null set. + +This is notation for `Filter.EventuallyLE (MeasureTheory.ae μ) (· ∈ s) (· ∈ t)`. -/ +notation:50 s " ⊆ᵐ[" μ:50 "] " t:50 => + Filter.EventuallyLE (MeasureTheory.ae μ) (fun x => x ∈ s) (fun x => x ∈ t) + theorem mem_ae_iff {s : Set α} : s ∈ ae μ ↔ μ sᶜ = 0 := Iff.rfl @@ -137,127 +149,122 @@ theorem ae_le_of_ae_lt {β : Type*} [Preorder β] {f g : α → β} (h : ∀ᵐ h.mono fun _ ↦ le_of_lt @[simp] -theorem ae_eq_empty : s =ᵐ[μ] (∅ : Set α) ↔ μ s = 0 := - eventuallyEq_empty.trans <| by simp only [ae_iff, Classical.not_not, setOf_mem_eq] +theorem ae_eq_empty : s =ᵐˢ[μ] (∅ : Set α) ↔ μ s = 0 := + eventuallyEq_empty.trans <| by simp only [ae_iff, Classical.not_not, ofPred_mem_eq] -- The priority should be higher than `eventuallyEq_univ`. @[simp high] -theorem ae_eq_univ : s =ᵐ[μ] (univ : Set α) ↔ μ sᶜ = 0 := +theorem ae_eq_univ : s =ᵐˢ[μ] (univ : Set α) ↔ μ sᶜ = 0 := eventuallyEq_univ -theorem ae_le_set : s ≤ᵐ[μ] t ↔ μ (s \ t) = 0 := +theorem ae_le_set : s ⊆ᵐ[μ] t ↔ μ (s \ t) = 0 := calc - s ≤ᵐ[μ] t ↔ ∀ᵐ x ∂μ, x ∈ s → x ∈ t := Iff.rfl + s ⊆ᵐ[μ] t ↔ ∀ᵐ x ∂μ, x ∈ s → x ∈ t := Iff.rfl _ ↔ μ (s \ t) = 0 := by simp [ae_iff]; rfl -theorem ae_le_set_inter {s' t' : Set α} (h : s ≤ᵐ[μ] t) (h' : s' ≤ᵐ[μ] t') : - (s ∩ s' : Set α) ≤ᵐ[μ] (t ∩ t' : Set α) := +theorem ae_le_set_inter {s' t' : Set α} (h : s ⊆ᵐ[μ] t) (h' : s' ⊆ᵐ[μ] t') : + (s ∩ s' : Set α) ⊆ᵐ[μ] (t ∩ t' : Set α) := h.inter h' -theorem ae_le_set_union {s' t' : Set α} (h : s ≤ᵐ[μ] t) (h' : s' ≤ᵐ[μ] t') : - (s ∪ s' : Set α) ≤ᵐ[μ] (t ∪ t' : Set α) := +theorem ae_le_set_union {s' t' : Set α} (h : s ⊆ᵐ[μ] t) (h' : s' ⊆ᵐ[μ] t') : + (s ∪ s' : Set α) ⊆ᵐ[μ] (t ∪ t' : Set α) := h.union h' -theorem union_ae_eq_right : (s ∪ t : Set α) =ᵐ[μ] t ↔ μ (s \ t) = 0 := by - simp [eventuallyLE_antisymm_iff, ae_le_set, union_sdiff_right, - sdiff_eq_empty.2 Set.subset_union_right] +theorem union_ae_eq_right : (s ∪ t : Set α) =ᵐˢ[μ] t ↔ μ (s \ t) = 0 := by + rw [eventuallyLE_antisymm_iff, ae_le_set, ae_le_set, union_sdiff_right, + sdiff_eq_empty.2 Set.subset_union_right, and_iff_left measure_empty] -theorem sdiff_ae_eq_self : (s \ t : Set α) =ᵐ[μ] s ↔ μ (s ∩ t) = 0 := by - simp [eventuallyLE_antisymm_iff, ae_le_set] +theorem sdiff_ae_eq_self : (s \ t : Set α) =ᵐˢ[μ] s ↔ μ (s ∩ t) = 0 := by + rw [eventuallyLE_antisymm_iff, ae_le_set, ae_le_set, Set.sdiff_sdiff_right_self, + sdiff_eq_empty.2 sdiff_le, and_iff_right measure_empty] @[deprecated (since := "2026-06-03")] alias diff_ae_eq_self := sdiff_ae_eq_self -theorem sdiff_null_ae_eq_self (ht : μ t = 0) : (s \ t : Set α) =ᵐ[μ] s := +theorem sdiff_null_ae_eq_self (ht : μ t = 0) : (s \ t : Set α) =ᵐˢ[μ] s := sdiff_ae_eq_self.mpr (measure_mono_null inter_subset_right ht) @[deprecated (since := "2026-06-03")] alias diff_null_ae_eq_self := sdiff_null_ae_eq_self -theorem ae_eq_set {s t : Set α} : s =ᵐ[μ] t ↔ μ (s \ t) = 0 ∧ μ (t \ s) = 0 := by +theorem ae_eq_set {s t : Set α} : s =ᵐˢ[μ] t ↔ μ (s \ t) = 0 ∧ μ (t \ s) = 0 := by simp [eventuallyLE_antisymm_iff, ae_le_set] open scoped symmDiff in @[simp] -theorem measure_symmDiff_eq_zero_iff {s t : Set α} : μ (s ∆ t) = 0 ↔ s =ᵐ[μ] t := by +theorem measure_symmDiff_eq_zero_iff {s t : Set α} : μ (s ∆ t) = 0 ↔ s =ᵐˢ[μ] t := by simp [ae_eq_set, symmDiff_def] set_option backward.isDefEq.respectTransparency false in @[simp] -theorem ae_eq_set_compl_compl {s t : Set α} : sᶜ =ᵐ[μ] tᶜ ↔ s =ᵐ[μ] t := by +theorem ae_eq_set_compl_compl {s t : Set α} : sᶜ =ᵐˢ[μ] tᶜ ↔ s =ᵐˢ[μ] t := by simp only [← measure_symmDiff_eq_zero_iff, compl_symmDiff_compl] -theorem ae_eq_set_compl {s t : Set α} : sᶜ =ᵐ[μ] t ↔ s =ᵐ[μ] tᶜ := by +theorem ae_eq_set_compl {s t : Set α} : sᶜ =ᵐˢ[μ] t ↔ s =ᵐˢ[μ] tᶜ := by rw [← ae_eq_set_compl_compl, compl_compl] -theorem ae_eq_set_inter {s' t' : Set α} (h : s =ᵐ[μ] t) (h' : s' =ᵐ[μ] t') : - (s ∩ s' : Set α) =ᵐ[μ] (t ∩ t' : Set α) := +theorem ae_eq_set_inter {s' t' : Set α} (h : s =ᵐˢ[μ] t) (h' : s' =ᵐˢ[μ] t') : + (s ∩ s' : Set α) =ᵐˢ[μ] (t ∩ t' : Set α) := h.inter h' -theorem ae_eq_set_union {s' t' : Set α} (h : s =ᵐ[μ] t) (h' : s' =ᵐ[μ] t') : - (s ∪ s' : Set α) =ᵐ[μ] (t ∪ t' : Set α) := +theorem ae_eq_set_union {s' t' : Set α} (h : s =ᵐˢ[μ] t) (h' : s' =ᵐˢ[μ] t') : + (s ∪ s' : Set α) =ᵐˢ[μ] (t ∪ t' : Set α) := h.union h' -theorem ae_eq_set_sdiff {s' t' : Set α} (h : s =ᵐ[μ] t) (h' : s' =ᵐ[μ] t') : - s \ s' =ᵐ[μ] t \ t' := +theorem ae_eq_set_sdiff {s' t' : Set α} (h : s =ᵐˢ[μ] t) (h' : s' =ᵐˢ[μ] t') : + s \ s' =ᵐˢ[μ] t \ t' := h.diff h' @[deprecated (since := "2026-06-03")] alias ae_eq_set_diff := ae_eq_set_sdiff open scoped symmDiff in -theorem ae_eq_set_symmDiff {s' t' : Set α} (h : s =ᵐ[μ] t) (h' : s' =ᵐ[μ] t') : - s ∆ s' =ᵐ[μ] t ∆ t' := +theorem ae_eq_set_symmDiff {s' t' : Set α} (h : s =ᵐˢ[μ] t) (h' : s' =ᵐˢ[μ] t') : + s ∆ s' =ᵐˢ[μ] t ∆ t' := h.symmDiff h' -theorem union_ae_eq_univ_of_ae_eq_univ_left (h : s =ᵐ[μ] univ) : (s ∪ t : Set α) =ᵐ[μ] univ := - (ae_eq_set_union h (ae_eq_refl t)).trans <| by rw [univ_union] +theorem union_ae_eq_univ_of_ae_eq_univ_left (h : s =ᵐˢ[μ] univ) : (s ∪ t : Set α) =ᵐˢ[μ] univ := + (ae_eq_set_union h EventuallyEq.rfl).trans <| by rw [univ_union] -theorem union_ae_eq_univ_of_ae_eq_univ_right (h : t =ᵐ[μ] univ) : (s ∪ t : Set α) =ᵐ[μ] univ := by - convert! ae_eq_set_union (ae_eq_refl s) h - rw [union_univ] +theorem union_ae_eq_univ_of_ae_eq_univ_right (h : t =ᵐˢ[μ] univ) : (s ∪ t : Set α) =ᵐˢ[μ] univ := + (ae_eq_set_union EventuallyEq.rfl h).trans <| by rw [union_univ] -theorem union_ae_eq_right_of_ae_eq_empty (h : s =ᵐ[μ] (∅ : Set α)) : (s ∪ t : Set α) =ᵐ[μ] t := by - convert! ae_eq_set_union h (ae_eq_refl t) - rw [empty_union] +theorem union_ae_eq_right_of_ae_eq_empty (h : s =ᵐˢ[μ] (∅ : Set α)) : + (s ∪ t : Set α) =ᵐˢ[μ] t := + (ae_eq_set_union h EventuallyEq.rfl).trans <| by rw [empty_union] -theorem union_ae_eq_left_of_ae_eq_empty (h : t =ᵐ[μ] (∅ : Set α)) : (s ∪ t : Set α) =ᵐ[μ] s := by - convert! ae_eq_set_union (ae_eq_refl s) h - rw [union_empty] +theorem union_ae_eq_left_of_ae_eq_empty (h : t =ᵐˢ[μ] (∅ : Set α)) : (s ∪ t : Set α) =ᵐˢ[μ] s := + (ae_eq_set_union EventuallyEq.rfl h).trans <| by rw [union_empty] -theorem inter_ae_eq_right_of_ae_eq_univ (h : s =ᵐ[μ] univ) : (s ∩ t : Set α) =ᵐ[μ] t := by - convert! ae_eq_set_inter h (ae_eq_refl t) - rw [univ_inter] +theorem inter_ae_eq_right_of_ae_eq_univ (h : s =ᵐˢ[μ] univ) : (s ∩ t : Set α) =ᵐˢ[μ] t := + (ae_eq_set_inter h EventuallyEq.rfl).trans <| by rw [univ_inter] -theorem inter_ae_eq_left_of_ae_eq_univ (h : t =ᵐ[μ] univ) : (s ∩ t : Set α) =ᵐ[μ] s := by - convert! ae_eq_set_inter (ae_eq_refl s) h - rw [inter_univ] +theorem inter_ae_eq_left_of_ae_eq_univ (h : t =ᵐˢ[μ] univ) : (s ∩ t : Set α) =ᵐˢ[μ] s := + (ae_eq_set_inter EventuallyEq.rfl h).trans <| by rw [inter_univ] -theorem inter_ae_eq_empty_of_ae_eq_empty_left (h : s =ᵐ[μ] (∅ : Set α)) : - (s ∩ t : Set α) =ᵐ[μ] (∅ : Set α) := by - convert! ae_eq_set_inter h (ae_eq_refl t) - rw [empty_inter] +theorem inter_ae_eq_empty_of_ae_eq_empty_left (h : s =ᵐˢ[μ] (∅ : Set α)) : + (s ∩ t : Set α) =ᵐˢ[μ] (∅ : Set α) := + (ae_eq_set_inter h EventuallyEq.rfl).trans <| by rw [empty_inter] -theorem inter_ae_eq_empty_of_ae_eq_empty_right (h : t =ᵐ[μ] (∅ : Set α)) : - (s ∩ t : Set α) =ᵐ[μ] (∅ : Set α) := by - convert! ae_eq_set_inter (ae_eq_refl s) h - rw [inter_empty] +theorem inter_ae_eq_empty_of_ae_eq_empty_right (h : t =ᵐˢ[μ] (∅ : Set α)) : + (s ∩ t : Set α) =ᵐˢ[μ] (∅ : Set α) := + (ae_eq_set_inter EventuallyEq.rfl h).trans <| by rw [inter_empty] theorem ae_eq_set_biInter {s : Set β} (hs : s.Countable) {t t' : β → Set α} - (h : ∀ b ∈ s, t b =ᵐ[μ] t' b) : - (⋂ b ∈ s, t b : Set α) =ᵐ[μ] (⋂ b ∈ s, t' b : Set α) := + (h : ∀ b ∈ s, t b =ᵐˢ[μ] t' b) : + (⋂ b ∈ s, t b : Set α) =ᵐˢ[μ] (⋂ b ∈ s, t' b : Set α) := .countable_bInter hs h theorem ae_eq_set_biUnion {s : Set β} (hs : s.Countable) {t t' : β → Set α} - (h : ∀ b ∈ s, t b =ᵐ[μ] t' b) : - (⋃ b ∈ s, t b : Set α) =ᵐ[μ] (⋃ b ∈ s, t' b : Set α) := + (h : ∀ b ∈ s, t b =ᵐˢ[μ] t' b) : + (⋃ b ∈ s, t b : Set α) =ᵐˢ[μ] (⋃ b ∈ s, t' b : Set α) := .countable_bUnion hs h @[to_additive] theorem _root_.Set.mulIndicator_ae_eq_one {M : Type*} [One M] {f : α → M} {s : Set α} : s.mulIndicator f =ᵐ[μ] 1 ↔ μ (s ∩ f.mulSupport) = 0 := by - simp [EventuallyEq, eventually_iff, ae, compl_setOf]; rfl + simp [EventuallyEq, eventually_iff, ae, compl_ofPred]; rfl /-- If `s ⊆ t` modulo a set of measure `0`, then `μ s ≤ μ t`. -/ @[mono] -theorem measure_mono_ae (H : s ≤ᵐ[μ] t) : μ s ≤ μ t := +theorem measure_mono_ae (H : s ⊆ᵐ[μ] t) : μ s ≤ μ t := calc μ s ≤ μ (s ∪ t) := measure_mono subset_union_left _ = μ (t ∪ s \ t) := by rw [union_sdiff_self, Set.union_comm] @@ -267,12 +274,12 @@ theorem measure_mono_ae (H : s ≤ᵐ[μ] t) : μ s ≤ μ t := alias _root_.Filter.EventuallyLE.measure_le := measure_mono_ae /-- If two sets are equal modulo a set of measure zero, then `μ s = μ t`. -/ -theorem measure_congr (H : s =ᵐ[μ] t) : μ s = μ t := +theorem measure_congr (H : s =ᵐˢ[μ] t) : μ s = μ t := le_antisymm H.le.measure_le H.symm.le.measure_le alias _root_.Filter.EventuallyEq.measure_eq := measure_congr -theorem measure_mono_null_ae (H : s ≤ᵐ[μ] t) (ht : μ t = 0) : μ s = 0 := +theorem measure_mono_null_ae (H : s ⊆ᵐ[μ] t) (ht : μ t = 0) : μ s = 0 := nonpos_iff_eq_zero.1 <| ht ▸ H.measure_le end MeasureTheory diff --git a/Mathlib/MeasureTheory/OuterMeasure/BorelCantelli.lean b/Mathlib/MeasureTheory/OuterMeasure/BorelCantelli.lean index 3496a39ce1d7d0..8a3d4fdd6013ec 100644 --- a/Mathlib/MeasureTheory/OuterMeasure/BorelCantelli.lean +++ b/Mathlib/MeasureTheory/OuterMeasure/BorelCantelli.lean @@ -16,7 +16,7 @@ then a.e. all points belong to finitely many sets of the family. We prove several versions of this lemma: -- `MeasureTheory.ae_finite_setOf_mem`: as stated above; +- `MeasureTheory.ae_finite_setOfPred_mem`: as stated above; - `MeasureTheory.measure_limsup_cofinite_eq_zero`: in terms of `Filter.limsup` along `Filter.cofinite`; - `MeasureTheory.measure_limsup_atTop_eq_zero`: @@ -67,25 +67,31 @@ theorem measure_limsup_atTop_eq_zero {s : ℕ → Set α} (hs : ∑' i, μ (s i) (sometimes called the "*first* Borel-Cantelli lemma"): if `(s i)` is a countable family of sets such that `∑' i, μ (s i)` is finite, then a.e. all points belong to finitely many sets of the family. -/ -theorem ae_finite_setOf_mem {s : ι → Set α} (h : ∑' i, μ (s i) ≠ ∞) : +theorem ae_finite_setOfPred_mem {s : ι → Set α} (h : ∑' i, μ (s i) ≠ ∞) : ∀ᵐ x ∂μ, {i | x ∈ s i}.Finite := by rw [ae_iff, ← measure_limsup_cofinite_eq_zero h] congr 1 with x simp [mem_limsup_iff_frequently_mem, Filter.Frequently] +@[deprecated (since := "2026-07-09")] +alias ae_finite_setOf_mem := ae_finite_setOfPred_mem + /-- A version of the **Borel-Cantelli lemma**: if `pᵢ` is a sequence of predicates such that `∑' i, μ {x | pᵢ x}` is finite, then the measure of `x` such that `pᵢ x` holds frequently as `i → ∞` (or equivalently, `pᵢ x` holds for infinitely many `i`) is equal to zero. -/ -theorem measure_setOf_frequently_eq_zero {p : ℕ → α → Prop} (hp : ∑' i, μ { x | p i x } ≠ ∞) : +theorem measure_setOfPred_frequently_eq_zero {p : ℕ → α → Prop} (hp : ∑' i, μ { x | p i x } ≠ ∞) : μ { x | ∃ᶠ n in atTop, p n x } = 0 := by - simpa only [limsup_eq_iInf_iSup_of_nat, frequently_atTop, ← bex_def, setOf_forall, - setOf_exists] using! measure_limsup_atTop_eq_zero hp + simpa only [limsup_eq_iInf_iSup_of_nat, frequently_atTop, ← bex_def, ofPred_forall, + ofPred_exists] using! measure_limsup_atTop_eq_zero hp + +@[deprecated (since := "2026-07-09")] +alias measure_setOf_frequently_eq_zero := measure_setOfPred_frequently_eq_zero /-- A version of the **Borel-Cantelli lemma**: if `sᵢ` is a sequence of sets such that `∑' i, μ sᵢ` is finite, then for almost all `x`, `x` does not belong to `sᵢ` for large `i`. -/ theorem ae_eventually_notMem {s : ℕ → Set α} (hs : (∑' i, μ (s i)) ≠ ∞) : ∀ᵐ x ∂μ, ∀ᶠ n in atTop, x ∉ s n := - measure_setOf_frequently_eq_zero hs + measure_setOfPred_frequently_eq_zero hs theorem measure_liminf_cofinite_eq_zero [Infinite ι] {s : ι → Set α} (h : ∑' i, μ (s i) ≠ ∞) : μ (liminf s cofinite) = 0 := by @@ -99,14 +105,14 @@ theorem measure_liminf_atTop_eq_zero {s : ℕ → Set α} (h : (∑' i, μ (s i) -- TODO: the next 2 lemmas are true for any filter with countable intersections, not only `ae`. -- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/pull/19041 theorem limsup_ae_eq_of_forall_ae_eq (s : ℕ → Set α) {t : Set α} - (h : ∀ n, s n =ᵐ[μ] t) : limsup (α := Set α) s atTop =ᵐ[μ] t := by + (h : ∀ n, s n =ᵐˢ[μ] t) : limsup (α := Set α) s atTop =ᵐˢ[μ] t := by simp only [eventuallyEq_set, ← eventually_countable_forall] at h refine eventuallyEq_set.2 <| h.mono fun x hx ↦ ?_ simp [mem_limsup_iff_frequently_mem, hx] -- Need to specify `α := Set α` above because of diamond; see https://github.com/leanprover-community/mathlib4/pull/19041 theorem liminf_ae_eq_of_forall_ae_eq (s : ℕ → Set α) {t : Set α} - (h : ∀ n, s n =ᵐ[μ] t) : liminf (α := Set α) s atTop =ᵐ[μ] t := by + (h : ∀ n, s n =ᵐˢ[μ] t) : liminf (α := Set α) s atTop =ᵐˢ[μ] t := by simp only [eventuallyEq_set, ← eventually_countable_forall] at h refine eventuallyEq_set.2 <| h.mono fun x hx ↦ ?_ simp only [mem_liminf_iff_eventually_mem, hx, eventually_const] diff --git a/Mathlib/MeasureTheory/PiSystem.lean b/Mathlib/MeasureTheory/PiSystem.lean index 06bfac122aa2f9..277a20c3707f9a 100644 --- a/Mathlib/MeasureTheory/PiSystem.lean +++ b/Mathlib/MeasureTheory/PiSystem.lean @@ -231,18 +231,22 @@ theorem isPiSystem_Icc (f : ι → α) (g : ι' → α) : end Order +/-- Given a collection `S` of subsets of `α`, then `GeneratePiSystem S` is the predicate of +being in the smallest π-system containing `S`. See `generatePiSystem` for the set version. -/ +inductive GeneratePiSystem (S : Set (Set α)) : Set α → Prop + | base {s : Set α} (h_s : s ∈ S) : GeneratePiSystem S s + | inter {s t : Set α} (h_s : GeneratePiSystem S s) (h_t : GeneratePiSystem S t) + (h_nonempty : (s ∩ t).Nonempty) : GeneratePiSystem S (s ∩ t) + /-- Given a collection `S` of subsets of `α`, then `generatePiSystem S` is the smallest π-system containing `S`. -/ -inductive generatePiSystem (S : Set (Set α)) : Set (Set α) - | base {s : Set α} (h_s : s ∈ S) : generatePiSystem S s - | inter {s t : Set α} (h_s : generatePiSystem S s) (h_t : generatePiSystem S t) - (h_nonempty : (s ∩ t).Nonempty) : generatePiSystem S (s ∩ t) +def generatePiSystem (S : Set (Set α)) : Set (Set α) := {s | GeneratePiSystem S s} theorem isPiSystem_generatePiSystem (S : Set (Set α)) : IsPiSystem (generatePiSystem S) := - fun _ h_s _ h_t h_nonempty => generatePiSystem.inter h_s h_t h_nonempty + fun _ h_s _ h_t h_nonempty => GeneratePiSystem.inter h_s h_t h_nonempty theorem subset_generatePiSystem_self (S : Set (Set α)) : S ⊆ generatePiSystem S := fun _ => - generatePiSystem.base + GeneratePiSystem.base theorem generatePiSystem_subset_self {S : Set (Set α)} (h_S : IsPiSystem S) : generatePiSystem S ⊆ S := fun x h => by @@ -256,7 +260,7 @@ theorem generatePiSystem_eq {S : Set (Set α)} (h_pi : IsPiSystem S) : generateP theorem generatePiSystem_mono {S T : Set (Set α)} (hST : S ⊆ T) : generatePiSystem S ⊆ generatePiSystem T := fun t ht => by induction ht with - | base h_s => exact generatePiSystem.base (Set.mem_of_subset_of_mem hST h_s) + | base h_s => exact GeneratePiSystem.base (Set.mem_of_subset_of_mem hST h_s) | inter _ _ h_nonempty h_s h_u => exact isPiSystem_generatePiSystem T _ h_s _ h_u h_nonempty theorem generatePiSystem_measurableSet [M : MeasurableSpace α] {S : Set (Set α)} @@ -275,7 +279,7 @@ theorem generateFrom_generatePiSystem_eq {g : Set (Set α)} : generateFrom (generatePiSystem g) = generateFrom g := by apply le_antisymm <;> apply generateFrom_le · exact fun t h_t => generateFrom_measurableSet_of_generatePiSystem t h_t - · exact fun t h_t => measurableSet_generateFrom (generatePiSystem.base h_t) + · exact fun t h_t => measurableSet_generateFrom (GeneratePiSystem.base h_t) /-- Every element of the π-system generated by the union of a family of π-systems is a finite intersection of elements from the π-systems. @@ -315,12 +319,11 @@ theorem mem_generatePiSystem_iUnion_elim' {α β} {g : β → Set (Set α)} {s : (h_pi : ∀ b ∈ s, IsPiSystem (g b)) (t : Set α) (h_t : t ∈ generatePiSystem (⋃ b ∈ s, g b)) : ∃ (T : Finset β) (f : β → Set α), ↑T ⊆ s ∧ (t = ⋂ b ∈ T, f b) ∧ ∀ b ∈ T, f b ∈ g b := by classical - have : t ∈ generatePiSystem (⋃ b : Subtype s, (g ∘ Subtype.val) b) := by - suffices h1 : ⋃ b : Subtype s, (g ∘ Subtype.val) b = ⋃ b ∈ s, g b by rwa [h1] + have : t ∈ generatePiSystem (⋃ b : ↥s, (g ∘ Subtype.val) b) := by + suffices h1 : ⋃ b : ↥s, (g ∘ Subtype.val) b = ⋃ b ∈ s, g b by rwa [h1] ext x simp only [exists_prop, Set.mem_iUnion, Function.comp_apply, Subtype.exists] - rfl - rcases @mem_generatePiSystem_iUnion_elim α (Subtype s) (g ∘ Subtype.val) + rcases @mem_generatePiSystem_iUnion_elim α (↥s) (g ∘ Subtype.val) (fun b => h_pi b.val b.property) t this with ⟨T, ⟨f, ⟨rfl, h_t'⟩⟩⟩ refine @@ -392,7 +395,7 @@ theorem piiUnionInter_singleton_left (s : ι → Set α) (S : Set ι) : piiUnionInter (fun i => ({s i} : Set (Set α))) S = { s' : Set α | ∃ (t : Finset ι) (_ : ↑t ⊆ S), s' = ⋂ i ∈ t, s i } := by ext1 s' - simp_rw [piiUnionInter, Set.mem_singleton_iff, exists_prop, Set.mem_setOf_eq] + simp_rw [piiUnionInter, Set.mem_singleton_iff, exists_prop, Set.mem_ofPred_eq] refine ⟨fun h => ?_, fun ⟨t, htS, h_eq⟩ => ⟨t, htS, s, fun _ _ => rfl, h_eq⟩⟩ grind @@ -414,7 +417,7 @@ theorem isPiSystem_piiUnionInter (π : ι → Set (Set α)) (hpi : ∀ x, IsPiSy IsPiSystem (piiUnionInter π S) := by classical rintro t1 ⟨p1, hp1S, f1, hf1m, ht1_eq⟩ t2 ⟨p2, hp2S, f2, hf2m, ht2_eq⟩ h_nonempty - simp_rw [piiUnionInter, Set.mem_setOf_eq] + simp_rw [piiUnionInter, Set.mem_ofPred_eq] let g n := ite (n ∈ p1) (f1 n) Set.univ ∩ ite (n ∈ p2) (f2 n) Set.univ have hp_union_ss : ↑(p1 ∪ p2) ⊆ S := by simp only [hp1S, hp2S, Finset.coe_union, union_subset_iff, and_self_iff] @@ -620,7 +623,7 @@ def toMeasurableSpace (h_inter : ∀ s₁ s₂, d.Has s₁ → d.Has s₂ → d. rw [← iUnion_disjointed] exact d.has_iUnion (disjoint_disjointed _) fun n => - disjointedRec (fun (t : Set α) i h => h_inter _ _ h <| d.has_compl <| hf i) (hf n) + disjointedRec (p := d.Has) (fun t i h => h_inter _ _ h <| d.has_compl <| hf i) (hf n) theorem ofMeasurableSpace_toMeasurableSpace (h_inter : ∀ s₁ s₂, d.Has s₁ → d.Has s₂ → d.Has (s₁ ∩ s₂)) : diff --git a/Mathlib/MeasureTheory/SetAlgebra.lean b/Mathlib/MeasureTheory/SetAlgebra.lean index a59499c5d23b33..b025c1f6938ce0 100644 --- a/Mathlib/MeasureTheory/SetAlgebra.lean +++ b/Mathlib/MeasureTheory/SetAlgebra.lean @@ -103,24 +103,29 @@ section generateSetAlgebra /-! ### Definition and properties of the algebra of sets generated by some family -/ +/-- `GenerateSetAlgebra 𝒜` is the predicate of being in the smallest algebra of sets +containing `𝒜`. See `generateSetAlgebra` for the set version. -/ +inductive GenerateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set α → Prop + | base (s : Set α) (s_mem : s ∈ 𝒜) : GenerateSetAlgebra 𝒜 s + | empty : GenerateSetAlgebra 𝒜 ∅ + | compl (s : Set α) (hs : GenerateSetAlgebra 𝒜 s) : GenerateSetAlgebra 𝒜 sᶜ + | union (s t : Set α) (hs : GenerateSetAlgebra 𝒜 s) (ht : GenerateSetAlgebra 𝒜 t) : + GenerateSetAlgebra 𝒜 (s ∪ t) + /-- `generateSetAlgebra 𝒜` is the smallest algebra of sets containing `𝒜`. -/ -inductive generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α) - | base (s : Set α) (s_mem : s ∈ 𝒜) : generateSetAlgebra 𝒜 s - | empty : generateSetAlgebra 𝒜 ∅ - | compl (s : Set α) (hs : generateSetAlgebra 𝒜 s) : generateSetAlgebra 𝒜 sᶜ - | union (s t : Set α) (hs : generateSetAlgebra 𝒜 s) (ht : generateSetAlgebra 𝒜 t) : - generateSetAlgebra 𝒜 (s ∪ t) +@[expose] def generateSetAlgebra {α : Type*} (𝒜 : Set (Set α)) : Set (Set α) := + {s | GenerateSetAlgebra 𝒜 s} /-- The algebra of sets generated by a family of sets is an algebra of sets. -/ theorem isSetAlgebra_generateSetAlgebra : IsSetAlgebra (generateSetAlgebra 𝒜) where - empty_mem := generateSetAlgebra.empty - compl_mem := fun _ hs ↦ generateSetAlgebra.compl _ hs - union_mem := fun _ _ hs ht ↦ generateSetAlgebra.union _ _ hs ht + empty_mem := GenerateSetAlgebra.empty + compl_mem := fun _ hs ↦ GenerateSetAlgebra.compl _ hs + union_mem := fun _ _ hs ht ↦ GenerateSetAlgebra.union _ _ hs ht /-- The algebra of sets generated by `𝒜` contains `𝒜`. -/ theorem self_subset_generateSetAlgebra : 𝒜 ⊆ generateSetAlgebra 𝒜 := - fun _ ↦ generateSetAlgebra.base _ + fun _ ↦ GenerateSetAlgebra.base _ /-- The measurable space generated by a family of sets `𝒜` is the same as the one generated by the algebra of sets generated by `𝒜`. -/ @@ -200,7 +205,7 @@ theorem mem_generateSetAlgebra_elim (s_mem : s ∈ generateSetAlgebra 𝒜) : exact hA a.1 a.2 (f a).1 (f a).2 · ext x simp only [u_eq, compl_iUnion, compl_iInter, mem_iInter, mem_iUnion, mem_compl_iff, - exists_prop, Subtype.exists, mem_setOf_eq, iUnion_exists, iUnion_iUnion_eq', + exists_prop, Subtype.exists, mem_ofPred_eq, iUnion_exists, iUnion_iUnion_eq', iInter_exists] constructor <;> intro hx · choose f hf using hx @@ -230,9 +235,9 @@ theorem countable_generateSetAlgebra (h : 𝒜.Countable) : exact this ▸ h.image compl let f : Set (Set (Set α)) → Set α := fun A ↦ ⋃ a ∈ A, ⋂ t ∈ a, t let 𝒞 := {a | a.Finite ∧ a ⊆ ℬ} - have count_𝒞 : 𝒞.Countable := countable_setOf_finite_subset (countable_coe_iff.1 count_ℬ) + have count_𝒞 : 𝒞.Countable := countable_ofPred_finite_subset (countable_coe_iff.1 count_ℬ) let 𝒟 := {A | A.Finite ∧ A ⊆ 𝒞} - have count_𝒟 : 𝒟.Countable := countable_setOf_finite_subset (countable_coe_iff.1 count_𝒞) + have count_𝒟 : 𝒟.Countable := countable_ofPred_finite_subset (countable_coe_iff.1 count_𝒞) have : generateSetAlgebra 𝒜 ⊆ f '' 𝒟 := by intro s s_mem rcases mem_generateSetAlgebra_elim s_mem with ⟨A, A_fin, mem_A, hA, rfl⟩ diff --git a/Mathlib/MeasureTheory/SetSemiring.lean b/Mathlib/MeasureTheory/SetSemiring.lean index 74d5c72231956c..1fcf21bfbe1438 100644 --- a/Mathlib/MeasureTheory/SetSemiring.lean +++ b/Mathlib/MeasureTheory/SetSemiring.lean @@ -516,7 +516,7 @@ lemma sUnion_disjointOfUnion (hC : IsSetSemiring C) (hJ : ↑J ⊆ C) : end disjointOfUnion -private lemma _root_.Set.Ioc_mem_setOf_Ioc_le [LinearOrder α] (u v : α) : +private lemma _root_.Set.Ioc_mem_ofPred_Ioc_le [LinearOrder α] (u v : α) : Set.Ioc u v ∈ {s : Set α | ∃ u v, u ≤ v ∧ s = Set.Ioc u v} := ⟨u, max u v, by grind, by grind⟩ @@ -529,16 +529,16 @@ protected lemma Ioc [LinearOrder α] [Nonempty α] : inter_mem := by rintro s ⟨u, v, huv, rfl⟩ t ⟨u', v', hu'v', rfl⟩ rw [Set.Ioc_inter_Ioc] - apply Ioc_mem_setOf_Ioc_le + apply Ioc_mem_ofPred_Ioc_le sdiff_eq_sUnion' := by classical rintro s ⟨u, v, huv, rfl⟩ t ⟨u', v', hu'v', rfl⟩ rcases le_or_gt u' u with hu | hu - · rcases Ioc_mem_setOf_Ioc_le (max u v') v with ⟨u'', v'', h'', heq⟩ + · rcases Ioc_mem_ofPred_Ioc_le (max u v') v with ⟨u'', v'', h'', heq⟩ exists {Set.Ioc u'' v''} grind [coe_singleton, pairwiseDisjoint_singleton] rcases le_or_gt v v' with hv | hv - · rcases Ioc_mem_setOf_Ioc_le u (min u' v) with ⟨u'', v'', h'', heq⟩ + · rcases Ioc_mem_ofPred_Ioc_le u (min u' v) with ⟨u'', v'', h'', heq⟩ exists {Set.Ioc u'' v''} grind [coe_singleton, pairwiseDisjoint_singleton] rw [show Set.Ioc u v \ Set.Ioc u' v' = Set.Ioc u u' ∪ Set.Ioc v' v by grind] diff --git a/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean b/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean index 8394925e8a56f3..abf9c670d3c759 100644 --- a/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean +++ b/Mathlib/MeasureTheory/VectorMeasure/AddContent.lean @@ -142,10 +142,10 @@ lemma exists_extension_of_isSetRing_of_le_measure_of_dense [IsFiniteMeasure μ] have : Dense {s | ‖m₁ s‖ₑ ≤ μ s} := by apply C'_dense.mono intro s hs - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] convert! hm s (C'C s hs) exact C'_dense.extend_eq lip.continuous ⟨s, hs⟩ - simpa only [Dense, IsClosed.closure_eq, Set.mem_setOf_eq] using! this + simpa only [Dense, IsClosed.closure_eq, Set.mem_ofPred_eq] using! this /- Most involved technical step: show that the extension `m₁` of `m₀` is still finitely additive. -/ have hAddit (s t : MeasuredSets μ) (h : Disjoint (s : Set α) t) : diff --git a/Mathlib/MeasureTheory/VectorMeasure/SetIntegral.lean b/Mathlib/MeasureTheory/VectorMeasure/SetIntegral.lean index 47c85aa59371b4..b9fccbc3ef0555 100644 --- a/Mathlib/MeasureTheory/VectorMeasure/SetIntegral.lean +++ b/Mathlib/MeasureTheory/VectorMeasure/SetIntegral.lean @@ -189,7 +189,7 @@ theorem setIntegral_indicator (hs : MeasurableSet s) (ht : MeasurableSet t) : rw [integral_indicator ht, μ.restrict_restrict ht hs, Set.inter_comm] theorem setIntegral_congr_set - (hs : MeasurableSet s) (ht : MeasurableSet t) (hst : s =ᵐ[μ.variation] t) : + (hs : MeasurableSet s) (ht : MeasurableSet t) (hst : s =ᵐˢ[μ.variation] t) : ∫ᵛ x in s, f x ∂[B; μ] = ∫ᵛ x in t, f x ∂[B; μ] := by rw [← integral_indicator hs, ← integral_indicator ht] apply integral_congr_ae diff --git a/Mathlib/ModelTheory/Algebra/Field/CharP.lean b/Mathlib/ModelTheory/Algebra/Field/CharP.lean index 69d6040d887561..d167eb28f8c91e 100644 --- a/Mathlib/ModelTheory/Algebra/Field/CharP.lean +++ b/Mathlib/ModelTheory/Algebra/Field/CharP.lean @@ -41,7 +41,7 @@ noncomputable def eqZero (n : ℕ) : Language.ring.Sentence := simp [eqZero] /-- The first-order theory of fields of characteristic `p` as a theory over the language of rings -/ -def _root_.FirstOrder.Language.Theory.fieldOfChar (p : ℕ) : Language.ring.Theory := +noncomputable def _root_.FirstOrder.Language.Theory.fieldOfChar (p : ℕ) : Language.ring.Theory := Theory.field ∪ if p = 0 then (fun q => ∼(eqZero q)) '' {q : ℕ | q.Prime} @@ -56,7 +56,7 @@ instance model_hasChar_of_charP [Field K] [CompatibleRing K] [CharP K p] : simp [hp.ne_zero, hp, Sentence.Realize] | inr hp => subst hp - simp only [ite_true, Theory.model_iff, Set.mem_image, Set.mem_setOf_eq, + simp only [ite_true, Theory.model_iff, Set.mem_image, Set.mem_ofPred_eq, Sentence.Realize, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, Formula.realize_not, realize_eqZero, ← CharZero.charZero_iff_forall_prime_ne_zero] exact CharP.charP_to_charZero K @@ -67,7 +67,7 @@ theorem charP_iff_model_fieldOfChar [Field K] [CompatibleRing K] : (show (Theory.field.Model K) by infer_instance), true_and] split_ifs with hp0 hp · subst hp0 - simp only [Theory.model_iff, Set.mem_image, Set.mem_setOf_eq, Sentence.Realize, + simp only [Theory.model_iff, Set.mem_image, Set.mem_ofPred_eq, Sentence.Realize, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, Formula.realize_not, realize_eqZero, ← CharZero.charZero_iff_forall_prime_ne_zero] exact ⟨fun _ => CharP.ofCharZero _, fun _ => CharP.charP_to_charZero K⟩ diff --git a/Mathlib/ModelTheory/Algebra/Field/IsAlgClosed.lean b/Mathlib/ModelTheory/Algebra/Field/IsAlgClosed.lean index 7e2c2bc1ec3093..5579652eaf3781 100644 --- a/Mathlib/ModelTheory/Algebra/Field/IsAlgClosed.lean +++ b/Mathlib/ModelTheory/Algebra/Field/IsAlgClosed.lean @@ -79,7 +79,7 @@ theorem realize_genericMonicPolyHasRoot [Field K] [CompatibleRing K] (n : ℕ) : /-- The theory of algebraically closed fields of characteristic `p` as a theory over the language of rings -/ -def _root_.FirstOrder.Language.Theory.ACF (p : ℕ) : Theory .ring := +noncomputable def _root_.FirstOrder.Language.Theory.ACF (p : ℕ) : Theory .ring := Theory.fieldOfChar p ∪ genericMonicPolyHasRoot '' {n | 0 < n} instance [Language.ring.Structure K] (p : ℕ) [h : (Theory.ACF p).Model K] : @@ -210,7 +210,8 @@ theorem finite_ACF_prime_not_realize_of_ACF_zero_realize simp only [s, Finset.mem_biUnion, Finset.mem_attach, true_and, Subtype.exists, not_exists] at hpψ exact (f ψ (hT0 hψ)).2 p (hpψ _ hψ) - refine Set.Finite.subset (Finset.finite_toSet s) (Set.compl_subset_comm.2 ?_) + refine Set.Finite.subset (Finset.finite_toSet s) + ((Set.compl_subset_comm (s := {p : Nat.Primes | Theory.ACF ↑p ⊨ᵇ φ})).2 ?_) intro p hp exact Theory.models_of_models_theory (fun ψ hψ => hs p ψ hψ hp) h diff --git a/Mathlib/ModelTheory/Arithmetic/Presburger/Definability.lean b/Mathlib/ModelTheory/Arithmetic/Presburger/Definability.lean index dbdb246371611b..95d4f4127263ab 100644 --- a/Mathlib/ModelTheory/Arithmetic/Presburger/Definability.lean +++ b/Mathlib/ModelTheory/Arithmetic/Presburger/Definability.lean @@ -52,7 +52,7 @@ theorem IsLinearSet.definable [Finite α] (hs : IsLinearSet s) : A.Definable pre x.1 i • Term.var (Sum.inr (Sum.inr x))))), ?_⟩ ext x simp only [mem_vadd_set, SetLike.mem_coe, AddSubmonoid.mem_closure_finset', Finset.univ_eq_attach, - nsmul_eq_mul, vadd_eq_add, ↓existsAndEq, true_and, mem_setOf_eq, Formula.realize_iExs, + nsmul_eq_mul, vadd_eq_add, ↓existsAndEq, true_and, mem_ofPred_eq, Formula.realize_iExs, Formula.realize_iInf, Formula.realize_equal, Term.realize_var, Sum.elim_inl, Term.realize_varsToConstants, coe_con, presburger.realize_add, presburger.realize_natCast, Nat.cast_id, presburger.realize_sum, presburger.realize_nsmul, Sum.elim_inr, smul_eq_mul] @@ -69,7 +69,7 @@ theorem IsSemilinearSet.definable [Finite α] (hs : IsSemilinearSet s) : refine ⟨Formula.iSup φ, ?_⟩ ext x have := fun s hs x => Set.ext_iff.1 (hφ ⟨s, hs⟩).symm x - simp only [mem_setOf_eq] at this + simp only [mem_ofPred_eq] at this simp [this] namespace FirstOrder.Language.presburger @@ -116,31 +116,31 @@ lemma isSemilinearSet_boundedFormula_realize {n} (φ : presburger[[A]].BoundedFo | equal t₁ t₂ => rcases term_realize_eq_add_dotProduct t₁ with ⟨k₁, u₁, ht₁⟩ rcases term_realize_eq_add_dotProduct t₂ with ⟨k₂, u₂, ht₂⟩ - convert! Nat.isSemilinearSet_setOf_mulVec_eq ![k₁] ![k₂] (.of ![u₁]) (.of ![u₂]) + convert! Nat.isSemilinearSet_setOfPred_mulVec_eq ![k₁] ![k₂] (.of ![u₁]) (.of ![u₂]) simp [ht₁, ht₂] | rel f => nomatch f | falsum => exact .empty | imp _ _ ih₁ ih₂ => convert! (ih₂.compl.inter ih₁).compl using 1 - simp [setOf_inter_eq_sep, imp_iff_not_or, compl_setOf] + simp [ofPred_inter_eq_sep, imp_iff_not_or, compl_ofPred] | @all n φ ih => let e := (Equiv.sumAssoc α (Fin n) (Fin 1)).trans (Equiv.sumCongr (.refl α) finSumFinEquiv) rw [← isSemilinearSet_image_iff (LinearEquiv.funCongrLeft ℕ ℕ e)] at ih convert! ih.compl.proj.compl using 1 - simp_rw [compl_setOf, not_exists, Fin.forall_fin_succ_pi, Fin.forall_fin_zero_pi, + simp_rw [compl_ofPred, not_exists, Fin.forall_fin_succ_pi, Fin.forall_fin_zero_pi, mem_compl_iff, mem_image, not_not, ← LinearEquiv.eq_symm_apply, LinearEquiv.funCongrLeft_symm, - exists_eq_right, mem_setOf, LinearEquiv.funCongrLeft_apply, LinearMap.funLeft, + exists_eq_right, mem_ofPred, LinearEquiv.funCongrLeft_apply, LinearMap.funLeft, LinearMap.coe_mk, AddHom.coe_mk] congr! 4 ext i cases i using Fin.lastCases <;> simp [e] lemma isSemilinearSet_formula_realize_semilinear (φ : presburger[[A]].Formula α) : - IsSemilinearSet (setOf φ.Realize : Set (α → ℕ)) := by + IsSemilinearSet (Set.ofPred φ.Realize : Set (α → ℕ)) := by let e := Equiv.sumEmpty α (Fin 0) convert! (isSemilinearSet_boundedFormula_realize φ).image (LinearMap.funLeft ℕ ℕ e.symm) ext x - simp only [mem_setOf_eq, mem_image] + simp only [mem_iff_mem, mem_ofPred_eq, mem_image] rw [(e.arrowCongr (.refl ℕ)).exists_congr_left] simp [Formula.Realize, Unique.eq_default, Function.comp_def, LinearMap.funLeft, e] @@ -154,8 +154,8 @@ theorem definable_iff_isSemilinearSet {s : Set (α → ℕ)} : theorem definable₁_iff_ultimately_periodic {s : Set ℕ} : A.Definable₁ presburger s ↔ ∃ k, ∃ p > 0, ∀ x ≥ k, x ∈ s ↔ x + p ∈ s := by rw [Definable₁, definable_iff_isSemilinearSet, - ← isSemilinearSet_image_iff (LinearEquiv.funUnique (Fin 1) ℕ ℕ), ← preimage_setOf_eq] - simp only [LinearEquiv.funUnique_apply, Function.eval, Fin.default_eq_zero, setOf_mem_eq] + ← isSemilinearSet_image_iff (LinearEquiv.funUnique (Fin 1) ℕ ℕ), ← preimage_ofPred_eq] + simp only [LinearEquiv.funUnique_apply, Function.eval, Fin.default_eq_zero, ofPred_mem_eq] rw [image_preimage_eq s fun x => ⟨![x], rfl⟩, Nat.isSemilinearSet_iff_ultimately_periodic] /-- The graph of multiplication is not Presburger definable in `ℕ`. -/ @@ -164,12 +164,12 @@ theorem mul_not_definable : ¬ A.Definable presburger {v : Fin 3 → ℕ | v 0 = have hsqr : A.Definable₁ presburger {x * x | x : ℕ} := by rw [Definable₁] convert! (hmul.preimage_comp (β := Fin 2) ![0, 1, 1]).image_comp ![0] - ext - simpa [funext_iff, Fin.exists_fin_succ_pi] using exists_congr fun _ => Eq.comm + simpa [mem_iff_mem, funext_iff, Fin.exists_fin_succ_pi] using + exists_congr fun _ => Eq.comm rw [definable₁_iff_ultimately_periodic] at hsqr rcases hsqr with ⟨k, p, hp, h⟩ specialize h ((max k p) * (max k p)) ((Nat.le_mul_self _).trans' (le_max_left _ _)) - simp only [mem_setOf_eq, exists_apply_eq_apply, true_iff] at h + simp only [mem_ofPred_eq, exists_apply_eq_apply, true_iff] at h rcases h with ⟨x, h₁⟩ by_cases h₂ : x ≤ max k p · apply Nat.mul_self_le_mul_self at h₂ diff --git a/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Basic.lean b/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Basic.lean index 26520550127936..080ef62f8a9dc7 100644 --- a/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Basic.lean +++ b/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Basic.lean @@ -29,7 +29,7 @@ any commutative monoid. ## Main Results -- `isSemilinearSet_setOf_eq`: the set of solutions to a linear equation `a + f x = b + g y` is +- `isSemilinearSet_setOfPred_eq`: the set of solutions to a linear equation `a + f x = b + g y` is semilinear. - `IsSemilinearSet.inter`, `IsSemilinearSet.diff`: semilinear sets are closed under intersection and set difference. @@ -67,7 +67,8 @@ private theorem sep_apply_eq {ι : Type*} {M : ι → Type*} [∀ i, Add (M i)] variable {M : Type*} [AddCommMonoid M] [PartialOrder M] [WellQuasiOrderedLE M] [IsOrderedCancelAddMonoid M] [CanonicallyOrderedAdd M] -private theorem exists_isSemilinearSet_setOf_le {s : Set M} (hs : IsSlice s) (hs' : s.Nonempty) : +private theorem exists_isSemilinearSet_setOfPred_le {s : Set M} (hs : IsSlice s) + (hs' : s.Nonempty) : ∃ x ∈ s, IsSemilinearSet { y ∈ s | x ≤ y } := by classical let f (x : M) : AddSubmonoid M := @@ -76,7 +77,7 @@ private theorem exists_isSemilinearSet_setOf_le {s : Set M} (hs : IsSlice s) (hs zero_mem' := by simpa add_mem' := by intro a b ha hb - simp only [mem_setOf_eq] at * + simp only [mem_ofPred_eq] at * rw [← add_assoc] exact hs _ hx _ _ ha hb } else ⊥ @@ -97,7 +98,7 @@ private theorem exists_isSemilinearSet_setOf_le {s : Set M} (hs : IsSlice s) (hs refine ⟨a, ha.1, ?_⟩ convert_to IsSemilinearSet (a +ᵥ (f a : Set M)) · ext x - simp only [le_iff_exists_add, mem_setOf_eq, ha.1, ↓reduceDIte, coe_set_mk, + simp only [le_iff_exists_add, mem_ofPred_eq, ha.1, ↓reduceDIte, coe_set_mk, AddSubsemigroup.coe_set_mk, mem_vadd_set, vadd_eq_add, f] grind · refine IsSemilinearSet.vadd a (.of_fg (AddSubmonoid.fg_of_subtractive ?_)) @@ -134,6 +135,7 @@ private theorem exists_isSemilinearSet_setOf_le {s : Set M} (hs : IsSlice s) (hs · simp [hu₂, hu'₂] · rwa [← add_assoc w'] + end IsSlice private theorem Nat.isSemilinearSet_of_isSlice {ι : Type*} [Finite ι] {s : Set (ι → ℕ)} @@ -146,11 +148,11 @@ private theorem Nat.isSemilinearSet_of_isSlice {ι : Type*} [Finite ι] {s : Set induction t using Finset.strongInductionOn generalizing s a with | _ t ih obtain rfl | hs' := s.eq_empty_or_nonempty · exact .empty - rcases hs.exists_isSemilinearSet_setOf_le hs' with ⟨x, hx, hx'⟩ + rcases hs.exists_isSemilinearSet_setOfPred_le hs' with ⟨x, hx, hx'⟩ convert_to IsSemilinearSet ({ y ∈ s | x ≤ y } ∪ ⋃ i ∈ t, ⋃ j ∈ Finset.range (x i), { y ∈ s | y i = j }) · ext y - simp only [Finset.mem_range, mem_union, mem_setOf_eq, mem_iUnion, Pi.le_def] + simp only [Finset.mem_range, mem_union, mem_ofPred_eq, mem_iUnion, Pi.le_def] grind · refine hx'.union (.biUnion_finset fun i hi => .biUnion_finset fun j hj => ?_) simp only [Finset.mem_range] at hj @@ -161,30 +163,38 @@ private theorem Nat.isSemilinearSet_of_isSlice {ι : Type*} [Finite ι] {s : Set variable {M N ι κ : Type*} [AddCommMonoid M] [AddCommMonoid N] {s s₁ s₂ : Set M} -private theorem Nat.isSemilinearSet_setOf_eq [Finite ι] {F G : Type*} +private theorem Nat.isSemilinearSet_setOfPred_eq [Finite ι] {F G : Type*} [FunLike F (ι → ℕ) M] [AddMonoidHomClass F (ι → ℕ) M] [FunLike G (ι → ℕ) M] [AddMonoidHomClass G (ι → ℕ) M] (a b : M) (f : F) (g : G) : IsSemilinearSet { x | a + f x = b + g x } := by apply isSemilinearSet_of_isSlice intro x hx y z hy hz - simp only [mem_setOf, map_add, ← add_assoc] at * + simp only [mem_ofPred, map_add, ← add_assoc] at * conv_lhs => rw [hy, ← hx, add_right_comm _ (g y) (f z), hz, add_right_comm _ (g z)] + /-- The set of solutions to a linear equation `a + f x = b + g y` in a finitely generated monoid is semilinear. -/ -public theorem isSemilinearSet_setOf_eq [AddMonoid.FG M] {F G : Type*} [FunLike F M N] +public theorem isSemilinearSet_setOfPred_eq [AddMonoid.FG M] {F G : Type*} [FunLike F M N] [AddMonoidHomClass F M N] [FunLike G M N] [AddMonoidHomClass G M N] (a b : N) (f : F) (g : G) : IsSemilinearSet { x | a + f x = b + g x } := by rcases fg_iff_exists_fin_addMonoidHom.1 (AddMonoid.FG.fg_top (M := M)) with ⟨n, h, hh⟩ rw [AddMonoidHom.mrange_eq_top] at hh - rw [← image_preimage_eq { x | a + f x = b + g x } hh, preimage_setOf_eq] + rw [← image_preimage_eq { x | a + f x = b + g x } hh, preimage_ofPred_eq] apply IsSemilinearSet.image - exact Nat.isSemilinearSet_setOf_eq a b (AddMonoidHom.comp f h) (AddMonoidHom.comp g h) + exact Nat.isSemilinearSet_setOfPred_eq a b (AddMonoidHom.comp f h) (AddMonoidHom.comp g h) -/-- Matrix version of `isSemilinearSet_setOf_eq`. -/ -public theorem Nat.isSemilinearSet_setOf_mulVec_eq [Fintype κ] (u v : ι → ℕ) (A B : Matrix ι κ ℕ) : +@[deprecated (since := "2026-07-09")] +alias isSemilinearSet_setOf_eq := isSemilinearSet_setOfPred_eq + +/-- Matrix version of `isSemilinearSet_setOfPred_eq`. -/ +public theorem Nat.isSemilinearSet_setOfPred_mulVec_eq [Fintype κ] (u v : ι → ℕ) + (A B : Matrix ι κ ℕ) : IsSemilinearSet { x | u + A *ᵥ x = v + B *ᵥ x } := - isSemilinearSet_setOf_eq u v A.mulVecLin B.mulVecLin + isSemilinearSet_setOfPred_eq u v A.mulVecLin B.mulVecLin + +@[deprecated (since := "2026-07-09")] +alias Nat.isSemilinearSet_setOf_mulVec_eq := Nat.isSemilinearSet_setOfPred_mulVec_eq public theorem isLinearSet_iff_exists_fin_addMonoidHom {s : Set M} : IsLinearSet s ↔ ∃ (a : M) (n : ℕ) (f : (Fin n → ℕ) →+ M), s = a +ᵥ Set.range f := by @@ -210,7 +220,7 @@ private lemma Nat.isSemilinearSet_preimage_of_isLinearSet [Finite ι] {F : Type* simp only [mem_vadd_set, mem_range, vadd_eq_add, exists_exists_eq_and] apply IsSemilinearSet.proj' convert! - isSemilinearSet_setOf_eq a 0 (g.comp (LinearMap.funLeft ℕ ℕ Sum.inr).toAddMonoidHom) + isSemilinearSet_setOfPred_eq a 0 (g.comp (LinearMap.funLeft ℕ ℕ Sum.inr).toAddMonoidHom) ((f : (ι → ℕ) →+ M).comp (LinearMap.funLeft ℕ ℕ Sum.inl).toAddMonoidHom) simp [LinearMap.funLeft] @@ -274,10 +284,10 @@ private lemma Nat.isSemilinearSet_inter_of_isLinearSet [Finite ι] {s₁ s₂ : rw [isLinearSet_iff_exists_matrix] at hs₁ hs₂ rcases hs₁ with ⟨u, n, A, rfl⟩ rcases hs₂ with ⟨v, m, B, rfl⟩ - simp_rw [← setOf_and, exists_and_exists_comm] + simp_rw [← ofPred_and, exists_and_exists_comm] refine IsSemilinearSet.proj' (IsSemilinearSet.proj' ?_) convert! - isSemilinearSet_setOf_mulVec_eq (κ := (ι ⊕ Fin n) ⊕ Fin m) (Sum.elim u v) 0 + isSemilinearSet_setOfPred_mulVec_eq (κ := (ι ⊕ Fin n) ⊕ Fin m) (Sum.elim u v) 0 (fromBlocks (fromCols 0 A) 0 0 B) (fromBlocks (fromCols 1 0) 0 (fromCols 1 0) 0) simp [fromBlocks_mulVec, fromCols_mulVec, ← Sum.elim_add_add, Sum.elim_eq_iff] @@ -598,7 +608,7 @@ private theorem isSemilinearSet_setOfFractNe : IsSemilinearSet hs.setOfFractNe : convert_to IsSemilinearSet (⋃ u ∈ hs.fundamentalDomain \ {hs.base}, { x | ∃ y ∈ closure hs.basisSet, ∃ y' ∈ closure hs.basisSet, x + y' = u + y }) using 1 · ext x - simp only [setOfFractNe, mem_iUnion, mem_setOf_eq, exists_prop] + simp only [setOfFractNe, mem_iUnion, mem_ofPred_eq, exists_prop] constructor · intro hx refine ⟨hs.fract x, ⟨hs.fract_mem_fundamentalDomain x, hx⟩, ∑ i, (hs.floor x i).toNat • i.1, @@ -612,17 +622,17 @@ private theorem isSemilinearSet_setOfFractNe : IsSemilinearSet hs.setOfFractNe : hs.fract_eq_self_of_mem_fundamentalDomain hu] at heq rwa [heq] · refine .biUnion hs.finite_fundamentalDomain.sdiff fun i hi => .proj' ?_ - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet) (LinearMap.funLeft ℕ ℕ Sum.inr) apply IsSemilinearSet.proj' - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet) (LinearMap.funLeft ℕ ℕ Sum.inr) classical haveI := Fintype.ofFinite ι convert! - Nat.isSemilinearSet_setOf_mulVec_eq (κ := (ι ⊕ ι) ⊕ ι) 0 i + Nat.isSemilinearSet_setOfPred_mulVec_eq (κ := (ι ⊕ ι) ⊕ ι) 0 i (Matrix.fromCols (Matrix.fromCols 1 0) 1) (Matrix.fromCols (Matrix.fromCols 0 1) 0) using 4 <;> simp [fromCols_mulVec] @@ -635,7 +645,7 @@ private theorem isSemilinearSet_setOfFloorNeg : IsSemilinearSet hs.setOfFloorNeg ∃ z ∈ closure (hs.basisSet \ {i.1}), ∃ z' ∈ closure (hs.basisSet \ {i.1}), x + i.1 + y + z' = hs.base + z }) using 1 · ext x - simp only [setOfFloorNeg, mem_iUnion, mem_setOf_eq] + simp only [setOfFloorNeg, mem_iUnion, mem_ofPred_eq] constructor · intro ⟨hx, i, hi⟩ refine ⟨i, ((- hs.floor x i).toNat - 1) • i.1, ?_, @@ -671,20 +681,20 @@ private theorem isSemilinearSet_setOfFloorNeg : IsSemilinearSet hs.setOfFloorNeg ← eq_neg_iff_add_eq_zero] at heq simpa [heq] using neg_one_lt_zero.trans_le (Nat.cast_nonneg _) · refine .iUnion fun i => .proj' ?_ - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite (finite_singleton _)) (LinearMap.funLeft ℕ ℕ Sum.inr) apply IsSemilinearSet.proj' - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet.sdiff) (LinearMap.funLeft ℕ ℕ Sum.inr) apply IsSemilinearSet.proj' - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet.sdiff) (LinearMap.funLeft ℕ ℕ Sum.inr) haveI := Fintype.ofFinite ι convert! - Nat.isSemilinearSet_setOf_mulVec_eq (κ := ((ι ⊕ ι) ⊕ ι) ⊕ ι) i.1 hs.base + Nat.isSemilinearSet_setOfPred_mulVec_eq (κ := ((ι ⊕ ι) ⊕ ι) ⊕ ι) i.1 hs.base (Matrix.fromCols (Matrix.fromCols (Matrix.fromCols 1 1) 0) 1) (Matrix.fromCols (Matrix.fromCols (Matrix.fromCols 0 0) 1) 0) using 4 <;> simp [add_comm _ i.1, add_assoc, fromCols_mulVec] @@ -698,7 +708,7 @@ private theorem isSemilinearSet_setOfFloorPos : IsSemilinearSet hs.setOfFloorPos { x | ∃ y ∈ closure {i.1}, ∃ z ∈ closure (hs.basisSet \ {i.1}), ∃ z' ∈ closure (hs.basisSet \ {i.1}), x + z' = hs.base + i.1 + y + z }) using 1 · ext x - simp only [setOfFloorPos, mem_iUnion, mem_setOf_eq, exists_prop] + simp only [setOfFloorPos, mem_iUnion, mem_ofPred_eq, exists_prop] constructor · intro ⟨hx, i, hi, hi'⟩ refine ⟨i, hi, ((hs.floor x i).toNat - 1) • i.1, ?_, @@ -732,20 +742,20 @@ private theorem isSemilinearSet_setOfFloorPos : IsSemilinearSet hs.setOfFloorPos add_assoc hs.base, ← succ_nsmul', hs.floor_add_nsmul_self, hs.floor_base, zero_add] at heq simp [heq] · refine .biUnion (toFinite _) fun i hi => .proj' ?_ - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite (finite_singleton _)) (LinearMap.funLeft ℕ ℕ Sum.inr) apply IsSemilinearSet.proj' - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet.sdiff) (LinearMap.funLeft ℕ ℕ Sum.inr) apply IsSemilinearSet.proj' - rw [setOf_and] + rw [ofPred_and] apply Nat.isSemilinearSet_inter <| Nat.isSemilinearSet_preimage (.closure_of_finite hs.finite_basisSet.sdiff) (LinearMap.funLeft ℕ ℕ Sum.inr) haveI := Fintype.ofFinite ι convert! - Nat.isSemilinearSet_setOf_mulVec_eq (κ := ((ι ⊕ ι) ⊕ ι) ⊕ ι) 0 (hs.base + i.1) + Nat.isSemilinearSet_setOfPred_mulVec_eq (κ := ((ι ⊕ ι) ⊕ ι) ⊕ ι) 0 (hs.base + i.1) (Matrix.fromCols (Matrix.fromCols (Matrix.fromCols 1 0) 0) 1) (Matrix.fromCols (Matrix.fromCols (Matrix.fromCols 0 1) 1) 0) using 4 <;> simp [add_assoc, fromCols_mulVec] @@ -759,7 +769,7 @@ private lemma Nat.isSemilinearSet_compl_of_isProperLinearSet [Finite ι] {s : Se hs.isSemilinearSet_setOfFloorNeg.union <| hs.isSemilinearSet_setOfFloorPos using 1 ext simp only [mem_compl_iff, hs.mem_iff_fract_eq_and_floor_nonneg, IsProperLinearSet.setOfFractNe, - IsProperLinearSet.setOfFloorNeg, IsProperLinearSet.setOfFloorPos, mem_union, mem_setOf_eq] + IsProperLinearSet.setOfFloorNeg, IsProperLinearSet.setOfFloorPos, mem_union, mem_ofPred_eq] grind private theorem Nat.isSemilinearSet_compl [Finite ι] {s : Set (ι → ℕ)} (hs : IsSemilinearSet s) : diff --git a/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Defs.lean b/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Defs.lean index 3cceccbb2e484a..2fd46e53304307 100644 --- a/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Defs.lean +++ b/Mathlib/ModelTheory/Arithmetic/Presburger/Semilinear/Defs.lean @@ -211,7 +211,9 @@ theorem isSemilinearSet_image_iff {F : Type*} [EquivLike F M N] [AddEquivClass F the index). It is a special case of `IsSemilinearSet.image`. -/ theorem IsSemilinearSet.proj {s : Set (ι ⊕ κ → M)} (hs : IsSemilinearSet s) : IsSemilinearSet { x | ∃ y, Sum.elim x y ∈ s } := by - convert! hs.image (LinearMap.funLeft ℕ M Sum.inl) + suffices h : { x | ∃ y, Sum.elim x y ∈ s } = ⇑(LinearMap.funLeft ℕ M Sum.inl) '' s by + rw [h] + exact hs.image _ ext x constructor · intro ⟨y, hy⟩ @@ -433,12 +435,12 @@ theorem Nat.isSemilinearSet_iff_ultimately_periodic {s : Set ℕ} : clear hpt induction m with grind [Finset.sup_le_iff] · intro ⟨k, p, hp, hs⟩ - have h₁ : {x ∈ s | x < k}.Finite := (Set.finite_lt_nat k).subset (sep_subset_setOf _ _) + have h₁ : {x ∈ s | x < k}.Finite := (Set.finite_lt_nat k).subset (sep_subset_ofPred _ _) have h₂ : {x ∈ s | k ≤ x ∧ x < k + p}.Finite := - (Set.finite_Ico k (k + p)).subset (sep_subset_setOf _ _) + (Set.finite_Ico k (k + p)).subset (sep_subset_ofPred _ _) convert! (IsSemilinearSet.of_finite h₁).union (.add (.of_finite h₂) (.closure_finset { p })) ext x - simp only [sep_and, Finset.coe_singleton, mem_union, mem_setOf_eq, mem_add, mem_inter_iff, + simp only [sep_and, Finset.coe_singleton, mem_union, mem_ofPred_eq, mem_add, mem_inter_iff, SetLike.mem_coe, AddSubmonoid.mem_closure_singleton, smul_eq_mul, exists_exists_eq_and] constructor · intro hx diff --git a/Mathlib/ModelTheory/Definability.lean b/Mathlib/ModelTheory/Definability.lean index b219893edfb6f8..a5ae0284483c27 100644 --- a/Mathlib/ModelTheory/Definability.lean +++ b/Mathlib/ModelTheory/Definability.lean @@ -54,7 +54,7 @@ variable {α : Type u₁} {β : Type*} /-- A subset of a finite Cartesian product of a structure is definable over a set `A` when membership in the set is given by a first-order formula with parameters from `A`. -/ def Definable (s : Set (α → M)) : Prop := - ∃ φ : L[[A]].Formula α, s = setOf φ.Realize + ∃ φ : L[[A]].Formula α, s = Set.ofPred φ.Realize variable {L} {A} {B : Set M} {s : Set (α → M)} @@ -63,7 +63,7 @@ theorem Definable.map_expansion {L' : FirstOrder.Language} [L'.Structure M] (h : obtain ⟨ψ, rfl⟩ := h refine ⟨(φ.addConstants A).onFormula ψ, ?_⟩ ext x - simp only [mem_setOf_eq, LHom.realize_onFormula] + simp only [mem_ofPred_eq, LHom.realize_onFormula] theorem definable_iff_exists_formula_sum : A.Definable L s ↔ ∃ φ : L.Formula (A ⊕ α), s = {v | φ.Realize (Sum.elim (↑) v)} := by @@ -71,7 +71,7 @@ theorem definable_iff_exists_formula_sum : refine exists_congr (fun φ => iff_iff_eq.2 (congr_arg (s = ·) ?_)) ext simp only [BoundedFormula.constantsVarsEquiv, constantsOn, - BoundedFormula.mapTermRelEquiv_symm_apply, mem_setOf_eq, Formula.Realize] + BoundedFormula.mapTermRelEquiv_symm_apply, mem_ofPred_eq, Formula.Realize] refine BoundedFormula.realize_mapTermRel_id ?_ (fun _ _ _ => rfl) intros simp only [Term.constantsVarsEquivLeft_symm_apply, Term.realize_varsToConstants, @@ -81,7 +81,7 @@ theorem definable_iff_exists_formula_sum : set_option backward.isDefEq.respectTransparency false in theorem empty_definable_iff : - (∅ : Set M).Definable L s ↔ ∃ φ : L.Formula α, s = setOf φ.Realize := by + (∅ : Set M).Definable L s ↔ ∃ φ : L.Formula α, s = Set.ofPred φ.Realize := by rw [Definable, Equiv.exists_congr_left (LEquiv.addEmptyConstants L (∅ : Set M)).onFormula] simp @@ -117,11 +117,11 @@ theorem Definable.inter {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.De @[simp] theorem Definable.union {f g : Set (α → M)} (hf : A.Definable L f) (hg : A.Definable L g) : A.Definable L (f ∪ g) := by - rcases hf with ⟨φ, hφ⟩ - rcases hg with ⟨θ, hθ⟩ + rcases hf with ⟨φ, rfl⟩ + rcases hg with ⟨θ, rfl⟩ refine ⟨φ ⊔ θ, ?_⟩ ext - rw [hφ, hθ, mem_setOf_eq, Formula.realize_sup, mem_union, mem_setOf_eq, mem_setOf_eq] + simp theorem definable_finset_inf {ι : Type*} {f : ι → Set (α → M)} (hf : ∀ i, A.Definable L (f i)) (s : Finset ι) : A.Definable L (s.inf f) := by @@ -164,7 +164,7 @@ theorem Definable.compl {s : Set (α → M)} (hf : A.Definable L s) : A.Definabl rcases hf with ⟨φ, hφ⟩ refine ⟨φ.not, ?_⟩ ext v - rw [hφ, compl_setOf, mem_setOf, mem_setOf, Formula.realize_not] + rw [hφ, compl_ofPred, mem_ofPred, mem_ofPred, Formula.realize_not] @[simp] theorem Definable.sdiff {s t : Set (α → M)} (hs : A.Definable L s) (ht : A.Definable L t) : @@ -179,7 +179,7 @@ theorem Definable.preimage_comp (f : α → β) {s : Set (α → M)} (h : A.Defi obtain ⟨φ, rfl⟩ := h refine ⟨φ.relabel f, ?_⟩ ext - simp only [Set.preimage_setOf_eq, mem_setOf_eq, Formula.realize_relabel] + simp only [Set.preimage_ofPred_eq, mem_ofPred_eq, Formula.realize_relabel] theorem Definable.image_comp_equiv {s : Set (β → M)} (h : A.Definable L s) (f : α ≃ β) : A.Definable L ((fun g : β → M => g ∘ f) '' s) := by @@ -203,7 +203,7 @@ theorem definable_iff_finitely_definable : refine ⟨A0, by simp [A0], (φ.restrictFreeVar <| fun x => Sum.casesOn x.1 (fun x hx => Sum.inl ⟨x, by simp [A0, hx]⟩) (fun x _ => Sum.inr x) x.2), ?_⟩ ext - simp only [Formula.Realize, mem_setOf_eq, Finset.coe_sort_coe] + simp only [Formula.Realize, mem_ofPred_eq, Finset.coe_sort_coe] exact iff_comm.1 <| BoundedFormula.realize_restrictFreeVar _ (by simp) · rintro ⟨A0, hA0, hd⟩ exact Definable.mono hd hA0 @@ -214,7 +214,7 @@ theorem Definable.image_comp_sumInl_fin (m : ℕ) {s : Set (Sum α (Fin m) → M obtain ⟨φ, rfl⟩ := h refine ⟨(BoundedFormula.relabel id φ).exs, ?_⟩ ext x - simp only [Set.mem_image, mem_setOf_eq, BoundedFormula.realize_exs, + simp only [Set.mem_image, mem_ofPred_eq, BoundedFormula.realize_exs, BoundedFormula.realize_relabel, Function.comp_id, Fin.castAdd_zero, Fin.cast_refl] constructor · rintro ⟨y, hy, rfl⟩ @@ -260,7 +260,7 @@ theorem Definable.image_comp {s : Set (β → M)} (h : A.Definable L s) (f : α simp refine (congr rfl (ext fun x => ?_)).mp (h.inter h') simp only [mem_inter_iff, mem_preimage, mem_image, exists_exists_and_eq_and, - mem_setOf_eq] + mem_ofPred_eq] constructor · rintro ⟨⟨y, ys, hy⟩, hx⟩ refine ⟨y, ys, ?_⟩ @@ -467,7 +467,7 @@ theorem DefinableFun.of_empty (hAs : (∅ : Set M).DefinableFun L f) : theorem empty_definableFun_iff : (∅ : Set M).DefinableFun L f ↔ - ∃ φ : L.Formula (Option α), f.tupleGraph = setOf φ.Realize := by + ∃ φ : L.Formula (Option α), f.tupleGraph = Set.ofPred φ.Realize := by simp [DefinableFun, Set.empty_definable_iff] theorem definableFun_iff_empty_definableFun_with_params : @@ -517,7 +517,7 @@ lemma _root_.Set.Definable.preimage_map {S : Set (β → M)} (hS : A.Definable L S) : A.Definable L (F ⁻¹' S) := by have h_graph : A.Definable L { w : α ⊕ β → M | ∀ i, F (w ∘ Sum.inl) i = w (Sum.inr i) } := by - rw [setOf_forall] + rw [ofPred_forall] refine definable_iInter_of_finite fun i => ?_ simpa [tupleGraph] using! (hF i).preimage_comp (fun | none => Sum.inr i | some j => Sum.inl j) @@ -546,7 +546,7 @@ theorem DefinableFun.comp [Finite α] {g : (β → M) → α → M} @[fun_prop] theorem DefinableFun.ite {p : (α → M) → Prop} {g} [DecidablePred p] - (hp : A.Definable L (setOf p)) (hf : DefinableFun L A f) (hg : DefinableFun L A g) : + (hp : A.Definable L (Set.ofPred p)) (hf : DefinableFun L A f) (hg : DefinableFun L A g) : DefinableFun L A fun v => if p v then f v else g v := by let P : Set (Option α → M) := {w | p (w ∘ some)} have hP : A.Definable L P := hp.preimage_comp some @@ -556,17 +556,24 @@ theorem DefinableFun.ite {p : (α → M) → Prop} {g} [DecidablePred p] by_cases h : p (w ∘ some) <;> simp [tupleGraph, P, h] /-- The set where two definable functions agree is definable. -/ -lemma DefinableFun.setOf_eq {f g : (α → M) → M} +lemma DefinableFun.ofPred_eq {f g : (α → M) → M} (hf : A.DefinableFun L f) (hg : A.DefinableFun L g) : A.Definable L {v : α → M | f v = g v} := by have hF : A.DefinableMap L (fun v => ![f v, g v]) := by simp [DefinableMap, *] exact (Definable.diagonal L A).preimage_map hF +@[deprecated (since := "2026-07-09")] +alias DefinableFun.setOf_eq := DefinableFun.ofPred_eq + /-- The preimage of a constant under a definable function is definable. -/ -lemma DefinableFun.setOf_eq_const {f : (α → M) → M} (hf : A.DefinableFun L f) {a : M} (ha : a ∈ A) : +lemma DefinableFun.ofPred_eq_const {f : (α → M) → M} (hf : A.DefinableFun L f) {a : M} + (ha : a ∈ A) : A.Definable L {v : α → M | f v = a} := - hf.setOf_eq (L.definableFun_const α ha) + hf.ofPred_eq (L.definableFun_const α ha) + +@[deprecated (since := "2026-07-09")] +alias DefinableFun.setOf_eq_const := DefinableFun.ofPred_eq_const end Set diff --git a/Mathlib/ModelTheory/DirectLimit.lean b/Mathlib/ModelTheory/DirectLimit.lean index 1574327f4418e6..65d04367b5db50 100644 --- a/Mathlib/ModelTheory/DirectLimit.lean +++ b/Mathlib/ModelTheory/DirectLimit.lean @@ -320,7 +320,7 @@ theorem exists_fg_substructure_in_Sigma (S : L.Substructure (DirectLimit G f)) ( rw [Substructure.map_closure] simp only [Embedding.coe_toHom, of_apply] rw [← image_univ, image_image, image_univ, ← eq_y, - Subtype.range_coe_subtype, Finset.setOf_mem, A_closure] + Subtype.range_coe_subtype, Finset.setOfPred_mem, A_closure] variable {P : Type u₁} [L.Structure P] diff --git a/Mathlib/ModelTheory/ElementarySubstructures.lean b/Mathlib/ModelTheory/ElementarySubstructures.lean index bebffda1987a1c..0f28f2ae14acbd 100644 --- a/Mathlib/ModelTheory/ElementarySubstructures.lean +++ b/Mathlib/ModelTheory/ElementarySubstructures.lean @@ -182,7 +182,7 @@ theorem isElementary_closure (hA : L.MeetsDefinable A) : simp only [Subtype.coe_prop] ⟩).term) i, ?_⟩ ext v - simp only [Fin.isValue, mem_setOf_eq, Formula.relabel, Formula.Realize, + simp only [Fin.isValue, mem_ofPred_eq, Formula.relabel, Formula.Realize, BoundedFormula.realize_subst, BoundedFormula.realize_relabel, Nat.add_zero, Fin.castAdd_zero, Fin.cast_refl, Function.comp_id, Fin.natAdd_zero, D] rw [← Formula.Realize, BoundedFormula.realize_toFormula, LHom.realize_onBoundedFormula] diff --git a/Mathlib/ModelTheory/Fraisse.lean b/Mathlib/ModelTheory/Fraisse.lean index 9b89473fed2ffe..8555d69ddb1e85 100644 --- a/Mathlib/ModelTheory/Fraisse.lean +++ b/Mathlib/ModelTheory/Fraisse.lean @@ -411,7 +411,7 @@ theorem isFraisseLimit_of_countable_infinite IsFraisseLimit { S : Bundled Language.empty.Structure | Finite S } M where age := by ext S - simp only [age, Structure.fg_iff_finite, mem_setOf_eq, and_iff_left_iff_imp] + simp only [age, Structure.fg_iff_finite, mem_ofPred_eq, and_iff_left_iff_imp] intro hS simp ultrahomogeneous S hS f := by diff --git a/Mathlib/ModelTheory/Satisfiability.lean b/Mathlib/ModelTheory/Satisfiability.lean index c36c9f809fde4c..3bed2376b00578 100644 --- a/Mathlib/ModelTheory/Satisfiability.lean +++ b/Mathlib/ModelTheory/Satisfiability.lean @@ -414,7 +414,7 @@ theorem realize_sentence_iff (h : T.IsComplete) (φ : L.Sentence) (M : Type*) [L theorem eq_complete_theory (h : T.IsComplete) (M : Type*) [L.Structure M] [M ⊨ T] [Nonempty M] : {φ | T ⊨ᵇ φ} = L.completeTheory M := by ext φ - simp only [Set.mem_setOf_eq, L.mem_completeTheory] + simp only [Set.mem_ofPred_eq, L.mem_completeTheory] refine ⟨fun h_models => h_models.realize_sentence M, fun h_realize => ?_⟩ cases h.2 φ with | inl hT => exact hT @@ -483,7 +483,7 @@ theorem isSatisfiable [Nonempty M] : (L.completeTheory M).IsSatisfiable := Theory.Model.isSatisfiable M theorem mem_or_not_mem (φ : L.Sentence) : φ ∈ L.completeTheory M ∨ φ.not ∈ L.completeTheory M := by - simp_rw [completeTheory, Set.mem_setOf_eq, Sentence.Realize, Formula.realize_not, or_not] + simp_rw [completeTheory, Set.mem_ofPred_eq, Sentence.Realize, Formula.realize_not, or_not] theorem isMaximal [Nonempty M] : (L.completeTheory M).IsMaximal := ⟨isSatisfiable L M, mem_or_not_mem L M⟩ diff --git a/Mathlib/ModelTheory/Semantics.lean b/Mathlib/ModelTheory/Semantics.lean index e10d87952cd7e7..559e209470ec2d 100644 --- a/Mathlib/ModelTheory/Semantics.lean +++ b/Mathlib/ModelTheory/Semantics.lean @@ -611,11 +611,15 @@ theorem LHom.realize_onFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansi φ.realize_onBoundedFormula ψ @[simp] -theorem LHom.setOf_realize_onFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] - (ψ : L.Formula α) : (setOf (φ.onFormula ψ).Realize : Set (α → M)) = setOf ψ.Realize := by +theorem LHom.setOfPred_realize_onFormula [L'.Structure M] (φ : L →ᴸ L') [φ.IsExpansionOn M] + (ψ : L.Formula α) : + (Set.ofPred (φ.onFormula ψ).Realize : Set (α → M)) = Set.ofPred ψ.Realize := by ext simp +@[deprecated (since := "2026-07-09")] +alias LHom.setOf_realize_onFormula := LHom.setOfPred_realize_onFormula + variable (M) /-- A sentence can be evaluated as true or false in a structure. -/ @@ -716,7 +720,7 @@ theorem mem_completeTheory {φ : Sentence L} : φ ∈ L.completeTheory M ↔ M Iff.rfl theorem elementarilyEquivalent_iff : M ≅[L] N ↔ ∀ φ : L.Sentence, M ⊨ φ ↔ N ⊨ φ := by - simp only [ElementarilyEquivalent, Set.ext_iff, completeTheory, Set.mem_setOf_eq] + simp only [ElementarilyEquivalent, Set.ext_iff, completeTheory, Set.mem_ofPred_eq] variable (M) diff --git a/Mathlib/ModelTheory/Substructures.lean b/Mathlib/ModelTheory/Substructures.lean index a7039badaf7741..26bb0fb0485190 100644 --- a/Mathlib/ModelTheory/Substructures.lean +++ b/Mathlib/ModelTheory/Substructures.lean @@ -246,7 +246,7 @@ theorem notMem_of_notMem_closure {P : M} (hP : P ∉ closure L s) : P ∉ s := f hP (subset_closure h) @[simp] -theorem closed (S : L.Substructure M) : (closure L).closed (S : Set M) := +theorem closed (S : L.Substructure M) : (S : Set M) ∈ (closure L).closed := congr rfl ((closure L).eq_of_le Set.Subset.rfl fun _x xS => mem_closure.2 fun _T hT => hT xS) open Set @@ -331,15 +331,16 @@ variable {L} (S) is preserved under function symbols, then `p` holds for all elements of the closure of `s`. -/ @[elab_as_elim] theorem closure_induction {p : M → Prop} {x} (h : x ∈ closure L s) (Hs : ∀ x ∈ s, p x) - (Hfun : ∀ {n : ℕ} (f : L.Functions n), ClosedUnder f (setOf p)) : p x := - (@closure_le L M _ ⟨setOf p, fun {_} => Hfun⟩ _).2 Hs h + (Hfun : ∀ {n : ℕ} (f : L.Functions n), ClosedUnder f (Set.ofPred p)) : p x := + (@closure_le L M _ ⟨Set.ofPred p, fun {_} => Hfun⟩ _).2 Hs h /-- If `s` is a dense set in a structure `M`, `Substructure.closure L s = ⊤`, then in order to prove that some predicate `p` holds for all `x : M` it suffices to verify `p x` for `x ∈ s`, and verify that `p` is preserved under function symbols. -/ @[elab_as_elim] theorem dense_induction {p : M → Prop} (x : M) {s : Set M} (hs : closure L s = ⊤) - (Hs : ∀ x ∈ s, p x) (Hfun : ∀ {n : ℕ} (f : L.Functions n), ClosedUnder f (setOf p)) : p x := by + (Hs : ∀ x ∈ s, p x) + (Hfun : ∀ {n : ℕ} (f : L.Functions n), ClosedUnder f (Set.ofPred p)) : p x := by have : ∀ x ∈ closure L s, p x := fun x hx => closure_induction hx Hs fun {n} => Hfun simpa [hs] using this x @@ -392,7 +393,7 @@ theorem mem_iSup_of_directed {ι : Type*} [hι : Nonempty ι] {S : ι → L.Subs suffices x ∈ closure L (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by simpa only [closure_iUnion, closure_eq (S _)] using this refine fun hx ↦ closure_induction hx (fun _ ↦ mem_iUnion.1) (fun f v hC ↦ ?_) - simp_rw [Set.mem_setOf] at * + simp_rw [Set.mem_ofPred] at * have ⟨i, hi⟩ := hS.finite_le (fun i ↦ Classical.choose (hC i)) refine ⟨i, (S i).fun_mem f v (fun j ↦ hi j (Classical.choose_spec (hC j)))⟩ diff --git a/Mathlib/ModelTheory/Topology/Types.lean b/Mathlib/ModelTheory/Topology/Types.lean index bf3a1bd0c329e3..d289604c4337a1 100644 --- a/Mathlib/ModelTheory/Topology/Types.lean +++ b/Mathlib/ModelTheory/Topology/Types.lean @@ -87,7 +87,7 @@ instance : CompactSpace (T.CompleteType α) := by have subset : (x : Set _) ⊆ T.toTheory := by rwa [Set.mem_iInter₂] at T_inter exact T.isMaximal.1.mono subset · intro φ - simp only [mem_setOf_eq, typesWith_not] + simp only [mem_ofPred_eq, typesWith_not] exact Ultrafilter.mem_or_compl_mem F (T.typesWith φ) · refine ⟨mem_univ _, ?_⟩ · rw [nhds_generateFrom] diff --git a/Mathlib/ModelTheory/Types.lean b/Mathlib/ModelTheory/Types.lean index 7dfcff66945023..8f9efd01ea82d4 100644 --- a/Mathlib/ModelTheory/Types.lean +++ b/Mathlib/ModelTheory/Types.lean @@ -113,11 +113,13 @@ theorem not_mem_iff (p : T.CompleteType α) (φ : L[[α]].Sentence) : φ.not ∈ exact ⟨ht, hf⟩, (p.mem_or_not_mem φ).resolve_left⟩ @[simp] -theorem compl_setOf_mem {φ : L[[α]].Sentence} : +theorem compl_setOfPred_mem {φ : L[[α]].Sentence} : { p : T.CompleteType α | φ ∈ p }ᶜ = { p : T.CompleteType α | φ.not ∈ p } := ext fun _ => (not_mem_iff _ _).symm -theorem setOf_subset_eq_empty_iff (S : L[[α]].Theory) : +@[deprecated (since := "2026-07-09")] alias compl_setOf_mem := compl_setOfPred_mem + +theorem setOfPred_subset_eq_empty_iff (S : L[[α]].Theory) : { p : T.CompleteType α | S ⊆ ↑p } = ∅ ↔ ¬((L.lhomWithConstants α).onTheory T ∪ S).IsSatisfiable := by rw [iff_not_comm, ← not_nonempty_iff_eq_empty, Classical.not_not, Set.Nonempty] @@ -130,36 +132,46 @@ theorem setOf_subset_eq_empty_iff (S : L[[α]].Theory) : rintro ⟨p, hp⟩ exact p.isMaximal.1.mono (union_subset p.subset hp) -theorem setOf_mem_eq_univ_iff (φ : L[[α]].Sentence) : +@[deprecated (since := "2026-07-09")] +alias setOf_subset_eq_empty_iff := setOfPred_subset_eq_empty_iff + +theorem setOfPred_mem_eq_univ_iff (φ : L[[α]].Sentence) : { p : T.CompleteType α | φ ∈ p } = Set.univ ↔ (L.lhomWithConstants α).onTheory T ⊨ᵇ φ := by - rw [models_iff_not_satisfiable, ← compl_empty_iff, compl_setOf_mem, ← setOf_subset_eq_empty_iff] + rw [models_iff_not_satisfiable, ← compl_empty_iff, compl_setOfPred_mem, + ← setOfPred_subset_eq_empty_iff] simp -theorem setOf_subset_eq_univ_iff (S : L[[α]].Theory) : +@[deprecated (since := "2026-07-09")] alias setOf_mem_eq_univ_iff := setOfPred_mem_eq_univ_iff + +theorem setOfPred_subset_eq_univ_iff (S : L[[α]].Theory) : { p : T.CompleteType α | S ⊆ ↑p } = Set.univ ↔ ∀ φ, φ ∈ S → (L.lhomWithConstants α).onTheory T ⊨ᵇ φ := by have h : { p : T.CompleteType α | S ⊆ ↑p } = ⋂₀ ((fun φ => { p | φ ∈ p }) '' S) := by ext simp [subset_def] - simp_rw [h, sInter_eq_univ, ← setOf_mem_eq_univ_iff] + simp_rw [h, sInter_eq_univ, ← setOfPred_mem_eq_univ_iff] refine ⟨fun h φ φS => h _ ⟨_, φS, rfl⟩, ?_⟩ rintro h _ ⟨φ, h1, rfl⟩ exact h _ h1 +@[deprecated (since := "2026-07-09")] alias setOf_subset_eq_univ_iff := setOfPred_subset_eq_univ_iff + theorem nonempty_iff : Nonempty (T.CompleteType α) ↔ T.IsSatisfiable := by rw [← isSatisfiable_onTheory_iff (lhomWithConstants_injective L α)] rw [nonempty_iff_univ_nonempty, nonempty_iff_ne_empty, Ne, not_iff_comm, - ← union_empty ((L.lhomWithConstants α).onTheory T), ← setOf_subset_eq_empty_iff] + ← union_empty ((L.lhomWithConstants α).onTheory T), ← setOfPred_subset_eq_empty_iff] simp instance instNonempty : Nonempty (CompleteType (∅ : L.Theory) α) := nonempty_iff.2 (isSatisfiable_empty L) -theorem iInter_setOf_subset {ι : Type*} (S : ι → L[[α]].Theory) : +theorem iInter_setOfPred_subset {ι : Type*} (S : ι → L[[α]].Theory) : ⋂ i : ι, { p : T.CompleteType α | S i ⊆ p } = { p : T.CompleteType α | ⋃ i : ι, S i ⊆ p } := by ext - simp only [mem_iInter, mem_setOf_eq, iUnion_subset_iff] + simp only [mem_iInter, mem_ofPred_eq, iUnion_subset_iff] + +@[deprecated (since := "2026-07-09")] alias iInter_setOf_subset := iInter_setOfPred_subset theorem toList_foldr_inf_mem {p : T.CompleteType α} {t : Finset L[[α]].Sentence} : t.toList.foldr (· ⊓ ·) ⊤ ∈ p ↔ (t : L[[α]].Theory) ⊆ ↑p := by @@ -211,7 +223,7 @@ lemma typesWith_top : T.typesWith (α := α) ⊤ = Set.univ := univ_subset_iff.mp fun p _ ↦ p.isMaximal.mem_of_models (φ := ⊤) (fun _ _ _ a ↦ a) lemma typesWith_not (φ : L[[α]].Sentence) : T.typesWith ∼φ = (T.typesWith φ)ᶜ := by - exact Eq.symm compl_setOf_mem + exact Eq.symm compl_setOfPred_mem end CompleteType diff --git a/Mathlib/ModelTheory/Ultraproducts.lean b/Mathlib/ModelTheory/Ultraproducts.lean index e84d5b83c0aac8..a41a887d2a6552 100644 --- a/Mathlib/ModelTheory/Ultraproducts.lean +++ b/Mathlib/ModelTheory/Ultraproducts.lean @@ -53,19 +53,19 @@ instance setoidPrestructure : L.Prestructure ((u : Filter α).productSetoid M) : RelMap := fun {_} r x => ∀ᶠ a : α in u, RelMap r fun i => x i a } fun_equiv := fun {n} f x y xy => by refine mem_of_superset (iInter_mem.2 xy) fun a ha => ?_ - simp only [Set.mem_iInter, Set.mem_setOf_eq] at ha - simp only [Set.mem_setOf_eq, ha] + simp only [Set.mem_iInter, Set.mem_ofPred_eq] at ha + simp only [Set.mem_ofPred_eq, ha] rel_equiv := fun {n} r x y xy => by rw [← iff_eq_eq] refine ⟨fun hx => ?_, fun hy => ?_⟩ · refine mem_of_superset (inter_mem hx (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ - simp only [Set.mem_iInter, Set.mem_setOf_eq] at * + simp only [Set.mem_iInter, Set.mem_ofPred_eq] at * rw [← funext ha2] exact ha1 · refine mem_of_superset (inter_mem hy (iInter_mem.2 xy)) ?_ rintro a ⟨ha1, ha2⟩ - simp only [Set.mem_iInter, Set.mem_setOf_eq] at * + simp only [Set.mem_iInter, Set.mem_ofPred_eq] at * rw [funext ha2] exact ha1 } diff --git a/Mathlib/NumberTheory/ArithmeticFunction/LFunction.lean b/Mathlib/NumberTheory/ArithmeticFunction/LFunction.lean index bc9919c9511070..926ce17f9a999e 100644 --- a/Mathlib/NumberTheory/ArithmeticFunction/LFunction.lean +++ b/Mathlib/NumberTheory/ArithmeticFunction/LFunction.lean @@ -253,7 +253,7 @@ local instance : CompleteSpace (ArithmeticFunction R) := by ext f exact ⟨by rintro ⟨f, rfl⟩; simp, fun hf ↦ ⟨⟨f, hf⟩, rfl⟩⟩ rw [ArithmeticFunction.range_coe] - apply isClosed_setOf_map_zero + apply isClosed_setOfPred_map_zero /-- The Euler product of a family of arithmetic functions. Defined as a `tprod`, but see `tendsTo_eulerProduct_of_tendsTo` for the outward facing `eulerProduct` API. -/ diff --git a/Mathlib/NumberTheory/Chebyshev.lean b/Mathlib/NumberTheory/Chebyshev.lean index f11b8f7ec00db4..8e285c3ef7d08d 100644 --- a/Mathlib/NumberTheory/Chebyshev.lean +++ b/Mathlib/NumberTheory/Chebyshev.lean @@ -639,7 +639,7 @@ theorem primeCounting_eq_theta_div_log_add_integral {x : ℝ} (hx : 2 ≤ x) : simp only [primeCounting, primeCounting', count_eq_card_filter_range] rw [card_eq_sum_ones, range_succ_eq_Icc_zero, sum_filter] push_cast - let a : ℕ → ℝ := Set.indicator (setOf Nat.Prime) (fun n ↦ log n) + let a : ℕ → ℝ := Set.indicator (Set.ofPred Nat.Prime) (fun n ↦ log n) trans ∑ n ∈ Icc 0 ⌊x⌋₊, (log n)⁻¹ * a n · refine sum_congr rfl fun n hn ↦ ?_ split_ifs with h @@ -674,7 +674,7 @@ theorem theta_eq_primeCounting_mul_log_sub_integral {x : ℝ} (hx : 2 ≤ x) : θ x = π ⌊x⌋₊ * log x - ∫ t in 2..x, π ⌊t⌋₊ / t := by -- Rewrite in a form to which Abel summation can be applied rw [theta_eq_sum_Icc, sum_filter] - let a : ℕ → ℝ := Set.indicator (setOf Nat.Prime) (fun n ↦ 1) + let a : ℕ → ℝ := Set.indicator (Set.ofPred Nat.Prime) (fun n ↦ 1) trans ∑ n ∈ Icc 0 ⌊x⌋₊, log n * a n · refine sum_congr rfl fun n _ ↦ ?_ split_ifs with h <;> simp [a, h] diff --git a/Mathlib/NumberTheory/Cyclotomic/Basic.lean b/Mathlib/NumberTheory/Cyclotomic/Basic.lean index 7e7c1e70257a3b..bafc58bd2961d3 100644 --- a/Mathlib/NumberTheory/Cyclotomic/Basic.lean +++ b/Mathlib/NumberTheory/Cyclotomic/Basic.lean @@ -196,7 +196,7 @@ theorem union_left [h : IsCyclotomicExtension T A B] (hS : S ⊆ T) : refine ⟨⟨b, subset_adjoin ⟨n, hn, hn', hb.pow_eq_one⟩⟩, ?_⟩ rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, Subtype.coe_mk] · convert! mem_top (R := A) (x := b) - rw [← adjoin_adjoin_coe_preimage, preimage_setOf_eq] + rw [← adjoin_adjoin_coe_preimage, preimage_ofPred_eq] norm_cast variable {n} @@ -235,7 +235,7 @@ theorem of_union_of_dvd (h : ∃ s ∈ S, s ≠ 0 ∧ n ∣ s) [H : IsCyclotomic · refine _root_.eq_top_iff.2 ?_ rw [← ((iff_adjoin_eq_top S A B).1 H).2] refine adjoin_mono fun x hx ↦ ?_ - simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢ + simp only [union_singleton, mem_insert_iff, mem_ofPred_eq] at hx ⊢ obtain ⟨m, hm, hm'⟩ := hx exact ⟨m, ⟨Or.inr hm, hm'⟩⟩ @@ -249,7 +249,7 @@ theorem iff_union_of_dvd (h : ∃ s ∈ S, s ≠ 0 ∧ n ∣ s) : · exact H.exists_isPrimitiveRoot (subset_union_left hs) · rw [_root_.eq_top_iff, ← ((iff_adjoin_eq_top _ A B).1 H).2] refine adjoin_mono fun x hx => ?_ - simp only [union_singleton, mem_insert_iff, mem_setOf_eq] at hx ⊢ + simp only [union_singleton, mem_insert_iff, mem_ofPred_eq] at hx ⊢ obtain ⟨m, rfl | hm, hxpow⟩ := hx · obtain ⟨y, ⟨hy, hy', ⟨z, rfl⟩⟩⟩ := h exact ⟨_, ⟨hy, hy', by simp only [pow_mul, hxpow, one_pow]⟩⟩ @@ -432,12 +432,12 @@ theorem adjoin_roots_cyclotomic_eq_adjoin_nth_roots [IsDomain B] {ζ : B} {n : simp only [mem_singleton_iff, exists_eq_left] refine le_antisymm (adjoin_mono fun x hx => ?_) (adjoin_le fun x hx => ?_) · rw [mem_rootSet'] at hx - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] rw [isRoot_of_unity_iff (NeZero.pos n)] refine ⟨NeZero.ne n, n, Nat.mem_divisors_self n (NeZero.ne n), ?_⟩ rw [IsRoot.def, ← map_cyclotomic n (algebraMap A B), eval_map_algebraMap] exact hx.2 - · simp only [mem_setOf_eq] at hx + · simp only [mem_ofPred_eq] at hx obtain ⟨i, _, rfl⟩ := hζ.eq_pow_of_pow_eq_one hx.2 refine SetLike.mem_coe.2 (Subalgebra.pow_mem _ (subset_adjoin ?_) _) rw [mem_rootSet', map_cyclotomic, ← eval_map_algebraMap, map_cyclotomic, ← IsRoot] @@ -480,7 +480,7 @@ theorem _root_.IsPrimitiveRoot.adjoin_isCyclotomicExtension {ζ : B} {n : ℕ} [ (fun b₁ b₂ _ _ hb₁ hb₂ => ?_) · rw [Set.mem_singleton_iff] at hb refine subset_adjoin ?_ - simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq, hb] + simp only [mem_singleton_iff, exists_eq_left, mem_ofPred_eq, hb] rw [← Subalgebra.coe_eq_one, Subalgebra.coe_pow, Subtype.coe_mk] exact ⟨NeZero.ne n, ((IsPrimitiveRoot.iff_def ζ n).1 h).1⟩ · exact Subalgebra.algebraMap_mem _ _ @@ -622,7 +622,7 @@ theorem isSplittingField_X_pow_sub_one : IsSplittingField K L (X ^ n - 1) := congr refine Set.ext fun x => ?_ simp only [mem_singleton_iff, ne_eq, exists_eq_left, NeZero.ne, not_false_eq_true, true_and, - mem_setOf_eq] + mem_ofPred_eq] simp only [mem_rootSet', map_sub, map_pow, aeval_one, aeval_X, sub_eq_zero, map_X, and_iff_right_iff_imp, Polynomial.map_sub, Polynomial.map_pow, Polynomial.map_one] exact fun _ => X_pow_sub_C_ne_zero (NeZero.pos n) (1 : L) } @@ -785,7 +785,7 @@ instance isCyclotomicExtension [IsDomain A] [IsFractionRing A K] [NeZero ((n : adjoin_induction (fun y hy => ?_) (fun a => ?_) (fun y z _ _ hy hz => ?_) (fun y z _ _ hy hz => ?_) hx · refine subset_adjoin ?_ - simp only [mem_singleton_iff, exists_eq_left, mem_setOf_eq] + simp only [mem_singleton_iff, exists_eq_left, mem_ofPred_eq] exact ⟨NeZero.ne n, by rwa [← Subalgebra.coe_eq_one, Subalgebra.coe_pow, Subtype.coe_mk]⟩ · exact Subalgebra.algebraMap_mem _ a · exact Subalgebra.add_mem _ hy hz @@ -883,7 +883,7 @@ theorem isCyclotomicExtension_iff_eq_adjoin (C : Subalgebra A B) rw [← Subalgebra.range_val C, ← Algebra.map_top, ← this, AlgHom.map_adjoin] congr; ext simp only [Subalgebra.coe_val, ne_eq, ← Subalgebra.coe_eq_one, SubmonoidClass.coe_pow, - Set.mem_image, Set.mem_setOf_eq, Subtype.exists, exists_and_left, exists_prop, + Set.mem_image, Set.mem_ofPred_eq, Subtype.exists, exists_and_left, exists_prop, exists_eq_right_right, and_iff_left_iff_imp, forall_exists_index, and_imp] exact fun n hn₁ hn₂ hx ↦ h.mem_of_pow_eq_one S C hn₁ hn₂ hx diff --git a/Mathlib/NumberTheory/Dioph.lean b/Mathlib/NumberTheory/Dioph.lean index 585cda8b56ae2d..935168e58fe9a5 100644 --- a/Mathlib/NumberTheory/Dioph.lean +++ b/Mathlib/NumberTheory/Dioph.lean @@ -381,7 +381,7 @@ theorem ex1_dioph {S : Set (Option α → ℕ)} : Dioph S → Dioph {v | ∃ x, funext fun s => by rcases s with a | b <;> try { cases a <;> rfl }; rfl] at ht ⟩⟩⟩⟩ theorem dom_dioph {f : (α → ℕ) →. ℕ} (d : DiophPFun f) : Dioph f.Dom := - cast (congr_arg Dioph <| Set.ext fun _ => (PFun.dom_iff_graph _ _).symm) (ex1_dioph d) + cast (congr_arg Dioph <| Set.ext fun v => (PFun.dom_iff_graph f v).symm) (ex1_dioph d) theorem diophFn_iff_pFun (f : (α → ℕ) → ℕ) : DiophFn f = @DiophPFun α f := by refine congr_arg Dioph (Set.ext fun v => ?_); exact PFun.lift_graph.symm @@ -394,7 +394,7 @@ theorem proj_dioph (i : α) : DiophFn fun v => v i := abs_poly_dioph (Poly.proj i) theorem diophPFun_comp1 {S : Set (Option α → ℕ)} (d : Dioph S) {f} (df : DiophPFun f) : - Dioph {v : α → ℕ | ∃ h : f.Dom v, f.fn v h ::ₒ v ∈ S} := + Dioph {v : α → ℕ | ∃ h : v ∈ f.Dom, f.fn v h ::ₒ v ∈ S} := ext (ex1_dioph (d.inter df)) fun v => ⟨fun ⟨x, hS, (h : Exists _)⟩ => by rw [show (x ::ₒ v) ∘ some = v from funext fun s => rfl] at h @@ -466,7 +466,7 @@ theorem diophFn_compn : congr! 1 ext x; obtain _ | _ | _ := x <;> rfl have : Dioph {v | (v ⊗ f v::fun i : Fin2 n => fl i v) ∈ S} := - @diophFn_compn n (fun v => (v ∘ inl ⊗ f (v ∘ inl) :: v ∘ inr) ∈ S) this _ dfl + @diophFn_compn n {v | (v ∘ inl ⊗ f (v ∘ inl) :: v ∘ inr) ∈ S} this _ dfl ext this fun v => by dsimp congr! 3 with x diff --git a/Mathlib/NumberTheory/DirichletCharacter/Basic.lean b/Mathlib/NumberTheory/DirichletCharacter/Basic.lean index 2e86d6e8cf4339..35828083f8c8a2 100644 --- a/Mathlib/NumberTheory/DirichletCharacter/Basic.lean +++ b/Mathlib/NumberTheory/DirichletCharacter/Basic.lean @@ -452,7 +452,7 @@ def subgroupOfCoprimeConductor [NeZero n] (d : ℕ) : apply Nat.Coprime.of_dvd_right (conductor_mul_dvd_lcm_conductor _ _) exact (Nat.Coprime.mul_right hχ hψ).coprime_div_right <| Nat.gcd_dvd_mul _ _ one_mem' := by simp [conductor_one] - inv_mem' hχ := by rwa [Set.mem_setOf, conductor_inv] + inv_mem' hχ := by rwa [Set.mem_ofPred, conductor_inv] @[simp] lemma mem_subgroupOfCoprimeConductor [NeZero n] {d : ℕ} {χ : DirichletCharacter R n} : diff --git a/Mathlib/NumberTheory/EulerProduct/DirichletLSeries.lean b/Mathlib/NumberTheory/EulerProduct/DirichletLSeries.lean index 903184cf97c479..bb327e7da98645 100644 --- a/Mathlib/NumberTheory/EulerProduct/DirichletLSeries.lean +++ b/Mathlib/NumberTheory/EulerProduct/DirichletLSeries.lean @@ -183,7 +183,7 @@ lemma DirichletCharacter.LSeries_changeLevel {M N : ℕ} [NeZero N] (DirichletCharacter.LSeries_eulerProduct_hasProd χ hs).multipliable · exact multipliable_subtype_iff_mulIndicator.mp Multipliable.of_finite · congr 1 with p - simp only [Set.mulIndicator_apply, Set.mem_setOf_eq, Finset.mem_coe, Nat.mem_primeFactors, + simp only [Set.mulIndicator_apply, Set.mem_ofPred_eq, Finset.mem_coe, Nat.mem_primeFactors, ne_eq, mul_ite, ite_mul, one_mul, mul_one] by_cases h : p.Prime; swap · simp only [h, false_and, if_false] diff --git a/Mathlib/NumberTheory/FLT/Four.lean b/Mathlib/NumberTheory/FLT/Four.lean index 6f17dfbc8a98a0..ec953d51e0cb79 100644 --- a/Mathlib/NumberTheory/FLT/Four.lean +++ b/Mathlib/NumberTheory/FLT/Four.lean @@ -66,7 +66,7 @@ theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minima let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 } have S_nonempty : S.Nonempty := by use Int.natAbs c - rw [Set.mem_setOf_eq] + rw [Set.mem_ofPred_eq] use ⟨a, ⟨b, c⟩⟩ let m : ℕ := Nat.find S_nonempty have m_mem : m ∈ S := Nat.find_spec S_nonempty diff --git a/Mathlib/NumberTheory/FactorisationProperties.lean b/Mathlib/NumberTheory/FactorisationProperties.lean index cea8ccdfdc3df0..a3842be4fcaaa2 100644 --- a/Mathlib/NumberTheory/FactorisationProperties.lean +++ b/Mathlib/NumberTheory/FactorisationProperties.lean @@ -189,7 +189,7 @@ theorem infinite_odd_deficient : {n : ℕ | Odd n ∧ n.Deficient}.Infinite := b rw [Set.infinite_iff_exists_gt] intro n obtain ⟨p, ⟨_, h2⟩⟩ := exists_infinite_primes (max (n + 1) 3) - exact ⟨p, Set.mem_setOf.mpr ⟨Prime.odd_of_ne_two h2 (Ne.symm (ne_of_lt (by grind))), + exact ⟨p, Set.mem_ofPred.mpr ⟨Prime.odd_of_ne_two h2 (Ne.symm (ne_of_lt (by grind))), Prime.deficient h2⟩, by grind⟩ theorem abundant_iff_sum_divisors : Abundant n ↔ 2 * n < ∑ i ∈ n.divisors, i := by diff --git a/Mathlib/NumberTheory/FermatPsp.lean b/Mathlib/NumberTheory/FermatPsp.lean index 4d0183bf4831e3..b62a748e8003d3 100644 --- a/Mathlib/NumberTheory/FermatPsp.lean +++ b/Mathlib/NumberTheory/FermatPsp.lean @@ -345,8 +345,11 @@ theorem frequently_atTop_fermatPsp {b : ℕ} (h : 1 ≤ b) : ∃ᶠ n in Filter. /-- Infinite set variant of `Nat.exists_infinite_pseudoprimes` -/ -theorem infinite_setOf_pseudoprimes {b : ℕ} (h : 1 ≤ b) : +theorem infinite_setOfPred_pseudoprimes {b : ℕ} (h : 1 ≤ b) : Set.Infinite { n : ℕ | FermatPsp n b } := Nat.frequently_atTop_iff_infinite.mp (frequently_atTop_fermatPsp h) +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_pseudoprimes := infinite_setOfPred_pseudoprimes + end Nat diff --git a/Mathlib/NumberTheory/FrobeniusNumber.lean b/Mathlib/NumberTheory/FrobeniusNumber.lean index 5af9915fceace7..2922468d355663 100644 --- a/Mathlib/NumberTheory/FrobeniusNumber.lean +++ b/Mathlib/NumberTheory/FrobeniusNumber.lean @@ -50,7 +50,7 @@ def FrobeniusNumber (n : ℕ) (s : Set ℕ) : Prop := theorem frobeniusNumber_iff {n : ℕ} {s : Set ℕ} : FrobeniusNumber n s ↔ n ∉ AddSubmonoid.closure s ∧ ∀ k > n, k ∈ AddSubmonoid.closure s := by - simp_rw [FrobeniusNumber, IsGreatest, upperBounds, Set.mem_setOf, not_imp_comm, not_le] + simp_rw [FrobeniusNumber, IsGreatest, upperBounds, Set.mem_ofPred, not_imp_comm, not_le] variable {m n : ℕ} @@ -173,12 +173,15 @@ theorem exists_mem_closure_of_ge : ∃ n, ∀ m ≥ n, setGcd s ∣ m → m ∈ ⟨n, fun m ge dvd ↦ (Submodule.span_nat_eq_addSubmonoidClosure s).le (Submodule.span_mono hts (hn m ge dvd))⟩ -theorem finite_setOf_setGcd_dvd_and_mem_span : +theorem finite_setOfPred_setGcd_dvd_and_mem_span : {n | setGcd s ∣ n ∧ n ∉ Ideal.span s}.Finite := have ⟨n, hn⟩ := exists_mem_closure_of_ge s (Finset.range n).finite_toSet.subset fun m h ↦ Finset.mem_range.mpr <| lt_of_not_ge fun ge ↦ h.2 <| (Submodule.span_nat_eq_addSubmonoidClosure s).ge (hn m ge h.1) +@[deprecated (since := "2026-07-09")] +alias finite_setOf_setGcd_dvd_and_mem_span := finite_setOfPred_setGcd_dvd_and_mem_span + /-- `ℕ` is a Noetherian `ℕ`-module, i.e., `ℕ` is a Noetherian semiring. -/ instance : IsNoetherian ℕ ℕ where noetherian s := by diff --git a/Mathlib/NumberTheory/Height/NumberField.lean b/Mathlib/NumberTheory/Height/NumberField.lean index 852c8132ed30e9..3ee577640d4527 100644 --- a/Mathlib/NumberTheory/Height/NumberField.lean +++ b/Mathlib/NumberTheory/Height/NumberField.lean @@ -24,7 +24,7 @@ and set up some API. * Heights on number fields satisfy the **Northcott property**: If `K` is a number field, then the set of elements of `K` of bounded (multiplicative or logarithmic) height is finite; - see `NumberField.finite_setOf_mulHeight₁_le` and `NumberField.finite_setOf_logHeight₁_le`. + see `NumberField.finite_setOfPred_mulHeight₁_le` and `NumberField.finite_setOfPred_logHeight₁_le`. We also provide instances for `Northcott (mulHeight₁ (K := K))` (which automatically leads also to `Northcott (logHeight₁ (K := K))`). @@ -169,7 +169,7 @@ private lemma absNorm_mul_finprod_finitePlace_eq_one_aux [Nonempty ι] (hx : ∀ rw [multiplicity_iSup _ H, map_pow, mul_eq_one_iff_inv_eq₀ h.ne', map_iInf_of_monotone (fun _ ↦ multiplicity ..) (pow_right_monotone <| by lia), map_iInf_of_monotone _ Nat.mono_cast, - map_iInf_of_antitoneOn antitoneOn_inv_pos fun _ ↦ Set.mem_setOf.mpr h] + map_iInf_of_antitoneOn antitoneOn_inv_pos fun _ ↦ Set.mem_ofPred.mpr h] refine iSup_congr fun i ↦ ?_ rw [← mul_eq_one_iff_inv_eq₀ h.ne', mul_comm, Nat.cast_pow] exact apply_mul_absNorm_pow_eq_one v (hx i) @@ -198,13 +198,13 @@ end NumberField We show that a number field `K` has the **Northcott property** with respect to the multiplicative and with respect to the logarithmic height, i.e., for any `B : ℝ` the set of elements `x : K` such that `mulHeight₁ x ≤ B` (resp., `logHeight₁ x ≤ B`) is finite. -See `NumberField.finite_setOf_mulHeight₁_le` and `NumberField.finite_setOf_logHeight₁_le`. +See `NumberField.finite_setOfPred_mulHeight₁_le` and `NumberField.finite_setOfPred_logHeight₁_le`. The main idea of the proof is as follows. We show that for every `x : K` there is `n : ℕ` such that `n * x` is an algebraic integer and `n ≤ mulHeight₁ x`; see `NumberField.exists_nat_le_mulHeight₁`. We also show that the set of `a : 𝓞 K` such that `mulHeight₁ (a / n)` is bounded is finite; -see `NumberField.finite_setOf_prod_infinitePlace_iSup_le`. The result for the multiplicative height -follows by combining these two ingredients, and the result for the logarithmic height follows +see `NumberField.finite_setOfPred_prod_infinitePlace_iSup_le`. The result for the multiplicative +height follows by combining these two ingredients, and the result for the logarithmic height follows from that for any field with a family of admissible absolute values (see `Mathlib.NumberTheory.Height.Northcott`). -/ @@ -329,7 +329,7 @@ private lemma infinitePlace_apply_le_of_prod_le {n : ℕ} (hn : n ≠ 0) (B : end withFinset -lemma finite_setOf_prod_infinitePlace_iSup_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : +lemma finite_setOfPred_prod_infinitePlace_iSup_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : {x : 𝓞 K | ∏ v : InfinitePlace K, (⨆ i, v (![(x : K), n] i)) ^ v.mult ≤ B}.Finite := by set B' := B / n ^ (totalWeight K - 1) suffices Set.BijOn ((↑) : 𝓞 K → K) {x | ∀ (v : InfinitePlace K), v x ≤ B'} @@ -337,40 +337,46 @@ lemma finite_setOf_prod_infinitePlace_iSup_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) this.finite_iff_finite.mpr (Embeddings.finite_of_norm_le K ℂ B') |>.subset fun _ _ ↦ by grind [infinitePlace_apply_le_of_prod_le hn B] refine .mk (fun x hx ↦ ?_) (fun _ _ _ _ ↦ RingOfIntegers.ext) fun a ha ↦ ?_ <;> - simp only [Set.mem_image, Set.mem_setOf_eq] at * + simp only [Set.mem_image, Set.mem_ofPred_eq] at * · exact ⟨x.isIntegral_coe, fun φ ↦ hx <| .mk φ⟩ · rw [← mem_integralClosure_iff ℤ K] at ha exact ⟨⟨a, ha.1⟩, fun v ↦ v.norm_embedding_eq a ▸ ha.2 v.embedding, rfl⟩ +@[deprecated (since := "2026-07-09")] +alias finite_setOf_prod_infinitePlace_iSup_le := finite_setOfPred_prod_infinitePlace_iSup_le + /-- The set of `a : 𝓞 K` such that `mulHeight₁ (a / n) = mulHeight ![a, n]` is bounded (for some given nonzero `n : ℕ`) is finite. -/ -lemma finite_setOf_mulHeight_nat_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : +lemma finite_setOfPred_mulHeight_nat_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : {a : 𝓞 K | mulHeight ![(a : K), n] ≤ B}.Finite := by suffices {a : 𝓞 K | mulHeight ![(a : K), n] ≤ B} ⊆ {a | ∏ v : InfinitePlace K, (⨆ i, v (![(a : K), n] i)) ^ v.mult ≤ n ^ totalWeight K * B} from - (finite_setOf_prod_infinitePlace_iSup_le hn _).subset this - refine Set.setOf_subset_setOf_of_imp fun a ha ↦ ?_ + (finite_setOfPred_prod_infinitePlace_iSup_le hn _).subset this + refine Set.ofPred_subset_ofPred_of_imp fun a ha ↦ ?_ rw [mulHeight_eq <| by simp [hn], mul_comm] at ha grw [← ha, ← mul_assoc, ← one_le_pow_totalWeight_mul_finprod hn, one_mul] -- nonnegativity side goal exact Finset.prod_nonneg fun _ _ ↦ pow_nonneg (Real.iSup_nonneg_of_nonnegHomClass ..) _ +@[deprecated (since := "2026-07-09")] +alias finite_setOf_mulHeight_nat_le := finite_setOfPred_mulHeight_nat_le + variable (K) in /- The set of `x : K` such that `mulHeight₁ x` is bounded and `n * x` is integral (for some given nonzero `n : ℕ`) is finite. This is a stepping stone for the proof of the next result, which is strictly stronger. -/ -private lemma finite_setOf_isIntegral_nat_mul_and_mulHeight₁_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : +private lemma finite_setOfPred_isIntegral_nat_mul_and_mulHeight₁_le {n : ℕ} (hn : n ≠ 0) (B : ℝ) : {x : K | IsIntegral ℤ (n * x) ∧ mulHeight₁ x ≤ B}.Finite := by have hn' : (n : K) ≠ 0 := mod_cast hn suffices Set.BijOn (fun a : 𝓞 K ↦ (a / n : K)) {a | mulHeight ![(a : K), n] ≤ B} {x | IsIntegral ℤ (n * x) ∧ mulHeight₁ x ≤ B} from - this.finite_iff_finite.mp <| finite_setOf_mulHeight_nat_le hn B + this.finite_iff_finite.mp <| finite_setOfPred_mulHeight_nat_le hn B refine .mk (fun a ha ↦ ?_) (fun a _ b _ h ↦ ?_) fun x ⟨hx₁, hx₂⟩ ↦ ?_ - · simp only [Set.mem_setOf_eq] at ha ⊢ + · simp only [Set.mem_ofPred_eq] at ha ⊢ rw [mul_div_cancel₀ (a : K) hn', mulHeight₁_div_eq_mulHeight] exact ⟨a.isIntegral_coe, ha⟩ · rwa [div_left_inj' hn', RingOfIntegers.eq_iff] at h - · simp only [Set.mem_setOf_eq, Set.mem_image] + · simp only [Set.mem_ofPred_eq, Set.mem_image] obtain ⟨a, ha⟩ : ∃ a : 𝓞 K, n * x = a := ⟨⟨_, hx₁⟩, rfl⟩ refine ⟨a, ?_, (EuclideanDomain.eq_div_of_mul_eq_right hn' ha).symm⟩ rwa [← ha, ← mulHeight₁_div_eq_mulHeight, mul_div_cancel_left₀ x hn'] @@ -378,28 +384,34 @@ private lemma finite_setOf_isIntegral_nat_mul_and_mulHeight₁_le {n : ℕ} (hn variable (K) in /-- A number field `K` satisfies the **Northcott property**: The set of elements of bounded multiplicative height is finite. -/ -theorem finite_setOf_mulHeight₁_le (B : ℝ) : {x : K | mulHeight₁ x ≤ B}.Finite := by +theorem finite_setOfPred_mulHeight₁_le (B : ℝ) : {x : K | mulHeight₁ x ≤ B}.Finite := by have H : {x : K | mulHeight₁ x ≤ B} = ⋃ n : Fin ⌊B⌋₊, {x : K | IsIntegral ℤ ((n + 1) * x) ∧ mulHeight₁ x ≤ B} := by ext x : 1 obtain ⟨n, hn₀, hn₁, hn⟩ := exists_nat_le_mulHeight₁ x - simp only [Set.mem_setOf_eq, Set.mem_iUnion, exists_and_right, iff_and_self] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion, exists_and_right, iff_and_self] refine fun h ↦ ⟨⟨n - 1, by grind [Nat.le_floor <| hn₁.trans h]⟩, ?_⟩ rwa [← Nat.cast_add_one, Nat.sub_one_add_one hn₀] rw [H] exact Set.finite_iUnion fun n ↦ - mod_cast finite_setOf_isIntegral_nat_mul_and_mulHeight₁_le K (Nat.zero_ne_add_one n).symm B + mod_cast finite_setOfPred_isIntegral_nat_mul_and_mulHeight₁_le K (Nat.zero_ne_add_one n).symm B + +@[deprecated (since := "2026-07-09")] +alias finite_setOf_mulHeight₁_le := finite_setOfPred_mulHeight₁_le instance : Northcott (mulHeight₁ (K := K)) where - finite_le := finite_setOf_mulHeight₁_le K + finite_le := finite_setOfPred_mulHeight₁_le K variable (K) in /-- A number field `K` satisfies the **Northcott property**: The set of elements of bounded logarithmic height is finite. -/ -theorem finite_setOf_logHeight₁_le (B : ℝ) : +theorem finite_setOfPred_logHeight₁_le (B : ℝ) : {x : K | logHeight₁ x ≤ B}.Finite := Northcott.finite_le B +@[deprecated (since := "2026-07-09")] +alias finite_setOf_logHeight₁_le := finite_setOfPred_logHeight₁_le + end NumberField end Northcott diff --git a/Mathlib/NumberTheory/LSeries/Dirichlet.lean b/Mathlib/NumberTheory/LSeries/Dirichlet.lean index adc4d5b6a96f5f..540860e41d2a98 100644 --- a/Mathlib/NumberTheory/LSeries/Dirichlet.lean +++ b/Mathlib/NumberTheory/LSeries/Dirichlet.lean @@ -176,7 +176,7 @@ lemma not_LSeriesSummable_at_one {N : ℕ} (hN : N ≠ 0) (χ : DirichletCharact refine fun h ↦ (Real.not_summable_indicator_one_div_natCast hN 1) ?_ refine h.norm.of_nonneg_of_le (fun m ↦ Set.indicator_apply_nonneg (fun _ ↦ by positivity)) (fun n ↦ ?_) - simp only [norm_term_eq, Set.indicator, Set.mem_setOf_eq] + simp only [norm_term_eq, Set.indicator, Set.mem_ofPred_eq] split_ifs with h₁ h₂ · simp [h₂] · simp [h₁, χ.map_one] diff --git a/Mathlib/NumberTheory/LSeries/DirichletContinuation.lean b/Mathlib/NumberTheory/LSeries/DirichletContinuation.lean index 947ea4773befb0..824975a28797a0 100644 --- a/Mathlib/NumberTheory/LSeries/DirichletContinuation.lean +++ b/Mathlib/NumberTheory/LSeries/DirichletContinuation.lean @@ -139,7 +139,7 @@ private lemma LFunction_changeLevel_aux {M N : ℕ} [NeZero M] [NeZero N] (hMN : refine .fun_finsetProd fun i h ↦ ?_ have : NeZero i := ⟨(Nat.pos_of_mem_primeFactors h).ne'⟩ fun_prop - · refine eventually_of_mem ?_ (fun t (ht : 1 < t.re) ↦ ?_) + · refine eventually_of_mem ?_ (fun t (ht : t ∈ {z : ℂ | 1 < z.re}) ↦ ?_) · exact (continuous_re.isOpen_preimage _ isOpen_Ioi).mem_nhds (by simp : 1 < (2 : ℂ).re) · simpa [LFunction_eq_LSeries _ ht] using LSeries_changeLevel hMN χ ht @@ -360,7 +360,7 @@ lemma deriv_LFunctionTrivChar₁_apply_of_ne_one {s : ℂ} (hs : s ≠ 1) : have H : deriv (LFunctionTrivChar₁ n) s = deriv (fun w ↦ (w - 1) * LFunctionTrivChar n w) s := by refine eventuallyEq_iff_exists_mem.mpr ?_ |>.deriv_eq - exact ⟨_, isOpen_ne.mem_nhds hs, fun _ hw ↦ Function.update_of_ne (Set.mem_setOf.mp hw) ..⟩ + exact ⟨_, isOpen_ne.mem_nhds hs, fun _ hw ↦ Function.update_of_ne (Set.mem_ofPred.mp hw) ..⟩ rw [H, deriv_fun_mul (by fun_prop) (differentiableAt_LFunction _ s (.inl hs)), deriv_sub_const, deriv_id'', one_mul, add_comm] @@ -376,7 +376,7 @@ lemma continuousOn_neg_logDeriv_LFunctionTrivChar₁ : rcases eq_or_ne w 1 with rfl | hw' · exact LFunctionTrivChar₁_apply_one_ne_zero _ · rw [LFunctionTrivChar₁, Function.update_of_ne hw', mul_ne_zero_iff] - exact ⟨sub_ne_zero_of_ne hw', (Set.mem_setOf.mp hw).resolve_left hw'⟩ + exact ⟨sub_ne_zero_of_ne hw', (Set.mem_ofPred.mp hw).resolve_left hw'⟩ end trivial diff --git a/Mathlib/NumberTheory/LSeries/Injectivity.lean b/Mathlib/NumberTheory/LSeries/Injectivity.lean index 029dc04d8f0a10..ea096a55cb8096 100644 --- a/Mathlib/NumberTheory/LSeries/Injectivity.lean +++ b/Mathlib/NumberTheory/LSeries/Injectivity.lean @@ -96,7 +96,7 @@ lemma LSeries.tendsto_cpow_mul_atTop {f : ℕ → ℂ} {n : ℕ} (h : ∀ m ≤ have H₁ : (k / (n + 1) : ℂ) = (k / (n + 1) : ℝ) := by push_cast; rfl have H₂ : (n + 1) / k < (1 : ℝ) := (div_lt_one <| mod_cast n.succ_pos.trans H).mpr <| mod_cast H - simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, F] + simp only [Set.mem_ofPred_eq, H, Set.indicator_of_mem, F] conv => enter [1, x] rw [div_eq_mul_inv, H₁, ← ofReal_cpow H₀, ← ofReal_inv, ← Real.inv_rpow H₀, inv_div] @@ -109,7 +109,7 @@ lemma LSeries.tendsto_cpow_mul_atTop {f : ℕ → ℂ} {n : ℕ} (h : ∀ m ≤ filter_upwards [mem_atTop y] with y' hy' k -- it remains to show that `‖F y' k‖ ≤ ‖F y k‖` (for `y' ≥ y`) rcases lt_or_ge (n + 1) k with H | H - · simp only [Set.mem_setOf_eq, H, Set.indicator_of_mem, norm_div, norm_cpow_real, + · simp only [Set.mem_ofPred_eq, H, Set.indicator_of_mem, norm_div, norm_cpow_real, Complex.norm_natCast, F] rw [← Nat.cast_one, ← Nat.cast_add, Complex.norm_natCast] have hkn : 1 ≤ (k / (n + 1 :) : ℝ) := diff --git a/Mathlib/NumberTheory/LSeries/Positivity.lean b/Mathlib/NumberTheory/LSeries/Positivity.lean index f4b11704341d94..e7855803a338e1 100644 --- a/Mathlib/NumberTheory/LSeries/Positivity.lean +++ b/Mathlib/NumberTheory/LSeries/Positivity.lean @@ -72,7 +72,7 @@ lemma positive_of_differentiable_of_eqOn {a : ℕ → ℂ} (ha₀ : 0 ≤ a) (ha have hxy : x < max x y + 1 := (le_max_left x y).trans_lt (lt_add_one _) have hxy' : abscissaOfAbsConv a < max x y + 1 := hx.trans_lt <| mod_cast hxy have hys : (max x y + 1 : ℂ) ∈ {s | x < s.re} := by - simp only [Set.mem_setOf_eq, add_re, ofReal_re, one_re, hxy] + simp only [Set.mem_ofPred_eq, add_re, ofReal_re, one_re, hxy] have hfx : 0 < f (max x y + 1) := by simpa only [hf' hys, ofReal_add, ofReal_one] using positive ha₀ ha₁ hxy' refine (hfx.trans_le <| hf.apply_le_of_iteratedDeriv_alternating (fun n _ ↦ ?_) ?_) diff --git a/Mathlib/NumberTheory/LSeries/PrimesInAP.lean b/Mathlib/NumberTheory/LSeries/PrimesInAP.lean index c9b77f4253ba06..150d4ed098ac0b 100644 --- a/Mathlib/NumberTheory/LSeries/PrimesInAP.lean +++ b/Mathlib/NumberTheory/LSeries/PrimesInAP.lean @@ -58,7 +58,7 @@ The main steps of the proof are as follows. ## Main Result We give two versions of **Dirichlet's Theorem**: -* `Nat.infinite_setOf_prime_and_eq_mod` states that the set of primes `p` +* `Nat.infinite_setOfPred_prime_and_eq_mod` states that the set of primes `p` such that `(p : ZMod q) = a` is infinite (when `a` is invertible in `ZMod q`). * `Nat.forall_exists_prime_gt_and_eq_mod` states that for any natural number `n` there is a prime `p > n` such that `(p : ZMod q) = a`. @@ -91,7 +91,7 @@ lemma tprod_eq_tprod_primes_of_mulSupport_subset_prime_powers {f : ℕ → α} prodNatEquiv.symm.multipliable_iff.mp <| by simpa only [← coe_prodNatEquiv_apply, Prod.eta, Function.comp_def, Equiv.apply_symm_apply] using! hfm.subtype _ - simp only [← tprod_subtype_eq_of_mulSupport_subset hf, Set.coe_setOf, ← prodNatEquiv.tprod_eq, + simp only [← tprod_subtype_eq_of_mulSupport_subset hf, Set.coe_ofPred, ← prodNatEquiv.tprod_eq, ← hfm'.tprod_prod] refine tprod_congr fun (p, k) ↦ congrArg f <| coe_prodNatEquiv_apply .. @@ -140,7 +140,7 @@ lemma residueClass_le (n : ℕ) : residueClass a n ≤ vonMangoldt n := @[simp] lemma residueClass_apply_zero : residueClass a 0 = 0 := by - simp only [Set.indicator_apply_eq_zero, Set.mem_setOf_eq, Nat.cast_zero, map_zero, + simp only [Set.indicator_apply_eq_zero, Set.mem_ofPred_eq, Nat.cast_zero, map_zero, implies_true] lemma abscissaOfAbsConv_residueClass_le_one : @@ -151,9 +151,9 @@ lemma abscissaOfAbsConv_residueClass_le_one : convert! this.indicator {n : ℕ | (n : ZMod q) = a} ext1 n by_cases hn : (n : ZMod q) = a - · simp +contextual only [term, Set.indicator, Set.mem_setOf_eq, hn, ↓reduceIte, apply_ite, + · simp +contextual only [term, Set.indicator, Set.mem_ofPred_eq, hn, ↓reduceIte, apply_ite, ite_self] - · simp +contextual only [term, Set.mem_setOf_eq, hn, not_false_eq_true, Set.indicator_of_notMem, + · simp +contextual only [term, Set.mem_ofPred_eq, hn, not_false_eq_true, Set.indicator_of_notMem, ofReal_zero, zero_div, ite_self] /-- The set we are interested in (prime numbers in the residue class `a`) is the same as the support @@ -163,9 +163,9 @@ lemma support_residueClass_prime_div : Function.support (fun n : ℕ ↦ (if n.Prime then residueClass a n else 0) / n) = {p : ℕ | p.Prime ∧ (p : ZMod q) = a} := by simp only [Function.support, ne_eq, div_eq_zero_iff, ite_eq_right_iff, - Set.indicator_apply_eq_zero, Set.mem_setOf_eq, Nat.cast_eq_zero, not_or, Classical.not_imp] + Set.indicator_apply_eq_zero, Set.mem_ofPred_eq, Nat.cast_eq_zero, not_or, Classical.not_imp] ext1 p - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] exact ⟨fun H ↦ ⟨H.1.1, H.1.2.1⟩, fun H ↦ ⟨⟨H.1, H.2, vonMangoldt_ne_zero_iff.mpr H.1.isPrimePow⟩, H.1.ne_zero⟩⟩ @@ -263,7 +263,7 @@ lemma residueClass_apply (ha : IsUnit a) (n : ℕ) : residueClass a n = (q.totient : ℂ)⁻¹ * ∑ χ : DirichletCharacter ℂ q, χ a⁻¹ * χ n * vonMangoldt n := by rw [eq_inv_mul_iff_mul_eq₀ <| mod_cast (Nat.totient_pos.mpr q.pos_of_neZero).ne'] - simp +contextual only [residueClass, Set.indicator_apply, Set.mem_setOf_eq, apply_ite, + simp +contextual only [residueClass, Set.indicator_apply, Set.mem_ofPred_eq, apply_ite, ofReal_zero, mul_zero, ← Finset.sum_mul, sum_char_inv_mul_char_eq ℂ ha n, eq_comm (a := a), ite_mul, zero_mul, ↓reduceIte, ite_self] @@ -314,15 +314,15 @@ lemma continuousOn_LFunctionResidueClassAux' : simp only [LFunctionResidueClassAux, sub_eq_add_neg] refine continuousOn_const.mul <| ContinuousOn.add ?_ ?_ · refine (continuousOn_neg_logDeriv_LFunctionTrivChar₁ q).mono fun s hs ↦ ?_ - simp only [ne_eq, Set.mem_setOf_eq] at hs + simp only [ne_eq, Set.mem_ofPred_eq] at hs tauto · simp only [← Finset.sum_neg_distrib, mul_div_assoc, ← mul_neg, ← neg_div] refine continuousOn_finsetSum _ fun χ hχ ↦ continuousOn_const.mul ?_ replace hχ : χ ≠ 1 := by simpa only [ne_eq, Finset.mem_compl, Finset.mem_singleton] using hχ refine (continuousOn_neg_logDeriv_LFunction_of_nontriv hχ).mono fun s hs ↦ ?_ - simp only [ne_eq, Set.mem_setOf_eq] at hs + simp only [ne_eq, Set.mem_ofPred_eq] at hs rcases hs with rfl | hs - · simp only [ne_eq, Set.mem_setOf_eq, one_re, le_refl, + · simp only [ne_eq, Set.mem_ofPred_eq, one_re, le_refl, LFunction_ne_zero_of_one_le_re χ (.inl hχ), not_false_eq_true] · exact hs χ @@ -334,9 +334,9 @@ lemma continuousOn_LFunctionResidueClassAux : ContinuousOn (LFunctionResidueClassAux a) {s | 1 ≤ s.re} := by refine (continuousOn_LFunctionResidueClassAux' a).mono fun s hs ↦ ?_ rcases eq_or_ne s 1 with rfl | hs₁ - · simp only [ne_eq, Set.mem_setOf_eq, true_or] - · simp only [ne_eq, Set.mem_setOf_eq, hs₁, false_or] - exact fun χ ↦ LFunction_ne_zero_of_one_le_re χ (.inr hs₁) <| Set.mem_setOf.mp hs + · simp only [ne_eq, Set.mem_ofPred_eq, true_or] + · simp only [ne_eq, Set.mem_ofPred_eq, hs₁, false_or] + exact fun χ ↦ LFunction_ne_zero_of_one_le_re χ (.inr hs₁) <| Set.mem_ofPred.mp hs variable {a} @@ -350,7 +350,7 @@ lemma eqOn_LFunctionResidueClassAux (ha : IsUnit a) : (fun s ↦ L ↗(residueClass a) s - (q.totient : ℂ)⁻¹ / (s - 1)) {s | 1 < s.re} := by intro s hs - replace hs := Set.mem_setOf.mp hs + replace hs := Set.mem_ofPred.mp hs simp only [LSeries_residueClass_eq ha hs, LFunctionResidueClassAux] rw [neg_div, ← neg_add', mul_neg, ← neg_mul, div_eq_mul_one_div (q.totient : ℂ)⁻¹, sub_eq_add_neg, ← neg_mul, ← mul_add] @@ -399,7 +399,7 @@ lemma LSeries_residueClass_lower_bound (ha : IsUnit a) : simp only [ofReal_tsum, ofReal_div, ofReal_cpow (Nat.cast_nonneg _), ofReal_natCast, ofReal_add, ofReal_inv, ofReal_sub, ofReal_one] simp_rw [← LFunctionResidueClassAux_real ha hx, - eqOn_LFunctionResidueClassAux ha <| Set.mem_setOf.mpr (ofReal_re x ▸ hx), sub_add_cancel, + eqOn_LFunctionResidueClassAux ha <| Set.mem_ofPred.mpr (ofReal_re x ▸ hx), sub_add_cancel, LSeries, term] refine tsum_congr fun n ↦ ?_ split_ifs with hn @@ -408,7 +408,7 @@ lemma LSeries_residueClass_lower_bound (ha : IsUnit a) : have : ContinuousOn (fun x : ℝ ↦ (LFunctionResidueClassAux a x).re) (Set.Icc 1 2) := continuous_re.continuousOn.comp (t := Set.univ) (continuousOn_LFunctionResidueClassAux a) (fun ⦃x⦄ a ↦ trivial) |>.comp continuous_ofReal.continuousOn fun x hx ↦ by - simpa only [Set.mem_setOf_eq, ofReal_re] using hx.1 + simpa only [Set.mem_ofPred_eq, ofReal_re] using hx.1 obtain ⟨C, hC⟩ := bddBelow_def.mp <| IsCompact.bddBelow_image isCompact_Icc this replace hC {x : ℝ} (hx : x ∈ Set.Icc 1 2) : C ≤ (LFunctionResidueClassAux a x).re := hC (LFunctionResidueClassAux a x).re <| @@ -472,19 +472,22 @@ variable {q : ℕ} [NeZero q] {a : ZMod q} /-- **Dirichlet's Theorem** on primes in arithmetic progression: if `q` is a positive integer and `a : ZMod q` is a unit, then there are infinitely many prime numbers `p` such that `(p : ZMod q) = a`. -/ -theorem infinite_setOf_prime_and_eq_mod (ha : IsUnit a) : +theorem infinite_setOfPred_prime_and_eq_mod (ha : IsUnit a) : {p : ℕ | p.Prime ∧ (p : ZMod q) = a}.Infinite := by by_contra! H exact not_summable_residueClass_prime_div ha <| summable_of_hasFiniteSupport <| show Set.Finite _ from support_residueClass_prime_div a ▸ H +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_prime_and_eq_mod := infinite_setOfPred_prime_and_eq_mod + /-- **Dirichlet's Theorem** on primes in arithmetic progression: if `q` is a positive integer and `a : ZMod q` is a unit, then there are infinitely many prime numbers `p` such that `(p : ZMod q) = a`. -/ theorem forall_exists_prime_gt_and_eq_mod (ha : IsUnit a) (n : ℕ) : ∃ p > n, p.Prime ∧ (p : ZMod q) = a := by - obtain ⟨p, hp₁, hp₂⟩ := Set.infinite_iff_exists_gt.mp (infinite_setOf_prime_and_eq_mod ha) n - exact ⟨p, hp₂.gt, Set.mem_setOf.mp hp₁⟩ + obtain ⟨p, hp₁, hp₂⟩ := Set.infinite_iff_exists_gt.mp (infinite_setOfPred_prime_and_eq_mod ha) n + exact ⟨p, hp₂.gt, Set.mem_ofPred.mp hp₁⟩ /-- **Dirichlet's Theorem** on primes in arithmetic progression: if `q` is a positive integer and `a : ℤ` is coprime to `q`, then there are infinitely many prime numbers `p` @@ -513,10 +516,13 @@ lemma frequently_atTop_prime_and_modEq {q a : ℕ} (hq : q ≠ 0) (h : a.Coprime obtain ⟨p, hn, hp, ha⟩ := forall_exists_prime_gt_and_modEq n hq h exact ⟨p, hn.le, hp, ha⟩ -lemma infinite_setOf_prime_and_modEq {q a : ℕ} (hq : q ≠ 0) (h : a.Coprime q) : +lemma infinite_setOfPred_prime_and_modEq {q a : ℕ} (hq : q ≠ 0) (h : a.Coprime q) : Set.Infinite {p : ℕ | p.Prime ∧ p ≡ a [MOD q]} := frequently_atTop_iff_infinite.1 (frequently_atTop_prime_and_modEq hq h) +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_prime_and_modEq := infinite_setOfPred_prime_and_modEq + end Nat end DirichletsTheorem diff --git a/Mathlib/NumberTheory/LSeries/ZetaZeros.lean b/Mathlib/NumberTheory/LSeries/ZetaZeros.lean index 5b8765ca7d6d46..bd31d3f36d867f 100644 --- a/Mathlib/NumberTheory/LSeries/ZetaZeros.lean +++ b/Mathlib/NumberTheory/LSeries/ZetaZeros.lean @@ -30,7 +30,7 @@ so that in particular any compact subset of `ℂ` contains only finitely many ze @[expose] public section /-- The zeros of Riemann's ζ-function. -/ -def riemannZetaZeros : Set ℂ := riemannZeta ⁻¹' {0} +noncomputable def riemannZetaZeros : Set ℂ := riemannZeta ⁻¹' {0} lemma mem_riemannZetaZeros {z : ℂ} : z ∈ riemannZetaZeros ↔ riemannZeta z = 0 := .rfl diff --git a/Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/Basic.lean b/Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/Basic.lean index 84525ffbd6d2d3..4fe9cf2f5e7cc3 100644 --- a/Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/Basic.lean +++ b/Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/Basic.lean @@ -215,7 +215,7 @@ theorem quadraticChar_card_sqrts (hF : ringChar F ≠ 2) (a : F) : #{x : F | x ^ 2 = a}.toFinset = quadraticChar F a + 1 := by -- we consider the cases `a = 0`, `a` is a nonzero square and `a` is a nonsquare in turn by_cases h₀ : a = 0 - · simp only [h₀, sq_eq_zero_iff, Set.setOf_eq_eq_singleton, Set.toFinset_card, + · simp only [h₀, sq_eq_zero_iff, Set.ofPred_eq_eq_singleton, Set.toFinset_card, Set.card_singleton, Int.natCast_succ, Int.ofNat_zero, MulChar.map_zero] · set s := {x : F | x ^ 2 = a}.toFinset by_cases h : IsSquare a @@ -225,7 +225,7 @@ theorem quadraticChar_card_sqrts (hF : ringChar F ≠ 2) (a : F) : have h₁ : s = [b, -b].toFinset := by ext1 rw [← pow_two] at h - simp_rw [s, Set.toFinset_setOf, mem_filter_univ, h, List.toFinset_cons, List.toFinset_nil, + simp_rw [s, Set.toFinset_ofPred, mem_filter_univ, h, List.toFinset_cons, List.toFinset_nil, insert_empty_eq, mem_insert, mem_singleton] exact sq_eq_sq_iff_eq_or_eq_neg norm_cast diff --git a/Mathlib/NumberTheory/LocalField/Basic.lean b/Mathlib/NumberTheory/LocalField/Basic.lean index dd9694d4d63bb9..124f3040dd8f2b 100644 --- a/Mathlib/NumberTheory/LocalField/Basic.lean +++ b/Mathlib/NumberTheory/LocalField/Basic.lean @@ -81,7 +81,7 @@ lemma isCompact_closedBall (γ : ValueGroupWithZero K) : IsCompact { x | valuati · obtain ⟨r, rfl⟩ := ValuativeRel.valuation_surjective r simp only [ne_eq, map_eq_zero] at hr refine ⟨r ^ 2, by simpa using hr, by simpa [pow_two], fun x hx ↦ hrs ?_⟩ - simp only [map_pow, Set.mem_setOf_eq] at hx ⊢ + simp only [map_pow, Set.mem_ofPred_eq] at hx ⊢ exact hx.trans_lt (by simpa [pow_two, hr]) · refine ⟨r', hr', hr, .trans ?_ hrs⟩ intro x hx @@ -93,8 +93,8 @@ lemma isCompact_closedBall (γ : ValueGroupWithZero K) : IsCompact { x | valuati (Homeomorph.mulLeft₀ (γ / r) (by simp [hr, div_eq_zero_iff, hγ])).continuous using 1 refine .trans ?_ (Equiv.image_eq_preimage_symm _ _).symm ext x - simp only [Set.mem_setOf_eq, Homeomorph.coe_symm_toEquiv, Homeomorph.mulLeft₀_symm_apply, inv_div, - Set.preimage_setOf_eq, map_mul, map_div₀, Valuation.restrict_le_iff] + simp only [Set.mem_ofPred_eq, Homeomorph.coe_symm_toEquiv, Homeomorph.mulLeft₀_symm_apply, + inv_div, Set.preimage_ofPred_eq, map_mul, map_div₀, Valuation.restrict_le_iff] rw [div_mul_eq_mul_div, div_le_iff₀ (by simp [hγ])] simp only [IsValuativeTopology.v_eq_valuation, ← map_mul, Valuation.restrict_le_iff] simp [hr] diff --git a/Mathlib/NumberTheory/Modular.lean b/Mathlib/NumberTheory/Modular.lean index dbd0b531c022d9..7ec63c6dadb93f 100644 --- a/Mathlib/NumberTheory/Modular.lean +++ b/Mathlib/NumberTheory/Modular.lean @@ -809,11 +809,13 @@ section Topology -/ lemma isClosed_fd : IsClosed 𝒟 := by - refine .inter (.preimage (by fun_prop) isClosed_Ici) ?_ + change IsClosed ({z : ℍ | 1 ≤ normSq (z : ℂ)} ∩ {z : ℍ | |z.re| ≤ (1 : ℝ) / 2}) + refine .inter (.preimage (f := fun z : ℍ ↦ normSq (z : ℂ)) (by fun_prop) isClosed_Ici) ?_ exact isClosed_le (f := fun z : ℍ ↦ |z.re|) (by fun_prop) continuous_const lemma isOpen_fdo : IsOpen 𝒟ᵒ := by - refine .inter (.preimage (by fun_prop) isOpen_Ioi) ?_ + change IsOpen ({z : ℍ | 1 < normSq (z : ℂ)} ∩ {z : ℍ | |z.re| < (1 : ℝ) / 2}) + refine .inter (.preimage (f := fun z : ℍ ↦ normSq (z : ℂ)) (by fun_prop) isOpen_Ioi) ?_ exact isOpen_lt (f := fun z : ℍ ↦ |z.re|) (by fun_prop) continuous_const /-- Explicit formula for the image of `ModularGroup.fdo` in `ℂ`. -/ @@ -838,6 +840,7 @@ since the inclusion of `ℍ` in `ℂ` is an open but not a closed map. lemma isClosed_coe_fd : IsClosed ((↑) '' 𝒟 : Set ℂ) := by rw [coe_fd] have : IsClosed {z : ℂ | 0 ≤ z.im ∧ 1 ≤ ‖z‖ ∧ |z.re| ≤ 1/2} := by + change IsClosed ({z : ℂ | 0 ≤ z.im} ∩ ({z : ℂ | 1 ≤ ‖z‖} ∩ {z : ℂ | |z.re| ≤ 1/2})) refine .inter ?_ (.inter ?_ ?_) · exact isClosed_le continuous_const Complex.continuous_im · exact isClosed_le continuous_const continuous_norm @@ -860,7 +863,7 @@ private lemma mem_closure_of_one_lt_norm {x : ℍ} (hxnorm : 1 < ‖(x : ℂ)‖ apply mem_closure_of_frequently_of_tendsto (α := ℝ) (b := 𝓝[<] 1) (f := fun t ↦ ofComplex (t * x)) · apply Filter.Eventually.frequently - simp only [fdo, Set.mem_setOf, Filter.eventually_and, one_lt_normSq_iff] + simp only [fdo, Set.mem_ofPred, Filter.eventually_and, one_lt_normSq_iff] refine ⟨Filter.Tendsto.eventually_const_lt hxnorm (.mono_left ?_ nhdsWithin_le_nhds), ?_⟩ · have : ContinuousAt (fun a : ℝ ↦ (ofComplex (a * x : ℂ) : ℂ)) 1 := by refine .comp (by fun_prop) ((OpenPartialHomeomorph.continuousAt _ ?_).comp (by fun_prop)) @@ -962,6 +965,8 @@ lemma isCompact_truncatedFundamentalDomain (y : ℝ) : Metric.isCompact_iff_isClosed_bounded] constructor · -- show closed + change IsClosed ({z : ℂ | 0 ≤ z.im} ∩ + ({z : ℂ | z.im ≤ y} ∩ ({z : ℂ | |z.re| ≤ 1 / 2} ∩ {z : ℂ | 1 ≤ ‖z‖}))) apply (isClosed_le continuous_const Complex.continuous_im).inter apply (isClosed_le Complex.continuous_im continuous_const).inter apply (isClosed_le (continuous_abs.comp Complex.continuous_re) continuous_const).inter diff --git a/Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean b/Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean index 0e53a993d11ea0..20f7705b4dec1c 100644 --- a/Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean +++ b/Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean @@ -80,7 +80,7 @@ def Gamma0 : Subgroup SL(2, ℤ) where one_mem' := by simp mul_mem' {a} {b} ha hb := by have h := (Matrix.two_mul_expl a.1 b.1).2.2.1 - simp only [coe_mul, Set.mem_setOf_eq] at * + simp only [coe_mul, Set.mem_ofPred_eq] at * simp [h, ha, hb] inv_mem' {a} ha := by simpa [SL2_inv_expl a] using ha diff --git a/Mathlib/NumberTheory/ModularForms/EisensteinSeries/UniformConvergence.lean b/Mathlib/NumberTheory/ModularForms/EisensteinSeries/UniformConvergence.lean index e8ce2ce084d52c..ed7e30c74894cd 100644 --- a/Mathlib/NumberTheory/ModularForms/EisensteinSeries/UniformConvergence.lean +++ b/Mathlib/NumberTheory/ModularForms/EisensteinSeries/UniformConvergence.lean @@ -45,7 +45,7 @@ theorem eisensteinSeries_tendstoLocallyUniformly {k : ℤ} (hk : 3 ≤ k) {N : (eisensteinSeries a k ·) Filter.atTop := by have hk' : (2 : ℝ) < k := by norm_cast have p_sum : Summable fun x : gammaSet N 1 a ↦ ‖x.val‖ ^ (-k) := - mod_cast (summable_one_div_norm_rpow hk').subtype (gammaSet N 1 a) + mod_cast (summable_one_div_norm_rpow hk').subtype (· ∈ gammaSet N 1 a) simp only [tendstoLocallyUniformly_iff_forall_isCompact, eisensteinSeries] intro K hK obtain ⟨A, B, hB, HABK⟩ := subset_verticalStrip_of_isCompact hK diff --git a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean index e53507c24b94d7..de99827f197abb 100644 --- a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean +++ b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean @@ -1051,7 +1051,7 @@ variable [NumberField K] include hA in open scoped Classical in theorem iUnion_negAt_plusPart_ae : - ⋃ s, negAt s '' (plusPart A) =ᵐ[volume] A := by + ⋃ s, negAt s '' (plusPart A) =ᵐˢ[volume] A := by nth_rewrite 2 [← iUnion_negAt_plusPart_union A hA] refine (MeasureTheory.union_ae_eq_left_of_ae_eq_empty (ae_eq_empty.mpr ?_)).symm exact measure_mono_null Set.inter_subset_right diff --git a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean index 9fff85d2bd4375..867d982c42c9a4 100644 --- a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean +++ b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean @@ -55,7 +55,7 @@ variable (f : InfinitePlace K → ℝ≥0) /-- The convex body defined by `f`: the set of points `x : E` such that `‖x w‖ < f w` for all infinite places `w`. -/ -abbrev convexBodyLT : Set (mixedSpace K) := +noncomputable abbrev convexBodyLT : Set (mixedSpace K) := (Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } => ball 0 (f w))) ×ˢ (Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } => ball 0 (f w))) @@ -145,7 +145,7 @@ open scoped Classical in needed to ensure the element constructed is not real, see for example `exists_primitive_element_lt_of_isComplex`. -/ -abbrev convexBodyLT' : Set (mixedSpace K) := +noncomputable abbrev convexBodyLT' : Set (mixedSpace K) := (Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } ↦ ball 0 (f w))) ×ˢ (Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } ↦ if w = w₀ then {x | |x.re| < 1 ∧ |x.im| < (f w : ℝ) ^ 2} else ball 0 (f w))) @@ -161,7 +161,7 @@ theorem convexBodyLT'_mem {x : K} : · by_cases hw : IsReal w · exact norm_embedding_eq w _ ▸ h₁ w hw · specialize h₂ w (not_isReal_iff_isComplex.mp hw) - rw [apply_ite (w.embedding x ∈ ·), Set.mem_setOf_eq, + rw [apply_ite (w.embedding x ∈ ·), Set.mem_ofPred_eq, mem_ball_zero_iff, norm_embedding_eq] at h₂ rwa [if_neg (by exact Subtype.coe_ne_coe.1 h_ne)] at h₂ · simpa [if_true] using h₂ w₀.val w₀.prop @@ -207,14 +207,15 @@ theorem convexBodyLT'_volume : have vol_box : ∀ B : ℝ≥0, volume {x : ℂ | |x.re| < 1 ∧ |x.im| < B ^ 2} = 4 * B ^ 2 := by intro B rw [← (Complex.volume_preserving_equiv_real_prod.symm).measure_preimage] - · simp_rw [Set.preimage_setOf_eq, Complex.measurableEquivRealProd_symm_apply] + · simp_rw [Set.preimage_ofPred_eq, Complex.measurableEquivRealProd_symm_apply] rw [show {a : ℝ × ℝ | |a.1| < 1 ∧ |a.2| < B ^ 2} = Set.Ioo (-1 : ℝ) (1 : ℝ) ×ˢ Set.Ioo (-(B : ℝ) ^ 2) ((B : ℝ) ^ 2) by - ext; simp_rw [Set.mem_setOf_eq, Set.mem_prod, Set.mem_Ioo, abs_lt]] + ext; simp_rw [Set.mem_ofPred_eq, Set.mem_prod, Set.mem_Ioo, abs_lt]] simp_rw [volume_eq_prod, prod_prod, Real.volume_Ioo, sub_neg_eq_add, one_add_one_eq_two, ← two_mul, ofReal_mul zero_le_two, ofReal_pow (coe_nonneg B), ofReal_ofNat, ofReal_coe_nnreal, ← mul_assoc, show (2 : ℝ≥0∞) * 2 = 4 by norm_num] - · refine (MeasurableSet.inter ?_ ?_).nullMeasurableSet + · change NullMeasurableSet ({x : ℂ | |x.re| < 1} ∩ {x : ℂ | |x.im| < ↑B ^ 2}) volume + refine (MeasurableSet.inter ?_ ?_).nullMeasurableSet · exact measurableSet_lt (measurable_norm.comp Complex.measurable_re) measurable_const · exact measurableSet_lt (measurable_norm.comp Complex.measurable_im) measurable_const calc @@ -320,22 +321,22 @@ theorem convexBodySum_volume_eq_zero_of_le_zero {B} (hB : B ≤ 0) : · suffices convexBodySum K B = ∅ by rw [this, measure_empty] ext x refine ⟨fun hx => ?_, fun h => h.elim⟩ - rw [Set.mem_setOf] at hx + rw [Set.mem_ofPred] at hx linarith [convexBodySumFun_nonneg x] · suffices convexBodySum K B = { 0 } by rw [this, measure_singleton] ext - rw [convexBodySum, Set.mem_setOf_eq, Set.mem_singleton_iff, hB, ← convexBodySumFun_eq_zero_iff] + rw [convexBodySum, Set.mem_ofPred_eq, Set.mem_singleton_iff, hB, ← convexBodySumFun_eq_zero_iff] exact (convexBodySumFun_nonneg _).ge_iff_eq' theorem convexBodySum_mem {x : K} : mixedEmbedding K x ∈ (convexBodySum K B) ↔ ∑ w : InfinitePlace K, (mult w) * w.val x ≤ B := by - simp_rw [Set.mem_setOf_eq, convexBodySumFun, normAtPlace_apply] + simp_rw [Set.mem_ofPred_eq, convexBodySumFun, normAtPlace_apply] rfl theorem convexBodySum_neg_mem {x : mixedSpace K} (hx : x ∈ (convexBodySum K B)) : -x ∈ (convexBodySum K B) := by - rw [Set.mem_setOf, convexBodySumFun_neg] + rw [Set.mem_ofPred, convexBodySumFun_neg] exact hx theorem convexBodySum_convex : Convex ℝ (convexBodySum K B) := by @@ -378,7 +379,7 @@ theorem convexBodySum_volume : · suffices volume (convexBodySum K 1) = (convexBodySumFactor K) by rw [mul_comm] convert! addHaar_smul volume B (convexBodySum K 1) - · simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hB), Set.preimage_setOf_eq, convexBodySumFun, + · simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hB), Set.preimage_ofPred_eq, convexBodySumFun, normAtPlace_smul, abs_inv, abs_eq_self.mpr (le_of_lt hB), ← mul_assoc, mul_comm, mul_assoc, ← Finset.mul_sum, inv_mul_le_iff₀ hB, mul_one] · rw [abs_pow, ofReal_pow (abs_nonneg _), abs_eq_self.mpr (le_of_lt hB), diff --git a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean index 9958e44ebcd81e..c37f74369ab91d 100644 --- a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean +++ b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/FundamentalCone.lean @@ -216,7 +216,7 @@ theorem smul_mem_of_mem (hx : x ∈ fundamentalCone K) (hc : c ≠ 0) : refine ⟨?_, ?_⟩ · rw [Set.mem_preimage, logMap_real_smul hx.2 hc] exact hx.1 - · rw [Set.mem_setOf_eq, mixedEmbedding.norm_smul, mul_eq_zero, not_or] + · rw [Set.mem_ofPred_eq, mixedEmbedding.norm_smul, mul_eq_zero, not_or] exact ⟨pow_ne_zero _ (abs_ne_zero.mpr hc), hx.2⟩ theorem smul_mem_iff_mem (hc : c ≠ 0) : @@ -239,7 +239,7 @@ theorem torsion_smul_mem_of_mem (hx : x ∈ fundamentalCone K) {ζ : (𝓞 K)ˣ} constructor · rw [Set.mem_preimage, logMap_torsion_smul _ hζ] exact hx.1 - · rw [Set.mem_setOf_eq, unitSMul_smul, map_mul, norm_unit, one_mul] + · rw [Set.mem_ofPred_eq, unitSMul_smul, map_mul, norm_unit, one_mul] exact hx.2 theorem unit_smul_mem_iff_mem_torsion (hx : x ∈ fundamentalCone K) (u : (𝓞 K)ˣ) : diff --git a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean index dcf939ca237774..c61b839ef9378e 100644 --- a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean +++ b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/NormLeOne.lean @@ -150,7 +150,7 @@ theorem norm_normAtAllPlaces (x : mixedSpace K) : theorem normAtAllPlaces_mem_fundamentalCone_iff {x : mixedSpace K} : mixedSpaceOfRealSpace (normAtAllPlaces x) ∈ fundamentalCone K ↔ x ∈ fundamentalCone K := by simp_rw [fundamentalCone, Set.mem_sdiff, Set.mem_preimage, logMap_normAtAllPlaces, - Set.mem_setOf_eq, norm_normAtAllPlaces] + Set.mem_ofPred_eq, norm_normAtAllPlaces] end normAtAllPlaces @@ -161,7 +161,8 @@ variable [NumberField K] /-- The set of elements of the `fundamentalCone` of `norm ≤ 1`. -/ -abbrev normLeOne : Set (mixedSpace K) := fundamentalCone K ∩ {x | mixedEmbedding.norm x ≤ 1} +noncomputable abbrev normLeOne : Set (mixedSpace K) := + fundamentalCone K ∩ {x | mixedEmbedding.norm x ≤ 1} variable {K} in theorem mem_normLeOne {x : mixedSpace K} : @@ -195,8 +196,8 @@ theorem normAtAllPlaces_normLeOne : refine ⟨⟨⟨?_, ?_⟩, ?_⟩, ?_⟩ · rwa [Set.mem_preimage, ← logMap_normAtAllPlaces] at h₁ · exact fun w ↦ normAtPlace_nonneg w y - · rwa [Set.mem_setOf_eq, ← norm_normAtAllPlaces] at h₂ - · rwa [Set.mem_setOf_eq, ← norm_normAtAllPlaces] at h₃ + · rwa [Set.mem_ofPred_eq, ← norm_normAtAllPlaces] at h₂ + · rwa [Set.mem_ofPred_eq, ← norm_normAtAllPlaces] at h₃ · exact ⟨mixedSpaceOfRealSpace x, ⟨⟨h₁, h₃⟩, h₄⟩, normAtAllPlaces_mixedSpaceOfRealSpace h₂⟩ end normLeOne_def @@ -633,7 +634,7 @@ open scoped Classical in The set that parametrizes `normAtAllPlaces '' (normLeOne K)`, see `normAtAllPlaces_normLeOne_eq_image`. -/ -abbrev paramSet : Set (realSpace K) := +noncomputable abbrev paramSet : Set (realSpace K) := Set.univ.pi fun w ↦ if w = w₀ then Set.Iic 0 else Set.Ico 0 1 theorem measurableSet_paramSet : @@ -658,7 +659,7 @@ theorem normAtAllPlaces_normLeOne_eq_image : ext x by_cases hx : ∀ w, 0 < x w · rw [← expMapBasis.right_inv (Set.mem_univ_pi.mpr hx), (injective_expMapBasis K).mem_set_image] - simp only [normAtAllPlaces_normLeOne, Set.mem_inter_iff, Set.mem_setOf_eq, expMapBasis_nonneg, + simp only [normAtAllPlaces_normLeOne, Set.mem_inter_iff, Set.mem_ofPred_eq, expMapBasis_nonneg, Set.mem_preimage, logMap_expMapBasis, implies_true, and_true, norm_expMapBasis, pow_le_one_iff_of_nonneg (Real.exp_nonneg _) Module.finrank_pos.ne', Real.exp_le_one_iff, ne_eq, pow_eq_zero_iff', Real.exp_ne_zero, false_and, not_false_eq_true, Set.mem_univ_pi] @@ -687,7 +688,8 @@ theorem subset_interior_normLeOne : open ENNReal MeasureTheory -theorem closure_paramSet_ae_interior : closure (paramSet K) =ᵐ[volume] interior (paramSet K) := by +theorem closure_paramSet_ae_interior : + closure (paramSet K) =ᵐˢ[volume] interior (paramSet K) := by rw [closure_paramSet, interior_paramSet, volume_pi] refine Measure.ae_eq_set_pi fun w _ ↦ ?_ split_ifs @@ -720,7 +722,7 @@ open scoped Classical in A compact set that contains `expMapBasis '' closure (paramSet K)` and furthermore is almost equal to it, see `compactSet_ae`. -/ -abbrev compactSet : Set (realSpace K) := +noncomputable abbrev compactSet : Set (realSpace K) := (Set.Icc (0 : ℝ) 1) • (expMapBasis '' Set.univ.pi fun w ↦ if w = w₀ then {0} else Set.Icc 0 1) theorem isCompact_compactSet : @@ -802,9 +804,9 @@ theorem closure_normLeOne_subset : open MeasureTheory theorem compactSet_ae : - compactSet K =ᵐ[volume] expMapBasis '' closure (paramSet K) := by + compactSet K =ᵐˢ[volume] expMapBasis '' closure (paramSet K) := by rw [compactSet_eq_union] - exact union_ae_eq_left_of_ae_eq_empty (by simp) + exact union_ae_eq_left_of_ae_eq_empty (ae_eq_empty.2 (by simp)) end compactSet diff --git a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/PolarCoord.lean b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/PolarCoord.lean index a01452ffe40947..7c0815d6a9a073 100644 --- a/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/PolarCoord.lean +++ b/Mathlib/NumberTheory/NumberField/CanonicalEmbedding/PolarCoord.lean @@ -132,7 +132,7 @@ theorem det_fderivPolarCoordRealSymm (x : realMixedSpace K) : open scoped Classical in theorem polarCoordReal_symm_target_ae_eq_univ : - (polarCoordReal K).symm '' (polarCoordReal K).target =ᵐ[volume] Set.univ := by + (polarCoordReal K).symm '' (polarCoordReal K).target =ᵐˢ[volume] Set.univ := by rw [← Set.univ_prod_univ, volume_eq_prod, (polarCoordReal K).symm_image_target_eq_source, polarCoordReal_source, ← polarCoord.symm_image_target_eq_source, ← Set.piMap_image_univ_pi] exact set_prod_ae_eq .rfl pi_polarCoord_symm_target_ae_eq_univ @@ -430,7 +430,7 @@ private theorem volume_eq_two_pow_mul_two_pi_pow_mul_integral_aux using (ha₂ ⟨w, hw⟩).le · rw [normAtAllPlaces_apply, normAtPlace_apply_of_isComplex hw, normAtComplexPlaces_apply_isComplex ⟨w, hw⟩] - · simpa [Set.mem_setOf_eq, normAtComplexPlaces_apply_isReal] using (ha₂ w).ne' + · simpa [Set.mem_ofPred_eq, normAtComplexPlaces_apply_isReal] using (ha₂ w).ne' open scoped Classical in /-- diff --git a/Mathlib/NumberTheory/NumberField/Completion/FinitePlace.lean b/Mathlib/NumberTheory/NumberField/Completion/FinitePlace.lean index 2d4baf22f6d9b5..7c50e96b7187cd 100644 --- a/Mathlib/NumberTheory/NumberField/Completion/FinitePlace.lean +++ b/Mathlib/NumberTheory/NumberField/Completion/FinitePlace.lean @@ -425,7 +425,7 @@ theorem hasFiniteMulSupport_int {x : 𝓞 K} (h_x_nezero : x ≠ 0) : have h_inj : Set.InjOn FinitePlace.maximalIdeal {w | w.maximalIdeal.asIdeal ∣ span {x}} := Function.Injective.injOn maximalIdeal_injective refine (h.subset ?_).of_finite_image h_inj - simp only [dvd_span_singleton, Set.image_subset_iff, Set.preimage_setOf_eq, subset_refl] + simp only [dvd_span_singleton, Set.image_subset_iff, Set.preimage_ofPred_eq, subset_refl] @[deprecated (since := "2026-03-03")] alias mulSupport_finite_int := hasFiniteMulSupport_int diff --git a/Mathlib/NumberTheory/NumberField/Completion/Ramification.lean b/Mathlib/NumberTheory/NumberField/Completion/Ramification.lean index e2b367b8760508..ab6b57169d548e 100644 --- a/Mathlib/NumberTheory/NumberField/Completion/Ramification.lean +++ b/Mathlib/NumberTheory/NumberField/Completion/Ramification.lean @@ -100,11 +100,11 @@ theorem inertiaDeg_eq_finrank [w.1.LiesOver v.1] : variable {v w} in theorem inertiaDeg_eq_one (hw : w ∈ unramifiedPlacesOver L v) : v.inertiaDeg w = 1 := - have := (Set.mem_setOf.1 hw).1; finrank_eq_one_of_isUnramified v hw.2 ▸ inertiaDeg_eq_finrank v w + have := (Set.mem_ofPred.1 hw).1; finrank_eq_one_of_isUnramified v hw.2 ▸ inertiaDeg_eq_finrank v w variable {v w} in theorem inertiaDeg_eq_two (hw : w ∈ ramifiedPlacesOver L v) : v.inertiaDeg w = 2 := - have := (Set.mem_setOf.1 hw).1; finrank_eq_two_of_isRamified v hw.2 ▸ inertiaDeg_eq_finrank v w + have := (Set.mem_ofPred.1 hw).1; finrank_eq_two_of_isRamified v hw.2 ▸ inertiaDeg_eq_finrank v w variable (K L) in open scoped Classical in diff --git a/Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean b/Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean index e177981d40d19d..b2b6fdd007c5ce 100644 --- a/Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean +++ b/Mathlib/NumberTheory/NumberField/Cyclotomic/Basic.lean @@ -137,7 +137,7 @@ theorem cyclotomicRing_isIntegralClosure_of_prime_pow : refine ⟨IsFractionRing.injective _ _, @fun x => ⟨fun h => ⟨⟨x, ?_⟩, rfl⟩, ?_⟩⟩ · obtain ⟨y, rfl⟩ := (isIntegralClosure_adjoin_singleton_of_prime_pow hζ).isIntegral_iff.1 h refine adjoin_mono ?_ y.2 - simp only [Set.singleton_subset_iff, Set.mem_setOf_eq] + simp only [Set.singleton_subset_iff, Set.mem_ofPred_eq] exact hζ.pow_eq_one · rintro ⟨y, rfl⟩ exact IsIntegral.algebraMap ((IsCyclotomicExtension.integral {p ^ k} ℤ _).isIntegral _) @@ -818,7 +818,7 @@ theorem cyclotomicRing_isIntegralClosure : refine ⟨IsFractionRing.injective _ _, fun {x} => ⟨fun h => ⟨⟨x, ?_⟩, rfl⟩, ?_⟩⟩ · obtain ⟨y, rfl⟩ := (isIntegralClosure_adjoin_singleton hζ).isIntegral_iff.1 h refine adjoin_mono ?_ y.2 - simp only [Set.singleton_subset_iff, Set.mem_setOf_eq] + simp only [Set.singleton_subset_iff, Set.mem_ofPred_eq] exact hζ.pow_eq_one · rintro ⟨y, rfl⟩ exact IsIntegral.algebraMap ((IsCyclotomicExtension.integral {n} ℤ _).isIntegral _) diff --git a/Mathlib/NumberTheory/NumberField/DedekindZeta.lean b/Mathlib/NumberTheory/NumberField/DedekindZeta.lean index 3c3d6b09835a76..21e3ce4065fab4 100644 --- a/Mathlib/NumberTheory/NumberField/DedekindZeta.lean +++ b/Mathlib/NumberTheory/NumberField/DedekindZeta.lean @@ -83,7 +83,7 @@ theorem tendsto_sub_one_mul_dedekindZeta_nhdsGT : show Finset.Icc 1 n = Finset.Ioc 0 n from Finset.Icc_succ_left_eq_Ioc _ _, show 1 = Nat.card {I : Ideal (𝓞 K) // absNorm I = 0} by simp [Ideal.absNorm_eq_zero_iff], Finset.sum_Ioc_add_eq_sum_Icc (n.zero_le), - ← Finset.card_preimage_eq_sum_card_image_eq (fun k _ ↦ finite_setOf_absNorm_eq k)] + ← Finset.card_preimage_eq_sum_card_image_eq (fun k _ ↦ finite_setOfPred_absNorm_eq k)] simp [Set.coe_eq_subtype] end NumberField diff --git a/Mathlib/NumberTheory/NumberField/Ideal/Asymptotics.lean b/Mathlib/NumberTheory/NumberField/Ideal/Asymptotics.lean index e149e1a95598ba..4c2260b8994485 100644 --- a/Mathlib/NumberTheory/NumberField/Ideal/Asymptotics.lean +++ b/Mathlib/NumberTheory/NumberField/Ideal/Asymptotics.lean @@ -136,7 +136,7 @@ theorem tendsto_norm_le_div_atTop₀ : · filter_upwards [eventually_ge_atTop 0] with s hs have : Fintype {I : (Ideal (𝓞 K))⁰ // absNorm (I : Ideal (𝓞 K)) ≤ s} := by simp_rw [← Nat.le_floor_iff hs] - refine @Fintype.ofFinite _ (finite_setOf_absNorm_le₀ ⌊s⌋₊) + refine @Fintype.ofFinite _ (finite_setOfPred_absNorm_le₀ ⌊s⌋₊) let e := fun C : ClassGroup (𝓞 K) ↦ Equiv.subtypeSubtypeEquivSubtypeInter (fun I : (Ideal (𝓞 K))⁰ ↦ absNorm I.1 ≤ s) (fun I ↦ ClassGroup.mk0 I = C) simp_rw [← Nat.card_congr (e _), Nat.card_eq_fintype_card, Fintype.subtype_card] diff --git a/Mathlib/NumberTheory/NumberField/InfinitePlace/Basic.lean b/Mathlib/NumberTheory/NumberField/InfinitePlace/Basic.lean index 5baa65ba634bb0..1d612f239cc1fa 100644 --- a/Mathlib/NumberTheory/NumberField/InfinitePlace/Basic.lean +++ b/Mathlib/NumberTheory/NumberField/InfinitePlace/Basic.lean @@ -436,7 +436,8 @@ theorem card_eq_nrRealPlaces_add_nrComplexPlaces : classical convert! Fintype.card_subtype_or_disjoint (IsReal (K := K)) (IsComplex (K := K)) - (disjoint_isReal_isComplex K) using 1 + (Pi.disjoint_iff.mpr fun w ↦ Prop.disjoint_iff.mpr fun ⟨h1, h2⟩ ↦ + not_isReal_iff_isComplex.mpr h2 h1) using 1 exact (Fintype.card_of_subtype _ (fun w ↦ ⟨fun _ ↦ isReal_or_isComplex w, fun _ ↦ by simp⟩)).symm open scoped Classical in diff --git a/Mathlib/NumberTheory/NumberField/InfinitePlace/Embeddings.lean b/Mathlib/NumberTheory/NumberField/InfinitePlace/Embeddings.lean index b6646e9377dd59..b166a808bfd0c3 100644 --- a/Mathlib/NumberTheory/NumberField/InfinitePlace/Embeddings.lean +++ b/Mathlib/NumberTheory/NumberField/InfinitePlace/Embeddings.lean @@ -125,7 +125,7 @@ theorem pow_eq_one_of_norm_le_one {x : K} (hx₀ : x ≠ 0) (hxi : IsIntegral (hx : ∀ φ : K →+* A, ‖φ x‖ ≤ 1) : ∃ (n : ℕ) (_ : 0 < n), x ^ n = 1 := by obtain ⟨a, -, b, -, habne, h⟩ := Set.Infinite.exists_ne_map_eq_of_mapsTo (f := (x ^ · : ℕ → K)) Set.infinite_univ - (fun a _ => mem_setOf.mpr <| + (fun a _ => mem_ofPred.mpr <| ⟨hxi.pow a, fun φ => by simp [pow_le_one₀ (norm_nonneg (φ x)) <| hx φ]⟩) (finite_of_norm_le K A (1 : ℝ)) wlog hlt : b < a @@ -375,7 +375,7 @@ theorem disjoint_unmixedEmbeddingsOver_mixedEmbeddingsOver : theorem union_unmixedEmbeddingsOver_mixedEmbeddingsOver : (unmixedEmbeddingsOver L ψ) ∪ (mixedEmbeddingsOver L ψ) = { φ | ComplexEmbedding.LiesOver φ ψ } := by - grind [unmixedEmbeddingsOver, mixedEmbeddingsOver, ← Set.setOf_or] + grind [unmixedEmbeddingsOver, mixedEmbeddingsOver, ← Set.ofPred_or] end Extension diff --git a/Mathlib/NumberTheory/NumberField/InfinitePlace/Ramification.lean b/Mathlib/NumberTheory/NumberField/InfinitePlace/Ramification.lean index 521e28ad4eb9e7..7ad43edf401d60 100644 --- a/Mathlib/NumberTheory/NumberField/InfinitePlace/Ramification.lean +++ b/Mathlib/NumberTheory/NumberField/InfinitePlace/Ramification.lean @@ -694,7 +694,7 @@ theorem disjoint_ramifiedPlacesOver_unramifiedPlacesOver : theorem union_ramifiedPlacesOver_unramifiedPlacesOver : (ramifiedPlacesOver L v) ∪ (unramifiedPlacesOver L v) = placesOver L v := by - rw [placesOver, ramifiedPlacesOver, unramifiedPlacesOver, ← Set.setOf_or] + rw [placesOver, ramifiedPlacesOver, unramifiedPlacesOver, ← Set.ofPred_or] grind theorem bijOn_sumElim_conjugate : @@ -773,7 +773,7 @@ theorem unramifedPlacesOver_ncard_add_eq_finrank [NumberField K] [NumberField L] union_unmixedEmbeddingsOver_mixedEmbeddingsOver, Set.ncard_eq_toFinset_card] apply (card_nbij AlgHom.toRingHom (fun σ _ ↦ by simpa using ⟨by aesop⟩) AlgHom.coe_ringHom_injective.injOn (fun ψ hψ ↦ ?_)).symm - simp only [Set.Finite.toFinset_setOf, coe_filter, mem_univ, true_and, Set.mem_setOf_eq] at hψ + simp only [Set.Finite.toFinset_ofPred, coe_filter, mem_univ, true_and, Set.mem_ofPred_eq] at hψ exact ⟨⟨ψ, fun _ ↦ by simp [RingHom.algebraMap_toAlgebra, ← hψ.over]⟩, by simp⟩ end placesOver diff --git a/Mathlib/NumberTheory/NumberField/ProductFormula.lean b/Mathlib/NumberTheory/NumberField/ProductFormula.lean index 0a89c7a85a2412..75e0dd59eea782 100644 --- a/Mathlib/NumberTheory/NumberField/ProductFormula.lean +++ b/Mathlib/NumberTheory/NumberField/ProductFormula.lean @@ -58,7 +58,7 @@ theorem FinitePlace.prod_eq_inv_abs_norm_int {x : 𝓞 K} (h_x_nezero : x ≠ 0) have h_fin₁ : t₁.Finite := h_fin₀.subset <| by simp [norm_eq_one_iff_notMem, t₁, t₀] have h_fin₂ : t₂.Finite := by refine h_fin₀.subset ?_ - simp only [mulSupport_subset_iff, Set.mem_setOf_eq, t₂, t₀, + simp only [mulSupport_subset_iff, Set.mem_ofPred_eq, t₂, t₀, maxPowDividing, ← dvd_span_singleton] intro v hv simp only [map_pow, Nat.cast_pow, ← pow_zero (absNorm v.asIdeal : ℝ)] at hv diff --git a/Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean b/Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean index c9a4d626332a35..ff02345e7ee526 100644 --- a/Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean +++ b/Mathlib/NumberTheory/NumberField/Units/DirichletTheorem.lean @@ -309,8 +309,8 @@ theorem exists_unit (w₁ : InfinitePlace K) : rw [map_inv₀, mul_inv_lt_iff₀' (pos_iff.mpr (seq_ne_zero K w₁ hB n)), mul_one] exact seq_decreasing K w₁ hB hnm w hw refine Set.Finite.exists_lt_map_eq_of_forall_mem (t := {I : Ideal (𝓞 K) | Ideal.absNorm I ≤ B}) - (fun n ↦ ?_) (Ideal.finite_setOf_absNorm_le B) - rw [Set.mem_setOf_eq, Ideal.absNorm_span_singleton] + (fun n ↦ ?_) (Ideal.finite_setOfPred_absNorm_le B) + rw [Set.mem_ofPred_eq, Ideal.absNorm_span_singleton] exact seq_norm_le K w₁ hB n theorem unitLattice_span_eq_top : diff --git a/Mathlib/NumberTheory/Padics/WithVal.lean b/Mathlib/NumberTheory/Padics/WithVal.lean index 6a48f60d4d30c2..d5ecce1a186311 100644 --- a/Mathlib/NumberTheory/Padics/WithVal.lean +++ b/Mathlib/NumberTheory/Padics/WithVal.lean @@ -44,7 +44,7 @@ lemma isUniformInducing_cast_withVal : IsUniformInducing ((Rat.castHom ℚ_[p]). have hp1 : (p : ℝ)⁻¹ < 1 := by simp [inv_lt_one_iff₀, Nat.Prime.one_lt Fact.out] rw [Filter.HasBasis.isUniformInducing_iff (Valued.hasBasis_uniformity _ _) (Metric.uniformity_basis_dist_le_pow hp0 hp1)] - simp only [Set.mem_setOf_eq, dist_eq_norm_sub, inv_pow, RingEquiv.toRingHom_eq_coe, + simp only [Set.mem_ofPred_eq, dist_eq_norm_sub, inv_pow, RingEquiv.toRingHom_eq_coe, RingHom.coe_comp, Rat.coe_castHom, RingHom.coe_coe, Function.comp_apply, ← Rat.cast_sub, ← map_sub, Padic.eq_padicNorm, true_and, forall_const] constructor @@ -176,9 +176,13 @@ theorem withValUniformEquiv_norm_le_one_iff {p : ℕ} [Fact p.Prime] ‖Padic.withValUniformEquiv x‖ ≤ 1 ↔ Valued.v x ≤ 1 := by induction x using UniformSpace.Completion.induction_on with | hp => - rw [Set.ext fun _ ↦ Iff.comm] + have : {x : (Rat.padicValuation p).Completion | + ‖Padic.withValUniformEquiv x‖ ≤ 1 ↔ Valued.v x ≤ 1} = + {x | Valued.v x ≤ 1 ↔ ‖Padic.withValUniformEquiv x‖ ≤ 1} := + Set.ext fun _ ↦ Iff.comm + rw [this] simp_rw [← Valuation.restrict_le_one_iff Valued.v] - apply withValUniformEquiv.toHomeomorph.isClosed_setOf_iff (q := fun x ↦ ‖x‖ ≤ 1) + apply withValUniformEquiv.toHomeomorph.isClosed_setOfPred_iff (q := fun x ↦ ‖x‖ ≤ 1) (Valued.isClopen_closedBall _ one_ne_zero) simpa [Metric.closedBall] using IsUltrametricDist.isClopen_closedBall (0 : ℚ_[p]) one_ne_zero | ih a => diff --git a/Mathlib/NumberTheory/Pell.lean b/Mathlib/NumberTheory/Pell.lean index 8b68eb9388aeb0..83cce8a9e31408 100644 --- a/Mathlib/NumberTheory/Pell.lean +++ b/Mathlib/NumberTheory/Pell.lean @@ -333,25 +333,25 @@ theorem exists_of_not_isSquare (h₀ : 0 < d) (hd : ¬IsSquare d) : refine Infinite.mono (fun q h => ?_) (infinite_rat_abs_sub_lt_one_div_den_sq_of_irrational hξ) have h0 : 0 < (q.2 : ℝ) ^ 2 := pow_pos (Nat.cast_pos.mpr q.pos) 2 have h1 : (q.num : ℝ) / (q.den : ℝ) = q := mod_cast q.num_div_den - rw [mem_setOf, abs_sub_comm, ← @Int.cast_lt ℝ, + rw [mem_ofPred, abs_sub_comm, ← @Int.cast_lt ℝ, ← div_lt_div_iff_of_pos_right (abs_pos_of_pos h0)] push_cast rw [← abs_div, abs_sq, sub_div, mul_div_cancel_right₀ _ h0.ne', ← div_pow, h1, ← sq_sqrt (Int.cast_pos.mpr h₀).le, sq_sub_sq, abs_mul, ← mul_one_div] refine mul_lt_mul'' (((abs_add_le ξ q).trans ?_).trans_lt hM₁) h (abs_nonneg _) (abs_nonneg _) rw [two_mul, add_assoc, add_le_add_iff_left, ← sub_le_iff_le_add'] - rw [mem_setOf, abs_sub_comm] at h + rw [mem_ofPred, abs_sub_comm] at h refine (abs_sub_abs_le_abs_sub (q : ℝ) ξ).trans (h.le.trans ?_) rw [div_le_one h0, one_le_sq_iff_one_le_abs, Nat.abs_cast, Nat.one_le_cast] exact q.pos obtain ⟨m, hm⟩ : ∃ m : ℤ, {q : ℚ | q.1 ^ 2 - d * (q.den : ℤ) ^ 2 = m}.Infinite := by contrapose! hM refine (congr_arg _ (ext fun x => ?_)).mp (Finite.biUnion (finite_Ioo (-M) M) fun m _ => hM m) - simp only [abs_lt, mem_setOf, mem_Ioo, mem_iUnion, exists_prop, exists_eq_right'] + simp only [abs_lt, mem_ofPred, mem_Ioo, mem_iUnion, exists_prop, exists_eq_right'] have hm₀ : m ≠ 0 := by rintro rfl obtain ⟨q, hq⟩ := hm.nonempty - rw [mem_setOf, sub_eq_zero, mul_comm] at hq + rw [mem_ofPred, sub_eq_zero, mul_comm] at hq obtain ⟨a, ha⟩ := (Int.pow_dvd_pow_iff two_ne_zero).mp ⟨d, hq⟩ rw [ha, mul_pow, mul_right_inj' (pow_pos (Int.natCast_pos.mpr q.pos) 2).ne'] at hq exact hd ⟨a, sq a ▸ hq.symm⟩ diff --git a/Mathlib/NumberTheory/PrimeCounting.lean b/Mathlib/NumberTheory/PrimeCounting.lean index 094ba7830c3724..a9d6b59349f06c 100644 --- a/Mathlib/NumberTheory/PrimeCounting.lean +++ b/Mathlib/NumberTheory/PrimeCounting.lean @@ -77,14 +77,14 @@ theorem monotone_primeCounting : Monotone primeCounting := @[simp] theorem primeCounting'_nth_eq (n : ℕ) : π' (nth Prime n) = n := - count_nth_of_infinite infinite_setOf_prime _ + count_nth_of_infinite infinite_setOfPred_prime _ /-- The `n`th prime is greater or equal to `n + 2`. -/ theorem add_two_le_nth_prime (n : ℕ) : n + 2 ≤ nth Prime n := - nth_prime_zero_eq_two ▸ (nth_strictMono infinite_setOf_prime).add_le_nat n 0 + nth_prime_zero_eq_two ▸ (nth_strictMono infinite_setOfPred_prime).add_le_nat n 0 theorem surjective_primeCounting' : Function.Surjective π' := - Nat.surjective_count_of_infinite_setOf infinite_setOf_prime + Nat.surjective_count_of_infinite_setOfPred infinite_setOfPred_prime theorem surjective_primeCounting : Function.Surjective π := by suffices Function.Surjective (π ∘ fun n => n - 1) from this.of_comp @@ -103,7 +103,7 @@ theorem tendsto_primeCounting : Tendsto π atTop atTop := @[simp] theorem prime_nth_prime (n : ℕ) : Prime (nth Prime n) := - nth_mem_of_infinite infinite_setOf_prime _ + nth_mem_of_infinite infinite_setOfPred_prime _ @[simp] lemma primeCounting'_eq_zero_iff {n : ℕ} : n.primeCounting' = 0 ↔ n ≤ 2 := by diff --git a/Mathlib/NumberTheory/PrimesCongruentOne.lean b/Mathlib/NumberTheory/PrimesCongruentOne.lean index 0d250aa0429b1a..a86dc9c89cf78c 100644 --- a/Mathlib/NumberTheory/PrimesCongruentOne.lean +++ b/Mathlib/NumberTheory/PrimesCongruentOne.lean @@ -65,8 +65,11 @@ theorem frequently_atTop_modEq_one {k : ℕ} (hk0 : k ≠ 0) : exact ⟨p, ⟨hp.2.1.le, hp.1, hp.2.2⟩⟩ /-- For any positive `k : ℕ` there are infinitely many primes `p` such that `p ≡ 1 [MOD k]`. -/ -theorem infinite_setOf_prime_modEq_one {k : ℕ} (hk0 : k ≠ 0) : +theorem infinite_setOfPred_prime_modEq_one {k : ℕ} (hk0 : k ≠ 0) : Set.Infinite {p : ℕ | Nat.Prime p ∧ p ≡ 1 [MOD k]} := frequently_atTop_iff_infinite.1 (frequently_atTop_modEq_one hk0) +@[deprecated (since := "2026-07-09")] +alias infinite_setOf_prime_modEq_one := infinite_setOfPred_prime_modEq_one + end Nat diff --git a/Mathlib/NumberTheory/RamificationInertia/Ramification.lean b/Mathlib/NumberTheory/RamificationInertia/Ramification.lean index 4e5a335aecebcf..40330be6bec06c 100644 --- a/Mathlib/NumberTheory/RamificationInertia/Ramification.lean +++ b/Mathlib/NumberTheory/RamificationInertia/Ramification.lean @@ -71,7 +71,7 @@ variable {p P} theorem ramificationIdx'_eq_find [DecidablePred fun n ↦ ∀ (k : ℕ), map f p ≤ P ^ k → k ≤ n] (h : ∃ n, ∀ k, map f p ≤ P ^ k → k ≤ n) : ramificationIdx' p P = Nat.find h := by - convert! Nat.sSup_def h + convert! Nat.sSup_def (s := {n | map f p ≤ P ^ n}) h @[deprecated (since := "2026-07-01")] alias ramificationIdx_eq_find := ramificationIdx'_eq_find @@ -166,7 +166,7 @@ lemma ramificationIdx'_comap_eq (e : S ≃ₐ[R] S₁) (P : Ideal S₁) : dsimp only [ramificationIdx'] congr 1 ext n - simp only [Set.mem_setOf_eq, Ideal.map_le_iff_le_comap] + simp only [Set.mem_ofPred_eq, Ideal.map_le_iff_le_comap] rw [← comap_coe e, ← e.toRingEquiv_toRingHom, comap_coe, ← RingEquiv.symm_symm (e : S ≃+* S₁), ← map_comap_of_equiv, ← Ideal.map_pow, map_comap_of_equiv, ← comap_coe (RingEquiv.symm _), comap_comap, RingEquiv.symm_symm, e.toRingEquiv_toRingHom, ← e.toAlgHom_toRingHom, diff --git a/Mathlib/NumberTheory/RamificationInertia/Valuation.lean b/Mathlib/NumberTheory/RamificationInertia/Valuation.lean index 8af1bd6a3711a9..ad14d189ee8534 100644 --- a/Mathlib/NumberTheory/RamificationInertia/Valuation.lean +++ b/Mathlib/NumberTheory/RamificationInertia/Valuation.lean @@ -95,7 +95,7 @@ theorem uniformContinuous_algebraMap_liesOver : let γK := σvV.symm (σK.symm (σv.symm (exp (m.log / e)))) have hγK : γK ≠ 0 := by simp [γK, EmbeddingLike.map_eq_zero_iff (f := σK.symm)] use .mk0 _ hγK - simp only [Units.val_mk0, Set.mem_setOf_eq, true_and] + simp only [Units.val_mk0, Set.mem_ofPred_eq, true_and] intro x hx rcases eq_or_ne x 0 with rfl | hx₀; · simp rw [σvV.lt_symm_apply, σK.lt_symm_apply, σv.lt_symm_apply, diff --git a/Mathlib/NumberTheory/RatFunc/Ostrowski.lean b/Mathlib/NumberTheory/RatFunc/Ostrowski.lean index 9e9ea867ed3d8e..4e7cbad0f07236 100644 --- a/Mathlib/NumberTheory/RatFunc/Ostrowski.lean +++ b/Mathlib/NumberTheory/RatFunc/Ostrowski.lean @@ -60,7 +60,7 @@ end Infinity open IsDedekindDomain HeightOneSpectrum Set Valuation Polynomial -lemma setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty [v.IsNontrivial] [v.IsTrivialOn K] +lemma setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty [v.IsNontrivial] [v.IsTrivialOn K] (hle : v RatFunc.X ≤ 1) : {p : K[X] | v p < 1 ∧ p ≠ 0}.Nonempty := by obtain ⟨w, h0, h1⟩ := IsNontrivial.exists_lt_one (v := v) induction w using RatFunc.induction_on with @@ -73,6 +73,10 @@ lemma setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty [v.IsNontrivial] [v exact fun r hr hr0 ↦ ⟨r, lt_iff_le_and_ne.mpr ⟨Polynomial.valuation_le_one_of_valuation_X_le_one _ hle r, hr⟩, hr0⟩ +@[deprecated (since := "2026-07-09")] +alias setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty := + setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty + private lemma one_le_valuation_factor (hne : {p : K[X] | v p < 1 ∧ p ≠ 0}.Nonempty) {a b : K[X]} (hab : v ↑(a * b) < 1 ∧ a ≠ 0 ∧ b ≠ 0) (hπᵥ : degree_lt_wf.min _ hne = a * b) (hb : ¬IsUnit b) : 1 ≤ v ↑a := by @@ -109,18 +113,18 @@ variable [v.IsNontrivial] [v.IsTrivialOn K] (hle : v RatFunc.X ≤ 1) /-- A uniformizing element for the valuation `v`, as a polynomial in `K[X]`. -/ abbrev uniformizingPolynomial : K[X] := - WellFounded.min degree_lt_wf _ (setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty hle) + WellFounded.min degree_lt_wf _ (setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty hle) @[inherit_doc] local notation "πᵥ" => uniformizingPolynomial hle lemma uniformizingPolynomial_ne_zero : πᵥ ≠ 0 := by - have := degree_lt_wf.min_mem _ (setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty hle) + have := degree_lt_wf.min_mem _ (setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty hle) simp_all [uniformizingPolynomial] lemma valuation_uniformizingPolynomial_lt_one : v πᵥ < 1 := by simpa using! (degree_lt_wf.min_mem _ - (setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty hle)).1 + (setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty hle)).1 open Ideal in /-- The maximal ideal of `K[X]` generated by the `uniformizingPolynomial` for `v`. -/ @@ -128,7 +132,7 @@ def valuationIdeal : HeightOneSpectrum K[X] where asIdeal := Submodule.span K[X] {πᵥ} isPrime := IsMaximal.isPrime (PrincipalIdealRing.isMaximal_of_irreducible (irreducible_min_polynomial_valuation_lt_one_and_ne_zero - (setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty hle))) + (setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty hle))) ne_bot := by simpa using uniformizingPolynomial_ne_zero hle @[inherit_doc] @@ -142,11 +146,11 @@ lemma valuation_eq_valuation_uniformizingPolynomial_pow_of_valuation_X_le_one {p v (algebraMap K[X] (RatFunc K) p) = v (πᵥ ^ ((Associates.mk (Pᵥ).asIdeal).count (Associates.mk (Ideal.span {p})).factors)) := by set π := πᵥ - have hne := setOf_polynomial_valuation_lt_one_and_ne_zero_nonempty hle + have hne := setOfPred_polynomial_valuation_lt_one_and_ne_zero_nonempty hle have hπirr : Irreducible π := irreducible_min_polynomial_valuation_lt_one_and_ne_zero hne obtain ⟨k, q, hnq, heq⟩ := WfDvdMonoid.max_power_factor hp hπirr have hπ : π ∈ _ := degree_lt_wf.min_mem _ hne - simp only [ne_eq, mem_setOf] at hπ + simp only [ne_eq, mem_ofPred] at hπ nth_rw 1 [heq] simp only [map_mul, map_pow] suffices v (algebraMap K[X] (RatFunc K) q) = 1 by diff --git a/Mathlib/NumberTheory/Rayleigh.lean b/Mathlib/NumberTheory/Rayleigh.lean index 6f5a2a7626abe6..2c67001a17862a 100644 --- a/Mathlib/NumberTheory/Rayleigh.lean +++ b/Mathlib/NumberTheory/Rayleigh.lean @@ -140,9 +140,9 @@ theorem beattySeq_symmDiff_beattySeq'_pos {r s : ℝ} (hrs : r.HolderConjugate s {beattySeq r k | k > 0} ∆ {beattySeq' s k | k > 0} = {n | 0 < n} := by apply Set.eq_of_subset_of_subset · rintro j (⟨⟨k, hk, hjk⟩, -⟩ | ⟨⟨k, hk, hjk⟩, -⟩) - · rw [Set.mem_setOf_eq, ← hjk, beattySeq, Int.floor_pos] + · rw [Set.mem_ofPred_eq, ← hjk, beattySeq, Int.floor_pos] exact one_le_mul_of_one_le_of_one_le (by norm_cast) hrs.lt.le - · rw [Set.mem_setOf_eq, ← hjk, beattySeq', sub_pos, Int.lt_ceil, Int.cast_one] + · rw [Set.mem_ofPred_eq, ← hjk, beattySeq', sub_pos, Int.lt_ceil, Int.cast_one] exact one_lt_mul_of_le_of_lt (by norm_cast) hrs.symm.lt intro j (hj : 0 < j) have hb₁ : ∀ s ≥ 0, j ∈ {beattySeq s k | k > 0} ↔ j ∈ {beattySeq s k | k} := by diff --git a/Mathlib/NumberTheory/SelbergSieve.lean b/Mathlib/NumberTheory/SelbergSieve.lean index af6311cc74e0c1..10a994679cbcbf 100644 --- a/Mathlib/NumberTheory/SelbergSieve.lean +++ b/Mathlib/NumberTheory/SelbergSieve.lean @@ -315,7 +315,8 @@ theorem nu_inv_eq_sum_divisors_inv_selbergTerms {d : ℕ} (hdP : d ∣ s.prodPri rw [eq_comm, ←sum_filter, Nat.divisors_filter_dvd_of_dvd prodPrimes_ne_zero hdP] have hd_pos : 0 < d := Nat.pos_of_ne_zero <| ne_zero_of_dvd_ne_zero prodPrimes_ne_zero hdP revert hdP; revert d - apply (ArithmeticFunction.sum_eq_iff_sum_mul_moebius_eq_on _ (fun _ _ ↦ Nat.dvd_trans)).mpr + apply (ArithmeticFunction.sum_eq_iff_sum_mul_moebius_eq_on {d | d ∣ s.prodPrimes} + (fun _ _ ↦ Nat.dvd_trans)).mpr intro l _ hlP exact inv_selbergTerms_eq_sum_divisors_moebius_nu (Squarefree.squarefree_of_dvd hlP s.prodPrimes_squarefree) diff --git a/Mathlib/NumberTheory/SmoothNumbers.lean b/Mathlib/NumberTheory/SmoothNumbers.lean index 3ba37f37cc32d1..eac17caaf3ef8c 100644 --- a/Mathlib/NumberTheory/SmoothNumbers.lean +++ b/Mathlib/NumberTheory/SmoothNumbers.lean @@ -154,7 +154,7 @@ lemma factoredNumbers_compl {N : ℕ} {s : Finset ℕ} (h : primesBelow N ≤ s) intro n hn simp only [Set.mem_compl_iff, mem_factoredNumbers, Set.mem_sdiff, ne_eq, not_and, not_forall, exists_prop, Set.mem_singleton_iff] at hn - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] obtain ⟨p, hp₁, hp₂⟩ := hn.1 hn.2 have : N ≤ p := by contrapose! hp₂ diff --git a/Mathlib/NumberTheory/SumPrimeReciprocals.lean b/Mathlib/NumberTheory/SumPrimeReciprocals.lean index 5811222e1cb395..3234bdaf4c5100 100644 --- a/Mathlib/NumberTheory/SumPrimeReciprocals.lean +++ b/Mathlib/NumberTheory/SumPrimeReciprocals.lean @@ -70,7 +70,8 @@ theorem not_summable_one_div_on_primes : intro h obtain ⟨k, hk⟩ := h.nat_tsum_vanishing (Iio_mem_nhds one_half_pos : Iio (1 / 2 : ℝ) ∈ 𝓝 0) specialize hk ({p | Nat.Prime p} ∩ {p | k ≤ p}) inter_subset_right - rw [tsum_subtype, indicator_indicator, inter_eq_left.mpr fun n hn ↦ hn.1, mem_Iio] at hk + rw [tsum_subtype, indicator_indicator, + inter_eq_left.mpr fun n (hn : n ∈ {p | Nat.Prime p} ∩ {p | k ≤ p}) ↦ hn.1, mem_Iio] at hk have h' : Summable (indicator ({p | Nat.Prime p} ∩ {p | k ≤ p}) fun n ↦ (1 : ℝ) / n) := by convert! h.indicator {n : ℕ | k ≤ n} using 1 simp only [indicator_indicator, inter_comm] @@ -79,7 +80,7 @@ theorem not_summable_one_div_on_primes : Summable.sum_le_tsum (primesBelow ((4 ^ (k.primesBelow.card + 1)).succ) \ primesBelow k) (fun n _ ↦ indicator_nonneg (fun p _ ↦ by positivity) _) h' using 2 with p hp - obtain ⟨hp₁, hp₂⟩ := mem_setOf_eq ▸ Finset.mem_sdiff.mp hp + obtain ⟨hp₁, hp₂⟩ := mem_ofPred_eq ▸ Finset.mem_sdiff.mp hp have hpp := prime_of_mem_primesBelow hp₁ refine (indicator_of_mem ?_ fun n : ℕ ↦ (1 / n : ℝ)).symm exact ⟨hpp, by simpa [primesBelow, hpp] using hp₂⟩ diff --git a/Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean b/Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean index 29b45e17dd4454..02f53f5121b0a7 100644 --- a/Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean +++ b/Mathlib/NumberTheory/Transcendental/Liouville/Measure.lean @@ -15,7 +15,7 @@ public import Mathlib.Analysis.PSeries In this file we prove that the set of Liouville numbers with exponent (irrationality measure) strictly greater than two is a set of Lebesgue measure zero, see -`volume_iUnion_setOf_liouvilleWith`. +`volume_iUnion_setOfPred_liouvilleWith`. Since this set is a residual set, we show that the filters `residual` and `ae volume` are disjoint. These filters correspond to two common notions of genericity on `ℝ`: residual sets and sets of full @@ -33,7 +33,7 @@ open scoped Filter ENNReal Topology NNReal open Filter Set Metric MeasureTheory Real -theorem setOf_liouvilleWith_subset_aux : +theorem setOfPred_liouvilleWith_subset_aux : { x : ℝ | ∃ p > 2, LiouvilleWith p x } ⊆ ⋃ m : ℤ, (· + (m : ℝ)) ⁻¹' ⋃ n > (0 : ℕ), { x : ℝ | ∃ᶠ b : ℕ in atTop, ∃ a ∈ Finset.Icc (0 : ℤ) b, @@ -72,20 +72,24 @@ theorem setOf_liouvilleWith_subset_aux : · rw [add_le_add_iff_left] exact mul_le_of_le_one_left hb0.le hx01.2.le +@[deprecated (since := "2026-07-09")] +alias setOf_liouvilleWith_subset_aux := setOfPred_liouvilleWith_subset_aux + /-- The set of numbers satisfying the Liouville condition with some exponent `p > 2` has Lebesgue measure zero. -/ @[simp] -theorem volume_iUnion_setOf_liouvilleWith : +theorem volume_iUnion_setOfPred_liouvilleWith : volume (⋃ (p : ℝ) (_hp : 2 < p), { x : ℝ | LiouvilleWith p x }) = 0 := by - simp only [← setOf_exists, exists_prop] - refine measure_mono_null setOf_liouvilleWith_subset_aux ?_ + simp only [← ofPred_exists, exists_prop] + refine measure_mono_null setOfPred_liouvilleWith_subset_aux ?_ rw [measure_iUnion_null_iff]; intro m; rw [measure_preimage_add_right]; clear m - refine (measure_biUnion_null_iff <| to_countable _).2 fun n (hn : 1 ≤ n) => ?_ + refine (measure_biUnion_null_iff (I := {n : ℕ | 1 ≤ n}) <| to_countable _).2 + fun n (hn : 1 ≤ n) => ?_ generalize hr : (2 + 1 / n : ℝ) = r replace hr : 2 < r := by simp [← hr, zero_lt_one.trans_le hn] clear hn n - refine measure_setOf_frequently_eq_zero ?_ - simp only [setOf_exists, ← exists_prop, ← Real.dist_eq, ← mem_ball, setOf_mem_eq] + refine measure_setOfPred_frequently_eq_zero ?_ + simp only [ofPred_exists, ← exists_prop, ← Real.dist_eq, ← mem_ball, ofPred_mem_eq] set B : ℤ → ℕ → Set ℝ := fun a b => ball (a / b) (1 / (b : ℝ) ^ r) have hB : ∀ a b, volume (B a b) = ↑((2 : ℝ≥0) / (b : ℝ≥0) ^ r) := fun a b ↦ by rw [Real.volume_ball, mul_one_div, ← NNReal.coe_two, ← NNReal.coe_natCast, ← NNReal.coe_rpow, @@ -106,18 +110,24 @@ theorem volume_iUnion_setOf_liouvilleWith : refine ne_top_of_le_ne_top (ENNReal.tsum_coe_ne_top_iff_summable.2 ?_) (ENNReal.tsum_le_tsum this) refine (Summable.add ?_ ?_).mul_left _ <;> simp only [NNReal.summable_rpow] <;> linarith +@[deprecated (since := "2026-07-09")] +alias volume_iUnion_setOf_liouvilleWith := volume_iUnion_setOfPred_liouvilleWith + theorem ae_not_liouvilleWith : ∀ᵐ x, ∀ p > (2 : ℝ), ¬LiouvilleWith p x := by - simpa only [ae_iff, not_forall, Classical.not_not, setOf_exists] using - volume_iUnion_setOf_liouvilleWith + simpa only [ae_iff, not_forall, Classical.not_not, ofPred_exists] using + volume_iUnion_setOfPred_liouvilleWith theorem ae_not_liouville : ∀ᵐ x, ¬Liouville x := ae_not_liouvilleWith.mono fun _ h₁ h₂ => h₁ 3 (by norm_num) (h₂.liouvilleWith 3) /-- The set of Liouville numbers has Lebesgue measure zero. -/ @[simp] -theorem volume_setOf_liouville : volume { x : ℝ | Liouville x } = 0 := by +theorem volume_setOfPred_liouville : volume { x : ℝ | Liouville x } = 0 := by simpa only [ae_iff, Classical.not_not] using ae_not_liouville +@[deprecated (since := "2026-07-09")] +alias volume_setOf_liouville := volume_setOfPred_liouville + /-- The filters `residual ℝ` and `ae volume` are disjoint. This means that there exists a residual set of Lebesgue measure zero (e.g., the set of Liouville numbers). -/ theorem Real.disjoint_residual_ae : Disjoint (residual ℝ) (ae volume) := diff --git a/Mathlib/NumberTheory/Transcendental/Liouville/Residual.lean b/Mathlib/NumberTheory/Transcendental/Liouville/Residual.lean index d9a0960836a2ac..892077e14c5abd 100644 --- a/Mathlib/NumberTheory/Transcendental/Liouville/Residual.lean +++ b/Mathlib/NumberTheory/Transcendental/Liouville/Residual.lean @@ -24,37 +24,47 @@ open scoped Filter open Filter Set Metric -theorem setOf_liouville_eq_iInter_iUnion : +theorem setOfPred_liouville_eq_iInter_iUnion : { x | Liouville x } = ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b), ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by ext x - simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, Set.mem_sdiff, + simp only [mem_iInter, mem_iUnion, Liouville, mem_ofPred_eq, exists_prop, Set.mem_sdiff, mem_singleton_iff, mem_ball, Real.dist_eq, and_comm] -theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by - rw [setOf_liouville_eq_iInter_iUnion] +@[deprecated (since := "2026-07-09")] +alias setOf_liouville_eq_iInter_iUnion := setOfPred_liouville_eq_iInter_iUnion + +theorem IsGδ.setOfPred_liouville : IsGδ { x | Liouville x } := by + rw [setOfPred_liouville_eq_iInter_iUnion] refine .iInter fun n => IsOpen.isGδ ?_ refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_ exact isOpen_ball.inter isClosed_singleton.isOpen_compl +@[deprecated (since := "2026-07-09")] +alias IsGδ.setOf_liouville := IsGδ.setOfPred_liouville + -theorem setOf_liouville_eq_irrational_inter_iInter_iUnion : +theorem setOfPred_liouville_eq_irrational_inter_iInter_iUnion : { x | Liouville x } = { x | Irrational x } ∩ ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b), ball (a / b) (1 / (b : ℝ) ^ n) := by refine Subset.antisymm ?_ ?_ · refine subset_inter (fun x hx => hx.irrational) ?_ - rw [setOf_liouville_eq_iInter_iUnion] + rw [setOfPred_liouville_eq_iInter_iUnion] exact iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun _hb => sdiff_subset - · simp only [inter_iInter, inter_iUnion, setOf_liouville_eq_iInter_iUnion] + · simp only [inter_iInter, inter_iUnion, setOfPred_liouville_eq_iInter_iUnion] refine iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun hb => ?_ rw [inter_comm] exact sdiff_subset_sdiff Subset.rfl (singleton_subset_iff.2 ⟨a / b, by norm_cast⟩) +@[deprecated (since := "2026-07-09")] +alias setOf_liouville_eq_irrational_inter_iInter_iUnion := + setOfPred_liouville_eq_irrational_inter_iInter_iUnion + /-- The set of Liouville numbers is a residual set. -/ theorem eventually_residual_liouville : ∀ᶠ x in residual ℝ, Liouville x := by - rw [Filter.Eventually, setOf_liouville_eq_irrational_inter_iInter_iUnion] + rw [Filter.Eventually, setOfPred_liouville_eq_irrational_inter_iInter_iUnion] refine eventually_residual_irrational.and ?_ refine residual_of_dense_Gδ ?_ (Rat.isDenseEmbedding_coe_real.dense.mono ?_) · exact .iInter fun n => IsOpen.isGδ <| diff --git a/Mathlib/NumberTheory/WellApproximable.lean b/Mathlib/NumberTheory/WellApproximable.lean index 730fc04d079d20..ba55d8ec67a7c0 100644 --- a/Mathlib/NumberTheory/WellApproximable.lean +++ b/Mathlib/NumberTheory/WellApproximable.lean @@ -76,7 +76,7 @@ def approxOrderOf (A : Type*) [SeminormedGroup A] (n : ℕ) (δ : ℝ) : Set A : @[to_additive mem_approx_add_orderOf_iff] theorem mem_approxOrderOf_iff {A : Type*} [SeminormedGroup A] {n : ℕ} {δ : ℝ} {a : A} : a ∈ approxOrderOf A n δ ↔ ∃ b : A, orderOf b = n ∧ a ∈ ball b δ := by - simp only [approxOrderOf, thickening_eq_biUnion_ball, mem_iUnion₂, mem_setOf_eq, exists_prop] + simp only [approxOrderOf, thickening_eq_biUnion_ball, mem_iUnion₂, mem_ofPred_eq, exists_prop] /-- In a seminormed group `A`, given a sequence of distances `δ₁, δ₂, ...`, `wellApproximable A δ` is the limsup as `n → ∞` of the sets `approxOrderOf A n δₙ`. Thus, it is the set of points that @@ -115,7 +115,7 @@ theorem image_pow_subset (n : ℕ) (hm : 0 < m) : rintro - ⟨a, ha, rfl⟩ obtain ⟨b, hb : orderOf b = n * m, hab : a ∈ ball b δ⟩ := mem_approxOrderOf_iff.mp ha replace hb : b ^ m ∈ {y : A | orderOf y = n} := by - rw [mem_setOf_eq, orderOf_pow' b hm.ne', hb, Nat.gcd_mul_left_left, n.mul_div_cancel hm] + rw [mem_ofPred_eq, orderOf_pow' b hm.ne', hb, Nat.gcd_mul_left_left, n.mul_div_cancel hm] apply ball_subset_thickening hb (m * δ) convert! pow_mem_ball hm hab using 1 simp only [nsmul_eq_mul] @@ -124,7 +124,7 @@ theorem image_pow_subset (n : ℕ) (hm : 0 < m) : theorem smul_subset_of_coprime (han : (orderOf a).Coprime n) : a • approxOrderOf A n δ ⊆ approxOrderOf A (orderOf a * n) δ := by simp_rw [approxOrderOf, thickening_eq_biUnion_ball, ← image_smul, image_iUnion₂, image_smul, - smul_ball'', smul_eq_mul, mem_setOf_eq] + smul_ball'', smul_eq_mul, mem_ofPred_eq] refine iUnion₂_subset_iff.mpr fun b hb c hc => ?_ simp only [mem_iUnion, exists_prop] refine ⟨a * b, ?_, hc⟩ @@ -135,7 +135,7 @@ theorem smul_subset_of_coprime (han : (orderOf a).Coprime n) : theorem smul_eq_of_mul_dvd (hn : 0 < n) (han : orderOf a ^ 2 ∣ n) : a • approxOrderOf A n δ = approxOrderOf A n δ := by simp_rw [approxOrderOf, thickening_eq_biUnion_ball, ← image_smul, image_iUnion₂, image_smul, - smul_ball'', smul_eq_mul, mem_setOf_eq] + smul_ball'', smul_eq_mul, mem_ofPred_eq] replace han : ∀ {b : A}, orderOf b = n → orderOf (a * b) = n := by intro b hb rw [← hb] at han hn @@ -146,11 +146,11 @@ theorem smul_eq_of_mul_dvd (hn : 0 < n) (han : orderOf a ^ 2 ∣ n) : have hf : Surjective f := by rintro ⟨b, hb⟩ refine ⟨⟨a⁻¹ * b, ?_⟩, ?_⟩ - · rw [mem_setOf_eq, ← orderOf_inv, mul_inv_rev, inv_inv, mul_comm] + · rw [mem_ofPred_eq, ← orderOf_inv, mul_inv_rev, inv_inv, mul_comm] apply han simpa · simp only [f, mul_inv_cancel_left] - simpa only [mem_setOf_eq, Subtype.coe_mk, iUnion_coe_set] using + simpa only [mem_ofPred_eq, Subtype.coe_mk, iUnion_coe_set] using hf.iUnion_comp fun b => ball (b : A) δ end approxOrderOf @@ -159,7 +159,7 @@ namespace UnitAddCircle theorem mem_approxAddOrderOf_iff {δ : ℝ} {x : UnitAddCircle} {n : ℕ} (hn : 0 < n) : x ∈ approxAddOrderOf UnitAddCircle n δ ↔ ∃ m < n, gcd m n = 1 ∧ ‖x - ↑((m : ℝ) / n)‖ < δ := by - simp only [mem_approx_add_orderOf_iff, mem_setOf_eq, ball, dist_eq_norm, + simp only [mem_approx_add_orderOf_iff, mem_ofPred_eq, ball, dist_eq_norm, AddCircle.addOrderOf_eq_pos_iff hn, mul_one] constructor · rintro ⟨y, ⟨m, hm₁, hm₂, rfl⟩, hx⟩; exact ⟨m, hm₁, hm₂, hx⟩ @@ -169,7 +169,7 @@ theorem mem_addWellApproximable_iff (δ : ℕ → ℝ) (x : UnitAddCircle) : x ∈ addWellApproximable UnitAddCircle δ ↔ {n : ℕ | ∃ m < n, gcd m n = 1 ∧ ‖x - ↑((m : ℝ) / n)‖ < δ n}.Infinite := by simp only [mem_add_wellApproximable_iff, ← Nat.cofinite_eq_atTop, cofinite.blimsup_set_eq, - mem_setOf_eq] + mem_ofPred_eq] refine iff_of_eq (congr_arg Set.Infinite <| ext fun n => ⟨fun hn => ?_, fun hn => ?_⟩) · exact (mem_approxAddOrderOf_iff hn.1).mp hn.2 · have h : 0 < n := by obtain ⟨m, hm₁, _, _⟩ := hn; exact pos_of_gt hm₁ @@ -189,7 +189,7 @@ local notation "𝕊" => AddCircle T /-- **Gallagher's ergodic theorem** on Diophantine approximation. -/ theorem addWellApproximable_ae_empty_or_univ (δ : ℕ → ℝ) (hδ : Tendsto δ atTop (𝓝 0)) : - (∀ᵐ x, ¬addWellApproximable 𝕊 δ x) ∨ ∀ᵐ x, addWellApproximable 𝕊 δ x := by + (∀ᵐ x, x ∉ addWellApproximable 𝕊 δ) ∨ ∀ᵐ x, x ∈ addWellApproximable 𝕊 δ := by /- Sketch of proof: Let `E := addWellApproximable 𝕊 δ`. For each prime `p : ℕ`, we can partition `E` into three @@ -243,11 +243,11 @@ theorem addWellApproximable_ae_empty_or_univ (δ : ℕ → ℝ) (hδ : Tendsto congr ext n tauto - have hE₂ : ∀ p : Nat.Primes, A p =ᵐ[μ] (∅ : Set 𝕊) ∧ B p =ᵐ[μ] (∅ : Set 𝕊) → E =ᵐ[μ] C p := by + have hE₂ : ∀ p : Nat.Primes, A p =ᵐˢ[μ] (∅ : Set 𝕊) ∧ B p =ᵐˢ[μ] (∅ : Set 𝕊) → E =ᵐˢ[μ] C p := by rintro p ⟨hA, hB⟩ rw [hE₁ p] exact union_ae_eq_right_of_ae_eq_empty ((union_ae_eq_right_of_ae_eq_empty hA).trans hB) - have hA : ∀ p : Nat.Primes, A p =ᵐ[μ] (∅ : Set 𝕊) ∨ A p =ᵐ[μ] univ := by + have hA : ∀ p : Nat.Primes, A p =ᵐˢ[μ] (∅ : Set 𝕊) ∨ A p =ᵐˢ[μ] univ := by rintro ⟨p, hp⟩ let f : 𝕊 → 𝕊 := fun y => (p : ℕ) • y suffices @@ -259,7 +259,7 @@ theorem addWellApproximable_ae_empty_or_univ (δ : ℕ → ℝ) (hδ : Tendsto refine (sSupHom.setImage f).apply_blimsup_le.trans (mono_blimsup fun n hn => ?_) replace hn := Nat.coprime_comm.mp (hp.coprime_iff_not_dvd.2 hn.2) exact approxAddOrderOf.image_nsmul_subset_of_coprime (δ n) hp.pos hn - have hB : ∀ p : Nat.Primes, B p =ᵐ[μ] (∅ : Set 𝕊) ∨ B p =ᵐ[μ] univ := by + have hB : ∀ p : Nat.Primes, B p =ᵐˢ[μ] (∅ : Set 𝕊) ∨ B p =ᵐˢ[μ] univ := by rintro ⟨p, hp⟩ let x := u ⟨p, hp⟩ let f : 𝕊 → 𝕊 := fun y => p • y + x @@ -296,10 +296,10 @@ theorem addWellApproximable_ae_empty_or_univ (δ : ℕ → ℝ) (hδ : Tendsto rw [OrderIso.apply_blimsup e, ← hu₀ p] exact blimsup_congr (Eventually.of_forall fun n hn => approxAddOrderOf.vadd_eq_of_mul_dvd (δ n) hn.1 hn.2) - by_cases! +distrib h : ∀ p : Nat.Primes, A p =ᵐ[μ] (∅ : Set 𝕊) ∧ B p =ᵐ[μ] (∅ : Set 𝕊) - · replace h : ∀ p : Nat.Primes, (u p +ᵥ E : Set _) =ᵐ[μ] E := by + by_cases! +distrib h : ∀ p : Nat.Primes, A p =ᵐˢ[μ] (∅ : Set 𝕊) ∧ B p =ᵐˢ[μ] (∅ : Set 𝕊) + · replace h : ∀ p : Nat.Primes, (u p +ᵥ E : Set _) =ᵐˢ[μ] E := by intro p - replace hE₂ : E =ᵐ[μ] C p := hE₂ p (h p) + replace hE₂ : E =ᵐˢ[μ] C p := hE₂ p (h p) have h_qmp : Measure.QuasiMeasurePreserving (-u p +ᵥ ·) μ μ := (measurePreserving_vadd _ μ).quasiMeasurePreserving refine (h_qmp.vadd_ae_eq_of_ae_eq (u p) hE₂).trans (ae_eq_trans ?_ hE₂.symm) diff --git a/Mathlib/Order/Antichain.lean b/Mathlib/Order/Antichain.lean index 716191a7b70fa5..33447320056fba 100644 --- a/Mathlib/Order/Antichain.lean +++ b/Mathlib/Order/Antichain.lean @@ -267,19 +267,25 @@ theorem IsAntichain.maximal_mem_iff (hs : IsAntichain (· ≤ ·) s) : Maximal ( /-- If `t` is an antichain shadowing and including the set of maximal elements of `s`, then `t` *is* the set of maximal elements of `s`. -/ -theorem IsAntichain.eq_setOf_maximal (ht : IsAntichain (· ≤ ·) t) +theorem IsAntichain.eq_setOfPred_maximal (ht : IsAntichain (· ≤ ·) t) (h : ∀ x, Maximal (· ∈ s) x → x ∈ t) (hs : ∀ a ∈ t, ∃ b, b ≤ a ∧ Maximal (· ∈ s) b) : {x | Maximal (· ∈ s) x} = t := by refine Set.ext fun x ↦ ⟨h _, fun hx ↦ ?_⟩ obtain ⟨y, hyx, hy⟩ := hs x hx rwa [← ht.eq (h y hy) hx hyx] +@[deprecated (since := "2026-07-09")] +alias IsAntichain.eq_setOf_maximal := IsAntichain.eq_setOfPred_maximal + /-- If `t` is an antichain shadowed by and including the set of minimal elements of `s`, then `t` *is* the set of minimal elements of `s`. -/ -theorem IsAntichain.eq_setOf_minimal (ht : IsAntichain (· ≤ ·) t) +theorem IsAntichain.eq_setOfPred_minimal (ht : IsAntichain (· ≤ ·) t) (h : ∀ x, Minimal (· ∈ s) x → x ∈ t) (hs : ∀ a ∈ t, ∃ b, a ≤ b ∧ Minimal (· ∈ s) b) : {x | Minimal (· ∈ s) x} = t := - ht.to_dual.eq_setOf_maximal h hs + ht.to_dual.eq_setOfPred_maximal h hs + +@[deprecated (since := "2026-07-09")] +alias IsAntichain.eq_setOf_minimal := IsAntichain.eq_setOfPred_minimal end Preorder @@ -299,11 +305,16 @@ theorem isAntichain_iff_forall_not_lt : IsAntichain (· ≤ ·) s ↔ ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → ¬a < b := ⟨fun hs _ ha _ => hs.not_lt ha, fun hs _ ha _ hb h h' => hs ha hb <| h'.lt_of_ne h⟩ -theorem setOf_maximal_antichain (P : α → Prop) : IsAntichain (· ≤ ·) {x | Maximal P x} := +theorem setOfPred_maximal_antichain (P : α → Prop) : IsAntichain (· ≤ ·) {x | Maximal P x} := fun _ hx _ ⟨hy, _⟩ hne hle ↦ hne (hle.antisymm <| hx.2 hy hle) -theorem setOf_minimal_antichain (P : α → Prop) : IsAntichain (· ≤ ·) {x | Minimal P x} := - (setOf_maximal_antichain (α := αᵒᵈ) P).swap +@[deprecated (since := "2026-07-09")] +alias setOf_maximal_antichain := setOfPred_maximal_antichain + +theorem setOfPred_minimal_antichain (P : α → Prop) : IsAntichain (· ≤ ·) {x | Minimal P x} := + (setOfPred_maximal_antichain (α := αᵒᵈ) P).swap + +@[deprecated (since := "2026-07-09")] alias setOf_minimal_antichain := setOfPred_minimal_antichain end PartialOrder diff --git a/Mathlib/Order/Atoms.lean b/Mathlib/Order/Atoms.lean index 626c404ca544a2..6c74751ce73fc6 100644 --- a/Mathlib/Order/Atoms.lean +++ b/Mathlib/Order/Atoms.lean @@ -697,7 +697,7 @@ theorem exists_mem_le_of_le_sSup_of_isAtom {α} [CompleteAtomicBooleanAlgebra α (ha : IsAtom a) {s : Set α} (hs : a ≤ sSup s) : ∃ b ∈ s, a ≤ b := (IsAtom.le_sSup ha).mp hs -lemma eq_setOf_le_sSup_and_isAtom {α} [CompleteAtomicBooleanAlgebra α] {S : Set α} +lemma eq_setOfPred_le_sSup_and_isAtom {α} [CompleteAtomicBooleanAlgebra α] {S : Set α} (hS : ∀ a ∈ S, IsAtom a) : S = {a | a ≤ sSup S ∧ IsAtom a} := by ext a refine ⟨fun h => ⟨le_sSup h, hS a h⟩, fun ⟨hale, hatom⟩ => ?_⟩ @@ -706,6 +706,9 @@ lemma eq_setOf_le_sSup_and_isAtom {α} [CompleteAtomicBooleanAlgebra α] {S : Se · simpa using hatom.1 assumption +@[deprecated (since := "2026-07-09")] +alias eq_setOf_le_sSup_and_isAtom := eq_setOfPred_le_sSup_and_isAtom + /-- Representation theorem for complete atomic boolean algebras: For a complete atomic Boolean algebra `α`, `toSetOfIsAtom` is an order isomorphism @@ -719,7 +722,7 @@ def toSetOfIsAtom {α} [CompleteAtomicBooleanAlgebra α] : α ≃o (Set {a : α have h : ∀ a ∈ Subtype.val '' S, IsAtom a := by rintro a ⟨a', ha', rfl⟩ exact a'.prop - rw [← Subtype.val_injective.image_injective.eq_iff, eq_setOf_le_sSup_and_isAtom h] + rw [← Subtype.val_injective.image_injective.eq_iff, eq_setOfPred_le_sSup_and_isAtom h] ext a simp map_rel_iff' {a b} := by diff --git a/Mathlib/Order/BooleanAlgebra/Set.lean b/Mathlib/Order/BooleanAlgebra/Set.lean index 6d0c6ec6ab3679..2a6a68a6d12237 100644 --- a/Mathlib/Order/BooleanAlgebra/Set.lean +++ b/Mathlib/Order/BooleanAlgebra/Set.lean @@ -39,8 +39,16 @@ instance : HImp (Set α) where @[simp] theorem mem_himp_iff : a ∈ s ⇨ t ↔ a ∈ s → a ∈ t := .rfl -instance instBooleanAlgebra : BooleanAlgebra (Set α) := - fast_instance% { (inferInstance : BooleanAlgebra (α → Prop)) with } +instance instBooleanAlgebra : BooleanAlgebra (Set α) where + __ := instDistribLattice + __ := instBoundedOrder + compl s := sᶜ + sdiff s t := s \ t + himp s t := s ⇨ t + inf_compl_le_bot _ _ h := h.2 h.1 + top_le_sup_compl s x _ := em (x ∈ s) + sdiff_eq _ _ := rfl + himp_eq _ _ := ext fun _ => imp_iff_or_not theorem himp_def : s ⇨ t = t ∪ sᶜ := himp_eq @@ -93,9 +101,11 @@ theorem compl_def (s : Set α) : sᶜ = { x | x ∉ s } := theorem mem_compl {s : Set α} {x : α} (h : x ∉ s) : x ∈ sᶜ := h -theorem compl_setOf {α} (p : α → Prop) : { a | p a }ᶜ = { a | ¬p a } := +theorem compl_ofPred {α} (p : α → Prop) : { a | p a }ᶜ = { a | ¬p a } := rfl +@[deprecated (since := "2026-07-09")] alias compl_setOf := compl_ofPred + theorem notMem_of_mem_compl {s : Set α} {x : α} (h : x ∈ sᶜ) : x ∉ s := h @@ -198,7 +208,7 @@ lemma mem_compl_singleton_iff : a ∈ ({b} : Set α)ᶜ ↔ a ≠ b := .rfl lemma compl_singleton_eq (a : α) : {a}ᶜ = {x | x ≠ a} := rfl @[simp] -lemma compl_ne_eq_singleton (a : α) : {x | x ≠ a}ᶜ = {a} := compl_compl _ +lemma compl_ne_eq_singleton (a : α) : {x | x ≠ a}ᶜ = {a} := compl_compl {a} @[simp] lemma subset_compl_singleton_iff : s ⊆ {a}ᶜ ↔ a ∉ s := subset_compl_comm.trans singleton_subset_iff diff --git a/Mathlib/Order/BooleanGenerators.lean b/Mathlib/Order/BooleanGenerators.lean index 63bd704640ce36..5c6c59bad2fd9c 100644 --- a/Mathlib/Order/BooleanGenerators.lean +++ b/Mathlib/Order/BooleanGenerators.lean @@ -95,7 +95,7 @@ lemma atomistic (hS : BooleanGenerators S) (a : α) (ha : a ≤ sSup S) : ∃ T apply sSup_le_sSup apply _root_.le_sSup use c, hc, hC _ hc, (le_sSup hc).trans ha - · simp only [Set.sSup_eq_sUnion, sSup_le_iff, Set.mem_sUnion, Set.mem_setOf_eq, + · simp only [Set.sSup_eq_sUnion, sSup_le_iff, Set.mem_sUnion, Set.mem_ofPred_eq, forall_exists_index, and_imp] rintro a T b hbC hb hbS rfl haT apply (le_sSup haT).trans diff --git a/Mathlib/Order/Bounds/Basic.lean b/Mathlib/Order/Bounds/Basic.lean index c50f1b1e109a3b..e0e38ded4b056a 100644 --- a/Mathlib/Order/Bounds/Basic.lean +++ b/Mathlib/Order/Bounds/Basic.lean @@ -642,7 +642,7 @@ theorem not_bddAbove_univ [NoTopOrder α] : ¬BddAbove (univ : Set α) := by sim @[to_dual (attr := simp)] theorem upperBounds_empty : upperBounds (∅ : Set α) = univ := by - simp only [upperBounds, eq_univ_iff_forall, mem_setOf_eq, forall_mem_empty, forall_true_iff] + simp only [upperBounds, eq_univ_iff_forall, mem_ofPred_eq, forall_mem_empty, forall_true_iff] @[to_dual (attr := simp)] theorem bddAbove_empty [Nonempty α] : BddAbove (∅ : Set α) := by diff --git a/Mathlib/Order/BourbakiWitt.lean b/Mathlib/Order/BourbakiWitt.lean index 6cb54b5b0b60f3..7f832f5129829a 100644 --- a/Mathlib/Order/BourbakiWitt.lean +++ b/Mathlib/Order/BourbakiWitt.lean @@ -153,7 +153,7 @@ lemma bot_eq_of_le_or_map_le {y : α} (le_map : ∀ x, x ≤ f x) (hy : IsExtrem right apply le_trans h' (le_cSup _ _ hz) -lemma setOf_isExtremePt_isAdmissible (le_map : ∀ x, x ≤ f x) : +lemma setOfPred_isExtremePt_isAdmissible (le_map : ∀ x, x ≤ f x) : IsAdmissible x f {y | IsExtremePt x f y} := by apply IsAdmissible.mk · constructor @@ -193,14 +193,20 @@ lemma setOf_isExtremePt_isAdmissible (le_map : ∀ x, x ≤ f x) : intro hc' exact lt_irrefl y (lt_of_lt_of_le hy' hc') -lemma setOf_isExtremePt_eq_bot (le_map : ∀ x, x ≤ f x) : {y | IsExtremePt x f y} = bot x f := by +@[deprecated (since := "2026-07-09")] +alias setOf_isExtremePt_isAdmissible := setOfPred_isExtremePt_isAdmissible + +lemma setOfPred_isExtremePt_eq_bot (le_map : ∀ x, x ≤ f x) : {y | IsExtremePt x f y} = bot x f := by rw [← subset_bot_iff] · exact fun _ h ↦ h.mem_bot - · exact setOf_isExtremePt_isAdmissible le_map + · exact setOfPred_isExtremePt_isAdmissible le_map + +@[deprecated (since := "2026-07-09")] +alias setOf_isExtremePt_eq_bot := setOfPred_isExtremePt_eq_bot lemma mem_bot_iff_isExtremePt {y : α} (le_map : ∀ x, x ≤ f x) : y ∈ bot x f ↔ IsExtremePt x f y := by - rw [← setOf_isExtremePt_eq_bot le_map, mem_setOf] + rw [← setOfPred_isExtremePt_eq_bot le_map, mem_ofPred] lemma bot_isChain (le_map : ∀ x, x ≤ f x) : IsChain (· ≤ ·) (bot x f) := by intro y hy z hz _ diff --git a/Mathlib/Order/Circular.lean b/Mathlib/Order/Circular.lean index fba2e79292da1d..073192dbecd6bb 100644 --- a/Mathlib/Order/Circular.lean +++ b/Mathlib/Order/Circular.lean @@ -328,11 +328,11 @@ theorem right_mem_cIcc (a b : α) : b ∈ cIcc a b := theorem compl_cIcc {a b : α} : (cIcc a b)ᶜ = cIoo b a := by ext - rw [Set.mem_cIoo, sbtw_iff_not_btw, cIcc, mem_compl_iff, mem_setOf] + rw [Set.mem_cIoo, sbtw_iff_not_btw, cIcc, mem_compl_iff, mem_ofPred] theorem compl_cIoo {a b : α} : (cIoo a b)ᶜ = cIcc b a := by ext - rw [Set.mem_cIcc, btw_iff_not_sbtw, cIoo, mem_compl_iff, mem_setOf] + rw [Set.mem_cIcc, btw_iff_not_sbtw, cIoo, mem_compl_iff, mem_ofPred] end CircularOrder diff --git a/Mathlib/Order/Closure.lean b/Mathlib/Order/Closure.lean index 4b9b99d6ba2e11..7694f702c4bede 100644 --- a/Mathlib/Order/Closure.lean +++ b/Mathlib/Order/Closure.lean @@ -149,9 +149,12 @@ variable {c} {x y : α} theorem IsClosed.closure_eq : c.IsClosed x → c x = x := c.isClosed_iff.1 /-- The set of closed elements for `c` is exactly its range. -/ -theorem setOf_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by +theorem setOfPred_isClosed_eq_range_closure : {x | c.IsClosed x} = Set.range c := by ext x; exact ⟨fun hx ↦ ⟨x, hx.closure_eq⟩, by rintro ⟨y, rfl⟩; exact c.isClosed_closure _⟩ +@[deprecated (since := "2026-07-09")] +alias setOf_isClosed_eq_range_closure := setOfPred_isClosed_eq_range_closure + theorem le_closure_iff : x ≤ c y ↔ c x ≤ c y := ⟨fun h ↦ c.idempotent y ▸ c.monotone h, (c.le_closure x).trans⟩ @@ -401,7 +404,7 @@ theorem closure_is_closed (x : α) : u (l x) ∈ l.closed := /-- The set of closed elements for `l` is the range of `u ∘ l`. -/ theorem closed_eq_range_close : l.closed = Set.range (u ∘ l) := - l.closureOperator.setOf_isClosed_eq_range_closure + l.closureOperator.setOfPred_isClosed_eq_range_closure /-- Send an `x` to an element of the set of closed elements (by taking the closure). -/ def toClosed (x : α) : l.closed := diff --git a/Mathlib/Order/Cofinal.lean b/Mathlib/Order/Cofinal.lean index 1269f4bdf408f6..321a2fb702bdad 100644 --- a/Mathlib/Order/Cofinal.lean +++ b/Mathlib/Order/Cofinal.lean @@ -165,7 +165,7 @@ theorem not_bddAbove_iff_isCofinal [NoMaxOrder α] {s : Set α} : ¬ BddAbove s /-- The set of "records" (the smallest inputs yielding the highest values) with respect to a well-ordering of `α` is a cofinal set. -/ -theorem isCofinal_setOf_imp_lt (r : α → α → Prop) [h : IsWellFounded α r] : +theorem isCofinal_setOfPred_imp_lt (r : α → α → Prop) [h : IsWellFounded α r] : IsCofinal { a | ∀ b, r b a → b < a } := by intro a obtain ⟨b, hb, hb'⟩ := h.wf.has_min (Set.Ici a) Set.nonempty_Ici @@ -173,6 +173,8 @@ theorem isCofinal_setOf_imp_lt (r : α → α → Prop) [h : IsWellFounded α r] by_contra! hc' exact hb' c (hb.trans hc') hc +@[deprecated (since := "2026-07-09")] alias isCofinal_setOf_imp_lt := isCofinal_setOfPred_imp_lt + theorem isCofinal_range_of_strictMono [WellFoundedLT α] {f : α → α} (hf : StrictMono f) : IsCofinal (range f) := fun x ↦ ⟨_, ⟨x, rfl⟩, hf.le_apply⟩ diff --git a/Mathlib/Order/CompactlyGenerated/Basic.lean b/Mathlib/Order/CompactlyGenerated/Basic.lean index c1905fb75c6263..07739d090dcd85 100644 --- a/Mathlib/Order/CompactlyGenerated/Basic.lean +++ b/Mathlib/Order/CompactlyGenerated/Basic.lean @@ -452,7 +452,7 @@ lemma iSupIndep_iff_supIndep {ι : Type*} {f : ι → α} : classical have hf : Set.InjOn f {i : ι | f i ≠ ⊥} := by by_contra! hf - simp_all only [Set.InjOn, ne_eq, Set.mem_setOf_eq, not_forall] + simp_all only [Set.InjOn, ne_eq, Set.mem_ofPred_eq, not_forall] obtain ⟨x₁, hx₁, x₂, hx₂, hfeq, hneq⟩ := hf specialize h ({x₁, x₂} : Finset ι) rw [Finset.supIndep_pair hneq, disjoint_iff, hfeq, inf_idem (f x₂)] at h diff --git a/Mathlib/Order/CompleteLattice/Chain.lean b/Mathlib/Order/CompleteLattice/Chain.lean index b10b8b938ecff5..ab70a8e351e20b 100644 --- a/Mathlib/Order/CompleteLattice/Chain.lean +++ b/Mathlib/Order/CompleteLattice/Chain.lean @@ -36,7 +36,7 @@ inductive ChainClosure (r : α → α → Prop) : Set α → Prop | union : ∀ {s}, (∀ a ∈ s, ChainClosure r a) → ChainClosure r (⋃₀ s) /-- An explicit maximal chain. `maxChain` is taken to be the union of all sets in `ChainClosure`. -/ -def maxChain (r : α → α → Prop) : Set α := ⋃₀ setOf (ChainClosure r) +def maxChain (r : α → α → Prop) : Set α := ⋃₀ Set.ofPred (ChainClosure r) lemma chainClosure_empty : ChainClosure r ∅ := by have : ChainClosure r (⋃₀ ∅) := ChainClosure.union fun a h => (notMem_empty _ h).elim diff --git a/Mathlib/Order/ConditionallyCompletePartialOrder/Indexed.lean b/Mathlib/Order/ConditionallyCompletePartialOrder/Indexed.lean index 2de0ca976d89d7..8d86bfb9771754 100644 --- a/Mathlib/Order/ConditionallyCompletePartialOrder/Indexed.lean +++ b/Mathlib/Order/ConditionallyCompletePartialOrder/Indexed.lean @@ -203,7 +203,7 @@ theorem l_csSup_of_directedOn' (gc : GaloisConnection l u) {s : Set α} theorem l_csSup_of_directedOn (gc : GaloisConnection l u) {s : Set α} (hd : DirectedOn (· ≤ ·) s) (hne : s.Nonempty) (hbdd : BddAbove s) : l (sSup s) = ⨆ x : s, l x := by - simpa only [← comp_def, ← sSup_range, range_comp, Subtype.range_coe_subtype, setOf_mem_eq] + simpa only [← comp_def, ← sSup_range, range_comp, Subtype.range_coe_subtype, ofPred_mem_eq] using gc.l_csSup_of_directedOn' hd hne hbdd theorem l_ciSup_of_directed (gc : GaloisConnection l u) {f : ι → α} (hd : Directed (· ≤ ·) f) diff --git a/Mathlib/Order/CountableSupClosed.lean b/Mathlib/Order/CountableSupClosed.lean index 5bebdc531fc481..af52f5ee79e99a 100644 --- a/Mathlib/Order/CountableSupClosed.lean +++ b/Mathlib/Order/CountableSupClosed.lean @@ -180,7 +180,7 @@ variable [Preorder α] /-- Every set generates a set closed under countable supremum. -/ @[to_dual /-- Every set generates a set closed under countable infimum. -/] def countableSupClosure : ClosureOperator (Set α) := .ofPred - (fun s a ↦ ∃ (A : Set α) (_ : A ⊆ s) (_ : A.Nonempty) (_ : A.Countable), IsLUB A a) + (fun s ↦ {a | ∃ (A : Set α) (_ : A ⊆ s) (_ : A.Nonempty) (_ : A.Countable), IsLUB A a}) CountableSupClosed (fun s x hxs ↦ ⟨{x}, by simp; grind, by simp, by simp, by simp⟩) (fun s ↦ by @@ -229,7 +229,7 @@ lemma countableSupClosure_eq_sInter (s : Set α) : countableSupClosure s = ⋂₀ {t | s ⊆ t ∧ CountableSupClosed t} := by have : CountableSupClosed (⋂₀ {t | s ⊆ t ∧ CountableSupClosed t}) := by constructor - simp only [Set.subset_sInter_iff, Set.mem_setOf_eq, and_imp, Set.mem_sInter] + simp only [Set.subset_sInter_iff, Set.mem_ofPred_eq, and_imp, Set.mem_sInter] intro t ht ht_ne ht_c x hx t' hst' ht' exact ht'.isLUB_mem t (ht t' hst' ht') ht_ne ht_c x hx refine le_antisymm (countableSupClosure_min (by grind) (by grind)) (Set.sInter_subset_of_mem ?_) diff --git a/Mathlib/Order/DirectedInverseSystem.lean b/Mathlib/Order/DirectedInverseSystem.lean index 76c35452acdb11..37c4dcaac4e4bf 100644 --- a/Mathlib/Order/DirectedInverseSystem.lean +++ b/Mathlib/Order/DirectedInverseSystem.lean @@ -466,9 +466,10 @@ variable (hi : IsSuccPrelimit i) (e : ∀ j : Iio i, PEquivOn f equivSucc (Iic j obtaining a partial family over a right-open interval. -/ noncomputable def pEquivOnGlue : PEquivOn f equivSucc (Iio i) where equiv := (piLTLim (X := fun j ↦ F j ≃ piLT X j) hi).symm - ⟨fun j ↦ ((e j).restrict fun _ h ↦ h.le).equiv, fun _ _ h ↦ funext fun _ ↦ + ⟨fun j ↦ ((e j).restrict fun _ h ↦ le_of_lt h).equiv, fun _ _ h ↦ funext fun _ ↦ pEquivOn_apply_eq ((isLowerSet_Iio _).inter <| isLowerSet_Iio _)⟩ - nat j k hj hk h := by rw [piLTLim_symm_apply]; exacts [(e _).nat _ _ _, h.trans_lt (hi.mid _).2.1] + nat j k hj hk h := by + rw [piLTLim_symm_apply]; exacts [(e _).nat _ _ _, lt_of_le_of_lt h (hi.mid _).2.1] compat hj := have k := hi.mid hj by rw [piLTLim_symm_apply hi ⟨_, k.2.2⟩ (by exact k.2.1)]; apply (e _).compat diff --git a/Mathlib/Order/Filter/AtTopBot/Basic.lean b/Mathlib/Order/Filter/AtTopBot/Basic.lean index 63fceba64c99d6..c1ce22ac571a8d 100644 --- a/Mathlib/Order/Filter/AtTopBot/Basic.lean +++ b/Mathlib/Order/Filter/AtTopBot/Basic.lean @@ -146,7 +146,8 @@ variable [Preorder α] [IsDirectedOrder α] {F : Filter β} {u : α → β} @[to_dual inf_map_atBot_neBot_iff] theorem inf_map_atTop_neBot_iff [Nonempty α] : NeBot (F ⊓ map u atTop) ↔ ∀ U ∈ F, ∀ N, ∃ n, N ≤ n ∧ u n ∈ U := by - simp_rw [inf_neBot_iff_frequently_left, frequently_map, frequently_atTop]; rfl + simp_rw [inf_neBot_iff_frequently_left, frequently_map, frequently_atTop] + exact ⟨fun h U hU ↦ h (p := (· ∈ U)) hU, fun h p hp ↦ h {x | p x} hp⟩ variable [Preorder β] diff --git a/Mathlib/Order/Filter/Bases/Basic.lean b/Mathlib/Order/Filter/Bases/Basic.lean index cfbbfa7a4197ef..add15a94f66f2f 100644 --- a/Mathlib/Order/Filter/Bases/Basic.lean +++ b/Mathlib/Order/Filter/Bases/Basic.lean @@ -22,7 +22,7 @@ to `B.filter` if and only if it contains an element of `B`. Given an indexing type `ι`, a predicate `p : ι → Prop`, and a map `s : ι → Set α`, the proposition `h : Filter.IsBasis p s` makes sure the range of `s` bounded by `p` -(i.e. `s '' setOf p`) defines a filter basis `h.filterBasis`. +(i.e. `s '' Set.ofPred p`) defines a filter basis `h.filterBasis`. If one already has a filter `l` on `α`, `Filter.HasBasis l p s` (where `p : ι → Prop` and `s : ι → Set α` as above) means that a set belongs to `l` if and @@ -485,7 +485,7 @@ theorem HasBasis.sup_pure (hl : l.HasBasis p s) (x : α) : theorem HasBasis.inf_principal (hl : l.HasBasis p s) (s' : Set α) : (l ⊓ 𝓟 s').HasBasis p fun i => s i ∩ s' := ⟨fun t => by - simp only [mem_inf_principal, hl.mem_iff, subset_def, mem_setOf_eq, mem_inter_iff, and_imp]⟩ + simp only [mem_inf_principal, hl.mem_iff, subset_def, mem_ofPred_eq, mem_inter_iff, and_imp]⟩ theorem HasBasis.principal_inf (hl : l.HasBasis p s) (s' : Set α) : (𝓟 s' ⊓ l).HasBasis p fun i => s' ∩ s i := by @@ -560,7 +560,8 @@ theorem le_iff_forall_inf_principal_compl {f g : Filter α} : f ≤ g ↔ ∀ V theorem inf_neBot_iff_frequently_left {f g : Filter α} : NeBot (f ⊓ g) ↔ ∀ {p : α → Prop}, (∀ᶠ x in f, p x) → ∃ᶠ x in g, p x := by - simp only [inf_neBot_iff, frequently_iff, and_comm]; rfl + simp only [inf_neBot_iff, frequently_iff, and_comm] + exact ⟨fun h _p hp _U hU => h hp hU, fun h s hs s' hs' => h (p := (· ∈ s)) hs hs'⟩ theorem inf_neBot_iff_frequently_right {f g : Filter α} : NeBot (f ⊓ g) ↔ ∀ {p : α → Prop}, (∀ᶠ x in g, p x) → ∃ᶠ x in f, p x := by @@ -744,7 +745,7 @@ theorem mem_prod_self_iff {s} : s ∈ la ×ˢ la ↔ ∃ t ∈ la, t ×ˢ t ⊆ lemma eventually_prod_self_iff {r : α → α → Prop} : (∀ᶠ x in la ×ˢ la, r x.1 x.2) ↔ ∃ t ∈ la, ∀ x ∈ t, ∀ y ∈ t, r x y := - mem_prod_self_iff.trans <| by simp only [prod_subset_iff, mem_setOf_eq] + mem_prod_self_iff.trans <| by simp only [prod_subset_iff, mem_ofPred_eq] /-- A version of `eventually_prod_self_iff` that is more suitable for forward rewriting. -/ lemma eventually_prod_self_iff' {r : α × α → Prop} : diff --git a/Mathlib/Order/Filter/Basic.lean b/Mathlib/Order/Filter/Basic.lean index c9c47c96d06c0e..a309ade9875116 100644 --- a/Mathlib/Order/Filter/Basic.lean +++ b/Mathlib/Order/Filter/Basic.lean @@ -593,7 +593,7 @@ theorem mem_inf_principal' {f : Filter α} {s t : Set α} : s ∈ f ⊓ 𝓟 t ← (isCompl_principal (t ∩ sᶜ)).le_right_iff, compl_inter, compl_compl] lemma mem_inf_principal {f : Filter α} {s t : Set α} : s ∈ f ⊓ 𝓟 t ↔ { x | x ∈ t → x ∈ s } ∈ f := by - simp only [mem_inf_principal', imp_iff_not_or, setOf_or, compl_def, setOf_mem_eq] + simp only [mem_inf_principal', imp_iff_not_or, ofPred_or, compl_def, ofPred_mem_eq] lemma iSup_inf_principal (f : ι → Filter α) (s : Set α) : ⨆ i, f i ⊓ 𝓟 s = (⨆ i, f i) ⊓ 𝓟 s := by ext @@ -632,7 +632,7 @@ theorem eventually_mem_set {s : Set α} {l : Filter α} : (∀ᶠ x in l, x ∈ protected theorem ext' {f₁ f₂ : Filter α} (h : ∀ p : α → Prop, (∀ᶠ x in f₁, p x) ↔ ∀ᶠ x in f₂, p x) : f₁ = f₂ := - Filter.ext <| Set.setOf_bijective.surjective.forall.mpr h + Filter.ext <| Set.ofPred_bijective.surjective.forall.mpr h theorem Eventually.filter_mono {f₁ f₂ : Filter α} (h : f₁ ≤ f₂) {p : α → Prop} (hp : ∀ᶠ x in f₂, p x) : ∀ᶠ x in f₁, p x := @@ -811,7 +811,7 @@ theorem frequently_iff_forall_eventually_exists_and {p : α → Prop} {f : Filte theorem frequently_iff {f : Filter α} {P : α → Prop} : (∃ᶠ x in f, P x) ↔ ∀ {U}, U ∈ f → ∃ x ∈ U, P x := by simp only [frequently_iff_forall_eventually_exists_and, @and_comm (P _), - Set.setOf_bijective.surjective.forall, Filter.Eventually, mem_setOf] + Set.ofPred_bijective.surjective.forall, Filter.Eventually, mem_ofPred] @[simp, push] theorem not_eventually {p : α → Prop} {f : Filter α} : (¬∀ᶠ x in f, p x) ↔ ∃ᶠ x in f, ¬p x := by @@ -928,14 +928,14 @@ theorem EventuallyEq.rw {l : Filter α} {f g : α → β} (h : f =ᶠ[l] g) (p : (hf : ∀ᶠ x in l, p x (f x)) : ∀ᶠ x in l, p x (g x) := hf.congr <| h.mono fun _ hx => hx ▸ Iff.rfl -theorem eventuallyEq_set {s t : Set α} {l : Filter α} : s =ᶠ[l] t ↔ ∀ᶠ x in l, x ∈ s ↔ x ∈ t := +theorem eventuallyEq_set {s t : Set α} {l : Filter α} : s =ᶠˢ[l] t ↔ ∀ᶠ x in l, x ∈ s ↔ x ∈ t := eventually_congr <| Eventually.of_forall fun _ ↦ eq_iff_iff alias ⟨EventuallyEq.mem_iff, Eventually.set_eq⟩ := eventuallyEq_set @[simp] -theorem eventuallyEq_univ {s : Set α} {l : Filter α} : s =ᶠ[l] univ ↔ s ∈ l := by - simp [eventuallyEq_set] +theorem eventuallyEq_univ {s : Set α} {l : Filter α} : s =ᶠˢ[l] univ ↔ s ∈ l := by + simp [EventuallyEq, eventually_mem_set] theorem EventuallyEq.exists_mem {l : Filter α} {f g : α → β} (h : f =ᶠ[l] g) : ∃ s ∈ l, EqOn f g s := @@ -1050,45 +1050,39 @@ theorem EventuallyEq.inf [Min β] {l : Filter α} {f f' g g' : α → β} (hf : (hg : g =ᶠ[l] g') : f ⊓ g =ᶠ[l] f' ⊓ g' := hf.comp₂ (· ⊓ ·) hg -@[gcongr] theorem EventuallyEq.preimage {l : Filter α} {f g : α → β} (h : f =ᶠ[l] g) (s : Set β) : - f ⁻¹' s =ᶠ[l] g ⁻¹' s := - h.fun_comp s + f ⁻¹' s =ᶠˢ[l] g ⁻¹' s := + h.fun_comp (· ∈ s) -@[gcongr] -theorem EventuallyEq.inter {s t s' t' : Set α} {l : Filter α} (h : s =ᶠ[l] t) (h' : s' =ᶠ[l] t') : - (s ∩ s' : Set α) =ᶠ[l] (t ∩ t' : Set α) := +theorem EventuallyEq.inter {s t s' t' : Set α} {l : Filter α} (h : s =ᶠˢ[l] t) + (h' : s' =ᶠˢ[l] t') : s ∩ s' =ᶠˢ[l] t ∩ t' := h.comp₂ (· ∧ ·) h' -@[gcongr] -theorem EventuallyEq.union {s t s' t' : Set α} {l : Filter α} (h : s =ᶠ[l] t) (h' : s' =ᶠ[l] t') : - (s ∪ s' : Set α) =ᶠ[l] (t ∪ t' : Set α) := +theorem EventuallyEq.union {s t s' t' : Set α} {l : Filter α} (h : s =ᶠˢ[l] t) + (h' : s' =ᶠˢ[l] t') : s ∪ s' =ᶠˢ[l] t ∪ t' := h.comp₂ (· ∨ ·) h' -@[gcongr] -theorem EventuallyEq.compl {s t : Set α} {l : Filter α} (h : s =ᶠ[l] t) : - (sᶜ : Set α) =ᶠ[l] (tᶜ : Set α) := +theorem EventuallyEq.compl {s t : Set α} {l : Filter α} (h : s =ᶠˢ[l] t) : + sᶜ =ᶠˢ[l] tᶜ := h.fun_comp Not -@[gcongr] -theorem EventuallyEq.diff {s t s' t' : Set α} {l : Filter α} (h : s =ᶠ[l] t) (h' : s' =ᶠ[l] t') : - (s \ s' : Set α) =ᶠ[l] (t \ t' : Set α) := +theorem EventuallyEq.diff {s t s' t' : Set α} {l : Filter α} (h : s =ᶠˢ[l] t) + (h' : s' =ᶠˢ[l] t') : s \ s' =ᶠˢ[l] t \ t' := h.inter h'.compl -@[gcongr] protected theorem EventuallyEq.symmDiff {s t s' t' : Set α} {l : Filter α} - (h : s =ᶠ[l] t) (h' : s' =ᶠ[l] t') : (s ∆ s' : Set α) =ᶠ[l] (t ∆ t' : Set α) := + (h : s =ᶠˢ[l] t) (h' : s' =ᶠˢ[l] t') : s ∆ s' =ᶠˢ[l] t ∆ t' := (h.diff h').union (h'.diff h) -theorem eventuallyEq_empty {s : Set α} {l : Filter α} : s =ᶠ[l] (∅ : Set α) ↔ ∀ᶠ x in l, x ∉ s := +theorem eventuallyEq_empty {s : Set α} {l : Filter α} : s =ᶠˢ[l] (∅ : Set α) ↔ ∀ᶠ x in l, x ∉ s := eventuallyEq_set.trans <| by simp theorem inter_eventuallyEq_left {s t : Set α} {l : Filter α} : - (s ∩ t : Set α) =ᶠ[l] s ↔ ∀ᶠ x in l, x ∈ s → x ∈ t := by - simp only [eventuallyEq_set, mem_inter_iff, and_iff_left_iff_imp] + s ∩ t =ᶠˢ[l] s ↔ ∀ᶠ x in l, x ∈ s → x ∈ t := by + simp only [EventuallyEq, mem_inter_iff, eq_iff_iff, and_iff_left_iff_imp] theorem inter_eventuallyEq_right {s t : Set α} {l : Filter α} : - (s ∩ t : Set α) =ᶠ[l] t ↔ ∀ᶠ x in l, x ∈ t → x ∈ s := by + s ∩ t =ᶠˢ[l] t ↔ ∀ᶠ x in l, x ∈ t → x ∈ s := by rw [inter_comm, inter_eventuallyEq_left] @[simp] @@ -1204,37 +1198,33 @@ theorem Eventually.lt_top_iff_ne_top [PartialOrder β] [OrderTop β] {l : Filter (∀ᶠ x in l, f x < ⊤) ↔ ∀ᶠ x in l, f x ≠ ⊤ := ⟨Eventually.ne_of_lt, Eventually.lt_top_of_ne⟩ -@[gcongr, mono] -theorem EventuallyLE.inter {s t s' t' : Set α} {l : Filter α} (h : s ≤ᶠ[l] t) (h' : s' ≤ᶠ[l] t') : - (s ∩ s' : Set α) ≤ᶠ[l] (t ∩ t' : Set α) := +theorem EventuallyLE.inter {s t s' t' : Set α} {l : Filter α} (h : s ⊆ᶠ[l] t) + (h' : s' ⊆ᶠ[l] t') : s ∩ s' ⊆ᶠ[l] t ∩ t' := h'.mp <| h.mono fun _ => And.imp -@[gcongr, mono] -theorem EventuallyLE.union {s t s' t' : Set α} {l : Filter α} (h : s ≤ᶠ[l] t) (h' : s' ≤ᶠ[l] t') : - (s ∪ s' : Set α) ≤ᶠ[l] (t ∪ t' : Set α) := +theorem EventuallyLE.union {s t s' t' : Set α} {l : Filter α} (h : s ⊆ᶠ[l] t) + (h' : s' ⊆ᶠ[l] t') : s ∪ s' ⊆ᶠ[l] t ∪ t' := h'.mp <| h.mono fun _ => Or.imp -@[gcongr, mono] -theorem EventuallyLE.compl {s t : Set α} {l : Filter α} (h : s ≤ᶠ[l] t) : - (tᶜ : Set α) ≤ᶠ[l] (sᶜ : Set α) := +theorem EventuallyLE.compl {s t : Set α} {l : Filter α} (h : s ⊆ᶠ[l] t) : + tᶜ ⊆ᶠ[l] sᶜ := h.mono fun _ => mt -@[gcongr, mono] -theorem EventuallyLE.diff {s t s' t' : Set α} {l : Filter α} (h : s ≤ᶠ[l] t) (h' : t' ≤ᶠ[l] s') : - (s \ s' : Set α) ≤ᶠ[l] (t \ t' : Set α) := +theorem EventuallyLE.diff {s t s' t' : Set α} {l : Filter α} (h : s ⊆ᶠ[l] t) + (h' : t' ⊆ᶠ[l] s') : s \ s' ⊆ᶠ[l] t \ t' := h.inter h'.compl theorem set_eventuallyLE_iff_mem_inf_principal {s t : Set α} {l : Filter α} : - s ≤ᶠ[l] t ↔ t ∈ l ⊓ 𝓟 s := + s ⊆ᶠ[l] t ↔ t ∈ l ⊓ 𝓟 s := eventually_inf_principal.symm theorem set_eventuallyLE_iff_inf_principal_le {s t : Set α} {l : Filter α} : - s ≤ᶠ[l] t ↔ l ⊓ 𝓟 s ≤ l ⊓ 𝓟 t := + s ⊆ᶠ[l] t ↔ l ⊓ 𝓟 s ≤ l ⊓ 𝓟 t := set_eventuallyLE_iff_mem_inf_principal.trans <| by simp only [le_inf_iff, inf_le_left, true_and, le_principal_iff] theorem set_eventuallyEq_iff_inf_principal {s t : Set α} {l : Filter α} : - s =ᶠ[l] t ↔ l ⊓ 𝓟 s = l ⊓ 𝓟 t := by + s =ᶠˢ[l] t ↔ l ⊓ 𝓟 s = l ⊓ 𝓟 t := by simp only [eventuallyLE_antisymm_iff, le_antisymm_iff, set_eventuallyLE_iff_inf_principal_le] @[to_dual (attr := gcongr)] @@ -1273,8 +1263,8 @@ theorem Set.EqOn.eventuallyEq_of_mem {α β} {s : Set α} {l : Filter α} {f g : (hl : s ∈ l) : f =ᶠ[l] g := h.eventuallyEq.filter_mono <| Filter.le_principal_iff.2 hl -theorem LE.le.eventuallyLE {α} {l : Filter α} {s t : Set α} (h : s ⊆ t) : s ≤ᶠ[l] t := - Filter.Eventually.of_forall h +theorem LE.le.eventuallyLE {α} {l : Filter α} {s t : Set α} (h : s ⊆ t) : s ⊆ᶠ[l] t := + Filter.Eventually.of_forall fun _ => @h _ @[deprecated (since := "2026-03-16")] alias HasSubset.Subset.eventuallyLE := LE.le.eventuallyLE diff --git a/Mathlib/Order/Filter/CardinalInter.lean b/Mathlib/Order/Filter/CardinalInter.lean index e6541960d896c4..84a4bd815aa036 100644 --- a/Mathlib/Order/Filter/CardinalInter.lean +++ b/Mathlib/Order/Filter/CardinalInter.lean @@ -56,7 +56,7 @@ theorem cardinal_sInter_mem {S : Set (Set α)} [CardinalInterFilter l c] (hSc : /-- Every filter is a CardinalInterFilter with c = ℵ₀ -/ theorem _root_.Filter.cardinalInterFilter_aleph0 (l : Filter α) : CardinalInterFilter l ℵ₀ where cardinal_sInter_mem := by - simp_all only [lt_aleph0_iff_subtype_finite, setOf_mem_eq, sInter_mem, + simp_all only [lt_aleph0_iff_subtype_finite, ofPred_mem_eq, sInter_mem, implies_true] /-- Every CardinalInterFilter with c > ℵ₀ is a CountableInterFilter -/ @@ -107,56 +107,56 @@ theorem cardinal_bInter_mem {S : Set ι} (hS : #S < c) theorem eventually_cardinal_forall {p : α → ι → Prop} (hic : #ι < c) : (∀ᶠ x in l, ∀ i, p x i) ↔ ∀ i, ∀ᶠ x in l, p x i := by - simp only [Filter.Eventually, setOf_forall] + simp only [Filter.Eventually, ofPred_forall] exact cardinal_iInter_mem hic theorem eventually_cardinal_ball {S : Set ι} (hS : #S < c) {p : α → ∀ i ∈ S, Prop} : (∀ᶠ x in l, ∀ i hi, p x i hi) ↔ ∀ i hi, ∀ᶠ x in l, p x i hi := by - simp only [Filter.Eventually, setOf_forall] + simp only [Filter.Eventually, ofPred_forall] exact cardinal_bInter_mem hS theorem EventuallyLE.cardinal_iUnion {s t : ι → Set α} (hic : #ι < c) - (h : ∀ i, s i ≤ᶠ[l] t i) : ⋃ i, s i ≤ᶠ[l] ⋃ i, t i := + (h : ∀ i, s i ⊆ᶠ[l] t i) : ⋃ i, s i ⊆ᶠ[l] ⋃ i, t i := ((eventually_cardinal_forall hic).2 h).mono fun _ hst hs => mem_iUnion.2 <| (mem_iUnion.1 hs).imp hst theorem EventuallyEq.cardinal_iUnion {s t : ι → Set α} (hic : #ι < c) - (h : ∀ i, s i =ᶠ[l] t i) : ⋃ i, s i =ᶠ[l] ⋃ i, t i := + (h : ∀ i, s i =ᶠˢ[l] t i) : ⋃ i, s i =ᶠˢ[l] ⋃ i, t i := (EventuallyLE.cardinal_iUnion hic fun i => (h i).le).antisymm (EventuallyLE.cardinal_iUnion hic fun i => (h i).symm.le) theorem EventuallyLE.cardinal_bUnion {S : Set ι} (hS : #S < c) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ≤ᶠ[l] t i hi) : - ⋃ i ∈ S, s i ‹_› ≤ᶠ[l] ⋃ i ∈ S, t i ‹_› := by + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ⊆ᶠ[l] t i hi) : + ⋃ i ∈ S, s i ‹_› ⊆ᶠ[l] ⋃ i ∈ S, t i ‹_› := by simp only [biUnion_eq_iUnion] exact EventuallyLE.cardinal_iUnion hS fun i => h i i.2 theorem EventuallyEq.cardinal_bUnion {S : Set ι} (hS : #S < c) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠ[l] t i hi) : - ⋃ i ∈ S, s i ‹_› =ᶠ[l] ⋃ i ∈ S, t i ‹_› := + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠˢ[l] t i hi) : + ⋃ i ∈ S, s i ‹_› =ᶠˢ[l] ⋃ i ∈ S, t i ‹_› := (EventuallyLE.cardinal_bUnion hS fun i hi => (h i hi).le).antisymm (EventuallyLE.cardinal_bUnion hS fun i hi => (h i hi).symm.le) theorem EventuallyLE.cardinal_iInter {s t : ι → Set α} (hic : #ι < c) - (h : ∀ i, s i ≤ᶠ[l] t i) : ⋂ i, s i ≤ᶠ[l] ⋂ i, t i := + (h : ∀ i, s i ⊆ᶠ[l] t i) : ⋂ i, s i ⊆ᶠ[l] ⋂ i, t i := ((eventually_cardinal_forall hic).2 h).mono fun _ hst hs => mem_iInter.2 fun i => hst _ (mem_iInter.1 hs i) theorem EventuallyEq.cardinal_iInter {s t : ι → Set α} (hic : #ι < c) - (h : ∀ i, s i =ᶠ[l] t i) : ⋂ i, s i =ᶠ[l] ⋂ i, t i := + (h : ∀ i, s i =ᶠˢ[l] t i) : ⋂ i, s i =ᶠˢ[l] ⋂ i, t i := (EventuallyLE.cardinal_iInter hic fun i => (h i).le).antisymm (EventuallyLE.cardinal_iInter hic fun i => (h i).symm.le) theorem EventuallyLE.cardinal_bInter {S : Set ι} (hS : #S < c) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ≤ᶠ[l] t i hi) : - ⋂ i ∈ S, s i ‹_› ≤ᶠ[l] ⋂ i ∈ S, t i ‹_› := by + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ⊆ᶠ[l] t i hi) : + ⋂ i ∈ S, s i ‹_› ⊆ᶠ[l] ⋂ i ∈ S, t i ‹_› := by simp only [biInter_eq_iInter] exact EventuallyLE.cardinal_iInter hS fun i => h i i.2 theorem EventuallyEq.cardinal_bInter {S : Set ι} (hS : #S < c) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠ[l] t i hi) : - ⋂ i ∈ S, s i ‹_› =ᶠ[l] ⋂ i ∈ S, t i ‹_› := + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠˢ[l] t i hi) : + ⋂ i ∈ S, s i ‹_› =ᶠˢ[l] ⋂ i ∈ S, t i ‹_› := (EventuallyLE.cardinal_bInter hS fun i hi => (h i hi).le).antisymm (EventuallyLE.cardinal_bInter hS fun i hi => (h i hi).symm.le) @@ -198,13 +198,13 @@ def ofCardinalUnion (l : Set (Set α)) (hc : 2 < c) (hUnion : ∀ S : Set (Set α), (#S < c) → (∀ s ∈ S, s ∈ l) → ⋃₀ S ∈ l) (hmono : ∀ t ∈ l, ∀ s ⊆ t, s ∈ l) : Filter α := by refine .ofCardinalInter {s | sᶜ ∈ l} hc (fun S hSc hSp ↦ ?_) fun s t ht hsub ↦ ?_ - · rw [mem_setOf_eq, compl_sInter] + · rw [mem_ofPred_eq, compl_sInter] apply hUnion (compl '' S) (lt_of_le_of_lt mk_image_le hSc) intro s hs rw [mem_image] at hs rcases hs with ⟨t, ht, rfl⟩ apply hSp ht - · rw [mem_setOf_eq] + · rw [mem_ofPred_eq] rw [← compl_subset_compl] at hsub exact hmono sᶜ ht tᶜ hsub @@ -214,7 +214,7 @@ instance cardinalInter_ofCardinalUnion (l : Set (Set α)) (hc : 2 < c) (h₁ h @[simp] theorem mem_ofCardinalUnion {l : Set (Set α)} (hc : 2 < c) {hunion hmono s} : - s ∈ ofCardinalUnion l hc hunion hmono ↔ l sᶜ := + s ∈ ofCardinalUnion l hc hunion hmono ↔ sᶜ ∈ l := Iff.rfl instance cardinalInterFilter_principal (s : Set α) : CardinalInterFilter (𝓟 s) c := @@ -291,8 +291,8 @@ inductive CardinalGenerateSets : Set α → Prop /-- Assuming `2 < c`, `Filter.cardinalGenerate c g` is the greatest `CardinalInterFilter c` containing `g`. -/ def cardinalGenerate (hc : 2 < c) : Filter α := - ofCardinalInter (CardinalGenerateSets g) hc (fun _ => CardinalGenerateSets.sInter) fun _ _ => - CardinalGenerateSets.superset + ofCardinalInter {s | CardinalGenerateSets g s} hc (fun _ => CardinalGenerateSets.sInter) + fun _ _ => CardinalGenerateSets.superset lemma cardinalInter_ofCardinalGenerate (hc : 2 < c) : CardinalInterFilter (cardinalGenerate g hc) c := by diff --git a/Mathlib/Order/Filter/Cocardinal.lean b/Mathlib/Order/Filter/Cocardinal.lean index c783b9c7c598e6..6da48e17750a28 100644 --- a/Mathlib/Order/Filter/Cocardinal.lean +++ b/Mathlib/Order/Filter/Cocardinal.lean @@ -59,7 +59,8 @@ instance instCardinalInterFilter_cocardinal : CardinalInterFilter (cocardinal ( theorem eventually_cocardinal {p : α → Prop} : (∀ᶠ x in cocardinal α hreg, p x) ↔ #{ x | ¬p x } < c := Iff.rfl -theorem hasBasis_cocardinal : HasBasis (cocardinal α hreg) {s : Set α | #s < c} compl := +theorem hasBasis_cocardinal : + HasBasis (cocardinal α hreg) (fun s : Set α => #s < c) compl := ⟨fun s => ⟨fun h => ⟨sᶜ, h, (compl_compl s).subset⟩, fun ⟨_t, htf, hts⟩ => by have : #↑sᶜ < c := by @@ -70,7 +71,7 @@ theorem hasBasis_cocardinal : HasBasis (cocardinal α hreg) {s : Set α | #s < c theorem frequently_cocardinal {p : α → Prop} : (∃ᶠ x in cocardinal α hreg, p x) ↔ c ≤ #{ x | p x } := by - simp only [Filter.Frequently, eventually_cocardinal, not_not, coe_setOf, not_lt] + simp only [Filter.Frequently, eventually_cocardinal, not_not, coe_ofPred, not_lt] lemma frequently_cocardinal_mem {s : Set α} : (∃ᶠ x in cocardinal α hreg, x ∈ s) ↔ c ≤ #s := frequently_cocardinal diff --git a/Mathlib/Order/Filter/Cofinite.lean b/Mathlib/Order/Filter/Cofinite.lean index d630c290d515c6..807ee5f0e4ecec 100644 --- a/Mathlib/Order/Filter/Cofinite.lean +++ b/Mathlib/Order/Filter/Cofinite.lean @@ -216,7 +216,7 @@ theorem Nat.frequently_atTop_iff_infinite {p : ℕ → Prop} : rw [← Nat.cofinite_eq_atTop, frequently_cofinite_iff_infinite] lemma Nat.eventually_pos : ∀ᶠ (k : ℕ) in Filter.atTop, 0 < k := - Filter.eventually_of_mem (Filter.mem_atTop_sets.mpr ⟨1, fun _ hx ↦ hx⟩) (fun _ hx ↦ hx) + Filter.eventually_atTop.2 ⟨1, fun _ hx ↦ hx⟩ theorem Filter.Tendsto.exists_within_forall_le {α β : Type*} [LinearOrder β] {s : Set α} (hs : s.Nonempty) {f : α → β} (hf : Filter.Tendsto f Filter.cofinite Filter.atTop) : diff --git a/Mathlib/Order/Filter/CountableInter.lean b/Mathlib/Order/Filter/CountableInter.lean index 157177640ee2e9..b109f66b806f9d 100644 --- a/Mathlib/Order/Filter/CountableInter.lean +++ b/Mathlib/Order/Filter/CountableInter.lean @@ -60,13 +60,13 @@ theorem countable_bInter_mem {ι : Type*} {S : Set ι} (hS : S.Countable) {s : theorem eventually_countable_forall [Countable ι] {p : α → ι → Prop} : (∀ᶠ x in l, ∀ i, p x i) ↔ ∀ i, ∀ᶠ x in l, p x i := by - simpa only [Filter.Eventually, setOf_forall] using + simpa only [Filter.Eventually, ofPred_forall] using @countable_iInter_mem _ _ l _ _ fun i => { x | p x i } theorem eventually_countable_ball {ι : Type*} {S : Set ι} (hS : S.Countable) {p : α → ∀ i ∈ S, Prop} : (∀ᶠ x in l, ∀ i hi, p x i hi) ↔ ∀ i hi, ∀ᶠ x in l, p x i hi := by - simpa only [Filter.Eventually, setOf_forall] using + simpa only [Filter.Eventually, ofPred_forall] using @countable_bInter_mem _ l _ _ _ hS fun i hi => { x | p x i hi } theorem eventually_finset_ball {ι : Type*} {S : Finset ι} {p : α → ∀ i ∈ S, Prop} : @@ -75,15 +75,15 @@ theorem eventually_finset_ball {ι : Type*} {S : Finset ι} {p : α → ∀ i namespace Filter -theorem EventuallyLE.countable_iUnion [Countable ι] {s t : ι → Set α} (h : ∀ i, s i ≤ᶠ[l] t i) : - ⋃ i, s i ≤ᶠ[l] ⋃ i, t i := +theorem EventuallyLE.countable_iUnion [Countable ι] {s t : ι → Set α} (h : ∀ i, s i ⊆ᶠ[l] t i) : + ⋃ i, s i ⊆ᶠ[l] ⋃ i, t i := (eventually_countable_forall.2 h).mono fun _ hst hs => mem_iUnion.2 <| (mem_iUnion.1 hs).imp hst @[deprecated (since := "2026-03-03")] alias _root_.EventuallyLE.countable_iUnion := EventuallyLE.countable_iUnion -theorem EventuallyEq.countable_iUnion [Countable ι] {s t : ι → Set α} (h : ∀ i, s i =ᶠ[l] t i) : - ⋃ i, s i =ᶠ[l] ⋃ i, t i := +theorem EventuallyEq.countable_iUnion [Countable ι] {s t : ι → Set α} (h : ∀ i, s i =ᶠˢ[l] t i) : + ⋃ i, s i =ᶠˢ[l] ⋃ i, t i := (EventuallyLE.countable_iUnion fun i => (h i).le).antisymm (EventuallyLE.countable_iUnion fun i => (h i).symm.le) @@ -91,8 +91,8 @@ theorem EventuallyEq.countable_iUnion [Countable ι] {s t : ι → Set α} (h : EventuallyEq.countable_iUnion theorem EventuallyLE.countable_bUnion {ι : Type*} {S : Set ι} (hS : S.Countable) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ≤ᶠ[l] t i hi) : - ⋃ i ∈ S, s i ‹_› ≤ᶠ[l] ⋃ i ∈ S, t i ‹_› := by + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ⊆ᶠ[l] t i hi) : + ⋃ i ∈ S, s i ‹_› ⊆ᶠ[l] ⋃ i ∈ S, t i ‹_› := by simp only [biUnion_eq_iUnion] haveI := hS.toEncodable exact EventuallyLE.countable_iUnion fun i => h i i.2 @@ -101,24 +101,24 @@ theorem EventuallyLE.countable_bUnion {ι : Type*} {S : Set ι} (hS : S.Countabl EventuallyLE.countable_bUnion theorem EventuallyEq.countable_bUnion {ι : Type*} {S : Set ι} (hS : S.Countable) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠ[l] t i hi) : - ⋃ i ∈ S, s i ‹_› =ᶠ[l] ⋃ i ∈ S, t i ‹_› := + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠˢ[l] t i hi) : + ⋃ i ∈ S, s i ‹_› =ᶠˢ[l] ⋃ i ∈ S, t i ‹_› := (EventuallyLE.countable_bUnion hS fun i hi => (h i hi).le).antisymm (EventuallyLE.countable_bUnion hS fun i hi => (h i hi).symm.le) @[deprecated (since := "2026-03-03")] alias _root_.EventuallyEq.countable_bUnion := EventuallyEq.countable_bUnion -theorem EventuallyLE.countable_iInter [Countable ι] {s t : ι → Set α} (h : ∀ i, s i ≤ᶠ[l] t i) : - ⋂ i, s i ≤ᶠ[l] ⋂ i, t i := +theorem EventuallyLE.countable_iInter [Countable ι] {s t : ι → Set α} (h : ∀ i, s i ⊆ᶠ[l] t i) : + ⋂ i, s i ⊆ᶠ[l] ⋂ i, t i := (eventually_countable_forall.2 h).mono fun _ hst hs => mem_iInter.2 fun i => hst _ (mem_iInter.1 hs i) @[deprecated (since := "2026-03-03")] alias _root_.EventuallyLE.countable_iInter := EventuallyLE.countable_iInter -theorem EventuallyEq.countable_iInter [Countable ι] {s t : ι → Set α} (h : ∀ i, s i =ᶠ[l] t i) : - ⋂ i, s i =ᶠ[l] ⋂ i, t i := +theorem EventuallyEq.countable_iInter [Countable ι] {s t : ι → Set α} (h : ∀ i, s i =ᶠˢ[l] t i) : + ⋂ i, s i =ᶠˢ[l] ⋂ i, t i := (EventuallyLE.countable_iInter fun i => (h i).le).antisymm (EventuallyLE.countable_iInter fun i => (h i).symm.le) @@ -126,8 +126,8 @@ theorem EventuallyEq.countable_iInter [Countable ι] {s t : ι → Set α} (h : EventuallyEq.countable_iInter theorem EventuallyLE.countable_bInter {ι : Type*} {S : Set ι} (hS : S.Countable) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ≤ᶠ[l] t i hi) : - ⋂ i ∈ S, s i ‹_› ≤ᶠ[l] ⋂ i ∈ S, t i ‹_› := by + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi ⊆ᶠ[l] t i hi) : + ⋂ i ∈ S, s i ‹_› ⊆ᶠ[l] ⋂ i ∈ S, t i ‹_› := by simp only [biInter_eq_iInter] haveI := hS.toEncodable exact EventuallyLE.countable_iInter fun i => h i i.2 @@ -136,8 +136,8 @@ theorem EventuallyLE.countable_bInter {ι : Type*} {S : Set ι} (hS : S.Countabl EventuallyLE.countable_bInter theorem EventuallyEq.countable_bInter {ι : Type*} {S : Set ι} (hS : S.Countable) - {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠ[l] t i hi) : - ⋂ i ∈ S, s i ‹_› =ᶠ[l] ⋂ i ∈ S, t i ‹_› := + {s t : ∀ i ∈ S, Set α} (h : ∀ i hi, s i hi =ᶠˢ[l] t i hi) : + ⋂ i ∈ S, s i ‹_› =ᶠˢ[l] ⋂ i ∈ S, t i ‹_› := (EventuallyLE.countable_bInter hS fun i hi => (h i hi).le).antisymm (EventuallyLE.countable_bInter hS fun i hi => (h i hi).symm.le) @@ -176,13 +176,13 @@ def ofCountableUnion (l : Set (Set α)) (hUnion : ∀ S : Set (Set α), S.Countable → (∀ s ∈ S, s ∈ l) → ⋃₀ S ∈ l) (hmono : ∀ t ∈ l, ∀ s ⊆ t, s ∈ l) : Filter α := by refine .ofCountableInter {s | sᶜ ∈ l} (fun S hSc hSp ↦ ?_) fun s t ht hsub ↦ ?_ - · rw [mem_setOf_eq, compl_sInter] + · rw [mem_ofPred_eq, compl_sInter] apply hUnion (compl '' S) (hSc.image _) intro s hs rw [mem_image] at hs rcases hs with ⟨t, ht, rfl⟩ apply hSp ht - · rw [mem_setOf_eq] + · rw [mem_ofPred_eq] rw [← compl_subset_compl] at hsub exact hmono sᶜ ht tᶜ hsub @@ -192,7 +192,7 @@ instance countableInter_ofCountableUnion (l : Set (Set α)) (h₁ h₂) : @[simp] theorem mem_ofCountableUnion {l : Set (Set α)} {hunion hmono s} : - s ∈ ofCountableUnion l hunion hmono ↔ l sᶜ := + s ∈ ofCountableUnion l hunion hmono ↔ sᶜ ∈ l := Iff.rfl end Filter @@ -261,8 +261,8 @@ inductive CountableGenerateSets : Set α → Prop /-- `Filter.countableGenerate g` is the greatest `countableInterFilter` containing `g`. -/ def countableGenerate : Filter α := - ofCountableInter (CountableGenerateSets g) (fun _ => CountableGenerateSets.sInter) fun _ _ => - CountableGenerateSets.superset + ofCountableInter {s | CountableGenerateSets g s} (fun _ => CountableGenerateSets.sInter) + fun _ _ => CountableGenerateSets.superset deriving CountableInterFilter variable {g} diff --git a/Mathlib/Order/Filter/CountableSeparatingOn.lean b/Mathlib/Order/Filter/CountableSeparatingOn.lean index 7e62dc91886c2e..e4cb622e2e6ce6 100644 --- a/Mathlib/Order/Filter/CountableSeparatingOn.lean +++ b/Mathlib/Order/Filter/CountableSeparatingOn.lean @@ -251,11 +251,11 @@ theorem of_forall_separating_mem_iff (p : Set β → Prop) theorem of_eventually_mem_of_forall_separating_preimage (p : Set β → Prop) {s : Set β} [HasCountableSeparatingOn β p s] (hf : ∀ᶠ x in l, f x ∈ s) (hg : ∀ᶠ x in l, g x ∈ s) - (h : ∀ U : Set β, p U → f ⁻¹' U =ᶠ[l] g ⁻¹' U) : f =ᶠ[l] g := + (h : ∀ U : Set β, p U → f ⁻¹' U =ᶠˢ[l] g ⁻¹' U) : f =ᶠ[l] g := of_eventually_mem_of_forall_separating_mem_iff p hf hg fun U hU ↦ (h U hU).mem_iff theorem of_forall_separating_preimage (p : Set β → Prop) [HasCountableSeparatingOn β p univ] - (h : ∀ U : Set β, p U → f ⁻¹' U =ᶠ[l] g ⁻¹' U) : f =ᶠ[l] g := + (h : ∀ U : Set β, p U → f ⁻¹' U =ᶠˢ[l] g ⁻¹' U) : f =ᶠ[l] g := of_eventually_mem_of_forall_separating_preimage p (s := univ) univ_mem univ_mem h end EventuallyEq diff --git a/Mathlib/Order/Filter/CountablyGenerated.lean b/Mathlib/Order/Filter/CountablyGenerated.lean index acc28986485df4..ca496240de853f 100644 --- a/Mathlib/Order/Filter/CountablyGenerated.lean +++ b/Mathlib/Order/Filter/CountablyGenerated.lean @@ -34,7 +34,7 @@ class IsCountablyGenerated (f : Filter α) : Prop where /-- `IsCountableBasis p s` means the image of `s` bounded by `p` is a countable filter basis. -/ structure IsCountableBasis (p : ι → Prop) (s : ι → Set α) : Prop extends IsBasis p s where /-- The set of `i` that satisfy the predicate `p` is countable. -/ - countable : (setOf p).Countable + countable : (Set.ofPred p).Countable /-- We say that a filter `l` has a countable basis `s : ι → Set α` bounded by `p : ι → Prop`, if `t ∈ l` if and only if `t` includes `s i` for some `i` such that `p i`, and the set @@ -42,7 +42,7 @@ defined by `p` is countable. -/ structure HasCountableBasis (l : Filter α) (p : ι → Prop) (s : ι → Set α) : Prop extends HasBasis l p s where /-- The set of `i` that satisfy the predicate `p` is countable. -/ - countable : (setOf p).Countable + countable : (Set.ofPred p).Countable /-- A countable filter basis `B` on a type `α` is a nonempty countable collection of sets of `α` such that the intersection of two elements of this collection contains some element diff --git a/Mathlib/Order/Filter/Defs.lean b/Mathlib/Order/Filter/Defs.lean index 3c308f9c7a2ae8..19026611f0144f 100644 --- a/Mathlib/Order/Filter/Defs.lean +++ b/Mathlib/Order/Filter/Defs.lean @@ -171,7 +171,7 @@ def ker (f : Filter α) : Set α := ⋂₀ f.sets /-- The join of a filter of filters is defined by the relation `s ∈ join f ↔ {t | s ∈ t} ∈ f`. -/ def join (f : Filter (Filter α)) : Filter α where sets := { s | { t : Filter α | s ∈ t } ∈ f } - univ_sets := by simp only [mem_setOf_eq, univ_mem, setOf_true] + univ_sets := by simp only [mem_ofPred_eq, univ_mem, ofPred_true] sets_of_superset hx xy := mem_of_superset hx fun f h => mem_of_superset h xy inter_sets hx hy := mem_of_superset (inter_mem hx hy) fun f ⟨h₁, h₂⟩ => inter_mem h₁ h₂ @@ -308,6 +308,16 @@ def EventuallyLE [LE β] (l : Filter α) (f g : α → β) : Prop := @[inherit_doc] notation:50 f " ≤ᶠ[" l:50 "] " g:50 => EventuallyLE l f g +/-- Two sets `s` and `t` are *eventually equal* along a filter `l` if the set of `x` such that +`x ∈ s ↔ x ∈ t` belongs to `l`. This is notation for `(· ∈ s) =ᶠ[l] (· ∈ t)`, so all +`Filter.EventuallyEq` lemmas apply. -/ +notation:50 s " =ᶠˢ[" l:50 "] " t:50 => EventuallyEq l (fun x => x ∈ s) (fun x => x ∈ t) + +/-- A set `s` is *eventually contained* in a set `t` along a filter `l` if the set of `x` such +that `x ∈ s → x ∈ t` belongs to `l`. This is notation for `(· ∈ s) ≤ᶠ[l] (· ∈ t)`, so all +`Filter.EventuallyLE` lemmas apply. -/ +notation:50 s " ⊆ᶠ[" l:50 "] " t:50 => EventuallyLE l (fun x => x ∈ s) (fun x => x ∈ t) + /-- The forward map of a filter -/ def map (m : α → β) (f : Filter α) : Filter β where sets := preimage m ⁻¹' f.sets @@ -458,7 +468,7 @@ elab_rules : tactic return [m.mvarId!] liftMetaTactic fun goal => do goal.apply (← mkConstWithFreshMVarLevels ``Filter.univ_mem') config - evalTactic <|← `(tactic| try dsimp -zeta only [Set.mem_setOf_eq]) + evalTactic <|← `(tactic| try dsimp -zeta only [Set.mem_ofPred_eq]) if let some l := wth then evalTactic <|← `(tactic| intro $[$l]*) if let some e := usingArg then diff --git a/Mathlib/Order/Filter/ENNReal.lean b/Mathlib/Order/Filter/ENNReal.lean index 63cb8665190c29..bd50081e6bafe5 100644 --- a/Mathlib/Order/Filter/ENNReal.lean +++ b/Mathlib/Order/Filter/ENNReal.lean @@ -29,9 +29,9 @@ lemma limsSup_of_not_isCobounded {f : Filter ℝ} (hf : ¬ f.IsCobounded (· ≤ @[simp] lemma limsSup_of_not_isBounded {f : Filter ℝ} (hf : ¬ f.IsBounded (· ≤ ·)) : limsSup f = 0 := by - rw [limsSup] - convert! sInf_empty - simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + have h : {a : ℝ | ∀ᶠ n in f, n ≤ a} = ∅ := by + simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + rw [limsSup, h, sInf_empty] @[simp] lemma limsInf_of_not_isCobounded {f : Filter ℝ} (hf : ¬ f.IsCobounded (· ≥ ·)) : @@ -39,9 +39,9 @@ lemma limsInf_of_not_isCobounded {f : Filter ℝ} (hf : ¬ f.IsCobounded (· ≥ @[simp] lemma limsInf_of_not_isBounded {f : Filter ℝ} (hf : ¬ f.IsBounded (· ≥ ·)) : limsInf f = 0 := by - rw [limsInf] - convert! sSup_empty - simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + have h : {a : ℝ | ∀ᶠ n in f, a ≤ n} = ∅ := by + simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + rw [limsInf, h, sSup_empty] @[simp] lemma limsup_of_not_isCoboundedUnder (hf : ¬ f.IsCoboundedUnder (· ≤ ·) u) : limsup u f = 0 := @@ -107,9 +107,9 @@ variable {ι : Type*} {f : Filter ι} {u : ι → ℝ≥0} @[simp] lemma limsSup_of_not_isBounded {f : Filter ℝ≥0} (hf : ¬ f.IsBounded (· ≤ ·)) : limsSup f = 0 := by - rw [limsSup, ← bot_eq_zero] - convert! sInf_empty - simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + have h : {a : ℝ≥0 | ∀ᶠ n in f, n ≤ a} = ∅ := by + simpa [Set.eq_empty_iff_forall_notMem, IsBounded] using hf + rw [limsSup, h, NNReal.sInf_empty] @[simp] lemma limsInf_of_not_isCobounded {f : Filter ℝ≥0} (hf : ¬ f.IsCobounded (· ≥ ·)) : @@ -296,7 +296,7 @@ lemma toReal_limsup {u : α → ℝ≥0∞} (h₁ : ∀ᶠ a in f, u a ≠ ∞) obtain ⟨x, hx⟩ := h₂ rw [eventually_map] at hx have hx₀ : 0 ≤ x := by obtain ⟨i, hi⟩ := hx.exists; exact toReal_nonneg.trans hi - simp only [limsup, limsSup, eventually_map, ne_eq, sInf_eq_top, Set.mem_setOf_eq, not_forall] + simp only [limsup, limsSup, eventually_map, ne_eq, sInf_eq_top, Set.mem_ofPred_eq, not_forall] refine ⟨.ofReal x, ?_, by simp⟩ filter_upwards [h₁, hx] with i hi simp [le_ofReal_iff_toReal_le, *] diff --git a/Mathlib/Order/Filter/EventuallyConst.lean b/Mathlib/Order/Filter/EventuallyConst.lean index f7492b7e4c74ad..efd05e744824bd 100644 --- a/Mathlib/Order/Filter/EventuallyConst.lean +++ b/Mathlib/Order/Filter/EventuallyConst.lean @@ -68,15 +68,15 @@ theorem eventuallyConst_pred {p : α → Prop} : simp [eventuallyConst_pred', or_comm, EventuallyEq] theorem eventuallyConst_set' {s : Set α} : - EventuallyConst s l ↔ (s =ᶠ[l] (∅ : Set α)) ∨ s =ᶠ[l] univ := + EventuallyConst (· ∈ s) l ↔ (s =ᶠˢ[l] (∅ : Set α)) ∨ s =ᶠˢ[l] univ := eventuallyConst_pred' theorem eventuallyConst_set {s : Set α} : - EventuallyConst s l ↔ (∀ᶠ x in l, x ∈ s) ∨ (∀ᶠ x in l, x ∉ s) := + EventuallyConst (· ∈ s) l ↔ (∀ᶠ x in l, x ∈ s) ∨ (∀ᶠ x in l, x ∉ s) := eventuallyConst_pred theorem eventuallyConst_preimage {s : Set β} {f : α → β} : - EventuallyConst (f ⁻¹' s) l ↔ EventuallyConst s (map f l) := + EventuallyConst (· ∈ f ⁻¹' s) l ↔ EventuallyConst (· ∈ s) (map f l) := .rfl theorem EventuallyEq.eventuallyConst_iff {g : α → β} (h : f =ᶠ[l] g) : @@ -137,22 +137,22 @@ variable [One β] {s : Set α} {c : β} @[to_additive] lemma of_mulIndicator_const (h : EventuallyConst (s.mulIndicator fun _ ↦ c) l) (hc : c ≠ 1) : - EventuallyConst s l := by + EventuallyConst (· ∈ s) l := by simpa [Function.comp_def, hc, imp_false] using! h.comp (· = c) @[to_additive] -theorem mulIndicator_const (h : EventuallyConst s l) (c : β) : +theorem mulIndicator_const (h : EventuallyConst (· ∈ s) l) (c : β) : EventuallyConst (s.mulIndicator fun _ ↦ c) l := by classical exact h.comp (if · then c else 1) @[to_additive] theorem mulIndicator_const_iff_of_ne (hc : c ≠ 1) : - EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ EventuallyConst s l := + EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ EventuallyConst (· ∈ s) l := ⟨(of_mulIndicator_const · hc), (mulIndicator_const · c)⟩ @[to_additive (attr := simp)] theorem mulIndicator_const_iff : - EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ c = 1 ∨ EventuallyConst s l := by + EventuallyConst (s.mulIndicator fun _ ↦ c) l ↔ c = 1 ∨ EventuallyConst (· ∈ s) l := by rcases eq_or_ne c 1 with rfl | hc <;> simp [mulIndicator_const_iff_of_ne, *] end EventuallyConst diff --git a/Mathlib/Order/Filter/Extr.lean b/Mathlib/Order/Filter/Extr.lean index f8337827d8f967..5f806dabb50622 100644 --- a/Mathlib/Order/Filter/Extr.lean +++ b/Mathlib/Order/Filter/Extr.lean @@ -144,7 +144,7 @@ theorem IsMinOn.isGLB (ha : a ∈ s) (hfsa : IsMinOn f s a) : IsGLB {f x | x ∈ s} (f a) := by rw [isGLB_iff_le_iff] intro b - simp only [mem_lowerBounds, mem_setOf_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] + simp only [mem_lowerBounds, mem_ofPred_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] exact ⟨fun hba x hx ↦ le_trans hba (hfsa hx), fun hb ↦ hb a ha⟩ theorem IsMaxOn.isLUB (ha : a ∈ s) (hfsa : IsMaxOn f s a) : diff --git a/Mathlib/Order/Filter/Finite.lean b/Mathlib/Order/Filter/Finite.lean index 9a83bbff60523e..712a17a0b01c94 100644 --- a/Mathlib/Order/Filter/Finite.lean +++ b/Mathlib/Order/Filter/Finite.lean @@ -140,7 +140,7 @@ theorem mem_biInf_principal {ι : Type*} {p : ι → Prop} {s : ι → Set α} { rintro ⟨I, hIf, V, hV₁, hV₂, rfl⟩ choose! t ht₁ ht₂ using hV₁ refine ⟨I ∩ {i | p i}, hIf.inter_of_left _, fun i ↦ And.right, ?_⟩ - simp only [mem_inter_iff, iInter_and, biInter_eq_iInter, ht₂, mem_setOf_eq] + simp only [mem_inter_iff, iInter_and, biInter_eq_iInter, ht₂, mem_ofPred_eq] gcongr with i hpi exact ht₁ i hpi · rintro ⟨I, hIf, hpI, hst⟩ @@ -246,12 +246,12 @@ end Lattice @[simp] theorem eventually_all {ι : Sort*} [Finite ι] {l} {p : ι → α → Prop} : (∀ᶠ x in l, ∀ i, p i x) ↔ ∀ i, ∀ᶠ x in l, p i x := by - simpa only [Filter.Eventually, setOf_forall] using iInter_mem + simpa only [Filter.Eventually, ofPred_forall] using iInter_mem @[simp] theorem eventually_all_finite {ι} {I : Set ι} (hI : I.Finite) {l} {p : ι → α → Prop} : (∀ᶠ x in l, ∀ i ∈ I, p i x) ↔ ∀ i ∈ I, ∀ᶠ x in l, p i x := by - simpa only [Filter.Eventually, setOf_forall] using biInter_mem hI + simpa only [Filter.Eventually, ofPred_forall] using biInter_mem hI protected alias _root_.Set.Finite.eventually_all := eventually_all_finite @@ -295,24 +295,24 @@ variable {l : Filter α} {f g : α → β} variable {l : Filter α} protected lemma EventuallyLE.iUnion [Finite ι] {s t : ι → Set α} - (h : ∀ i, s i ≤ᶠ[l] t i) : (⋃ i, s i) ≤ᶠ[l] ⋃ i, t i := + (h : ∀ i, s i ⊆ᶠ[l] t i) : (⋃ i, s i) ⊆ᶠ[l] ⋃ i, t i := (eventually_all.2 h).mono fun _x hx hx' ↦ let ⟨i, hi⟩ := mem_iUnion.1 hx'; mem_iUnion.2 ⟨i, hx i hi⟩ protected lemma EventuallyEq.iUnion [Finite ι] {s t : ι → Set α} - (h : ∀ i, s i =ᶠ[l] t i) : (⋃ i, s i) =ᶠ[l] ⋃ i, t i := + (h : ∀ i, s i =ᶠˢ[l] t i) : (⋃ i, s i) =ᶠˢ[l] ⋃ i, t i := (EventuallyLE.iUnion fun i ↦ (h i).le).antisymm <| .iUnion fun i ↦ (h i).symm.le protected lemma EventuallyLE.iInter [Finite ι] {s t : ι → Set α} - (h : ∀ i, s i ≤ᶠ[l] t i) : (⋂ i, s i) ≤ᶠ[l] ⋂ i, t i := + (h : ∀ i, s i ⊆ᶠ[l] t i) : (⋂ i, s i) ⊆ᶠ[l] ⋂ i, t i := (eventually_all.2 h).mono fun _x hx hx' ↦ mem_iInter.2 fun i ↦ hx i (mem_iInter.1 hx' i) protected lemma EventuallyEq.iInter [Finite ι] {s t : ι → Set α} - (h : ∀ i, s i =ᶠ[l] t i) : (⋂ i, s i) =ᶠ[l] ⋂ i, t i := + (h : ∀ i, s i =ᶠˢ[l] t i) : (⋂ i, s i) =ᶠˢ[l] ⋂ i, t i := (EventuallyLE.iInter fun i ↦ (h i).le).antisymm <| .iInter fun i ↦ (h i).symm.le lemma _root_.Set.Finite.eventuallyLE_iUnion {ι : Type*} {s : Set ι} (hs : s.Finite) - {f g : ι → Set α} (hle : ∀ i ∈ s, f i ≤ᶠ[l] g i) : (⋃ i ∈ s, f i) ≤ᶠ[l] (⋃ i ∈ s, g i) := by + {f g : ι → Set α} (hle : ∀ i ∈ s, f i ⊆ᶠ[l] g i) : (⋃ i ∈ s, f i) ⊆ᶠ[l] (⋃ i ∈ s, g i) := by have := hs.to_subtype rw [biUnion_eq_iUnion, biUnion_eq_iUnion] exact .iUnion fun i ↦ hle i.1 i.2 @@ -320,14 +320,14 @@ lemma _root_.Set.Finite.eventuallyLE_iUnion {ι : Type*} {s : Set ι} (hs : s.Fi alias EventuallyLE.biUnion := Set.Finite.eventuallyLE_iUnion lemma _root_.Set.Finite.eventuallyEq_iUnion {ι : Type*} {s : Set ι} (hs : s.Finite) - {f g : ι → Set α} (heq : ∀ i ∈ s, f i =ᶠ[l] g i) : (⋃ i ∈ s, f i) =ᶠ[l] (⋃ i ∈ s, g i) := + {f g : ι → Set α} (heq : ∀ i ∈ s, f i =ᶠˢ[l] g i) : (⋃ i ∈ s, f i) =ᶠˢ[l] (⋃ i ∈ s, g i) := (EventuallyLE.biUnion hs fun i hi ↦ (heq i hi).le).antisymm <| .biUnion hs fun i hi ↦ (heq i hi).symm.le alias EventuallyEq.biUnion := Set.Finite.eventuallyEq_iUnion lemma _root_.Set.Finite.eventuallyLE_iInter {ι : Type*} {s : Set ι} (hs : s.Finite) - {f g : ι → Set α} (hle : ∀ i ∈ s, f i ≤ᶠ[l] g i) : (⋂ i ∈ s, f i) ≤ᶠ[l] (⋂ i ∈ s, g i) := by + {f g : ι → Set α} (hle : ∀ i ∈ s, f i ⊆ᶠ[l] g i) : (⋂ i ∈ s, f i) ⊆ᶠ[l] (⋂ i ∈ s, g i) := by have := hs.to_subtype rw [biInter_eq_iInter, biInter_eq_iInter] exact .iInter fun i ↦ hle i.1 i.2 @@ -335,26 +335,26 @@ lemma _root_.Set.Finite.eventuallyLE_iInter {ι : Type*} {s : Set ι} (hs : s.Fi alias EventuallyLE.biInter := Set.Finite.eventuallyLE_iInter lemma _root_.Set.Finite.eventuallyEq_iInter {ι : Type*} {s : Set ι} (hs : s.Finite) - {f g : ι → Set α} (heq : ∀ i ∈ s, f i =ᶠ[l] g i) : (⋂ i ∈ s, f i) =ᶠ[l] (⋂ i ∈ s, g i) := + {f g : ι → Set α} (heq : ∀ i ∈ s, f i =ᶠˢ[l] g i) : (⋂ i ∈ s, f i) =ᶠˢ[l] (⋂ i ∈ s, g i) := (EventuallyLE.biInter hs fun i hi ↦ (heq i hi).le).antisymm <| .biInter hs fun i hi ↦ (heq i hi).symm.le alias EventuallyEq.biInter := Set.Finite.eventuallyEq_iInter lemma _root_.Finset.eventuallyLE_iUnion {ι : Type*} (s : Finset ι) {f g : ι → Set α} - (hle : ∀ i ∈ s, f i ≤ᶠ[l] g i) : (⋃ i ∈ s, f i) ≤ᶠ[l] (⋃ i ∈ s, g i) := + (hle : ∀ i ∈ s, f i ⊆ᶠ[l] g i) : (⋃ i ∈ s, f i) ⊆ᶠ[l] (⋃ i ∈ s, g i) := .biUnion s.finite_toSet hle lemma _root_.Finset.eventuallyEq_iUnion {ι : Type*} (s : Finset ι) {f g : ι → Set α} - (heq : ∀ i ∈ s, f i =ᶠ[l] g i) : (⋃ i ∈ s, f i) =ᶠ[l] (⋃ i ∈ s, g i) := + (heq : ∀ i ∈ s, f i =ᶠˢ[l] g i) : (⋃ i ∈ s, f i) =ᶠˢ[l] (⋃ i ∈ s, g i) := .biUnion s.finite_toSet heq lemma _root_.Finset.eventuallyLE_iInter {ι : Type*} (s : Finset ι) {f g : ι → Set α} - (hle : ∀ i ∈ s, f i ≤ᶠ[l] g i) : (⋂ i ∈ s, f i) ≤ᶠ[l] (⋂ i ∈ s, g i) := + (hle : ∀ i ∈ s, f i ⊆ᶠ[l] g i) : (⋂ i ∈ s, f i) ⊆ᶠ[l] (⋂ i ∈ s, g i) := .biInter s.finite_toSet hle lemma _root_.Finset.eventuallyEq_iInter {ι : Type*} (s : Finset ι) {f g : ι → Set α} - (heq : ∀ i ∈ s, f i =ᶠ[l] g i) : (⋂ i ∈ s, f i) =ᶠ[l] (⋂ i ∈ s, g i) := + (heq : ∀ i ∈ s, f i =ᶠˢ[l] g i) : (⋂ i ∈ s, f i) =ᶠˢ[l] (⋂ i ∈ s, g i) := .biInter s.finite_toSet heq end EventuallyEq diff --git a/Mathlib/Order/Filter/IndicatorFunction.lean b/Mathlib/Order/Filter/IndicatorFunction.lean index 9d559233eff36d..4b0feac00a193c 100644 --- a/Mathlib/Order/Filter/IndicatorFunction.lean +++ b/Mathlib/Order/Filter/IndicatorFunction.lean @@ -31,7 +31,7 @@ section One variable [One M] {s t : Set α} {f g : α → M} {a : α} {l : Filter α} @[to_additive] -theorem mulIndicator_eventuallyEq (hf : f =ᶠ[l ⊓ 𝓟 s] g) (hs : s =ᶠ[l] t) : +theorem mulIndicator_eventuallyEq (hf : f =ᶠ[l ⊓ 𝓟 s] g) (hs : s =ᶠˢ[l] t) : mulIndicator s f =ᶠ[l] mulIndicator t g := (eventually_inf_principal.1 hf).mp <| hs.mem_iff.mono fun x hst hfg => by_cases @@ -103,7 +103,7 @@ theorem tendsto_mulIndicator_biUnion_finset {ι} [One β] (s : ι → Set α) (f @[to_additive] protected theorem Filter.EventuallyEq.mulSupport [One β] {f g : α → β} {l : Filter α} (h : f =ᶠ[l] g) : - Function.mulSupport f =ᶠ[l] Function.mulSupport g := + Function.mulSupport f =ᶠˢ[l] Function.mulSupport g := h.preimage ({1}ᶜ : Set β) @[to_additive] @@ -119,18 +119,18 @@ theorem Filter.EventuallyEq.mulIndicator_one [One β] {l : Filter α} {f : α @[to_additive] theorem Filter.EventuallyEq.of_mulIndicator [One β] {l : Filter α} {f : α → β} (hf : ∀ᶠ x in l, f x ≠ 1) {s t : Set α} (h : s.mulIndicator f =ᶠ[l] t.mulIndicator f) : - s =ᶠ[l] t := by - have : ∀ {s : Set α}, Function.mulSupport (s.mulIndicator f) =ᶠ[l] s := fun {s} ↦ by + s =ᶠˢ[l] t := by + have : ∀ {s : Set α}, Function.mulSupport (s.mulIndicator f) =ᶠˢ[l] s := fun {s} ↦ by rw [mulSupport_mulIndicator] exact (hf.mono fun x hx ↦ and_iff_left hx).set_eq exact this.symm.trans <| h.mulSupport.trans this @[to_additive] theorem Filter.EventuallyEq.of_mulIndicator_const [One β] {l : Filter α} {c : β} (hc : c ≠ 1) - {s t : Set α} (h : s.mulIndicator (fun _ ↦ c) =ᶠ[l] t.mulIndicator fun _ ↦ c) : s =ᶠ[l] t := + {s t : Set α} (h : s.mulIndicator (fun _ ↦ c) =ᶠ[l] t.mulIndicator fun _ ↦ c) : s =ᶠˢ[l] t := .of_mulIndicator (Eventually.of_forall fun _ ↦ hc) h @[to_additive] theorem Filter.mulIndicator_const_eventuallyEq [One β] {l : Filter α} {c : β} (hc : c ≠ 1) - {s t : Set α} : s.mulIndicator (fun _ ↦ c) =ᶠ[l] t.mulIndicator (fun _ ↦ c) ↔ s =ᶠ[l] t := - ⟨.of_mulIndicator_const hc, mulIndicator_eventuallyEq .rfl⟩ + {s t : Set α} : s.mulIndicator (fun _ ↦ c) =ᶠ[l] t.mulIndicator (fun _ ↦ c) ↔ s =ᶠˢ[l] t := + ⟨EventuallyEq.of_mulIndicator_const hc, mulIndicator_eventuallyEq .rfl⟩ diff --git a/Mathlib/Order/Filter/Lift.lean b/Mathlib/Order/Filter/Lift.lean index 8b1aac68e36d41..e85e736676879e 100644 --- a/Mathlib/Order/Filter/Lift.lean +++ b/Mathlib/Order/Filter/Lift.lean @@ -73,7 +73,7 @@ theorem mem_lift_sets (hg : Monotone g) {s : Set β} : s ∈ f.lift g ↔ ∃ t theorem sInter_lift_sets (hg : Monotone g) : ⋂₀ { s | s ∈ f.lift g } = ⋂ s ∈ f, ⋂₀ { t | t ∈ g s } := by - simp only [sInter_eq_biInter, mem_setOf_eq, mem_lift_sets hg, iInter_exists, + simp only [sInter_eq_biInter, mem_ofPred_eq, mem_lift_sets hg, iInter_exists, iInter_and, @iInter_comm _ (Set β)] theorem mem_lift {s : Set β} {t : Set α} (ht : t ∈ f) (hs : s ∈ g t) : s ∈ f.lift g := diff --git a/Mathlib/Order/Filter/Partial.lean b/Mathlib/Order/Filter/Partial.lean index 1b50ff84afc531..1690ef591d4e49 100644 --- a/Mathlib/Order/Filter/Partial.lean +++ b/Mathlib/Order/Filter/Partial.lean @@ -63,7 +63,7 @@ def rmap (r : SetRel α β) (l : Filter α) : Filter β where univ_sets := by simp sets_of_superset hs st := mem_of_superset hs (SetRel.core_mono st) inter_sets hs ht := by - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] convert! inter_mem hs ht rw [← SetRel.core_inter] @@ -110,7 +110,7 @@ theorem rcomap_rcomap (r : SetRel α β) (s : SetRel β γ) (l : Filter γ) : rcomap r (rcomap s l) = rcomap (r.comp s) l := filter_eq <| by ext t - simp only [rcomap_sets, SetRel.image, Filter.mem_sets, Set.mem_setOf_eq, SetRel.core_comp] + simp only [rcomap_sets, SetRel.image, Filter.mem_sets, Set.mem_ofPred_eq, SetRel.core_comp] constructor · rintro ⟨u, ⟨v, vsets, hv⟩, h⟩ exact ⟨v, vsets, Set.Subset.trans (SetRel.core_mono hv) h⟩ diff --git a/Mathlib/Order/Filter/Prod.lean b/Mathlib/Order/Filter/Prod.lean index e6f62fd24324e3..f0e5f64462da0b 100644 --- a/Mathlib/Order/Filter/Prod.lean +++ b/Mathlib/Order/Filter/Prod.lean @@ -88,7 +88,7 @@ theorem mem_prod_top {s : Set (α × β)} : theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} : (∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y) := by rw [eventually_iff, eventually_iff, mem_prod_principal] - simp only [mem_setOf_eq] + simp only [mem_ofPred_eq] theorem comap_prod (f : α → β × γ) (b : Filter β) (c : Filter γ) : comap f (b ×ˢ c) = comap (Prod.fst ∘ f) b ⊓ comap (Prod.snd ∘ f) c := by @@ -114,7 +114,12 @@ theorem eventually_prod_iff {p : α × β → Prop} : (∀ᶠ x in f ×ˢ g, p x) ↔ ∃ pa : α → Prop, (∀ᶠ x in f, pa x) ∧ ∃ pb : β → Prop, (∀ᶠ y in g, pb y) ∧ ∀ {x}, pa x → ∀ {y}, pb y → p (x, y) := by - simpa only [Set.prod_subset_iff] using! @mem_prod_iff α β p f g + constructor + · intro h + obtain ⟨t₁, ht₁, t₂, ht₂, hsub⟩ := mem_prod_iff.1 h + exact ⟨(· ∈ t₁), ht₁, (· ∈ t₂), ht₂, fun {x} hx {y} hy ↦ hsub (Set.mk_mem_prod hx hy)⟩ + · rintro ⟨pa, hpa, pb, hpb, h⟩ + exact mem_prod_iff.2 ⟨{x | pa x}, hpa, {y | pb y}, hpb, fun x hx ↦ h hx.1 hx.2⟩ theorem tendsto_fst : Tendsto Prod.fst (f ×ˢ g) f := tendsto_inf_left tendsto_comap diff --git a/Mathlib/Order/Filter/Tendsto.lean b/Mathlib/Order/Filter/Tendsto.lean index ed556e78c1f9f6..0f8b82ade46e59 100644 --- a/Mathlib/Order/Filter/Tendsto.lean +++ b/Mathlib/Order/Filter/Tendsto.lean @@ -34,7 +34,7 @@ theorem tendsto_def {f : α → β} {l₁ : Filter α} {l₂ : Filter β} : theorem tendsto_iff_eventually {f : α → β} {l₁ : Filter α} {l₂ : Filter β} : Tendsto f l₁ l₂ ↔ ∀ ⦃p : β → Prop⦄, (∀ᶠ y in l₂, p y) → ∀ᶠ x in l₁, p (f x) := - Iff.rfl + ⟨fun hf _p h => hf h, fun h s hs => h (p := (· ∈ s)) hs⟩ theorem tendsto_iff_forall_eventually_mem {f : α → β} {l₁ : Filter α} {l₂ : Filter β} : Tendsto f l₁ l₂ ↔ ∀ s ∈ l₂, ∀ᶠ x in l₁, f x ∈ s := @@ -257,7 +257,7 @@ theorem tendsto_pure_left {f : α → β} {a : α} {l : Filter β} : @[simp] theorem map_inf_principal_preimage {f : α → β} {s : Set β} {l : Filter α} : map f (l ⊓ 𝓟 (f ⁻¹' s)) = map f l ⊓ 𝓟 s := - Filter.ext fun t => by simp only [mem_map', mem_inf_principal, mem_setOf_eq, mem_preimage] + Filter.ext fun t => by simp only [mem_map', mem_inf_principal, mem_ofPred_eq, mem_preimage] /-- If two filters are disjoint, then a function cannot tend to both of them along a non-trivial filter. -/ diff --git a/Mathlib/Order/Filter/TendstoCofinite.lean b/Mathlib/Order/Filter/TendstoCofinite.lean index ecec915ed07312..1f6d2bcc64cfc0 100644 --- a/Mathlib/Order/Filter/TendstoCofinite.lean +++ b/Mathlib/Order/Filter/TendstoCofinite.lean @@ -71,7 +71,8 @@ namespace TendstoCofinite @[instance] lemma comp [TendstoCofinite g] [TendstoCofinite f] : TendstoCofinite (g ∘ f) := (tendstoCofinite_iff_finite_preimage_singleton _).mpr (fun r ↦ by - simpa using! TendstoCofinite.finite_preimage f (TendstoCofinite.finite_preimage g (by simp))) + simpa using! TendstoCofinite.finite_preimage f + (TendstoCofinite.finite_preimage g (finite_singleton r))) @[instance] lemma id : TendstoCofinite (id : α → α) := by simp [tendstoCofinite_iff_finite_preimage_singleton] @@ -115,7 +116,7 @@ theorem Finsupp.mapDomain_tendstoCofinite [TendstoCofinite f] : let e : s ↪ α := Function.Embedding.subtype (fun u ↦ u ∈ s) refine Set.Finite.subset (Set.Finite.image (embDomain e) <| finite_of_degree_le (degree x)) ?_ simp only [Set.subset_def, Set.mem_preimage, Set.mem_singleton_iff, Set.mem_image, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] refine fun y hy ↦ ⟨y.comapDomain e e.injective.injOn, ?_, embDomain_comapDomain ?_⟩ · rw [← hy, degree_mapDomain] exact degree_comapDomain_le_of_canonicallyOrderedAdd .. diff --git a/Mathlib/Order/Filter/Ultrafilter/Basic.lean b/Mathlib/Order/Filter/Ultrafilter/Basic.lean index 43971b62f5fbe5..99e3e498e9d598 100644 --- a/Mathlib/Order/Filter/Ultrafilter/Basic.lean +++ b/Mathlib/Order/Filter/Ultrafilter/Basic.lean @@ -42,8 +42,8 @@ theorem finite_biUnion_mem_iff {is : Set β} {s : β → Set α} (his : is.Finit lemma eventually_exists_mem_iff {is : Set β} {P : β → α → Prop} (his : is.Finite) : (∀ᶠ i in f, ∃ a ∈ is, P a i) ↔ ∃ a ∈ is, ∀ᶠ i in f, P a i := by simp only [Filter.Eventually, Ultrafilter.mem_coe] - convert! f.finite_biUnion_mem_iff his (s := P) with i - aesop + rw [show {i | ∃ a ∈ is, P a i} = ⋃ a ∈ is, {i | P a i} by ext; simp] + exact finite_biUnion_mem_iff his lemma eventually_exists_iff [Finite β] {P : β → α → Prop} : (∀ᶠ i in f, ∃ a, P a i) ↔ ∃ a, ∀ᶠ i in f, P a i := by diff --git a/Mathlib/Order/Filter/Ultrafilter/Defs.lean b/Mathlib/Order/Filter/Ultrafilter/Defs.lean index 26b11cfb7a8b8f..eca0be8cf00921 100644 --- a/Mathlib/Order/Filter/Ultrafilter/Defs.lean +++ b/Mathlib/Order/Filter/Ultrafilter/Defs.lean @@ -263,7 +263,7 @@ instance [Nonempty α] : Nonempty (Ultrafilter α) := defined in terms of map and join. -/ def bind (f : Ultrafilter α) (m : α → Ultrafilter β) : Ultrafilter β := ofComplNotMemIff (Filter.bind ↑f fun x => ↑(m x)) fun s => by - simp only [mem_bind', mem_coe, ← compl_mem_iff_notMem, compl_setOf, compl_compl] + simp only [mem_bind', mem_coe, ← compl_mem_iff_notMem, compl_ofPred, compl_compl] instance instBind : Bind Ultrafilter := ⟨@Ultrafilter.bind⟩ @@ -340,7 +340,7 @@ theorem Iic_pure (a : α) : Iic (pure a : Filter α) = {⊥, pure a} := theorem mem_iff_ultrafilter : s ∈ f ↔ ∀ g : Ultrafilter α, ↑g ≤ f → s ∈ g := by refine ⟨fun hf g hg => hg hf, fun H => by_contra fun hf => ?_⟩ set g : Filter (sᶜ : Set α) := comap (↑) f - haveI : NeBot g := comap_neBot_iff_compl_range.2 (by simpa [compl_setOf]) + haveI : NeBot g := comap_neBot_iff_compl_range.2 (by simpa [compl_ofPred]) simpa using H ((of g).map (↑)) (map_le_iff_le_comap.mpr (of_le g)) theorem le_iff_ultrafilter {f₁ f₂ : Filter α} : f₁ ≤ f₂ ↔ ∀ g : Ultrafilter α, ↑g ≤ f₁ → ↑g ≤ f₂ := diff --git a/Mathlib/Order/Filter/ZeroAndBoundedAtFilter.lean b/Mathlib/Order/Filter/ZeroAndBoundedAtFilter.lean index fa5ab3d3360876..1b4a42c48e306c 100644 --- a/Mathlib/Order/Filter/ZeroAndBoundedAtFilter.lean +++ b/Mathlib/Order/Filter/ZeroAndBoundedAtFilter.lean @@ -57,7 +57,7 @@ def zeroAtFilterSubmodule [TopologicalSpace β] [Semiring 𝕜] [AddCommMonoid β] [Module 𝕜 β] [ContinuousAdd β] [ContinuousConstSMul 𝕜 β] (l : Filter α) : Submodule 𝕜 (α → β) where - carrier := ZeroAtFilter l + carrier := {f | ZeroAtFilter l f} zero_mem' := zero_zeroAtFilter l add_mem' ha hb := ha.add hb smul_mem' c _ hf := hf.smul c @@ -66,7 +66,7 @@ def zeroAtFilterSubmodule which tend to zero along `l`. -/ def zeroAtFilterAddSubmonoid [TopologicalSpace β] [AddZeroClass β] [ContinuousAdd β] (l : Filter α) : AddSubmonoid (α → β) where - carrier := ZeroAtFilter l + carrier := {f | ZeroAtFilter l f} add_mem' ha hb := ha.add hb zero_mem' := zero_zeroAtFilter l @@ -119,7 +119,7 @@ variable (𝕜) in def boundedFilterSubmodule [SeminormedRing 𝕜] [SeminormedAddCommGroup β] [Module 𝕜 β] [IsBoundedSMul 𝕜 β] (l : Filter α) : Submodule 𝕜 (α → β) where - carrier := BoundedAtFilter l + carrier := {f | BoundedAtFilter l f} zero_mem' := const_boundedAtFilter l 0 add_mem' hf hg := hf.add hg smul_mem' c _ hf := hf.smul c @@ -132,11 +132,12 @@ def boundedFilterSubalgebra Submodule.toSubalgebra (boundedFilterSubmodule 𝕜 l) (const_boundedAtFilter l (1 : β)) - (fun f g hf hg ↦ by simpa only [Pi.one_apply, mul_one, norm_mul] using! hf.mul hg) + (fun f g (hf : BoundedAtFilter l f) (hg : BoundedAtFilter l g) ↦ by + simpa only [Pi.one_apply, mul_one, norm_mul] using! hf.mul hg) theorem BoundedAtFilter.prod {ι : Type} (s : Finset ι) [SeminormedCommRing β] {l : Filter α} {f : ι → α → β} (h : ∀ i ∈ s, BoundedAtFilter l (f i)) : BoundedAtFilter l (∏ i ∈ s, f i) := - (boundedFilterSubalgebra β l).prod_mem (f := f) h + (boundedFilterSubalgebra β l).prod_mem (t := s) (f := f) h end Filter diff --git a/Mathlib/Order/Interval/Set/OrdConnectedComponent.lean b/Mathlib/Order/Interval/Set/OrdConnectedComponent.lean index 442742305150e7..d453009351c782 100644 --- a/Mathlib/Order/Interval/Set/OrdConnectedComponent.lean +++ b/Mathlib/Order/Interval/Set/OrdConnectedComponent.lean @@ -66,7 +66,7 @@ theorem ordConnectedComponent_univ : ordConnectedComponent univ x = univ := by theorem ordConnectedComponent_inter (s t : Set α) (x : α) : ordConnectedComponent (s ∩ t) x = ordConnectedComponent s x ∩ ordConnectedComponent t x := by - simp [ordConnectedComponent, setOf_and] + simp [ordConnectedComponent, ofPred_and] theorem mem_ordConnectedComponent_comm : y ∈ ordConnectedComponent s x ↔ x ∈ ordConnectedComponent s y := by @@ -116,7 +116,7 @@ theorem ordConnectedProj_eq {x y : s} : /-- A set that intersects each order connected component of a set by a single point. Defined as the range of `Set.ordConnectedProj s`. -/ -def ordConnectedSection (s : Set α) : Set α := +noncomputable def ordConnectedSection (s : Set α) : Set α := range <| ordConnectedProj s theorem dual_ordConnectedSection (s : Set α) : @@ -165,7 +165,7 @@ theorem dual_ordSeparatingSet : /-- An auxiliary neighborhood that will be used in the proof of `OrderTopology.CompletelyNormalSpace`. -/ -def ordT5Nhd (s t : Set α) : Set α := +noncomputable def ordT5Nhd (s t : Set α) : Set α := ⋃ x ∈ s, ordConnectedComponent (tᶜ ∩ (ordConnectedSection <| ordSeparatingSet s t)ᶜ) x theorem disjoint_ordT5Nhd : Disjoint (ordT5Nhd s t) (ordT5Nhd t s) := by diff --git a/Mathlib/Order/Interval/Set/Pi.lean b/Mathlib/Order/Interval/Set/Pi.lean index a41b95796a6855..2ce0bf7b0c184f 100644 --- a/Mathlib/Order/Interval/Set/Pi.lean +++ b/Mathlib/Order/Interval/Set/Pi.lean @@ -274,7 +274,7 @@ theorem pi_univ_Ioc_update_union (x y : ∀ i, α i) (i₀ : ι) (m : α i₀) ( pi univ fun i ↦ Ioc (update x i₀ m i) (y i)) = pi univ fun i ↦ Ioc (x i) (y i) := by simp_rw [pi_univ_Ioc_update_left hm.1, pi_univ_Ioc_update_right hm.2, ← union_inter_distrib_right, - ← setOf_or, le_or_gt, setOf_true, univ_inter] + ← ofPred_or, le_or_gt, ofPred_true, univ_inter] /-- If `x`, `y`, `x'`, and `y'` are functions `Π i : ι, α i`, then the set difference between the box `[x, y]` and the product of the open intervals `(x' i, y' i)` diff --git a/Mathlib/Order/JordanHolder.lean b/Mathlib/Order/JordanHolder.lean index fc6a98ca3a949d..3c72fc73301560 100644 --- a/Mathlib/Order/JordanHolder.lean +++ b/Mathlib/Order/JordanHolder.lean @@ -224,7 +224,7 @@ theorem isMaximal_eraseLast_last {s : CompositionSeries X} (h : 0 < s.length) : IsMaximal s.eraseLast.last s.last := by rw [last_eraseLast, last] have := s.step ⟨s.length - 1, by lia⟩ - simp only [Fin.castSucc_mk, Fin.succ_mk, mem_setOf_eq] at this + simp only [Fin.castSucc_mk, Fin.succ_mk, mem_ofPred_eq] at this convert! this using 3 exact (tsub_add_cancel_of_le h).symm diff --git a/Mathlib/Order/KonigLemma.lean b/Mathlib/Order/KonigLemma.lean index a3817edf8f0d0b..4f30b4079b91e2 100644 --- a/Mathlib/Order/KonigLemma.lean +++ b/Mathlib/Order/KonigLemma.lean @@ -143,7 +143,7 @@ theorem exists_seq_forall_proj_of_forall_finite {α : ℕ → Type*} [Finite (α exact fun i x h ↦ ⟨zero_le, h⟩ have hfin : ∀ (a : αs), {x | a ⋖ x}.Finite := by refine fun ⟨i, a⟩ ↦ ((hfin i a).image (fun b ↦ ⟨_, b⟩)).subset ?_ - simp only [αs, hcovby, subset_def, mem_setOf_eq, mem_image, and_imp, Sigma.forall] + simp only [αs, hcovby, subset_def, mem_ofPred_eq, mem_image, and_imp, Sigma.forall] exact fun j b ⟨_, _⟩ hj ↦ ⟨π hj.le b, by rwa [π_trans], by cases hj; rw [π_refl]⟩ obtain ⟨f, hf0, hf⟩ := exists_orderEmbedding_covby_of_forall_covby_finite hfin ha₀inf have hr : ∀ i, (f i).1 = i := diff --git a/Mathlib/Order/LiminfLimsup.lean b/Mathlib/Order/LiminfLimsup.lean index cdae22417057be..d5e553f5022257 100644 --- a/Mathlib/Order/LiminfLimsup.lean +++ b/Mathlib/Order/LiminfLimsup.lean @@ -113,7 +113,7 @@ theorem bliminf_true (f : Filter β) (u : β → α) : (bliminf u f fun _ => Tru lemma blimsup_eq_limsup {f : Filter β} {u : β → α} {p : β → Prop} : blimsup u f p = limsup u (f ⊓ 𝓟 {x | p x}) := by - simp only [blimsup_eq, limsup_eq, eventually_inf_principal, mem_setOf_eq] + simp only [blimsup_eq, limsup_eq, eventually_inf_principal, mem_ofPred_eq] lemma bliminf_eq_liminf {f : Filter β} {u : β → α} {p : β → Prop} : bliminf u f p = liminf u (f ⊓ 𝓟 {x | p x}) := @@ -296,7 +296,7 @@ theorem HasBasis.liminf_eq_sSup_iUnion_iInter {ι ι' : Type*} {f : ι → α} { simp_rw [liminf_eq, hv.eventually_iff] congr 1 ext x - simp only [mem_setOf_eq, iInter_coe_set, mem_iUnion, mem_iInter, mem_Iic, Subtype.exists, + simp only [mem_ofPred_eq, iInter_coe_set, mem_iUnion, mem_iInter, mem_Iic, Subtype.exists, exists_prop] theorem HasBasis.liminf_eq_sSup_univ_of_empty {f : ι → α} {v : Filter ι} @@ -448,7 +448,7 @@ lemma HasBasis.blimsup_eq_iInf_iSup {p : ι → Prop} {s : ι → Set β} {f : F (hf : f.HasBasis p s) {q : β → Prop} : blimsup u f q = ⨅ (i) (_ : p i), ⨆ a ∈ s i, ⨆ (_ : q a), u a := by simp only [blimsup_eq_limsup, (hf.inf_principal _).limsup_eq_iInf_iSup, mem_inter_iff, iSup_and, - mem_setOf_eq] + mem_ofPred_eq] theorem blimsup_eq_iInf_biSup {f : Filter β} {p : β → Prop} {u : β → α} : blimsup u f p = ⨅ s ∈ f, ⨆ (b) (_ : p b ∧ b ∈ s), u b := by @@ -615,7 +615,7 @@ theorem bliminf_or_le_inf_aux_right : (bliminf u f fun x => p x ∨ q x) ≤ bli theorem _root_.OrderIso.apply_blimsup [CompleteLattice γ] (e : α ≃o γ) : e (blimsup u f p) = blimsup (e ∘ u) f p := by simp only [blimsup_eq, map_sInf, Function.comp_apply, e.image_eq_preimage_symm, - Set.preimage_setOf_eq, e.le_symm_apply] + Set.preimage_ofPred_eq, e.le_symm_apply] theorem _root_.OrderIso.apply_bliminf [CompleteLattice γ] (e : α ≃o γ) : e (bliminf u f p) = bliminf (e ∘ u) f p := @@ -640,7 +640,7 @@ variable [CompleteDistribLattice α] {f : Filter β} {p q : β → Prop} {u : β lemma limsup_sup_filter {g} : limsup u (f ⊔ g) = limsup u f ⊔ limsup u g := by refine le_antisymm ?_ (sup_le (limsup_le_limsup_of_le le_sup_left) (limsup_le_limsup_of_le le_sup_right)) - simp_rw [limsup_eq, sInf_sup_eq, sup_sInf_eq, mem_setOf_eq, le_iInf₂_iff] + simp_rw [limsup_eq, sInf_sup_eq, sup_sInf_eq, mem_ofPred_eq, le_iInf₂_iff] intro a ha b hb exact sInf_le ⟨ha.mono fun _ h ↦ h.trans le_sup_left, hb.mono fun _ h ↦ h.trans le_sup_right⟩ @@ -649,7 +649,7 @@ lemma liminf_sup_filter {g} : liminf u (f ⊔ g) = liminf u f ⊓ liminf u g := @[simp] theorem blimsup_or_eq_sup : (blimsup u f fun x => p x ∨ q x) = blimsup u f p ⊔ blimsup u f q := by - simp only [blimsup_eq_limsup, ← limsup_sup_filter, ← inf_sup_left, sup_principal, setOf_or] + simp only [blimsup_eq_limsup, ← limsup_sup_filter, ← inf_sup_left, sup_principal, ofPred_or] @[simp] theorem bliminf_or_eq_inf : (bliminf u f fun x => p x ∨ q x) = bliminf u f p ⊓ bliminf u f q := @@ -744,9 +744,9 @@ theorem cofinite.blimsup_set_eq : simp only [blimsup_eq, eventually_cofinite, not_forall, sInf_eq_sInter, exists_prop] ext x refine ⟨fun h => ?_, fun hx t h => ?_⟩ <;> contrapose h - · simp only [mem_sInter, mem_setOf_eq, not_forall, exists_prop] + · simp only [mem_sInter, mem_ofPred_eq, not_forall, exists_prop] exact ⟨{x}ᶜ, by simpa using h, by simp⟩ - · exact hx.mono fun i hi => ⟨hi.1, fun hit => h (hit hi.2)⟩ + · exact hx.mono (s := {n | p n ∧ x ∈ s n}) fun i hi => ⟨hi.1, fun hit => h (hit hi.2)⟩ theorem cofinite.bliminf_set_eq : bliminf s cofinite p = { x | { n | p n ∧ x ∉ s n }.Finite } := by rw [← compl_inj_iff] @@ -963,7 +963,8 @@ variable [ConditionallyCompleteLinearOrder α] {f : Filter α} {b : α} set_option linter.unusedVariables false in theorem lt_mem_sets_of_limsSup_lt (h : f.IsBounded (· ≤ ·)) (l : f.limsSup < b) : ∀ᶠ a in f, a < b := - let ⟨c, (h : ∀ᶠ a in f, a ≤ c), hcb⟩ := exists_lt_of_csInf_lt h l + let ⟨c, (h : ∀ᶠ a in f, a ≤ c), hcb⟩ := + exists_lt_of_csInf_lt (s := {a | ∀ᶠ n in f, n ≤ a}) h l mem_of_superset h fun _a => hcb.trans_le' theorem gt_mem_sets_of_limsInf_gt : f.IsBounded (· ≥ ·) → b < f.limsInf → ∀ᶠ a in f, b < a := @@ -1011,7 +1012,7 @@ theorem HasBasis.liminf_eq_ciSup_ciInf {v : Filter ι} · have : j = liminf_reparam f s p j := by simp only [m, liminf_reparam, hj, ite_true] conv_lhs => rw [this] apply subset_iUnion _ j - · simp only [m, mem_setOf_eq, ← nonempty_iInter_Iic_iff, not_nonempty_iff_eq_empty] at hj + · simp only [m, mem_ofPred_eq, ← nonempty_iInter_Iic_iff, not_nonempty_iff_eq_empty] at hj simp only [hj, empty_subset] · apply iUnion_subset (fun j ↦ ?_) exact subset_iUnion (fun (k : Subtype p) ↦ (⋂ (i : s k), Iic (f i))) (liminf_reparam f s p j) diff --git a/Mathlib/Order/Minimal.lean b/Mathlib/Order/Minimal.lean index 01cfc2ce2977f5..f470dc9fe82367 100644 --- a/Mathlib/Order/Minimal.lean +++ b/Mathlib/Order/Minimal.lean @@ -189,26 +189,28 @@ theorem not_minimal_iff_exists_lt (hx : P x) : ¬ Minimal P x ↔ ∃ y, y < x alias ⟨exists_lt_of_not_minimal, _⟩ := not_minimal_iff_exists_lt @[to_dual] -theorem MinimalFor.of_strictMonoOn_comp (hg : StrictMonoOn g (f '' setOf Q)) +theorem MinimalFor.of_strictMonoOn_comp (hg : StrictMonoOn g (f '' Set.ofPred Q)) (h : MinimalFor Q (g ∘ f) i) : MinimalFor Q f i := by refine ⟨h.prop, fun j hj hle ↦ ?_⟩ by_contra exact h.not_lt hj <| hg ⟨j, hj, rfl⟩ ⟨i, h.prop, rfl⟩ <| lt_of_le_not_ge hle this @[to_dual] -theorem MinimalFor.minimal_of_strictMonoOn (hg : StrictMonoOn g (setOf P)) (h : MinimalFor P g x) : +theorem MinimalFor.minimal_of_strictMonoOn (hg : StrictMonoOn g (Set.ofPred P)) + (h : MinimalFor P g x) : Minimal P x := minimalFor_id.mp <| .of_strictMonoOn_comp (Set.image_id _ ▸ hg) h @[to_dual] -theorem MinimalFor.maximalFor_of_strictAntiOn_comp (hg : StrictAntiOn g (f '' setOf Q)) +theorem MinimalFor.maximalFor_of_strictAntiOn_comp (hg : StrictAntiOn g (f '' Set.ofPred Q)) (h : MinimalFor Q (g ∘ f) i) : MaximalFor Q f i := by refine ⟨h.prop, fun j hj hle ↦ ?_⟩ by_contra exact h.not_lt hj <| hg ⟨i, h.prop, rfl⟩ ⟨j, hj, rfl⟩ <| lt_of_le_not_ge hle this @[to_dual] -theorem MinimalFor.maximal_of_strictAntiOn (hg : StrictAntiOn g (setOf P)) (h : MinimalFor P g x) : +theorem MinimalFor.maximal_of_strictAntiOn (hg : StrictAntiOn g (Set.ofPred P)) + (h : MinimalFor P g x) : Maximal P x := maximalFor_id.mp <| MinimalFor.maximalFor_of_strictAntiOn_comp (Set.image_id _ ▸ hg) h @@ -392,9 +394,12 @@ section Preorder variable [Preorder α] @[to_dual] -theorem setOf_minimal_subset (s : Set α) : {x | Minimal (· ∈ s) x} ⊆ s := +theorem setOfPred_minimal_subset (s : Set α) : {x | Minimal (· ∈ s) x} ⊆ s := sep_subset .. +@[deprecated (since := "2026-07-09")] alias setOf_minimal_subset := setOfPred_minimal_subset +@[deprecated (since := "2026-07-09")] alias setOf_maximal_subset := setOfPred_maximal_subset + @[to_dual] theorem Set.Subsingleton.minimal_mem_iff (h : s.Subsingleton) : Minimal (· ∈ s) x ↔ x ∈ s := by obtain (rfl | ⟨x, rfl⟩) := h.eq_empty_or_singleton <;> simp @@ -453,28 +458,52 @@ theorem minimal_mem_image_antitone_iff (ha : a ∈ s) maximal_mem_image_monotone_iff (β := βᵒᵈ) ha (fun _ _ h h' ↦ hf h' h) @[to_dual (reorder := hf (x y, 3 4))] -theorem image_monotone_setOf_minimal (hf : ∀ ⦃x y⦄, P x → P y → (f x ≤ f y ↔ x ≤ y)) : +theorem image_monotone_setOfPred_minimal (hf : ∀ ⦃x y⦄, P x → P y → (f x ≤ f y ↔ x ≤ y)) : f '' {x | Minimal P x} = {x | Minimal (∃ x₀, P x₀ ∧ f x₀ = ·) x} := by refine Set.ext fun x ↦ ⟨?_, fun h ↦ ?_⟩ · rintro ⟨x, (hx : Minimal _ x), rfl⟩ exact (minimal_mem_image_monotone_iff hx.prop hf).2 hx - obtain ⟨y, hy, rfl⟩ := (mem_setOf_eq ▸ h).prop - exact mem_image_of_mem _ <| (minimal_mem_image_monotone_iff (s := setOf P) hy hf).1 h + obtain ⟨y, hy, rfl⟩ := (mem_ofPred_eq ▸ h).prop + exact mem_image_of_mem _ <| (minimal_mem_image_monotone_iff (s := Set.ofPred P) hy hf).1 h + +@[deprecated (since := "2026-07-09")] +alias image_monotone_setOf_minimal := image_monotone_setOfPred_minimal + +@[deprecated (since := "2026-07-09")] +alias image_monotone_setOf_maximal := image_monotone_setOfPred_maximal @[to_dual (reorder := hf (x y, 3 4))] -theorem image_antitone_setOf_minimal (hf : ∀ ⦃x y⦄, P x → P y → (f x ≤ f y ↔ y ≤ x)) : +theorem image_antitone_setOfPred_minimal (hf : ∀ ⦃x y⦄, P x → P y → (f x ≤ f y ↔ y ≤ x)) : f '' {x | Minimal P x} = {x | Maximal (∃ x₀, P x₀ ∧ f x₀ = ·) x} := - image_monotone_setOf_minimal (β := βᵒᵈ) (fun _ _ hx hy ↦ hf hy hx) + image_monotone_setOfPred_minimal (β := βᵒᵈ) (fun _ _ hx hy ↦ hf hy hx) + +@[deprecated (since := "2026-07-09")] +alias image_antitone_setOf_minimal := image_antitone_setOfPred_minimal + +@[deprecated (since := "2026-07-09")] +alias image_antitone_setOf_maximal := image_antitone_setOfPred_maximal @[to_dual (reorder := hf (x y, 3 4))] -theorem image_monotone_setOf_minimal_mem (hf : ∀ ⦃x y⦄, x ∈ s → y ∈ s → (f x ≤ f y ↔ x ≤ y)) : +theorem image_monotone_setOfPred_minimal_mem (hf : ∀ ⦃x y⦄, x ∈ s → y ∈ s → (f x ≤ f y ↔ x ≤ y)) : f '' {x | Minimal (· ∈ s) x} = {x | Minimal (· ∈ f '' s) x} := - image_monotone_setOf_minimal hf + image_monotone_setOfPred_minimal hf + +@[deprecated (since := "2026-07-09")] +alias image_monotone_setOf_minimal_mem := image_monotone_setOfPred_minimal_mem + +@[deprecated (since := "2026-07-09")] +alias image_monotone_setOf_maximal_mem := image_monotone_setOfPred_maximal_mem @[to_dual (reorder := hf (x y, 3 4))] -theorem image_antitone_setOf_minimal_mem (hf : ∀ ⦃x y⦄, x ∈ s → y ∈ s → (f x ≤ f y ↔ y ≤ x)) : +theorem image_antitone_setOfPred_minimal_mem (hf : ∀ ⦃x y⦄, x ∈ s → y ∈ s → (f x ≤ f y ↔ y ≤ x)) : f '' {x | Minimal (· ∈ s) x} = {x | Maximal (· ∈ f '' s) x} := - image_antitone_setOf_minimal hf + image_antitone_setOfPred_minimal hf + +@[deprecated (since := "2026-07-09")] +alias image_antitone_setOf_minimal_mem := image_antitone_setOfPred_minimal_mem + +@[deprecated (since := "2026-07-09")] +alias image_antitone_setOf_maximal_mem := image_antitone_setOfPred_maximal_mem end Function @@ -507,26 +536,40 @@ theorem minimal_apply_mem_iff (ht : t ⊆ Set.range f) : @[deprecated (since := "2026-04-07")] alias maximal_apply_iff := maximal_apply_mem_iff -theorem image_setOf_minimal : f '' {x | Minimal (· ∈ s) x} = {x | Minimal (· ∈ f '' s) x} := - _root_.image_monotone_setOf_minimal (by simp [f.le_iff_le]) +theorem image_setOfPred_minimal : f '' {x | Minimal (· ∈ s) x} = {x | Minimal (· ∈ f '' s) x} := + _root_.image_monotone_setOfPred_minimal (by simp [f.le_iff_le]) + +@[deprecated (since := "2026-07-09")] +alias image_setOf_minimal := image_setOfPred_minimal @[to_dual] -theorem inter_preimage_setOf_minimal_eq_of_subset (hts : t ⊆ f '' s) : +theorem inter_preimage_setOfPred_minimal_eq_of_subset (hts : t ⊆ f '' s) : x ∈ s ∩ f ⁻¹' {y | Minimal (· ∈ t) y} ↔ Minimal (· ∈ s ∩ f ⁻¹' t) x := by - simp_rw [mem_inter_iff, preimage_setOf_eq, mem_setOf_eq, mem_preimage, + simp_rw [mem_inter_iff, preimage_ofPred_eq, mem_ofPred_eq, mem_preimage, f.minimal_apply_mem_iff (hts.trans (image_subset_range _ _)), minimal_and_iff_left_of_imp (fun _ hx ↦ f.injective.mem_set_image.1 <| hts hx)] +@[deprecated (since := "2026-07-09")] +alias inter_preimage_setOf_minimal_eq_of_subset := inter_preimage_setOfPred_minimal_eq_of_subset + +@[deprecated (since := "2026-07-09")] +alias inter_preimage_setOf_maximal_eq_of_subset := inter_preimage_setOfPred_maximal_eq_of_subset + end OrderEmbedding namespace OrderIso @[to_dual] -theorem image_setOf_minimal (f : α ≃o β) (P : α → Prop) : +theorem image_setOfPred_minimal (f : α ≃o β) (P : α → Prop) : f '' {x | Minimal P x} = {x | Minimal (fun x ↦ P (f.symm x)) x} := by - convert! _root_.image_monotone_setOf_minimal (f := f) (by simp [f.le_iff_le]) + convert! _root_.image_monotone_setOfPred_minimal (f := f) (by simp [f.le_iff_le]) aesop +@[deprecated (since := "2026-07-09")] +alias image_setOf_minimal := image_setOfPred_minimal +@[deprecated (since := "2026-07-09")] +alias image_setOf_maximal := image_setOfPred_maximal + @[to_dual] theorem map_minimal_mem (f : s ≃o t) (hx : Minimal (· ∈ s) x) : Minimal (· ∈ t) (f ⟨x, hx.prop⟩) := by @@ -535,30 +578,39 @@ theorem map_minimal_mem (f : s ≃o t) (hx : Minimal (· ∈ s) x) : (f.toOrderEmbedding.trans (OrderEmbedding.subtype (· ∈ t))) (s := univ) (x := ⟨x, hx.prop⟩) /-- If two sets are order isomorphic, their minimals are also order isomorphic. -/ -def mapSetOfMinimal (f : s ≃o t) : {x | Minimal (· ∈ s) x} ≃o {x | Minimal (· ∈ t) x} where +def mapOfPredMinimal (f : s ≃o t) : {x | Minimal (· ∈ s) x} ≃o {x | Minimal (· ∈ t) x} where toFun x := ⟨f ⟨x, x.2.1⟩, f.map_minimal_mem x.2⟩ invFun x := ⟨f.symm ⟨x, x.2.1⟩, f.symm.map_minimal_mem x.2⟩ left_inv x := Subtype.ext (congr_arg Subtype.val <| f.left_inv ⟨x, x.2.1⟩ :) right_inv x := Subtype.ext (congr_arg Subtype.val <| f.right_inv ⟨x, x.2.1⟩ :) map_rel_iff' := f.map_rel_iff +@[deprecated (since := "2026-07-03")] alias mapSetOfMinimal := mapOfPredMinimal + /-- If two sets are order isomorphic, their maximals are also order isomorphic. -/ @[to_dual existing] -def mapSetOfMaximal (f : s ≃o t) : {x | Maximal (· ∈ s) x} ≃o {x | Maximal (· ∈ t) x} where +def mapOfPredMaximal (f : s ≃o t) : {x | Maximal (· ∈ s) x} ≃o {x | Maximal (· ∈ t) x} where toFun x := ⟨f ⟨x, x.2.1⟩, f.map_maximal_mem x.2⟩ invFun x := ⟨f.symm ⟨x, x.2.1⟩, f.symm.map_maximal_mem x.2⟩ left_inv x := Subtype.ext (congr_arg Subtype.val <| f.left_inv ⟨x, x.2.1⟩ :) right_inv x := Subtype.ext (congr_arg Subtype.val <| f.right_inv ⟨x, x.2.1⟩ :) map_rel_iff' := f.map_rel_iff +@[deprecated (since := "2026-07-03")] alias mapSetOfMaximal := mapOfPredMaximal + /-- If two sets are antitonically order isomorphic, their minimals/maximals are too. -/ @[to_dual /-- If two sets are antitonically order isomorphic, their maximals/minimals are too. -/] -def setOfMinimalIsoSetOfMaximal (f : s ≃o tᵒᵈ) : +def setOfPredMinimalIsoSetOfPredMaximal (f : s ≃o tᵒᵈ) : {x | Minimal (· ∈ s) x} ≃o {x | Maximal (· ∈ t) (ofDual x)} where - toFun x := ⟨(f ⟨x.1, x.2.1⟩).1, ((show s ≃o ofDual ⁻¹' t from f).mapSetOfMinimal x).2⟩ + toFun x := ⟨(f ⟨x.1, x.2.1⟩).1, ((show s ≃o ofDual ⁻¹' t from f).mapOfPredMinimal x).2⟩ invFun x := ⟨(f.symm ⟨x.1, x.2.1⟩).1, - ((show ofDual ⁻¹' t ≃o s from f.symm).mapSetOfMinimal x).2⟩ - __ := (show s ≃o ofDual ⁻¹' t from f).mapSetOfMinimal + ((show ofDual ⁻¹' t ≃o s from f.symm).mapOfPredMinimal x).2⟩ + __ := (show s ≃o ofDual ⁻¹' t from f).mapOfPredMinimal + +@[deprecated (since := "2026-07-09")] +alias setOfMinimalIsoSetOfMaximal := setOfPredMinimalIsoSetOfPredMaximal +@[deprecated (since := "2026-07-09")] +alias setOfMaximalIsoSetOfMinimal := setOfPredMaximalIsoSetOfPredMinimal end OrderIso diff --git a/Mathlib/Order/OmegaCompletePartialOrder.lean b/Mathlib/Order/OmegaCompletePartialOrder.lean index d5913f103a73f3..e4654247df4df8 100644 --- a/Mathlib/Order/OmegaCompletePartialOrder.lean +++ b/Mathlib/Order/OmegaCompletePartialOrder.lean @@ -226,16 +226,16 @@ theorem ωSup_le_ωSup_of_le {c₀ c₁ : Chain α} (h : c₀ ≤ c₁) : ωSup lemma isLUB_range_ωSup (c : Chain α) : IsLUB (Set.range c) (ωSup c) := by constructor · simp only [upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] exact fun a ↦ le_ωSup c a · simp only [lowerBounds, upperBounds, Set.mem_range, forall_exists_index, - forall_apply_eq_imp_iff, Set.mem_setOf_eq] + forall_apply_eq_imp_iff, Set.mem_ofPred_eq] exact fun ⦃a⦄ a_1 ↦ ωSup_le c a a_1 lemma ωSup_eq_of_isLUB {c : Chain α} {a : α} (h : IsLUB (Set.range c) a) : a = ωSup c := by rw [le_antisymm_iff] simp only [IsLUB, IsLeast, upperBounds, lowerBounds, Set.mem_range, forall_exists_index, - forall_apply_eq_imp_iff, Set.mem_setOf_eq] at h + forall_apply_eq_imp_iff, Set.mem_ofPred_eq] at h constructor · apply h.2 exact fun a ↦ le_ωSup c a diff --git a/Mathlib/Order/OrderIsoNat.lean b/Mathlib/Order/OrderIsoNat.lean index 3c1aefd5c22cd3..99d5da7e5ebbc7 100644 --- a/Mathlib/Order/OrderIsoNat.lean +++ b/Mathlib/Order/OrderIsoNat.lean @@ -167,7 +167,7 @@ theorem exists_increasing_or_nonincreasing_subseq' (r : α → α → Prop) (f : have h : ∀ n : ℕ, ∃ n' : ℕ, n < n' ∧ r (f (n + m)) (f (n' + m)) := by intro n have h := hm _ (Nat.le_add_left m n) - simp only [bad, exists_prop, not_not, Set.mem_setOf_eq, not_forall] at h + simp only [bad, exists_prop, not_not, Set.mem_ofPred_eq, not_forall] at h obtain ⟨n', hn1, hn2⟩ := h refine ⟨n + n' - n - m, by lia, ?_⟩ convert! hn2 @@ -299,7 +299,8 @@ theorem exists_covBy_seq_of_wellFoundedLT_wellFoundedGT (α) [Preorder α] have H : ∃ n, IsMax (a n) := by by_contra! exact (RelEmbedding.natGT a fun n ↦ (cov n (this n)).1).not_wellFounded wfg.wf - exact ⟨_, wellFounded_lt.min_mem _ H, fun i h ↦ cov _ (wellFounded_lt.not_lt_min _ · h)⟩ + exact ⟨_, wellFounded_lt.min_mem {n | IsMax (a n)} H, + fun i h ↦ cov _ (wellFounded_lt.not_lt_min {n | IsMax (a n)} · h)⟩ theorem exists_covBy_seq_of_wellFoundedLT_wellFoundedGT_of_le {α : Type*} [PartialOrder α] [wfl : WellFoundedLT α] [wfg : WellFoundedGT α] {x y : α} (h : x ≤ y) : diff --git a/Mathlib/Order/Preorder/Chain.lean b/Mathlib/Order/Preorder/Chain.lean index ac24fba1fc51b0..a1188495a51cb9 100644 --- a/Mathlib/Order/Preorder/Chain.lean +++ b/Mathlib/Order/Preorder/Chain.lean @@ -292,7 +292,7 @@ theorem IsMaxChain.symm (h : IsMaxChain r s) : IsMaxChain (flip r) s := open scoped Classical in /-- Given a set `s`, if there exists a chain `t` strictly including `s`, then `SuccChain s` is one of these chains. Otherwise it is `s`. -/ -def SuccChain (r : α → α → Prop) (s : Set α) : Set α := +noncomputable def SuccChain (r : α → α → Prop) (s : Set α) : Set α := if h : ∃ t, IsChain r s ∧ SuperChain r s t then h.choose else s theorem succChain_spec (h : ∃ t, IsChain r s ∧ SuperChain r s t) : diff --git a/Mathlib/Order/PrimeSeparator.lean b/Mathlib/Order/PrimeSeparator.lean index 60d5cbfd67f8c5..2e38299d36b946 100644 --- a/Mathlib/Order/PrimeSeparator.lean +++ b/Mathlib/Order/PrimeSeparator.lean @@ -53,7 +53,7 @@ theorem DistribLattice.prime_ideal_of_disjoint_filter_ideal [DistribLattice α] intro c hcS hcC hcNe use sUnion c refine ⟨?_, fun s hs ↦ le_sSup hs⟩ - simp only [mem_setOf_eq, disjoint_sUnion_right, S] + simp only [mem_ofPred_eq, disjoint_sUnion_right, S] let ⟨J, hJ⟩ := hcNe refine ⟨Order.isIdeal_sUnion_of_isChain (fun _ hJ ↦ (hcS hJ).1) hcC hcNe, ⟨le_trans (hcS hJ).2.1 (le_sSup hJ), fun J hJ ↦ (hcS hJ).2.2⟩⟩ @@ -88,12 +88,12 @@ theorem DistribLattice.prime_ideal_of_disjoint_filter_ideal [DistribLattice α] have J₁F : ¬ (Disjoint (F : Set α) J₁) := by intro hdis apply J₁S - simp only [mem_setOf_eq, SetLike.coe_subset_coe, S] + simp only [mem_ofPred_eq, SetLike.coe_subset_coe, S] exact ⟨J₁.isIdeal, le_trans IJ' le_sup_left, hdis⟩ have J₂F : ¬ (Disjoint (F : Set α) J₂) := by intro hdis apply J₂S - simp only [mem_setOf_eq, SetLike.coe_subset_coe, S] + simp only [mem_ofPred_eq, SetLike.coe_subset_coe, S] exact ⟨J₂.isIdeal, le_trans IJ' le_sup_left, hdis⟩ -- Thus, pick cᵢ ∈ F ∩ Jᵢ. let ⟨c₁, ⟨c₁F, c₁J₁⟩⟩ := Set.not_disjoint_iff.1 J₁F diff --git a/Mathlib/Order/ScottContinuity.lean b/Mathlib/Order/ScottContinuity.lean index a44944daa7eb47..3122343272d4e5 100644 --- a/Mathlib/Order/ScottContinuity.lean +++ b/Mathlib/Order/ScottContinuity.lean @@ -111,20 +111,20 @@ lemma ScottContinuousOn.prodMk {g : α → γ} (hD : ∀ a b : α, a ≤ b → { ScottContinuousOn D fun x => (f x, g x) := fun d hd₁ hd₂ hd₃ a hda => by rw [IsLUB, IsLeast, upperBounds] constructor - · simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_setOf_eq, + · simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_ofPred_eq, Prod.mk_le_mk] intro b hb exact ⟨hf.monotone D hD (hda.1 hb), hg.monotone D hD (hda.1 hb)⟩ · intro ⟨p₁, p₂⟩ hp - simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_setOf_eq, + simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_ofPred_eq, Prod.mk_le_mk] at hp constructor · rw [isLUB_le_iff (hf hd₁ hd₂ hd₃ hda), upperBounds] - simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_setOf_eq] + simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_ofPred_eq] intro _ hb exact (hp _ hb).1 · rw [isLUB_le_iff (hg hd₁ hd₂ hd₃ hda), upperBounds] - simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_setOf_eq] + simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, mem_ofPred_eq] intro _ hb exact (hp _ hb).2 @@ -196,10 +196,10 @@ variable [SemilatticeSup β] @[fun_prop] lemma ScottContinuous.sup₂ : ScottContinuous fun b : β × β => (b.1 ⊔ b.2 : β) := fun d _ _ ⟨p₁, p₂⟩ hdp => by - simp only [IsLUB, IsLeast, upperBounds, Prod.forall, mem_setOf_eq, Prod.mk_le_mk] at hdp + simp only [IsLUB, IsLeast, upperBounds, Prod.forall, mem_ofPred_eq, Prod.mk_le_mk] at hdp simp only [IsLUB, IsLeast, upperBounds, mem_image, Prod.exists, forall_exists_index, and_imp] have e1 : (p₁, p₂) ∈ lowerBounds {x | ∀ (b₁ b₂ : β), (b₁, b₂) ∈ d → (b₁, b₂) ≤ x} := hdp.2 - simp only [lowerBounds, mem_setOf_eq, Prod.forall, Prod.mk_le_mk] at e1 + simp only [lowerBounds, mem_ofPred_eq, Prod.forall, Prod.mk_le_mk] at e1 refine ⟨fun a b₁ b₂ hbd hba => ?_,fun b hb => ?_⟩ · rw [← hba] exact sup_le_sup (hdp.1 _ _ hbd).1 (hdp.1 _ _ hbd).2 diff --git a/Mathlib/Order/ScottContinuity/Prod.lean b/Mathlib/Order/ScottContinuity/Prod.lean index 9cf6a2830551bc..cc672824b65cee 100644 --- a/Mathlib/Order/ScottContinuity/Prod.lean +++ b/Mathlib/Order/ScottContinuity/Prod.lean @@ -42,9 +42,8 @@ lemma ScottContinuousOn.fromProd [Preorder α] [Preorder β] [Preorder γ] convert! (h₂ _ (mem_image_of_mem (fun d ↦ Prod.fst '' d) hX) (Nonempty.image Prod.fst hd₁) (DirectedOn.fst hd₂) (isLUB_prod.mp hdp).1) - ext : 1 simp_all only [Subtype.exists, mem_image, Prod.exists, - exists_and_right, exists_eq_right, exists_prop, mem_setOf_eq] + exists_and_right, exists_eq_right, exists_prop, mem_iff_mem] lemma ScottContinuous.fromProd {γ : Type*} [Preorder α] [Preorder β] [Preorder γ] {f : α × β → γ} (h₁ : ∀ a, ScottContinuous (fun b => f (a, b))) diff --git a/Mathlib/Order/SemiconjSup.lean b/Mathlib/Order/SemiconjSup.lean index e7ab5076672a2b..d74120564ef8f1 100644 --- a/Mathlib/Order/SemiconjSup.lean +++ b/Mathlib/Order/SemiconjSup.lean @@ -88,7 +88,7 @@ theorem Semiconj.symm_adjoint [PartialOrder α] [Preorder β] {fa : α ≃o α} (h : Function.Semiconj g fa fb) {g' : β → α} (hg' : IsOrderRightAdjoint g g') : Function.Semiconj g' fb fa := by refine fun y => (hg' _).unique ?_ - rw [← fa.surjective.image_preimage { x | g x ≤ fb y }, preimage_setOf_eq] + rw [← fa.surjective.image_preimage { x | g x ≤ fb y }, preimage_ofPred_eq] simp only [h.eq, fb.le_iff_le, fa.isLUB_image'.mpr (hg' _)] variable {G : Type*} diff --git a/Mathlib/Order/SetAccumulate.lean b/Mathlib/Order/SetAccumulate.lean index c06377ea68a96a..c886522b6f548b 100644 --- a/Mathlib/Order/SetAccumulate.lean +++ b/Mathlib/Order/SetAccumulate.lean @@ -42,13 +42,16 @@ theorem accumulate_eq_biInter_lt {s : ℕ → Set β} {n : ℕ} : accumulate s n theorem mem_accumulate [LE α] {x : α} {z : β} : z ∈ accumulate s x ↔ ∃ y ≤ x, z ∈ s y := by simp_rw [accumulate_def, mem_iUnion₂, exists_prop] -theorem subset_accumulate [Preorder α] {x : α} : s x ⊆ accumulate s x := fun _ => mem_biUnion le_rfl +theorem subset_accumulate [Preorder α] {x : α} : s x ⊆ accumulate s x := fun _ hz => + mem_accumulate.2 ⟨x, le_rfl, hz⟩ -theorem accumulate_subset_iUnion [LE α] (x : α) : accumulate s x ⊆ ⋃ i, s i := - (biUnion_subset_biUnion_left (subset_univ _)).trans_eq (biUnion_univ _) +theorem accumulate_subset_iUnion [LE α] (x : α) : accumulate s x ⊆ ⋃ i, s i := fun _ hz => + have ⟨y, _, hy⟩ := mem_accumulate.1 hz + mem_iUnion.2 ⟨y, hy⟩ -theorem monotone_accumulate [Preorder α] : Monotone (accumulate s) := fun _ _ hxy => - biUnion_subset_biUnion_left fun _ hz => le_trans hz hxy +theorem monotone_accumulate [Preorder α] : Monotone (accumulate s) := fun _ _ hxy _ hz => + have ⟨y, hyx, hy⟩ := mem_accumulate.1 hz + mem_accumulate.2 ⟨y, hyx.trans hxy, hy⟩ @[gcongr] theorem accumulate_subset_accumulate [Preorder α] {x y} (h : x ≤ y) : diff --git a/Mathlib/Order/SetDissipate.lean b/Mathlib/Order/SetDissipate.lean index e163c53144fcf5..216241f538eabe 100644 --- a/Mathlib/Order/SetDissipate.lean +++ b/Mathlib/Order/SetDissipate.lean @@ -36,14 +36,14 @@ theorem mem_dissipate [LE α] {x : α} {z : β} : z ∈ dissipate s x ↔ ∀ y simp [dissipate_def] theorem dissipate_subset [LE α] {x y : α} (hy : y ≤ x) : dissipate s x ⊆ s y := - biInter_subset_of_mem hy + fun _ hz ↦ mem_dissipate.1 hz y hy theorem iInter_subset_dissipate [LE α] (x : α) : ⋂ i, s i ⊆ dissipate s x := by simp only [dissipate, subset_iInter_iff] exact fun x h ↦ iInter_subset_of_subset x fun ⦃a⦄ a ↦ a theorem antitone_dissipate [Preorder α] : Antitone (dissipate s) := - fun _ _ hab ↦ biInter_subset_biInter_left fun _ hz => le_trans hz hab + fun _ _ hab _ hz ↦ mem_dissipate.2 fun y hy ↦ mem_dissipate.1 hz y (hy.trans hab) @[gcongr] theorem dissipate_subset_dissipate [Preorder α] {x y} (h : y ≤ x) : diff --git a/Mathlib/Order/SuccPred/Tree.lean b/Mathlib/Order/SuccPred/Tree.lean index cd27b5de99afba..ba4b7fd2e5e80a 100644 --- a/Mathlib/Order/SuccPred/Tree.lean +++ b/Mathlib/Order/SuccPred/Tree.lean @@ -179,7 +179,7 @@ variable {t : RootedTree} lemma SubRootedTree.root_ne_bot_of_mem_subtrees (r : SubRootedTree t) (hr : r ∈ t.subtrees) : r.root ≠ ⊥ := by - simp only [RootedTree.subtrees, Set.mem_setOf_eq] at hr + simp only [RootedTree.subtrees, Set.mem_ofPred_eq] at hr exact hr.1 lemma RootedTree.mem_subtrees_disjoint_iff {t₁ t₂ : SubRootedTree t} diff --git a/Mathlib/Order/UpperLower/Basic.lean b/Mathlib/Order/UpperLower/Basic.lean index 48c4788f45302f..73b7dc2c13f4c8 100644 --- a/Mathlib/Order/UpperLower/Basic.lean +++ b/Mathlib/Order/UpperLower/Basic.lean @@ -170,13 +170,17 @@ theorem Set.antitone_mem : Antitone (· ∈ s) ↔ IsLowerSet s := forall_comm @[simp] -theorem isUpperSet_setOf : IsUpperSet { a | p a } ↔ Monotone p := +theorem isUpperSet_setOfPred : IsUpperSet { a | p a } ↔ Monotone p := Iff.rfl +@[deprecated (since := "2026-07-09")] alias isUpperSet_setOf := isUpperSet_setOfPred + @[simp] -theorem isLowerSet_setOf : IsLowerSet { a | p a } ↔ Antitone p := +theorem isLowerSet_setOfPred : IsLowerSet { a | p a } ↔ Antitone p := forall_comm +@[deprecated (since := "2026-07-09")] alias isLowerSet_setOf := isLowerSet_setOfPred + @[to_dual] lemma IsUpperSet.upperBounds_subset (hs : IsUpperSet s) : s.Nonempty → upperBounds s ⊆ s := fun ⟨_a, ha⟩ _b hb ↦ hs (hb ha) ha diff --git a/Mathlib/Order/UpperLower/Closure.lean b/Mathlib/Order/UpperLower/Closure.lean index 3e8ab41c0077bc..5a0e4c0c6c81d0 100644 --- a/Mathlib/Order/UpperLower/Closure.lean +++ b/Mathlib/Order/UpperLower/Closure.lean @@ -193,7 +193,7 @@ variable [PartialOrder α] {s : Set α} {x : α} lemma IsAntichain.minimal_mem_upperClosure_iff_mem (hs : IsAntichain (· ≤ ·) s) : Minimal (· ∈ upperClosure s) x ↔ x ∈ s := by - simp only [upperClosure, UpperSet.mem_mk, mem_setOf_eq] + simp only [upperClosure, UpperSet.mem_mk, mem_ofPred_eq] refine ⟨fun h ↦ ?_, fun h ↦ ⟨⟨x, h, rfl.le⟩, fun b ⟨a, has, hab⟩ hbx ↦ ?_⟩⟩ · obtain ⟨a, has, hax⟩ := h.prop rwa [h.eq_of_ge ⟨a, has, rfl.le⟩ hax] diff --git a/Mathlib/Probability/BorelCantelli.lean b/Mathlib/Probability/BorelCantelli.lean index 8fd7476d2ae477..f4309f6e7c4c06 100644 --- a/Mathlib/Probability/BorelCantelli.lean +++ b/Mathlib/Probability/BorelCantelli.lean @@ -70,11 +70,12 @@ theorem measure_limsup_eq_one {s : ℕ → Set Ω} (hsm : ∀ n, MeasurableSet ( (hs' : (∑' n, μ (s n)) = ∞) : μ (limsup s atTop) = 1 := by have : IsProbabilityMeasure μ := hs.isProbabilityMeasure rw [measure_congr (eventuallyEq_set.2 (ae_mem_limsup_atTop_iff μ <| - measurableSet_filtrationOfSet' hsm) : (limsup s atTop : Set Ω) =ᵐ[μ] + measurableSet_filtrationOfSet' hsm) : (limsup s atTop : Set Ω) =ᵐˢ[μ] {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, (μ[(s (k + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm k]) ω) atTop atTop})] suffices {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, - (μ[(s (k + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm k]) ω) atTop atTop} =ᵐ[μ] Set.univ by + (μ[(s (k + 1)).indicator (1 : Ω → ℝ)|filtrationOfSet hsm k]) ω) atTop atTop} + =ᵐˢ[μ] Set.univ by rw [measure_congr this, measure_univ] have : ∀ᵐ ω ∂μ, ∀ n, (μ[(s (n + 1)).indicator (1 : Ω → ℝ) | filtrationOfSet hsm n]) ω = _ := ae_all_iff.2 fun n => hs.condExp_indicator_filtrationOfSet_ae_eq hsm n.lt_succ_self diff --git a/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean b/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean index 29ff54fdfee892..a8a46c3a353cf0 100644 --- a/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean +++ b/Mathlib/Probability/Combinatorics/BinomialRandomGraph/Defs.lean @@ -56,7 +56,7 @@ lemma binomialRandom_eq_map : G(V, p) = map fromEdgeSet setBer(Sym2.diagSetᶜ, refine (map_eq_comap measurable_fromEdgeSet measurableEmbedding_edgeSet ?_ fromEdgeSet_edgeSet).symm filter_upwards [setBernoulli_ae_subset] with S hS - exact ⟨fromEdgeSet S, by simpa [← Set.compl_setOf, Set.subset_compl_iff_disjoint_right] using hS⟩ + exact ⟨fromEdgeSet S, by simpa [← Set.compl_ofPred, Set.subset_compl_iff_disjoint_right] using hS⟩ variable (p) in lemma binomialRandom_apply' (S : Set (SimpleGraph V)) : @@ -74,7 +74,7 @@ instance : IsProbabilityMeasure G(V, p) := by refine measurableEmbedding_edgeSet.isProbabilityMeasure_comap ?_ filter_upwards [setBernoulli_ae_subset] with s hs refine ⟨.fromEdgeSet s, ?_⟩ - simpa [← Set.disjoint_compl_right_iff_subset, ← Set.compl_setOf] using hs + simpa [← Set.disjoint_compl_right_iff_subset, ← Set.compl_ofPred] using hs variable (V) in @[simp] lemma binomialRandom_zero : G(V, 0) = dirac ⊥ := by simp [binomialRandom_eq_map] diff --git a/Mathlib/Probability/Distributions/Fernique.lean b/Mathlib/Probability/Distributions/Fernique.lean index 609d9a2a1324c1..7d15ebaddfcf68 100644 --- a/Mathlib/Probability/Distributions/Fernique.lean +++ b/Mathlib/Probability/Distributions/Fernique.lean @@ -128,13 +128,12 @@ lemma measure_le_mul_measure_gt_le_of_map_rotation_eq_self [SFinite μ] _ = (μ.prod μ) {p | ‖p.1 - p.2‖ / √2 ≤ a ∧ b < ‖p.1 + p.2‖ / √2} := by rw [Measure.map_apply (by fun_prop)] swap - · refine MeasurableSet.inter ?_ ?_ - · change MeasurableSet {p : E × E | ‖p.1‖ ≤ a} - exact measurableSet_le (by fun_prop) (by fun_prop) - · change MeasurableSet {p : E × E | b < ‖p.2‖} - exact measurableSet_lt (by fun_prop) (by fun_prop) + · change MeasurableSet ({p : E × E | ‖p.1‖ ≤ a} ∩ {p : E × E | b < ‖p.2‖}) + refine MeasurableSet.inter ?_ ?_ + · exact measurableSet_le (by fun_prop) (by fun_prop) + · exact measurableSet_lt (by fun_prop) (by fun_prop) congr 1 - simp only [Set.preimage_setOf_eq, ContinuousLinearMap.rotation_apply, Real.cos_neg, + simp only [Set.preimage_ofPred_eq, ContinuousLinearMap.rotation_apply, Real.cos_neg, Real.cos_pi_div_four, Real.sin_neg, Real.sin_pi_div_four, neg_smul, neg_neg] have h_twos : ‖2⁻¹ * √2‖ = (√2)⁻¹ := by simp only [norm_mul, norm_inv, Real.norm_ofNat, Real.norm_eq_abs] @@ -147,7 +146,7 @@ lemma measure_le_mul_measure_gt_le_of_map_rotation_eq_self [SFinite μ] _ ≤ (μ.prod μ) {p | (b - a) / √2 < ‖p.1‖ ∧ (b - a) / √2 < ‖p.2‖} := by -- The rotated bands are contained in quadrants. refine measure_mono fun p ↦ ?_ - simp only [Set.mem_setOf_eq, and_imp] + simp only [Set.mem_ofPred_eq, and_imp] intro hp1 hp2 suffices (b - a) / √2 < min ‖p.1‖ ‖p.2‖ from lt_min_iff.mp this calc (b - a) / √2 @@ -494,7 +493,7 @@ theorem lintegral_exp_mul_sq_norm_le_of_map_rotation_eq_self [IsProbabilityMeasu by_contra! h_neg have : {x : E | ‖x‖ ≤ a} = ∅ := 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 h_neg.trans_le (norm_nonneg _) simp only [this, measure_empty, nonpos_iff_eq_zero] at hc simp [hc] at hc_gt @@ -572,12 +571,12 @@ lemma exists_integrable_exp_sq_of_map_rotation_eq_self_of_isProbabilityMeasure · exact h_of_pos a ha have h_univ : (Set.univ : Set E) = ⋃ a : ℕ, {x | ‖x‖ ≤ a} := by ext x - simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_setOf_eq, true_iff] + simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_ofPred_eq, true_iff] exact exists_nat_ge _ rw [h_univ, Monotone.measure_iUnion] · simp [h_le] · intro a b hab x hx - simp only [Set.mem_setOf_eq] at hx ⊢ + simp only [Set.mem_ofPred_eq] at hx ⊢ exact hx.trans (mod_cast hab) -- So we can take `C = 1` and show that `x ↦ exp (‖x‖ ^ 2)` is integrable, since it is bounded. have hb' : ∀ᵐ x ∂μ, ‖x‖ ≤ b := by diff --git a/Mathlib/Probability/Distributions/SetBernoulli.lean b/Mathlib/Probability/Distributions/SetBernoulli.lean index e09c6be68ed550..8678144199b1c1 100644 --- a/Mathlib/Probability/Distributions/SetBernoulli.lean +++ b/Mathlib/Probability/Distributions/SetBernoulli.lean @@ -48,22 +48,22 @@ noncomputable def setBernoulli : Measure (Set ι) := @[inherit_doc] scoped notation "setBer(" u ", " p ")" => setBernoulli u p instance : IsProbabilityMeasure setBer(u, p) := - MeasurableEquiv.setOf.symm.measurableEmbedding.isProbabilityMeasure_comap <| .of_forall fun P ↦ - ⟨{i | P i}, rfl⟩ + MeasurableEquiv.setOfPred.symm.measurableEmbedding.isProbabilityMeasure_comap <| + .of_forall fun P ↦ ⟨{i | P i}, rfl⟩ variable (u p) in lemma setBernoulli_eq_map : setBer(u, p) = .map (fun p : ι → Prop ↦ {i | p i}) (infinitePi fun i : ι ↦ toNNReal p • dirac (i ∈ u) + toNNReal (σ p) • dirac False) := - MeasurableEquiv.setOf.comap_symm + MeasurableEquiv.setOfPred.comap_symm lemma setBernoulli_apply (S : Set (Set ι)) : setBer(u, p) S = (infinitePi fun i ↦ toNNReal p • dirac (i ∈ u) + toNNReal (σ p) • dirac False) - ((fun t i ↦ i ∈ t) '' S) := MeasurableEquiv.setOf.symm.measurableEmbedding.comap_apply .. + ((fun t i ↦ i ∈ t) '' S) := MeasurableEquiv.setOfPred.symm.measurableEmbedding.comap_apply .. lemma setBernoulli_apply' (S : Set (Set ι)) : setBer(u, p) S = (infinitePi fun i ↦ toNNReal p • dirac (i ∈ u) + toNNReal (σ p) • dirac False) - ((fun p ↦ {i | p i}) ⁻¹' S) := MeasurableEquiv.setOf.symm.comap_apply .. + ((fun p ↦ {i | p i}) ⁻¹' S) := MeasurableEquiv.setOfPred.symm.comap_apply .. variable (u) in @[simp] lemma setBernoulli_zero : setBer(u, 0) = dirac ∅ := by simp [setBernoulli_eq_map] @@ -76,8 +76,8 @@ variable [Countable ι] lemma setBernoulli_ae_subset : ∀ᵐ s ∂setBer(u, p), s ⊆ u := by classical - simp only [Filter.Eventually, mem_ae_iff, Set.compl_setOf, Set.not_subset_iff_exists_mem_notMem, - Set.setOf_exists, Set.setOf_and, measure_iUnion_null_iff] + simp only [Filter.Eventually, mem_ae_iff, Set.compl_ofPred, Set.not_subset_iff_exists_mem_notMem, + Set.ofPred_exists, Set.ofPred_and, measure_iUnion_null_iff] rintro i by_cases hi : i ∈ u · simp [*] @@ -119,8 +119,8 @@ variable (p) in rw [tprod_eq_prod, Finset.prod_congr rfl] <;> simp +contextual [ite_add_ite, mt (@hsu _), ← ENNReal.coe_add] _ = toNNReal p ^ s.ncard * toNNReal (σ p) ^ (↑u \ s).ncard := by - simp [Finset.prod_ite, ← Set.ncard_coe_finset, Set.setOf_and, - Set.inter_eq_right.2 hsu, ← Set.compl_setOf, Set.sdiff_eq_compl_inter, Set.inter_comm] + simp [Finset.prod_ite, ← Set.ncard_coe_finset, Set.ofPred_and, + Set.inter_eq_right.2 hsu, ← Set.compl_ofPred, Set.sdiff_eq_compl_inter, Set.inter_comm] @[simp] lemma setBernoulli_real_singleton (p : I) (hsu : s ⊆ u) (hu : u.Finite) : @@ -133,12 +133,12 @@ lemma map_ncard_setBernoulli_real_singleton {u : Set ι} (hu : u.Finite) (p : I) classical have : {s ⊆ u | s.ncard ∈ ({k} : Set ℕ)}.Finite := hu.finite_subsets.subset (by grind) rw [measureReal_def, map_ncard_setBernoulli_apply, ← measureReal_def, - ← Set.biUnion_of_singleton (setOf _)] + ← Set.biUnion_of_singleton (Set.ofPred _)] simp_rw [← this.mem_toFinset] rw [measureReal_biUnion_finset (by simp) (by simp)] have h1 s (hs : s ∈ this.toFinset) : setBer(u, p).real {s} = p ^ k * (1 - p) ^ (u.ncard - k) := by - simp only [Set.mem_singleton_iff, Set.Finite.mem_toFinset, Set.mem_setOf_eq] at hs + simp only [Set.mem_singleton_iff, Set.Finite.mem_toFinset, Set.mem_ofPred_eq] at hs rw [setBernoulli_real_singleton _ hs.1 hu, Set.ncard_sdiff' hs.1 hu, hs.2] rw [Finset.sum_congr rfl h1, Finset.sum_const, nsmul_eq_mul, mul_assoc, ← Set.ncard_eq_toFinset_card _ _] @@ -152,14 +152,16 @@ lemma map_ncard_setBernoulli_singleton {u : Set ι} (hu : u.Finite) (p : I) (k : @[simp] lemma setBernoulli_empty : setBer((∅ : Set ι), p) = dirac ∅ := by + have key : setBer((∅ : Set ι), p) {∅} = 1 := by + rw [show ({∅} : Set (Set ι)) = {s ∈ Set.univ | s ⊆ ∅} by ext; simp [Set.subset_empty_iff], + ← setBernoulli_apply_eq_apply_subsets, measure_univ] ext s hs - rw [setBernoulli_apply_eq_apply_subsets] + rw [setBernoulli_apply_eq_apply_subsets, dirac_apply' _ hs] by_cases h : ∅ ∈ s - · have : {t | t ∈ s ∧ t ⊆ ∅} = {∅} := by grind - simp_all - · have : {t | t ∈ s ∧ t ⊆ ∅} = ∅ := by grind - rw [this] - simp_all + · rw [show {t ∈ s | t ⊆ ∅} = ({∅} : Set (Set ι)) by grind, key, + Set.indicator_of_mem h, Pi.one_apply] + · rw [show {t ∈ s | t ⊆ ∅} = (∅ : Set (Set ι)) by grind, measure_empty, + Set.indicator_of_notMem h] end Countable diff --git a/Mathlib/Probability/HasLaw.lean b/Mathlib/Probability/HasLaw.lean index 73c46d781c40af..abc9e450f070bf 100644 --- a/Mathlib/Probability/HasLaw.lean +++ b/Mathlib/Probability/HasLaw.lean @@ -88,7 +88,7 @@ protected lemma HasLaw.id : HasLaw id μ μ where protected lemma HasLaw.ae_iff (hX : HasLaw X μ P) {p : 𝓧 → Prop} (hp : Measurable p) : (∀ᵐ ω ∂P, p (X ω)) ↔ ∀ᵐ x ∂μ, p x := by - rw [← hX.map_eq, ae_map_iff hX.aemeasurable (measurableSet_setOf.2 hp)] + rw [← hX.map_eq, ae_map_iff hX.aemeasurable (measurableSet_setOfPred.2 hp)] protected theorem HasLaw.isFiniteMeasure_iff (hX : HasLaw X μ P) : IsFiniteMeasure P ↔ IsFiniteMeasure μ := by diff --git a/Mathlib/Probability/IdentDistrib.lean b/Mathlib/Probability/IdentDistrib.lean index 3a290b509a42ae..2bfc13bbd8f5ff 100644 --- a/Mathlib/Probability/IdentDistrib.lean +++ b/Mathlib/Probability/IdentDistrib.lean @@ -320,7 +320,7 @@ theorem MemLp.uniformIntegrable_of_identDistrib_aux {ι : Type*} {f : ι → α have : ∀ k, (fun x ↦ Set.indicator {x | C ≤ ‖f k x‖} (fun a ↦ ‖f k a‖) x) = F ∘ f k := by intro k ext x - simp only [Set.indicator, Set.mem_setOf_eq]; norm_cast + simp only [Set.indicator, Set.mem_ofPred_eq]; norm_cast rw [this, this, ← eLpNorm_map_measure F_meas.aestronglyMeasurable (hf i).aemeasurable_fst, (hf i).map_eq, eLpNorm_map_measure F_meas.aestronglyMeasurable (hf j).aemeasurable_fst] diff --git a/Mathlib/Probability/Independence/Integrable.lean b/Mathlib/Probability/Independence/Integrable.lean index c1a4dbb8a9a6fa..c358de8d7f83ab 100644 --- a/Mathlib/Probability/Independence/Integrable.lean +++ b/Mathlib/Probability/Independence/Integrable.lean @@ -44,7 +44,7 @@ lemma MemLp.isProbabilityMeasure_of_indepFun have h'c : μ {ω | c ≤ ‖f ω‖₊} < ∞ := hℒp.meas_ge_lt_top hp hp' c_pos.ne' have := hindep.measure_inter_preimage_eq_mul {x | c ≤ ‖x‖₊} Set.univ (isClosed_le continuous_const continuous_nnnorm).measurableSet MeasurableSet.univ - simp only [Set.preimage_setOf_eq, Set.preimage_univ, Set.inter_univ] at this + simp only [Set.preimage_ofPred_eq, Set.preimage_univ, Set.inter_univ] at this exact ⟨(ENNReal.mul_eq_left hc.ne' h'c.ne).1 this.symm⟩ diff --git a/Mathlib/Probability/Independence/Kernel/Indep.lean b/Mathlib/Probability/Independence/Kernel/Indep.lean index 4f9747d1c095fe..0c7c0766c9a249 100644 --- a/Mathlib/Probability/Independence/Kernel/Indep.lean +++ b/Mathlib/Probability/Independence/Kernel/Indep.lean @@ -279,7 +279,7 @@ theorem indep_bot_right (m' : MeasurableSpace Ω) {_mΩ : MeasurableSpace Ω} {κ : Kernel α Ω} {μ : Measure α} [IsZeroOrMarkovKernel κ] : Indep m' ⊥ κ μ := by intro s t _ ht - rw [Set.mem_setOf_eq, MeasurableSpace.measurableSet_bot_iff] at ht + rw [Set.mem_ofPred_eq, MeasurableSpace.measurableSet_bot_iff] at ht rcases eq_zero_or_isMarkovKernel κ with rfl | h · simp refine Filter.Eventually.of_forall (fun a ↦ ?_) @@ -649,7 +649,7 @@ theorem iIndepSet.indep_generateFrom_lt [Preorder ι] {s : ι → Set Ω} convert! iIndepSet.indep_generateFrom_of_disjoint hsm hs { i } {j | j < i} (Set.disjoint_singleton_left.mpr (lt_irrefl _)) using 1 - simp only [Set.mem_singleton_iff, exists_eq_left, Set.setOf_eq_eq_singleton'] + simp only [Set.mem_singleton_iff, exists_eq_left, Set.ofPred_eq_eq_singleton'] theorem iIndepSet.indep_generateFrom_le [Preorder ι] {s : ι → Set Ω} (hsm : ∀ n, MeasurableSet (s n)) (hs : iIndepSet s κ μ) (i : ι) {k : ι} (hk : i < k) : @@ -657,7 +657,7 @@ theorem iIndepSet.indep_generateFrom_le [Preorder ι] {s : ι → Set Ω} convert! iIndepSet.indep_generateFrom_of_disjoint hsm hs { k } {j | j ≤ i} (Set.disjoint_singleton_left.mpr hk.not_ge) using 1 - simp only [Set.mem_singleton_iff, exists_eq_left, Set.setOf_eq_eq_singleton'] + simp only [Set.mem_singleton_iff, exists_eq_left, Set.ofPred_eq_eq_singleton'] theorem iIndepSet.indep_generateFrom_le_nat {s : ℕ → Set Ω} (hsm : ∀ n, MeasurableSet (s n)) (hs : iIndepSet s κ μ) (n : ℕ) : diff --git a/Mathlib/Probability/Independence/Kernel/IndepFun.lean b/Mathlib/Probability/Independence/Kernel/IndepFun.lean index 56935576fa75f9..a6b1d4f77ce568 100644 --- a/Mathlib/Probability/Independence/Kernel/IndepFun.lean +++ b/Mathlib/Probability/Independence/Kernel/IndepFun.lean @@ -234,8 +234,8 @@ theorem IndepFun.congr' {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'} IndepFun f' g' κ μ := by rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩ filter_upwards [hf, hg, hfg _ _ ⟨_, hA, rfl⟩ ⟨_, hB, rfl⟩] with a hf' hg' hfg' - have h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A := hf'.fun_comp A - have h2 : g ⁻¹' B =ᵐ[κ a] g' ⁻¹' B := hg'.fun_comp B + have h1 : f ⁻¹' A =ᵐˢ[κ a] f' ⁻¹' A := hf'.fun_comp (· ∈ A) + have h2 : g ⁻¹' B =ᵐˢ[κ a] g' ⁻¹' B := hg'.fun_comp (· ∈ B) rwa [← measure_congr h1, ← measure_congr h2, ← measure_congr (h1.inter h2)] theorem IndepFun.comp {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'} @@ -356,7 +356,7 @@ theorem iIndepFun.indepFun_finset (S T : Finset ι) (hST : Disjoint S T) (Measurable.comap_le (measurable_pi_iff.mpr fun i => hf_meas i)) hπS_pi hπT_pi hπS_gen hπT_gen ?_ rintro _ _ ⟨s, ⟨sets_s, hs1, hs2⟩, rfl⟩ ⟨t, ⟨sets_t, ht1, ht2⟩, rfl⟩ - simp only [Set.mem_univ_pi, Set.mem_setOf_eq] at hs1 ht1 + simp only [Set.mem_univ_pi, Set.mem_ofPred_eq] at hs1 ht1 rw [← hs2, ← ht2] classical let sets_s' : ∀ i : ι, Set (β i) := fun i => diff --git a/Mathlib/Probability/Independence/Process/Basic.lean b/Mathlib/Probability/Independence/Process/Basic.lean index 8f314f4984f065..9cb717c758512d 100644 --- a/Mathlib/Probability/Independence/Process/Basic.lean +++ b/Mathlib/Probability/Independence/Process/Basic.lean @@ -106,7 +106,7 @@ lemma IndepFun.process_indepFun {𝓧 : S → Type*} {𝓨 : Type*} πX_pi (@isPiSystem_measurableSet Ω (.comap Y inferInstance)) πX_gen (@generateFrom_measurableSet Ω (.comap Y inferInstance)).symm ?_ rintro - - ⟨-, ⟨I, s, hs, rfl⟩, rfl⟩ ⟨t, ht, rfl⟩ - simp only [Set.mem_pi, Set.mem_univ, Set.mem_setOf_eq, forall_const] at hs + simp only [Set.mem_pi, Set.mem_univ, Set.mem_ofPred_eq, forall_const] at hs have : (fun ω i ↦ X i ω) ⁻¹' .pi I s = (fun ω (i : I) ↦ X i ω) ⁻¹' .pi (SetLike.coe Finset.univ) (fun i ↦ s i) := by @@ -255,7 +255,7 @@ lemma iIndepFun.iIndepFun_process {T : S → Type*} {𝓧 : (i : S) → (j : T i rfl refine iIndepSets.iIndep _ (fun i ↦ (measurable_pi_iff.2 (hX i)).comap_le) π π_pi π_gen fun I s hs ↦ ?_ - simp only [squareCylinders, Set.mem_pi, Set.mem_univ, Set.mem_setOf_eq, forall_const, + simp only [squareCylinders, Set.mem_pi, Set.mem_univ, Set.mem_ofPred_eq, forall_const, ↓existsAndEq, and_true, π] at hs choose! J t ht hs using hs simp_rw [Set.iInter₂_congr (fun i hi ↦ (hs i hi).symm), diff --git a/Mathlib/Probability/Kernel/Composition/CompProd.lean b/Mathlib/Probability/Kernel/Composition/CompProd.lean index 399b39d718dd7c..e14820256d7e09 100644 --- a/Mathlib/Probability/Kernel/Composition/CompProd.lean +++ b/Mathlib/Probability/Kernel/Composition/CompProd.lean @@ -207,12 +207,12 @@ lemma compProd_deterministic_apply [MeasurableSingletonClass γ] {f : α × β · suffices ∀ b ∈ tᶜ, (if f (x, b) ∈ Prod.mk b ⁻¹' s then (1 : ℝ≥0∞) else 0) = 0 by rw [setLIntegral_congr_fun ht.compl this, lintegral_zero] intro b hb - simp only [t, Set.mem_compl_iff, Set.mem_setOf_eq] at hb + simp only [t, Set.mem_compl_iff, Set.mem_ofPred_eq] at hb simp [hb] · suffices ∀ b ∈ t, (if f (x, b) ∈ Prod.mk b ⁻¹' s then (1 : ℝ≥0∞) else 0) = 1 by rw [setLIntegral_congr_fun ht this, setLIntegral_one] intro b hb - simp only [t, Set.mem_setOf_eq] at hb + simp only [t, Set.mem_ofPred_eq] at hb simp [hb] section Ae @@ -288,8 +288,8 @@ theorem compProd_restrict {s : Set β} {t : Set γ} (hs : MeasurableSet s) (ht : classical rw [Set.indicator_apply] split_ifs with h - · simp only [h, true_and, Set.inter_def, Set.mem_setOf] - · simp only [h, false_and, and_false, Set.setOf_false, measure_empty] + · simp only [h, true_and, Set.inter_def, Set.mem_ofPred] + · simp only [h, false_and, and_false, Set.ofPred_false, measure_empty] simp_rw [this] rw [lintegral_indicator hs] @@ -562,7 +562,7 @@ lemma fst_compProd_apply (κ : Kernel α β) (η : Kernel (α × β) γ) swap; · exact measurable_fst hs have h_eq b : η (x, b) {c | b ∈ s} = s.indicator (fun b ↦ η (x, b) Set.univ) b := by by_cases hb : b ∈ s <;> simp [hb] - simp_rw [Set.preimage, Set.mem_setOf_eq, h_eq] + simp_rw [Set.preimage, Set.mem_ofPred_eq, h_eq] @[simp] lemma fst_compProd (κ : Kernel α β) (η : Kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] : diff --git a/Mathlib/Probability/Kernel/Composition/MapComap.lean b/Mathlib/Probability/Kernel/Composition/MapComap.lean index 7606bd9421d80c..1546ebcdf9a804 100644 --- a/Mathlib/Probability/Kernel/Composition/MapComap.lean +++ b/Mathlib/Probability/Kernel/Composition/MapComap.lean @@ -454,7 +454,7 @@ lemma fst_map_prod (κ : Kernel α β) {f : β → γ} {g : β → δ} (hg : Mea by_cases hf : Measurable f · ext x s hs rw [fst_apply' _ _ hs, map_apply' _ (hf.prod hg) _, map_apply' _ hf _ hs] - · simp only [Set.preimage, Set.mem_setOf] + · simp only [Set.preimage, Set.mem_ofPred] · exact measurable_fst hs · have : ¬ Measurable (fun x ↦ (f x, g x)) := by contrapose hf; exact hf.fst @@ -516,7 +516,7 @@ lemma snd_map_prod (κ : Kernel α β) {f : β → γ} {g : β → δ} (hf : Mea by_cases hg : Measurable g · ext x s hs rw [snd_apply' _ _ hs, map_apply' _ (hf.prod hg), map_apply' _ hg _ hs] - · simp only [Set.preimage, Set.mem_setOf] + · simp only [Set.preimage, Set.mem_ofPred] · exact measurable_snd hs · have : ¬ Measurable (fun x ↦ (f x, g x)) := by contrapose hg; exact hg.snd diff --git a/Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean b/Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean index 0647d82cd7fad6..68403b544d1a92 100644 --- a/Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean +++ b/Mathlib/Probability/Kernel/Disintegration/CDFToKernel.lean @@ -555,7 +555,7 @@ lemma lintegral_toKernel_mem [IsFiniteKernel κ] (hf : IsCondKernelCDF f κ ν) simp only [preimage_empty, measure_empty, lintegral_const, zero_mul] | basic s hs => rcases hs with ⟨t₁, ht₁, t₂, ht₂, rfl⟩ - simp only [mem_setOf_eq] at ht₁ ht₂ + simp only [mem_ofPred_eq] at ht₁ ht₂ rw [← lintegral_add_compl _ ht₁] have h_eq1 : ∫⁻ x in t₁, hf.toKernel f (a, x) (Prod.mk x ⁻¹' t₁ ×ˢ t₂) ∂(ν a) = ∫⁻ x in t₁, hf.toKernel f (a, x) t₂ ∂(ν a) := by diff --git a/Mathlib/Probability/Kernel/Disintegration/Density.lean b/Mathlib/Probability/Kernel/Disintegration/Density.lean index 5c95391a27fe67..095b23c959db59 100644 --- a/Mathlib/Probability/Kernel/Disintegration/Density.lean +++ b/Mathlib/Probability/Kernel/Disintegration/Density.lean @@ -175,7 +175,7 @@ lemma meas_countablePartitionSet_le_of_fst_le (hκν : fst κ ≤ ν) (n : ℕ) ≤ fst κ a (countablePartitionSet n x) := by rw [fst_apply' _ _ (measurableSet_countablePartitionSet _ _)] refine measure_mono (fun x ↦ ?_) - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h _ ≤ ν a (countablePartitionSet n x) := hκν a _ @@ -219,7 +219,7 @@ lemma setIntegral_densityProcess_of_mem (hκν : fst κ ≤ ν) [hν : IsFiniteK have h0' : fst κ a (countablePartitionSet n x) = 0 := by simpa using (hκν a _).trans h0.le rw [fst_apply' _ _ (measurableSet_countablePartitionSet _ _)] at h0' refine measure_mono_null (fun x ↦ ?_) h0' - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h · finiteness congr @@ -235,7 +235,7 @@ lemma setIntegral_densityProcess_of_mem (hκν : fst κ ≤ ν) [hν : IsFiniteK rw [fst_apply' _ _ hu_meas] at h0' refine (measure_mono_null ?_ h0').symm intro p - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h rw [div_eq_mul_inv, mul_assoc, ENNReal.inv_mul_cancel h0, mul_one] exact measure_ne_top _ _ @@ -401,7 +401,7 @@ lemma tendsto_eLpNorm_one_densityProcess_limitProcess (hκν : fst κ ≤ ν) [I · refine fun ε _ ↦ ⟨2, fun n ↦ le_of_eq_of_le ?_ (?_ : 0 ≤ ENNReal.ofReal ε)⟩ · suffices {x | 2 ≤ ‖densityProcess κ ν n a x s‖₊} = ∅ by simp [this] ext x - simp only [mem_setOf_eq, mem_empty_iff_false, iff_false, not_le] + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false, not_le] refine (?_ : _ ≤ (1 : ℝ≥0)).trans_lt one_lt_two rw [Real.nnnorm_of_nonneg (densityProcess_nonneg _ _ _ _ _ _)] exact mod_cast (densityProcess_le_one hκν _ _ _ _) @@ -536,10 +536,10 @@ lemma setIntegral_density (hκν : fst κ ≤ ν) [IsFiniteKernel ν] have : IsFiniteKernel κ := isFiniteKernel_of_isFiniteKernel_fst (h := isFiniteKernel_of_le hκν) have hgen : ‹MeasurableSpace γ› = .generateFrom {s | ∃ n, MeasurableSet[countableFiltration γ n] s} := by - rw [setOf_exists, generateFrom_iUnion_measurableSet (countableFiltration γ), + rw [ofPred_exists, generateFrom_iUnion_measurableSet (countableFiltration γ), iSup_countableFiltration] have hpi : IsPiSystem {s | ∃ n, MeasurableSet[countableFiltration γ n] s} := by - rw [setOf_exists] + rw [ofPred_exists] exact isPiSystem_iUnion_of_monotone _ (fun n ↦ @isPiSystem_measurableSet _ (countableFiltration γ n)) fun _ _ ↦ (countableFiltration γ).mono @@ -660,14 +660,14 @@ lemma densityProcess_fst_univ_ae (κ : Kernel α (γ × β)) [IsFiniteKernel κ] have : {x | ¬ densityProcess κ (fst κ) n a x univ = 1} ⊆ {x | fst κ a (countablePartitionSet n x) = 0} := by intro x hx - simp only [mem_setOf_eq] at hx ⊢ + simp only [mem_ofPred_eq] at hx ⊢ rw [densityProcess_fst_univ] at hx simpa using hx refine measure_mono_null this ?_ have : {x | fst κ a (countablePartitionSet n x) = 0} ⊆ ⋃ (u) (_ : u ∈ countablePartition γ n) (_ : fst κ a u = 0), u := by intro t ht - simp only [mem_setOf_eq, mem_iUnion, exists_prop] at ht ⊢ + simp only [mem_ofPred_eq, mem_iUnion, exists_prop] at ht ⊢ exact ⟨countablePartitionSet n t, countablePartitionSet_mem _ _, ht, mem_countablePartitionSet _ _⟩ refine measure_mono_null this ?_ @@ -693,10 +693,10 @@ lemma tendsto_densityProcess_fst_atTop_univ_of_monotone (κ : Kernel α (γ × simp_rw [fst_apply' _ _ (measurableSet_countablePartitionSet _ _)] constructor · refine fun h h0 ↦ h (measure_mono_null (fun x ↦ ?_) h0) - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h · refine fun h_top ↦ eq_top_mono (measure_mono (fun x ↦ ?_)) h_top - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h by_cases h0 : fst κ a (countablePartitionSet n x) = 0 · rw [fst_apply' _ _ (measurableSet_countablePartitionSet _ _)] at h0 ⊢ @@ -705,10 +705,9 @@ lemma tendsto_densityProcess_fst_atTop_univ_of_monotone (κ : Kernel α (γ × suffices κ a (countablePartitionSet n x ×ˢ univ) = 0 by simp only [this, ENNReal.zero_div] convert! h0 - ext x - simp only [mem_prod, mem_univ, and_true, mem_setOf_eq] + simp only [Set.mem_iff_mem, mem_prod, mem_univ, and_true] refine fun m ↦ measure_mono_null (fun x ↦ ?_) h0 - simp only [mem_prod, mem_setOf_eq, and_imp] + simp only [mem_prod, mem_ofPred_eq, and_imp] exact fun h _ ↦ h refine ENNReal.Tendsto.div_const ?_ ?_ · convert! tendsto_measure_iUnion_atTop (monotone_const.set_prod hseq) @@ -739,7 +738,7 @@ lemma tendsto_density_fst_atTop_ae_of_monotone [IsFiniteKernel κ] convert! tendsto_integral_density_of_monotone (κ := κ) le_rfl a seq hseq hseq_iUnion hseq_meas simp only [measureReal_def] rw [fst_apply' _ _ MeasurableSet.univ] - simp only [mem_univ, setOf_true] + simp only [mem_univ, ofPred_true] · exact ae_of_all _ (fun c n m hnm ↦ density_mono_set le_rfl a c (hseq hnm)) · exact ae_of_all _ (fun x m ↦ density_le_one le_rfl a x (seq m)) diff --git a/Mathlib/Probability/Kernel/Disintegration/MeasurableStieltjes.lean b/Mathlib/Probability/Kernel/Disintegration/MeasurableStieltjes.lean index 9f51f0ecb5e416..6c1b0fd83203fc 100644 --- a/Mathlib/Probability/Kernel/Disintegration/MeasurableStieltjes.lean +++ b/Mathlib/Probability/Kernel/Disintegration/MeasurableStieltjes.lean @@ -88,7 +88,7 @@ lemma measurableSet_isRatStieltjesPoint [MeasurableSpace α] (hf : Measurable f) MeasurableSet {a | IsRatStieltjesPoint f a} := by have h1 : MeasurableSet {a | Monotone (f a)} := by change MeasurableSet {a | ∀ q r (_ : q ≤ r), f a q ≤ f a r} - simp_rw [Set.setOf_forall] + simp_rw [Set.ofPred_forall] refine MeasurableSet.iInter (fun q ↦ ?_) refine MeasurableSet.iInter (fun r ↦ ?_) refine MeasurableSet.iInter (fun _ ↦ ?_) @@ -98,7 +98,7 @@ lemma measurableSet_isRatStieltjesPoint [MeasurableSpace α] (hf : Measurable f) have h3 : MeasurableSet {a | Tendsto (f a) atBot (𝓝 0)} := measurableSet_tendsto _ (fun q ↦ hf.eval) have h4 : MeasurableSet {a | ∀ t : ℚ, ⨅ r : Ioi t, f a r = f a t} := by - rw [Set.setOf_forall] + rw [Set.ofPred_forall] refine MeasurableSet.iInter (fun q ↦ ?_) exact measurableSet_eq_fun (.iInf fun _ ↦ hf.eval) hf.eval suffices {a | IsRatStieltjesPoint f a} @@ -107,7 +107,7 @@ lemma measurableSet_isRatStieltjesPoint [MeasurableSpace α] (hf : Measurable f) rw [this] exact (((h1.inter h2).inter h3).inter h4) ext a - simp only [mem_setOf_eq, mem_inter_iff] + simp only [mem_ofPred_eq, mem_inter_iff] refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · exact ⟨⟨⟨h.mono, h.tendsto_atTop_one⟩, h.tendsto_atBot_zero⟩, h.iInf_rat_gt_eq⟩ · exact ⟨h.1.1.1, h.1.1.2, h.1.2, h.2⟩ diff --git a/Mathlib/Probability/Kernel/MeasurableIntegral.lean b/Mathlib/Probability/Kernel/MeasurableIntegral.lean index 0adc5b18d2add3..e2c813fea9b0bb 100644 --- a/Mathlib/Probability/Kernel/MeasurableIntegral.lean +++ b/Mathlib/Probability/Kernel/MeasurableIntegral.lean @@ -70,7 +70,7 @@ theorem StronglyMeasurable.integral_kernel ⦃f : β → E⦄ exact κ.measurable_coe ((s n).measurableSet_fiber _) · rw [tendsto_pi_nhds]; intro x by_cases hfx : Integrable f (κ x) - · simp only [mem_setOf_eq, hfx, indicator_of_mem, f'] + · simp only [mem_ofPred_eq, hfx, indicator_of_mem, f'] apply tendsto_integral_approxOn_of_measurable_of_range_subset _ hfx exact subset_rfl · simp [f', hfx, integral_undef] @@ -107,7 +107,7 @@ theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄ filter_upwards with y simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem, - mem_setOf_eq] + mem_ofPred_eq] refine tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖) (fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_ diff --git a/Mathlib/Probability/Kernel/MeasurableLIntegral.lean b/Mathlib/Probability/Kernel/MeasurableLIntegral.lean index 3c6e41f14545f9..2a7782dbce9357 100644 --- a/Mathlib/Probability/Kernel/MeasurableLIntegral.lean +++ b/Mathlib/Probability/Kernel/MeasurableLIntegral.lean @@ -44,7 +44,7 @@ theorem measurable_kernel_prodMk_left_of_finite {t : Set (α × β)} (ht : Measu using MeasurableSpace.induction_on_inter generateFrom_prod.symm isPiSystem_prod with | empty => simp only [preimage_empty, measure_empty, measurable_const] | basic t ht => - simp only [Set.mem_image2, Set.mem_setOf_eq] at ht + simp only [Set.mem_image2, Set.mem_ofPred_eq] at ht obtain ⟨t₁, ht₁, t₂, ht₂, rfl⟩ := ht classical simp_rw [mk_preimage_prod_right_eq_if] diff --git a/Mathlib/Probability/Kernel/RadonNikodym.lean b/Mathlib/Probability/Kernel/RadonNikodym.lean index 37e2a38b4c4336..e2ee195ea9368a 100644 --- a/Mathlib/Probability/Kernel/RadonNikodym.lean +++ b/Mathlib/Probability/Kernel/RadonNikodym.lean @@ -193,7 +193,7 @@ def mutuallySingularSetSlice (κ η : Kernel α γ) (a : α) : Set γ := lemma mem_mutuallySingularSetSlice (κ η : Kernel α γ) (a : α) (x : γ) : x ∈ mutuallySingularSetSlice κ η a ↔ 1 ≤ rnDerivAux κ (κ + η) a x := by - rw [mutuallySingularSetSlice, mem_setOf] + rw [mutuallySingularSetSlice, mem_ofPred] lemma notMem_mutuallySingularSetSlice (κ η : Kernel α γ) (a : α) (x : γ) : x ∉ mutuallySingularSetSlice κ η a ↔ rnDerivAux κ (κ + η) a x < 1 := by @@ -220,7 +220,7 @@ lemma measure_mutuallySingularSetSlice (κ η : Kernel α γ) [IsFiniteKernel κ · fun_prop · fun_prop refine ae_of_all _ (fun x hx ↦ ?_) - simp only [mem_setOf_eq] at hx + simp only [mem_ofPred_eq] at hx simp [hx] /-- Radon-Nikodym derivative of the kernel `κ` with respect to the kernel `η`. -/ @@ -247,12 +247,12 @@ lemma rnDeriv_eq_top_iff (κ η : Kernel α γ) (a : α) (x : γ) : rnDeriv κ η a x = ∞ ↔ (a, x) ∈ mutuallySingularSet κ η := by simp only [rnDeriv, ENNReal.div_eq_top, ne_eq, ENNReal.ofReal_eq_zero, not_le, tsub_le_iff_right, zero_add, ENNReal.ofReal_ne_top, not_false_eq_true, and_true, or_false, - mutuallySingularSet, mem_setOf_eq, and_iff_right_iff_imp] + mutuallySingularSet, mem_ofPred_eq, and_iff_right_iff_imp] exact fun h ↦ zero_lt_one.trans_le h lemma rnDeriv_eq_top_iff' (κ η : Kernel α γ) (a : α) (x : γ) : rnDeriv κ η a x = ∞ ↔ x ∈ mutuallySingularSetSlice κ η a := by - rw [rnDeriv_eq_top_iff, mutuallySingularSet, mutuallySingularSetSlice, mem_setOf, mem_setOf] + rw [rnDeriv_eq_top_iff, mutuallySingularSet, mutuallySingularSetSlice, mem_ofPred, mem_ofPred] /-- Singular part of the kernel `κ` with respect to the kernel `η`. -/ noncomputable @@ -285,7 +285,7 @@ lemma singularPart_compl_mutuallySingularSetSlice (κ η : Kernel α γ) [IsSFin · exact measurable_singularPart_fun_right κ η a · exact measurable_singularPart_fun κ η refine ae_of_all _ (fun x hx ↦ ?_) - simp only [mem_compl_iff, mutuallySingularSetSlice, mem_setOf, not_le] at hx + simp only [mem_compl_iff, mutuallySingularSetSlice, mem_ofPred, not_le] at hx simp_rw [rnDeriv] rw [← ENNReal.ofReal_div_of_pos, div_eq_inv_mul, ← ENNReal.ofReal_mul, ← mul_assoc, mul_inv_cancel₀, one_mul, tsub_self, Pi.zero_apply] diff --git a/Mathlib/Probability/Kernel/Representation.lean b/Mathlib/Probability/Kernel/Representation.lean index 90a06b713b9bd9..e9846b9dd52e9a 100644 --- a/Mathlib/Probability/Kernel/Representation.lean +++ b/Mathlib/Probability/Kernel/Representation.lean @@ -52,7 +52,7 @@ private lemma exists_measurable_map_eq_unitInterval_aux (κ : Kernel X I) [IsMar have sSup_eq_iUnion_rat : {x : X × I | a < f x.1 x.2} = ⋃ (q : ℚ) (hqI : ↑q ∈ I) (_ : a < (q : ℝ)), {e | (κ e.1).real (Icc 0 ⟨q, hqI⟩) < e.2} := by ext e - simp_all only [lt_sSup_iff, mem_setOf_eq, Subtype.exists, mem_Icc, Rat.cast_nonneg, + simp_all only [lt_sSup_iff, mem_ofPred_eq, Subtype.exists, mem_Icc, Rat.cast_nonneg, mem_iUnion, exists_prop, exists_and_left, f] constructor · rintro ⟨y, hyI, y_mem, (hy : a.1 < y)⟩ diff --git a/Mathlib/Probability/Martingale/Convergence.lean b/Mathlib/Probability/Martingale/Convergence.lean index f304cfd1f359f9..0adbe1fe53f8a9 100644 --- a/Mathlib/Probability/Martingale/Convergence.lean +++ b/Mathlib/Probability/Martingale/Convergence.lean @@ -202,7 +202,7 @@ theorem Submartingale.exists_ae_trim_tendsto_of_bdd [IsFiniteMeasure μ] (hf : S rw [ae_iff, trim_measurableSet_eq] · exact hf.exists_ae_tendsto_of_bdd hbdd · exact MeasurableSet.compl <| measurableSet_exists_tendsto - fun n => (hf.stronglyMeasurable n).measurable.mono (le_sSup ⟨n, rfl⟩) le_rfl + fun n => (hf.stronglyMeasurable n).measurable.mono (le_iSup _ n) le_rfl /-- **Almost everywhere martingale convergence theorem**: An L¹-bounded submartingale converges almost everywhere to a `⨆ n, ℱ n`-measurable function. -/ @@ -381,7 +381,7 @@ theorem Integrable.tendsto_ae_condExp (hg : Integrable g μ) (fun s _ _ => hlimint.integrableOn) (fun s hs _ => ?_) hgmeas.aestronglyMeasurable stronglyMeasurable_limitProcess.aestronglyMeasurable have hpi : IsPiSystem {s | ∃ n, MeasurableSet[ℱ n] s} := by - rw [Set.setOf_exists] + rw [Set.ofPred_exists] exact isPiSystem_iUnion_of_monotone _ (fun n ↦ (ℱ n).isPiSystem_measurableSet) fun _ _ ↦ ℱ.mono induction s, hs using MeasurableSpace.induction_on_inter (MeasurableSpace.measurableSpace_iSup_eq ℱ) hpi with diff --git a/Mathlib/Probability/Martingale/OptionalSampling.lean b/Mathlib/Probability/Martingale/OptionalSampling.lean index 0c00d1562a9576..da461730194adb 100644 --- a/Mathlib/Probability/Martingale/OptionalSampling.lean +++ b/Mathlib/Probability/Martingale/OptionalSampling.lean @@ -69,7 +69,7 @@ theorem condExp_stopping_time_ae_eq_restrict_eq_const_of_le_const (h : Martingal rw [Set.inter_comm _ t, IsStoppingTime.measurableSet_inter_eq_iff] · suffices {x : Ω | τ x = i} = ∅ by simp [this]; norm_cast ext1 x - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] contrapose hin exact_mod_cast hin ▸ hτ_le x @@ -82,7 +82,7 @@ theorem stoppedValue_ae_eq_restrict_eq (h : Martingale f ℱ μ) (hτ : IsStoppi (condExp_stopping_time_ae_eq_restrict_eq_const_of_le_const h hτ hτ_le i).symm rw [Filter.EventuallyEq, ae_restrict_iff' (ℱ.le _ _ (hτ.measurableSet_eq i))] refine Filter.Eventually.of_forall fun x hx => ?_ - rw [Set.mem_setOf_eq] at hx + rw [Set.mem_ofPred_eq] at hx simp [stoppedValue, hx] /-- The value of a martingale `f` at a stopping time `τ` bounded by `n` is the conditional @@ -94,7 +94,7 @@ theorem stoppedValue_ae_eq_condExp_of_le_const_of_countable_range (h : Martingal have : Set.univ = ⋃ i ∈ Set.range τ, {x | τ x = i} := by ext1 x simp only [Set.mem_univ, Set.mem_range, Set.iUnion_exists, Set.iUnion_iUnion_eq', - Set.mem_iUnion, Set.mem_setOf_eq, exists_apply_eq_apply'] + Set.mem_iUnion, Set.mem_ofPred_eq, exists_apply_eq_apply'] nth_rw 1 [← @Measure.restrict_univ Ω _ μ] rw [this, ae_eq_restrict_biUnion_iff _ h_countable_range] intro i hi @@ -206,7 +206,7 @@ theorem stoppedValue_min_ae_eq_condExp [SigmaFiniteFiltration μ ℱ] (h : Marti rw [Filter.EventuallyEq, ae_restrict_iff'] at this swap; · exact hτ.measurableSpace_le _ (hτ.measurableSet_le_stopping_time hσ) filter_upwards [this] with x hx hx_mem - simp only [Set.mem_compl_iff, Set.mem_setOf_eq, not_le] at hx_mem + simp only [Set.mem_compl_iff, Set.mem_ofPred_eq, not_le] at hx_mem exact hx hx_mem.le apply Filter.EventuallyEq.trans _ ((condExp_min_stopping_time_ae_eq_restrict_le hτ hσ).trans _) · exact stoppedValue f τ diff --git a/Mathlib/Probability/Martingale/OptionalStopping.lean b/Mathlib/Probability/Martingale/OptionalStopping.lean index ffd7a0c4fa5013..eee101a8c0afa4 100644 --- a/Mathlib/Probability/Martingale/OptionalStopping.lean +++ b/Mathlib/Probability/Martingale/OptionalStopping.lean @@ -49,6 +49,7 @@ theorem Submartingale.expected_stoppedValue_mono {E : Type*} [NormedAddCommGroup · simp only [Finset.sum_apply] have : ∀ i, MeasurableSet[𝒢 i] {ω : Ω | τ ω ≤ i ∧ i < π ω} := by intro i + change MeasurableSet[𝒢 i] ({ω : Ω | τ ω ≤ i} ∩ {ω : Ω | i < π ω}) refine (hτ i).inter ?_ convert! (hπ i).compl using 1 ext x @@ -130,8 +131,8 @@ theorem smul_le_stoppedValue_hittingBtwn [IsFiniteMeasure μ] (hsub : Submarting (ε : ℝ) ≤ stoppedValue f (fun ω ↦ (hittingBtwn f {y : ℝ | ε ≤ y} 0 n ω : ℕ)) ω := by intro x hx simp_rw [le_sup'_iff, mem_range, Nat.lt_succ_iff] at hx - refine stoppedValue_hittingBtwn_mem ?_ - simp only [Set.mem_Icc, zero_le, true_and, Set.mem_setOf_eq] + refine stoppedValue_hittingBtwn_mem (s := {y : ℝ | ε ≤ y}) ?_ + simp only [Set.mem_Icc, zero_le, true_and, Set.mem_ofPred_eq] exact let ⟨j, hj₁, hj₂⟩ := hx ⟨j, hj₁, hj₂⟩ @@ -194,9 +195,9 @@ theorem maximal_ineq [IsFiniteMeasure μ] (hsub : Submartingale f 𝒢 μ) (hnon exact hsub.stronglyAdapted.adapted.isStoppingTime_hittingBtwn measurableSet_Ici · exact nullMeasurableSet_lt (measurable_range_sup'' fun n _ ↦ (hsub.stronglyMeasurable n).measurable.le (𝒢.le n)).aemeasurable aemeasurable_const - rw [Set.mem_setOf_eq] at hω + rw [Set.mem_ofPred_eq] at hω have : hittingBtwn f {y : ℝ | ε ≤ y} 0 n ω = n := by - simp only [hittingBtwn, Set.mem_setOf_eq, ite_eq_right_iff, forall_exists_index, and_imp] + simp only [hittingBtwn, Set.mem_ofPred_eq, ite_eq_right_iff, forall_exists_index, and_imp] intro m hm hεm exact False.elim ((not_le.2 hω) ((le_sup'_iff _).2 ⟨m, mem_range.2 (Nat.lt_succ_of_le hm.2), hεm⟩)) diff --git a/Mathlib/Probability/Martingale/Upcrossing.lean b/Mathlib/Probability/Martingale/Upcrossing.lean index d266f8502d70b2..c400ddbd3f076f 100644 --- a/Mathlib/Probability/Martingale/Upcrossing.lean +++ b/Mathlib/Probability/Martingale/Upcrossing.lean @@ -376,7 +376,8 @@ theorem StronglyAdapted.upcrossingStrat (hf : StronglyAdapted ℱ f) : ∑ k ∈ Finset.range N, ({n | lowerCrossingTime a b f N k ω ≤ n} ∩ {n | n < upperCrossingTime a b f N (k + 1) ω}).indicator 1 n refine Finset.stronglyMeasurable_fun_sum _ fun i _ => - stronglyMeasurable_const.indicator ?_ + stronglyMeasurable_const.indicator + (s := {ω | lowerCrossingTime a b f N i ω ≤ n ∧ n < upperCrossingTime a b f N (i + 1) ω}) ?_ have hl := hf.isStoppingTime_lowerCrossingTime (a := a) (b := b) (N := N) (n := i) n have hu := hf.isStoppingTime_upperCrossingTime (a := a) (b := b) (N := N) (n := i + 1) n simp only [ENat.some_eq_coe, Nat.cast_le] at hl hu @@ -522,7 +523,7 @@ theorem upcrossingsBefore_lt_of_exists_upcrossing (hab : a < b) {N₁ N₂ : ℕ (hN₁' : f N₁ ω < a) (hN₂ : N₁ ≤ N₂) (hN₂' : b < f N₂ ω) : upcrossingsBefore a b f N ω < upcrossingsBefore a b f (N₂ + 1) ω := by refine lt_of_lt_of_le (Nat.lt_succ_self _) (le_csSup (upperCrossingTime_lt_bddAbove hab) ?_) - rw [Set.mem_setOf_eq, upperCrossingTime_succ_eq, hittingBtwn_lt_iff _ le_rfl] + rw [Set.mem_ofPred_eq, upperCrossingTime_succ_eq, hittingBtwn_lt_iff _ le_rfl] refine ⟨N₂, ⟨?_, Nat.lt_succ_self _⟩, hN₂'.le⟩ rw [lowerCrossingTime, hittingBtwn_le_iff_of_lt _ (Nat.lt_succ_self _)] refine ⟨N₁, ⟨le_trans ?_ hN₁, hN₂⟩, hN₁'.le⟩ @@ -741,7 +742,7 @@ theorem upcrossingsBefore_eq_sum (hab : a < b) : upcrossingsBefore a b f N ω = rintro k hk rw [Finset.mem_Ico, Nat.succ_le_iff] at hk rw [Set.indicator_of_notMem] - simp only [Set.mem_setOf_eq, not_lt] + simp only [Set.mem_ofPred_eq, not_lt] exact (upperCrossingTime_eq_of_upcrossingsBefore_lt hab hk.1).symm.le rw [Finset.sum_congr rfl h₁, Finset.sum_congr rfl h₂, Finset.sum_const, Finset.sum_const, smul_eq_mul, mul_one, smul_eq_mul, mul_zero, Nat.card_Ico, Nat.add_succ_sub_one, @@ -754,8 +755,8 @@ theorem StronglyAdapted.measurable_upcrossingsBefore (hf : StronglyAdapted ℱ f ext ω exact upcrossingsBefore_eq_sum hab rw [this] - refine Finset.measurable_fun_sum _ fun i _ => Measurable.indicator measurable_const <| - ℱ.le N _ ?_ + refine Finset.measurable_fun_sum _ fun i _ => Measurable.indicator + (s := {ω | upperCrossingTime a b f N i ω < N}) measurable_const <| ℱ.le N _ ?_ simpa only [ENat.some_eq_coe, Nat.cast_lt] using! hf.isStoppingTime_upperCrossingTime.measurableSet_lt_of_pred N diff --git a/Mathlib/Probability/Moments/Basic.lean b/Mathlib/Probability/Moments/Basic.lean index 2941afd2786b9c..8bc06c60bcbd0e 100644 --- a/Mathlib/Probability/Moments/Basic.lean +++ b/Mathlib/Probability/Moments/Basic.lean @@ -437,7 +437,7 @@ theorem measure_ge_le_exp_mul_mgf [IsFiniteMeasure μ] (ε : ℝ) (ht : 0 ≤ t) calc μ.real {ω | ε ≤ X ω} = μ.real {ω | exp (t * ε) ≤ exp (t * X ω)} := by congr 1 with ω - simp only [Set.mem_setOf_eq, exp_le_exp] + simp only [Set.mem_ofPred_eq, exp_le_exp] exact ⟨fun h => mul_le_mul_of_nonneg_left h ht_pos.le, fun h => le_of_mul_le_mul_left h ht_pos⟩ _ ≤ (exp (t * ε))⁻¹ * μ[fun ω => exp (t * X ω)] := by diff --git a/Mathlib/Probability/Moments/ComplexMGF.lean b/Mathlib/Probability/Moments/ComplexMGF.lean index e779d0be17f9b7..c9d820921ab05b 100644 --- a/Mathlib/Probability/Moments/ComplexMGF.lean +++ b/Mathlib/Probability/Moments/ComplexMGF.lean @@ -211,7 +211,8 @@ lemma hasDerivAt_iteratedDeriv_complexMGF (hz : z.re ∈ interior (integrableExp have : deriv (iteratedDeriv n (complexMGF X μ)) =ᶠ[𝓝 z] fun z ↦ μ[fun ω ↦ X ω ^ (n + 1) * cexp (z * X ω)] := by have h_mem : ∀ᶠ y in 𝓝 z, y.re ∈ interior (integrableExpSet X μ) := by - refine IsOpen.eventually_mem ?_ hz + refine IsOpen.eventually_mem (s := Complex.re ⁻¹' interior (integrableExpSet X μ)) + ?_ hz exact isOpen_interior.preimage Complex.continuous_re filter_upwards [h_mem] with y hy using HasDerivAt.deriv (hn hy) rw [EventuallyEq.hasDerivAt_iff this] @@ -241,7 +242,7 @@ the same `integrableExpSet`. -/ lemma integrableExpSet_eq_of_mgf' (hXY : mgf X μ = mgf Y μ') (hμμ' : μ = 0 ↔ μ' = 0) : integrableExpSet X μ = integrableExpSet Y μ' := by ext t - simp only [integrableExpSet, Set.mem_setOf_eq] + simp only [integrableExpSet, Set.mem_ofPred_eq] by_cases hμ : μ = 0 · simp [hμ, hμμ'.mp hμ] have : NeZero μ := ⟨hμ⟩ diff --git a/Mathlib/Probability/Moments/SubGaussian.lean b/Mathlib/Probability/Moments/SubGaussian.lean index 0de6c2ca8428f9..a676606bf9ee41 100644 --- a/Mathlib/Probability/Moments/SubGaussian.lean +++ b/Mathlib/Probability/Moments/SubGaussian.lean @@ -353,7 +353,7 @@ lemma measure_pos_eq_zero_of_hasSubGaussianMGF_zero (h : HasSubgaussianMGF X 0 ∀ᵐ ω' ∂ν, (κ ω') {ω | 0 < X ω} = 0 := by have hs : {ω | 0 < X ω} = ⋃ ε : {ε : ℚ // 0 < ε}, {ω | ε ≤ X ω} := by ext ω - simp only [Set.mem_setOf_eq, Set.mem_iUnion, Subtype.exists, exists_prop] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion, Subtype.exists, exists_prop] constructor · intro hp obtain ⟨q, h1, h2⟩ := exists_rat_btwn hp diff --git a/Mathlib/Probability/ProbabilityMassFunction/Constructions.lean b/Mathlib/Probability/ProbabilityMassFunction/Constructions.lean index bab0cce586a7d7..f84582dd289484 100644 --- a/Mathlib/Probability/ProbabilityMassFunction/Constructions.lean +++ b/Mathlib/Probability/ProbabilityMassFunction/Constructions.lean @@ -311,14 +311,15 @@ theorem support_bernoulli : (bernoulli p h).support = { b | cond b (p ≠ 0) (p refine Set.ext fun b => ?_ induction b · simp_rw [mem_support_iff, bernoulli_apply, Bool.cond_false, Ne, ENNReal.coe_sub, - ENNReal.coe_one, Bool.cond_prop, Set.mem_setOf_eq, Bool.false_eq_true, ite_false, not_iff_not] + ENNReal.coe_one, Bool.cond_prop, Set.mem_ofPred_eq, Bool.false_eq_true, ite_false, + not_iff_not] constructor · intro h' simp only [tsub_eq_zero_iff_le, one_le_coe_iff] at h' exact eq_of_le_of_ge h h' · intro h' simp only [h', ENNReal.coe_one, tsub_self] - · simp only [mem_support_iff, bernoulli_apply, Bool.cond_true, Set.mem_setOf_eq, ne_eq, + · simp only [mem_support_iff, bernoulli_apply, Bool.cond_true, Set.mem_ofPred_eq, ne_eq, ENNReal.coe_eq_zero] @[deprecated ProbabilityTheory.bernoulliMeasure_apply_of_notMem_of_notMem (since := "2026-05-29")] diff --git a/Mathlib/Probability/Process/HittingTime.lean b/Mathlib/Probability/Process/HittingTime.lean index 6f0144b035b6b5..d1ce82eaee85ae 100644 --- a/Mathlib/Probability/Process/HittingTime.lean +++ b/Mathlib/Probability/Process/HittingTime.lean @@ -89,7 +89,7 @@ lemma hittingBtwn_univ {ι : Type*} [ConditionallyCompleteLinearOrder ι] {u : hittingBtwn u .univ n m = fun _ ↦ min n m := by ext ω classical - simp only [hittingBtwn_def, Set.mem_Icc, Set.mem_univ, and_true, Set.setOf_true, Set.inter_univ] + simp only [hittingBtwn_def, Set.mem_Icc, Set.mem_univ, and_true, Set.ofPred_true, Set.inter_univ] by_cases hnm : n ≤ m <;> simp [hnm] <;> grind @[simp] @@ -132,7 +132,7 @@ theorem notMem_of_lt_hittingAfter {k : ι} (hk₁ : k < hittingAfter u s n ω) ( u k ω ∉ s := by refine fun h ↦ not_le.2 hk₁ ?_ rw [hittingAfter, if_pos ⟨k, hk₂, h⟩] - exact_mod_cast csInf_le bddBelow_Ici.inter_of_left ⟨hk₂, h⟩ + exact_mod_cast csInf_le (s := {i | n ≤ i ∧ u i ω ∈ s}) ⟨n, fun j hj => hj.1⟩ ⟨hk₂, h⟩ theorem hittingBtwn_eq_end_iff {m : ι} : hittingBtwn u s n m ω = m ↔ (∃ j ∈ Set.Icc n m, u j ω ∈ s) → sInf (Set.Icc n m ∩ {i : ι | u i ω ∈ s}) = m := by @@ -165,7 +165,7 @@ theorem le_hittingBtwn {m : ι} (hnm : n ≤ m) (ω : Ω) : n ≤ hittingBtwn u lemma le_hittingAfter (ω : Ω) : n ≤ hittingAfter u s n ω := by simp only [hittingAfter] split_ifs with h - · exact_mod_cast le_csInf h fun b hb => hb.1 + · exact_mod_cast le_csInf (s := {i | n ≤ i ∧ u i ω ∈ s}) h fun b hb => hb.1 · simp theorem le_hittingBtwn_of_exists {m : ι} (h_exists : ∃ j ∈ Set.Icc n m, u j ω ∈ s) : @@ -183,7 +183,7 @@ theorem hittingBtwn_mem_set [WellFoundedLT ι] {m : ι} (h_exists : ∃ j ∈ Se simp_rw [hittingBtwn, if_pos h_exists] have h_nonempty : (Set.Icc n m ∩ {i : ι | u i ω ∈ s}).Nonempty := by obtain ⟨k, hk₁, hk₂⟩ := h_exists - exact ⟨k, Set.mem_inter hk₁ hk₂⟩ + exact ⟨k, hk₁, hk₂⟩ have h_mem := csInf_mem h_nonempty rw [Set.mem_inter_iff] at h_mem exact h_mem.2 @@ -193,7 +193,7 @@ lemma hittingAfter_mem_set [WellFoundedLT ι] (h_exists : ∃ j, n ≤ j ∧ u j rw [hittingAfter, if_pos h_exists] have h_nonempty : {i : ι | n ≤ i ∧ u i ω ∈ s}.Nonempty := by obtain ⟨k, hk₁, hk₂⟩ := h_exists - exact ⟨k, Set.mem_inter hk₁ hk₂⟩ + exact ⟨k, hk₁, hk₂⟩ exact (csInf_mem h_nonempty).2 theorem hittingBtwn_mem_set_of_hittingBtwn_lt [WellFoundedLT ι] {m : ι} @@ -220,7 +220,7 @@ lemma hittingAfter_le_of_mem (hin : n ≤ i) (his : u i ω ∈ s) : hittingAfter u s n ω ≤ i := by have h_exists : ∃ k, n ≤ k ∧ u k ω ∈ s := ⟨i, hin, his⟩ rw [hittingAfter, if_pos h_exists] - exact_mod_cast csInf_le (BddBelow.inter_of_left bddBelow_Ici) (Set.mem_inter hin his) + exact_mod_cast csInf_le (s := {i | n ≤ i ∧ u i ω ∈ s}) ⟨n, fun j hj => hj.1⟩ ⟨hin, his⟩ theorem hittingBtwn_le_iff_of_exists [WellFoundedLT ι] {m : ι} (h_exists : ∃ j ∈ Set.Icc n m, u j ω ∈ s) : @@ -271,7 +271,7 @@ theorem hittingBtwn_lt_iff {m : ι} (i : ι) (hi : i ≤ m) : rotate_left · exact ⟨n, by simp [mem_lowerBounds]; grind⟩ · exact h - simp only [Set.mem_inter_iff, Set.mem_Icc, Set.mem_setOf_eq] at h' + simp only [Set.mem_inter_iff, Set.mem_Icc, Set.mem_ofPred_eq] at h' obtain ⟨j, ⟨⟨hnj, hjm⟩, hj_mem⟩, hji⟩ := h' exact ⟨j, ⟨hnj, hji⟩, hj_mem⟩ · obtain ⟨k, hk₁, hk₂⟩ := h' @@ -293,7 +293,7 @@ lemma hittingAfter_lt_iff : rotate_left · exact ⟨n, by simp [mem_lowerBounds]; grind⟩ · exact h_exists - simp only [Set.mem_setOf_eq] at h' + simp only [Set.mem_ofPred_eq] at h' obtain ⟨j, hj₁, hj₂⟩ := h' exact ⟨j, ⟨hj₁.1, hj₂⟩, hj₁.2⟩ · obtain ⟨j, hj₁, hj₂⟩ := h' @@ -449,7 +449,7 @@ theorem Adapted.isStoppingTime_hittingBtwn_isStoppingTime [ConditionallyComplete (⋃ i ≤ n, {x | τ x = i} ∩ {x | hittingBtwn u s i N x ≤ n}) ∪ ⋃ i > n, {x | τ x = i} ∩ {x | hittingBtwn u s i N x ≤ n} := by ext x - simp only [Set.mem_setOf_eq, gt_iff_lt, Set.mem_union, Set.mem_iUnion, Set.mem_inter_iff, + simp only [Set.mem_ofPred_eq, gt_iff_lt, Set.mem_union, Set.mem_iUnion, Set.mem_inter_iff, exists_and_left, exists_prop] specialize hτbdd x have h_top : τ x ≠ ⊤ := fun h => by simp [h] at hτbdd @@ -457,7 +457,7 @@ theorem Adapted.isStoppingTime_hittingBtwn_isStoppingTime [ConditionallyComplete simp [← or_and_right, le_or_gt] have h₂ : ⋃ i > n, {x | τ x = i} ∩ {x | hittingBtwn u s i N x ≤ n} = ∅ := by ext x - simp only [gt_iff_lt, Set.mem_iUnion, Set.mem_inter_iff, Set.mem_setOf_eq, exists_prop, + simp only [gt_iff_lt, Set.mem_iUnion, Set.mem_inter_iff, Set.mem_ofPred_eq, exists_prop, Set.mem_empty_iff_false, iff_false, not_exists, not_and, not_le] refine fun m hm hτ ↦ hm.trans_le <| le_hittingBtwn ?_ x specialize hτbdd x diff --git a/Mathlib/Probability/Process/LocalProperty.lean b/Mathlib/Probability/Process/LocalProperty.lean index 4078759db74a29..b19bb011c2e441 100644 --- a/Mathlib/Probability/Process/LocalProperty.lean +++ b/Mathlib/Probability/Process/LocalProperty.lean @@ -175,7 +175,7 @@ lemma IsStable.locally_and_iff (hp : IsStable 𝓕 p) (hq : IsStable 𝓕 q) : hqX.isLocalizingSequence_localSeq.isStoppingTime n using 1 ext i ω simp_rw [stoppedProcess_indicator_comm, Pi.inf_apply, lt_inf_iff, inf_comm (hpX.localSeq n)] - rw [← stoppedProcess_stoppedProcess, ← stoppedProcess_indicator_comm, Set.setOf_and, + rw [← stoppedProcess_stoppedProcess, ← stoppedProcess_indicator_comm, Set.ofPred_and, Set.inter_comm] simp_rw [← Set.indicator_indicator] rfl @@ -193,7 +193,8 @@ lemma IsPreLocalizingSequence.isLocalizingSequence_biInf IsLocalizingSequence 𝓕 (fun i ω ↦ ⨅ j ≥ i, τ j ω) P where isStoppingTime n := IsStoppingTime.biInf (Set.to_countable {j | j ≥ n}) (fun j _ ↦ hτ.isStoppingTime j) - mono := ae_of_all _ <| fun ω n m hnm ↦ iInf_le_iInf_of_subset <| fun k hk ↦ hnm.trans hk + mono := ae_of_all _ <| fun ω n m hnm ↦ + iInf_le_iInf_of_subset (s := {j | j ≥ m}) (t := {j | j ≥ n}) fun k hk ↦ hnm.trans hk tendsto_top := by filter_upwards [hτ.tendsto_top] with ω hω replace hω := hω.liminf_eq @@ -239,7 +240,7 @@ private lemma isPreLocalizingSequence_of_isLocalizingSequence_aux' rw [measure_eq_zero_iff_ae_notMem] filter_upwards [(hσ n).tendsto_top] with ω hTop hmem simp_rw [WithTop.tendsto_nhds_top_iff, eventually_atTop] at hTop - simp only [Set.mem_iInter, Set.mem_setOf_eq] at hmem + simp only [Set.mem_iInter, Set.mem_ofPred_eq] at hmem obtain ⟨N, hN⟩ := hTop (T n) specialize hN N le_rfl specialize hmem N @@ -249,10 +250,10 @@ private lemma isPreLocalizingSequence_of_isLocalizingSequence_aux' · filter_upwards [(hσ n).mono] with ω hω intros i j hij specialize hω hij - simp [setOf] at * + simp at * grind · refine fun i ↦ .nullMeasurableSet ?_ - simp_rw [lt_inf_iff, Set.setOf_and] + simp_rw [lt_inf_iff, Set.ofPred_and] exact MeasurableSet.inter (measurableSet_lt ((hσ n).isStoppingTime i).measurable' (hτ.isStoppingTime n).measurable') <| measurableSet_lt ((hσ n).isStoppingTime i).measurable' measurable_const @@ -282,7 +283,7 @@ private lemma isPreLocalizingSequence_of_isLocalizingSequence_aux fun n ↦ le_trans (EventuallyLE.measure_le ?_) (hnk n)⟩ filter_upwards [(hσ n).mono] with ω hω specialize hω (le_mkStrictMonoAux nk n) - simp [setOf] + simp grind lemma IsLocalizingSequence.isPrelocalizingSequence_inf_extraction diff --git a/Mathlib/Probability/Process/PartitionFiltration.lean b/Mathlib/Probability/Process/PartitionFiltration.lean index 1f100fc7eda116..9cc1191e8d798f 100644 --- a/Mathlib/Probability/Process/PartitionFiltration.lean +++ b/Mathlib/Probability/Process/PartitionFiltration.lean @@ -74,7 +74,6 @@ lemma measurable_memPartitionSet_subtype (ht : ∀ n, MeasurableSet (t n)) (n : rcases s with ⟨s, hs⟩ suffices MeasurableSet[partitionFiltration ht n] {x | memPartitionSet t n x = s} by convert! this - ext x simp simp_rw [memPartitionSet_eq_iff _ hs] exact measurableSet_partitionFiltration_of_mem _ _ hs @@ -105,7 +104,7 @@ variable {α : Type*} [MeasurableSpace α] [CountablyGenerated α] /-- A filtration built from the measurable spaces generated by `countablePartition α n` for all `n : ℕ`. -/ -def countableFiltration (α : Type*) [m : MeasurableSpace α] [CountablyGenerated α] : +noncomputable def countableFiltration (α : Type*) [m : MeasurableSpace α] [CountablyGenerated α] : Filtration ℕ m where seq n := generateFrom (countablePartition α n) mono' := monotone_nat_of_le_succ (generateFrom_countablePartition_le_succ _) diff --git a/Mathlib/Probability/Process/Stopping.lean b/Mathlib/Probability/Process/Stopping.lean index 1f84841c8797e3..7bec9d438e03eb 100644 --- a/Mathlib/Probability/Process/Stopping.lean +++ b/Mathlib/Probability/Process/Stopping.lean @@ -93,7 +93,7 @@ theorem IsStoppingTime.measurableSet_lt_of_pred [PredOrder ι] (hτ : IsStopping by_cases hi_min : IsMin i · suffices {ω : Ω | τ ω < i} = ∅ by rw [this]; exact @MeasurableSet.empty _ (f i) ext1 ω - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] rw [isMin_iff_forall_not_lt] at hi_min cases τ ω with | top => simp @@ -121,7 +121,7 @@ protected theorem measurableSet_eq_of_countable_range (hτ : IsStoppingTime f τ (h_countable : (Set.range τ).Countable) (i : ι) : MeasurableSet[f i] {ω | τ ω = i} := by have : {ω | τ ω = i} = {ω | τ ω ≤ i} \ ⋃ (j ∈ Set.range τ) (_ : j < i), {ω | τ ω ≤ j} := by ext1 a - simp only [Set.mem_setOf_eq, Set.mem_range, Set.iUnion_exists, Set.iUnion_iUnion_eq', + simp only [Set.mem_ofPred_eq, Set.mem_range, Set.iUnion_exists, Set.iUnion_iUnion_eq', Set.mem_sdiff, Set.mem_iUnion, exists_prop, not_exists, not_and] constructor <;> intro h · simp only [h, lt_iff_le_not_ge, le_refl, and_imp, imp_self, imp_true_iff, and_self_iff] @@ -154,7 +154,7 @@ protected theorem measurableSet_ge_of_countable_range {ι} [LinearOrder ι] {τ {f : Filtration ι m} (hτ : IsStoppingTime f τ) (h_countable : (Set.range τ).Countable) (i : ι) : MeasurableSet[f i] {ω | i ≤ τ ω} := by have : {ω | i ≤ τ ω} = {ω | τ ω < i}ᶜ := by - ext1 ω; simp only [Set.mem_setOf_eq, Set.mem_compl_iff, not_lt] + ext1 ω; simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, not_lt] rw [this] exact (hτ.measurableSet_lt_of_countable_range h_countable i).compl @@ -174,7 +174,7 @@ variable [LinearOrder ι] {f : Filtration ι m} {τ : Ω → WithTop ι} theorem IsStoppingTime.measurableSet_gt (hτ : IsStoppingTime f τ) (i : ι) : MeasurableSet[f i] {ω | i < τ ω} := by have : {ω | i < τ ω} = {ω | τ ω ≤ i}ᶜ := by - ext1 ω; simp only [Set.mem_setOf_eq, Set.mem_compl_iff, not_le] + ext1 ω; simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, not_le] rw [this] exact (hτ.measurableSet_le i).compl @@ -188,7 +188,7 @@ theorem IsStoppingTime.measurableSet_lt_of_isLUB (hτ : IsStoppingTime f τ) (i by_cases hi_min : IsMin i · suffices {ω | τ ω < i} = ∅ by rw [this]; exact @MeasurableSet.empty _ (f i) ext1 ω - simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] cases τ ω with | top => simp | coe t => norm_cast; exact isMin_iff_forall_not_lt.mp hi_min t @@ -213,7 +213,7 @@ theorem IsStoppingTime.measurableSet_lt_of_isLUB (hτ : IsStoppingTime f τ) (i have h_lt_eq_preimage : {ω | τ ω < i} = τ ⁻¹' Set.Iio i := by ext1 ω; push _ ∈ _; rfl rw [h_lt_eq_preimage, h_Iio_eq_Union] - simp only [Set.preimage_iUnion, Set.preimage_setOf_eq] + simp only [Set.preimage_iUnion, Set.preimage_ofPred_eq] exact MeasurableSet.iUnion fun n => f.mono (h_bound n).le _ (hτ.measurableSet_le (seq n)) theorem IsStoppingTime.measurableSet_lt (hτ : IsStoppingTime f τ) (i : ι) : @@ -231,14 +231,14 @@ theorem IsStoppingTime.measurableSet_lt (hτ : IsStoppingTime f τ) (i : ι) : theorem IsStoppingTime.measurableSet_ge (hτ : IsStoppingTime f τ) (i : ι) : MeasurableSet[f i] {ω | i ≤ τ ω} := by have : {ω | i ≤ τ ω} = {ω | τ ω < i}ᶜ := by - ext1 ω; simp only [Set.mem_setOf_eq, Set.mem_compl_iff, not_lt] + ext1 ω; simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, not_lt] rw [this] exact (hτ.measurableSet_lt i).compl theorem IsStoppingTime.measurableSet_eq (hτ : IsStoppingTime f τ) (i : ι) : MeasurableSet[f i] {ω | τ ω = i} := by have : {ω | τ ω = i} = {ω | τ ω ≤ i} ∩ {ω | τ ω ≥ i} := by - ext1 ω; simp only [Set.mem_setOf_eq, Set.mem_inter_iff, le_antisymm_iff] + ext1 ω; simp only [Set.mem_ofPred_eq, Set.mem_inter_iff, le_antisymm_iff] rw [this] exact (hτ.measurableSet_le i).inter (hτ.measurableSet_ge i) @@ -261,12 +261,12 @@ theorem isStoppingTime_of_measurableSet_eq [Preorder ι] [Countable ι] {f : Fil intro i have h_eq_iUnion : {ω | τ ω ≤ i} = ⋃ k ≤ i, {ω | τ ω = k} := by ext ω - simp only [Set.mem_setOf_eq, Set.mem_iUnion, exists_prop] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion, exists_prop] cases τ ω with | top => simp | coe a => norm_cast; simp rw [h_eq_iUnion] - refine MeasurableSet.biUnion (Set.to_countable _) fun k hk => ?_ + refine MeasurableSet.biUnion (s := {k | k ≤ i}) (Set.to_countable _) fun k hk => ?_ exact f.mono hk _ (hτ k) end Countable @@ -307,7 +307,7 @@ lemma isStoppingTime_of_measurableSet_lt_of_isRightContinuous' [hf : f.IsRightCo -- we write `{τ ≤ t}` as a countable intersection of `{τ < s n}` have h_eq_iInter : {ω | τ ω ≤ t} = ⋂ m, {ω | τ ω < s m} := by ext ω - simp only [Set.mem_setOf_eq, Set.mem_iInter] + simp only [Set.mem_ofPred_eq, Set.mem_iInter] refine ⟨fun h_le m ↦ h_le.trans_lt (mod_cast (hs_gt m)), fun h_lt ↦ ?_⟩ refine le_of_forall_gt fun u hu ↦ ?_ obtain ⟨i, hi⟩ : ∃ i, s i < u := h_exists_lt' u hu @@ -328,7 +328,7 @@ lemma isStoppingTime_of_measurableSet_lt_of_isRightContinuous' [hf : f.IsRightCo intro k have h_eq_k : ⋂ m, {ω | τ ω < s m} = ⋂ (m) (hm : s m ≤ s k), {ω | τ ω < s m} := by ext x - simp only [Set.mem_iInter, Set.mem_setOf_eq] + simp only [Set.mem_iInter, Set.mem_ofPred_eq] refine ⟨fun h m _ ↦ h m, fun h m ↦ ?_⟩ rcases le_total (s m) (s k) with hmk | hkm · exact h m hmk @@ -352,7 +352,7 @@ protected theorem max [LinearOrder ι] {f : Filtration ι m} {τ π : Ω → Wit (hτ : IsStoppingTime f τ) (hπ : IsStoppingTime f π) : IsStoppingTime f fun ω => max (τ ω) (π ω) := by intro i - simp_rw [max_le_iff, Set.setOf_and] + simp_rw [max_le_iff, Set.ofPred_and] exact (hτ i).inter (hπ i) protected theorem max_const [LinearOrder ι] {f : Filtration ι m} {τ : Ω → WithTop ι} @@ -363,7 +363,7 @@ protected theorem min [LinearOrder ι] {f : Filtration ι m} {τ π : Ω → Wit (hτ : IsStoppingTime f τ) (hπ : IsStoppingTime f π) : IsStoppingTime f fun ω => min (τ ω) (π ω) := by intro i - simp_rw [min_le_iff, Set.setOf_or] + simp_rw [min_le_iff, Set.ofPred_or] exact (hτ i).union (hπ i) protected theorem min_const [LinearOrder ι] {f : Filtration ι m} {τ : Ω → WithTop ι} @@ -397,7 +397,7 @@ theorem add_const [AddGroup ι] [Preorder ι] [AddRightMono ι] simp only have h_eq : {ω | τ ω + i ≤ j} = {ω | τ ω ≤ j - i} := by ext ω - simp only [Set.mem_setOf_eq, coe_sub] + simp only [Set.mem_ofPred_eq, coe_sub] cases τ ω with | top => simp | coe a => norm_cast; simp_rw [← le_sub_iff_add_le] @@ -412,7 +412,7 @@ theorem add_const' [Add ι] [LinearOrder ι] [CanonicallyOrderedAdd ι] [Countab intro j have h : {ω | τ ω + i ≤ j} = ⋃ k : {k | k + i ≤ j}, {ω | τ ω = k} := by ext ω - simp only [Set.mem_setOf_eq, Set.mem_iUnion] + simp only [Set.mem_ofPred_eq, Set.mem_iUnion] cases τ ω with | top => simp | coe a => simp; norm_cast @@ -426,7 +426,7 @@ theorem add [Add ι] [LinearOrder ι] [CanonicallyOrderedAdd ι] [Countable ι] intro j have h : {ω | (τ + π) ω ≤ j} = ⋃ k : Set.Iic j, {ω | π ω = k} ∩ {ω | τ ω + k ≤ j} := by ext ω - simp only [Pi.add_apply, Set.mem_setOf_eq, Set.mem_iUnion, Set.mem_inter_iff] + simp only [Pi.add_apply, Set.mem_ofPred_eq, Set.mem_iUnion, Set.mem_inter_iff] cases τ ω with | top => simp | coe a => @@ -471,7 +471,7 @@ theorem measurableSpace_mono (hτ : IsStoppingTime f τ) (hπ : IsStoppingTime f rw [(_ : s ∩ {ω | π ω ≤ i} = s ∩ {ω | τ ω ≤ i} ∩ {ω | π ω ≤ i})] · exact (hs.2 i).inter (hπ i) · ext - simp only [Set.mem_inter_iff, iff_self_and, and_congr_left_iff, Set.mem_setOf_eq] + simp only [Set.mem_inter_iff, iff_self_and, and_congr_left_iff, Set.mem_ofPred_eq] intro hle' _ exact le_trans (hle _) hle' @@ -484,14 +484,14 @@ theorem measurableSpace_const (f : Filtration ι m) (i : ι) : rw [IsStoppingTime.measurableSet] constructor <;> intro h · have h' := h.2 i - simpa only [le_refl, Set.setOf_true, Set.inter_univ] using h' + simpa only [le_refl, Set.ofPred_true, Set.inter_univ] using h' · refine ⟨f.le i _ h, fun j ↦ ?_⟩ by_cases hij : i ≤ j · norm_cast - simp only [hij, Set.setOf_true, Set.inter_univ] + simp only [hij, Set.ofPred_true, Set.inter_univ] exact f.mono hij _ h · norm_cast - simp only [hij, Set.setOf_false, Set.inter_empty, @MeasurableSet.empty _ (f.1 j)] + simp only [hij, Set.ofPred_false, Set.inter_empty, @MeasurableSet.empty _ (f.1 j)] theorem measurableSet_inter_eq_iff (hτ : IsStoppingTime f τ) (s : Set Ω) (i : ι) : MeasurableSet[hτ.measurableSpace] (s ∩ {ω | τ ω = i}) ↔ @@ -499,7 +499,7 @@ theorem measurableSet_inter_eq_iff (hτ : IsStoppingTime f τ) (s : Set Ω) (i : have : ∀ j, {ω : Ω | τ ω = i} ∩ {ω : Ω | τ ω ≤ j} = {ω : Ω | τ ω = i} ∩ {_ω | i ≤ j} := by intro j ext1 ω - simp only [Set.mem_inter_iff, Set.mem_setOf_eq, and_congr_right_iff] + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, and_congr_right_iff] intro hxi rw [hxi] constructor <;> intro h @@ -508,7 +508,7 @@ theorem measurableSet_inter_eq_iff (hτ : IsStoppingTime f τ) (s : Set Ω) (i : rw [Set.inter_assoc, this] by_cases hij : i ≤ j · norm_cast - simp only [hij, Set.setOf_true, Set.inter_univ] + simp only [hij, Set.ofPred_true, Set.inter_univ] exact f.mono hij _ h · simp [hij] @@ -553,7 +553,7 @@ protected theorem measurableSet_le' (hτ : IsStoppingTime f τ) (i : ι) : refine ⟨f.le i _ (hτ i), fun j ↦ ?_⟩ have : {ω : Ω | τ ω ≤ i} ∩ {ω : Ω | τ ω ≤ j} = {ω : Ω | τ ω ≤ min i j} := by ext1 ω - simp [Set.mem_inter_iff, Set.mem_setOf_eq] + simp [Set.mem_inter_iff, Set.mem_ofPred_eq] rw [this] exact f.mono (min_le_right i j) _ (hτ _) @@ -574,7 +574,7 @@ protected theorem measurableSet_ge' [TopologicalSpace ι] [OrderTopology ι] MeasurableSet[hτ.measurableSpace] {ω | i ≤ τ ω} := by have : {ω | i ≤ τ ω} = {ω | τ ω = i} ∪ {ω | i < τ ω} := by ext1 ω - simp only [le_iff_lt_or_eq, Set.mem_setOf_eq, Set.mem_union] + simp only [le_iff_lt_or_eq, Set.mem_ofPred_eq, Set.mem_union] cases τ ω with | top => simp | coe a => @@ -588,7 +588,7 @@ protected theorem measurableSet_lt' [TopologicalSpace ι] [OrderTopology ι] MeasurableSet[hτ.measurableSpace] {ω | τ ω < i} := by have : {ω | τ ω < i} = {ω | τ ω ≤ i} \ {ω | τ ω = i} := by ext1 ω - simp only [lt_iff_le_and_ne, Set.mem_setOf_eq, Set.mem_sdiff] + simp only [lt_iff_le_and_ne, Set.mem_ofPred_eq, Set.mem_sdiff] rw [this] exact (hτ.measurableSet_le' i).diff (hτ.measurableSet_eq' i) @@ -609,7 +609,7 @@ protected theorem measurableSet_ge_of_countable_range' (hτ : IsStoppingTime f MeasurableSet[hτ.measurableSpace] {ω | i ≤ τ ω} := by have : {ω | i ≤ τ ω} = {ω | τ ω = i} ∪ {ω | i < τ ω} := by ext1 ω - simp only [le_iff_lt_or_eq, Set.mem_setOf_eq, Set.mem_union] + simp only [le_iff_lt_or_eq, Set.mem_ofPred_eq, Set.mem_union] cases τ ω with | top => simp | coe a => @@ -627,7 +627,7 @@ protected theorem measurableSet_lt_of_countable_range' (hτ : IsStoppingTime f MeasurableSet[hτ.measurableSpace] {ω | τ ω < i} := by have : {ω | τ ω < i} = {ω | τ ω ≤ i} \ {ω | τ ω = i} := by ext1 ω - simp only [lt_iff_le_and_ne, Set.mem_setOf_eq, Set.mem_sdiff] + simp only [lt_iff_le_and_ne, Set.mem_ofPred_eq, Set.mem_sdiff] rw [this] exact (hτ.measurableSet_le' i).diff (hτ.measurableSet_eq_of_countable_range' h_countable i) @@ -758,7 +758,7 @@ theorem measurableSet_eq_stopping_time_min [TopologicalSpace ι] (hτ : IsStoppingTime f τ) (hπ : IsStoppingTime f π) : MeasurableSet[(hτ.min hπ).measurableSpace] {ω | τ ω = π ω} := by have : {ω | τ ω = π ω} = {ω | τ ω ≤ π ω} ∩ {ω | π ω ≤ τ ω} := by - ext; simp only [Set.mem_setOf_eq, le_antisymm_iff, Set.mem_inter_iff] + ext; simp only [Set.mem_ofPred_eq, le_antisymm_iff, Set.mem_inter_iff] rw [this] refine MeasurableSet.inter (measurableSet_stopping_time_le_min hτ hπ) ?_ convert! (measurableSet_stopping_time_le_min hπ hτ) using 3 @@ -948,7 +948,7 @@ theorem isStronglyProgressive_min_stopping_time [PseudoMetrizableSpace ι] (fun x : s => (x : Set.Iic i × Ω).snd) ⁻¹' {ω | τ ω ≤ min i j} := by ext1 ω simp only [Set.mem_preimage, Set.mem_Iic, coe_min, le_inf_iff, - Set.preimage_setOf_eq, Set.mem_setOf_eq, iff_and_self] + Set.preimage_ofPred_eq, Set.mem_ofPred_eq, iff_and_self] exact fun _ => ω.prop rw [h_set_eq] suffices h_meas : @Measurable _ _ (m_set s) (f i) fun x : s ↦ (x : Set.Iic i × Ω).snd from @@ -969,7 +969,7 @@ theorem isStronglyProgressive_min_stopping_time [PseudoMetrizableSpace ι] norm_cast refine hx_fst_le.trans (le_of_lt ?_) convert! ω.prop - simp only [sc, s, not_le, Set.mem_compl_iff, Set.mem_setOf_eq, ← ht] + simp only [sc, s, not_le, Set.mem_compl_iff, Set.mem_ofPred_eq, ← ht] norm_cast @[deprecated (since := "2026-04-24")] @@ -1027,7 +1027,7 @@ lemma measurableSet_preimage_stoppedValue_inter [PseudoMetrizableSpace β] [Meas (stoppedValue u fun ω => min (τ ω) i) ⁻¹' t ∩ {ω : Ω | τ ω ≤ i} by rw [this]; exact ((h_str_meas i).measurable ht).inter (hτ.measurableSet_le i) ext1 ω - simp only [stoppedValue, Set.mem_inter_iff, Set.mem_preimage, Set.mem_setOf_eq, + simp only [stoppedValue, Set.mem_inter_iff, Set.mem_preimage, Set.mem_ofPred_eq, and_congr_left_iff] intro h rw [min_eq_left h] @@ -1044,8 +1044,8 @@ theorem measurable_stoppedValue [PseudoMetrizableSpace β] [MeasurableSpace β] = (⋃ n, stoppedValue u τ ⁻¹' t ∩ {ω | τ ω ≤ seq n}) ∪ (stoppedValue u τ ⁻¹' t ∩ {ω | τ ω = ⊤}) := by ext1 ω - simp only [Set.mem_preimage, Set.mem_union, Set.mem_iUnion, Set.mem_inter_iff, Set.mem_setOf_eq, - exists_and_left] + simp only [Set.mem_preimage, Set.mem_union, Set.mem_iUnion, Set.mem_inter_iff, + Set.mem_ofPred_eq, exists_and_left] rw [← and_or_left, iff_self_and] intro _ by_cases h : τ ω = ⊤ @@ -1062,7 +1062,7 @@ theorem measurable_stoppedValue [PseudoMetrizableSpace β] [MeasurableSpace β] = (fun ω ↦ u (Classical.arbitrary ι) ω) ⁻¹' t ∩ {ω | τ ω = ⊤} := by ext ω simp only [Set.mem_inter_iff, Set.mem_preimage, stoppedValue, untopA, - Set.mem_setOf_eq, and_congr_left_iff] + Set.mem_ofPred_eq, and_congr_left_iff] intro h simp [h] rw [this] @@ -1087,7 +1087,7 @@ theorem stoppedValue_eq_of_mem_finset [AddCommMonoid E] {s : Finset ι} suffices {i ∈ s | y ∈ {ω : Ω | τ ω = (i : ι)}} = ({(τ y).untopA} : Finset ι) by rw [this, Finset.sum_singleton] ext1 ω - simp only [Set.mem_setOf_eq, Finset.mem_filter, Finset.mem_singleton] + simp only [Set.mem_ofPred_eq, Finset.mem_filter, Finset.mem_singleton] constructor <;> intro h · simp [h.2] · simp only [h] @@ -1117,7 +1117,7 @@ theorem stoppedProcess_eq_of_mem_finset [LinearOrder ι] [AddCommMonoid E] {s : · intro m hm refine Set.indicator_of_notMem ?_ _ rw [Finset.mem_filter] at hm - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] refine (lt_of_lt_of_le ?_ h).ne' exact mod_cast hm.2 · exact h @@ -1127,7 +1127,7 @@ theorem stoppedProcess_eq_of_mem_finset [LinearOrder ι] [AddCommMonoid E] {s : lift τ ω to ι using h_top with i hi rw [Finset.sum_eq_single_of_mem i] · simp only [untopD_coe] - rw [Set.indicator_of_notMem, zero_add, Set.indicator_of_mem] <;> rw [Set.mem_setOf] + rw [Set.indicator_of_notMem, zero_add, Set.indicator_of_mem] <;> rw [Set.mem_ofPred] · exact hi.symm · rw [← hi] exact not_le.2 h @@ -1136,7 +1136,7 @@ theorem stoppedProcess_eq_of_mem_finset [LinearOrder ι] [AddCommMonoid E] {s : exact ⟨hbdd, mod_cast h⟩ · intro b _ hneq rw [Set.indicator_of_notMem] - rw [Set.mem_setOf, ← hi] + rw [Set.mem_ofPred, ← hi] exact mod_cast hneq.symm theorem stoppedProcess_eq'' [LinearOrder ι] [LocallyFiniteOrderBot ι] [AddCommMonoid E] (n : ι) : @@ -1299,7 +1299,7 @@ theorem stoppedValue_sub_eq_sum' [AddCommGroup β] (hle : τ ≤ π) {N : ℕ} ( simp only [Finset.sum_apply, Finset.sum_indicator_eq_sum_filter] refine Finset.sum_congr ?_ fun _ _ => rfl ext i - simp only [Finset.mem_filter, Set.mem_setOf_eq, Finset.mem_range, Finset.mem_Ico] + simp only [Finset.mem_filter, Set.mem_ofPred_eq, Finset.mem_range, Finset.mem_Ico] specialize hbdd ω lift τ ω to ℕ using hτ_top ω with t ht lift π ω to ℕ using hπ_top ω with b hb @@ -1337,15 +1337,15 @@ theorem stoppedProcess_eq' (n : ℕ) : stoppedProcess u τ n = Set.indicator {a · simp_rw [@eq_comm _ _ (n : WithTop ℕ), @le_iff_eq_or_lt _ _ (n : WithTop ℕ)] have : {a | ↑n + 1 ≤ τ a} = {a | ↑n < τ a} := by ext ω - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] cases τ ω with | top => simp | coe t => simp only [Nat.cast_lt] norm_cast - rw [this, Set.setOf_or] + rw [this, Set.ofPred_or] · rintro ⟨h₁, h₂⟩ - rw [Set.mem_setOf] at h₁ h₂ + rw [Set.mem_ofPred] at h₁ h₂ rw [h₁] at h₂ norm_cast at h₂ grind @@ -1368,7 +1368,7 @@ theorem IsStoppingTime.piecewise_of_le (hτ_st : IsStoppingTime 𝒢 τ) (hη_st intro n have : {ω | s.piecewise τ η ω ≤ n} = s ∩ {ω | τ ω ≤ n} ∪ sᶜ ∩ {ω | η ω ≤ n} := by ext1 ω - simp only [Set.piecewise, Set.mem_setOf_eq] + simp only [Set.piecewise, Set.mem_ofPred_eq] by_cases hx : ω ∈ s <;> simp [hx] rw [this] by_cases hin : i ≤ n diff --git a/Mathlib/Probability/StrongLaw.lean b/Mathlib/Probability/StrongLaw.lean index bd87fe5c9227cb..74fe6148a66f51 100644 --- a/Mathlib/Probability/StrongLaw.lean +++ b/Mathlib/Probability/StrongLaw.lean @@ -301,7 +301,7 @@ theorem tsum_prob_mem_Ioi_lt_top {X : Ω → ℝ} (hint : Integrable X) (hnonneg obtain ⟨N, hN⟩ : ∃ N : ℕ, X ω ≤ N := exists_nat_ge (X ω) exact Set.mem_iUnion.2 ⟨N, hω, hN⟩ · simp +contextual only [Set.mem_Ioc, Set.mem_Ioi, - Set.iUnion_subset_iff, Set.setOf_subset_setOf, imp_true_iff] + Set.iUnion_subset_iff, Set.ofPred_subset_ofPred, imp_true_iff] rw [this] apply tendsto_measure_iUnion_atTop intro m n hmn x hx diff --git a/Mathlib/RepresentationTheory/Invariants.lean b/Mathlib/RepresentationTheory/Invariants.lean index a93460d67982c7..fb4593f3f0bf79 100644 --- a/Mathlib/RepresentationTheory/Invariants.lean +++ b/Mathlib/RepresentationTheory/Invariants.lean @@ -72,7 +72,7 @@ variable (ρ : Representation k G V) (σ : Representation k G W) /-- The subspace of invariants, consisting of the vectors fixed by all elements of `G`. -/ def invariants : Submodule k V where - carrier := setOf fun v => ∀ g : G, ρ g v = v + carrier := Set.ofPred fun v => ∀ g : G, ρ g v = v zero_mem' g := by simp only [map_zero] add_mem' hv hw g := by simp only [hv g, hw g, map_add] smul_mem' r v hv g := by simp only [hv g, map_smulₛₗ, RingHom.id_apply] diff --git a/Mathlib/RingTheory/Algebraic/Cardinality.lean b/Mathlib/RingTheory/Algebraic/Cardinality.lean index 7e45d940cdf87c..cc0e611901c515 100644 --- a/Mathlib/RingTheory/Algebraic/Cardinality.lean +++ b/Mathlib/RingTheory/Algebraic/Cardinality.lean @@ -40,7 +40,7 @@ theorem lift_cardinalMk_le_sigma_polynomial : ← Polynomial.aeval_def, p.2.2]⟩) fun x y => by intro h - simp only [Set.coe_setOf, ne_eq, Set.mem_setOf_eq, Sigma.mk.inj_iff] at h + simp only [Set.coe_ofPred, ne_eq, Set.mem_ofPred_eq, Sigma.mk.inj_iff] at h refine (Subtype.heq_iff_coe_eq ?_).1 h.2 simp only [h.1, forall_true_iff] rwa [lift_umax, lift_id'.{v}] at this diff --git a/Mathlib/RingTheory/AlgebraicIndependent/TranscendenceBasis.lean b/Mathlib/RingTheory/AlgebraicIndependent/TranscendenceBasis.lean index eb4677becdaabe..9072dca12c18d1 100644 --- a/Mathlib/RingTheory/AlgebraicIndependent/TranscendenceBasis.lean +++ b/Mathlib/RingTheory/AlgebraicIndependent/TranscendenceBasis.lean @@ -333,8 +333,8 @@ theorem isAlgebraic_adjoin_iff_of_matroid_isBasis [NoZeroDivisors A] {s t : Set theorem matroid_closure_eq [IsDomain A] {s : Set A} : (matroid R A).closure s = algebraicClosure (adjoin R s) A := by have ⟨B, hB⟩ := (matroid R A).exists_isBasis s - simp_rw [← hB.closure_eq_closure, hB.1.1.1.closure_eq_setOf_isBasis_insert, Set.ext_iff, - mem_setOf, matroid_isBasis_iff, ← matroid_indep_iff, hB.1.1.1, subset_insert, true_and, + simp_rw [← hB.closure_eq_closure, hB.1.1.1.closure_eq_setOfPred_isBasis_insert, Set.ext_iff, + mem_ofPred, matroid_isBasis_iff, ← matroid_indep_iff, hB.1.1.1, subset_insert, true_and, SetLike.mem_coe, mem_algebraicClosure, ← isAlgebraic_adjoin_iff_of_matroid_isBasis hB, forall_mem_insert] exact fun _ ↦ and_iff_left fun x hx ↦ isAlgebraic_algebraMap (⟨x, subset_adjoin hx⟩ : adjoin R B) diff --git a/Mathlib/RingTheory/AlgebraicIndependent/Transcendental.lean b/Mathlib/RingTheory/AlgebraicIndependent/Transcendental.lean index be4a6f564aec3b..fab830bbc6ae3d 100644 --- a/Mathlib/RingTheory/AlgebraicIndependent/Transcendental.lean +++ b/Mathlib/RingTheory/AlgebraicIndependent/Transcendental.lean @@ -188,15 +188,20 @@ theorem iff_adjoin_image (s : Set ι) : classical apply algebraicIndependent_equiv' ((Equiv.sumComm ..).trans (Equiv.Set.sumCompl ..)) ext (_ | _) <;> rfl +set_option maxHeartbeats 800000 in +-- The `convert!` needs to see through heavy `Set`/subtype defeq since `Set` became a structure. theorem iff_adjoin_image_compl (s : Set ι) : AlgebraicIndependent R x ↔ AlgebraicIndependent R (fun i : ↥sᶜ ↦ x i) ∧ AlgebraicIndepOn (adjoin R (x '' sᶜ)) x s := by convert! ← iff_adjoin_image _; apply compl_compl +set_option maxHeartbeats 800000 in +-- The `and_congr_right` needs to see through heavy `Set`/subtype defeq since `Set` became a +-- structure. theorem iff_transcendental_adjoin_image (i : ι) : AlgebraicIndependent R x ↔ AlgebraicIndependent R (fun j : {j // j ≠ i} ↦ x j) ∧ Transcendental (adjoin R (x '' {i}ᶜ)) (x i) := - (iff_adjoin_image_compl _).trans <| and_congr_right + (iff_adjoin_image_compl {i}).trans <| and_congr_right fun _ ↦ algebraicIndependent_unique_type_iff (ι := {j // j = i}) variable (hx : AlgebraicIndependent R x) diff --git a/Mathlib/RingTheory/Artinian/Module.lean b/Mathlib/RingTheory/Artinian/Module.lean index 87ce8600bf7547..0d81e1186b9071 100644 --- a/Mathlib/RingTheory/Artinian/Module.lean +++ b/Mathlib/RingTheory/Artinian/Module.lean @@ -514,14 +514,16 @@ section CommSemiring variable (R : Type*) [CommSemiring R] [IsArtinianRing R] @[stacks 00J7] -lemma setOf_isMaximal_finite : {I : Ideal R | I.IsMaximal}.Finite := by +lemma setOfPred_isMaximal_finite : {I : Ideal R | I.IsMaximal}.Finite := by have ⟨s, H⟩ := Finset.exists_inf_le (Subtype.val (p := fun I : Ideal R ↦ I.IsMaximal)) refine Set.finite_def.2 ⟨s, fun p ↦ ?_⟩ have ⟨q, hq1, hq2⟩ := p.2.isPrime.inf_le'.mp (H p) rwa [← Subtype.ext <| q.2.eq_of_le p.2.ne_top hq2] +@[deprecated (since := "2026-07-09")] alias setOf_isMaximal_finite := setOfPred_isMaximal_finite + instance : Finite (MaximalSpectrum R) := - haveI : Finite {I : Ideal R // I.IsMaximal} := (setOf_isMaximal_finite R).to_subtype + haveI : Finite {I : Ideal R // I.IsMaximal} := (setOfPred_isMaximal_finite R).to_subtype .of_equiv _ (MaximalSpectrum.equivSubtype _).symm end CommSemiring @@ -588,11 +590,13 @@ theorem nilradical_pow_eq_iInf (n : ℕ) : theorem nilradical_eq_iInf : nilradical R = iInf MaximalSpectrum.asIdeal := by simpa using nilradical_pow_eq_iInf R 1 -lemma setOf_isPrime_finite : {I : Ideal R | I.IsPrime}.Finite := by - simpa only [isPrime_iff_isMaximal] using setOf_isMaximal_finite R +lemma setOfPred_isPrime_finite : {I : Ideal R | I.IsPrime}.Finite := by + simpa only [isPrime_iff_isMaximal] using setOfPred_isMaximal_finite R + +@[deprecated (since := "2026-07-09")] alias setOf_isPrime_finite := setOfPred_isPrime_finite instance : Finite (PrimeSpectrum R) := - haveI : Finite {I : Ideal R // I.IsPrime} := (setOf_isPrime_finite R).to_subtype + haveI : Finite {I : Ideal R // I.IsPrime} := (setOfPred_isPrime_finite R).to_subtype .of_equiv _ (PrimeSpectrum.equivSubtype _).symm.toEquiv /-- A temporary field instance on the quotients by maximal ideals. -/ diff --git a/Mathlib/RingTheory/Coalgebra/GroupLike.lean b/Mathlib/RingTheory/Coalgebra/GroupLike.lean index d93f5915453b62..9c9cff4f1172ff 100644 --- a/Mathlib/RingTheory/Coalgebra/GroupLike.lean +++ b/Mathlib/RingTheory/Coalgebra/GroupLike.lean @@ -112,7 +112,7 @@ lemma linearIndepOn_isGroupLikeElem : LinearIndepOn R id {a : A | IsGroupLikeEle -- Let's deal with the `s ∪ {a}` case. | cons a s has ih => simp only [Finset.cons_eq_insert, Finset.coe_insert, Set.subset_def, Set.mem_insert_iff, - Finset.mem_coe, Set.mem_setOf_eq, forall_eq_or_imp] at hs + Finset.mem_coe, Set.mem_ofPred_eq, forall_eq_or_imp] at hs obtain ⟨ha, hs⟩ := hs specialize ih hs -- Assume that there is some `c : A → R` and `d : R` such that `∑ x ∈ s, c x • x = d • a`. diff --git a/Mathlib/RingTheory/DedekindDomain/Factorization.lean b/Mathlib/RingTheory/DedekindDomain/Factorization.lean index c25fa26cb9ebc7..c5491f95e87b57 100644 --- a/Mathlib/RingTheory/DedekindDomain/Factorization.lean +++ b/Mathlib/RingTheory/DedekindDomain/Factorization.lean @@ -84,7 +84,7 @@ theorem IsDedekindDomain.HeightOneSpectrum.maxPowDividing_eq_pow_multiset_count /-- Only finitely many maximal ideals of `R` divide a given nonzero ideal. -/ theorem Ideal.finite_factors {I : Ideal R} (hI : I ≠ 0) : {v : HeightOneSpectrum R | v.asIdeal ∣ I}.Finite := by - rw [← Set.finite_coe_iff, Set.coe_setOf] + rw [← Set.finite_coe_iff, Set.coe_ofPred] haveI h_fin := fintypeSubtypeDvd I hI refine Finite.of_injective (fun v => (⟨(v : HeightOneSpectrum R).asIdeal, v.2⟩ : { x // x ∣ I })) ?_ @@ -502,7 +502,7 @@ theorem count_maximal (w : HeightOneSpectrum R) [Decidable (w = v)] : theorem count_finprod_coprime (exps : HeightOneSpectrum R → ℤ) : count K v (∏ᶠ (w : HeightOneSpectrum R) (_ : w ≠ v), (w.asIdeal : (FractionalIdeal R⁰ K)) ^ exps w) = 0 := by - apply finprod_mem_induction fun I => count K v I = 0 + apply finprod_mem_induction (s := {w | w ≠ v}) fun I => count K v I = 0 · exact count_one K v · intro I I' hI hI' classical @@ -583,11 +583,11 @@ theorem finite_factors' {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) {a : R} intro v hv have hv_irred : Irreducible v.asIdeal := v.irreducible by_contra h_notMem - rw [mem_union, mem_setOf_eq, mem_setOf_eq] at h_notMem + rw [mem_union, mem_ofPred_eq, mem_ofPred_eq] at h_notMem push Not at h_notMem rw [← Associates.count_ne_zero_iff_dvd ha_ne_zero hv_irred, not_not, ← Associates.count_ne_zero_iff_dvd hJ_ne_zero hv_irred, not_not] at h_notMem - rw [mem_setOf_eq, h_notMem.1, h_notMem.2, sub_self] at hv + rw [mem_ofPred_eq, h_notMem.1, h_notMem.2, sub_self] at hv exact hv (Eq.refl 0) exact Finite.subset (Finite.union (Ideal.finite_factors (ideal_factor_ne_zero hI haJ)) (Ideal.finite_factors (constant_factor_ne_zero hI haJ))) h_subset @@ -597,7 +597,7 @@ open Classical in theorem finite_factors (I : FractionalIdeal R⁰ K) : ∀ᶠ v : HeightOneSpectrum R in Filter.cofinite, count K v I = 0 := by by_cases hI : I = 0 - · simp only [hI, count_zero, Filter.eventually_cofinite, not_true_eq_false, setOf_false, + · simp only [hI, count_zero, Filter.eventually_cofinite, not_true_eq_false, ofPred_false, finite_empty] · convert! finite_factors' hI (choose_spec (choose_spec (exists_eq_spanSingleton_mul I))).2 rw [count_ne_zero K _ hI] diff --git a/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean b/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean index ff857b8f025943..0cda4b73f6bdbb 100644 --- a/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean +++ b/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean @@ -57,7 +57,7 @@ lemma HeightOneSpectrum.Support.finite (k : K) : (Support R k).Finite := by intro v hv apply_fun v.valuation K at hk simp only [Valuation.map_mul, valuation_of_algebraMap] at hk - rw [Set.mem_setOf_eq, valuation_of_algebraMap] + rw [Set.mem_ofPred_eq, valuation_of_algebraMap] have := intValuation_le_one v n contrapose! this rw [← hk, mul_comm] @@ -157,7 +157,7 @@ theorem isUnit_iff {a : FiniteAdeleRing R K} : IsUnit a ↔ (∀ v, a v ≠ 0) ∧ ∀ᶠ v in Filter.cofinite, Valued.v (a v) = 1 := by rw [RestrictedProduct.isUnit_iff] simp only [isUnit_iff_ne_zero, adicCompletionIntegers.isUnit_iff_valued_eq_one, exists_prop, - Filter.eventually_cofinite, not_and_or, Set.setOf_or] + Filter.eventually_cofinite, not_and_or, Set.ofPred_or] simpa using! fun _ _ ↦ a.2 theorem unitsEquiv_finite_valued_eq_one (a : (FiniteAdeleRing R K)ˣ) : diff --git a/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean b/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean index 7a1360a71b601b..2cbb1b3f70a926 100644 --- a/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean +++ b/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean @@ -155,7 +155,7 @@ open UniqueFactorizationMonoid in theorem mem_primesOver_iff_mem_normalizedFactors {p : Ideal R} [h : p.IsMaximal] [Algebra R A] [IsDomain R] [IsTorsionFree R A] (hp : p ≠ ⊥) {P : Ideal A} : P ∈ p.primesOver A ↔ P ∈ normalizedFactors (map (algebraMap R A) p) := by - rw [primesOver, Set.mem_setOf_eq, mem_normalizedFactors_iff (map_ne_bot_of_ne_bot hp), + rw [primesOver, Set.mem_ofPred_eq, mem_normalizedFactors_iff (map_ne_bot_of_ne_bot hp), liesOver_iff, under_def, and_congr_right_iff, map_le_iff_le_comap] intro hP refine ⟨fun h ↦ le_of_eq h, fun h' ↦ ((IsCoatom.le_iff_eq (isMaximal_def.mp h) ?_).mp h').symm⟩ @@ -1201,7 +1201,8 @@ of the maximal ideal `p` in `B` and the primes over `p` in `B`. -/ noncomputable def equivPrimesOver (hp : p ≠ 0) : {v : HeightOneSpectrum B // v.asIdeal ∣ map (algebraMap A B) p} ≃ p.primesOver B := - Set.BijOn.equiv HeightOneSpectrum.asIdeal + Set.BijOn.equiv (s := {v : HeightOneSpectrum B | v.asIdeal ∣ map (algebraMap A B) p}) + (t := ↑(p.primesOver B)) HeightOneSpectrum.asIdeal ⟨fun v hv ↦ ⟨v.isPrime, by rwa [liesOver_iff_dvd_map v.isPrime.ne_top]⟩, fun _ _ _ _ h ↦ HeightOneSpectrum.ext_iff.mpr h, fun Q hQ ↦ ⟨⟨Q, hQ.1, ne_bot_of_mem_primesOver hp hQ⟩, diff --git a/Mathlib/RingTheory/DedekindDomain/PID.lean b/Mathlib/RingTheory/DedekindDomain/PID.lean index 6472035ba9635f..e0633b5a8abb24 100644 --- a/Mathlib/RingTheory/DedekindDomain/PID.lean +++ b/Mathlib/RingTheory/DedekindDomain/PID.lean @@ -233,7 +233,7 @@ theorem IsDedekindDomain.isPrincipalIdealRing_localization_over_prime [IsDomain (Set.Finite.ofFinset {P ∈ {⊥} ∪ (normalizedFactors (Ideal.map (algebraMap R Sₚ) p)).toFinset | P.IsPrime} fun P => ?_) - rw [Finset.mem_filter, Finset.mem_union, Finset.mem_singleton, Set.mem_setOf, + rw [Finset.mem_filter, Finset.mem_union, Finset.mem_singleton, Set.mem_ofPred, Multiset.mem_toFinset] exact and_iff_right_of_imp fun hP => diff --git a/Mathlib/RingTheory/DedekindDomain/SInteger.lean b/Mathlib/RingTheory/DedekindDomain/SInteger.lean index 49e3eb3a80843b..290106f1f1d86c 100644 --- a/Mathlib/RingTheory/DedekindDomain/SInteger.lean +++ b/Mathlib/RingTheory/DedekindDomain/SInteger.lean @@ -109,7 +109,7 @@ def unit : Subgroup Kˣ := (⨅ (v) (_ : v ∉ S), (v.valuation K).valuationSubring.unitGroup).copy {x : Kˣ | ∀ (v) (_ : v ∉ S), (v : HeightOneSpectrum R).valuation K x = 1} <| Set.ext fun _ => by - simp only [mem_setOf, SetLike.mem_coe, Subgroup.mem_iInf, Valuation.mem_unitGroup_iff] + simp only [mem_ofPred, SetLike.mem_coe, Subgroup.mem_iInf, Valuation.mem_unitGroup_iff] theorem unit_eq : S.unit K = ⨅ (v) (_ : v ∉ S), (v.valuation K).valuationSubring.unitGroup := diff --git a/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean b/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean index cf440202db633a..a6d4ea2c6ffcf1 100644 --- a/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean +++ b/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean @@ -664,16 +664,19 @@ variable {K Γ₀ O : Type*} [Field K] [LinearOrderedCommGroupWithZero Γ₀] [C [Algebra O K] {v : Valuation K Γ₀} (hv : v.Integers O) include hv -lemma maximalIdeal_eq_setOf_le_v_algebraMap : +lemma maximalIdeal_eq_setOfPred_le_v_algebraMap : letI : IsDomain O := hv.hom_inj.isDomain ∀ [IsDiscreteValuationRing O] {ϖ : O} (_h : Irreducible ϖ), (IsLocalRing.maximalIdeal O : Set O) = {y : O | v (algebraMap O K y) ≤ v (algebraMap O K ϖ)} := by letI : IsDomain O := hv.hom_inj.isDomain intro _ _ h - rw [← hv.coe_span_singleton_eq_setOf_le_v_algebraMap, ← h.maximalIdeal_eq] + rw [← hv.coe_span_singleton_eq_setOfPred_le_v_algebraMap, ← h.maximalIdeal_eq] -lemma maximalIdeal_pow_eq_setOf_le_v_algebraMap_pow : +@[deprecated (since := "2026-07-09")] +alias maximalIdeal_eq_setOf_le_v_algebraMap := maximalIdeal_eq_setOfPred_le_v_algebraMap + +lemma maximalIdeal_pow_eq_setOfPred_le_v_algebraMap_pow : letI : IsDomain O := hv.hom_inj.isDomain ∀ [IsDiscreteValuationRing O] {ϖ : O} (_h : Irreducible ϖ) (n : ℕ), ((IsLocalRing.maximalIdeal O ^ n : Ideal O) : Set O) = @@ -681,24 +684,36 @@ lemma maximalIdeal_pow_eq_setOf_le_v_algebraMap_pow : letI : IsDomain O := hv.hom_inj.isDomain intro _ ϖ h n have : (v (algebraMap O K ϖ)) ^ n = v (algebraMap O K (ϖ ^ n)) := by simp - rw [this, ← hv.coe_span_singleton_eq_setOf_le_v_algebraMap, + rw [this, ← hv.coe_span_singleton_eq_setOfPred_le_v_algebraMap, ← Ideal.span_singleton_pow, ← h.maximalIdeal_eq] +@[deprecated (since := "2026-07-09")] +alias maximalIdeal_pow_eq_setOf_le_v_algebraMap_pow := + maximalIdeal_pow_eq_setOfPred_le_v_algebraMap_pow + end Valuation.Integers section Valuation.integer variable {K Γ₀ : Type*} [Field K] [LinearOrderedCommGroupWithZero Γ₀] (v : Valuation K Γ₀) -lemma _root_.Irreducible.maximalIdeal_eq_setOf_le_v_coe +lemma _root_.Irreducible.maximalIdeal_eq_setOfPred_le_v_coe [IsDiscreteValuationRing v.integer] {ϖ : v.integer} (h : Irreducible ϖ) : (IsLocalRing.maximalIdeal v.integer : Set v.integer) = {y : v.integer | v y ≤ v ϖ} := - (Valuation.integer.integers v).maximalIdeal_eq_setOf_le_v_algebraMap h + (Valuation.integer.integers v).maximalIdeal_eq_setOfPred_le_v_algebraMap h -lemma _root_.Irreducible.maximalIdeal_pow_eq_setOf_le_v_coe_pow +@[deprecated (since := "2026-07-09")] +alias _root_.Irreducible.maximalIdeal_eq_setOf_le_v_coe := + _root_.Irreducible.maximalIdeal_eq_setOfPred_le_v_coe + +lemma _root_.Irreducible.maximalIdeal_pow_eq_setOfPred_le_v_coe_pow [IsDiscreteValuationRing v.integer] {ϖ : v.integer} (h : Irreducible ϖ) (n : ℕ) : ((IsLocalRing.maximalIdeal v.integer ^ n : Ideal v.integer) : Set v.integer) = {y : v.integer | v y ≤ v (ϖ : K) ^ n} := - (Valuation.integer.integers v).maximalIdeal_pow_eq_setOf_le_v_algebraMap_pow h _ + (Valuation.integer.integers v).maximalIdeal_pow_eq_setOfPred_le_v_algebraMap_pow h _ + +@[deprecated (since := "2026-07-09")] +alias _root_.Irreducible.maximalIdeal_pow_eq_setOf_le_v_coe_pow := + _root_.Irreducible.maximalIdeal_pow_eq_setOfPred_le_v_coe_pow end Valuation.integer diff --git a/Mathlib/RingTheory/DividedPowers/DPMorphism.lean b/Mathlib/RingTheory/DividedPowers/DPMorphism.lean index e09c1922e5521e..b232b405165571 100644 --- a/Mathlib/RingTheory/DividedPowers/DPMorphism.lean +++ b/Mathlib/RingTheory/DividedPowers/DPMorphism.lean @@ -139,7 +139,7 @@ set_option linter.style.whitespace false in -- manual alignment is not recognise def _root_.DividedPowers.ideal_from_ringHom {f : A →+* B} (hf : I.map f ≤ J) : Ideal A where carrier := {x ∈ I | ∀ n : ℕ, f (hI.dpow n (x : A)) = hJ.dpow n (f (x : A))} add_mem' := fun hx hy ↦ by - simp only [mem_setOf_eq, map_add] at hx hy ⊢ + simp only [mem_ofPred_eq, map_add] at hx hy ⊢ refine ⟨I.add_mem hx.1 hy.1, fun n ↦ ?_⟩ rw [hI.dpow_add hx.1 hy.1, map_sum, hJ.dpow_add (hf (mem_map_of_mem f hx.1)) (hf (mem_map_of_mem f hy.1))] @@ -147,7 +147,7 @@ def _root_.DividedPowers.ideal_from_ringHom {f : A →+* B} (hf : I.map f ≤ J) ext k rw [map_mul, hx.2, hy.2] zero_mem' := by - simp only [mem_setOf_eq, Submodule.zero_mem, map_zero, true_and] + simp only [mem_ofPred_eq, Submodule.zero_mem, map_zero, true_and] intro n induction n with | zero => rw [hI.dpow_zero I.zero_mem, hJ.dpow_zero J.zero_mem, map_one] diff --git a/Mathlib/RingTheory/DividedPowers/Padic.lean b/Mathlib/RingTheory/DividedPowers/Padic.lean index 3c5c3bd9f30b60..5e75b45d37f460 100644 --- a/Mathlib/RingTheory/DividedPowers/Padic.lean +++ b/Mathlib/RingTheory/DividedPowers/Padic.lean @@ -140,7 +140,7 @@ set_option backward.privateInPublic.warn false in noncomputable def dividedPowers : DividedPowers (Ideal.span {(p : ℤ_[p])}) := by classical refine ofInjective (Ideal.span {(p : ℤ_[p])}) (⊤) - PadicInt.Coe.ringHom ((Set.injective_codRestrict Subtype.property).mp fun ⦃a₁ a₂⦄ a ↦ a) + PadicInt.Coe.ringHom ((subring p).subtype_injective) (RatAlgebra.dividedPowers (⊤ : Ideal ℚ_[p])) ?_ ?_ · rw [Ideal.map_span, Set.image_singleton, map_natCast] simp only [Ideal.span_singleton_eq_top, isUnit_iff_ne_zero, ne_eq, cast_eq_zero] @@ -158,7 +158,7 @@ private lemma dividedPowers_eq (n : ℕ) (x : ℤ_[p]) : simp only [dividedPowers, ofInjective] split_ifs with hx · have hinj : Injective (PadicInt.Coe.ringHom (p := p)) := - (Set.injective_codRestrict Subtype.property).mp fun ⦃a₁ a₂⦄ a ↦ a + (subring p).subtype_injective have heq : Coe.ringHom ⟨dpow' p n x, dpow'_int p n hx⟩ = inverse (n ! : ℚ_[p]) * Coe.ringHom x ^ n := by simp [dpow', inverse_eq_inv', Coe.ringHom_apply] diff --git a/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean b/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean index 5b6ff9563584bf..6d48886917c720 100644 --- a/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean +++ b/Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean @@ -429,7 +429,7 @@ theorem span_carrier_eq_dpow_span {S : Set A} (hS : S ⊆ I) : · rw [le_iInf₂_iff] intro K hK have : S ≤ K := by - simp only [Set.mem_insert_iff, Set.mem_setOf_eq] at hK + simp only [Set.mem_insert_iff, Set.mem_ofPred_eq] at hK rcases hK with rfl | hKS exacts [hS, hKS] rw [span_le] @@ -492,7 +492,7 @@ def dpEqualizer : Ideal A where theorem mem_dpEqualizer_iff {x : A} : x ∈ dpEqualizer hI hI' ↔ x ∈ I ∧ ∀ n : ℕ, hI.dpow n x = hI'.dpow n x := by simp [dpEqualizer, Submodule.mem_mk, AddSubmonoid.mem_mk, AddSubsemigroup.mem_mk, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] theorem dpEqualizer_is_dp_ideal_left : DividedPowers.IsSubDPIdeal hI (dpEqualizer hI hI') := diff --git a/Mathlib/RingTheory/Extension/Generators.lean b/Mathlib/RingTheory/Extension/Generators.lean index 5c03910ea8864e..b902e074bf14c8 100644 --- a/Mathlib/RingTheory/Extension/Generators.lean +++ b/Mathlib/RingTheory/Extension/Generators.lean @@ -162,7 +162,7 @@ noncomputable def ofSet {s : Set S} (hs : Algebra.adjoin R s = ⊤) : Generators R S s := by refine ofSurjective (Subtype.val : s → S) ?_ rwa [← AlgHom.range_eq_top, ← Algebra.adjoin_range_eq_range_aeval, - Subtype.range_coe_subtype, Set.setOf_mem_eq] + Subtype.range_coe_subtype, Set.ofPred_mem_eq] variable (R S) in /-- The `Generators` containing the whole algebra, which induces the canonical map `R[S] → S`. -/ diff --git a/Mathlib/RingTheory/Extension/Presentation/Core.lean b/Mathlib/RingTheory/Extension/Presentation/Core.lean index 14d4919f4ff948..a5d109562461e1 100644 --- a/Mathlib/RingTheory/Extension/Presentation/Core.lean +++ b/Mathlib/RingTheory/Extension/Presentation/Core.lean @@ -34,7 +34,7 @@ namespace Algebra.Presentation variable (P) in /-- The coefficients of a presentation are the coefficients of the relations. -/ -def coeffs : Set R := ⋃ (i : σ), (P.relation i).coeffs +noncomputable def coeffs : Set R := ⋃ (i : σ), (P.relation i).coeffs lemma coeffs_relation_subset_coeffs (x : σ) : ((P.relation x).coeffs : Set R) ⊆ P.coeffs := @@ -44,8 +44,9 @@ lemma finite_coeffs [Finite σ] : P.coeffs.Finite := Set.finite_iUnion fun _ ↦ Finset.finite_toSet _ variable (P) in -/-- The core of a presentation is the subalgebra generated by the coefficients of the relations. -/ -def core : Subalgebra ℤ R := Algebra.adjoin _ P.coeffs +/-- The core of a presentation is the subalgebra generated by the coefficients of the +relations. -/ +noncomputable def core : Subalgebra ℤ R := Algebra.adjoin _ P.coeffs variable (P) in lemma coeffs_subset_core : P.coeffs ⊆ P.core := Algebra.subset_adjoin @@ -56,12 +57,14 @@ lemma coeffs_relation_subset_core (x : σ) : variable (P) in /-- The core coerced to a type for performance reasons. -/ -def Core : Type _ := P.core +noncomputable def Core : Type _ := P.core -instance : CommRing P.Core := fast_instance% (inferInstanceAs <| CommRing P.core) -instance : Algebra P.Core R := fast_instance% (inferInstanceAs <| Algebra P.core R) +noncomputable instance : CommRing P.Core := fast_instance% (inferInstanceAs <| CommRing P.core) +noncomputable instance : Algebra P.Core R := + fast_instance% (inferInstanceAs <| Algebra P.core R) instance : FaithfulSMul P.Core R := inferInstanceAs <| FaithfulSMul P.core R -instance : Algebra P.Core S := fast_instance% (inferInstanceAs <| Algebra P.core S) +noncomputable instance : Algebra P.Core S := + fast_instance% (inferInstanceAs <| Algebra P.core S) instance : IsScalarTower P.Core R S := inferInstanceAs <| IsScalarTower P.core R S instance [Finite σ] : FiniteType ℤ P.Core := .adjoin_of_finite P.finite_coeffs @@ -255,7 +258,7 @@ lemma jacobianRelations_spec [DecidableEq σ] [Fintype σ] : convert! P.exists_sum_eq_σ_jacobian_mul_σ_jacobian_inv_sub_one.choose_spec /-- The set of coefficients that is enough to descend a submersive presentation `P`. -/ -def coeffs : Set R := +noncomputable def coeffs : Set R := P.toPresentation.coeffs ∪ (P.σ (P.jacobian_isUnit.unit⁻¹ :)).coeffs ∪ ⋃ i, (P.jacobianRelations i).coeffs diff --git a/Mathlib/RingTheory/FiniteType.lean b/Mathlib/RingTheory/FiniteType.lean index c31975d59b8c2f..90a90cfde685fd 100644 --- a/Mathlib/RingTheory/FiniteType.lean +++ b/Mathlib/RingTheory/FiniteType.lean @@ -127,7 +127,7 @@ theorem iff_quotient_freeAlgebra : · rintro ⟨s, hs⟩ refine ⟨s, FreeAlgebra.lift _ (↑), ?_⟩ rw [← Set.range_eq_univ, ← AlgHom.coe_range, ← adjoin_range_eq_range_freeAlgebra_lift, - Subtype.range_coe_subtype, Finset.setOf_mem, hs, coe_top] + Subtype.range_coe_subtype, Finset.setOfPred_mem, hs, coe_top] · rintro ⟨s, f, hsur⟩ exact .of_surjective f hsur @@ -140,8 +140,9 @@ theorem iff_quotient_mvPolynomial : · rintro ⟨s, hs⟩ use s, MvPolynomial.aeval (↑) intro x - rw [← Set.mem_range, ← AlgHom.coe_range, ← adjoin_eq_range, SetLike.mem_coe, hs] - apply mem_top + have hx : x ∈ (MvPolynomial.aeval (R := R) ((↑) : (↑s : Set S) → S)).range := by + rw [← adjoin_eq_range, hs]; exact mem_top + exact (AlgHom.mem_range _).1 hx · rintro ⟨s, f, hsur⟩ exact .of_surjective f hsur @@ -191,7 +192,7 @@ theorem isNoetherianRing (R S : Type*) [CommRing R] [CommRing S] [Algebra R S] isNoetherianRing_of_surjective (MvPolynomial s R) S (MvPolynomial.aeval (↑) : MvPolynomial s R →ₐ[R] S).toRingHom rw [← Set.range_eq_univ, AlgHom.toRingHom_eq_coe, RingHom.coe_coe, ← AlgHom.coe_range, - ← Algebra.adjoin_range_eq_range_aeval, Subtype.range_coe_subtype, Finset.setOf_mem, hs] + ← Algebra.adjoin_range_eq_range_aeval, Subtype.range_coe_subtype, Finset.setOfPred_mem, hs] rfl theorem _root_.Subalgebra.fg_iff_finiteType (S : Subalgebra R A) : S.FG ↔ Algebra.FiniteType R S := diff --git a/Mathlib/RingTheory/FractionalIdeal/Basic.lean b/Mathlib/RingTheory/FractionalIdeal/Basic.lean index 25256416bf34ef..49a73ade69fd66 100644 --- a/Mathlib/RingTheory/FractionalIdeal/Basic.lean +++ b/Mathlib/RingTheory/FractionalIdeal/Basic.lean @@ -645,12 +645,12 @@ theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} : · intro hJ refine ⟨⟨⟨⟨{ x : R | algebraMap R P x ∈ J }, ?_⟩, ?_⟩, ?_⟩, ?_⟩ · intro a b ha hb - rw [mem_setOf, map_add] + rw [mem_ofPred, map_add] exact J.val.add_mem ha hb - · rw [mem_setOf, map_zero] + · rw [mem_ofPred, map_zero] exact J.zero_mem · intro c x hx - rw [smul_eq_mul, mem_setOf, map_mul, ← Algebra.smul_def] + rw [smul_eq_mul, mem_ofPred, map_mul, ← Algebra.smul_def] exact J.val.smul_mem c hx · ext x constructor @@ -658,7 +658,7 @@ theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} : rwa [← eq_y] · intro hx obtain ⟨y, rfl⟩ := (mem_one_iff S).mp (hJ hx) - exact mem_setOf.mpr ⟨y, hx, rfl⟩ + exact mem_ofPred.mpr ⟨y, hx, rfl⟩ · rintro ⟨I, hI⟩ rw [← hI] apply coeIdeal_le_one diff --git a/Mathlib/RingTheory/FractionalIdeal/Extended.lean b/Mathlib/RingTheory/FractionalIdeal/Extended.lean index d158d68aa6fd15..bd92d137978c15 100644 --- a/Mathlib/RingTheory/FractionalIdeal/Extended.lean +++ b/Mathlib/RingTheory/FractionalIdeal/Extended.lean @@ -54,7 +54,7 @@ variable (I : FractionalIdeal M K) (J : FractionalIdeal M K) /-- Given commutative rings `A` and `B` with respective localizations `IsLocalization M K` and `IsLocalization N L`, and a ring homomorphism `f : A →+* B` satisfying `M ≤ Submonoid.comap f N`, a fractional ideal `I` of `A` can be extended along `f` to a fractional ideal of `B`. -/ -def extended (I : FractionalIdeal M K) : FractionalIdeal N L where +noncomputable def extended (I : FractionalIdeal M K) : FractionalIdeal N L where val := span B <| (IsLocalization.map (S := K) L f hf) '' I property := by have ⟨a, ha, frac⟩ := I.isFractional @@ -211,7 +211,7 @@ The ring homomorphism version of `FractionalIdeal.extended`. See `FractionalIdeal.extendedHom` for a more convenient version that is often enough. -/ @[simps] -def extendedHom' : FractionalIdeal M K →+* FractionalIdeal N L where +noncomputable def extendedHom' : FractionalIdeal M K →+* FractionalIdeal N L where toFun := extended L hf map_one' := extended_one L hf map_zero' := extended_zero L hf @@ -244,7 +244,7 @@ variable {A K : Type*} (L B : Type*) [CommRing A] [IsDomain A] [CommRing B] [IsD The ring homomorphism that extends a fractional ideal of `A` to a fractional ideal of `B` for an extension of domains `A ⊆ B`. -/ -abbrev extendedHom : FractionalIdeal A⁰ K →+* FractionalIdeal B⁰ L := +noncomputable abbrev extendedHom : FractionalIdeal A⁰ K →+* FractionalIdeal B⁰ L := extendedHom' L <| nonZeroDivisors_le_comap_nonZeroDivisors_of_injective _ (FaithfulSMul.algebraMap_injective _ _) diff --git a/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Ideal.lean b/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Ideal.lean index 6bb4bfed265a05..220615cb608c7e 100644 --- a/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Ideal.lean +++ b/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Ideal.lean @@ -136,7 +136,7 @@ theorem Ideal.isHomogeneous_iff_forall_subset : theorem Ideal.isHomogeneous_iff_subset_iInter : I.IsHomogeneous 𝒜 ↔ (I : Set A) ⊆ ⋂ i, GradedRing.proj 𝒜 i ⁻¹' ↑I := - subset_iInter_iff.symm + (Ideal.isHomogeneous_iff_forall_subset 𝒜 I).trans subset_iInter_iff.symm theorem Ideal.mul_homogeneous_element_mem_of_mem {I : Ideal A} (r x : A) (hx₁ : SetLike.IsHomogeneousElem 𝒜 x) @@ -175,7 +175,7 @@ is the largest homogeneous ideal of `A` contained in `I`. -/ def Ideal.homogeneousCore : HomogeneousIdeal 𝒜 := ⟨Ideal.homogeneousCore' 𝒜 I, Ideal.homogeneous_span _ _ fun _ h => by - have := Subtype.image_preimage_coe (setOf (SetLike.IsHomogeneousElem 𝒜)) (I : Set A) + have := Subtype.image_preimage_coe (Set.ofPred (SetLike.IsHomogeneousElem 𝒜)) (I : Set A) exact (cast congr(_ ∈ $this) h).1⟩ theorem Ideal.homogeneousCore_mono : Monotone (Ideal.homogeneousCore 𝒜) := @@ -456,7 +456,7 @@ theorem Ideal.homogeneousCore'_eq_sSup : have coe_mono : Monotone (toIdeal : HomogeneousIdeal 𝒜 → Ideal A) := fun x y => id convert! coe_mono.map_isGreatest (Ideal.homogeneousCore.gc 𝒜).isGreatest_u using 1 ext x - rw [mem_image, mem_setOf_eq] + rw [mem_image, mem_ofPred_eq] refine ⟨fun hI => ⟨⟨x, hI.1⟩, ⟨hI.2, rfl⟩⟩, ?_⟩ rintro ⟨x, ⟨hx, rfl⟩⟩ exact ⟨x.isHomogeneous, hx⟩ @@ -518,7 +518,7 @@ theorem Ideal.toIdeal_homogeneousHull_eq_iSup : rw [← Ideal.span_iUnion] apply congr_arg Ideal.span _ ext1 - simp only [Set.mem_iUnion, Set.mem_image, mem_setOf_eq, GradedRing.proj_apply, SetLike.exists, + simp only [Set.mem_iUnion, Set.mem_image, mem_ofPred_eq, GradedRing.proj_apply, SetLike.exists, exists_prop, SetLike.mem_coe] theorem Ideal.homogeneousHull_eq_iSup : @@ -608,8 +608,10 @@ lemma irrelevant_eq_iSup : 𝒜₊.toAddSubmonoid = ⨆ i > 0, .ofClass (𝒜 i) open AddSubmonoid Set in lemma irrelevant_eq_closure : 𝒜₊.toAddSubmonoid = .closure (⋃ i > 0, 𝒜 i) := by rw [irrelevant_eq_iSup] - exact le_antisymm (iSup_le fun i ↦ iSup_le fun hi _ hx ↦ subset_closure <| mem_biUnion hi hx) <| - closure_le.mpr <| iUnion_subset fun i ↦ iUnion_subset fun hi ↦ le_biSup (ofClass <| 𝒜 ·) hi + refine le_antisymm + (iSup_le fun i ↦ iSup_le fun hi _ hx ↦ subset_closure <| mem_iUnion₂_of_mem hi hx) <| + closure_le.mpr <| iUnion_subset fun i ↦ iUnion_subset fun hi ↦ + SetLike.coe_subset_coe.mpr <| le_iSup₂ (f := fun i (_ : 0 < i) ↦ ofClass (𝒜 i)) i hi open AddSubmonoid Set in lemma irrelevant_eq_span : 𝒜₊.toIdeal = .span (⋃ i > 0, 𝒜 i) := diff --git a/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Subsemiring.lean b/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Subsemiring.lean index 33415485cbe7b0..a55891cae9ff94 100644 --- a/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Subsemiring.lean +++ b/Mathlib/RingTheory/GradedAlgebra/Homogeneous/Subsemiring.lean @@ -133,7 +133,7 @@ theorem Subsemiring.isHomogeneous_iff_forall_subset : Iff.rfl theorem Subsemiring.isHomogeneous_iff_subset_iInter : - SetLike.IsHomogeneous 𝒜 R ↔ (R : Set A) ⊆ ⋂ i, GradedRing.proj 𝒜 i ⁻¹' R := - subset_iInter_iff.symm + SetLike.IsHomogeneous 𝒜 R ↔ (R : Set A) ⊆ ⋂ i, GradedRing.proj 𝒜 i ⁻¹' R := by + simp [Subsemiring.isHomogeneous_iff_forall_subset] end IsHomogeneousSubsemiringDefs diff --git a/Mathlib/RingTheory/GradedAlgebra/HomogeneousLocalization.lean b/Mathlib/RingTheory/GradedAlgebra/HomogeneousLocalization.lean index 4658ca2c7240e3..09e5048774583b 100644 --- a/Mathlib/RingTheory/GradedAlgebra/HomogeneousLocalization.lean +++ b/Mathlib/RingTheory/GradedAlgebra/HomogeneousLocalization.lean @@ -631,7 +631,7 @@ theorem Away.eventually_smul_mem {m} (hf : f ∈ 𝒜 m) (z : Away 𝒜 f) : obtain ⟨k, hk : f ^ k = _⟩ := z.den_mem apply Filter.mem_of_superset (Filter.Ici_mem_atTop k) rintro k' (hk' : k ≤ k') - simp only [Set.mem_image, SetLike.mem_coe, Set.mem_setOf_eq] + simp only [Set.mem_image, SetLike.mem_coe, Set.mem_ofPred_eq] by_cases hfk : f ^ k = 0 · refine ⟨0, zero_mem _, ?_⟩ rw [← tsub_add_cancel_of_le hk', map_zero, pow_add, hfk, mul_zero, zero_smul] diff --git a/Mathlib/RingTheory/HahnSeries/Lex.lean b/Mathlib/RingTheory/HahnSeries/Lex.lean index bd86c3046f4539..7dfe1432898b2b 100644 --- a/Mathlib/RingTheory/HahnSeries/Lex.lean +++ b/Mathlib/RingTheory/HahnSeries/Lex.lean @@ -57,9 +57,9 @@ instance : LinearOrder (Lex R⟦Γ⟧) where let v := {i : Γ | (ofLex a).coeff i ≠ (ofLex b).coeff i} have hvu : v ⊆ u := by intro i h - rw [Set.mem_union, Set.mem_setOf_eq, Set.mem_setOf_eq] + rw [Set.mem_union, Set.mem_ofPred_eq, Set.mem_ofPred_eq] contrapose! h - rw [Set.notMem_setOf_iff, not_not, h.1, h.2] + rw [Set.notMem_ofPred_iff, not_not, h.1, h.2] have hv : v.IsWF := ((ofLex a).isPWO_support'.isWF.union (ofLex b).isPWO_support'.isWF).subset hvu let i := hv.min hab diff --git a/Mathlib/RingTheory/HahnSeries/Multiplication.lean b/Mathlib/RingTheory/HahnSeries/Multiplication.lean index 035bbf98a04d5b..0e674e1e8edc58 100644 --- a/Mathlib/RingTheory/HahnSeries/Multiplication.lean +++ b/Mathlib/RingTheory/HahnSeries/Multiplication.lean @@ -186,7 +186,7 @@ instance instSMul : SMul R⟦Γ⟧ (HahnModule Γ' R V) where { a : Γ' | (VAddAntidiagonal a (Set.VAddAntidiagonal.finite_of_isPWO x.isPWO_support ((of R).symm y).isPWO_support a)).Nonempty } := by intro a ha - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] contrapose! ha simp [ha] (isPWO_support_vaddAntidiagonal x.isPWO_support ((of R).symm y).isPWO_support).mono h } @@ -346,7 +346,7 @@ theorem support_smul_subset_vadd_support' [MulZeroClass R] [SMulWithZero R V] {x ((of R).symm (x • y)).support ⊆ x.support +ᵥ ((of R).symm y).support := by refine Set.Subset.trans (fun x hx => ?_) (support_vaddAntidiagonal_subset_vadd fun a ↦ Set.VAddAntidiagonal.finite_of_isPWO x.isPWO_support ((of R).symm y).isPWO_support a) - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] contrapose! hx simp [coeff_smul, hx] @@ -682,7 +682,7 @@ def orderTopSubOnePos (Γ R) [LinearOrder Γ] [AddCommMonoid Γ] [IsOrderedCance intro x y hx hy obtain (_ | _) := subsingleton_or_nontrivial R · simp - · simp_all only [Set.mem_setOf_eq, orderTop_self_sub_one_pos_iff] + · simp_all only [Set.mem_ofPred_eq, orderTop_self_sub_one_pos_iff] have h1 : x.val.leadingCoeff * y.val.leadingCoeff = 1 := by rw [hx.2, hy.2, mul_one] constructor · rw [Units.val_mul, orderTop_mul_of_ne_zero (by simp [h1]), hx.1, hy.1, add_zero] diff --git a/Mathlib/RingTheory/HahnSeries/Summable.lean b/Mathlib/RingTheory/HahnSeries/Summable.lean index f33baf323acfe1..c72e95a36fffc4 100644 --- a/Mathlib/RingTheory/HahnSeries/Summable.lean +++ b/Mathlib/RingTheory/HahnSeries/Summable.lean @@ -152,7 +152,7 @@ instance : SMul M (SummableFamily Γ R β) := intro g refine (t.finite_co_support g).subset ?_ intro i hi - simp only [Pi.smul_apply, coeff_smul, ne_eq, Set.mem_setOf_eq] at hi + simp only [Pi.smul_apply, coeff_smul, ne_eq, Set.mem_ofPred_eq] at hi simp only [Function.mem_support, ne_eq] exact right_ne_zero_of_smul hi } ⟩ @@ -284,7 +284,7 @@ def smulFamily [AddCommMonoid V] [SMulWithZero R V] (f : α → R) (s : Summable exact Exists.intro i <| right_ne_zero_of_smul hi finite_co_support' g := by refine Set.Finite.subset (s.finite_co_support g) fun i hi => ?_ - simp_all only [coeff_smul, ne_eq, Set.mem_setOf_eq, Function.mem_support] + simp_all only [coeff_smul, ne_eq, Set.mem_ofPred_eq, Function.mem_support] exact right_ne_zero_of_smul hi theorem hsum_smulFamily [AddCommMonoid V] [SMulWithZero R V] (f : α → R) @@ -375,7 +375,7 @@ theorem smul_support_subset_prod (s : SummableFamily Γ R α) ((s.finite_co_support' gh.1).prod (t.finite_co_support' gh.2)).toFinset := by intro _ hab simp_all only [Function.mem_support, ne_eq, Set.Finite.coe_toFinset, Set.mem_prod, - Set.mem_setOf_eq] + Set.mem_ofPred_eq] exact ⟨left_ne_zero_of_smul hab, right_ne_zero_of_smul hab⟩ theorem hasFiniteSupport_smul (s : SummableFamily Γ R α) @@ -401,7 +401,7 @@ theorem isPWO_iUnion_support_prod_smul {s : α → R⟦Γ⟧} {t : β → V⟦Γ intro ab refine Set.Subset.trans (fun x hx => ?_) (support_vaddAntidiagonal_subset_vadd fun a ↦ Set.VAddAntidiagonal.finite_of_isPWO (s ab.1).isPWO_support (t ab.2).isPWO_support a) - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] contrapose! hx rw [mem_support, not_not, HahnModule.coeff_smul, hx, sum_empty] refine Set.Subset.trans (Set.iUnion_mono fun a => (hsupp a)) ?_ @@ -417,7 +417,7 @@ theorem finite_co_support_prod_smul (s : SummableFamily Γ R α) t.isPWO_iUnion_support g)).finite_toSet.biUnion' (fun gh _ => hasFiniteSupport_smul s t gh)).subset _ exact fun ab hab => by - simp only [ne_eq, Set.mem_setOf_eq] at hab + simp only [ne_eq, Set.mem_ofPred_eq] at hab obtain ⟨ij, hij⟩ := Finset.exists_ne_zero_of_sum_ne_zero hab simp only [mem_coe, mem_vaddAntidiagonal, Set.mem_iUnion, mem_support, ne_eq, Function.mem_support, exists_prop, Prod.exists] @@ -461,7 +461,7 @@ theorem coeff_smul {R} {V} [Semiring R] [AddCommMonoid V] [Module R V] have hsupp := smul_support_subset_prod s t gh simp_all only [mem_vaddAntidiagonal, Set.mem_iUnion, mem_support, ne_eq, Set.Finite.mem_toFinset, Function.mem_support, Set.Finite.coe_toFinset, support_subset_iff, Set.mem_prod, - Set.mem_setOf_eq, Prod.forall, coeff_support, mem_product] + Set.mem_ofPred_eq, Prod.forall, coeff_support, mem_product] exact hsupp ab.1 ab.2 hab theorem smul_hsum {R} {V} [Semiring R] [AddCommMonoid V] [Module R V] @@ -624,9 +624,9 @@ def embDomain (s : SummableFamily Γ R α) (f : α ↪ β) : SummableFamily Γ R (by intro b h by_cases hb : b ∈ Set.range f - · simp only [Ne, Set.mem_setOf_eq, dif_pos hb] at h + · simp only [Ne, Set.mem_ofPred_eq, dif_pos hb] at h exact ⟨Classical.choose hb, h, Classical.choose_spec hb⟩ - · simp only [Ne, Set.mem_setOf_eq, dif_neg hb, coeff_zero, not_true_eq_false] at h) + · simp only [Ne, Set.mem_ofPred_eq, dif_neg hb, coeff_zero, not_true_eq_false] at h) variable (s : SummableFamily Γ R α) (f : α ↪ β) {a : α} {b : β} @@ -679,7 +679,7 @@ theorem isPWO_iUnion_support_powers [AddCommMonoid Γ] [LinearOrder Γ] [IsOrder theorem co_support_zero [AddCommMonoid Γ] [PartialOrder Γ] [IsOrderedCancelAddMonoid Γ] [Semiring R] (g : Γ) : {a | ¬((0 : R⟦Γ⟧) ^ a).coeff g = 0} ⊆ {0} := by - simp only [Set.subset_singleton_iff, Set.mem_setOf_eq] + simp only [Set.subset_singleton_iff, Set.mem_ofPred_eq] intro n hn by_contra h' simp_all only [ne_eq, not_false_eq_true, zero_pow, coeff_zero, not_true_eq_false] diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Finiteness.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Finiteness.lean index 8981a4233c3901..6d62d3b6b63808 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Finiteness.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Finiteness.lean @@ -179,7 +179,8 @@ theorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A /-- A commutative Noetherian total ring of fractions is semilocal. -/ instance [IsFractionRing A A] : Finite (MaximalSpectrum A) := (MaximalSpectrum.equivSubtype A).finite_iff.mpr <| Set.finite_coe_iff.mpr <| - (associatedPrimes.finite A A).subset fun _ ↦ (·.mem_associatedPrimes_of_isFractionRing) + (associatedPrimes.finite A A).subset (t := {I : Ideal A | I.IsMaximal}) + fun _ hp ↦ hp.mem_associatedPrimes_of_isFractionRing variable {A} diff --git a/Mathlib/RingTheory/Ideal/Colon.lean b/Mathlib/RingTheory/Ideal/Colon.lean index 88cefc94603f37..0314583b7a14a1 100644 --- a/Mathlib/RingTheory/Ideal/Colon.lean +++ b/Mathlib/RingTheory/Ideal/Colon.lean @@ -38,7 +38,7 @@ def colon (N : Submodule R M) (S : Set M) : Ideal R where (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp)) zero_mem' := (Set.zero_smul_set_subset S).trans (by simp) smul_mem' r := by - simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff] + simp only [Set.mem_ofPred_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff] intro x hx y hy exact N.smul_mem _ (hx hy) diff --git a/Mathlib/RingTheory/Ideal/Defs.lean b/Mathlib/RingTheory/Ideal/Defs.lean index aee2dc55cc58e9..2bff77320cba98 100644 --- a/Mathlib/RingTheory/Ideal/Defs.lean +++ b/Mathlib/RingTheory/Ideal/Defs.lean @@ -94,7 +94,7 @@ with the kernel of `LinearMap.toSpanSingleton R M (m - m')`. -/ def Module.eqIdeal (R) {M} [Semiring R] [AddCommMonoid M] [Module R M] (m m' : M) : Ideal R where carrier := {r : R | r • m = r • m'} add_mem' h h' := by simpa [add_smul] using congr($h + $h') - zero_mem' := by simp_rw [Set.mem_setOf, zero_smul] + zero_mem' := by simp_rw [Set.mem_ofPred, zero_smul] smul_mem' _ _ h := by simpa [mul_smul] using congr(_ • $h) end Semiring diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index beef0a92dab0c1..22312242fa73d8 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -51,7 +51,7 @@ lemma IsLocalRing.quotient_artinian_of_mem_minimalPrimes_of_isLocalRing have : Ring.KrullDimLE 0 (R ⧸ I) := Ring.krullDimLE_zero_iff.mpr fun J prime ↦ Ideal.isMaximal_of_isIntegral_of_isMaximal_comap _ <| by convert! IsLocalRing.maximalIdeal.isMaximal R - rw [Ideal.minimalPrimes, Set.mem_setOf] at hp + rw [Ideal.minimalPrimes, Set.mem_ofPred] at hp have := prime.comap (Ideal.Quotient.mk I) exact hp.eq_of_le ⟨this, .trans (by simp) (Ideal.ker_le_comap _)⟩ (le_maximalIdeal this.1) IsNoetherianRing.isArtinianRing_of_krullDimLE_zero diff --git a/Mathlib/RingTheory/Ideal/Maps.lean b/Mathlib/RingTheory/Ideal/Maps.lean index 62de906cb2c249..e43229779d7197 100644 --- a/Mathlib/RingTheory/Ideal/Maps.lean +++ b/Mathlib/RingTheory/Ideal/Maps.lean @@ -1136,7 +1136,7 @@ theorem map_radical_of_surjective {f : R →+* S} (hf : Function.Surjective f) { (h : RingHom.ker f ≤ I) : map f I.radical = (map f I).radical := by rw [radical_eq_sInf, radical_eq_sInf] have : ∀ J ∈ {J : Ideal R | I ≤ J ∧ J.IsPrime}, RingHom.ker f ≤ J := fun J hJ => h.trans hJ.left - convert! map_sInf hf this + convert map_sInf hf this using 2 ext j constructor · rintro ⟨hj, hj'⟩ diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 23e037a198388a..ad2f031d006c4b 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -63,8 +63,8 @@ This is defined as `Ideal.minimalPrimes ⊥`. -/ abbrev minimalPrimes : Set (Ideal R) := {p | IsMinimalPrime p} -lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x} := - congr_arg Minimal (by simp) +lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x} := by + ext; simp [Ideal.IsMinimalPrime] variable {I J} diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 0815cca79f45dc..6bc27ca6abfb8a 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -42,7 +42,7 @@ theorem Ideal.iUnion_minimalPrimes : ⋃ p ∈ I.minimalPrimes, p = { x | ∃ y ∉ I.radical, x * y ∈ I.radical } := by classical ext x - simp only [Set.mem_iUnion, SetLike.mem_coe, exists_prop, Set.mem_setOf_eq] + simp only [Set.mem_iUnion, SetLike.mem_coe, exists_prop, Set.mem_ofPred_eq] constructor · rintro ⟨p, ⟨⟨hp₁, hp₂⟩, hp₃⟩, hxp⟩ have : p.map (algebraMap R (Localization.AtPrime p)) ≤ (I.map (algebraMap _ _)).radical := by diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Noetherian.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Noetherian.lean index 8863003728235c..e5456ac21b324c 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Noetherian.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Noetherian.lean @@ -28,7 +28,7 @@ lemma Ideal.finite_minimalPrimes_of_isNoetherianRing (I : Ideal R) : by_contra hI obtain ⟨I : Ideal R, hI : ¬ I.minimalPrimes.Finite, hmax⟩ := set_has_maximal_iff_noetherian.mpr hR {I : Ideal R | ¬ I.minimalPrimes.Finite} ⟨I, hI⟩ - simp only [Set.mem_setOf_eq, not_imp_not] at hmax + simp only [Set.mem_ofPred_eq, not_imp_not] at hmax have h1 : ¬ I.IsPrime := by contrapose hI; simp [minimalPrimes_eq_subsingleton_self] have h2 : I ≠ ⊤ := by contrapose hI; simp [hI, minimalPrimes_top] obtain ⟨x, hx, y, hy, h⟩ := (not_isPrime_iff.mp h1).resolve_left h2 diff --git a/Mathlib/RingTheory/Ideal/Norm/AbsNorm.lean b/Mathlib/RingTheory/Ideal/Norm/AbsNorm.lean index a8f308649071e7..ddb9e6ace5839f 100644 --- a/Mathlib/RingTheory/Ideal/Norm/AbsNorm.lean +++ b/Mathlib/RingTheory/Ideal/Norm/AbsNorm.lean @@ -417,10 +417,10 @@ lemma exists_isMaximal_dvd_of_dvd_absNorm' exists_isMaximal_dvd_of_dvd_absNorm (Int.prime_iff_natAbs_prime.mpr (by simpa)) _ (by exact_mod_cast hI) -theorem finite_setOf_absNorm_eq [CharZero S] (n : ℕ) : +theorem finite_setOfPred_absNorm_eq [CharZero S] (n : ℕ) : {I : Ideal S | Ideal.absNorm I = n}.Finite := by obtain hn | hn := Nat.eq_zero_or_pos n - · simp only [hn, absNorm_eq_zero_iff, Set.setOf_eq_eq_singleton, Set.finite_singleton] + · simp only [hn, absNorm_eq_zero_iff, Set.ofPred_eq_eq_singleton, Set.finite_singleton] · let f := fun I : Ideal S => Ideal.map (Ideal.Quotient.mk (@Ideal.span S _ {↑n})) I refine Set.Finite.of_finite_image (f := f) ?_ ?_ · suffices Finite (S ⧸ @Ideal.span S _ {↑n}) by @@ -435,26 +435,36 @@ theorem finite_setOf_absNorm_eq [CharZero S] (n : ℕ) : comap_map_mk (span_singleton_absNorm_le J), ← hJ.symm] congr -theorem finite_setOf_absNorm_le [CharZero S] (n : ℕ) : +@[deprecated (since := "2026-07-09")] alias finite_setOf_absNorm_eq := finite_setOfPred_absNorm_eq + +theorem finite_setOfPred_absNorm_le [CharZero S] (n : ℕ) : {I : Ideal S | Ideal.absNorm I ≤ n}.Finite := by rw [show {I : Ideal S | Ideal.absNorm I ≤ n} = (⋃ i ∈ Set.Icc 0 n, {I : Ideal S | Ideal.absNorm I = i}) by ext; simp] - refine Set.Finite.biUnion (Set.finite_Icc 0 n) (fun i _ => Ideal.finite_setOf_absNorm_eq i) + refine Set.Finite.biUnion (Set.finite_Icc 0 n) (fun i _ => Ideal.finite_setOfPred_absNorm_eq i) + +@[deprecated (since := "2026-07-09")] alias finite_setOf_absNorm_le := finite_setOfPred_absNorm_le -theorem finite_setOf_absNorm_le₀ [CharZero S] (n : ℕ) : +theorem finite_setOfPred_absNorm_le₀ [CharZero S] (n : ℕ) : {I : (Ideal S)⁰ | Ideal.absNorm (I : Ideal S) ≤ n}.Finite := by have : Finite {I : Ideal S // I ∈ (Ideal S)⁰ ∧ absNorm I ≤ n} := - (finite_setOf_absNorm_le n).subset fun _ ⟨_, h⟩ ↦ h + (finite_setOfPred_absNorm_le n).subset + (t := {I | I ∈ (Ideal S)⁰ ∧ absNorm I ≤ n}) fun _ ⟨_, h⟩ ↦ h exact Finite.of_equiv _ (Equiv.subtypeSubtypeEquivSubtypeInter _ (fun I ↦ absNorm I ≤ n)).symm +@[deprecated (since := "2026-07-09")] +alias finite_setOf_absNorm_le₀ := finite_setOfPred_absNorm_le₀ + theorem card_norm_le_eq_card_norm_le_add_one (n : ℕ) [CharZero S] : Nat.card {I : Ideal S // absNorm I ≤ n} = Nat.card {I : (Ideal S)⁰ // absNorm (I : Ideal S) ≤ n} + 1 := by classical have : Finite {I : Ideal S // I ∈ (Ideal S)⁰ ∧ absNorm I ≤ n} := - (finite_setOf_absNorm_le n).subset fun _ ⟨_, h⟩ ↦ h + (finite_setOfPred_absNorm_le n).subset + (t := {I | I ∈ (Ideal S)⁰ ∧ absNorm I ≤ n}) fun _ ⟨_, h⟩ ↦ h have : Finite {I : Ideal S // I ∉ (Ideal S)⁰ ∧ absNorm I ≤ n} := - (finite_setOf_absNorm_le n).subset fun _ ⟨_, h⟩ ↦ h + (finite_setOfPred_absNorm_le n).subset + (t := {I | I ∉ (Ideal S)⁰ ∧ absNorm I ≤ n}) fun _ ⟨_, h⟩ ↦ h rw [Nat.card_congr (Equiv.subtypeSubtypeEquivSubtypeInter (fun I ↦ I ∈ (Ideal S)⁰) (fun I ↦ absNorm I ≤ n))] let e : {I : Ideal S // absNorm I ≤ n} ≃ {I : Ideal S // I ∈ (Ideal S)⁰ ∧ absNorm I ≤ n} ⊕ diff --git a/Mathlib/RingTheory/Ideal/Quotient/HasFiniteQuotients.lean b/Mathlib/RingTheory/Ideal/Quotient/HasFiniteQuotients.lean index 656fc378d3e3d2..02bd7bbb6bdde3 100644 --- a/Mathlib/RingTheory/Ideal/Quotient/HasFiniteQuotients.lean +++ b/Mathlib/RingTheory/Ideal/Quotient/HasFiniteQuotients.lean @@ -80,12 +80,14 @@ theorem cardQuot_pos (I : Ideal R) (hI : I ≠ ⊥) : 0 < I.cardQuot := by rw [Submodule.cardQuot_apply] exact Nat.card_pos -theorem finite_setOf_mem (x : R) (hx : x ≠ 0) : {I : Ideal R | x ∈ I}.Finite := by +theorem finite_setOfPred_mem (x : R) (hx : x ≠ 0) : {I : Ideal R | x ∈ I}.Finite := by have := finiteQuotient (mt Ideal.span_singleton_eq_bot.mp hx) have : {I | Ideal.comap (Ideal.Quotient.mk (Ideal.span {x})) ⊥ ≤ I}.Finite := .of_equiv _ (Ideal.relIsoOfSurjective _ Ideal.Quotient.mk_surjective).toEquiv simpa [← RingHom.ker_eq_comap_bot] using this +@[deprecated (since := "2026-07-09")] alias finite_setOf_mem := finite_setOfPred_mem + open scoped Pointwise in /-- For every bound `B`, a ring with finite quotients has only finitely many ideals of norm bounded by `B`. -/ @@ -101,10 +103,10 @@ theorem finite_cardQuot_le (B : ℕ) : {I : Ideal R | I.cardQuot ≤ B}.Finite : -- in a ring with finite quotients, each nonzero element is contained in only finitely many ideals -- so it is enough to show that each ideal `I` of norm at most `B` contains some element of `t` suffices {I | Submodule.cardQuot I ≤ B} \ {⊥} ⊆ ⋃ x ∈ t, {I | x ∈ I} from - (t.finite_toSet.biUnion fun x hx ↦ finite_setOf_mem x (by grind)).subset this + (t.finite_toSet.biUnion fun x hx ↦ finite_setOfPred_mem x (by grind)).subset this intro I hI - rw [Set.mem_sdiff, Set.mem_setOf, Submodule.cardQuot_apply] at hI - simp_rw [Set.mem_iUnion, exists_prop, Set.mem_setOf_eq] + rw [Set.mem_sdiff, Set.mem_ofPred, Submodule.cardQuot_apply] at hI + simp_rw [Set.mem_iUnion, exists_prop, Set.mem_ofPred_eq] -- `s` has cardinality `B + 1`, but the quotient `R ⧸ I` has cardinality at most `B` replace hs : (s.image (Ideal.Quotient.mk I)).card < s.card := by have := finiteQuotient hI.2 diff --git a/Mathlib/RingTheory/Ideal/Quotient/Index.lean b/Mathlib/RingTheory/Ideal/Quotient/Index.lean index ad8ffac0b28bd3..dc8a89cf1464b1 100644 --- a/Mathlib/RingTheory/Ideal/Quotient/Index.lean +++ b/Mathlib/RingTheory/Ideal/Quotient/Index.lean @@ -74,7 +74,8 @@ lemma Submodule.index_smul_le [Finite (R ⧸ I)] (quotTensorEquivQuotSMul N I).symm rw [Nat.card_congr e.toEquiv] have H : LinearMap.range (Finsupp.linearCombination R (α := s) (↑)) = N := by - rw [Finsupp.range_linearCombination, ← hs, Subtype.range_val] + rw [Finsupp.range_linearCombination, ← hs] + exact congrArg (span R) Subtype.range_coe_subtype let f : (s →₀ R) →ₗ[R] N := (Finsupp.linearCombination R (↑)).codRestrict _ (fun c => by rw [← H, LinearMap.mem_range]; exact exists_apply_eq_apply _ _) have hf : Function.Surjective f := fun x ↦ by diff --git a/Mathlib/RingTheory/Ideal/Span.lean b/Mathlib/RingTheory/Ideal/Span.lean index dac38b8076649d..ab0d0df7f1a1c2 100644 --- a/Mathlib/RingTheory/Ideal/Span.lean +++ b/Mathlib/RingTheory/Ideal/Span.lean @@ -169,7 +169,7 @@ lemma span_range_eq_span_range_support (x : ι → α) : congr ext1 a simp only [mem_sdiff, mem_range, mem_singleton_iff] - exact ⟨fun ⟨⟨i, hi⟩, ha⟩ ↦ ⟨⟨i, mem_setOf.mpr (hi ▸ ha)⟩, hi⟩, + exact ⟨fun ⟨⟨i, hi⟩, ha⟩ ↦ ⟨⟨i, mem_ofPred.mpr (hi ▸ ha)⟩, hi⟩, fun ⟨j, hj⟩ ↦ ⟨⟨j.val, hj⟩, by grind⟩⟩ end Semiring diff --git a/Mathlib/RingTheory/IntegralClosure/GoingDown.lean b/Mathlib/RingTheory/IntegralClosure/GoingDown.lean index a42ee0f39c77a2..45ce638b399779 100644 --- a/Mathlib/RingTheory/IntegralClosure/GoingDown.lean +++ b/Mathlib/RingTheory/IntegralClosure/GoingDown.lean @@ -82,7 +82,7 @@ instance [IsDomain S] [FaithfulSMul R S] [Algebra.IsIntegral R S] [IsIntegrallyC (minpoly.isIntegrallyClosed_dvd (Algebra.IsIntegral.isIntegral _) hfa) simp only [IsIntegrallyClosed.minpoly_smul hx0 (Algebra.IsIntegral.isIntegral _), natDegree_scaleRoots, coeff_scaleRoots, Ideal.radical_eq_sInf, Submodule.mem_sInf, - Set.mem_setOf_eq, and_imp] at this + Set.mem_ofPred_eq, and_imp] at this refine ‹p.IsPrime›.mem_of_pow_mem _ ((‹p.IsPrime›.mem_or_mem (this i hi p ?_ inferInstance)).resolve_left hip) simp +contextual [Ideal.span_le, Set.subset_def, LT.lt.ne, hf] diff --git a/Mathlib/RingTheory/Jacobson/Radical.lean b/Mathlib/RingTheory/Jacobson/Radical.lean index cea9cb8d9c956f..0713b35171cb4c 100644 --- a/Mathlib/RingTheory/Jacobson/Radical.lean +++ b/Mathlib/RingTheory/Jacobson/Radical.lean @@ -99,7 +99,7 @@ theorem jacobson_quotient_jacobson : jacobson R (M ⧸ jacobson R M) = ⊥ := by theorem jacobson_lt_top [Nontrivial M] [IsCoatomic (Submodule R M)] : jacobson R M < ⊤ := by obtain ⟨m, hm, -⟩ := (eq_top_or_exists_le_coatom (⊥ : Submodule R M)).resolve_left bot_ne_top - exact (sInf_le <| Set.mem_setOf.mpr hm).trans_lt hm.1.lt_top + exact (sInf_le <| Set.mem_ofPred.mpr hm).trans_lt hm.1.lt_top example [Nontrivial M] [Module.Finite R M] : jacobson R M < ⊤ := jacobson_lt_top R M diff --git a/Mathlib/RingTheory/Jacobson/Ring.lean b/Mathlib/RingTheory/Jacobson/Ring.lean index 19f44282274054..f0ecc8597a2836 100644 --- a/Mathlib/RingTheory/Jacobson/Ring.lean +++ b/Mathlib/RingTheory/Jacobson/Ring.lean @@ -76,7 +76,7 @@ theorem isJacobsonRing_iff_prime_eq : refine fun h I hI ↦ le_antisymm (fun x hx ↦ ?_) (fun x hx ↦ mem_sInf.mpr fun _ hJ ↦ hJ.left hx) rw [← hI.radical, radical_eq_sInf I, mem_sInf] intro P hP - rw [Set.mem_setOf_eq] at hP + rw [Set.mem_ofPred_eq] at hP rw [jacobson, mem_sInf] at hx rw [← h P hP.right, jacobson, mem_sInf] exact fun J hJ => hx ⟨le_trans hP.left hJ.left, hJ.right⟩ @@ -136,7 +136,7 @@ theorem isJacobsonRing_of_isIntegral [Algebra R S] [Algebra.IsIntegral R S] [IsJ ((isJacobsonRing_iff_prime_eq.1 ‹_›) (comap (algebraMap R S) P) (comap_isPrime _ _)), comap_jacobson] refine sInf_le_sInf fun J hJ => ?_ - simp only [true_and, Set.mem_image, bot_le, Set.mem_setOf_eq] + simp only [true_and, Set.mem_image, bot_le, Set.mem_ofPred_eq] have : J.IsMaximal := by simpa using hJ exact exists_ideal_over_maximal_of_isIntegral J (comap_bot_le_of_injective _ algebraMap_quotient_injective) diff --git a/Mathlib/RingTheory/KrullDimension/PID.lean b/Mathlib/RingTheory/KrullDimension/PID.lean index 370302852f63ef..73b8b5a551713e 100644 --- a/Mathlib/RingTheory/KrullDimension/PID.lean +++ b/Mathlib/RingTheory/KrullDimension/PID.lean @@ -20,7 +20,7 @@ public section instance IsPrincipalIdealRing.krullDimLE_one (R : Type*) [CommRing R] [IsPrincipalIdealRing R] : Ring.KrullDimLE 1 R := by refine Ring.krullDimLE_one_iff.2 fun I hI ↦ or_iff_not_imp_left.2 fun hI' ↦ ?_ - rw [minimalPrimes_eq_minimals, Set.notMem_setOf_iff, not_minimal_iff_exists_lt hI] at hI' + rw [minimalPrimes_eq_minimals, Set.notMem_ofPred_iff, not_minimal_iff_exists_lt hI] at hI' obtain ⟨P, hlt, hP⟩ := hI' have := IsPrincipalIdealRing.of_surjective (Ideal.Quotient.mk P) Ideal.Quotient.mk_surjective have : (I.map (Ideal.Quotient.mk P)).IsMaximal := by diff --git a/Mathlib/RingTheory/KrullDimension/Zero.lean b/Mathlib/RingTheory/KrullDimension/Zero.lean index 1971d6da9a135e..2e48f38c29aeab 100644 --- a/Mathlib/RingTheory/KrullDimension/Zero.lean +++ b/Mathlib/RingTheory/KrullDimension/Zero.lean @@ -32,15 +32,23 @@ lemma Ring.KrullDimLE.mem_minimalPrimes_iff_le_of_isPrime {I J : Ideal R} [I.IsP rwa [mem_minimalPrimes_iff, and_iff_right] variable (R) in -lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isPrime : +lemma Ring.KrullDimLE.minimalPrimes_eq_setOfPred_isPrime : minimalPrimes R = { I | I.IsPrime } := by ext exact Ideal.mem_minimalPrimes_iff_isPrime +@[deprecated (since := "2026-07-09")] +alias Ring.KrullDimLE.minimalPrimes_eq_setOf_isPrime := + Ring.KrullDimLE.minimalPrimes_eq_setOfPred_isPrime + variable (R) in -lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isMaximal : +lemma Ring.KrullDimLE.minimalPrimes_eq_setOfPred_isMaximal : minimalPrimes R = { I | I.IsMaximal } := by - ext; simp [minimalPrimes_eq_setOf_isPrime, Ideal.isMaximal_iff_isPrime] + ext; simp [minimalPrimes_eq_setOfPred_isPrime, Ideal.isMaximal_iff_isPrime] + +@[deprecated (since := "2026-07-09")] +alias Ring.KrullDimLE.minimalPrimes_eq_setOf_isMaximal := + Ring.KrullDimLE.minimalPrimes_eq_setOfPred_isMaximal /-- Note that the `ringKrullDim` of the trivial ring is `⊥` and not `0`. -/ example [Subsingleton R] : Ring.KrullDimLE 0 R := inferInstance diff --git a/Mathlib/RingTheory/LaurentSeries.lean b/Mathlib/RingTheory/LaurentSeries.lean index 86c866fe9a00d5..33528d10db231d 100644 --- a/Mathlib/RingTheory/LaurentSeries.lean +++ b/Mathlib/RingTheory/LaurentSeries.lean @@ -771,8 +771,7 @@ theorem Cauchy.coeff_eventually_equal {ℱ : Filter K⸨X⸩} (hℱ : Cauchy ℱ · have := (exists_lb_coeff_ne hℱ).choose_spec rw [Filter.eventually_iff] at this convert! this - ext - simp only [Set.mem_iInter, Set.mem_setOf_eq]; rfl + simp only [Set.mem_iff_mem, Set.mem_iInter]; rfl · rw [biInter_mem (Set.finite_Icc ℓ N)] intro i _ apply (coeff_tendsto hℱ _).eventually @@ -886,7 +885,7 @@ theorem coe_range_dense : DenseRange ((↑) : K⟮X⟯ → K⸨X⸩) := by apply hT₁ apply hγ simpa only [Units.coe_map, MonoidHom.coe_mk, ZeroHom.toFun_eq_coe, OneHom.coe_mk, add_comm, - MonoidWithZeroHom.toZeroHom_coe, ← sub_eq_add_neg, Set.mem_setOf_eq, + MonoidWithZeroHom.toZeroHom_coe, ← sub_eq_add_neg, Set.mem_ofPred_eq, Valuation.restrict_lt_iff_lt_embedding] end Dense @@ -908,7 +907,7 @@ open MonoidWithZeroHom.ValueGroup₀ theorem inducing_coe : IsUniformInducing ((↑) : K⟮X⟯ → K⸨X⸩) := by rw [isUniformInducing_iff, Filter.comap] ext S - simp only [Filter.mem_mk, Set.mem_setOf_eq, uniformity_eq_comap_nhds_zero, + simp only [Filter.mem_mk, Set.mem_ofPred_eq, uniformity_eq_comap_nhds_zero, Filter.mem_comap] constructor · rintro ⟨T, ⟨⟨R, ⟨hR, pre_R⟩⟩, pre_T⟩⟩ @@ -921,7 +920,7 @@ theorem inducing_coe : IsUniformInducing ((↑) : K⟮X⟯ → K⸨X⸩) := by rw [Valuation.restrict_def, ne_eq, restrict₀_eq_zero_iff]; simp [hx]) simp [v_def, Valuation.restrict_lt_iff, ← hx] apply hd - simp only [sub_zero, Set.mem_setOf_eq] + simp only [sub_zero, Set.mem_ofPred_eq] rw [← map_sub, Valuation.restrict_lt_iff_lt_embedding] simp only [valuation_def] rwa [← valuation_eq_LaurentSeries_valuation] @@ -938,12 +937,12 @@ theorem inducing_coe : IsUniformInducing ((↑) : K⟮X⟯ → K⸨X⸩) := by simp only [h, map_zero] at hx exact Units.ne_zero _ hx.symm) simp only [Units.val_mk0, ← Valuation.restrict_lt_iff_lt_embedding, - X_def, Set.setOf_subset_setOf, Valuation.restrict_lt_iff] + X_def, Set.ofPred_subset_ofPred, Valuation.restrict_lt_iff] rw [← hx, embedding_restrict₀] simp [v_def, valuation_coe_ratFunc] · refine subset_trans (fun _ _ ↦ ?_) pre_T apply hd - rw [Set.mem_setOf_eq, sub_zero, Valuation.restrict_lt_iff_lt_embedding, v_def, + rw [Set.mem_ofPred_eq, sub_zero, Valuation.restrict_lt_iff_lt_embedding, v_def, valuation_eq_LaurentSeries_valuation, map_sub] assumption @@ -1093,7 +1092,7 @@ theorem tendsto_valuation (a : (idealX K).adicCompletion K⟮X⟯) : · rw [WithZeroTopology.tendsto_of_ne_zero ((Valuation.ne_zero_iff Valued.v).mpr ha), Filter.eventually_comap, Filter.Eventually, Valued.mem_nhds] use Units.mk0 (Valued.v.restrict a) (by simp [Valuation.restrict_def, ha]) - simp only [Units.val_mk0, v_def, Set.setOf_subset_setOf] + simp only [Units.val_mk0, v_def, Set.ofPred_subset_ofPred] rintro y val_y b rfl rw [← valuedAdicCompletion_eq_valuation'] exact (Valuation.restrict_inj _).mp <| Valuation.map_eq_of_sub_lt Valued.v.restrict val_y diff --git a/Mathlib/RingTheory/LocalIso.lean b/Mathlib/RingTheory/LocalIso.lean index ac833ffa208833..2c537368c1e94b 100644 --- a/Mathlib/RingTheory/LocalIso.lean +++ b/Mathlib/RingTheory/LocalIso.lean @@ -142,11 +142,11 @@ lemma trans [Algebra S T] [Algebra R T] [IsScalarTower R S T] rw [Ideal.map_top, Ideal.map_span] at h1 nth_rw 1 [_root_.eq_top_iff, ← Ideal.top_mul ⊤, ← h1, ← span_isStandardOpenImmersion_eq_top S T, Ideal.span_mul_span, Ideal.span_le, Set.mul_subset_iff] - simp only [Set.mem_image, Set.mem_setOf_eq, SetLike.mem_coe, forall_exists_index, and_imp, + simp only [Set.mem_image, Set.mem_ofPred_eq, SetLike.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intro g hg x hx refine Ideal.subset_span ⟨⟨⟨g, hg⟩, ⟨x, ?_⟩⟩, rfl⟩ - simp only [Set.mem_setOf_eq, t] + simp only [Set.mem_ofPred_eq, t] let : Algebra (Localization.Away x) (T'' g x) := localizationAlgebra (.powers x) (T' g) have : IsScalarTower S (Localization.Away x) (T'' g x) := @@ -177,7 +177,7 @@ instance [Algebra R T] [IsLocalIso R S] : IsLocalIso T (T ⊗[R] S) := by Ideal.map_le_iff_le_comap, Ideal.span_le] intro g hg apply Ideal.subset_span - simp only [Set.mem_setOf_eq] at hg ⊢ + simp only [Set.mem_ofPred_eq] at hg ⊢ exact .of_algEquiv <| IsLocalization.Away.tensorProductEquivTMulRight R T g (Localization.Away g) end Algebra.IsLocalIso diff --git a/Mathlib/RingTheory/LocalProperties/Projective.lean b/Mathlib/RingTheory/LocalProperties/Projective.lean index 668948e2ba7be2..10463481a3f6ed 100644 --- a/Mathlib/RingTheory/LocalProperties/Projective.lean +++ b/Mathlib/RingTheory/LocalProperties/Projective.lean @@ -136,7 +136,7 @@ theorem Module.projective_of_localization_maximal (H : ∀ (I : Ideal R) (_ : I. let N := s →₀ R let f : N →ₗ[R] M := Finsupp.linearCombination R (Subtype.val : s → M) have hf : Function.Surjective f := by - rw [← LinearMap.range_eq_top, Finsupp.range_linearCombination, Subtype.range_val] + rw [← LinearMap.range_eq_top, Finsupp.range_linearCombination, Subtype.range_coe_subtype] convert! hs have (I : Ideal R) (hI : I.IsMaximal) := letI := H I hI diff --git a/Mathlib/RingTheory/Localization/AtPrime/Basic.lean b/Mathlib/RingTheory/Localization/AtPrime/Basic.lean index 429a6fba691abb..588cf7fe8be7fb 100644 --- a/Mathlib/RingTheory/Localization/AtPrime/Basic.lean +++ b/Mathlib/RingTheory/Localization/AtPrime/Basic.lean @@ -143,7 +143,8 @@ variable (I : Ideal R) [hI : I.IsPrime] [IsLocalization.AtPrime S I] order-preserving bijection with the prime ideals contained in I. -/ @[simps!] def orderIsoOfPrime : { p : Ideal S // p.IsPrime } ≃o { p : Ideal R // p.IsPrime ∧ p ≤ I } := - (IsLocalization.orderIsoOfPrime I.primeCompl S).trans <| .setCongr _ _ <| show setOf _ = setOf _ + (IsLocalization.orderIsoOfPrime I.primeCompl S).trans <| .setCongr _ _ <| + show Set.ofPred _ = Set.ofPred _ by ext; simp [Ideal.primeCompl, ← le_compl_iff_disjoint_left] /-- The prime spectrum of the localization of a commutative ring R at a prime ideal I are in diff --git a/Mathlib/RingTheory/Localization/Away/Basic.lean b/Mathlib/RingTheory/Localization/Away/Basic.lean index 8f68522c0189c5..92593b388aeb09 100644 --- a/Mathlib/RingTheory/Localization/Away/Basic.lean +++ b/Mathlib/RingTheory/Localization/Away/Basic.lean @@ -578,8 +578,10 @@ theorem existsUnique_algebraMap_eq_of_span_eq_top (s : Set R) (span_eq : Ideal.s replace hts := Set.insert_subset a.2 hts classical have ⟨r', eq, _⟩ := this ({a.1} ∪ t) (fun a ↦ f ⟨a, hts a.2⟩) (fun a b ↦ - h ⟨a, hts a.2⟩ ⟨b, hts b.2⟩) (Ideal.span_mono (fun _ ↦ .inr) mem) ⟨{a.1} ∪ t, by simp⟩ - exact (congr_arg _ (uniq _ fun b ↦ eq ⟨b, .inr b.2⟩).symm).trans (eq ⟨a, .inl rfl⟩) + h ⟨a, hts a.2⟩ ⟨b, hts b.2⟩) (Ideal.span_mono (fun _ h ↦ Set.mem_union_right _ h) mem) + ⟨{a.1} ∪ t, by simp⟩ + exact (congr_arg _ (uniq _ fun b ↦ eq ⟨b, Set.mem_union_right _ b.2⟩).symm).trans + (eq ⟨a, Set.mem_union_left _ rfl⟩) have span_eq := (Ideal.eq_top_iff_one _).mpr mem refine existsUnique_of_exists_of_unique ?_ fun x y hx hy ↦ algebraMap_injective_of_span_eq_top s span_eq (funext fun a ↦ (hx a).trans (hy a).symm) diff --git a/Mathlib/RingTheory/MvPolynomial/Basic.lean b/Mathlib/RingTheory/MvPolynomial/Basic.lean index 86708fc1d603ab..de7e7075485c09 100644 --- a/Mathlib/RingTheory/MvPolynomial/Basic.lean +++ b/Mathlib/RingTheory/MvPolynomial/Basic.lean @@ -216,15 +216,16 @@ theorem linearIndependent_X : LinearIndependent R (X : σ → MvPolynomial σ R) (basisMonomials σ R).linearIndependent.comp (fun s : σ => Finsupp.single s 1) (Finsupp.single_left_injective one_ne_zero) -private lemma finite_setOf_bounded (α) [Finite α] (n : ℕ) : Finite {f : α →₀ ℕ | ∀ a, f a ≤ n} := +private lemma finite_setOfPred_bounded (α) [Finite α] (n : ℕ) : + Finite {f : α →₀ ℕ | ∀ a, f a ≤ n} := ((Set.Finite.pi' fun _ ↦ Set.finite_le_nat _).preimage DFunLike.coe_injective.injOn).to_subtype instance [Finite σ] (N : ℕ) : Module.Finite R (restrictDegree σ R N) := - have := finite_setOf_bounded σ N + have := finite_setOfPred_bounded σ N Module.Finite.of_basis (basisRestrictSupport R _) instance [Finite σ] (N : ℕ) : Module.Finite R (restrictTotalDegree σ R N) := - have := finite_setOf_bounded σ N + have := finite_setOfPred_bounded σ N have : Finite {s : σ →₀ ℕ | s.sum (fun _ e ↦ e) ≤ N} := by rw [Set.finite_coe_iff] at this ⊢ exact this.subset fun n hn i ↦ (eq_or_ne (n i) 0).elim diff --git a/Mathlib/RingTheory/MvPolynomial/EulerIdentity.lean b/Mathlib/RingTheory/MvPolynomial/EulerIdentity.lean index 4b8c64bb0560c9..bad7ba74f75f7a 100644 --- a/Mathlib/RingTheory/MvPolynomial/EulerIdentity.lean +++ b/Mathlib/RingTheory/MvPolynomial/EulerIdentity.lean @@ -65,7 +65,7 @@ theorem IsWeightedHomogeneous.sum_weight_X_mul_pderiv {w : σ → ℕ} · rintro _ ⟨m, hm, rfl⟩ simp_rw [single_eq_monomial, X_mul_pderiv_monomial, smul_smul, ← sum_smul, mul_comm (w _)] congr - rwa [Set.mem_setOf, weight_apply, sum_fintype] at hm + rwa [Set.mem_ofPred, weight_apply, sum_fintype] at hm intro; apply zero_smul · simp · simp_rw [map_add, left_distrib, smul_add, sum_add_distrib, hp, hq] diff --git a/Mathlib/RingTheory/MvPolynomial/Symmetric/Defs.lean b/Mathlib/RingTheory/MvPolynomial/Symmetric/Defs.lean index 592ab3ac4e4d96..1afacf83e95568 100644 --- a/Mathlib/RingTheory/MvPolynomial/Symmetric/Defs.lean +++ b/Mathlib/RingTheory/MvPolynomial/Symmetric/Defs.lean @@ -106,7 +106,7 @@ def IsSymmetric [CommSemiring R] (φ : MvPolynomial σ R) : Prop := /-- The subalgebra of symmetric `MvPolynomial`s. -/ def symmetricSubalgebra (σ R : Type*) [CommSemiring R] : Subalgebra R (MvPolynomial σ R) where - carrier := setOf IsSymmetric + carrier := Set.ofPred IsSymmetric algebraMap_mem' r e := rename_C e r mul_mem' ha hb e := by rw [map_mul, ha, hb] add_mem' ha hb e := by rw [map_add, ha, hb] diff --git a/Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean b/Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean index 7f6d951a470c7c..0021245437365b 100644 --- a/Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean +++ b/Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean @@ -247,7 +247,7 @@ the elementary symmetric polynomials and would like to calculate the values of t theorem psum_eq_mul_esymm_sub_sum (k : ℕ) (h : 0 < k) : psum σ R k = (-1) ^ (k + 1) * k * esymm σ R k - ∑ a ∈ antidiagonal k with a.1 ∈ Set.Ioo 0 k, (-1) ^ a.fst * esymm σ R a.1 * psum σ R a.2 := by - simp only [Set.Ioo, Set.mem_setOf_eq, and_comm] + simp only [Set.Ioo, Set.mem_ofPred_eq, and_comm] have hesymm := mul_esymm_eq_sum σ R k rw [← (sum_filter_add_sum_filter_not {a ∈ antidiagonal k | a.fst < k} (fun a ↦ 0 < a.fst) (fun a ↦ (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd))] at hesymm diff --git a/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean b/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean index 167c934b9e5fef..1da6f443c2ea9c 100644 --- a/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean +++ b/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean @@ -335,7 +335,7 @@ lemma induction_on {w : σ → M} {m : M} rw [Set.image_subset_iff] intro d hd simp only [MvPolynomial, Submodule.coe_set_mk, AddSubmonoid.coe_set_mk, - AddSubsemigroup.coe_set_mk, preimage_setOf_eq, mem_setOf_eq, A] + AddSubsemigroup.coe_set_mk, preimage_ofPred_eq, mem_ofPred_eq, A] refine ⟨isWeightedHomogeneous_monomial w d 1 hd, fun a ↦ ?_⟩ simpa only [single_eq_monomial, ← MvPolynomial.C_mul_monomial] using monomial _ (a * 1) hd diff --git a/Mathlib/RingTheory/MvPowerSeries/LinearTopology.lean b/Mathlib/RingTheory/MvPowerSeries/LinearTopology.lean index c47f513096cff1..ca7c9f02283c59 100644 --- a/Mathlib/RingTheory/MvPowerSeries/LinearTopology.lean +++ b/Mathlib/RingTheory/MvPowerSeries/LinearTopology.lean @@ -90,7 +90,7 @@ theorem basis_le_iff {J K : TwoSidedIdeal R} {d e : σ →₀ ℕ} (hK : K ≠ basis σ R ⟨J, d⟩ ≤ basis σ R ⟨K, e⟩ ↔ J ≤ K ∧ e ≤ d := by classical constructor - · simp only [basis, TwoSidedIdeal.le_iff, TwoSidedIdeal.coe_mk', setOf_subset_setOf] + · simp only [basis, TwoSidedIdeal.le_iff, TwoSidedIdeal.coe_mk', ofPred_subset_ofPred] intro h constructor · intro x hx diff --git a/Mathlib/RingTheory/MvPowerSeries/Restricted.lean b/Mathlib/RingTheory/MvPowerSeries/Restricted.lean index 72d90d9acdcb90..55fd208e1867e5 100644 --- a/Mathlib/RingTheory/MvPowerSeries/Restricted.lean +++ b/Mathlib/RingTheory/MvPowerSeries/Restricted.lean @@ -96,7 +96,7 @@ namespace IsRestricted /-- Restricted power series as an additive subgroup of `MvPowerSeries σ R`. -/ protected def addSubgroup (c : σ → ℝ) : AddSubgroup (MvPowerSeries σ R) where - carrier := IsRestricted c + carrier := {f | IsRestricted c f} zero_mem' := isRestricted_zero c add_mem' := isRestricted.add c neg_mem' := isRestricted.neg c diff --git a/Mathlib/RingTheory/MvPowerSeries/Substitution.lean b/Mathlib/RingTheory/MvPowerSeries/Substitution.lean index 4bf62eae37dcea..2c1dcb7df60530 100644 --- a/Mathlib/RingTheory/MvPowerSeries/Substitution.lean +++ b/Mathlib/RingTheory/MvPowerSeries/Substitution.lean @@ -139,7 +139,7 @@ theorem HasSubst.smul_X (a : σ → R) : /-- Families of `MvPowerSeries` that can be substituted, as an `Ideal` -/ noncomputable def hasSubstIdeal : Ideal (σ → MvPowerSeries τ S) := - { carrier := setOf HasSubst + { carrier := Set.ofPred HasSubst add_mem' := HasSubst.add zero_mem' := HasSubst.zero smul_mem' := HasSubst.mul_left } @@ -493,7 +493,7 @@ theorem le_weightedOrder_subst (ha : HasSubst a) (f : MvPowerSeries σ R) : by_cases hfx : f.coeff x = 0 · simp [hfx] rw [coeff_eq_zero_of_lt_weightedOrder w, smul_zero] - refine hd.trans_le (((biInf_le _ hfx).trans ?_).trans (le_weightedOrder_prod ..)) + refine hd.trans_le (((iInf₂_le x hfx).trans ?_).trans (le_weightedOrder_prod ..)) simp only [Finsupp.weight_apply, Finsupp.sum, Function.comp_apply] exact Finset.sum_le_sum fun i hi ↦ .trans (by simp) (le_weightedOrder_pow ..) diff --git a/Mathlib/RingTheory/Nilpotent/Defs.lean b/Mathlib/RingTheory/Nilpotent/Defs.lean index 4108190b2a5f23..55d464188d65bb 100644 --- a/Mathlib/RingTheory/Nilpotent/Defs.lean +++ b/Mathlib/RingTheory/Nilpotent/Defs.lean @@ -78,7 +78,7 @@ lemma isNilpotent_of_pos_nilpotencyClass (hx : 0 < nilpotencyClass x) : simp [not_nonempty_iff_eq_empty.mp contra] at hx lemma pow_nilpotencyClass (hx : IsNilpotent x) : x ^ (nilpotencyClass x) = 0 := - Nat.sInf_mem hx + Nat.sInf_mem (s := {k | x ^ k = 0}) hx end ZeroPow diff --git a/Mathlib/RingTheory/Noetherian/UniqueFactorizationDomain.lean b/Mathlib/RingTheory/Noetherian/UniqueFactorizationDomain.lean index 6f8df5c4e76863..feb875a2bc7d68 100644 --- a/Mathlib/RingTheory/Noetherian/UniqueFactorizationDomain.lean +++ b/Mathlib/RingTheory/Noetherian/UniqueFactorizationDomain.lean @@ -22,4 +22,4 @@ variable {R : Type*} [CommSemiring R] [IsDomain R] -- see Note [lower instance priority] instance (priority := 100) IsNoetherianRing.wfDvdMonoid [h : IsNoetherianRing R] : WfDvdMonoid R := - WfDvdMonoid.of_setOf_isPrincipal_wellFoundedOn_gt h.wf.wellFoundedOn + WfDvdMonoid.of_setOfPred_isPrincipal_wellFoundedOn_gt h.wf.wellFoundedOn diff --git a/Mathlib/RingTheory/Polynomial/Basic.lean b/Mathlib/RingTheory/Polynomial/Basic.lean index ac7a2baaabd417..c01195e13afd35 100644 --- a/Mathlib/RingTheory/Polynomial/Basic.lean +++ b/Mathlib/RingTheory/Polynomial/Basic.lean @@ -681,7 +681,7 @@ theorem mem_span_C_coeff : f ∈ Ideal.span { g : R[X] | ∃ i : ℕ, g = C (coe dsimp have : C (coeff f n) ∈ p := by apply subset_span - rw [mem_setOf_eq] + rw [mem_ofPred_eq] use n have : monomial n (1 : R) • C (coeff f n) ∈ p := p.smul_mem _ this convert! this using 1 diff --git a/Mathlib/RingTheory/Polynomial/ContentIdeal.lean b/Mathlib/RingTheory/Polynomial/ContentIdeal.lean index 9758b54a8d9a11..4ecf24c863f5f2 100644 --- a/Mathlib/RingTheory/Polynomial/ContentIdeal.lean +++ b/Mathlib/RingTheory/Polynomial/ContentIdeal.lean @@ -48,7 +48,7 @@ open Ideal variable {R S : Type*} [Semiring R] [Semiring S] (p : R[X]) /-- The content ideal of a polynomial `p` is the ideal generated by its coefficients. -/ -def contentIdeal := span (p.coeffs : Set R) +noncomputable def contentIdeal := span (p.coeffs : Set R) theorem contentIdeal_def : p.contentIdeal = span (p.coeffs : Set R) := rfl diff --git a/Mathlib/RingTheory/Polynomial/Dickson.lean b/Mathlib/RingTheory/Polynomial/Dickson.lean index 99c6d0c632f322..6d46ac63bf3608 100644 --- a/Mathlib/RingTheory/Polynomial/Dickson.lean +++ b/Mathlib/RingTheory/Polynomial/Dickson.lean @@ -221,7 +221,7 @@ theorem dickson_one_one_zmod_p (p : ℕ) [Fact p.Prime] : dickson 1 (1 : ZMod p) -- The two polynomials agree on all `x` of the form `x = y + y⁻¹`. apply @Set.Infinite.mono _ { x : K | ∃ y, x = y + y⁻¹ ∧ y ≠ 0 } · rintro _ ⟨x, rfl, hx⟩ - simp only [eval_X, eval_pow, Set.mem_setOf_eq, ZMod.cast_one', add_pow_char, + simp only [eval_X, eval_pow, Set.mem_ofPred_eq, ZMod.cast_one', add_pow_char, dickson_one_one_eval_add_inv _ _ (mul_inv_cancel₀ hx), ZMod.castHom_apply] -- Now we need to show that the set of such `x` is infinite. -- If the set is finite, then we will show that `K` is also finite. @@ -247,7 +247,7 @@ theorem dickson_one_one_zmod_p (p : ℕ) [Fact p.Prime] : dickson 1 (1 : ZMod p) classical convert! (φ.roots ∪ {0}).toFinset.finite_toSet using 1 ext1 y - simp only [φ, Multiset.mem_toFinset, Set.mem_setOf_eq, Finset.mem_coe, Multiset.mem_union, + simp only [φ, Multiset.mem_toFinset, Set.mem_ofPred_eq, Finset.mem_coe, Multiset.mem_union, mem_roots hφ, IsRoot, eval_add, eval_sub, eval_pow, eval_mul, eval_X, eval_C, eval_one, Multiset.mem_singleton] by_cases hy : y = 0 @@ -259,7 +259,7 @@ theorem dickson_one_one_zmod_p (p : ℕ) [Fact p.Prime] : dickson 1 (1 : ZMod p) -- Finally, we prove the claim that our finite union of finite sets covers all of `K`. apply (Set.eq_univ_of_forall _).symm intro x - simp only [exists_prop, Set.mem_iUnion, Ne, Set.mem_setOf_eq] + simp only [exists_prop, Set.mem_iUnion, Ne, Set.mem_ofPred_eq] by_cases hx : x = 0 · simp only [hx, and_true, inv_zero, or_true] exact ⟨_, 1, rfl, one_ne_zero⟩ diff --git a/Mathlib/RingTheory/Polynomial/GaussNorm.lean b/Mathlib/RingTheory/Polynomial/GaussNorm.lean index 4b6d9d9f6afa1a..5a28e9d6eb136e 100644 --- a/Mathlib/RingTheory/Polynomial/GaussNorm.lean +++ b/Mathlib/RingTheory/Polynomial/GaussNorm.lean @@ -158,10 +158,10 @@ lemma exists_min_eq_gaussNorm (p : R[X]) (hc : 0 ≤ c) : ∀ j, j < i → v (p.coeff j) * c ^ j < p.gaussNorm v c := by have h_nonempty : {i | gaussNorm v c p = v (p.coeff i) * c ^ i}.Nonempty := by obtain ⟨i, hi⟩ := exists_eq_gaussNorm v c p - exact ⟨i, Set.mem_setOf.mpr hi⟩ + exact ⟨i, Set.mem_ofPred.mpr hi⟩ refine ⟨Nat.find h_nonempty, Nat.find_spec h_nonempty, ?_⟩ intro j hj_lt - simp only [Nat.lt_find_iff, Set.mem_setOf_eq] at hj_lt + simp only [Nat.lt_find_iff, Set.mem_ofPred_eq] at hj_lt exact lt_of_le_of_ne (le_gaussNorm v _ hc j) fun a ↦ hj_lt j (Nat.le_refl j) a.symm /-- If `v` is a nonnegative nonarchimedean function with `v 0 = 0` and `c` is nonnegative, the diff --git a/Mathlib/RingTheory/Polynomial/HilbertPoly.lean b/Mathlib/RingTheory/Polynomial/HilbertPoly.lean index 5eb64277585043..90e7094936dae5 100644 --- a/Mathlib/RingTheory/Polynomial/HilbertPoly.lean +++ b/Mathlib/RingTheory/Polynomial/HilbertPoly.lean @@ -202,7 +202,7 @@ theorem existsUnique_hilbertPoly (p : F[X]) (d : ℕ) : apply eq_of_infinite_eval_eq h (hilbertPoly p d) apply ((Set.Ioi_infinite (max N p.natDegree)).image cast_injective.injOn).mono rintro x ⟨n, hn, rfl⟩ - simp only [Set.mem_Ioi, sup_lt_iff, Set.mem_setOf_eq] at hn ⊢ + simp only [Set.mem_Ioi, sup_lt_iff, Set.mem_ofPred_eq] at hn ⊢ rw [← coeff_mul_invOneSubPow_eq_hilbertPoly_eval d hn.2, hhN n hn.1] /-- diff --git a/Mathlib/RingTheory/PolynomialLaw/Basic.lean b/Mathlib/RingTheory/PolynomialLaw/Basic.lean index 1a1843e362c313..9066f46c4837f2 100644 --- a/Mathlib/RingTheory/PolynomialLaw/Basic.lean +++ b/Mathlib/RingTheory/PolynomialLaw/Basic.lean @@ -315,7 +315,7 @@ theorem range_φ (s : Finset S) : (φ R s).range = Algebra.adjoin R s := by rw [← Algebra.adjoin_range_eq_range_aeval] congr rw [← Function.comp_def, Set.range_comp] - simp only [Equiv.range_eq_univ, Set.image_univ, Subtype.range_coe_subtype, Finset.setOf_mem] + simp only [Equiv.range_eq_univ, Set.image_univ, Subtype.range_coe_subtype, Finset.setOfPred_mem] variable (S) diff --git a/Mathlib/RingTheory/PowerSeries/Restricted.lean b/Mathlib/RingTheory/PowerSeries/Restricted.lean index 195cbe963fc699..aa9376d8e9906e 100644 --- a/Mathlib/RingTheory/PowerSeries/Restricted.lean +++ b/Mathlib/RingTheory/PowerSeries/Restricted.lean @@ -100,7 +100,7 @@ lemma convergenceSet_BddAbove {f : PowerSeries R} (hf : IsRestricted c f) : obtain ⟨N, hf⟩ := by simpa using (hf 1) rw [bddAbove_def, convergenceSet] use max 1 (max' (image (fun i ↦ ‖coeff i f‖ * c ^ i) (range (N + 1))) (by simp)) - simp only [Set.mem_setOf_eq, le_sup_iff, forall_exists_index, forall_apply_eq_imp_iff] + simp only [Set.mem_ofPred_eq, le_sup_iff, forall_exists_index, forall_apply_eq_imp_iff] intro i rcases le_total i N with h | h · right @@ -121,7 +121,7 @@ lemma mul {f g : PowerSeries R} (hf : IsRestricted c f) (hg : IsRestricted c g) ((isRestricted_iff_abs c f).mp hf)) obtain ⟨b, hb, gBound1⟩ := (bddAbove_iff_exists_ge 1).mp (convergenceSet_BddAbove _ ((isRestricted_iff_abs c g).mp hg)) - simp only [convergenceSet, Set.mem_setOf_eq, forall_exists_index, forall_apply_eq_imp_iff] + simp only [convergenceSet, Set.mem_ofPred_eq, forall_exists_index, forall_apply_eq_imp_iff] at fBound1 gBound1 simp only [isRestricted_iff, norm_mul, norm_pow, Real.norm_eq_abs, abs_norm, PowerSeries.coeff_mul] at ⊢ hf hg diff --git a/Mathlib/RingTheory/PowerSeries/Substitution.lean b/Mathlib/RingTheory/PowerSeries/Substitution.lean index 594ec0f9357e8b..0b4a706f14ee28 100644 --- a/Mathlib/RingTheory/PowerSeries/Substitution.lean +++ b/Mathlib/RingTheory/PowerSeries/Substitution.lean @@ -124,7 +124,7 @@ theorem HasSubst.smul (r : MvPowerSeries τ S) {a : MvPowerSeries τ S} (ha : Ha /-- Families of `PowerSeries` that can be substituted, as an `Ideal`. -/ noncomputable def HasSubst.ideal : Ideal (MvPowerSeries τ S) where - carrier := setOf HasSubst + carrier := Set.ofPred HasSubst add_mem' := HasSubst.add zero_mem' := HasSubst.zero smul_mem' := HasSubst.smul diff --git a/Mathlib/RingTheory/PrincipalIdealDomain.lean b/Mathlib/RingTheory/PrincipalIdealDomain.lean index a06cd2ff1b50bb..636e73bc5bfbbc 100644 --- a/Mathlib/RingTheory/PrincipalIdealDomain.lean +++ b/Mathlib/RingTheory/PrincipalIdealDomain.lean @@ -299,7 +299,7 @@ instance (priority := 100) EuclideanDomain.to_principal_ideal_domain : IsPrincip { x : R | x ∈ S ∧ x ≠ 0 } := fun h₁ => WellFounded.not_lt_min wf _ h₁ (mod_lt x hmin.2) have : x % WellFounded.min wf { x : R | x ∈ S ∧ x ≠ 0 } h = 0 := by - simp only [not_and_or, Set.mem_setOf_eq, not_ne_iff] at this + simp only [not_and_or, Set.mem_ofPred_eq, not_ne_iff] at this exact this.neg_resolve_left <| (mod_mem_iff hmin.1).2 hx simp [*]), fun hx => diff --git a/Mathlib/RingTheory/Regular/IsSMulRegular.lean b/Mathlib/RingTheory/Regular/IsSMulRegular.lean index ce1fd7f8a89024..022f7499de6751 100644 --- a/Mathlib/RingTheory/Regular/IsSMulRegular.lean +++ b/Mathlib/RingTheory/Regular/IsSMulRegular.lean @@ -124,7 +124,7 @@ variable (R) in lemma biUnion_associatedPrimes_eq_compl_regular [IsNoetherianRing R] : ⋃ p ∈ associatedPrimes R M, p = { r : R | IsSMulRegular M r }ᶜ := Eq.trans (biUnion_associatedPrimes_eq_zero_divisors R M) <| by - simp_rw [Set.compl_setOf, isSMulRegular_iff_right_eq_zero_of_smul, + simp_rw [Set.compl_ofPred, isSMulRegular_iff_right_eq_zero_of_smul, not_forall, exists_prop, and_comm] lemma isSMulRegular_iff_ker_lsmul_eq_bot : diff --git a/Mathlib/RingTheory/Regular/RegularSequence.lean b/Mathlib/RingTheory/Regular/RegularSequence.lean index 8b2559f6416cda..267bee9ea195c4 100644 --- a/Mathlib/RingTheory/Regular/RegularSequence.lean +++ b/Mathlib/RingTheory/Regular/RegularSequence.lean @@ -684,6 +684,7 @@ lemma RingTheory.Sequence.IsRegular.of_isWeaklyRegular_of_mem_maximalIdeal {rs : (mem : ∀ r ∈ rs, r ∈ maximalIdeal R) (reg : IsWeaklyRegular L rs) : IsRegular L rs := ⟨reg, Submodule.top_ne_ideal_smul_of_le_jacobson_annihilator - ((Ideal.span_le.mpr mem).trans (maximalIdeal_le_jacobson _))⟩ + (((Ideal.span_le (s := {r | r ∈ rs})).mpr fun r hr => mem r hr).trans + (maximalIdeal_le_jacobson _))⟩ end IsLocalRing diff --git a/Mathlib/RingTheory/RingHom/Locally.lean b/Mathlib/RingTheory/RingHom/Locally.lean index cc1a4f61fe5336..11e013277c7a48 100644 --- a/Mathlib/RingTheory/RingHom/Locally.lean +++ b/Mathlib/RingTheory/RingHom/Locally.lean @@ -298,7 +298,7 @@ lemma locally_isStableUnderBaseChange (hPi : RespectsIso P) (hPb : IsStableUnder ← hf.span_eq_top, Ideal.map_le_iff_le_comap, Ideal.span_le] intro g hg apply Ideal.subset_span - simp only [Set.mem_setOf_eq, Algebra.TensorProduct.includeRight_apply, + simp only [Set.mem_ofPred_eq, Algebra.TensorProduct.includeRight_apply, ← IsScalarTower.algebraMap_eq] at hg ⊢ let e := IsLocalization.Away.tensorProductEquivTMulRight R S g (Localization.Away g) rw [← e.toAlgHom.comp_algebraMap] diff --git a/Mathlib/RingTheory/RootsOfUnity/Basic.lean b/Mathlib/RingTheory/RootsOfUnity/Basic.lean index cd6d861a10e498..73a14ab422640d 100644 --- a/Mathlib/RingTheory/RootsOfUnity/Basic.lean +++ b/Mathlib/RingTheory/RootsOfUnity/Basic.lean @@ -56,8 +56,8 @@ variable {k l : ℕ} def rootsOfUnity (k : ℕ) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ k = 1} one_mem' := one_pow _ - mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] - inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] + mul_mem' _ _ := by simp_all only [Set.mem_ofPred_eq, mul_pow, one_mul] + inv_mem' _ := by simp_all only [Set.mem_ofPred_eq, inv_pow, inv_one] @[simp] theorem mem_rootsOfUnity (k : ℕ) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ k = 1 := diff --git a/Mathlib/RingTheory/Smooth/NoetherianDescent.lean b/Mathlib/RingTheory/Smooth/NoetherianDescent.lean index 65ffbc4d7bab00..cfb55c3b9e35a0 100644 --- a/Mathlib/RingTheory/Smooth/NoetherianDescent.lean +++ b/Mathlib/RingTheory/Smooth/NoetherianDescent.lean @@ -51,20 +51,24 @@ variable (D : DescentAux A B) variable (R) /-- (Implementation detail): The finite type `R`-algebra. -/ -def subalgebra (D : DescentAux A B) : Subalgebra R A := +noncomputable def subalgebra (D : DescentAux A B) : Subalgebra R A := Algebra.adjoin R (D.P.coeffs ∪ ((⋃ i, (D.h i).coeffs) ∪ (⋃ i, ⋃ x ∈ (D.q i).coeffs, x.coeffs) ∪ (⋃ i, ⋃ x ∈ (D.p i).coeffs, x.coeffs)) : Set A) -instance : CommRing (D.subalgebra R) := inferInstanceAs <| CommRing (Algebra.adjoin _ _) +noncomputable instance : CommRing (D.subalgebra R) := + inferInstanceAs <| CommRing (Algebra.adjoin _ _) -instance algebra₀ : Algebra R (D.subalgebra R) := inferInstanceAs <| Algebra R (Algebra.adjoin _ _) +noncomputable instance algebra₀ : Algebra R (D.subalgebra R) := + inferInstanceAs <| Algebra R (Algebra.adjoin _ _) -instance algebra₁ : Algebra (D.subalgebra R) A := inferInstanceAs <| Algebra (Algebra.adjoin _ _) A +noncomputable instance algebra₁ : Algebra (D.subalgebra R) A := + inferInstanceAs <| Algebra (Algebra.adjoin _ _) A -instance algebra₂ : Algebra (D.subalgebra R) B := inferInstanceAs <| Algebra (Algebra.adjoin _ _) B +noncomputable instance algebra₂ : Algebra (D.subalgebra R) B := + inferInstanceAs <| Algebra (Algebra.adjoin _ _) B instance : IsScalarTower (D.subalgebra R) A B := inferInstanceAs <| IsScalarTower (Algebra.adjoin _ _) _ _ diff --git a/Mathlib/RingTheory/Spectrum/Maximal/Basic.lean b/Mathlib/RingTheory/Spectrum/Maximal/Basic.lean index 4f5720b20f0226..8da57cb5a6041b 100644 --- a/Mathlib/RingTheory/Spectrum/Maximal/Basic.lean +++ b/Mathlib/RingTheory/Spectrum/Maximal/Basic.lean @@ -31,8 +31,8 @@ def equivSubtype : MaximalSpectrum R ≃ {I : Ideal R // I.IsMaximal} where theorem range_asIdeal : Set.range MaximalSpectrum.asIdeal = {J : Ideal R | J.IsMaximal} := Set.ext fun J ↦ - ⟨fun hJ ↦ let ⟨j, hj⟩ := Set.mem_range.mp hJ; Set.mem_setOf.mpr <| hj ▸ j.isMaximal, - fun hJ ↦ Set.mem_range.mpr ⟨⟨J, Set.mem_setOf.mp hJ⟩, rfl⟩⟩ + ⟨fun hJ ↦ let ⟨j, hj⟩ := Set.mem_range.mp hJ; Set.mem_ofPred.mpr <| hj ▸ j.isMaximal, + fun hJ ↦ Set.mem_range.mpr ⟨⟨J, Set.mem_ofPred.mp hJ⟩, rfl⟩⟩ variable {R} diff --git a/Mathlib/RingTheory/Spectrum/Prime/Basic.lean b/Mathlib/RingTheory/Spectrum/Prime/Basic.lean index 645de1ee070a05..fe03757b253645 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Basic.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Basic.lean @@ -85,8 +85,8 @@ variable (R S) theorem range_asIdeal : Set.range PrimeSpectrum.asIdeal = {J : Ideal R | J.IsPrime} := Set.ext fun J ↦ - ⟨fun hJ ↦ let ⟨j, hj⟩ := Set.mem_range.mp hJ; Set.mem_setOf.mpr <| hj ▸ j.isPrime, - fun hJ ↦ Set.mem_range.mpr ⟨⟨J, Set.mem_setOf.mp hJ⟩, rfl⟩⟩ + ⟨fun hJ ↦ let ⟨j, hj⟩ := Set.mem_range.mp hJ; Set.mem_ofPred.mpr <| hj ▸ j.isPrime, + fun hJ ↦ Set.mem_range.mpr ⟨⟨J, Set.mem_ofPred.mp hJ⟩, rfl⟩⟩ /-- The map from the direct sum of prime spectra to the prime spectrum of a direct product. -/ @[simp] @@ -166,7 +166,7 @@ theorem coe_vanishingIdeal (t : Set (PrimeSpectrum R)) : theorem mem_vanishingIdeal (t : Set (PrimeSpectrum R)) (f : R) : f ∈ vanishingIdeal t ↔ ∀ x ∈ t, f ∈ x.asIdeal := by - rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq] + rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_ofPred_eq] @[simp] theorem vanishingIdeal_singleton (x : PrimeSpectrum R) : diff --git a/Mathlib/RingTheory/Spectrum/Prime/IsOpenComapC.lean b/Mathlib/RingTheory/Spectrum/Prime/IsOpenComapC.lean index 6d285194ff4884..a5113def61ae25 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/IsOpenComapC.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/IsOpenComapC.lean @@ -36,7 +36,7 @@ def imageOfDf (f : R[X]) : Set (PrimeSpectrum R) := { p : PrimeSpectrum R | ∃ i : ℕ, coeff f i ∉ p.asIdeal } theorem isOpen_imageOfDf : IsOpen (imageOfDf f) := by - rw [imageOfDf, setOf_exists fun i (x : PrimeSpectrum R) => coeff f i ∉ x.asIdeal] + rw [imageOfDf, ofPred_exists fun i (x : PrimeSpectrum R) => coeff f i ∉ x.asIdeal] exact isOpen_iUnion fun i => isOpen_basicOpen /-- If a point of `Spec R[x]` is not contained in the vanishing set of `f`, then its image in diff --git a/Mathlib/RingTheory/Spectrum/Prime/Jacobson.lean b/Mathlib/RingTheory/Spectrum/Prime/Jacobson.lean index 8435f122bc27d5..bc04095a3fdbe7 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Jacobson.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Jacobson.lean @@ -93,9 +93,9 @@ lemma isOpen_singleton_tfae_of_isNoetherian_of_isJacobsonRing suffices {x} = (⋃ p ∈ { p : PrimeSpectrum R | IsMin p ∧ p ≠ x }, closure {p})ᶜ by rw [this, isOpen_compl_iff] refine Set.Finite.isClosed_biUnion ?_ (fun _ _ ↦ isClosed_closure) - exact (finite_setOf_isMin R).subset fun x h ↦ h.1 + exact (finite_setOfPred_isMin R).subset fun x h ↦ h.1 ext p - simp only [Set.mem_singleton_iff, ne_eq, Set.mem_setOf_eq, Set.compl_iUnion, Set.mem_iInter, + simp only [Set.mem_singleton_iff, ne_eq, Set.mem_ofPred_eq, Set.compl_iUnion, Set.mem_iInter, Set.mem_compl_iff, and_imp, ← specializes_iff_mem_closure, ← le_iff_specializes, not_imp_not] constructor diff --git a/Mathlib/RingTheory/Spectrum/Prime/Noetherian.lean b/Mathlib/RingTheory/Spectrum/Prime/Noetherian.lean index e24cb019939470..44c6d91919cee7 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Noetherian.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Noetherian.lean @@ -30,13 +30,15 @@ variable (R : Type u) [CommSemiring R] [IsNoetherianRing R] instance : NoetherianSpace (PrimeSpectrum R) := ((noetherianSpace_TFAE <| PrimeSpectrum R).out 0 1).mpr (closedsEmbedding R).dual.wellFoundedLT -lemma finite_setOf_isMin : +lemma finite_setOfPred_isMin : {x : PrimeSpectrum R | IsMin x}.Finite := by have : Function.Injective (asIdeal (R := R)) := @PrimeSpectrum.ext _ _ refine Set.Finite.of_finite_image (f := asIdeal) ?_ this.injOn simp_rw [isMin_iff] exact (minimalPrimes.finite_of_isNoetherianRing R).subset (Set.image_preimage_subset _ _) +@[deprecated (since := "2026-07-09")] alias finite_setOf_isMin := finite_setOfPred_isMin + end IsNoetherianRing end PrimeSpectrum diff --git a/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean b/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean index d8ec4669009cfa..f32068b94d1b51 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Polynomial.lean @@ -94,7 +94,7 @@ lemma mem_image_comap_zeroLocus_sdiff (f : A) (s : Set A) (x) : exact hqf this · intro H rw [← mem_nilradical, nilradical_eq_sInf, Ideal.mem_sInf] at H - simp only [Set.mem_setOf_eq, Algebra.TensorProduct.algebraMap_apply, + simp only [Set.mem_ofPred_eq, Algebra.TensorProduct.algebraMap_apply, Ideal.Quotient.algebraMap_eq, not_forall] at H obtain ⟨q, hq, hfq⟩ := H have : ∀ a ∈ s, Ideal.Quotient.mk (Ideal.span s) a ⊗ₜ[R] 1 ∈ q := fun a ha ↦ by diff --git a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean index 6a73b5aede0902..7b380368bf49ec 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean @@ -309,7 +309,7 @@ theorem discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical : letI s := {I : Ideal R | I.IsMaximal} DiscreteTopology (PrimeSpectrum R) ↔ Finite s ∧ sInf s ≤ nilradical R := by rw [discreteTopology_iff_finite_and_krullDimLE_zero, Ring.krullDimLE_zero_iff, - (equivSubtype R).finite_iff, ← Set.coe_setOf, Set.finite_coe_iff, Set.finite_coe_iff] + (equivSubtype R).finite_iff, ← Set.coe_ofPred, Set.finite_coe_iff, Set.finite_coe_iff] refine ⟨fun h ↦ ⟨h.1.subset fun _ h ↦ h.isPrime, nilradical_eq_sInf R ▸ sInf_le_sInf h.2⟩, fun ⟨fin, le⟩ ↦ ?_⟩ have hpm (I : Ideal R) (hI : I.IsPrime) : I.IsMaximal := by @@ -601,7 +601,7 @@ theorem localization_away_comap_range (S : Type v) [CommSemiring S] [Algebra R S [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by rw [localization_comap_range S (Submonoid.powers r)] ext x - simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq, + simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_ofPred_eq, Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le] constructor · intro h₁ h₂ @@ -939,7 +939,7 @@ lemma vanishingIdeal_range_comap : ext x rw [RingHom.ker_eq_comap_bot, ← Ideal.comap_radical, Ideal.radical_eq_sInf] simp only [mem_vanishingIdeal, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff, - comap_asIdeal, Ideal.mem_comap, bot_le, true_and, Submodule.mem_sInf, Set.mem_setOf_eq] + comap_asIdeal, Ideal.mem_comap, bot_le, true_and, Submodule.mem_sInf, Set.mem_ofPred_eq] exact ⟨fun H I hI ↦ H ⟨I, hI⟩, fun H I ↦ H I.1 I.2⟩ lemma closure_range_comap : @@ -958,7 +958,7 @@ lemma denseRange_comap_iff_minimalPrimes : · intro H I hI have : I ∈ (RingHom.ker f).minimalPrimes := by rw [denseRange_comap_iff_ker_le_nilRadical] at H - simp only [Set.mem_setOf, Ideal.IsMinimalPrime] at hI ⊢ + simp only [Set.mem_ofPred, Ideal.IsMinimalPrime] at hI ⊢ convert! hI using 2 with p exact ⟨fun h ↦ ⟨h.1, bot_le⟩, fun h ↦ ⟨h.1, H.trans (h.1.radical_le_iff.mpr bot_le)⟩⟩ obtain ⟨p, hp, _, rfl⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f (I := ⊥) I this @@ -1249,9 +1249,10 @@ protected def _root_.Ideal.minimalPrimes.equivIrreducibleComponents (I : Ideal R let e : {p : Ideal R | p.IsPrime ∧ I ≤ p} ≃o zeroLocus (I : Set R) := ⟨⟨fun x ↦ ⟨⟨x.1, x.2.1⟩, x.2.2⟩, fun x ↦ ⟨x.1.1, x.1.2, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩, .rfl⟩ rw [irreducibleComponents_eq_maximals_closed] - exact OrderIso.setOfMinimalIsoSetOfMaximal + exact OrderIso.setOfPredMinimalIsoSetOfPredMaximal (e.trans ((PrimeSpectrum.zeroLocusEquivIrreducibleCloseds (I : Set R)).trans - (TopologicalSpace.IrreducibleCloseds.orderIsoSubtype' (zeroLocus (I : Set R))).dual)) + (TopologicalSpace.IrreducibleCloseds.orderIsoSubtype' (zeroLocus (I : Set R))).dual) : + _ ≃o (↥{x | IsClosed x ∧ IsIrreducible x})ᵒᵈ) variable (R) @@ -1263,15 +1264,16 @@ protected def _root_.minimalPrimes.equivIrreducibleComponents : let e : {p : Ideal R | p.IsPrime ∧ ⊥ ≤ p} ≃o PrimeSpectrum R := ⟨⟨fun x ↦ ⟨x.1, x.2.1⟩, fun x ↦ ⟨x.1, x.2, bot_le⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩, Iff.rfl⟩ rw [irreducibleComponents_eq_maximals_closed] - exact OrderIso.setOfMinimalIsoSetOfMaximal + exact OrderIso.setOfPredMinimalIsoSetOfPredMaximal (e.trans ((PrimeSpectrum.pointsEquivIrreducibleCloseds R).trans - (TopologicalSpace.IrreducibleCloseds.orderIsoSubtype' (PrimeSpectrum R)).dual)) + (TopologicalSpace.IrreducibleCloseds.orderIsoSubtype' (PrimeSpectrum R)).dual) : + _ ≃o (↥{x | IsClosed x ∧ IsIrreducible x})ᵒᵈ) lemma vanishingIdeal_irreducibleComponents : vanishingIdeal '' (irreducibleComponents <| PrimeSpectrum R) = minimalPrimes R := by rw [irreducibleComponents_eq_maximals_closed, minimalPrimes_eq_minimals, - image_antitone_setOf_maximal (fun s t hs _ ↦ (vanishingIdeal_anti_mono_iff hs.1).symm), - ← funext (@Set.mem_setOf_eq _ · Ideal.IsPrime), ← vanishingIdeal_isClosed_isIrreducible] + image_antitone_setOfPred_maximal (fun s t hs _ ↦ (vanishingIdeal_anti_mono_iff hs.1).symm), + ← funext (@Set.mem_ofPred_eq _ · Ideal.IsPrime), ← vanishingIdeal_isClosed_isIrreducible] rfl lemma zeroLocus_minimalPrimes : diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/Ideal.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/Ideal.lean index 4a392091aa3b51..5ee05cff6207dd 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/Ideal.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/Ideal.lean @@ -12,7 +12,8 @@ public import Mathlib.RingTheory.UniqueFactorizationDomain.Defs # Unique factorization and ascending chain condition on ideals ## Main results -* `Ideal.setOf_isPrincipal_wellFoundedOn_gt`, `WfDvdMonoid.of_setOf_isPrincipal_wellFoundedOn_gt` +* `Ideal.setOfPred_isPrincipal_wellFoundedOn_gt`, + `WfDvdMonoid.of_setOfPred_isPrincipal_wellFoundedOn_gt` in a domain, well-foundedness of the strict version of ∣ is equivalent to the ascending chain condition on principal ideals. -/ @@ -38,7 +39,7 @@ theorem Ideal.IsPrime.exists_mem_prime_of_ne_bot {R : Type*} [CommSemiring R] section Ideal /-- The ascending chain condition on principal ideals holds in a `WfDvdMonoid` domain. -/ -lemma Ideal.setOf_isPrincipal_wellFoundedOn_gt [CommSemiring α] [WfDvdMonoid α] [IsDomain α] : +lemma Ideal.setOfPred_isPrincipal_wellFoundedOn_gt [CommSemiring α] [WfDvdMonoid α] [IsDomain α] : {I : Ideal α | I.IsPrincipal}.WellFoundedOn (· > ·) := by have : {I : Ideal α | I.IsPrincipal} = ((fun a ↦ Ideal.span {a}) '' Set.univ) := by ext @@ -48,9 +49,12 @@ lemma Ideal.setOf_isPrincipal_wellFoundedOn_gt [CommSemiring α] [WfDvdMonoid α ext exact Ideal.span_singleton_lt_span_singleton +@[deprecated (since := "2026-07-09")] +alias Ideal.setOf_isPrincipal_wellFoundedOn_gt := Ideal.setOfPred_isPrincipal_wellFoundedOn_gt + /-- The ascending chain condition on principal ideals in a domain is sufficient to prove that the domain is `WfDvdMonoid`. -/ -lemma WfDvdMonoid.of_setOf_isPrincipal_wellFoundedOn_gt [CommSemiring α] [IsDomain α] +lemma WfDvdMonoid.of_setOfPred_isPrincipal_wellFoundedOn_gt [CommSemiring α] [IsDomain α] (h : {I : Ideal α | I.IsPrincipal}.WellFoundedOn (· > ·)) : WfDvdMonoid α := by have : WellFounded (α := {I : Ideal α // I.IsPrincipal}) (· > ·) := h @@ -59,4 +63,8 @@ lemma WfDvdMonoid.of_setOf_isPrincipal_wellFoundedOn_gt [CommSemiring α] [IsDom ext exact Ideal.span_singleton_lt_span_singleton.symm +@[deprecated (since := "2026-07-09")] +alias WfDvdMonoid.of_setOf_isPrincipal_wellFoundedOn_gt := + WfDvdMonoid.of_setOfPred_isPrincipal_wellFoundedOn_gt + end Ideal diff --git a/Mathlib/RingTheory/Valuation/Archimedean.lean b/Mathlib/RingTheory/Valuation/Archimedean.lean index 12619adbed5d70..aef4fee0cc104f 100644 --- a/Mathlib/RingTheory/Valuation/Archimedean.lean +++ b/Mathlib/RingTheory/Valuation/Archimedean.lean @@ -48,19 +48,20 @@ lemma wellFounded_gt_on_v_iff_discrete_mrange [Nontrivial (MonoidHom.mrange v)ˣ (hv : Integers v O) : WellFounded ((· > ·) on (v ∘ algebraMap O F)) ↔ Nonempty (MonoidHom.mrange v ≃*o ℤᵐ⁰) := by - rw [← LinearOrderedCommGroupWithZero.wellFoundedOn_setOf_ge_gt_iff_nonempty_discrete_of_ne_zero + rw [← + LinearOrderedCommGroupWithZero.wellFoundedOn_setOfPred_ge_gt_iff_nonempty_discrete_of_ne_zero one_ne_zero, ← Set.wellFoundedOn_range] classical refine ⟨fun h ↦ (h.mapsTo Subtype.val ?_).mono' (by simp), fun h ↦ (h.mapsTo ?_ ?_).mono' ?_⟩ · rintro ⟨_, x, rfl⟩ - simp only [← Subtype.coe_le_coe, OneMemClass.coe_one, Set.mem_setOf_eq, Set.mem_range, + simp only [← Subtype.coe_le_coe, OneMemClass.coe_one, Set.mem_ofPred_eq, Set.mem_range, Function.comp_apply] intro hx obtain ⟨y, rfl⟩ := hv.exists_of_le_one hx exact ⟨y, by simp⟩ · exact fun x ↦ if hx : x ∈ MonoidHom.mrange v then ⟨x, hx⟩ else 1 · intro - simp only [Set.mem_range, Function.comp_apply, MonoidHom.mem_mrange, Set.mem_setOf_eq, + simp only [Set.mem_range, Function.comp_apply, MonoidHom.mem_mrange, Set.mem_ofPred_eq, forall_exists_index] rintro x rfl simp [← Subtype.coe_le_coe, hv.map_le_one] diff --git a/Mathlib/RingTheory/Valuation/Basic.lean b/Mathlib/RingTheory/Valuation/Basic.lean index a669fb8572cbfd..e27dc3d60988f7 100644 --- a/Mathlib/RingTheory/Valuation/Basic.lean +++ b/Mathlib/RingTheory/Valuation/Basic.lean @@ -444,7 +444,7 @@ def leAddSubgroup (v : Valuation R Γ₀) (γ : Γ₀) : AddSubgroup R where carrier := { x | v x ≤ γ } zero_mem' := by simp add_mem' {x y} x_in y_in := (v.map_add x y).trans (max_le x_in y_in) - neg_mem' x_in := by rwa [Set.mem_setOf, map_neg] + neg_mem' x_in := by rwa [Set.mem_ofPred, map_neg] @[simp] lemma mem_leAddSubgroup_iff {v : Valuation R Γ₀} {γ : Γ₀} {x : R} : @@ -555,7 +555,7 @@ lemma IsEquiv.restrict {Γ₀' : Type*} [LinearOrderedCommGroupWithZero Γ₀'] carrier := { x | v x < γ } zero_mem' := by simp add_mem' {x y} x_in y_in := lt_of_le_of_lt (v.map_add x y) (max_lt x_in y_in) - neg_mem' x_in := by rwa [Set.mem_setOf, map_neg] + neg_mem' x_in := by rwa [Set.mem_ofPred, map_neg] @[simp] lemma mem_ltAddSubgroup_iff {v : Valuation R Γ₀} {γ x} : x ∈ ltAddSubgroup v γ ↔ v x < γ := diff --git a/Mathlib/RingTheory/Valuation/Integers.lean b/Mathlib/RingTheory/Valuation/Integers.lean index baee5b9d6767c1..bf8ea0fafa9f68 100644 --- a/Mathlib/RingTheory/Valuation/Integers.lean +++ b/Mathlib/RingTheory/Valuation/Integers.lean @@ -32,10 +32,10 @@ variable (v : Valuation R Γ₀) def integer : Subring R where carrier := { x | v x ≤ 1 } one_mem' := le_of_eq v.map_one - mul_mem' {x y} hx hy := by simp only [Set.mem_setOf_eq, map_mul, mul_le_one' hx hy] + mul_mem' {x y} hx hy := by simp only [Set.mem_ofPred_eq, map_mul, mul_le_one' hx hy] zero_mem' := by simp add_mem' {x y} hx hy := le_trans (v.map_add x y) (max_le hx hy) - neg_mem' {x} hx := by simp only [Set.mem_setOf_eq] at hx; simpa only [Set.mem_setOf_eq, map_neg] + neg_mem' {x} hx := by simp only [Set.mem_ofPred_eq] at hx; simpa only [Set.mem_ofPred_eq, map_neg] lemma mem_integer_iff (r : R) : r ∈ v.integer ↔ v r ≤ 1 := by rfl @@ -198,13 +198,16 @@ theorem eq_algebraMap_or_inv_eq_algebraMap (hv : Integers v O) (x : F) : obtain ⟨a, ha⟩ := exists_of_le_one hv h exacts [⟨a, Or.inl ha.symm⟩, ⟨a, Or.inr ha.symm⟩] -lemma coe_span_singleton_eq_setOf_le_v_algebraMap (hv : Integers v O) (x : O) : +lemma coe_span_singleton_eq_setOfPred_le_v_algebraMap (hv : Integers v O) (x : O) : (Ideal.span {x} : Set O) = {y : O | v (algebraMap O F y) ≤ v (algebraMap O F x)} := by rcases eq_or_ne x 0 with rfl | hx · simp [Set.singleton_zero, map_eq_zero_iff _ hv.hom_inj] ext simp [SetLike.mem_coe, Ideal.mem_span_singleton, hv.dvd_iff_le] +@[deprecated (since := "2026-07-09")] +alias coe_span_singleton_eq_setOf_le_v_algebraMap := coe_span_singleton_eq_setOfPred_le_v_algebraMap + lemma bijective_algebraMap_of_subsingleton_units_mrange (hv : Integers v O) [Subsingleton (MonoidHom.mrange v)ˣ] : Function.Bijective (algebraMap O F) := by @@ -231,14 +234,14 @@ lemma isPrincipal_iff_exists_isGreatest (hv : Integers v O) {I : Ideal O} : simp only [Ideal.submodule_span_eq, Ideal.mem_span_singleton] exact ⟨fun hb ↦ dvd_of_le hv (hx.2 <| mem_image_of_mem _ hb), fun hb ↦ I.mem_of_dvd hb ha⟩ -lemma isPrincipal_iff_exists_eq_setOf_valuation_le (hv : Integers v O) {I : Ideal O} : +lemma isPrincipal_iff_exists_eq_setOfPred_valuation_le (hv : Integers v O) {I : Ideal O} : I.IsPrincipal ↔ ∃ x, (I : Set O) = {y | v (algebraMap O F y) ≤ v (algebraMap O F x)} := by rw [isPrincipal_iff_exists_isGreatest hv] constructor <;> rintro ⟨x, hx⟩ · obtain ⟨a, ha, rfl⟩ : ∃ a ∈ I, (v ∘ algebraMap O F) a = x := by simpa using hx.left refine ⟨a, ?_⟩ ext b - simp only [SetLike.mem_coe, mem_setOf_eq] + simp only [SetLike.mem_coe, mem_ofPred_eq] constructor <;> intro h · exact hx.right (Set.mem_image_of_mem _ h) · rw [le_iff_dvd hv] at h @@ -247,6 +250,10 @@ lemma isPrincipal_iff_exists_eq_setOf_valuation_le (hv : Integers v O) {I : Idea · simp [hx] · simp [hx, mem_upperBounds] +@[deprecated (since := "2026-07-09")] +alias isPrincipal_iff_exists_eq_setOf_valuation_le := + isPrincipal_iff_exists_eq_setOfPred_valuation_le + lemma not_denselyOrdered_of_isPrincipalIdealRing [IsPrincipalIdealRing O] (hv : Integers v O) : ¬ DenselyOrdered (range v) := by intro H @@ -289,9 +296,12 @@ lemma v_irreducible_lt_one {ϖ : v.integer} (h : Irreducible ϖ) : lemma v_irreducible_pos {ϖ : v.integer} (h : Irreducible ϖ) : 0 < v ϖ := (Valuation.integer.integers v).valuation_irreducible_pos h -lemma coe_span_singleton_eq_setOf_le_v_coe (x : v.integer) : +lemma coe_span_singleton_eq_setOfPred_le_v_coe (x : v.integer) : (Ideal.span {x} : Set v.integer) = {y : v.integer | v y ≤ v x} := - (Valuation.integer.integers v).coe_span_singleton_eq_setOf_le_v_algebraMap x + (Valuation.integer.integers v).coe_span_singleton_eq_setOfPred_le_v_algebraMap x + +@[deprecated (since := "2026-07-09")] +alias coe_span_singleton_eq_setOf_le_v_coe := coe_span_singleton_eq_setOfPred_le_v_coe end integer diff --git a/Mathlib/RingTheory/Valuation/ValuationSubring.lean b/Mathlib/RingTheory/Valuation/ValuationSubring.lean index cf0ce5bbf3e112..aa883d6b895dbd 100644 --- a/Mathlib/RingTheory/Valuation/ValuationSubring.lean +++ b/Mathlib/RingTheory/Valuation/ValuationSubring.lean @@ -553,7 +553,7 @@ section nonunits /-- The nonunits of a valuation subring of `K`, as a nonunital subring of `K` -/ def nonunits : NonUnitalSubring K where carrier := {x | A.valuation x < 1} - mul_mem' ha hb := (mul_lt_mul'' (Set.mem_setOf.mp ha) (Set.mem_setOf.mp hb) + mul_mem' ha hb := (mul_lt_mul'' (Set.mem_ofPred.mp ha) (Set.mem_ofPred.mp hb) zero_le zero_le).trans_eq <| mul_one _ add_mem' ha hb := (A.valuation.map_add ..).trans_lt (max_lt ha hb) zero_mem' := by simp @@ -635,7 +635,7 @@ def principalUnitGroup : Subgroup Kˣ where carrier := {x | A.valuation (x - 1) < 1} mul_mem' := by intro a b ha hb - rw [Set.mem_setOf] at ha hb ⊢ + rw [Set.mem_ofPred] at ha hb ⊢ refine lt_of_le_of_lt ?_ (max_lt hb ha) rw [← one_mul (A.valuation (b - 1)), ← A.valuation.map_one_add_of_lt ha, add_sub_cancel, ← Valuation.map_mul, mul_sub_one, ← sub_add_sub_cancel] diff --git a/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean b/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean index bba4af792f46b6..7a93ca69f21609 100644 --- a/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean +++ b/Mathlib/RingTheory/WittVector/TeichmullerSeries.lean @@ -106,7 +106,7 @@ theorem dvd_sub_sum_teichmuller_iterateFrobeniusEquiv_coeff (x : 𝕎 R) (n : exact teichmuller_mul_pow_coeff_of_ne _ (Ne.intro hb.2).symm · refine fun n ↦ ⟨fun ⟨a, _, ha⟩ ⟨b, _, hb⟩ ↦ ?_⟩ ext - dsimp only [ne_eq, Set.mem_setOf_eq] + dsimp only [ne_eq, Set.mem_ofPred_eq] rw [← Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) ha] exact Not.imp_symm (teichmuller_mul_pow_coeff_of_ne _) hb diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index 3ffc2f0591903c..491c97d1d1aba5 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -180,7 +180,7 @@ theorem range_preOmega : range preOmega = {x | IsInitial x} := range_enumOrd not_bddAbove_isInitial theorem mem_range_preOmega_iff {x : Ordinal} : x ∈ range preOmega ↔ IsInitial x := by - rw [range_preOmega, mem_setOf] + rw [range_preOmega, mem_ofPred] alias ⟨_, IsInitial.mem_range_preOmega⟩ := mem_range_preOmega_iff @@ -272,7 +272,7 @@ theorem range_omega : range omega = {x | ω ≤ x ∧ IsInitial x} := by rw [omega_eq_preOmega, Ordinal.add_sub_cancel_of_le ha'] theorem mem_range_omega_iff {x : Ordinal} : x ∈ range omega ↔ ω ≤ x ∧ IsInitial x := by - rw [range_omega, mem_setOf] + rw [range_omega, mem_ofPred] theorem preOmega_of_omega0_sq_le {o : Ordinal} (ho : ω ^ 2 ≤ o) : preOmega o = ω_ o := by rw [← opow_natCast] at ho diff --git a/Mathlib/SetTheory/Cardinal/Arithmetic.lean b/Mathlib/SetTheory/Cardinal/Arithmetic.lean index 98b12da1d49fa8..2a9b9c59195971 100644 --- a/Mathlib/SetTheory/Cardinal/Arithmetic.lean +++ b/Mathlib/SetTheory/Cardinal/Arithmetic.lean @@ -641,7 +641,7 @@ theorem mk_surjective_eq_zero_iff_lift : contrapose! +distrib rw [lift_mk_le', and_comm] simp_rw [mk_ne_zero_iff, mk_eq_zero_iff, nonempty_coe_sort, - Set.Nonempty, mem_setOf, exists_surjective_iff, nonempty_fun] + Set.Nonempty, mem_ofPred, exists_surjective_iff, nonempty_fun] theorem mk_surjective_eq_zero_iff : #{f : α → β | Surjective f} = 0 ↔ #α < #β ∨ (#α ≠ 0 ∧ #β = 0) := by @@ -808,7 +808,7 @@ theorem mk_bounded_set_le (α : Type u) (c : Cardinal) : theorem mk_bounded_subset_le {α : Type u} (s : Set α) (c : Cardinal.{u}) : #{ t : Set α // t ⊆ s ∧ #t ≤ c } ≤ max #s ℵ₀ ^ c := by refine le_trans ?_ (mk_bounded_set_le s c) - refine ⟨Embedding.codRestrict _ ?_ ?_⟩ + refine ⟨.codRestrict {t : Set s | #t ≤ c} ?_ ?_⟩ · use fun t => (↑) ⁻¹' t.1 rintro ⟨t, ht1, ht2⟩ ⟨t', h1t', h2t'⟩ h apply Subtype.ext diff --git a/Mathlib/SetTheory/Cardinal/Basic.lean b/Mathlib/SetTheory/Cardinal/Basic.lean index b95ae55919b8f8..fb4ffda1f82196 100644 --- a/Mathlib/SetTheory/Cardinal/Basic.lean +++ b/Mathlib/SetTheory/Cardinal/Basic.lean @@ -901,7 +901,7 @@ lemma compl_nonempty_of_mk_lt_mk {S : Set α} (h : #S < #α) : Sᶜ.Nonempty := theorem mk_union_le_aleph0 {α} {P Q : Set α} : #(P ∪ Q : Set α) ≤ ℵ₀ ↔ #P ≤ ℵ₀ ∧ #Q ≤ ℵ₀ := by - simp only [le_aleph0_iff_subtype_countable, setOf_mem_eq, Set.union_def, + simp only [le_aleph0_iff_subtype_countable, ofPred_mem_eq, Set.union_def, ← countable_union] theorem mk_sep (s : Set α) (t : α → Prop) : #({ x ∈ s | t x } : Set α) = #{ x : s | t x.1 } := @@ -1066,6 +1066,6 @@ theorem powerlt_zero {a : Cardinal} : a ^< 0 = 0 := by (minimum excluded value) -/ theorem _root_.WellFounded.cardinalMk_subtype_lt_min_compl_le {r : α → α → Prop} (wf : WellFounded r) {s : Set α} (hs : sᶜ.Nonempty) : #{ x // r x (wf.min sᶜ hs) } ≤ #s := - Cardinal.mk_le_mk_of_subset fun _ ↦ wf.mem_of_lt_min_compl + Cardinal.mk_subtype_le_of_subset fun _ ↦ wf.mem_of_lt_min_compl end Cardinal diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index 2b981eef602627..48a4a15ae9c370 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -157,7 +157,7 @@ theorem exists_ord_cof_eq [LinearOrder α] [WellFoundedLT α] : ∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by obtain ⟨s, hs, hs'⟩ := exists_cof_eq α obtain ⟨r, hr, hr'⟩ := exists_ord_eq s - have ht := hs.trans (isCofinal_setOf_imp_lt r) + have ht := hs.trans (isCofinal_setOfPred_imp_lt r) refine ⟨_, ht, (ord_le.2 (cof_le ht)).antisymm' ?_⟩ rw [← hs', hr', type_le_iff'] refine ⟨.ofMonotone (fun x ↦ ⟨x.1, ?_⟩) fun x y hxy ↦ ?_⟩ @@ -566,8 +566,8 @@ theorem mk_bounded_subset {α : Type*} (h : IsStrongPrelimit #α) {r : α → α have h' : IsStrongLimit #α := ⟨ha, @h⟩ have ha := h'.aleph0_le apply le_antisymm - · have : { s : Set α | Bounded r s } = ⋃ i, 𝒫 { j | r j i } := setOf_exists _ - rw [← coe_setOf, this] + · have : { s : Set α | Bounded r s } = ⋃ i, 𝒫 { j | r j i } := ofPred_exists _ + rw [← coe_ofPred, this] refine mk_iUnion_le_sum_mk.trans ((sum_le_mk_mul_iSup (fun i => #(𝒫 { j | r j i }))).trans ((mul_le_max_of_aleph0_le_left ha).trans ?_)) rw [max_eq_left] diff --git a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean index 99db04260f81fc..3f5aadde9eea93 100644 --- a/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean +++ b/Mathlib/SetTheory/Cardinal/HasCardinalLT.lean @@ -172,7 +172,8 @@ lemma hasCardinalLT_iUnion {ι : Type*} {X : Type*} (S : ι → Set X) {κ : Cardinal} [Fact κ.IsRegular] (hι : HasCardinalLT ι κ) (hS : ∀ i, HasCardinalLT (S i) κ) : HasCardinalLT (⋃ i, S i) κ := by - convert! show HasCardinalLT (setOf ((⨆ i, S i))) κ from hasCardinalLT_subtype_iSup S hι hS + convert! show HasCardinalLT (Subtype (⨆ i, (· ∈ S i))) κ from + hasCardinalLT_subtype_iSup (fun i => (· ∈ S i)) hι hS aesop /-- The particular case of `hasCardinalLT_prod` when all the inputs are in the diff --git a/Mathlib/SetTheory/Cardinal/NatCard.lean b/Mathlib/SetTheory/Cardinal/NatCard.lean index 9ab54e13a093c5..4fac8003f708f4 100644 --- a/Mathlib/SetTheory/Cardinal/NatCard.lean +++ b/Mathlib/SetTheory/Cardinal/NatCard.lean @@ -196,10 +196,10 @@ theorem ecard_lt_ecard (hs : s.Finite) (hsub : s ⊂ t) : ENat.card s < ENat.car sdiff_union_of_subset hsub.subset] exact le_add_of_le_right hle -theorem card_strictMonoOn : StrictMonoOn (α := Set α) (Nat.card ∘ (↑)) (setOf Set.Finite) := +theorem card_strictMonoOn : StrictMonoOn (α := Set α) (Nat.card ∘ (↑)) (Set.ofPred Set.Finite) := fun _ _ _ ↦ card_lt_card -theorem ecard_strictMonoOn : StrictMonoOn (α := Set α) (ENat.card ∘ (↑)) (setOf Set.Finite) := +theorem ecard_strictMonoOn : StrictMonoOn (α := Set α) (ENat.card ∘ (↑)) (Set.ofPred Set.Finite) := fun _ hs _ _ ↦ hs.ecard_lt_ecard theorem eq_of_subset_of_card_le (ht : t.Finite) (hsub : s ⊆ t) (hcard : Nat.card t ≤ Nat.card s) : diff --git a/Mathlib/SetTheory/Cardinal/NatCount.lean b/Mathlib/SetTheory/Cardinal/NatCount.lean index bbbb21f1ae44c5..88b38d96b78aad 100644 --- a/Mathlib/SetTheory/Cardinal/NatCount.lean +++ b/Mathlib/SetTheory/Cardinal/NatCount.lean @@ -27,7 +27,7 @@ theorem count_le_cardinal : (count p n : Cardinal) ≤ Cardinal.mk { k | p k } : exact Cardinal.mk_subtype_mono fun x hx ↦ hx.2 theorem count_le_setENCard : count p n ≤ Set.encard { k | p k } := by - simp only [Set.encard, ENat.card, Set.coe_setOf, Cardinal.natCast_le_toENat] + simp only [Set.encard, ENat.card, Set.coe_ofPred, Cardinal.natCast_le_toENat] exact Nat.count_le_cardinal n theorem count_le_setNCard (h : { k | p k }.Finite) : count p n ≤ Set.ncard { k | p k } := by diff --git a/Mathlib/SetTheory/Cardinal/Order.lean b/Mathlib/SetTheory/Cardinal/Order.lean index 600df08519e708..a3ac18b735f233 100644 --- a/Mathlib/SetTheory/Cardinal/Order.lean +++ b/Mathlib/SetTheory/Cardinal/Order.lean @@ -261,7 +261,7 @@ theorem lift_two : lift.{u, v} 2 = 2 := by simp [← one_add_one_eq_two] @[simp] theorem mk_set {α : Type u} : #(Set α) = 2 ^ #α := by - simp [← mk_congr (Equiv.ofBijective _ Set.setOf_bijective), ← one_add_one_eq_two] + simp [← mk_congr (Equiv.ofBijective _ Set.ofPred_bijective), ← one_add_one_eq_two] /-- A variant of `Cardinal.mk_set` expressed in terms of a `Set` instead of a `Type`. -/ @[simp] @@ -513,7 +513,7 @@ theorem lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le {α : Type u} {β : Type v (Equiv.trans (by rw [Equiv.image_eq_preimage_symm] - simp only [preimage, mem_singleton_iff, ULift.up_inj, mem_setOf_eq, coe_setOf] + simp only [preimage, mem_singleton_iff, ULift.up_inj, mem_ofPred_eq, coe_ofPred] exact Equiv.refl _) Equiv.ulift.symm)).trans_le (hf b) diff --git a/Mathlib/SetTheory/Cardinal/Pigeonhole.lean b/Mathlib/SetTheory/Cardinal/Pigeonhole.lean index 9917abadfcad1c..a984c3e42cd348 100644 --- a/Mathlib/SetTheory/Cardinal/Pigeonhole.lean +++ b/Mathlib/SetTheory/Cardinal/Pigeonhole.lean @@ -60,7 +60,7 @@ theorem infinite_pigeonhole_set {β α : Type u} {s : Set β} (f : s → α) (θ ha.trans (ge_of_eq <| Quotient.sound ⟨Equiv.trans ?_ (Equiv.subtypeSubtypeEquivSubtypeExists _ _).symm⟩) - simp only [coe_eq_subtype, mem_singleton_iff, mem_preimage, mem_setOf_eq] + simp only [coe_eq_subtype, mem_singleton_iff, mem_preimage, mem_ofPred_eq] rfl rintro x ⟨_, hx'⟩; exact hx' diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index fa5a7b2d04f2ad..6f867189a591f7 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -412,8 +412,9 @@ def principalSegToType {α β : Ordinal} (h : α < β) : α.ToType lt_of_lt_of_le ?_ hij⟩, typein_lt_type _ _, ?_⟩ · by_contra! H exact (wo.wf.not_lt_min {j | r j i ∧ f i ≤ f j} ⟨IsTrans.trans _ _ _ hkj hji, H⟩) hkj diff --git a/Mathlib/SetTheory/Ordinal/Principal.lean b/Mathlib/SetTheory/Ordinal/Principal.lean index 5ea4572e343bc3..bfc52aec9b2b66 100644 --- a/Mathlib/SetTheory/Ordinal/Principal.lean +++ b/Mathlib/SetTheory/Ordinal/Principal.lean @@ -23,7 +23,7 @@ equivalent to the epsilon numbers given by `Ordinal.epsilon`. * `IsPrincipal`: A principal (or indecomposable) ordinal under some binary operation. We include `0` and other typically excluded edge cases for simplicity. -* `not_bddAbove_setOf_isPrincipal`: Principal ordinals (under any operation) are unbounded. +* `not_bddAbove_setOfPred_isPrincipal`: Principal ordinals (under any operation) are unbounded. * `isPrincipal_add_iff_zero_or_omega0_opow`: The additive principal ordinals are `0` and the ordinal powers of `ω`. * `isPrincipal_mul_iff_le_two_or_omega0_opow_opow`: The multiplicative principal ordinals are @@ -177,13 +177,16 @@ private theorem isPrincipal_nfp_iSup (op : Ordinal → Ordinal → Ordinal) (o : ⟨_, Set.mk_mem_prod ha (hb.trans_le h)⟩ /-- Principal ordinals under any operation are unbounded. -/ -theorem not_bddAbove_setOf_isPrincipal (op : Ordinal → Ordinal → Ordinal) : +theorem not_bddAbove_setOfPred_isPrincipal (op : Ordinal → Ordinal → Ordinal) : ¬ BddAbove { o | IsPrincipal op o } := by rintro ⟨a, ha⟩ exact ((le_nfp _ _).trans (ha (isPrincipal_nfp_iSup op (succ a)))).not_gt (lt_succ a) +@[deprecated (since := "2026-07-09")] +alias not_bddAbove_setOf_isPrincipal := not_bddAbove_setOfPred_isPrincipal + @[deprecated (since := "2026-03-17")] -alias not_bddAbove_principal := not_bddAbove_setOf_isPrincipal +alias not_bddAbove_principal := not_bddAbove_setOfPred_isPrincipal /-! ### Additive principal ordinals -/ diff --git a/Mathlib/SetTheory/ZFC/Basic.lean b/Mathlib/SetTheory/ZFC/Basic.lean index 162994b751eef2..ca9855541786fb 100644 --- a/Mathlib/SetTheory/ZFC/Basic.lean +++ b/Mathlib/SetTheory/ZFC/Basic.lean @@ -563,7 +563,7 @@ def powersetEquiv (x : ZFSet.{u}) : x.powerset ≃ 𝒫 (x : Set ZFSet) where toFun y := ⟨y.1, Set.mem_powerset (mem_powerset.1 y.2)⟩ invFun s := ⟨x.sep (· ∈ s.1), mem_powerset.2 sep_subset⟩ left_inv := by simp +contextual [Function.LeftInverse] - right_inv := by simp +contextual [Function.LeftInverse, Function.RightInverse, Set.setOf_and] + right_inv := by simp +contextual [Function.LeftInverse, Function.RightInverse, Set.ofPred_and] theorem insert_eq (x y : ZFSet) : insert x y = {x} ∪ y := by ext; simp diff --git a/Mathlib/SetTheory/ZFC/Class.lean b/Mathlib/SetTheory/ZFC/Class.lean index 5f0361f21f384d..96c7575dc90094 100644 --- a/Mathlib/SetTheory/ZFC/Class.lean +++ b/Mathlib/SetTheory/ZFC/Class.lean @@ -13,7 +13,7 @@ public import Mathlib.SetTheory.ZFC.Ordinal Classes in set theory are usually defined as collections of elements satisfying some property. Here, however, we define `Class` as `Set ZFSet` to derive many instances automatically, most of them being the lifting of set operations to classes. The usual definition is then -definitionally equal to ours. +equivalent to ours. ## Main definitions @@ -28,9 +28,9 @@ definitionally equal to ours. universe u /-- The collection of all classes. -We define `Class` as `Set ZFSet`, as this allows us to get many instances automatically. However, in -practice, we treat it as (the definitionally equal) `ZFSet → Prop`. This means, the preferred way to -state that `x : ZFSet` belongs to `A : Class` is to write `A x`. -/ +We define `Class` as `Set ZFSet`, as this allows us to get many instances automatically. The +preferred way to state that `x : ZFSet` belongs to `A : Class` is to write `↑x ∈ A`, using the +coercion `Class.ofSet`. -/ @[pp_with_univ, use_set_notation_for_order] def Class := Set ZFSet deriving LE, EmptyCollection, Nonempty, Union, Inter, Compl, SDiff @@ -40,16 +40,6 @@ instance : Insert ZFSet Class := namespace Class --- Porting note: this used to be a `deriving HasSep Set` instance, --- it should probably be turned into notation. -/-- `{x ∈ A | p x}` is the class of elements in `A` satisfying `p` -/ -protected def sep (p : ZFSet → Prop) (A : Class) : Class := - {y | A y ∧ p y} - -@[ext] -theorem ext {x y : Class.{u}} : (∀ z : ZFSet.{u}, x z ↔ y z) → x = y := - Set.ext - /-- Coerce a ZFC set into a class -/ @[coe] def ofSet (x : ZFSet.{u}) : Class.{u} := @@ -58,6 +48,13 @@ def ofSet (x : ZFSet.{u}) : Class.{u} := instance : Coe ZFSet Class := ⟨ofSet⟩ +/-- The set of ZFC sets satisfying a class. Definitionally, this is the identity, as `Class` is +defined as `Set ZFSet`; it is however not a no-op for elaboration, as `x ∈ A.toSet` directs +instance search to the `Set`-level membership. This `Set`-level membership is equivalent to the +class-level membership `↑x ∈ A`, see `Class.coe_mem`. -/ +abbrev toSet (A : Class.{u}) : Set ZFSet.{u} := + A + /-- The universal class -/ def univ : Class := Set.univ @@ -67,8 +64,8 @@ instance : Top Class := ⟨univ⟩ deriving instance CompleteLattice for Class /-- Assert that `A` is a ZFC set satisfying `B` -/ -def ToSet (B : Class.{u}) (A : Class.{u}) : Prop := - ∃ x : ZFSet, ↑x = A ∧ B x +def ToSet (B A : Class.{u}) : Prop := + ∃ x : ZFSet, ↑x = A ∧ x ∈ B.toSet /-- `A ∈ B` if `A` is a ZFC set which satisfies `B` -/ protected def Mem (B A : Class.{u}) : Prop := @@ -77,14 +74,40 @@ protected def Mem (B A : Class.{u}) : Prop := instance : Membership Class Class := ⟨Class.Mem⟩ -theorem mem_def (A B : Class.{u}) : A ∈ B ↔ ∃ x : ZFSet, ↑x = A ∧ B x := +theorem mem_def (A B : Class.{u}) : A ∈ B ↔ ∃ x : ZFSet, ↑x = A ∧ x ∈ B.toSet := Iff.rfl +theorem ofSet.inj {x y : ZFSet.{u}} (h : (x : Class.{u}) = y) : x = y := + ZFSet.ext fun z => Set.ext_iff.1 h z + +@[simp] +theorem toSet_of_ZFSet (A : Class.{u}) (x : ZFSet.{u}) : ToSet A ↑x ↔ x ∈ A.toSet := + ⟨fun ⟨y, yx, py⟩ => by rwa [ofSet.inj yx] at py, fun px => ⟨x, rfl, px⟩⟩ + +@[simp, norm_cast] +theorem coe_mem {x : ZFSet.{u}} {A : Class.{u}} : (x : Class.{u}) ∈ A ↔ x ∈ A.toSet := + toSet_of_ZFSet _ _ + +@[simp] +theorem coe_apply {x y : ZFSet.{u}} : x ∈ (y : Class.{u}).toSet ↔ x ∈ y := + Iff.rfl + +@[ext] +theorem ext {x y : Class.{u}} (h : ∀ z : ZFSet.{u}, (z : Class.{u}) ∈ x ↔ (z : Class.{u}) ∈ y) : + x = y := + Set.ext fun z => coe_mem.symm.trans ((h z).trans coe_mem) + +-- Porting note: this used to be a `deriving HasSep Set` instance, +-- it should probably be turned into notation. +/-- `{x ∈ A | p x}` is the class of elements in `A` satisfying `p` -/ +protected def sep (p : ZFSet → Prop) (A : Class) : Class := + {y | ↑y ∈ A ∧ p y} + @[simp] theorem notMem_empty (x : Class.{u}) : x ∉ (∅ : Class.{u}) := fun ⟨_, _, h⟩ => h @[simp] -theorem not_empty_hom (x : ZFSet.{u}) : ¬(∅ : Class.{u}) x := +theorem not_empty_hom (x : ZFSet.{u}) : x ∉ (∅ : Class.{u}).toSet := id @[simp] @@ -92,13 +115,13 @@ theorem mem_univ {A : Class.{u}} : A ∈ univ.{u} ↔ ∃ x : ZFSet.{u}, ↑x = exists_congr fun _ => iff_of_eq (and_true _) @[simp] -theorem mem_univ_hom (x : ZFSet.{u}) : univ.{u} x := +theorem mem_univ_hom (x : ZFSet.{u}) : x ∈ toSet univ.{u} := trivial -theorem eq_univ_iff_forall {A : Class.{u}} : A = univ ↔ ∀ x : ZFSet, A x := +theorem eq_univ_iff_forall {A : Class.{u}} : A = univ ↔ ∀ x : ZFSet, x ∈ A.toSet := Set.eq_univ_iff_forall -theorem eq_univ_of_forall {A : Class.{u}} : (∀ x : ZFSet, A x) → A = univ := +theorem eq_univ_of_forall {A : Class.{u}} : (∀ x : ZFSet, x ∈ A.toSet) → A = univ := Set.eq_univ_of_forall theorem mem_wf : @WellFounded Class.{u} (· ∈ ·) := @@ -165,64 +188,48 @@ def sInter (x : Class) : Class := @[inherit_doc] scoped prefix:110 "⋂₀ " => Class.sInter -theorem ofSet.inj {x y : ZFSet.{u}} (h : (x : Class.{u}) = y) : x = y := - ZFSet.ext fun z => by - change (x : Class.{u}) z ↔ (y : Class.{u}) z - rw [h] - -@[simp] -theorem toSet_of_ZFSet (A : Class.{u}) (x : ZFSet.{u}) : ToSet A x ↔ A x := - ⟨fun ⟨y, yx, py⟩ => by rwa [ofSet.inj yx] at py, fun px => ⟨x, rfl, px⟩⟩ - -@[simp, norm_cast] -theorem coe_mem {x : ZFSet.{u}} {A : Class.{u}} : ↑x ∈ A ↔ A x := - toSet_of_ZFSet _ _ - -@[simp] -theorem coe_apply {x y : ZFSet.{u}} : (y : Class.{u}) x ↔ x ∈ y := - Iff.rfl - @[simp, norm_cast] theorem coe_subset (x y : ZFSet.{u}) : (x : Class.{u}) ⊆ y ↔ x ⊆ y := Iff.rfl @[simp, norm_cast] -theorem coe_sep (p : Class.{u}) (x : ZFSet.{u}) : +theorem coe_sep (p : ZFSet.{u} → Prop) (x : ZFSet.{u}) : (ZFSet.sep p x : Class) = { y ∈ x | p y } := - ext fun _ => ZFSet.mem_sep + Set.ext fun _ => ZFSet.mem_sep @[simp, norm_cast] theorem coe_empty : ↑(∅ : ZFSet.{u}) = (∅ : Class.{u}) := - ext fun y => iff_false _ ▸ ZFSet.notMem_empty y + Set.ext fun y => iff_false _ ▸ ZFSet.notMem_empty y @[simp, norm_cast] theorem coe_insert (x y : ZFSet.{u}) : ↑(insert x y) = @insert ZFSet.{u} Class.{u} _ x y := - ext fun _ => ZFSet.mem_insert_iff + Set.ext fun _ => ZFSet.mem_insert_iff @[simp, norm_cast] theorem coe_union (x y : ZFSet.{u}) : ↑(x ∪ y) = (x : Class.{u}) ∪ y := - ext fun _ => ZFSet.mem_union + Set.ext fun _ => ZFSet.mem_union @[simp, norm_cast] theorem coe_inter (x y : ZFSet.{u}) : ↑(x ∩ y) = (x : Class.{u}) ∩ y := - ext fun _ => ZFSet.mem_inter + Set.ext fun _ => ZFSet.mem_inter @[simp, norm_cast] theorem coe_sdiff (x y : ZFSet.{u}) : ↑(x \ y) = (x : Class.{u}) \ y := - ext fun _ => ZFSet.mem_sdiff + Set.ext fun _ => ZFSet.mem_sdiff @[deprecated (since := "2026-06-03")] alias coe_diff := coe_sdiff @[simp, norm_cast] theorem coe_powerset (x : ZFSet.{u}) : ↑x.powerset = powerset.{u} x := - ext fun _ => ZFSet.mem_powerset + Set.ext fun _ => ZFSet.mem_powerset @[simp] -theorem powerset_apply {A : Class.{u}} {x : ZFSet.{u}} : powerset A x ↔ ↑x ⊆ A := +theorem powerset_apply {A : Class.{u}} {x : ZFSet.{u}} : x ∈ (powerset A).toSet ↔ ↑x ⊆ A := Iff.rfl @[simp] -theorem sUnion_apply {x : Class} {y : ZFSet} : (⋃₀ x) y ↔ ∃ z : ZFSet, x z ∧ y ∈ z := by +theorem sUnion_apply {x : Class.{u}} {y : ZFSet.{u}} : + y ∈ (⋃₀ x).toSet ↔ ∃ z : ZFSet, z ∈ x.toSet ∧ y ∈ z := by constructor · rintro ⟨-, ⟨z, rfl, hxz⟩, hyz⟩ exact ⟨z, hxz, hyz⟩ @@ -231,7 +238,7 @@ theorem sUnion_apply {x : Class} {y : ZFSet} : (⋃₀ x) y ↔ ∃ z : ZFSet, x open scoped ZFSet in @[simp, norm_cast] theorem coe_sUnion (x : ZFSet.{u}) : ↑(⋃₀ x : ZFSet) = ⋃₀ (x : Class.{u}) := - ext fun y => + Set.ext fun y => ZFSet.mem_sUnion.trans (sUnion_apply.trans <| by rfl).symm @[simp] @@ -242,7 +249,8 @@ theorem mem_sUnion {x y : Class.{u}} : y ∈ ⋃₀ x ↔ ∃ z, z ∈ x ∧ y · rintro ⟨w, hwx, z, rfl, hwz⟩ exact ⟨z, rfl, w, hwx, hwz⟩ -theorem sInter_apply {x : Class.{u}} {y : ZFSet.{u}} : (⋂₀ x) y ↔ ∀ z : ZFSet.{u}, x z → y ∈ z := by +theorem sInter_apply {x : Class.{u}} {y : ZFSet.{u}} : + y ∈ (⋂₀ x).toSet ↔ ∀ z : ZFSet.{u}, z ∈ x.toSet → y ∈ z := by refine ⟨fun hxy z hxz => hxy _ ⟨z, rfl, hxz⟩, ?_⟩ rintro H - ⟨z, rfl, hxz⟩ exact H _ hxz @@ -280,17 +288,18 @@ theorem eq_univ_of_powerset_subset {A : Class} (hA : powerset A ⊆ A) : A = uni (by by_contra! hnA exact - WellFounded.min_mem ZFSet.mem_wf _ hnA + WellFounded.min_mem ZFSet.mem_wf {x | x ∉ A.toSet} hnA (hA fun x hx => Classical.not_not.1 fun hB => - WellFounded.not_lt_min ZFSet.mem_wf _ hB <| coe_apply.1 hx)) + WellFounded.not_lt_min ZFSet.mem_wf {x | x ∉ A.toSet} hB <| + coe_apply.1 hx)) -/-- The definite description operator, which is `{x}` if `{y | A y} = {x}` and `∅` otherwise. -/ +/-- The definite description operator, which is `{x}` if `A = {x}` and `∅` otherwise. -/ def iota (A : Class) : Class := - ⋃₀ ({ x | ∀ y, A y ↔ y = x } : Class) + ⋃₀ ({ x | ∀ y : ZFSet, ↑y ∈ A ↔ y = x } : Class) -theorem iota_val (A : Class) (x : ZFSet) (H : ∀ y, A y ↔ y = x) : iota A = ↑x := - ext fun y => +theorem iota_val (A : Class) (x : ZFSet) (H : ∀ y : ZFSet, ↑y ∈ A ↔ y = x) : iota A = ↑x := + Set.ext fun y => ⟨fun ⟨_, ⟨x', rfl, h⟩, yx'⟩ => by rwa [← (H x').1 <| (h x').2 rfl], fun yx => ⟨_, ⟨x, rfl, H⟩, yx⟩⟩ @@ -299,13 +308,13 @@ theorem iota_val (A : Class) (x : ZFSet) (H : ∀ y, A y ↔ y = x) : iota A = associated `Class → Set` function. -/ theorem iota_ex (A) : iota.{u} A ∈ univ.{u} := mem_univ.2 <| - Or.elim (Classical.em <| ∃ x, ∀ y, A y ↔ y = x) (fun ⟨x, h⟩ => ⟨x, Eq.symm <| iota_val A x h⟩) - fun hn => - ⟨∅, ext fun _ => coe_empty.symm ▸ ⟨False.rec, fun ⟨_, ⟨x, rfl, H⟩, _⟩ => hn ⟨x, H⟩⟩⟩ + Or.elim (Classical.em <| ∃ x : ZFSet, ∀ y : ZFSet, ↑y ∈ A ↔ y = x) + (fun ⟨x, h⟩ => ⟨x, Eq.symm <| iota_val A x h⟩) fun hn => + ⟨∅, Set.ext fun _ => coe_empty.symm ▸ ⟨False.rec, fun ⟨_, ⟨x, rfl, H⟩, _⟩ => hn ⟨x, H⟩⟩⟩ /-- Function value -/ def fval (F A : Class.{u}) : Class.{u} := - iota fun y => ToSet (fun x => F (ZFSet.pair x y)) A + iota {y | ToSet {x | ↑(ZFSet.pair x y) ∈ F} A} @[inherit_doc] infixl:100 " ′ " => fval @@ -321,7 +330,7 @@ namespace ZFSet theorem map_fval {f : ZFSet.{u} → ZFSet.{u}} [Definable₁ f] {x y : ZFSet.{u}} (h : y ∈ x) : (ZFSet.map f x ′ y : Class.{u}) = f y := Class.iota_val _ _ fun z => by - rw [Class.toSet_of_ZFSet, Class.coe_apply, mem_map] + simp only [Class.coe_mem, Set.mem_ofPred_eq, Class.toSet_of_ZFSet, Class.coe_apply, mem_map] exact ⟨fun ⟨w, _, pr⟩ => by let ⟨wy, fw⟩ := ZFSet.pair_injective pr @@ -370,12 +379,14 @@ noncomputable def coeEquiv : ZFSet.{u} ≃ {s : Set ZFSet.{u} // Small.{u, u+1} right_inv s := private Subtype.coe_injective <| coe_equiv_aux s.2 /-- The **Burali-Forti paradox**: ordinals form a proper class. -/ -theorem isOrdinal_notMem_univ : IsOrdinal ∉ Class.univ.{u} := by +theorem isOrdinal_notMem_univ : {x | IsOrdinal x} ∉ Class.univ.{u} := by rintro ⟨x, hx, -⟩ + have H : ∀ y : ZFSet, y ∈ x ↔ y.IsOrdinal := fun y => by + rw [← Class.coe_apply, hx, Set.mem_ofPred_eq] suffices IsOrdinal x by - apply Class.mem_irrefl x - rwa [Class.coe_mem, hx] - refine ⟨fun y hy z hz ↦ ?_, fun hyz hzw hwx ↦ ?_⟩ <;> rw [← Class.coe_apply, hx] at * - exacts [hy.mem hz, hwx.mem_trans hyz hzw] + apply Class.mem_irrefl (x : Class.{u}) + rwa [Class.coe_mem, Class.coe_apply, H] + refine ⟨fun y hy z hz ↦ (H z).2 <| ((H y).1 hy).mem hz, + @fun y z w hyz hzw hwx ↦ ((H w).1 hwx).mem_trans hyz hzw⟩ end ZFSet diff --git a/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean b/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean index c8d5ae4f4b1111..f2966d0e095d07 100644 --- a/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean +++ b/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean @@ -85,14 +85,15 @@ local instance : CompleteSpace (Stream' α) := local instance : CompleteSpace (Seq α) := by suffices IsClosed (X := Stream' (Option α)) - (fun x ↦ ∀ {n : ℕ}, x n = none → x (n + 1) = none) by - apply IsClosed.completeSpace_coe + {x | ∀ {n : ℕ}, x n = none → x (n + 1) = none} by + exact IsClosed.completeSpace_coe + (s := {x : Stream' (Option α) | ∀ {n : ℕ}, x n = none → x (n + 1) = none}) (hs := this) rw [isClosed_iff_clusterPt] intro s hs n hn rw [clusterPt_principal_iff] at hs obtain ⟨t, hts, ht⟩ := hs (Metric.ball s ((1 / 2 : ℝ) ^ (n + 1))) (Metric.ball_mem_nhds _ (by positivity)) - simp only [Metric.ball, Set.mem_setOf_eq] at hts + simp only [Metric.ball, Set.mem_ofPred_eq] at hts rw [← PiNat.apply_eq_of_dist_lt hts (by simp)] at hn rw [← PiNat.apply_eq_of_dist_lt hts (by rfl)] exact ht hn diff --git a/Mathlib/Tactic/Simps/Basic.lean b/Mathlib/Tactic/Simps/Basic.lean index 91bd1091d93821..d62d29e115ed06 100644 --- a/Mathlib/Tactic/Simps/Basic.lean +++ b/Mathlib/Tactic/Simps/Basic.lean @@ -902,7 +902,7 @@ structure Config where /-- List of types in which we are not recursing to generate simplification lemmas. E.g. if we write `@[simps] def e : α × β ≃ β × α := ...` we will generate `e_apply` and not `e_apply_fst`. -/ - notRecursive := [`Prod, `PProd, `Opposite, `PreOpposite] + notRecursive := [`Prod, `PProd, `Opposite, `PreOpposite, `Set] /-- Output debug messages. Not used much, use `set_option simps.debug true` instead. -/ debug := false /-- The stem to use for the projection names. If `none`, the default, use the suffix of the diff --git a/Mathlib/Tactic/Translate/ToDual.lean b/Mathlib/Tactic/Translate/ToDual.lean index da8dcb078ff371..077b1a396d1422 100644 --- a/Mathlib/Tactic/Translate/ToDual.lean +++ b/Mathlib/Tactic/Translate/ToDual.lean @@ -258,6 +258,8 @@ def abbreviationDict : Std.HashMap String String := .ofList [ ("neTop", "NeBot"), ("decidableSucc", "DecidablePred"), + -- `Set.ofPred` is not dual to `Set.ofSucc` + ("ofSucc", "OfPred"), ] @[inherit_doc GuessName.GuessNameExt] diff --git a/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean b/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean index 3f5841d4654d60..57e5d0d9593898 100644 --- a/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean +++ b/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean @@ -317,7 +317,7 @@ profinite additive groups. -/] def limitConePtAux : Subgroup (Π j : J, F.obj j) where carrier := {x | ∀ ⦃i j : J⦄ (π : i ⟶ j), F.map π (x i) = x j} mul_mem' hx hy _ _ π := by simp only [Pi.mul_apply, map_mul, hx π, hy π] - one_mem' := by simp only [Set.mem_setOf_eq, Pi.one_apply, map_one, implies_true] + one_mem' := by simp only [Set.mem_ofPred_eq, Pi.one_apply, map_one, implies_true] inv_mem' h _ _ π := by simp only [Pi.inv_apply, map_inv, h π] @[to_additive] diff --git a/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Limits.lean b/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Limits.lean index e05a25f8247f72..4c9e53b8c415f1 100644 --- a/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Limits.lean +++ b/Mathlib/Topology/Algebra/Category/ProfiniteGrp/Limits.lean @@ -73,7 +73,7 @@ lemma toLimitFun_continuous (P : ProfiniteGrp.{u}) : Continuous (toLimitFun P) : apply continuous_induced_rng.mpr (continuous_pi _) intro H dsimp only [Functor.comp_obj, CompHausLike.coe_of, Functor.comp_map, - CompHausLike.toCompHausLike_map, CompHausLike.compHausLikeToTop_map, Set.mem_setOf_eq, + CompHausLike.toCompHausLike_map, CompHausLike.compHausLikeToTop_map, Set.mem_ofPred_eq, toLimitFun, MonoidHom.coe_mk, OneHom.coe_mk, Function.comp_apply] apply Continuous.mk intro s _ diff --git a/Mathlib/Topology/Algebra/ConstMulAction.lean b/Mathlib/Topology/Algebra/ConstMulAction.lean index 69f48dd54a30fe..b38ecbc5b5e31d 100644 --- a/Mathlib/Topology/Algebra/ConstMulAction.lean +++ b/Mathlib/Topology/Algebra/ConstMulAction.lean @@ -169,13 +169,15 @@ theorem set_smul_closure_subset (s : Set M) (t : Set α) : s • closure t ⊆ c exact iUnion₂_subset fun c hc ↦ (smul_closure_subset c t).trans <| closure_mono <| subset_biUnion_of_mem (u := (· • t)) hc -theorem isClosed_setOf_map_smul {N : Type*} (α β) [SMul M α] [SMul N β] +theorem isClosed_setOfPred_map_smul {N : Type*} (α β) [SMul M α] [SMul N β] [TopologicalSpace β] [T2Space β] [ContinuousConstSMul N β] (σ : M → N) : IsClosed { f : α → β | ∀ c x, f (c • x) = σ c • f x } := by - simp only [Set.setOf_forall] + simp only [Set.ofPred_forall] exact isClosed_iInter fun c => isClosed_iInter fun x => isClosed_eq (continuous_apply _) ((continuous_apply _).const_smul _) +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_map_smul := isClosed_setOfPred_map_smul + end SMul section Monoid @@ -607,7 +609,7 @@ instance (priority := 100) t2Space_of_properlyDiscontinuousSMul_of_t2Space [T2Sp by_cases H : γ ∈ bad_Γ_set · exact fun h => (u_v_disjoint γ).le_bot ⟨mem_iInter₂.mp x_in_U₀₀ γ H, mem_iInter₂.mp h.1 γ H⟩ · rintro ⟨-, h'⟩ - simp only [bad_Γ_set, image_smul, not_nonempty_iff_eq_empty, mem_setOf_eq] at H + simp only [bad_Γ_set, image_smul, not_nonempty_iff_eq_empty, mem_ofPred_eq] at H exact eq_empty_iff_forall_notMem.mp H (γ • x) ⟨mem_image_of_mem _ x_in_K₀, h'⟩ /-- The quotient of a second countable space by a group action is second countable. -/ diff --git a/Mathlib/Topology/Algebra/Group/Basic.lean b/Mathlib/Topology/Algebra/Group/Basic.lean index 7d82c9db6f5b06..fe0fedbee6c631 100644 --- a/Mathlib/Topology/Algebra/Group/Basic.lean +++ b/Mathlib/Topology/Algebra/Group/Basic.lean @@ -48,7 +48,7 @@ variable {G : Type w} {H : Type x} {α : Type u} {β : Type v} /-- In a Hausdorff magma with continuous multiplication, the centralizer of any set is closed. -/ lemma Set.isClosed_centralizer {M : Type*} (s : Set M) [Mul M] [TopologicalSpace M] [SeparatelyContinuousMul M] [T2Space M] : IsClosed (centralizer s) := by - rw [centralizer, setOf_forall] + rw [centralizer, ofPred_forall] refine isClosed_sInter ?_ rintro - ⟨m, ht, rfl⟩ refine isClosed_imp (by simp) <| isClosed_eq ?_ ?_ @@ -284,11 +284,17 @@ section PointwiseLimits variable (G₁ G₂ : Type*) [TopologicalSpace G₂] [T2Space G₂] @[to_additive] -theorem isClosed_setOf_map_inv [Inv G₁] [Inv G₂] [ContinuousInv G₂] : +theorem isClosed_setOfPred_map_inv [Inv G₁] [Inv G₂] [ContinuousInv G₂] : IsClosed { f : G₁ → G₂ | ∀ x, f x⁻¹ = (f x)⁻¹ } := by - simp only [setOf_forall] + simp only [ofPred_forall] exact isClosed_iInter fun i => isClosed_eq (continuous_apply _) (continuous_apply _).inv +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_map_inv := isClosed_setOfPred_map_inv + +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_map_neg := isClosed_setOfPred_map_neg + end PointwiseLimits instance [TopologicalSpace H] [Inv H] [ContinuousInv H] : ContinuousNeg (Additive H) where @@ -804,7 +810,7 @@ theorem Filter.HasBasis.nhds_of_one {ι : Sort*} {p : ι → Prop} {s : ι → S theorem mem_closure_iff_nhds_one {x : G} {s : Set G} : x ∈ closure s ↔ ∀ U ∈ (𝓝 1 : Filter G), ∃ y ∈ s, y / x ∈ U := by rw [mem_closure_iff_nhds_basis ((𝓝 1 : Filter G).basis_sets.nhds_of_one x)] - simp_rw [Set.mem_setOf, id] + simp_rw [Set.mem_ofPred, id] /-- A monoid homomorphism (a bundled morphism of a type that implements `MonoidHomClass`) from a topological group to a topological monoid is continuous @@ -1128,8 +1134,7 @@ theorem Subgroup.properlyDiscontinuousSMul_of_tendsto_cofinite (S : Subgroup G) have H : Set.Finite _ := hS ((hL.prod hK).image continuous_div').compl_mem_cocompact rw [preimage_compl, compl_compl] at H convert! H - ext x - simp only [image_smul, mem_setOf_eq, coe_subtype, mem_preimage, mem_image, Prod.exists] + simp only [image_smul, mem_iff_mem, coe_subtype, mem_preimage, mem_image, Prod.exists] exact Set.smul_inter_nonempty_iff' } /-- A subgroup `S` of a topological group `G` acts on `G` properly discontinuously on the right, if @@ -1156,7 +1161,7 @@ theorem Subgroup.properlyDiscontinuousSMul_opposite_of_tendsto_cofinite (S : Sub apply Finite.of_preimage _ (equivOp S).surjective convert! H using 1 ext x - simp only [image_smul, mem_setOf_eq, mem_preimage, mem_image, Prod.exists] + simp only [image_smul, mem_ofPred_eq, mem_preimage, mem_image, Prod.exists] exact Set.op_smul_inter_nonempty_iff } end diff --git a/Mathlib/Topology/Algebra/Group/CompactOpen.lean b/Mathlib/Topology/Algebra/Group/CompactOpen.lean index 36a25124e9fab8..9d1352ce388025 100644 --- a/Mathlib/Topology/Algebra/Group/CompactOpen.lean +++ b/Mathlib/Topology/Algebra/Group/CompactOpen.lean @@ -61,7 +61,7 @@ theorem isClosedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] : IsClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) where toIsEmbedding := isEmbedding_toContinuousMap A B isClosed_range := by - simp only [range_toContinuousMap, Set.setOf_and, Set.setOf_forall] + simp only [range_toContinuousMap, Set.ofPred_and, Set.ofPred_forall] refine .inter (isClosed_singleton.preimage (continuous_eval_const 1)) <| isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ ?_ exact isClosed_eq (continuous_eval_const (x * y)) <| @@ -169,7 +169,7 @@ theorem locallyCompactSpace_of_equicontinuousAt (U : Set X) (V : Set Y) rw [equicontinuous_iff_range, ← Set.image_eq_range] at h ⊢ rwa [← hS4] at h replace hS4 : S4 = Set.pi U (fun _ ↦ W) ∩ Set.range ((↑) : (X →* Y) → (X → Y)) := by - simp_rw [hS4, Set.ext_iff, Set.mem_image, S1, Set.mem_setOf_eq] + simp_rw [hS4, Set.ext_iff, Set.mem_image, S1, Set.mem_ofPred_eq] exact fun f ↦ ⟨fun ⟨g, hg, hf⟩ ↦ hf ▸ ⟨hg, g, rfl⟩, fun ⟨hg, g, hf⟩ ↦ ⟨g, hf ▸ hg, hf⟩⟩ replace hS4 : IsClosed S4 := hS4.symm ▸ (isClosed_set_pi (fun _ _ ↦ hWc.isClosed)).inter (MonoidHom.isClosed_range_coe X Y) @@ -177,7 +177,7 @@ theorem locallyCompactSpace_of_equicontinuousAt (U : Set X) (V : Set Y) let T : Set (ContinuousMonoidHom X Y) := {f | Set.MapsTo f U (interior W)} have h1 : T.Nonempty := ⟨1, fun _ _ ↦ mem_interior_iff_mem_nhds.mpr hWo⟩ have h2 : T ⊆ S2 := fun f hf ↦ hf.mono_right interior_subset - have h3 : IsOpen T := isOpen_induced (ContinuousMap.isOpen_setOf_mapsTo hU isOpen_interior) + have h3 : IsOpen T := isOpen_induced (ContinuousMap.isOpen_setOfPred_mapsTo hU isOpen_interior) exact h1.mono (interior_maximal h2 h3) exact TopologicalSpace.PositiveCompacts.locallyCompactSpace_of_group ⟨⟨S2, (isInducing_toContinuousMap X Y).isCompact_iff.mpr @@ -209,7 +209,7 @@ theorem locallyCompactSpace_of_hasBasis (V : ℕ → Set Y) apply locallyCompactSpace_of_equicontinuousAt (U 0) (V 0) hU0c (hVo.mem_of_mem trivial) rw [hVo.uniformity_of_nhds_one.equicontinuousAt_iff_right] refine fun n _ ↦ Filter.eventually_iff_exists_mem.mpr ⟨U n, hU1 n, fun x hx ⟨f, hf⟩ ↦ ?_⟩ - rw [Set.mem_setOf_eq, map_one, div_one] + rw [Set.mem_ofPred_eq, map_one, div_one] exact hU4 f hf n hx end LocallyCompact diff --git a/Mathlib/Topology/Algebra/Group/DiscontinuousSubgroup.lean b/Mathlib/Topology/Algebra/Group/DiscontinuousSubgroup.lean index 9299ba695f52ea..ee2f6c4c455536 100644 --- a/Mathlib/Topology/Algebra/Group/DiscontinuousSubgroup.lean +++ b/Mathlib/Topology/Algebra/Group/DiscontinuousSubgroup.lean @@ -27,7 +27,6 @@ protected lemma Subgroup.properlyDiscontinuousSMul_iff rw [properlyDiscontinuousSMul_iff] congr! with K L hK hL convert! injOn_subtype_val (s := {m : S | (m • K ∩ L).Nonempty}) |>.bijOn_image.finite_iff_finite - ext g simp [Set.subtype_smul_set, and_comm] @[to_additive] diff --git a/Mathlib/Topology/Algebra/Group/Matrix.lean b/Mathlib/Topology/Algebra/Group/Matrix.lean index cdf69454384009..78444a235191b2 100644 --- a/Mathlib/Topology/Algebra/Group/Matrix.lean +++ b/Mathlib/Topology/Algebra/Group/Matrix.lean @@ -93,16 +93,18 @@ theorem continuous_apply {α : Type*} [TopologicalSpace α] @[fun_prop] lemma _root_.Continuous.specialLinearGroup_map (hf : Continuous f) : Continuous (map (n := n) f) := by - refine IsInducing.subtypeVal.continuous_iff.mpr ?_ + refine (IsInducing.subtypeVal (t := {A : Matrix n n S | A.det = 1})).continuous_iff.mpr ?_ exact (continuous_id.matrix_map hf).comp continuous_subtype_val lemma _root_.Topology.IsInducing.specialLinearGroup_map (hf : IsInducing f) : IsInducing (map (n := n) f) := - (hf.matrix_map.comp .subtypeVal).of_comp (by fun_prop) continuous_subtype_val + (hf.matrix_map.comp (IsInducing.subtypeVal (t := {A : Matrix n n R | A.det = 1}))).of_comp + (by fun_prop) continuous_subtype_val lemma _root_.Topology.IsEmbedding.specialLinearGroup_map (hf : IsEmbedding f) : IsEmbedding (map (n := n) f) := - (hf.matrix_map.comp .subtypeVal).of_comp (by fun_prop) continuous_subtype_val + (hf.matrix_map.comp (IsEmbedding.subtypeVal (p := fun A : Matrix n n R ↦ A.det = 1))).of_comp + (by fun_prop) continuous_subtype_val variable [IsTopologicalRing R] diff --git a/Mathlib/Topology/Algebra/Group/SubmonoidClosure.lean b/Mathlib/Topology/Algebra/Group/SubmonoidClosure.lean index b5c4ae89e78e98..c4ff6d865a4207 100644 --- a/Mathlib/Topology/Algebra/Group/SubmonoidClosure.lean +++ b/Mathlib/Topology/Algebra/Group/SubmonoidClosure.lean @@ -70,7 +70,7 @@ theorem mapClusterPt_atTop_pow_tfae (x y : G) : refine fun h ↦ closure_mono (range_subset_iff.2 fun n ↦ ?_) h exact ⟨n, zpow_natCast _ _⟩ tfae_have 4 → 1 := by - refine fun h ↦ closure_minimal ?_ isClosed_setOf_clusterPt h + refine fun h ↦ closure_minimal ?_ isClosed_setOfPred_clusterPt h exact range_subset_iff.2 (mapClusterPt_self_zpow_atTop_pow _) tfae_have 1 → 3 := by rw [mem_closure_iff_clusterPt] diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean b/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean index 01c9ccbcfcd3fa..570862b8d39c43 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Defs.lean @@ -254,7 +254,7 @@ theorem hasProd_fintype_support [Fintype β] (f : β → α) (L : SummationFilte (fun b hb ↦ (L.eventually_mem_or_not_mem b).resolve_left hb) filter_upwards [h1, h2] with s hs hs' congr 1 - simp only [Set.mem_iInter, Set.mem_setOf_eq, Set.mem_compl_iff] at hs hs' + simp only [Set.mem_iInter, Set.mem_ofPred_eq, Set.mem_compl_iff] at hs hs' grind @[to_additive] diff --git a/Mathlib/Topology/Algebra/InfiniteSum/Order.lean b/Mathlib/Topology/Algebra/InfiniteSum/Order.lean index 97017871e4fcc6..4194355b07c380 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/Order.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/Order.lean @@ -84,7 +84,7 @@ protected lemma Multipliable.tprod_subtype_le {κ γ : Type*} [CommGroup γ] [Pa (∏' (b : β), f b) ≤ (∏' (a : κ), f a) := by apply Multipliable.tprod_le_tprod_of_inj _ (Subtype.coe_injective) - (by simp only [Subtype.range_coe_subtype, Set.setOf_mem_eq, h, implies_true]) + (by simp only [Subtype.range_coe_subtype, Set.ofPred_mem_eq, h, implies_true]) (by simp only [le_refl, implies_true]) (by apply hf.subtype) apply hf diff --git a/Mathlib/Topology/Algebra/InfiniteSum/SummationFilter.lean b/Mathlib/Topology/Algebra/InfiniteSum/SummationFilter.lean index 4f65111db79aaf..4276e821ba95cc 100644 --- a/Mathlib/Topology/Algebra/InfiniteSum/SummationFilter.lean +++ b/Mathlib/Topology/Algebra/InfiniteSum/SummationFilter.lean @@ -63,13 +63,13 @@ def support (L : SummationFilter β) : Set β := {b | ∀ᶠ s in L.filter, b lemma support_eq_limsInf (L : SummationFilter β) : support L = limsInf (L.filter.map (↑)) := by refine eq_of_forall_ge_iff fun c ↦ ?_ - simpa [support, limsInf, setOf_subset] using + simpa [support, limsInf, ofPred_subset] using ⟨fun hL b hb x hx ↦ hL x <| hb.mp <| .of_forall fun c hc ↦ hc hx, fun hL x hx ↦ singleton_subset_iff.mp <| hL _ <| by simpa using hx⟩ lemma support_eq_univ_iff {L : SummationFilter β} : L.support = univ ↔ L.filter ≤ atTop := by - simp only [support, Set.eq_univ_iff_forall, Set.mem_setOf] + simp only [support, Set.eq_univ_iff_forall, Set.mem_ofPred] refine ⟨fun h s hs ↦ ?_, fun h b ↦ .filter_mono h ?_⟩ · obtain ⟨t, ht⟩ := mem_atTop_sets.mp hs have := (Filter.biInter_finset_mem t).mpr fun b hb ↦ h b diff --git a/Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean b/Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean index ac1b694b34f284..52991163da86a0 100644 --- a/Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean +++ b/Mathlib/Topology/Algebra/IsUniformGroup/Basic.lean @@ -643,7 +643,7 @@ instance QuotientGroup.completeSpace_right' (G : Type u) [Group G] [TopologicalS have h𝓤GN : (𝓤 (G ⧸ N)).HasBasis (fun _ ↦ True) fun i ↦ { x | x.snd / x.fst ∈ (↑) '' u i } := by simpa [uniformity_eq_comap_nhds_one', div_eq_mul_inv] using! hv.comap _ rw [h𝓤GN.cauchySeq_iff] at hx - simp only [mem_setOf_eq, forall_true_left, mem_image] at hx + simp only [mem_ofPred_eq, forall_true_left, mem_image] at hx intro i j rcases hx i with ⟨M, hM⟩ refine ⟨max j M + 1, (le_max_left _ _).trans_lt (lt_add_one _), fun a b ha hb g hg => ?_⟩ @@ -683,7 +683,7 @@ instance QuotientGroup.completeSpace_right' (G : Type u) [Group G] [TopologicalS have h𝓤G : (𝓤 G).HasBasis (fun _ => True) fun i => { x | x.snd / x.fst ∈ u i } := by simpa [uniformity_eq_comap_nhds_one', div_eq_mul_inv] using! hu.toHasBasis.comap _ rw [h𝓤G.cauchySeq_iff'] - simp only [mem_setOf_eq, forall_true_left] + simp only [mem_ofPred_eq, forall_true_left] exact fun m => ⟨m, fun n hmn => Nat.decreasingInduction' diff --git a/Mathlib/Topology/Algebra/Module/Alternating/Topology.lean b/Mathlib/Topology/Algebra/Module/Alternating/Topology.lean index 225fcd15c0dabf..bd6a920f499824 100644 --- a/Mathlib/Topology/Algebra/Module/Alternating/Topology.lean +++ b/Mathlib/Topology/Algebra/Module/Alternating/Topology.lean @@ -38,7 +38,7 @@ instance instTopologicalSpace : TopologicalSpace (E [⋀^ι]→L[𝕜] F) := lemma isClosed_range_toContinuousMultilinearMap [ContinuousSMul 𝕜 E] [T2Space F] : IsClosed (Set.range (toContinuousMultilinearMap : (E [⋀^ι]→L[𝕜] F) → ContinuousMultilinearMap 𝕜 (fun _ : ι ↦ E) F)) := by - simp only [range_toContinuousMultilinearMap, setOf_forall] + simp only [range_toContinuousMultilinearMap, ofPred_forall] repeat refine isClosed_iInter fun _ ↦ ?_ exact isClosed_singleton.preimage (continuous_eval_const _) diff --git a/Mathlib/Topology/Algebra/Module/Basic.lean b/Mathlib/Topology/Algebra/Module/Basic.lean index e2cd9a9f25d672..383e84088b4713 100644 --- a/Mathlib/Topology/Algebra/Module/Basic.lean +++ b/Mathlib/Topology/Algebra/Module/Basic.lean @@ -289,7 +289,7 @@ closure of the set of linear maps. -/ def linearMapOfMemClosureRangeCoe (f : M₁ → M₂) (hf : f ∈ closure (Set.range ((↑) : (M₁ →ₛₗ[σ] M₂) → M₁ → M₂))) : M₁ →ₛₗ[σ] M₂ := { addMonoidHomOfMemClosureRangeCoe f hf with - map_smul' := (isClosed_setOf_map_smul M₁ M₂ σ).closure_subset_iff.2 + map_smul' := (isClosed_setOfPred_map_smul M₁ M₂ σ).closure_subset_iff.2 (Set.range_subset_iff.2 map_smulₛₗ) hf } /-- Construct a bundled linear map from a pointwise limit of linear maps -/ diff --git a/Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean b/Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean index 047fedc1e464bc..56932b720231c0 100644 --- a/Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean +++ b/Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean @@ -137,9 +137,9 @@ theorem completeSpace (h : IsCoherentWith {s : Set (Π i, E i) | IsVonNBounded Continuous fun f : (Π i, E i) →ᵤ[{s | IsVonNBounded 𝕜 s}] F ↦ toFun _ f m := (uniformContinuous_eval (sUnion_isVonNBounded_eq_univ) _).continuous rw [completeSpace_iff_isComplete_range isUniformInducing_toUniformOnFun, range_toUniformOnFun] - simp only [setOf_and, setOf_forall] + simp only [ofPred_and, ofPred_forall] apply_rules [IsClosed.isComplete, IsClosed.inter] - · exact UniformOnFun.isClosed_setOf_continuous h + · exact UniformOnFun.isClosed_setOfPred_continuous h · exact isClosed_iInter fun m ↦ isClosed_iInter fun i ↦ isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ isClosed_eq H (H.add H) · exact isClosed_iInter fun m ↦ isClosed_iInter fun i ↦ diff --git a/Mathlib/Topology/Algebra/Module/Spaces/CharacterSpace.lean b/Mathlib/Topology/Algebra/Module/Spaces/CharacterSpace.lean index 1b748f50d456cc..aacb5d2596b0b2 100644 --- a/Mathlib/Topology/Algebra/Module/Spaces/CharacterSpace.lean +++ b/Mathlib/Topology/Algebra/Module/Spaces/CharacterSpace.lean @@ -121,7 +121,7 @@ theorem union_zero : /-- The `characterSpace 𝕜 A` along with `0` is always a closed set in `WeakDual 𝕜 A`. -/ theorem union_zero_isClosed [T2Space 𝕜] [ContinuousMul 𝕜] : IsClosed (characterSpace 𝕜 A ∪ {0}) := by - simp only [union_zero, Set.setOf_forall] + simp only [union_zero, Set.ofPred_forall] exact isClosed_iInter fun x => isClosed_iInter fun y => @@ -171,7 +171,7 @@ theorem eq_set_map_one_map_mul [Nontrivial 𝕜] : `WeakDual 𝕜 A`. -/ protected theorem isClosed [Nontrivial 𝕜] [T2Space 𝕜] [ContinuousMul 𝕜] : IsClosed (characterSpace 𝕜 A) := by - rw [eq_set_map_one_map_mul, Set.setOf_and] + rw [eq_set_map_one_map_mul, Set.ofPred_and] refine IsClosed.inter (isClosed_eq (eval_continuous _) continuous_const) ?_ simpa only [(union_zero 𝕜 A).symm] using union_zero_isClosed _ _ diff --git a/Mathlib/Topology/Algebra/Module/Spaces/UniformConvergenceCLM.lean b/Mathlib/Topology/Algebra/Module/Spaces/UniformConvergenceCLM.lean index 79e68720233db2..f2c2e0e07f222d 100644 --- a/Mathlib/Topology/Algebra/Module/Spaces/UniformConvergenceCLM.lean +++ b/Mathlib/Topology/Algebra/Module/Spaces/UniformConvergenceCLM.lean @@ -392,7 +392,7 @@ theorem completeSpace [UniformSpace F] [IsUniformAddGroup F] [ContinuousSMul rw [completeSpace_iff_isComplete_range (isUniformInducing_coeFn _ _ _)] apply IsClosed.isComplete have H₁ : IsClosed {f : E →ᵤ[𝔖] F | Continuous ((UniformOnFun.toFun 𝔖) f)} := - UniformOnFun.isClosed_setOf_continuous h𝔖 + UniformOnFun.isClosed_setOfPred_continuous h𝔖 convert! H₁.inter <| (LinearMap.isClosed_range_coe E F σ).preimage diff --git a/Mathlib/Topology/Algebra/Module/UniformConvergence.lean b/Mathlib/Topology/Algebra/Module/UniformConvergence.lean index 998531ca974c38..f463c4e5be42d9 100644 --- a/Mathlib/Topology/Algebra/Module/UniformConvergence.lean +++ b/Mathlib/Topology/Algebra/Module/UniformConvergence.lean @@ -83,7 +83,7 @@ lemma UniformFun.continuousSMul_induced_of_range_bounded (φ : hom) refine ⟨_, this hU, fun u hu x ↦ ?_⟩ simpa only [map_smul] using! hu x · intro u U hU - simp only [Set.mem_setOf_eq, map_smul, Pi.smul_apply] + simp only [Set.mem_ofPred_eq, map_smul, Pi.smul_apply] simpa only [Set.mapsTo_range_iff] using (h u hU).eventually_nhds_zero (mem_of_mem_nhds hU) /-- Let `E` be a TVS, `𝔖 : Set (Set α)` and `H` a submodule of `α →ᵤ[𝔖] E`. If the image of any diff --git a/Mathlib/Topology/Algebra/Monoid.lean b/Mathlib/Topology/Algebra/Monoid.lean index fc1387005e15c0..93308886d0e719 100644 --- a/Mathlib/Topology/Algebra/Monoid.lean +++ b/Mathlib/Topology/Algebra/Monoid.lean @@ -292,16 +292,23 @@ section PointwiseLimits variable (M₁ M₂ : Type*) [TopologicalSpace M₂] [T2Space M₂] @[to_additive] -theorem isClosed_setOf_map_one [One M₁] [One M₂] : IsClosed { f : M₁ → M₂ | f 1 = 1 } := +theorem isClosed_setOfPred_map_one [One M₁] [One M₂] : IsClosed { f : M₁ → M₂ | f 1 = 1 } := isClosed_eq (continuous_apply 1) continuous_const +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_map_one := isClosed_setOfPred_map_one + +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_map_zero := isClosed_setOfPred_map_zero + @[to_additive] -theorem isClosed_setOf_map_mul [Mul M₁] [Mul M₂] [ContinuousMul M₂] : +theorem isClosed_setOfPred_map_mul [Mul M₁] [Mul M₂] [ContinuousMul M₂] : IsClosed { f : M₁ → M₂ | ∀ x y, f (x * y) = f x * f y } := by - simp only [setOf_forall] + simp only [ofPred_forall] exact isClosed_iInter fun x ↦ isClosed_iInter fun y ↦ isClosed_eq (continuous_apply _) (by fun_prop) +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_map_mul := isClosed_setOfPred_map_mul +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_map_add := isClosed_setOfPred_map_add + section Semigroup variable {M₁ M₂} [Mul M₁] [Mul M₂] [ContinuousMul M₂] @@ -317,7 +324,8 @@ type of bundled homomorphisms that has an `AddHomClass` instance) to `M₁ → M def mulHomOfMemClosureRangeCoe (f : M₁ → M₂) (hf : f ∈ closure (range fun (f : F) (x : M₁) => f x)) : M₁ →ₙ* M₂ where toFun := f - map_mul' := (isClosed_setOf_map_mul M₁ M₂).closure_subset_iff.2 (range_subset_iff.2 map_mul) hf + map_mul' := (isClosed_setOfPred_map_mul M₁ M₂).closure_subset_iff.2 + (range_subset_iff.2 map_mul) hf /-- Construct a bundled semigroup homomorphism from a pointwise limit of semigroup homomorphisms. -/ @[to_additive (attr := simps! -fullyApplied) @@ -351,8 +359,10 @@ type of bundled homomorphisms that has an `AddMonoidHomClass` instance) to `M₁ def monoidHomOfMemClosureRangeCoe (f : M₁ → M₂) (hf : f ∈ closure (range fun (f : F) (x : M₁) => f x)) : M₁ →* M₂ where toFun := f - map_one' := (isClosed_setOf_map_one M₁ M₂).closure_subset_iff.2 (range_subset_iff.2 map_one) hf - map_mul' := (isClosed_setOf_map_mul M₁ M₂).closure_subset_iff.2 (range_subset_iff.2 map_mul) hf + map_one' := (isClosed_setOfPred_map_one M₁ M₂).closure_subset_iff.2 + (range_subset_iff.2 map_one) hf + map_mul' := (isClosed_setOfPred_map_mul M₁ M₂).closure_subset_iff.2 + (range_subset_iff.2 map_mul) hf /-- Construct a bundled monoid homomorphism from a pointwise limit of monoid homomorphisms. -/ @[to_additive (attr := simps! -fullyApplied) diff --git a/Mathlib/Topology/Algebra/Order/LiminfLimsup.lean b/Mathlib/Topology/Algebra/Order/LiminfLimsup.lean index da2292edd9312e..119e3d57f65efd 100644 --- a/Mathlib/Topology/Algebra/Order/LiminfLimsup.lean +++ b/Mathlib/Topology/Algebra/Order/LiminfLimsup.lean @@ -197,7 +197,7 @@ lemma limsup_const_sub (F : Filter ι) [AddCommSemigroup R] [Sub R] [ContinuousS (cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) : Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F := by rcases F.eq_or_neBot with rfl | _ - · simp only [liminf, limsInf, limsup, limsSup, map_bot, eventually_bot, Set.setOf_true] + · simp only [liminf, limsInf, limsup, limsSup, map_bot, eventually_bot, Set.ofPred_true] simp only [IsCoboundedUnder, IsCobounded, map_bot, eventually_bot, true_implies] at cobdd rcases cobdd with ⟨x, hx⟩ refine (csInf_le ?_ (Set.mem_univ _)).antisymm @@ -222,7 +222,7 @@ lemma limsup_sub_const (F : Filter ι) [AddCommSemigroup R] [Sub R] [ContinuousS rcases cobdd with ⟨x, hx⟩ refine ⟨x, mem_lowerBounds.2 fun y ↦ ?_⟩ simp only [Set.mem_univ, hx y, implies_true] - simp only [limsup, limsSup, map_bot, eventually_bot, Set.setOf_true] + simp only [limsup, limsSup, map_bot, eventually_bot, Set.ofPred_true] exact this.antisymm (tsub_le_iff_right.2 this) · apply (Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c) _ _).symm · exact fun _ _ h ↦ tsub_le_tsub_right h c diff --git a/Mathlib/Topology/Algebra/PontryaginDual.lean b/Mathlib/Topology/Algebra/PontryaginDual.lean index 2dd281ea6672e0..dc806407ffe9f0 100644 --- a/Mathlib/Topology/Algebra/PontryaginDual.lean +++ b/Mathlib/Topology/Algebra/PontryaginDual.lean @@ -85,7 +85,7 @@ instance [CompactSpace A] : DiscreteTopology (PontryaginDual A) := by let V : Set (PontryaginDual A) := {ψ | Set.MapsTo ψ Set.univ (Circle.centeredArc (π / 2))} have hVopen : IsOpen V := by dsimp only [V] - exact isOpen_induced (ContinuousMap.isOpen_setOf_mapsTo isCompact_univ + exact isOpen_induced (ContinuousMap.isOpen_setOfPred_mapsTo isCompact_univ (Circle.isOpen_centeredArc (π / 2))) have hVeq : V = ({1} : Set (PontryaginDual A)) := by ext ψ diff --git a/Mathlib/Topology/Algebra/ProperAction/Basic.lean b/Mathlib/Topology/Algebra/ProperAction/Basic.lean index 99ab94ef9ebc6a..a0eadfd840aeed 100644 --- a/Mathlib/Topology/Algebra/ProperAction/Basic.lean +++ b/Mathlib/Topology/Algebra/ProperAction/Basic.lean @@ -260,25 +260,33 @@ open scoped Pointwise in /-- If `G` acts properly on `X`, then for each pair of compacts `U, V ⊆ X`, the set of `g` such that `g • U` intersects `V` is compact. -See `MulAction.properSMul_iff_isCompact_setOf_inter_nonempty` for the two-way implication +See `MulAction.properSMul_iff_isCompact_setOfPred_inter_nonempty` for the two-way implication under additional conditions on `G` and `X`. -/ @[to_additive /-- If `G` acts properly on `X`, then for each pair of compacts `U, V ⊆ X`, the set of `g` such that `g +ᵥ U` intersects `V` is compact. -See `AddAction.properVAdd_iff_isCompact_setOf_inter_nonempty` for the two-way implication +See `AddAction.properVAdd_iff_isCompact_setOfPred_inter_nonempty` for the two-way implication under additional conditions on `G` and `X`. -/] -lemma ProperSMul.isCompact_setOf_inter_nonempty +lemma ProperSMul.isCompact_setOfPred_inter_nonempty {G : Type*} [Group G] [MulAction G X] [TopologicalSpace G] [ProperSMul G X] {U V : Set X} (hU : IsCompact U) (hV : IsCompact V) : IsCompact {g : G | (g • U ∩ V).Nonempty} := by - convert! - ((ProperSMul.isProperMap_smul_pair (G := G)).isCompact_preimage (hV.prod hU)).image + suffices h : {g : G | (g • U ∩ V).Nonempty} = + Prod.fst '' ((fun gx : G × X ↦ (gx.1 • gx.2, gx.2)) ⁻¹' (V ×ˢ U)) by + rw [h] + exact ((ProperSMul.isProperMap_smul_pair (G := G)).isCompact_preimage (hV.prod hU)).image continuous_fst ext g suffices (∃ v, v ∈ g • U ∧ v ∈ V) ↔ ∃ u, g • u ∈ V ∧ u ∈ U by simpa rw [← (MulAction.toPerm g).exists_congr_right] simp [and_comm] +@[deprecated (since := "2026-07-09")] +alias ProperSMul.isCompact_setOf_inter_nonempty := ProperSMul.isCompact_setOfPred_inter_nonempty + +@[deprecated (since := "2026-07-09")] +alias ProperVAdd.isCompact_setOf_inter_nonempty := ProperVAdd.isCompact_setOfPred_inter_nonempty + /-- If `G` acts transitively on `X`, and the orbit map of a point in `X` is a proper map, then the action is proper. -/ @[to_additive] diff --git a/Mathlib/Topology/Algebra/ProperAction/CompactlyGenerated.lean b/Mathlib/Topology/Algebra/ProperAction/CompactlyGenerated.lean index 9a98e8768fcde7..f7c2b083c2e676 100644 --- a/Mathlib/Topology/Algebra/ProperAction/CompactlyGenerated.lean +++ b/Mathlib/Topology/Algebra/ProperAction/CompactlyGenerated.lean @@ -22,8 +22,8 @@ weakly locally compact. * `properlyDiscontinuousSMul_iff_properSMul`: If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, and if the action is continuous in the second variable, then the action is properly discontinuous if and only if it is proper. -* `MulAction.properSMul_iff_isCompact_setOf_inter_nonempty`: if `G` is a topological group acting - continuously on a T2 space `X` such that `X × X` is compactly generated, then the action is +* `MulAction.properSMul_iff_isCompact_setOfPred_inter_nonempty`: if `G` is a topological group + acting continuously on a T2 space `X` such that `X × X` is compactly generated, then the action is proper iff, for each pair of compacts `U, V ⊆ X`, the set of `g : G` such that `g • U` intersects `V` is compact. @@ -44,7 +44,7 @@ variable {G X : Type*} [TopologicalSpace X] [Group G] /-- The `G`-action on `X` is proper iff, for each pair of compacts `U, V` in `X`, the set of `g` such that `U` intersects `g • V` is compact. -See `ProperSMul.isCompact_setOf_inter_nonempty` +See `ProperSMul.isCompact_setOfPred_inter_nonempty` for a one-way implication with fewer conditions. **Note**: We assume `CompactlyCoherentSpace (X × X)` @@ -57,7 +57,7 @@ Importing `Mathlib.Topology.Sequences` makes this implication available. The `G`-action on `X` is proper iff, for each pair of compacts `U, V` in `X`, the set of `g` such that `U` intersects `g +ᵥ V` is compact. -See `ProperVAdd.isCompact_setOf_inter_nonempty` +See `ProperVAdd.isCompact_setOfPred_inter_nonempty` for a one-way implication with fewer conditions. **Note**: We assume `CompactlyCoherentSpace (X × X)` @@ -66,10 +66,10 @@ but this follows from various more familiar conditions, such as `FirstCountableTopology X`. Importing `Mathlib.Topology.Sequences` makes this implication available. -/] -lemma MulAction.properSMul_iff_isCompact_setOf_inter_nonempty [ContinuousSMul G X] : +lemma MulAction.properSMul_iff_isCompact_setOfPred_inter_nonempty [ContinuousSMul G X] : ProperSMul G X ↔ (∀ {U V : Set X}, IsCompact U → IsCompact V → IsCompact {g : G | (g • U ∩ V).Nonempty}) := by - refine ⟨fun h ↦ ProperSMul.isCompact_setOf_inter_nonempty, fun h ↦ ⟨?_⟩⟩ + refine ⟨fun h ↦ ProperSMul.isCompact_setOfPred_inter_nonempty, fun h ↦ ⟨?_⟩⟩ refine isProperMap_iff_isCompact_preimage.mpr ⟨by fun_prop, fun {K} hK ↦ ?_⟩ -- First reduce to the case `K = U × V`. let U := Prod.fst '' K @@ -83,6 +83,14 @@ lemma MulAction.properSMul_iff_isCompact_setOf_inter_nonempty [ContinuousSMul G · exact (hU.prod hV).isClosed.preimage (by fun_prop) · exact fun ⟨g, x⟩ ⟨hgx, hgx'⟩ ↦ ⟨⟨g • x, smul_mem_smul_set hgx', hgx⟩, hgx'⟩ +@[deprecated (since := "2026-07-09")] +alias MulAction.properSMul_iff_isCompact_setOf_inter_nonempty := + MulAction.properSMul_iff_isCompact_setOfPred_inter_nonempty + +@[deprecated (since := "2026-07-09")] +alias AddAction.properVAdd_iff_isCompact_setOf_inter_nonempty := + AddAction.properVAdd_iff_isCompact_setOfPred_inter_nonempty + /-- If a discrete group acts on a T2 space `X` such that `X × X` is compactly generated, and if the action is continuous in the second variable, then the action is properly discontinuous if and only if it is proper. This is in particular true if `X` is first-countable or @@ -91,7 +99,7 @@ weakly locally compact. -/ theorem properlyDiscontinuousSMul_iff_properSMul [DiscreteTopology G] [ContinuousConstSMul G X] : ProperlyDiscontinuousSMul G X ↔ ProperSMul G X := by have : ContinuousSMul G X := ⟨continuous_prod_of_discrete_left.mpr continuous_const_smul⟩ - simp only [MulAction.properSMul_iff_isCompact_setOf_inter_nonempty, isCompact_iff_finite] + simp only [MulAction.properSMul_iff_isCompact_setOfPred_inter_nonempty, isCompact_iff_finite] rw [properlyDiscontinuousSMul_iff] end diff --git a/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean b/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean index 47b0e8187ea3cc..115ceb3409a01f 100644 --- a/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean +++ b/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean @@ -344,9 +344,13 @@ include hAopen in theorem isOpen_forall_imp_mem_of_principal {S : Set ι} (hS : cofinite ≤ 𝓟 S) {p : ι → Prop} : IsOpen {f : Πʳ i, [R i, A i]_[𝓟 S] | ∀ i, p i → f.1 i ∈ A i} := by rw [le_principal_iff] at hS - convert! - isOpen_set_pi (hS.inter_of_left {i | p i}) (fun i _ ↦ hAopen i) |>.preimage continuous_coe + suffices h : {f : Πʳ i, [R i, A i]_[𝓟 S] | ∀ i, p i → f.1 i ∈ A i} = + ((↑) ⁻¹' (Sᶜ ∩ {i | p i}).pi A : Set (Πʳ i, [R i, A i]_[𝓟 S])) by + rw [h] + exact isOpen_set_pi (hS.inter_of_left {i | p i}) (fun i _ ↦ hAopen i) |>.preimage + continuous_coe ext f + simp only [mem_ofPred_eq, mem_preimage, Set.mem_pi, mem_inter_iff, mem_compl_iff] refine ⟨fun H i hi ↦ H i hi.2, fun H i hiT ↦ ?_⟩ by_cases hiS : i ∈ S · exact f.2 hiS diff --git a/Mathlib/Topology/Algebra/Semigroup.lean b/Mathlib/Topology/Algebra/Semigroup.lean index 98f129280c3c51..82205a29b08850 100644 --- a/Mathlib/Topology/Algebra/Semigroup.lean +++ b/Mathlib/Topology/Algebra/Semigroup.lean @@ -52,7 +52,7 @@ theorem exists_idempotent_of_compact_t2_of_continuous_mul_left {M} [Nonempty M] · rwa [← scaling_eq_self] at hm · rintro m'' ⟨mem'', eq'' : _ = m⟩ m' ⟨mem', eq' : _ = m⟩ refine ⟨N_mul _ mem'' _ mem', ?_⟩ - rw [Set.mem_setOf_eq, mul_assoc, eq', eq''] + rw [Set.mem_ofPred_eq, mul_assoc, eq', eq''] apply Set.inter_subset_left rw [← absorbing_eq_self] at hm exact hm.2 diff --git a/Mathlib/Topology/Algebra/Support.lean b/Mathlib/Topology/Algebra/Support.lean index 333e0edf1cc137..732870c1154bbf 100644 --- a/Mathlib/Topology/Algebra/Support.lean +++ b/Mathlib/Topology/Algebra/Support.lean @@ -254,7 +254,7 @@ theorem isCompact (hf : HasCompactMulSupport f) : IsCompact (mulTSupport f) := h @[to_additive] theorem _root_.hasCompactMulSupport_iff_eventuallyEq : HasCompactMulSupport f ↔ f =ᶠ[coclosedCompact α] 1 := - mem_coclosedCompact_iff.symm + (mem_coclosedCompact_iff (s := {x | f x = (1 : α → β) x})).symm @[to_additive] theorem _root_.isCompact_range_of_mulSupport_subset_isCompact [TopologicalSpace β] @@ -528,7 +528,7 @@ theorem LocallyFinite.exists_finset_nhds_mulSupport_subset {U : ι → Set X} [O rw [inter_assoc] at hz exact mem_of_mem_inter_left hz replace hz := mem_of_mem_inter_right (mem_of_mem_inter_left hz) - simp only [js, Finset.mem_filter, Finite.mem_toFinset, mem_setOf_eq, mem_iInter, + simp only [js, Finset.mem_filter, Finite.mem_toFinset, mem_ofPred_eq, mem_iInter, and_imp] at hz suffices (mulSupport fun i => f i z) ⊆ hnf.toFinset by refine hnf.toFinset.subset_coe_filter_of_subset_forall _ this fun i hi => ?_ @@ -536,7 +536,7 @@ theorem LocallyFinite.exists_finset_nhds_mulSupport_subset {U : ι → Set X} [O contrapose hz simp [hz, subset_mulTSupport (f i) hi] intro i hi - simp only [Finite.coe_toFinset, mem_setOf_eq] + simp only [Finite.coe_toFinset, mem_ofPred_eq] exact ⟨z, ⟨hi, hzn⟩⟩ @[to_additive] diff --git a/Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean b/Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean index 06703c0c4427b3..729c591bb7f2fe 100644 --- a/Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean +++ b/Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean @@ -42,7 +42,7 @@ noncomputable section variable (R : Type*) [Ring R] [ValuativeRel R] variable {R} in -lemma Valuation.exists_setOf_restrict_le_iff {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] +lemma Valuation.exists_setOfPred_restrict_le_iff {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] (v : Valuation R Γ₀) [v.Compatible] (x : R) (s : Set R) : (∃ γ : (ValueGroup₀ (.ofClass v))ˣ, {z | v.restrict (z - x) < γ.val} ⊆ s) ↔ ∃ γ : (ValueGroupWithZero R)ˣ, {a | valuation R (a - x) < γ} ⊆ s := by @@ -50,6 +50,9 @@ lemma Valuation.exists_setOf_restrict_le_iff {Γ₀ : Type*} [LinearOrderedCommG fun ⟨r, hr⟩ ↦ ⟨r.mapEquiv (orderMonoidIso v), ?_⟩⟩ all_goals convert! hr; simp +@[deprecated (since := "2026-07-09")] +alias Valuation.exists_setOf_restrict_le_iff := Valuation.exists_setOfPred_restrict_le_iff + /-- We say that a topology on `R` is valuative if the neighborhoods of `0` in `R` are determined by the valuative relation `· ≤ᵥ ·`. -/ class IsValuativeTopology [TopologicalSpace R] where @@ -70,7 +73,7 @@ instance nonarchimedeanRing : NonarchimedeanRing R := instance isValuativeTopology : IsValuativeTopology R where mem_nhds_iff {s x} := by rw [Filter.hasBasis_iff.mp ((valuation R).subgroups_basis.hasBasis_nhds x) s] - simp [neg_add_eq_sub, ← (valuation R).exists_setOf_restrict_le_iff, + simp [neg_add_eq_sub, ← (valuation R).exists_setOfPred_restrict_le_iff, ← restrict_lt_iff_lt_embedding] /-- The uniform structure induced by a valuative relation. Note that this is not made into a @@ -167,7 +170,7 @@ namespace Valuation lemma mem_nhds_iff {s : Set R} {x : R} : s ∈ 𝓝 x ↔ ∃ γ : (ValueGroup₀ (.ofClass v))ˣ, { z | v.restrict (z - x) < γ.val } ⊆ s := by convert! IsValuativeTopology.mem_nhds_iff (s := s) using 4 - simpa [neg_add_eq_sub] using v.exists_setOf_restrict_le_iff _ _ + simpa [neg_add_eq_sub] using v.exists_setOfPred_restrict_le_iff _ _ lemma mem_nhds_zero_iff (s : Set R) : s ∈ 𝓝 0 ↔ ∃ γ : (ValueGroup₀ (.ofClass v))ˣ, { x | v.restrict x < γ.val } ⊆ s := by @@ -275,7 +278,7 @@ section Discrete lemma discreteTopology_of_forall_map_eq_one (h : ∀ x : R, x ≠ 0 → v x = 1) : DiscreteTopology R := by simp only [discreteTopology_iff_isOpen_singleton_zero, isOpen_iff_mem_nhds, mem_singleton_iff, - forall_eq, v.mem_nhds_zero_iff, subset_singleton_iff, mem_setOf_eq] + forall_eq, v.mem_nhds_zero_iff, subset_singleton_iff, mem_ofPred_eq] use 1 contrapose! h obtain ⟨x, hx, hx'⟩ := h @@ -299,7 +302,7 @@ theorem isOpen_ball (r : ValueGroup₀ (.ofClass v)) : IsOpen {x | v.restrict x · simp intro x hx rw [v.mem_nhds_iff] - simp only [setOf_subset_setOf] + simp only [ofPred_subset_ofPred] exact ⟨Units.mk0 _ hr, fun y hy ↦ (sub_add_cancel y x).symm ▸ (v.restrict.map_add _ x).trans_lt (max_lt hy hx)⟩ @@ -324,7 +327,7 @@ theorem isOpen_closedBall {r : ValueGroup₀ (.ofClass v)} (hr : r ≠ 0) : IsOpen {x | v.restrict x ≤ r} := by rw [isOpen_iff_mem_nhds] intro x hx - simp only [v.mem_nhds_iff, setOf_subset_setOf] + simp only [v.mem_nhds_iff, ofPred_subset_ofPred] exact ⟨Units.mk0 _ hr, fun y hy ↦ (sub_add_cancel y x).symm ▸ le_trans (v.restrict.map_add _ _) (max_le (le_of_lt hy) hx)⟩ @@ -334,7 +337,7 @@ theorem isClosed_closedBall (r : ValueGroup₀ (.ofClass v)) : IsClosed {x | v.restrict x ≤ r} := by rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] intro x hx - simp only [mem_compl_iff, mem_setOf_eq, not_le] at hx + simp only [mem_compl_iff, mem_ofPred_eq, not_le] at hx rw [v.mem_nhds_iff] have hx' : v.restrict x ≠ 0 := hx.ne_zero exact ⟨Units.mk0 _ hx', fun y hy hy' ↦ ne_of_lt hy <| map_sub_swap v.restrict x y ▸ diff --git a/Mathlib/Topology/Algebra/Valued/LocallyCompact.lean b/Mathlib/Topology/Algebra/Valued/LocallyCompact.lean index b1d32d1ae33b4f..98c4f16d9fd1f1 100644 --- a/Mathlib/Topology/Algebra/Valued/LocallyCompact.lean +++ b/Mathlib/Topology/Algebra/Valued/LocallyCompact.lean @@ -69,17 +69,18 @@ lemma norm_irreducible_pos {ϖ : 𝒪[K]} (h : Irreducible ϖ) : 0 < ‖ϖ‖ := lemma coe_span_singleton_eq_closedBall (x : 𝒪[K]) : (Ideal.span {x} : Set 𝒪[K]) = Metric.closedBall 0 ‖x‖ := by - simp [Valuation.integer.coe_span_singleton_eq_setOf_le_v_coe, Set.ext_iff, ← NNReal.coe_le_coe] + simp [Valuation.integer.coe_span_singleton_eq_setOfPred_le_v_coe, Set.ext_iff, + ← NNReal.coe_le_coe] lemma _root_.Irreducible.maximalIdeal_eq_closedBall [IsDiscreteValuationRing 𝒪[K]] {ϖ : 𝒪[K]} (h : Irreducible ϖ) : (𝓂[K] : Set 𝒪[K]) = Metric.closedBall 0 ‖ϖ‖ := by - simp [h.maximalIdeal_eq_setOf_le_v_coe, Set.ext_iff, ← NNReal.coe_le_coe] + simp [h.maximalIdeal_eq_setOfPred_le_v_coe, Set.ext_iff, ← NNReal.coe_le_coe] lemma _root_.Irreducible.maximalIdeal_pow_eq_closedBall_pow [IsDiscreteValuationRing 𝒪[K]] {ϖ : 𝒪[K]} (h : Irreducible ϖ) (n : ℕ) : ((𝓂[K] ^ n : Ideal 𝒪[K]) : Set 𝒪[K]) = Metric.closedBall 0 (‖ϖ‖ ^ n) := by - simp [h.maximalIdeal_pow_eq_setOf_le_v_coe_pow, Set.ext_iff, ← NNReal.coe_le_coe] + simp [h.maximalIdeal_pow_eq_setOfPred_le_v_coe_pow, Set.ext_iff, ← NNReal.coe_le_coe] variable (K) in lemma exists_norm_coe_lt_one : ∃ x : 𝒪[K], 0 < ‖(x : K)‖ ∧ ‖(x : K)‖ < 1 := by @@ -151,7 +152,7 @@ lemma totallyBounded_iff_finite_residueField [(Valued.v : Valuation K Γ₀).Ran -- TODO: make Valued.maximalIdeal abbreviations instead of def rw [Valued.maximalIdeal, hp.maximalIdeal_eq, ← SetLike.mem_coe, - (Valuation.integer.integers _).coe_span_singleton_eq_setOf_le_v_algebraMap] + (Valuation.integer.integers _).coe_span_singleton_eq_setOfPred_le_v_algebraMap] rw [dist_comm] at hy' simpa [dist_eq_norm] using! hy'.le · intro H @@ -166,7 +167,8 @@ lemma totallyBounded_iff_finite_residueField [(Valued.v : Valuation K Γ₀).Ran have : {y : 𝒪[K] | v (y : K) ≤ v (p : K) ^ n} = Metric.closedBall 0 (‖p‖ ^ n) := by ext simp [← norm_pow] - simp only [Ideal.univ_eq_iUnion_image_add (𝓂[K] ^ n), hp.maximalIdeal_pow_eq_setOf_le_v_coe_pow, + simp only [Ideal.univ_eq_iUnion_image_add (𝓂[K] ^ n), + hp.maximalIdeal_pow_eq_setOfPred_le_v_coe_pow, this, AddSubgroupClass.coe_norm, Set.image_univ, Set.mem_range, Set.iUnion_exists, Set.iUnion_iUnion_eq', Set.iUnion_subset_iff, Metric.vadd_closedBall, vadd_eq_add, add_zero] intro @@ -264,7 +266,7 @@ lemma locallyFiniteOrder_units_mrange_of_isCompact_integer (hc : IsCompact (X := push Not at hi' exact Subtype.coe_injective.ne_iff.mp (hi'.trans' z0).ne' · intro i - simp only [Set.mem_Icc, Finset.mem_coe, exists_prop, Set.mem_setOf_eq, and_imp] + simp only [Set.mem_Icc, Finset.mem_coe, exists_prop, Set.mem_ofPred_eq, and_imp] -- we get the `c` from the cover that covers our arbitrary `i` with its set obtain ⟨c, hc⟩ := i.val.prop intro hzi hi1 @@ -275,9 +277,9 @@ lemma locallyFiniteOrder_units_mrange_of_isCompact_integer (hc : IsCompact (X := -- and this `c` is either less than or greater than (or equal to) the threshold element simp only [MonoidWithZeroHom.coe_ofClass] at hc split_ifs at hj' with hcj - · simp only [Set.mem_setOf_eq, hc, Subtype.coe_le_coe, Units.val_le_val] at hj' + · simp only [Set.mem_ofPred_eq, hc, Subtype.coe_le_coe, Units.val_le_val] at hj' simp [hcj, le_antisymm hj' hzi] - · simp only [Set.mem_setOf_eq] at hj' + · simp only [Set.mem_ofPred_eq] at hj' rw [dif_neg hcj] simp [← hj', hc] @@ -338,7 +340,7 @@ lemma compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_resi lemma properSpace_iff_compactSpace_integer [(Valued.v : Valuation K Γ₀).RankOne] : ProperSpace K ↔ CompactSpace 𝒪[K] := by simp only [← isCompact_univ_iff, Subtype.isCompact_iff, Set.image_univ, Subtype.range_coe_subtype, - toNormedField.setOf_mem_integer_eq_closedBall] + toNormedField.setOfPred_mem_integer_eq_closedBall] constructor <;> intro h · exact isCompact_closedBall 0 1 · suffices LocallyCompactSpace K from .of_nontriviallyNormedField_of_weaklyLocallyCompactSpace K @@ -350,7 +352,7 @@ lemma properSpace_iff_completeSpace_and_isDiscreteValuationRing_integer_and_fini ProperSpace K ↔ CompleteSpace K ∧ IsDiscreteValuationRing 𝒪[K] ∧ Finite 𝓀[K] := by simp only [properSpace_iff_compactSpace_integer, compactSpace_iff_completeSpace_and_isDiscreteValuationRing_and_finite_residueField, - toNormedField.setOf_mem_integer_eq_closedBall, + toNormedField.setOfPred_mem_integer_eq_closedBall, completeSpace_iff_isComplete_univ (α := 𝒪[K]), Subtype.isComplete_iff, NormedField.completeSpace_iff_isComplete_closedBall, Set.image_univ, Subtype.range_coe_subtype] diff --git a/Mathlib/Topology/Algebra/Valued/NormedValued.lean b/Mathlib/Topology/Algebra/Valued/NormedValued.lean index 828583db4053db..a23752eb3f3686 100644 --- a/Mathlib/Topology/Algebra/Valued/NormedValued.lean +++ b/Mathlib/Topology/Algebra/Valued/NormedValued.lean @@ -75,7 +75,7 @@ def toValued : Valued K ℝ≥0 := rcases RankLeOne.exists_val_lt (valuation (K := K)) with H | H · use Units.mk0 (valuation.restrict 1) (by simp) intro x hx - simp only [Units.val_mk0, mem_setOf_eq, map_one] at hx + simp only [Units.val_mk0, mem_ofPred_eq, map_one] at hx by_cases hx0 : x = 0 · exact h (hx0 ▸ Metric.mem_ball_self hε) · exfalso @@ -90,7 +90,7 @@ def toValued : Valued K ℝ≥0 := intro y hy apply h simp only [Metric.mem_ball, dist_zero_right] - simp only [Units.val_mk0, mem_setOf_eq, restrict_lt_iff, ← NNReal.coe_lt_coe] at hy + simp only [Units.val_mk0, mem_ofPred_eq, restrict_lt_iff, ← NNReal.coe_lt_coe] at hy apply lt_trans hy simpa [RankLeOne.hom', valuation.restrict_def] using! hxy · rintro ⟨ε, hε⟩ @@ -176,8 +176,8 @@ def toNormedField : NormedField L := use δ, hδ_pos apply subset_trans _ hε intro x hx - simp only [mem_setOf_eq, Valuation.norm, hδ, NNReal.coe_lt_coe] at hx - rw [mem_setOf, ← neg_sub, Valuation.map_neg] + simp only [mem_ofPred_eq, Valuation.norm, hδ, NNReal.coe_lt_coe] at hx + rw [mem_ofPred, ← neg_sub, Valuation.map_neg] exact (RankOne.strictMono Valued.v).lt_iff_lt.mp hx · haveI : Nontrivial Γ₀ˣ := (nontrivial_iff_exists_ne (1 : Γ₀ˣ)).mpr ⟨RankOne.unit val.v, RankOne.unit_ne_one val.v⟩ @@ -185,14 +185,14 @@ def toNormedField : NormedField L := use u apply subset_trans _ hr intro x hx - simp only [Valuation.norm, mem_setOf_eq] + simp only [Valuation.norm, mem_ofPred_eq] apply lt_trans _ hu rw [NNReal.coe_lt_coe, ← neg_sub, Valuation.map_neg] exact (RankOne.strictMono Valued.v).lt_iff_lt.mpr hx · simp only [Directed] intro x y use min x y - simp only [le_principal_iff, mem_principal, setOf_subset_setOf, Prod.forall] + simp only [le_principal_iff, mem_principal, ofPred_subset_ofPred, Prod.forall] exact ⟨fun a b hab => lt_of_lt_of_le hab (min_le_left _ _), fun a b hab => lt_of_lt_of_le hab (min_le_right _ _)⟩ } @@ -256,11 +256,14 @@ theorem one_lt_norm_iff : 1 < ‖x‖ ↔ 1 < val.v x := by rw [← map_one val.v, ← v.restrict_lt_iff] simpa only [map_one] using! (Valuation.RankOne.strictMono val.v).lt_iff_lt (a := 1) -lemma setOf_mem_integer_eq_closedBall : +lemma setOfPred_mem_integer_eq_closedBall : { x : L | x ∈ Valued.v.integer } = Metric.closedBall 0 1 := by ext x simp [mem_integer_iff] +@[deprecated (since := "2026-07-09")] +alias setOf_mem_integer_eq_closedBall := setOfPred_mem_integer_eq_closedBall + end toNormedField /-- diff --git a/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean b/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean index de9f51ff05bed3..75ba082bc76b60 100644 --- a/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean +++ b/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean @@ -73,8 +73,8 @@ theorem subgroups_basis : use γ₀ rintro - ⟨r, r_in, s, s_in, rfl⟩ simp only [ltAddSubgroup, Units.coe_map, MonoidHom.coe_coe, AddSubgroup.coe_set_mk, - AddSubmonoid.coe_set_mk, AddSubsemigroup.coe_set_mk, mem_setOf_eq] at r_in s_in - simp only [coe_ltAddSubgroup, Units.coe_map, MonoidHom.coe_coe, mem_setOf_eq] + AddSubmonoid.coe_set_mk, AddSubsemigroup.coe_set_mk, mem_ofPred_eq] at r_in s_in + simp only [coe_ltAddSubgroup, Units.coe_map, MonoidHom.coe_coe, mem_ofPred_eq] rw [← restrict_lt_iff_lt_embedding] at * calc v.restrict (r * s) = v.restrict r * v.restrict s := Valuation.map_mul _ _ _ @@ -85,7 +85,7 @@ theorem subgroups_basis : rcases GroupWithZero.eq_zero_or_unit (v x) with (Hx | ⟨γx, Hx⟩) · use (1 : (ValueGroup₀ (.ofClass v))ˣ) rintro y _ - simp only [coe_ltAddSubgroup, preimage_setOf_eq, mem_setOf_eq] + simp only [coe_ltAddSubgroup, preimage_ofPred_eq, mem_ofPred_eq] rw [Valuation.map_mul, Hx, zero_mul] exact Units.zero_lt _ · set u : (ValueGroup₀ (.ofClass v))ˣ := Units.mk0 ((restrict₀ (.ofClass v)) x) @@ -94,7 +94,7 @@ theorem subgroups_basis : simp [restrict₀_apply, embedding_apply, hu_def, Hx] use u⁻¹ * γ rintro y (vy_lt : v y < ValueGroup₀.embedding (u⁻¹ * γ).1) - simp only [coe_ltAddSubgroup, preimage_setOf_eq, mem_setOf_eq] + simp only [coe_ltAddSubgroup, preimage_ofPred_eq, mem_ofPred_eq] rw [Valuation.map_mul, Hx, mul_comm] rw [Units.val_mul, mul_comm, map_mul, hu] at vy_lt simpa using mul_inv_lt_of_lt_mul₀ vy_lt @@ -103,7 +103,7 @@ theorem subgroups_basis : rcases GroupWithZero.eq_zero_or_unit (v x) with (Hx | ⟨γx, Hx⟩) · use 1 rintro y _ - simp only [coe_ltAddSubgroup, preimage_setOf_eq, mem_setOf_eq, Valuation.map_mul, Hx, + simp only [coe_ltAddSubgroup, preimage_ofPred_eq, mem_ofPred_eq, Valuation.map_mul, Hx, mul_zero, Units.zero_lt] · set u : (ValueGroup₀ (.ofClass v))ˣ := Units.mk0 ((restrict₀ (.ofClass v)) x) (by simp [restrict₀_apply]; aesop) with hu_def @@ -111,7 +111,7 @@ theorem subgroups_basis : hu_def, Hx] use u⁻¹ * γ rintro y (vy_lt : v y < ValueGroup₀.embedding (u⁻¹ * γ).1) - simp only [coe_ltAddSubgroup, preimage_setOf_eq, mem_setOf_eq, Valuation.map_mul, Hx] + simp only [coe_ltAddSubgroup, preimage_ofPred_eq, mem_ofPred_eq, Valuation.map_mul, Hx] rw [Units.val_mul, mul_comm, map_mul, hu] at vy_lt simpa using mul_inv_lt_of_lt_mul₀ vy_lt } @@ -172,7 +172,7 @@ variable {R Γ₀} theorem mem_nhds {s : Set R} {x : R} : s ∈ 𝓝 x ↔ ∃ γ : (MonoidWithZeroHom.ValueGroup₀ (.ofClass _i.v))ˣ, { y | (v.restrict (y - x) ) < γ.1 } ⊆ s := by - simp only [← nhds_translation_add_neg x, ← sub_eq_add_neg, preimage_setOf_eq, true_and, + simp only [← nhds_translation_add_neg x, ← sub_eq_add_neg, preimage_ofPred_eq, true_and, ((hasBasis_nhds_zero R Γ₀).comap fun y ↦ y - x).mem_iff] theorem mem_nhds_zero {s : Set R} : s ∈ 𝓝 (0 : R) ↔ @@ -199,7 +199,7 @@ section Discrete lemma discreteTopology_of_forall_map_eq_one (h : ∀ x : R, x ≠ 0 → v x = 1) : DiscreteTopology R := by simp only [discreteTopology_iff_isOpen_singleton_zero, isOpen_iff_mem_nhds, mem_singleton_iff, - forall_eq, mem_nhds_zero, subset_singleton_iff, mem_setOf_eq] + forall_eq, mem_nhds_zero, subset_singleton_iff, mem_ofPred_eq] use 1 contrapose! h obtain ⟨x, hx, hx'⟩ := h @@ -237,7 +237,7 @@ theorem isOpen_ball (r : ValueGroup₀ (.ofClass _i.v)) : · simp intro x hx rw [mem_nhds] - simp only [setOf_subset_setOf] + simp only [ofPred_subset_ofPred] exact ⟨Units.mk0 _ hr, fun y hy ↦ (sub_add_cancel y x).symm ▸ (v.restrict.map_add _ x).trans_lt (max_lt hy hx)⟩ @@ -260,7 +260,7 @@ theorem isOpen_closedBall {r : ValueGroup₀ (.ofClass _i.v)} (hr : r ≠ 0) : rw [isOpen_iff_mem_nhds] intro x hx rw [mem_nhds] - simp only [setOf_subset_setOf] + simp only [ofPred_subset_ofPred] exact ⟨Units.mk0 _ hr, fun y hy ↦ (sub_add_cancel y x).symm ▸ le_trans (v.restrict.map_add _ _) (max_le (le_of_lt hy) hx)⟩ @@ -269,7 +269,7 @@ theorem isClosed_closedBall (r : ValueGroup₀ (.ofClass _i.v)) : IsClosed {x | v.restrict x ≤ r} := by rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] intro x hx - simp only [mem_compl_iff, mem_setOf_eq, not_le] at hx + simp only [mem_compl_iff, mem_ofPred_eq, not_le] at hx rw [mem_nhds] have hx' : v.restrict x ≠ 0 := hx.ne_zero exact ⟨Units.mk0 _ hx', fun y hy hy' ↦ ne_of_lt hy <| map_sub_swap v.restrict x y ▸ diff --git a/Mathlib/Topology/Algebra/Valued/ValuativeRel.lean b/Mathlib/Topology/Algebra/Valued/ValuativeRel.lean index 60fce74c07b24e..6d1b786b733b71 100644 --- a/Mathlib/Topology/Algebra/Valued/ValuativeRel.lean +++ b/Mathlib/Topology/Algebra/Valued/ValuativeRel.lean @@ -59,7 +59,7 @@ instance (priority := low) {R : Type*} [Ring R] [ValuativeRel R] [UniformSpace R simp_rw [Valuation.restrict_lt_iff_lt_embedding] convert! mem_nhds_zero_iff (R := R) simpa [← Valuation.restrict_lt_iff_lt_embedding] using - (valuation R).exists_setOf_restrict_le_iff 0 _ + (valuation R).exists_setOfPred_restrict_le_iff 0 _ lemma v_eq_valuation {R : Type*} [Ring R] [ValuativeRel R] [UniformSpace R] [IsUniformAddGroup R] [IsValuativeTopology R] : diff --git a/Mathlib/Topology/Algebra/Valued/ValuedField.lean b/Mathlib/Topology/Algebra/Valued/ValuedField.lean index 752bb654a6e7a5..585f219c3e8296 100644 --- a/Mathlib/Topology/Algebra/Valued/ValuedField.lean +++ b/Mathlib/Topology/Algebra/Valued/ValuedField.lean @@ -98,7 +98,7 @@ instance (priority := 100) Valued.isTopologicalDivisionRing [Valued K Γ₀] : use min (γ * (γ' * γ')) γ' intro y y_in apply hs - simp only [mem_setOf_eq, Units.min_val, Units.val_mul] at y_in + simp only [mem_ofPred_eq, Units.min_val, Units.val_mul] at y_in exact Valuation.inversion_estimate _ x_ne y_in } /-- A valued division ring is separated. -/ @@ -111,7 +111,7 @@ instance (priority := 100) ValuedRing.separated [Valued K Γ₀] : T0Space K := set γ' := Units.mk0 ((ValueGroup₀.restrict₀ _) x) (v.restrict.ne_zero_iff.mpr x_ne) with hdef exact ⟨γ', fun y hy => by simp only [Valuation.restrict_lt_iff_lt_embedding, hdef, sub_zero, Units.val_mk0, - mem_setOf_eq, embedding_restrict₀] at hy + mem_ofPred_eq, embedding_restrict₀] at hy simpa using hy⟩ section @@ -145,7 +145,7 @@ theorem Valued.continuous_valuation_of_surjective [hv : Valued K Γ₀] rw [Filter.Eventually, Valued.mem_nhds_zero] obtain ⟨x, hx⟩ := hsurj γ use Units.mk0 (restrict₀ (.ofClass hv.v) x) (by simp [restrict₀_apply, hx, hγ]) - simp only [Units.val_mk0, setOf_subset_setOf, ← v.restrict_def, Valuation.restrict_lt_iff, hx, + simp only [Units.val_mk0, ofPred_subset_ofPred, ← v.restrict_def, Valuation.restrict_lt_iff, hx, imp_self, implies_true] · have h0 : hv.v x ≠ 0 := (Valuation.ne_zero_iff _).mpr h rw [ContinuousAt, WithZeroTopology.tendsto_of_ne_zero h0] @@ -212,7 +212,7 @@ lemma valuation_isClosedMap : IsClosedMap (v.restrict : K → (ValueGroup₀ (.o refine IsClosedMap.of_nonempty ?_ intro U hU hU' simp only [← isOpen_compl_iff, isOpen_iff_mem_nhds, mem_compl_iff, mem_nhds, subset_compl_comm, - compl_setOf, not_lt] at hU + compl_ofPred, not_lt] at hU simp only [isClosed_iff, mem_image, map_eq_zero, exists_eq_right, ne_eq, image_subset_iff] refine (em _).imp_right fun h ↦ ?_ obtain ⟨γ, h⟩ := hU _ h @@ -237,8 +237,7 @@ theorem continuous_extension : Continuous (Valued.extension : hat K → _) := by rw [Valuation.map_one] exact zero_ne_one.symm convert! Valued.locally_const this - ext x - rw [Valuation.map_one, mem_preimage, mem_singleton_iff, mem_setOf_eq] + simp only [Valuation.map_one, Set.mem_iff_mem, mem_preimage, mem_singleton_iff] obtain ⟨V, V_in, hV⟩ : ∃ V ∈ 𝓝 (1 : hat K), ∀ x : K, (x : hat K) ∈ V → (v x : Γ₀) = 1 := by rwa [Completion.isDenseInducing_coe.nhds_eq_comap, mem_comap] at preimage_one have : ∃ V' ∈ 𝓝 (1 : hat K), (0 : hat K) ∉ V' ∧ ∀ (x) (_ : x ∈ V') (y) (_ : y ∈ V'), @@ -372,7 +371,7 @@ lemma exists_coe_eq_v (x : hat K) : ∃ r : K, extensionValuation x = v r := by (replacing grind's canonicalizer with a type-directed normalizer), `grind` closed this goal. It is not yet clear whether this is due to defeq abuse in Mathlib or a problem in the new canonicalizer; a minimization would help. The original proof was: `grind` -/ - ext; simp + simp -- Bourbaki CA VI §5 no.3 Proposition 5 (d) theorem closure_coe_completion_v_lt {γ : Γ₀ˣ} : @@ -384,10 +383,10 @@ theorem closure_coe_completion_v_lt {γ : Γ₀ˣ} : have heq : γ₀ = embedding γ₀' := rfl suffices γ₀ ≠ 0 → (x ∈ closure ((↑) '' { x : K | v x < (γ : Γ₀) }) ↔ γ₀ < (γ : Γ₀)) by rcases eq_or_ne γ₀ 0 with h | h - · simp only [(Valuation.zero_iff _).mp h, mem_setOf_eq, Valuation.map_zero, Units.zero_lt, + · simp only [(Valuation.zero_iff _).mp h, mem_ofPred_eq, Valuation.map_zero, Units.zero_lt, iff_true] apply subset_closure - exact ⟨0, by simp only [mem_setOf_eq, Valuation.map_zero, Units.zero_lt, true_and]; rfl⟩ + exact ⟨0, by simp only [mem_ofPred_eq, Valuation.map_zero, Units.zero_lt, true_and]; rfl⟩ · exact this h intro h have h' : γ₀' ≠ 0 := by simpa only [heq, map_ne_zero] using h diff --git a/Mathlib/Topology/Algebra/Valued/WithVal.lean b/Mathlib/Topology/Algebra/Valued/WithVal.lean index 0f0f940695bd2b..bb71a2e008f805 100644 --- a/Mathlib/Topology/Algebra/Valued/WithVal.lean +++ b/Mathlib/Topology/Algebra/Valued/WithVal.lean @@ -218,7 +218,7 @@ instance : (valuation v).Compatible := .ofValuation (valuation v) instance : IsValuativeTopology (WithVal v) where mem_nhds_iff {s x} := by - simp only [Set.image_add_left, Set.preimage_setOf_eq, Valued.mem_nhds] + simp only [Set.image_add_left, Set.preimage_ofPred_eq, Valued.mem_nhds] let e := ValuativeRel.ValueGroupWithZero.orderMonoidIso (valuation v) apply e.unitsCongr.symm.exists_congr fun a ↦ ?_ simp [-OrderMonoidIso.val_unitsCongr_symm_apply, OrderMonoidIso.unitsCongr_symm_apply, @@ -546,11 +546,11 @@ theorem IsEquiv.uniformContinuous_equiv [hval : Valued R Γ₀'] (hv : Valued.v have hs0' : 0 < Valued.v.restrict (toVal v s) := by simp [restrict_pos_iff, h.pos_iff, ← hv, hs₀] have h' : v.restrict.IsEquiv w.restrict := h.restrict - rw [← hr, equiv_apply, Set.mem_setOf_eq, lt_div_iff₀ ((restrict_pos_iff Valued.v s).mpr hs₀), hv, + rw [← hr, equiv_apply, Set.mem_ofPred_eq, lt_div_iff₀ ((restrict_pos_iff Valued.v s).mpr hs₀), hv, ← map_mul, ← lt_def, ← ofVal_mul, ← hy, ← toVal_mul, ← h'.orderRingIso_apply, ← h'.orderRingIso.lt_symm_apply] simp only [toVal_mul, orderRingIso_symm_apply, lt_def, ofVal_mul, restrict_lt_iff] - simp only [equiv_symm_apply, Units.val_mk0, Set.mem_setOf_eq, lt_div_iff₀ hs0'] at hx + simp only [equiv_symm_apply, Units.val_mk0, Set.mem_ofPred_eq, lt_div_iff₀ hs0'] at hx rwa [← map_mul, restrict_lt_iff] at hx theorem IsEquiv.uniformContinuous_equiv_symm [hval : Valued R Γ₀'] (hv : Valued.v = w) @@ -568,8 +568,8 @@ theorem IsEquiv.uniformContinuous_equiv_symm [hval : Valued R Γ₀'] (hv : Valu (eq_zero h (r := s.ofVal)).ne] exact ⟨hr₀.ne', hs₀.ne'⟩) intro x hx - simp only [equiv_symm_apply, Set.mem_setOf_eq] - simp only [equiv_apply, Units.val_mk0, Set.mem_setOf_eq] at hx + simp only [equiv_symm_apply, Set.mem_ofPred_eq] + simp only [equiv_apply, Units.val_mk0, Set.mem_ofPred_eq] at hx rw [lt_div_iff₀, ← map_mul, restrict_lt_iff, hv, h.lt_iff_lt, map_mul] at hx · rw [← hr, lt_div_iff₀ ((restrict_pos_iff Valued.v s).mpr hs₀), ← map_mul, ← lt_def, ← h.orderRingIso_apply] @@ -591,7 +591,7 @@ lemma IsEquiv.uniformContinuous (h : v.IsEquiv w) : intro x let u := WithZero.unzero (Units.ne_zero x) obtain ⟨a, ha, y, hu⟩ := (mem_valueGroup_iff_of_comm _).mp u.2 - simp only [Set.mem_setOf_eq, RingHom.id_apply] + simp only [Set.mem_ofPred_eq, RingHom.id_apply] set y₀ := h_val.orderMonoidIso x with hy₀_def have hy₀_ne_zero : y₀ ≠ 0 := by simp [hy₀_def] set y := (Units.mk0 y₀ hy₀_ne_zero) with hy_def @@ -658,7 +658,7 @@ theorem IsEquiv.valuedCompletion_le_one_iff {K : Type*} [Field K] {v : Valuation Valued.v x ≤ 1 ↔ Valued.v.restrict x ≤ 1 := by rw [restrict_le_one_iff] simp_rw [h1] convert! - (mapEquiv h.uniformEquiv).toHomeomorph.isClosed_setOf_iff + (mapEquiv h.uniformEquiv).toHomeomorph.isClosed_setOfPred_iff (Valued.isClopen_closedBall _ one_ne_zero) (Valued.isClopen_closedBall _ one_ne_zero) rw [restrict_le_one_iff] rfl diff --git a/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean b/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean index de8116ebd5373c..4389b89196151b 100644 --- a/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean +++ b/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean @@ -28,7 +28,7 @@ variable {R Γ₀ : Type*} [Ring R] [LinearOrderedCommGroupWithZero Γ₀] -- TODO: use ValuativeRel after https://github.com/leanprover-community/mathlib4/issues/26833 lemma tendsto_zero_pow_of_v_lt_one [MulArchimedean Γ₀] [Valued R Γ₀] {x : R} (hx : v x < 1) : Tendsto (fun n : ℕ ↦ x ^ n) atTop (𝓝 0) := by - simp only [(hasBasis_nhds_zero _ _).tendsto_right_iff, mem_setOf_eq, map_pow, eventually_atTop, + simp only [(hasBasis_nhds_zero _ _).tendsto_right_iff, mem_ofPred_eq, map_pow, eventually_atTop, forall_const] intro y let v : Valuation R Γ₀ := Valued.v diff --git a/Mathlib/Topology/Algebra/WithZeroTopology.lean b/Mathlib/Topology/Algebra/WithZeroTopology.lean index 760e23fee1833b..902ee6e1ea8483 100644 --- a/Mathlib/Topology/Algebra/WithZeroTopology.lean +++ b/Mathlib/Topology/Algebra/WithZeroTopology.lean @@ -63,7 +63,7 @@ theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by only if there exists a nonzero element `γ₀` such that `Iio γ₀ ⊆ U`. -/ theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by rw [nhds_zero] - refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩ + refine hasBasis_biInf_principal (S := {γ : Γ₀ | γ ≠ 0}) ?_ ⟨1, one_ne_zero⟩ exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab) theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) := @@ -142,7 +142,7 @@ theorem isOpen_Iio {a : Γ₀} : IsOpen (Iio a) := structure: the set `{p : Γ₀ × Γ₀ | p.1 ≤ p.2}` is closed. -/ scoped instance (priority := 100) orderClosedTopology : OrderClosedTopology Γ₀ where isClosed_le' := by - simp only [← isOpen_compl_iff, compl_setOf, not_le, isOpen_iff_mem_nhds] + simp only [← isOpen_compl_iff, compl_ofPred, not_le, isOpen_iff_mem_nhds] rintro ⟨a, b⟩ (hab : b < a) rw [nhds_prod_eq, nhds_of_ne_zero hab.ne_zero, pure_prod] exact Iio_mem_nhds hab diff --git a/Mathlib/Topology/Baire/BaireMeasurable.lean b/Mathlib/Topology/Baire/BaireMeasurable.lean index 07b3f91ed20e7e..c8ec75bdcf010f 100644 --- a/Mathlib/Topology/Baire/BaireMeasurable.lean +++ b/Mathlib/Topology/Baire/BaireMeasurable.lean @@ -36,7 +36,8 @@ open Topology /-- Notation for `=ᶠ[residual _]`. That is, eventual equality with respect to the filter of residual sets. In lemma names, this is called `residualEq`. -/ -scoped[Topology] notation:50 f " =ᵇ " g:50 => Filter.EventuallyEq (residual _) f g +scoped[Topology] notation:50 s " =ᵇ " t:50 => + Filter.EventuallyEq (residual _) (fun x => x ∈ s) (fun x => x ∈ t) /-- Notation to say that a property of points in a topological space holds almost everywhere in the sense of Baire category. That is, on a residual set. -/ diff --git a/Mathlib/Topology/Baire/Lemmas.lean b/Mathlib/Topology/Baire/Lemmas.lean index 7d9c592d303eeb..bcbb354e3f018b 100644 --- a/Mathlib/Topology/Baire/Lemmas.lean +++ b/Mathlib/Topology/Baire/Lemmas.lean @@ -156,7 +156,7 @@ theorem mem_residual {s : Set X} : s ∈ residual X ↔ ∃ t ⊆ s, IsGδ t ∧ /-- A property holds on a residual (comeagre) set if and only if it holds on some dense `Gδ` set. -/ theorem eventually_residual {p : X → Prop} : (∀ᶠ x in residual X, p x) ↔ ∃ t : Set X, IsGδ t ∧ Dense t ∧ ∀ x ∈ t, p x := by - simp only [Filter.Eventually, mem_residual, subset_def, mem_setOf_eq] + simp only [Filter.Eventually, mem_residual, subset_def, mem_ofPred_eq] tauto theorem dense_of_mem_residual {s : Set X} (hs : s ∈ residual X) : Dense s := diff --git a/Mathlib/Topology/Bases.lean b/Mathlib/Topology/Bases.lean index bbfba69335b6d4..e9d825b2b4cc9d 100644 --- a/Mathlib/Topology/Bases.lean +++ b/Mathlib/Topology/Bases.lean @@ -793,7 +793,7 @@ theorem exists_countable_basis [SecondCountableTopology α] : ∃ b : Set (Set α), b.Countable ∧ ∅ ∉ b ∧ IsTopologicalBasis b := by obtain ⟨b, hb₁, hb₂⟩ := @SecondCountableTopology.is_open_generated_countable α _ _ refine ⟨_, ?_, notMem_sdiff_of_mem ?_, (isTopologicalBasis_of_subbasis hb₂).sdiff_empty⟩ - exacts [((countable_setOf_finite_subset hb₁).image _).mono sdiff_subset, rfl] + exacts [((countable_ofPred_finite_subset hb₁).image _).mono sdiff_subset, rfl] theorem exists_seq_basis [SecondCountableTopology α] : ∃ b : ℕ → Set α, IsTopologicalBasis (range b) := by @@ -839,9 +839,10 @@ variable (α) -- see Note [lower instance priority] instance (priority := 100) SecondCountableTopology.to_firstCountableTopology [SecondCountableTopology α] : FirstCountableTopology α := - ⟨fun _ => HasCountableBasis.isCountablyGenerated <| + ⟨fun x => HasCountableBasis.isCountablyGenerated <| ⟨(isBasis_countableBasis α).nhds_hasBasis, - (countable_countableBasis α).mono inter_subset_left⟩⟩ + (countable_countableBasis α).mono + (inter_subset_left (s := countableBasis α) (t := {t | x ∈ t}))⟩⟩ -- see Note [lower instance priority] instance (priority := 100) [Countable α] [FirstCountableTopology α] : diff --git a/Mathlib/Topology/Category/CompHaus/Basic.lean b/Mathlib/Topology/Category/CompHaus/Basic.lean index 3d82ef12851a4c..f447d00d8e3e4d 100644 --- a/Mathlib/Topology/Category/CompHaus/Basic.lean +++ b/Mathlib/Topology/Category/CompHaus/Basic.lean @@ -144,7 +144,7 @@ def limitCone {J : Type v} [SmallCategory J] (F : J ⥤ CompHaus.{max v u}) : Li { u : ∀ j, F.obj j | ∀ {i j : J} (f : i ⟶ j), F.map f (u i) = u j } = ⋂ (i : J) (j : J) (f : i ⟶ j), { u | F.map f (u i) = u j } := by ext1 - simp only [Set.mem_iInter, Set.mem_setOf_eq] + simp only [Set.mem_iInter, Set.mem_ofPred_eq] rw [this] apply isClosed_iInter intro i diff --git a/Mathlib/Topology/Category/Compactum.lean b/Mathlib/Topology/Category/Compactum.lean index 9eacb2c74d35a2..982af3f3f25f20 100644 --- a/Mathlib/Topology/Category/Compactum.lean +++ b/Mathlib/Topology/Category/Compactum.lean @@ -261,7 +261,7 @@ private theorem cl_cl {X : Compactum} (A : Set X) : cl (cl A) ⊆ cl A := by -- Finish apply claim4.finiteInter_mem T intro t ht - exact finiteInterClosure.basic (@hT t ht) + exact MemFiniteInterClosure.basic (@hT t ht) set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in @@ -338,7 +338,7 @@ theorem str_eq_of_le_nhds {X : Compactum} (F : Ultrafilter X) (x : X) : ↑F ≤ intro T hT refine claim6 _ (finiteInter_mem (.finiteInterClosure_finiteInter _) _ ?_) intro t ht - exact finiteInterClosure.basic (@hT t ht) + exact MemFiniteInterClosure.basic (@hT t ht) theorem le_nhds_of_str_eq {X : Compactum} (F : Ultrafilter X) (x : X) : X.str F = x → ↑F ≤ 𝓝 x := fun h => le_nhds_iff.mpr fun s hx hs => hs _ <| by rwa [h] diff --git a/Mathlib/Topology/Category/Profinite/Nobeling/Basic.lean b/Mathlib/Topology/Category/Profinite/Nobeling/Basic.lean index fbc475f10b9339..227d02aba32925 100644 --- a/Mathlib/Topology/Category/Profinite/Nobeling/Basic.lean +++ b/Mathlib/Topology/Category/Profinite/Nobeling/Basic.lean @@ -609,7 +609,7 @@ theorem eval_πs_image {l : Products I} {o : Ordinal} (hl : ∀ i ∈ l.val, ord I i < o) : eval C '' { m | m < l } = (πs C o) '' eval (π C (ord I · < o)) '' { m | m < l } := by ext f - simp only [Set.mem_image, Set.mem_setOf_eq, exists_exists_and_eq_and] + simp only [Set.mem_image, Set.mem_ofPred_eq, exists_exists_and_eq_and] apply exists_congr; intro m apply and_congr_right; intro hm rw [eval_πs C (lt_ord_of_lt hm hl)] @@ -618,7 +618,7 @@ theorem eval_πs_image' {l : Products I} {o₁ o₂ : Ordinal} (h : o₁ ≤ o (hl : ∀ i ∈ l.val, ord I i < o₁) : eval (π C (ord I · < o₂)) '' { m | m < l } = (πs' C h) '' eval (π C (ord I · < o₁)) '' { m | m < l } := by ext f - simp only [Set.mem_image, Set.mem_setOf_eq, exists_exists_and_eq_and] + simp only [Set.mem_image, Set.mem_ofPred_eq, exists_exists_and_eq_and] apply exists_congr; intro m apply and_congr_right; intro hm rw [eval_πs' C h (lt_ord_of_lt hm hl)] diff --git a/Mathlib/Topology/Category/Profinite/Nobeling/Span.lean b/Mathlib/Topology/Category/Profinite/Nobeling/Span.lean index 85b6d679dd112a..c604a4c348dca5 100644 --- a/Mathlib/Topology/Category/Profinite/Nobeling/Span.lean +++ b/Mathlib/Topology/Category/Profinite/Nobeling/Span.lean @@ -211,7 +211,7 @@ theorem GoodProducts.spanFin [WellFoundedLT I] : apply Submodule.smul_mem apply Submodule.subset_span refine ⟨m, ⟨?_, rfl⟩⟩ - simp only [Set.mem_setOf_eq] + simp only [Set.mem_ofPred_eq] have hmas : m.val ≤ as := hc (by simpa only [Finset.mem_coe, Finsupp.mem_support_iff] using hm) refine le_trans hmas ?_ diff --git a/Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean b/Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean index 4b2e9628bc9211..fbfde7e4f87dea 100644 --- a/Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean +++ b/Mathlib/Topology/Category/Profinite/Nobeling/Successor.lean @@ -114,14 +114,14 @@ theorem contained_C1 : contained (π (C1 C ho) (ord I · < o)) o := theorem union_C0C1_eq : (C0 C ho) ∪ (C1 C ho) = C := by ext x - simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_setOf_eq, + simp only [C0, C1, Set.mem_union, Set.mem_inter_iff, Set.mem_ofPred_eq, ← and_or_left, and_iff_left_iff_imp, Bool.dichotomy (x (term I ho)), implies_true] /-- The intersection of `C0` and the projection of `C1`. We will apply the inductive hypothesis to this set. -/ -def C' := C0 C ho ∩ π (C1 C ho) (ord I · < o) +noncomputable def C' := C0 C ho ∩ π (C1 C ho) (ord I · < o) include hC in theorem isClosed_C' : IsClosed (C' C ho) := @@ -214,7 +214,7 @@ theorem C0_projOrd {x : I → Bool} (hx : x ∈ C0 C ho) : Proj (ord I · < o) x rw [← not_imp_not] at hsC simp only [not_lt, Bool.not_eq_true, Order.succ_le_iff] at hsC exact (hsC hi).symm - · simp only [C0, Set.mem_inter_iff, Set.mem_setOf_eq] at hx + · simp only [C0, Set.mem_inter_iff, Set.mem_ofPred_eq] at hx rw [eq_comm, ord_term ho] at hi rw [← hx.2, hi] @@ -295,7 +295,7 @@ def MaxProducts : Set (Products I) := {l | l.isGood C ∧ term I ho ∈ l.val} include hsC in theorem union_succ : GoodProducts C = GoodProducts (π C (ord I · < o)) ∪ MaxProducts C ho := by ext l - simp only [GoodProducts, MaxProducts, Set.mem_union, Set.mem_setOf_eq] + simp only [GoodProducts, MaxProducts, Set.mem_union, Set.mem_ofPred_eq] refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · by_cases hh : term I ho ∈ l.val · exact Or.inr ⟨h, hh⟩ @@ -577,7 +577,7 @@ theorem maxTail_isGood (l : MaxProducts C ho) dsimp only [eval] rw [Products.eval_πs C (Products.prop_of_isGood _ _ q.prop)] refine ⟨q.val, ⟨?_, rfl⟩⟩ - simp only [Products.lt_iff_lex_lt, Set.mem_setOf_eq] + simp only [Products.lt_iff_lex_lt, Set.mem_ofPred_eq] exact good_lt_maxProducts C hsC ho q l · apply Submodule.finsuppSum_mem intro q hq @@ -586,7 +586,7 @@ theorem maxTail_isGood (l : MaxProducts C ho) rw [Finsupp.mem_supported] at hmmem rw [← Finsupp.mem_support_iff] at hq refine ⟨⟨term I ho :: q.val, isChain_cons_of_lt C hsC ho l q (hmmem hq)⟩, ⟨?_, rfl⟩⟩ - simp only [Products.lt_iff_lex_lt, Set.mem_setOf_eq] + simp only [Products.lt_iff_lex_lt, Set.mem_ofPred_eq] rw [max_eq_o_cons_tail C hsC ho l] exact List.Lex.cons ((Products.lt_iff_lex_lt q l.val.Tail).mp (hmmem hq)) diff --git a/Mathlib/Topology/Category/Profinite/Nobeling/ZeroLimit.lean b/Mathlib/Topology/Category/Profinite/Nobeling/ZeroLimit.lean index 8598d72a995750..714f8201f0fef0 100644 --- a/Mathlib/Topology/Category/Profinite/Nobeling/ZeroLimit.lean +++ b/Mathlib/Topology/Category/Profinite/Nobeling/ZeroLimit.lean @@ -53,7 +53,7 @@ def Products.nil : Products I := ⟨[], by simp only [List.isChain_nil]⟩ theorem Products.lt_nil_empty {I} [LinearOrder I] : { m : Products I | m < Products.nil } = ∅ := by ext ⟨m, hm⟩ refine ⟨fun h ↦ ?_, by tauto⟩ - simp only [Set.mem_setOf_eq, lt_iff_lex_lt, nil, List.not_lex_nil] at h + simp only [Set.mem_ofPred_eq, lt_iff_lex_lt, nil, List.not_lex_nil] at h instance {α : Type*} [TopologicalSpace α] [Nonempty α] : Nontrivial (LocallyConstant α ℤ) := ⟨0, 1, ne_of_apply_ne DFunLike.coe <| (Function.const_injective (β := ℤ)).ne zero_ne_one⟩ @@ -86,7 +86,7 @@ instance : Unique { l // Products.isGood ({fun _ ↦ false} : Set (I → Bool)) intro _ apply hll have he : {Products.nil} ⊆ {m | m < ⟨l,hl⟩} := by - simpa only [Products.nil, Products.lt_iff_lex_lt, Set.singleton_subset_iff, Set.mem_setOf_eq] + simpa only [Products.nil, Products.lt_iff_lex_lt, Set.singleton_subset_iff, Set.mem_ofPred_eq] grw [← he] rw [Products.span_nil_eq_top] exact Submodule.mem_top @@ -138,7 +138,7 @@ The image of the `GoodProducts` for `π C (ord I · < o)` in `LocallyConstant C refers to the setting in which we will use this, when we are mapping in `GoodProducts` from a smaller set, i.e. when `o` is a smaller ordinal than the one `C` is "contained" in. -/ -def smaller (o : Ordinal) : Set (LocallyConstant C ℤ) := +noncomputable def smaller (o : Ordinal) : Set (LocallyConstant C ℤ) := (πs C o) '' (range (π C (ord I · < o))) /-- @@ -233,7 +233,8 @@ theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.va The image of the `GoodProducts` in `C` is equivalent to the union of `smaller C o'` over all ordinals `o' < o`. -/ -def GoodProducts.range_equiv : range C ≃ ⋃ (e : {o' // o' < o}), (smaller C e.val) := +noncomputable def GoodProducts.range_equiv : + range C ≃ ⋃ (e : {o' // o' < o}), (smaller C e.val) := Equiv.setCongr (union C ho hsC) theorem GoodProducts.range_equiv_factorization : diff --git a/Mathlib/Topology/Category/TopCat/Limits/Konig.lean b/Mathlib/Topology/Category/TopCat/Limits/Konig.lean index 419cca5e85072f..f73e994d152edf 100644 --- a/Mathlib/Topology/Category/TopCat/Limits/Konig.lean +++ b/Mathlib/Topology/Category/TopCat/Limits/Konig.lean @@ -113,7 +113,7 @@ theorem partialSections.closed [∀ j : J, T2Space (F.obj j)] {G : Finset J} partialSections F H = ⋂ (f : FiniteDiagramArrow G) (_ : f ∈ H), {u | F.map f.2.2.2.2 (u f.1) = u f.2.1} := by ext1 - simp only [Set.mem_iInter, Set.mem_setOf_eq] + simp only [Set.mem_iInter, Set.mem_ofPred_eq] rfl rw [this] apply isClosed_biInter diff --git a/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean b/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean index a9b32ee97e30ed..77d5d149109e68 100644 --- a/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean +++ b/Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean @@ -135,7 +135,7 @@ theorem range_pullback_to_prod {X Y Z : TopCat.{u}} (f : X ⟶ Z) (g : Y ⟶ Z) ext x constructor · rintro ⟨y, rfl⟩ - simp only [← ConcreteCategory.comp_apply, Set.mem_setOf_eq] + simp only [← ConcreteCategory.comp_apply, Set.mem_ofPred_eq] simp [pullback.condition] · rintro (h : f (_, _).1 = g (_, _).2) use (pullbackIsoProdSubtype f g).inv ⟨⟨_, _⟩, h⟩ diff --git a/Mathlib/Topology/ClopenBox.lean b/Mathlib/Topology/ClopenBox.lean index 042f17d7e81d8d..764ece7be66f59 100644 --- a/Mathlib/Topology/ClopenBox.lean +++ b/Mathlib/Topology/ClopenBox.lean @@ -48,7 +48,7 @@ theorem exists_prod_subset (W : Clopens (X × Y)) {a : X × Y} (h : a ∈ W) : have hV : IsCompact V := (W.2.1.preimage hp).isCompact let U : Set X := {x | MapsTo (Prod.mk x) V W} have hUV : U ×ˢ V ⊆ W := fun ⟨_, _⟩ hw ↦ hw.1 hw.2 - exact ⟨⟨U, (ContinuousMap.isClopen_setOf_mapsTo hV W.2).preimage + exact ⟨⟨U, (ContinuousMap.isClopen_setOfPred_mapsTo hV W.2).preimage (ContinuousMap.id (X × Y)).curry.2⟩, by simp [U, V, MapsTo], ⟨V, W.2.preimage hp⟩, h, hUV⟩ variable [CompactSpace X] diff --git a/Mathlib/Topology/Closure.lean b/Mathlib/Topology/Closure.lean index f2b757227e75cf..fa2e2514af7d7c 100644 --- a/Mathlib/Topology/Closure.lean +++ b/Mathlib/Topology/Closure.lean @@ -37,7 +37,7 @@ variable {X : Type u} [TopologicalSpace X] {ι : Sort v} {x : X} {s s₁ s₂ t section Interior theorem mem_interior : x ∈ interior s ↔ ∃ t ⊆ s, IsOpen t ∧ x ∈ t := by - simp only [interior, mem_sUnion, mem_setOf_eq, and_assoc, and_left_comm] + simp only [interior, mem_sUnion, mem_ofPred_eq, and_assoc, and_left_comm] @[simp] theorem isOpen_interior : IsOpen (interior s) := diff --git a/Mathlib/Topology/ClusterPt.lean b/Mathlib/Topology/ClusterPt.lean index 4ed4ac24377b38..9b9cafb0edc733 100644 --- a/Mathlib/Topology/ClusterPt.lean +++ b/Mathlib/Topology/ClusterPt.lean @@ -246,10 +246,12 @@ theorem clusterPt_principal {x : X} {C : Set X} : /-- The set of cluster points of a filter is closed. In particular, the set of limit points of a sequence is closed. -/ -theorem isClosed_setOf_clusterPt {f : Filter X} : IsClosed { x | ClusterPt x f } := by - simp only [clusterPt_iff_forall_mem_closure, setOf_forall] +theorem isClosed_setOfPred_clusterPt {f : Filter X} : IsClosed { x | ClusterPt x f } := by + simp only [clusterPt_iff_forall_mem_closure, ofPred_forall] exact isClosed_biInter fun _ _ ↦ isClosed_closure +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_clusterPt := isClosed_setOfPred_clusterPt + theorem mem_closure_iff_clusterPt : x ∈ closure s ↔ ClusterPt x (𝓟 s) := mem_closure_iff_frequently.trans clusterPt_principal_iff_frequently.symm diff --git a/Mathlib/Topology/CompactOpen.lean b/Mathlib/Topology/CompactOpen.lean index f691e208772d12..44ac61ba5cfc19 100644 --- a/Mathlib/Topology/CompactOpen.lean +++ b/Mathlib/Topology/CompactOpen.lean @@ -56,28 +56,33 @@ theorem compactOpen_eq : @compactOpen X Y _ _ = .generateFrom (image2 (fun K U ↦ {f | MapsTo f K U}) {K | IsCompact K} {t | IsOpen t}) := rfl -theorem isOpen_setOf_mapsTo (hK : IsCompact K) (hU : IsOpen U) : +theorem isOpen_setOfPred_mapsTo (hK : IsCompact K) (hU : IsOpen U) : IsOpen {f : C(X, Y) | MapsTo f K U} := isOpen_generateFrom_of_mem <| mem_image2_of_mem hK hU +@[deprecated (since := "2026-07-09")] alias isOpen_setOf_mapsTo := isOpen_setOfPred_mapsTo + lemma eventually_mapsTo {f : C(X, Y)} (hK : IsCompact K) (hU : IsOpen U) (h : MapsTo f K U) : ∀ᶠ g : C(X, Y) in 𝓝 f, MapsTo g K U := - (isOpen_setOf_mapsTo hK hU).mem_nhds h + (isOpen_setOfPred_mapsTo hK hU).mem_nhds h -lemma isOpen_setOf_range_subset [CompactSpace X] (hU : IsOpen U) : +lemma isOpen_setOfPred_range_subset [CompactSpace X] (hU : IsOpen U) : IsOpen {f : C(X, Y) | range f ⊆ U} := by simp_rw [← mapsTo_univ_iff_range_subset] - exact isOpen_setOf_mapsTo isCompact_univ hU + exact isOpen_setOfPred_mapsTo isCompact_univ hU + +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_range_subset := isOpen_setOfPred_range_subset lemma eventually_range_subset [CompactSpace X] {f : C(X, Y)} (hU : IsOpen U) (h : range f ⊆ U) : ∀ᶠ g : C(X, Y) in 𝓝 f, range g ⊆ U := - (isOpen_setOf_range_subset hU).mem_nhds h + (isOpen_setOfPred_range_subset hU).mem_nhds h lemma nhds_compactOpen (f : C(X, Y)) : 𝓝 f = ⨅ (K : Set X) (_ : IsCompact K) (U : Set Y) (_ : IsOpen U) (_ : MapsTo f K U), 𝓟 {g : C(X, Y) | MapsTo g K U} := by - simp_rw +instances [compactOpen_eq, nhds_generateFrom, mem_setOf_eq, @and_comm (f ∈ _), iInf_and, - ← image_prod, iInf_image, biInf_prod, mem_setOf_eq] + simp_rw +instances [compactOpen_eq, nhds_generateFrom, mem_ofPred_eq, @and_comm (f ∈ _), iInf_and, + ← image_prod, iInf_image, biInf_prod, mem_ofPred_eq] lemma tendsto_nhds_compactOpen {l : Filter α} {f : α → C(Y, Z)} {g : C(Y, Z)} : Tendsto f l (𝓝 g) ↔ @@ -101,7 +106,7 @@ protected lemma mem_nhds_iff {f : C(X, Y)} {s : Set C(X, Y)} : s ∈ 𝓝 f ↔ ∃ S : Set (Set X × Set Y), S.Finite ∧ (∀ K U, (K, U) ∈ S → IsCompact K ∧ IsOpen U ∧ MapsTo f K U) ∧ {g : C(X, Y) | ∀ K U, (K, U) ∈ S → MapsTo g K U} ⊆ s := by - simp [f.hasBasis_nhds.mem_iff, ← setOf_forall, and_assoc] + simp [f.hasBasis_nhds.mem_iff, ← ofPred_forall, and_assoc] lemma _root_.Filter.HasBasis.nhds_continuousMapConst {ι : Type*} {c : Y} {p : ι → Prop} {U : ι → Set Y} (h : (𝓝 c).HasBasis p U) : @@ -132,7 +137,7 @@ section Functorial /-- `C(X, ·)` is a functor. -/ @[fun_prop] theorem continuous_postcomp (g : C(Y, Z)) : Continuous (ContinuousMap.comp g : C(X, Y) → C(X, Z)) := - continuous_compactOpen.2 fun _K hK _U hU ↦ isOpen_setOf_mapsTo hK (hU.preimage g.2) + continuous_compactOpen.2 fun _K hK _U hU ↦ isOpen_setOfPred_mapsTo hK (hU.preimage g.2) /-- If `g : C(Y, Z)` is injective, then the composition `ContinuousMap.comp g : C(X, Y) → C(X, Z)` is injective too. -/ @@ -145,8 +150,8 @@ then the composition `ContinuousMap.comp g : C(X, Y) → C(X, Z)` is a topology theorem isInducing_postcomp (g : C(Y, Z)) (hg : IsInducing g) : IsInducing (g.comp : C(X, Y) → C(X, Z)) where eq_induced := by - simp only [compactOpen_eq, induced_generateFrom_eq, image_image2, hg.setOf_isOpen, - image2_image_right, MapsTo, mem_preimage, preimage_setOf_eq, comp_apply] + simp only [compactOpen_eq, induced_generateFrom_eq, image_image2, hg.setOfPred_isOpen, + image2_image_right, MapsTo, mem_preimage, preimage_ofPred_eq, comp_apply] /-- If `g : C(Y, Z)` is a topological embedding, then the composition `ContinuousMap.comp g : C(X, Y) → C(X, Z)` is an embedding too. -/ @@ -158,7 +163,7 @@ theorem isEmbedding_postcomp (g : C(Y, Z)) (hg : IsEmbedding g) : @[continuity, fun_prop] theorem continuous_precomp (f : C(X, Y)) : Continuous (fun g => g.comp f : C(Y, Z) → C(X, Z)) := continuous_compactOpen.2 fun K hK U hU ↦ by - simpa only [mapsTo_image_iff] using! isOpen_setOf_mapsTo (hK.image f.2) hU + simpa only [mapsTo_image_iff] using! isOpen_setOfPred_mapsTo (hK.image f.2) hU variable (Z) in /-- Precomposition by a continuous map is itself a continuous map between spaces of continuous maps. @@ -245,15 +250,20 @@ instance [LocallyCompactPair X Y] : ContinuousEval C(X, Y) X Y where instance : ContinuousEvalConst C(X, Y) X Y where continuous_eval_const x := - continuous_def.2 fun U hU ↦ by simpa using! isOpen_setOf_mapsTo isCompact_singleton hU + continuous_def.2 fun U hU ↦ by simpa using! isOpen_setOfPred_mapsTo isCompact_singleton hU -lemma isClosed_setOf_mapsTo {t : Set Y} (ht : IsClosed t) (s : Set X) : +lemma isClosed_setOfPred_mapsTo {t : Set Y} (ht : IsClosed t) (s : Set X) : IsClosed {f : C(X, Y) | MapsTo f s t} := - ht.setOf_mapsTo fun _ _ ↦ continuous_eval_const _ + ht.setOfPred_mapsTo fun _ _ ↦ continuous_eval_const _ -lemma isClopen_setOf_mapsTo (hK : IsCompact K) (hU : IsClopen U) : +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_mapsTo := isClosed_setOfPred_mapsTo + +lemma isClopen_setOfPred_mapsTo (hK : IsCompact K) (hU : IsClopen U) : IsClopen {f : C(X, Y) | MapsTo f K U} := - ⟨isClosed_setOf_mapsTo hU.isClosed K, isOpen_setOf_mapsTo hK hU.isOpen⟩ + ⟨isClosed_setOfPred_mapsTo hU.isClosed K, isOpen_setOfPred_mapsTo hK hU.isOpen⟩ + +@[deprecated (since := "2026-07-09")] alias isClopen_setOf_mapsTo := isClopen_setOfPred_mapsTo @[norm_cast] lemma specializes_coe {f g : C(X, Y)} : ⇑f ⤳ ⇑g ↔ f ⤳ g := by @@ -289,8 +299,9 @@ instance [RegularSpace Y] : RegularSpace C(X, Y) := rcases (hK.image f.continuous).exists_isOpen_closure_subset (hU.mem_nhdsSet.2 hf.image_subset) with ⟨V, hVo, hKV, hVU⟩ filter_upwards [mem_lift' (eventually_mapsTo hK hVo (mapsTo_iff_image_subset.2 hKV))] with g hg - refine ((isClosed_setOf_mapsTo isClosed_closure K).closure_subset ?_).mono_right hVU - exact closure_mono (fun _ h ↦ h.mono_right subset_closure) hg + refine ((isClosed_setOfPred_mapsTo isClosed_closure K).closure_subset ?_).mono_right hVU + exact closure_mono (s := {f : C(X, Y) | MapsTo f K V}) + (fun _ h ↦ h.mono_right subset_closure) hg instance [T3Space Y] : T3Space C(X, Y) := inferInstance @@ -339,7 +350,7 @@ theorem compactOpen_eq_iInf_induced : refine le_antisymm (le_iInf₂ fun s _ ↦ compactOpen_le_induced s) ?_ refine le_generateFrom <| forall_mem_image2.2 fun K (hK : IsCompact K) U hU ↦ ?_ refine TopologicalSpace.le_def.1 (iInf₂_le K hK) _ ?_ - convert! isOpen_induced (isOpen_setOf_mapsTo (isCompact_iff_isCompact_univ.1 hK) hU) + convert! isOpen_induced (isOpen_setOfPred_mapsTo (isCompact_iff_isCompact_univ.1 hK) hU) simp [Subtype.forall, MapsTo] theorem nhds_compactOpen_eq_iInf_nhds_induced (f : C(X, Y)) : @@ -382,7 +393,7 @@ theorem exists_tendsto_compactOpen_iff_forall [WeaklyLocallyCompactSpace X] [T2S exact tendsto_nhds_unique h₁ h₂ -- So glue the `f s hs` together and prove that this glued function `f₀` is a limit on each -- compact set `s` - refine ⟨liftCover' _ _ h exists_compact_mem_nhds, ?_⟩ + refine ⟨liftCover' {s : Set X | IsCompact s} _ h exists_compact_mem_nhds, ?_⟩ rw [tendsto_compactOpen_iff_forall] intro s hs rw [liftCover_restrict'] diff --git a/Mathlib/Topology/Compactification/StoneCech.lean b/Mathlib/Topology/Compactification/StoneCech.lean index d2e261792e3636..1df02061bab5c4 100644 --- a/Mathlib/Topology/Compactification/StoneCech.lean +++ b/Mathlib/Topology/Compactification/StoneCech.lean @@ -85,7 +85,7 @@ theorem ultrafilter_converges_iff {u : Ultrafilter (Ultrafilter α)} {x : Ultraf rw [eq_comm, ← Ultrafilter.coe_le_coe] change ↑u ≤ 𝓝 x ↔ ∀ s ∈ x, { v : Ultrafilter α | s ∈ v } ∈ u simp only [TopologicalSpace.nhds_generateFrom, le_iInf_iff, ultrafilterBasis, le_principal_iff, - mem_setOf_eq] + mem_ofPred_eq] constructor · intro h a ha exact h _ ⟨ha, a, rfl⟩ @@ -118,7 +118,7 @@ instance : TotallyDisconnectedSpace (Ultrafilter α) := by rw [Tendsto, ← coe_map, ultrafilter_converges_iff] ext s change s ∈ b ↔ {t | s ∈ t} ∈ map pure b - simp_rw [mem_map, preimage_setOf_eq, mem_pure, setOf_mem_eq] + simp_rw [mem_map, preimage_ofPred_eq, mem_pure, ofPred_mem_eq] theorem ultrafilter_comap_pure_nhds (b : Ultrafilter α) : comap pure (𝓝 b) ≤ b := by rw [TopologicalSpace.nhds_generateFrom] diff --git a/Mathlib/Topology/Compactness/Compact.lean b/Mathlib/Topology/Compactness/Compact.lean index 4df746261b2037..5f971499cb4fa4 100644 --- a/Mathlib/Topology/Compactness/Compact.lean +++ b/Mathlib/Topology/Compactness/Compact.lean @@ -1160,9 +1160,7 @@ theorem isCompact_pi_infinite {s : ∀ i, Set (X i)} : /-- **Tychonoff's theorem** formulated using `Set.pi`: product of compact sets is compact. -/ theorem isCompact_univ_pi {s : ∀ i, Set (X i)} (h : ∀ i, IsCompact (s i)) : - IsCompact (pi univ s) := by - convert! isCompact_pi_infinite h - simp only [← mem_univ_pi, setOf_mem_eq] + IsCompact (pi univ s) := by simpa [Set.pi] using isCompact_pi_infinite h instance Pi.compactSpace [∀ i, CompactSpace (X i)] : CompactSpace (∀ i, X i) := ⟨by rw [← pi_univ univ]; exact isCompact_univ_pi fun i => isCompact_univ⟩ diff --git a/Mathlib/Topology/Compactness/CompactSystem.lean b/Mathlib/Topology/Compactness/CompactSystem.lean index 11e01cc117c7a1..53a48d6ae71584 100644 --- a/Mathlib/Topology/Compactness/CompactSystem.lean +++ b/Mathlib/Topology/Compactness/CompactSystem.lean @@ -165,7 +165,8 @@ theorem isCompactSystem_isCompact_isClosed (α : Type*) [TopologicalSpace α] : refine IsCompactSystem.of_nonempty_iInter fun C hC_cc h_nonempty ↦ ?_ rw [← iInter_dissipate] refine IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed (Set.dissipate C) - (fun n ↦ ?_) h_nonempty ?_ (fun n ↦ isClosed_biInter (fun i _ ↦ (hC_cc i).2)) + (fun n ↦ ?_) h_nonempty ?_ + (fun n ↦ isClosed_biInter (s := {i | i ≤ n}) (fun i _ ↦ (hC_cc i).2)) · exact Set.antitone_dissipate (by lia) · simpa using (hC_cc 0).1 diff --git a/Mathlib/Topology/Compactness/CompactlyCoherentSpace.lean b/Mathlib/Topology/Compactness/CompactlyCoherentSpace.lean index 18f43c237d61be..af7736f0152eb1 100644 --- a/Mathlib/Topology/Compactness/CompactlyCoherentSpace.lean +++ b/Mathlib/Topology/Compactness/CompactlyCoherentSpace.lean @@ -146,7 +146,7 @@ variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] instance instTopologicalSpace : TopologicalSpace (𝐤X) := .coinduced (.mk X) - (⨆ (K : Set X) (_ : IsCompact K), .coinduced (Subtype.val (p := K)) + (⨆ (K : Set X) (_ : IsCompact K), .coinduced (Subtype.val (p := (· ∈ K))) (inferInstanceAs <| TopologicalSpace K)) /-- A set `A` in the compact coherentification is open iff for all compact sets `K`, @@ -161,7 +161,6 @@ the intersection `K ∩ A` is closed in `K`. -/ lemma isClosed_iff {A : Set (𝐤X)} : IsClosed A ↔ ∀ (K : Set X), IsCompact K → IsClosed (K ↓∩ .mk X ⁻¹' A) := by simp_rw [isClosed_coinduced, isClosed_iSup_iff, ← isClosed_coinduced] - rfl lemma continuous_dom_iff {f : 𝐤X → Y} : Continuous f ↔ diff --git a/Mathlib/Topology/Compactness/CountablyCompact.lean b/Mathlib/Topology/Compactness/CountablyCompact.lean index 175bb4d8985b8f..0205d23df25e40 100644 --- a/Mathlib/Topology/Compactness/CountablyCompact.lean +++ b/Mathlib/Topology/Compactness/CountablyCompact.lean @@ -116,7 +116,7 @@ theorem IsCountablyCompact.elim_directed_cover [Countable ι] [Nonempty ι] iInf_le_of_le ‹Nonempty ι›.some <| principal_mono.mpr sdiff_subset rcases hA hle with ⟨a, ha, hac⟩ rcases mem_iUnion.mp (hAU ha) with ⟨k, hk⟩ - exact closure_minimal (fun _ hx => hx.2) (hUo k).isClosed_compl + exact closure_minimal (s := A \ U k) (t := (U k)ᶜ) (fun _ hx => hx.2) (hUo k).isClosed_compl (hac.mono (iInf_le _ k)).mem_closure hk /-- A countably compact set has a finite subcover for any countable open cover. -/ @@ -339,7 +339,7 @@ theorem isCountablyCompact_iff_infinite_subset_has_accPt [T1Space E] {A : Set E} hx.frequently.mp (by simp) · -- Case 2: Infinite range obtain ⟨a, haA, hacc⟩ := h (Set.range x ∩ A) inter_subset_right <| by - rw [eventually_iff, mem_cofinite, compl_setOf] at hx + rw [eventually_iff, mem_cofinite, compl_ofPred] at hx exact hfin.inter_of_finite_sdiff (hx.image x |>.subset (by grind)) refine ⟨a, haA, ?_⟩ simp_rw [mapClusterPt_iff_frequently, frequently_cofinite_iff_infinite] diff --git a/Mathlib/Topology/Compactness/Paracompact.lean b/Mathlib/Topology/Compactness/Paracompact.lean index 7d791089d0724d..35fd395aca3334 100644 --- a/Mathlib/Topology/Compactness/Paracompact.lean +++ b/Mathlib/Topology/Compactness/Paracompact.lean @@ -87,7 +87,7 @@ theorem precise_refinement [ParacompactSpace X] (u : ι → Set X) (uo : ∀ a, · simp only [eq_univ_iff_forall, mem_iUnion] exact fun x ↦ ⟨ind (t_inv x), _, rfl, ht_inv _⟩ · refine fun x ↦ ⟨U x, hxU x, ((hU x).image ind).subset ?_⟩ - simp only [subset_def, mem_iUnion, mem_setOf_eq, Set.Nonempty, mem_inter_iff] + simp only [subset_def, mem_iUnion, mem_ofPred_eq, Set.Nonempty, mem_inter_iff] rintro i ⟨y, ⟨a, rfl, hya⟩, hyU⟩ exact mem_image_of_mem _ ⟨y, hya, hyU⟩ · simp only [subset_def, mem_iUnion] @@ -246,7 +246,7 @@ theorem refinement_of_locallyCompact_sigmaCompact_of_nhds_basis_set [WeaklyLocal (finite_le_nat _).biUnion fun k _ ↦ finite_range _ apply this.subset rintro ⟨k, c, hc⟩ - simp only [mem_iUnion, mem_setOf_eq, Subtype.coe_mk] + simp only [mem_iUnion, mem_ofPred_eq, Subtype.coe_mk] rintro ⟨x, hxB : x ∈ B c (r k c), hxK⟩ refine ⟨k, ?_, ⟨c, hc⟩, rfl⟩ have := (mem_compl_iff _ _).1 (hr k c hxB) diff --git a/Mathlib/Topology/Compactness/SigmaCompact.lean b/Mathlib/Topology/Compactness/SigmaCompact.lean index 7d412e5a0dc409..483cddab491e80 100644 --- a/Mathlib/Topology/Compactness/SigmaCompact.lean +++ b/Mathlib/Topology/Compactness/SigmaCompact.lean @@ -199,7 +199,7 @@ variable [SigmaCompactSpace X] open SigmaCompactSpace /-- A choice of compact covering for a `σ`-compact space, chosen to be monotone. -/ -def compactCovering : ℕ → Set X := +noncomputable def compactCovering : ℕ → Set X := accumulate exists_compact_covering.choose theorem isCompact_compactCovering (n : ℕ) : IsCompact (compactCovering X n) := diff --git a/Mathlib/Topology/Connected/Basic.lean b/Mathlib/Topology/Connected/Basic.lean index 905b1b9ea09162..511fd16f522824 100644 --- a/Mathlib/Topology/Connected/Basic.lean +++ b/Mathlib/Topology/Connected/Basic.lean @@ -500,7 +500,7 @@ open scoped Classical in component of `x` in `F` is the connected component of `x` in the subtype `F` seen as a set in `α`. This definition does not make sense if `x` is not in `F` so we return the empty set in this case. -/ -def connectedComponentIn (F : Set α) (x : α) : Set α := +noncomputable def connectedComponentIn (F : Set α) (x : α) : Set α := if h : x ∈ F then (↑) '' connectedComponent (⟨x, h⟩ : F) else ∅ theorem connectedComponentIn_eq_image {F : Set α} {x : α} (h : x ∈ F) : diff --git a/Mathlib/Topology/Connected/PathConnected.lean b/Mathlib/Topology/Connected/PathConnected.lean index b29d16279be30e..933d5082827048 100644 --- a/Mathlib/Topology/Connected/PathConnected.lean +++ b/Mathlib/Topology/Connected/PathConnected.lean @@ -529,7 +529,7 @@ theorem IsPathConnected.exists_path_through_family' {n : ℕ} ∃ (γ : Path (p 0) (p (last n))) (t : Fin (n + 1) → I), (∀ t, γ t ∈ s) ∧ ∀ i, γ (t i) = p i := by rcases h.exists_path_through_family p hp with ⟨γ, hγ⟩ rcases hγ with ⟨h₁, h₂⟩ - simp only [range, mem_setOf_eq] at h₂ + simp only [range, mem_ofPred_eq] at h₂ rw [range_subset_iff] at h₁ choose! t ht using h₂ exact ⟨γ, t, h₁, ht⟩ @@ -576,7 +576,7 @@ theorem pathConnectedSpace_iff_univ : PathConnectedSpace X ↔ IsPathConnected ( theorem isPathConnected_iff_pathConnectedSpace : IsPathConnected F ↔ PathConnectedSpace F := by rw [pathConnectedSpace_iff_univ, IsInducing.subtypeVal.isPathConnected_iff, image_univ, - Subtype.range_val_subtype, setOf_mem_eq] + Subtype.range_val_subtype, ofPred_mem_eq] theorem isPathConnected_univ [PathConnectedSpace X] : IsPathConnected (univ : Set X) := pathConnectedSpace_iff_univ.mp inferInstance diff --git a/Mathlib/Topology/Constructible.lean b/Mathlib/Topology/Constructible.lean index fd8072bc572604..e5e453a6548d2d 100644 --- a/Mathlib/Topology/Constructible.lean +++ b/Mathlib/Topology/Constructible.lean @@ -135,7 +135,7 @@ lemma IsRetrocompact_iff_isSpectralMap_subtypeVal : IsRetrocompact s ↔ IsSpectralMap (Subtype.val : s → X) := by refine ⟨fun hs ↦ ⟨continuous_subtype_val, fun t htopen htcomp ↦ ?_⟩, fun hs t htcomp htopen ↦ ?_⟩ · rw [IsEmbedding.subtypeVal.isCompact_iff, image_preimage_eq_inter_range, - Subtype.range_coe_subtype, setOf_mem_eq, inter_comm] + Subtype.range_coe_subtype, ofPred_mem_eq, inter_comm] exact hs htcomp htopen · simpa using (hs.isCompact_preimage_of_isOpen htopen htcomp).image continuous_subtype_val diff --git a/Mathlib/Topology/Constructions.lean b/Mathlib/Topology/Constructions.lean index 03c4a57177fd18..7d06732a464261 100644 --- a/Mathlib/Topology/Constructions.lean +++ b/Mathlib/Topology/Constructions.lean @@ -1143,7 +1143,7 @@ theorem pi_eq_generateFrom : { g | ∃ (s : ∀ a, Set (A a)) (i : Finset ι), (∀ a ∈ i, IsOpen (s a)) ∧ g = pi (↑i) s } := calc Pi.topologicalSpace _ = @Pi.topologicalSpace ι A fun _ => generateFrom { s | IsOpen s } := by - simp +instances only [generateFrom_setOf_isOpen] + simp +instances only [generateFrom_setOfPred_isOpen] _ = _ := pi_generateFrom_eq theorem pi_generateFrom_eq_finite {X : ι → Type*} {g : ∀ a, Set (Set (X a))} [Finite ι] diff --git a/Mathlib/Topology/Constructions/SumProd.lean b/Mathlib/Topology/Constructions/SumProd.lean index 4bfea412958fbd..36c66a76397eec 100644 --- a/Mathlib/Topology/Constructions/SumProd.lean +++ b/Mathlib/Topology/Constructions/SumProd.lean @@ -149,9 +149,13 @@ theorem Continuous.prodMk_left (y : Y) : Continuous fun x : X => (x, y) := by fu /-- If `f x y` is continuous in `x` for all `y ∈ s`, then the set of `x` such that `f x` maps `s` to `t` is closed. -/ -lemma IsClosed.setOf_mapsTo {α : Type*} {f : X → α → Z} {s : Set α} {t : Set Z} (ht : IsClosed t) +lemma IsClosed.setOfPred_mapsTo {α : Type*} {f : X → α → Z} {s : Set α} {t : Set Z} + (ht : IsClosed t) (hf : ∀ a ∈ s, Continuous (f · a)) : IsClosed {x | MapsTo (f x) s t} := by - simpa only [MapsTo, setOf_forall] using! isClosed_biInter fun y hy ↦ ht.preimage (hf y hy) + simpa only [MapsTo, ofPred_forall] using! isClosed_biInter fun y hy ↦ ht.preimage (hf y hy) + +@[deprecated (since := "2026-07-09")] +alias IsClosed.setOf_mapsTo := IsClosed.setOfPred_mapsTo theorem Continuous.comp₂ {g : X × Y → Z} (hg : Continuous g) {e : W → X} (he : Continuous e) {f : W → Y} (hf : Continuous f) : Continuous fun w => g (e w, f w) := @@ -300,13 +304,16 @@ theorem prod_mem_nhds {s : Set X} {t : Set Y} {x : X} {y : Y} (hx : s ∈ 𝓝 x s ×ˢ t ∈ 𝓝 (x, y) := prod_mem_nhds_iff.2 ⟨hx, hy⟩ -theorem isOpen_setOf_disjoint_nhds_nhds : IsOpen { p : X × X | Disjoint (𝓝 p.1) (𝓝 p.2) } := by - simp only [isOpen_iff_mem_nhds, Prod.forall, mem_setOf_eq] +theorem isOpen_setOfPred_disjoint_nhds_nhds : IsOpen { p : X × X | Disjoint (𝓝 p.1) (𝓝 p.2) } := by + simp only [isOpen_iff_mem_nhds, Prod.forall, mem_ofPred_eq] intro x y h obtain ⟨U, hU, V, hV, hd⟩ := ((nhds_basis_opens x).disjoint_iff (nhds_basis_opens y)).mp h exact mem_nhds_prod_iff'.mpr ⟨U, V, hU.2, hU.1, hV.2, hV.1, fun ⟨x', y'⟩ ⟨hx', hy'⟩ => disjoint_of_disjoint_of_mem hd (hU.2.mem_nhds hx') (hV.2.mem_nhds hy')⟩ +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_disjoint_nhds_nhds := isOpen_setOfPred_disjoint_nhds_nhds + theorem Filter.Eventually.prod_nhds {p : X → Prop} {q : Y → Prop} {x : X} {y : Y} (hx : ∀ᶠ x in 𝓝 x, p x) (hy : ∀ᶠ y in 𝓝 y, q y) : ∀ᶠ z : X × Y in 𝓝 (x, y), p z.1 ∧ q z.2 := prod_mem_nhds hx hy @@ -459,7 +466,7 @@ theorem map_fst_nhdsWithin (x : X × Y) : map Prod.fst (𝓝[Prod.snd ⁻¹' {x. rcases x with ⟨x, y⟩ rw [mem_map, nhdsWithin, mem_inf_principal, mem_nhds_prod_iff] at hs rcases hs with ⟨u, hu, v, hv, H⟩ - simp only [prod_subset_iff, mem_singleton_iff, mem_setOf_eq, mem_preimage] at H + simp only [prod_subset_iff, mem_singleton_iff, mem_ofPred_eq, mem_preimage] at H exact mem_of_superset hu fun z hz => H _ hz _ (mem_of_mem_nhds hv) rfl @[simp] @@ -477,7 +484,7 @@ theorem map_snd_nhdsWithin (x : X × Y) : map Prod.snd (𝓝[Prod.fst ⁻¹' {x. rcases x with ⟨x, y⟩ rw [mem_map, nhdsWithin, mem_inf_principal, mem_nhds_prod_iff] at hs rcases hs with ⟨u, hu, v, hv, H⟩ - simp only [prod_subset_iff, mem_singleton_iff, mem_setOf_eq, mem_preimage] at H + simp only [prod_subset_iff, mem_singleton_iff, mem_ofPred_eq, mem_preimage] at H exact mem_of_superset hv fun z hz => H _ (mem_of_mem_nhds hu) _ hz rfl @[simp] diff --git a/Mathlib/Topology/ContinuousMap/Bounded/Basic.lean b/Mathlib/Topology/ContinuousMap/Bounded/Basic.lean index 8ee7a7818b0865..f2bd7dfba6b1d9 100644 --- a/Mathlib/Topology/ContinuousMap/Bounded/Basic.lean +++ b/Mathlib/Topology/ContinuousMap/Bounded/Basic.lean @@ -207,7 +207,7 @@ instance instMetricSpace {β} [MetricSpace β] : MetricSpace (α →ᵇ β) wher theorem nndist_eq : nndist f g = sInf { C | ∀ x : α, nndist (f x) (g x) ≤ C } := Subtype.ext <| dist_eq.trans <| by rw [val_eq_coe, coe_sInf, coe_image] - simp_rw [mem_setOf_eq, ← NNReal.coe_le_coe, NNReal.coe_mk, exists_prop, coe_nndist] + simp_rw [mem_ofPred_eq, ← NNReal.coe_le_coe, NNReal.coe_mk, exists_prop, coe_nndist] theorem nndist_set_exists : ∃ C, ∀ x : α, nndist (f x) (g x) ≤ C := Subtype.exists.mpr <| dist_set_exists.imp fun _ ⟨ha, h⟩ => ⟨ha, h⟩ diff --git a/Mathlib/Topology/ContinuousMap/Ideals.lean b/Mathlib/Topology/ContinuousMap/Ideals.lean index 7ab99056669275..2ab382bd0cacc2 100644 --- a/Mathlib/Topology/ContinuousMap/Ideals.lean +++ b/Mathlib/Topology/ContinuousMap/Ideals.lean @@ -94,7 +94,7 @@ def idealOfSet (s : Set X) : Ideal C(X, R) where theorem idealOfSet_closed [T2Space R] (s : Set X) : IsClosed (idealOfSet R s : Set C(X, R)) := by - simp only [idealOfSet, Submodule.coe_set_mk, Set.setOf_forall] + simp only [idealOfSet, Submodule.coe_set_mk, Set.ofPred_forall] exact isClosed_iInter fun x => isClosed_iInter fun _ => isClosed_eq (continuous_eval_const x) continuous_const @@ -114,14 +114,14 @@ def setOfIdeal (I : Ideal C(X, R)) : Set X := theorem notMem_setOfIdeal {I : Ideal C(X, R)} {x : X} : x ∉ setOfIdeal I ↔ ∀ ⦃f : C(X, R)⦄, f ∈ I → f x = 0 := by - rw [← Set.mem_compl_iff, setOfIdeal, compl_compl, Set.mem_setOf] + rw [← Set.mem_compl_iff, setOfIdeal, compl_compl, Set.mem_ofPred] theorem mem_setOfIdeal {I : Ideal C(X, R)} {x : X} : x ∈ setOfIdeal I ↔ ∃ f ∈ I, (f : C(X, R)) x ≠ 0 := by - simp_rw [setOfIdeal, Set.mem_compl_iff, Set.mem_setOf]; push Not; rfl + simp_rw [setOfIdeal, Set.mem_compl_iff, Set.mem_ofPred]; push Not; rfl theorem setOfIdeal_open [T2Space R] (I : Ideal C(X, R)) : IsOpen (setOfIdeal I) := by - simp only [setOfIdeal, Set.setOf_forall, isOpen_compl_iff] + simp only [setOfIdeal, Set.ofPred_forall, isOpen_compl_iff] exact isClosed_iInter fun f => isClosed_iInter fun _ => isClosed_eq (map_continuous f) continuous_const @@ -176,7 +176,7 @@ theorem exists_mul_le_one_eqOn_ge (f : C(X, ℝ≥0)) {c : ℝ≥0} (hc : 0 < c) (inv_mul_le_iff₀ (hc.trans_le le_sup_right)).mpr ((mul_one (f x ⊔ c)).symm ▸ le_sup_left), fun x hx => by simpa only [coe_const, mul_apply, coe_mk, Pi.inv_apply, Pi.sup_apply, - Function.const_apply, sup_eq_left.mpr (Set.mem_setOf.mp hx), ne_eq, Pi.one_apply] + Function.const_apply, sup_eq_left.mpr (Set.mem_ofPred.mp hx), ne_eq, Pi.one_apply] using inv_mul_cancel₀ (hc.trans_le hx).ne' ⟩ variable [CompactSpace X] [T2Space X] @@ -200,7 +200,7 @@ theorem idealOfSet_ofIdeal_eq_closure (I : Ideal C(X, 𝕜)) : have ht : IsClosed t := isClosed_le continuous_const (map_continuous f).nnnorm have htI : Disjoint t (setOfIdeal I)ᶜ := by refine Set.subset_compl_iff_disjoint_left.mp fun x hx => ?_ - simpa only [t, Set.mem_setOf, Set.mem_compl_iff, not_le] using! + simpa only [t, Set.mem_ofPred, Set.mem_compl_iff, not_le] using! (nnnorm_eq_zero.mpr (mem_idealOfSet.mp hf hx)).trans_lt (half_pos hε) /- It suffices to produce `g : C(X, ℝ≥0)` which takes values in `[0,1]` and is constantly `1` on `t` such that when composed with the natural embedding of `ℝ≥0` into `𝕜` lies in the ideal `I`. diff --git a/Mathlib/Topology/ContinuousMap/SecondCountableSpace.lean b/Mathlib/Topology/ContinuousMap/SecondCountableSpace.lean index 5fbf560cfa8504..0d97ffcd43dc93 100644 --- a/Mathlib/Topology/ContinuousMap/SecondCountableSpace.lean +++ b/Mathlib/Topology/ContinuousMap/SecondCountableSpace.lean @@ -41,8 +41,10 @@ theorem compactOpen_eq_generateFrom {S : Set (Set X)} {T : Set (Set Y)} obtain ⟨t, htT, htf, hTU, hKT⟩ : ∃ t ⊆ T, t.Finite ∧ (∀ V ∈ t, V ⊆ U) ∧ f '' K ⊆ ⋃₀ t := by rw [hT.open_eq_sUnion' hU, mapsTo_iff_image_subset, sUnion_eq_biUnion] at hfKU obtain ⟨t, ht, hfin, htK⟩ := - (hK.image (map_continuous f)).elim_finite_subcover_image (fun V hV ↦ hT.isOpen hV.1) hfKU - refine ⟨t, fun _ h ↦ (ht h).1, hfin, fun _ h ↦ (ht h).2, ?_⟩ + (hK.image (map_continuous f)).elim_finite_subcover_image + (b := {V | V ∈ T ∧ V ⊆ U}) (fun V hV ↦ hT.isOpen hV.1) hfKU + replace ht : ∀ V ∈ t, V ∈ T ∧ V ⊆ U := ht + refine ⟨t, fun _ h ↦ (ht _ h).1, hfin, fun _ h ↦ (ht _ h).2, ?_⟩ rwa [sUnion_eq_biUnion] rw [image_subset_iff] at hKT obtain ⟨s, hsS, hsf, hKs, hst⟩ : ∃ s ⊆ S, s.Finite ∧ K ⊆ ⋃₀ s ∧ MapsTo f (⋃₀ s) (⋃₀ t) := by @@ -58,7 +60,7 @@ theorem compactOpen_eq_generateFrom {S : Set (Set X)} {T : Set (Set Y)} rw [mapsTo_sUnion, forall_mem_image] exact fun x hx ↦ hLt x <| hsK x hx have hsub : (⋂ L ∈ s, {g : C(X, Y) | MapsTo g L (⋃₀ t)}) ⊆ {g | MapsTo g K U} := by - simp only [← setOf_forall, ← mapsTo_iUnion, ← sUnion_eq_biUnion] + simp only [← ofPred_forall, ← mapsTo_iUnion, ← sUnion_eq_biUnion] exact fun g hg ↦ hg.mono hKs (sUnion_subset hTU) refine mem_of_superset ((biInter_mem hsf).2 fun L hL ↦ ?_) hsub refine mem_iInf_of_mem _ <| mem_iInf_of_mem ?_ <| mem_principal_self _ @@ -76,7 +78,7 @@ theorem secondCountableTopology [SecondCountableTopology Y] is_open_generated_countable := by rcases hX with ⟨S, hScount, hScomp, hS⟩ refine ⟨_, ?_, compactOpen_eq_generateFrom (S := S) hScomp (isBasis_countableBasis _) ?_⟩ - · exact .image2 hScount (countable_setOf_finite_subset (countable_countableBasis Y)) _ + · exact .image2 hScount (countable_ofPred_finite_subset (countable_countableBasis Y)) _ · intro f x V hV hx apply hS exacts [isOpen_of_mem_countableBasis hV, hx] diff --git a/Mathlib/Topology/ContinuousMap/StoneWeierstrass.lean b/Mathlib/Topology/ContinuousMap/StoneWeierstrass.lean index 2b8c165c02034c..3125170bb22d20 100644 --- a/Mathlib/Topology/ContinuousMap/StoneWeierstrass.lean +++ b/Mathlib/Topology/ContinuousMap/StoneWeierstrass.lean @@ -195,7 +195,7 @@ theorem sublattice_closure_eq_top (L : Set C(X, ℝ)) (nA : L.Nonempty) intro x y refine IsOpen.mem_nhds ?_ ?_ · apply isOpen_lt <;> fun_prop - · rw [Set.mem_setOf_eq, w₂] + · rw [Set.mem_ofPred_eq, w₂] exact sub_lt_self _ pos -- Fixing `x` for a moment, we have a family of functions `fun y ↦ g x y` -- which on different patches (the `U x y`) are greater than `f z - ε`. @@ -229,7 +229,7 @@ theorem sublattice_closure_eq_top (L : Set C(X, ℝ)) (nA : L.Nonempty) intro x refine IsOpen.mem_nhds ?_ ?_ · apply isOpen_lt <;> fun_prop - · dsimp only [W, Set.mem_setOf_eq] + · dsimp only [W, Set.mem_ofPred_eq] rw [h_eq] exact lt_add_of_pos_right _ pos -- Since `X` is compact, there is some finset `ys t` @@ -689,7 +689,9 @@ lemma ContinuousMapZero.nonUnitalStarAlgHom_apply_mul_eq_zero {𝕜 A : Type*} | add _ _ h₁ h₂ => simp only [map_add, add_mul, h₁, h₂, zero_add] | mul _ _ _ h => simp only [map_mul, mul_assoc, h, mul_zero] | smul _ _ h => rw [map_smul, smul_mul_assoc, h, smul_zero] - | frequently f h => exact h.mem_of_closed <| isClosed_eq (by fun_prop) continuous_zero + | frequently f h => + exact h.mem_of_closed (s := {g | φ g * a = 0}) <| + isClosed_eq (by fun_prop) continuous_zero lemma ContinuousMapZero.mul_nonUnitalStarAlgHom_apply_eq_zero {𝕜 A : Type*} [RCLike 𝕜] [NonUnitalSemiring A] [Star A] [TopologicalSpace A] [SeparatelyContinuousMul A] @@ -704,6 +706,8 @@ lemma ContinuousMapZero.mul_nonUnitalStarAlgHom_apply_eq_zero {𝕜 A : Type*} | add _ _ h₁ h₂ => simp only [map_add, mul_add, h₁, h₂, zero_add] | mul _ _ h _ => simp only [map_mul, ← mul_assoc, h, zero_mul] | smul _ _ h => rw [map_smul, mul_smul_comm, h, smul_zero] - | frequently f h => exact h.mem_of_closed <| isClosed_eq (by fun_prop) continuous_zero + | frequently f h => + exact h.mem_of_closed (s := {g | a * φ g = 0}) <| + isClosed_eq (by fun_prop) continuous_zero end ContinuousMapZero diff --git a/Mathlib/Topology/ContinuousMap/T0Sierpinski.lean b/Mathlib/Topology/ContinuousMap/T0Sierpinski.lean index 77c27b073bb658..2bf5cf4e42a1a9 100644 --- a/Mathlib/Topology/ContinuousMap/T0Sierpinski.lean +++ b/Mathlib/Topology/ContinuousMap/T0Sierpinski.lean @@ -36,7 +36,7 @@ theorem eq_induced_by_maps_to_sierpinski (X : Type*) [t : TopologicalSpace X] : · intro u h rw [← generateFrom_iUnion_isOpen] apply isOpen_generateFrom_of_mem - simp only [Set.mem_iUnion, Set.mem_setOf_eq, isOpen_induced_iff] + simp only [Set.mem_iUnion, Set.mem_ofPred_eq, isOpen_induced_iff] exact ⟨⟨u, h⟩, {True}, isOpen_singleton_true, by simp [Set.preimage]⟩ variable (X : Type*) [TopologicalSpace X] diff --git a/Mathlib/Topology/ContinuousOn.lean b/Mathlib/Topology/ContinuousOn.lean index b31ebedce237be..37e6e709f73b2c 100644 --- a/Mathlib/Topology/ContinuousOn.lean +++ b/Mathlib/Topology/ContinuousOn.lean @@ -211,7 +211,7 @@ theorem continuousOn_to_generateFrom_iff {β : Type*} {T : Set (Set β)} {f : α @ContinuousOn α β _ (.generateFrom T) f s ↔ ∀ x ∈ s, ∀ t ∈ T, f x ∈ t → f ⁻¹' t ∈ 𝓝[s] x := forall₂_congr fun x _ => by delta ContinuousWithinAt - simp only [TopologicalSpace.nhds_generateFrom, tendsto_iInf, tendsto_principal, mem_setOf_eq, + simp only [TopologicalSpace.nhds_generateFrom, tendsto_iInf, tendsto_principal, mem_ofPred_eq, and_imp] exact forall_congr' fun t => forall_comm @@ -236,11 +236,11 @@ theorem ContinuousWithinAt.mono_of_mem_nhdsWithin (h : ContinuousWithinAt f t x) /-- If two sets coincide around `x`, then being continuous within one or the other at `x` is equivalent. See also `continuousWithinAt_congr_set'` which requires that the sets coincide locally away from a point `y`, in a T1 space. -/ -theorem continuousWithinAt_congr_set (h : s =ᶠ[𝓝 x] t) : +theorem continuousWithinAt_congr_set (h : s =ᶠˢ[𝓝 x] t) : ContinuousWithinAt f s x ↔ ContinuousWithinAt f t x := by simp only [ContinuousWithinAt, nhdsWithin_eq_iff_eventuallyEq.mpr h] -theorem ContinuousWithinAt.congr_set (hf : ContinuousWithinAt f s x) (h : s =ᶠ[𝓝 x] t) : +theorem ContinuousWithinAt.congr_set (hf : ContinuousWithinAt f s x) (h : s =ᶠˢ[𝓝 x] t) : ContinuousWithinAt f t x := (continuousWithinAt_congr_set h).1 hf diff --git a/Mathlib/Topology/Covering/Basic.lean b/Mathlib/Topology/Covering/Basic.lean index ad257b2dbc7685..fb31936178303c 100644 --- a/Mathlib/Topology/Covering/Basic.lean +++ b/Mathlib/Topology/Covering/Basic.lean @@ -355,9 +355,10 @@ protected theorem isSeparatedMap : IsSeparatedMap f := have he₂ := he₁; simp_rw [he] at he₂; rw [← t.mem_source] at he₁ he₂ refine ⟨t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₁).2}, t.source ∩ (Prod.snd ∘ t) ⁻¹' {(t e₂).2}, ?_, ?_, ⟨he₁, rfl⟩, ⟨he₂, rfl⟩, Set.disjoint_left.mpr fun x h₁ h₂ ↦ hne (t.injOn he₁ he₂ ?_)⟩ - iterate 2 - exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source - (continuous_snd.isOpen_preimage _ <| isOpen_discrete _) + · exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source + (continuous_snd.isOpen_preimage {(t e₁).2} <| isOpen_discrete _) + · exact t.continuousOn_toFun.isOpen_inter_preimage t.open_source + (continuous_snd.isOpen_preimage {(t e₂).2} <| isOpen_discrete _) refine Prod.ext ?_ (h₁.2.symm.trans h₂.2) rwa [t.proj_toFun e₁ he₁, t.proj_toFun e₂ he₂] diff --git a/Mathlib/Topology/DenseEmbedding.lean b/Mathlib/Topology/DenseEmbedding.lean index cf3e63756da367..6e48a79fadcf1b 100644 --- a/Mathlib/Topology/DenseEmbedding.lean +++ b/Mathlib/Topology/DenseEmbedding.lean @@ -341,7 +341,7 @@ theorem isClosed_property [TopologicalSpace β] {e : α → β} {p : β → Prop univ = closure (range e) := he.closure_range.symm _ ⊆ closure { b | p b } := closure_mono <| range_subset_iff.mpr h _ = _ := hp.closure_eq - simpa only [univ_subset_iff, eq_univ_iff_forall, mem_setOf] + simpa only [univ_subset_iff, eq_univ_iff_forall, mem_ofPred] theorem isClosed_property2 [TopologicalSpace β] {e : α → β} {p : β → β → Prop} (he : DenseRange e) (hp : IsClosed { q : β × β | p q.1 q.2 }) (h : ∀ a₁ a₂, p (e a₁) (e a₂)) : ∀ b₁ b₂, p b₁ b₂ := diff --git a/Mathlib/Topology/DiscreteQuotient.lean b/Mathlib/Topology/DiscreteQuotient.lean index b5045bc4dc69c2..5bdae0d0c8ad9e 100644 --- a/Mathlib/Topology/DiscreteQuotient.lean +++ b/Mathlib/Topology/DiscreteQuotient.lean @@ -74,19 +74,22 @@ variable {α X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [Topologic @[ext] structure DiscreteQuotient (X : Type*) [TopologicalSpace X] extends Setoid X where /-- For every point `x`, the set `{ y | Rel x y }` is an open set. -/ - protected isOpen_setOf_rel : ∀ x, IsOpen (setOf (toSetoid x)) + protected isOpen_setOfPred_rel : ∀ x, IsOpen (Set.ofPred (toSetoid x)) namespace DiscreteQuotient variable (S : DiscreteQuotient X) +@[deprecated (since := "2026-07-09")] +protected alias isOpen_setOf_rel := DiscreteQuotient.isOpen_setOfPred_rel + lemma toSetoid_injective : Function.Injective (@toSetoid X _) | ⟨_, _⟩, ⟨_, _⟩, _ => by congr /-- Construct a discrete quotient from a clopen set. -/ def ofIsClopen {A : Set X} (h : IsClopen A) : DiscreteQuotient X where toSetoid := ⟨fun x y => x ∈ A ↔ y ∈ A, fun _ => Iff.rfl, Iff.symm, Iff.trans⟩ - isOpen_setOf_rel x := by by_cases hx : x ∈ A <;> simp [hx, h.1, h.2, ← compl_setOf] + isOpen_setOfPred_rel x := by by_cases hx : x ∈ A <;> simp [hx, h.1, h.2, ← compl_ofPred] theorem refl : ∀ x, S.toSetoid x x := S.refl' @@ -106,7 +109,7 @@ instance : TopologicalSpace S := /-- The projection from `X` to the given discrete quotient. -/ def proj : X → S := Quotient.mk'' -theorem fiber_eq (x : X) : S.proj ⁻¹' {S.proj x} = setOf (S.toSetoid x) := +theorem fiber_eq (x : X) : S.proj ⁻¹' {S.proj x} = Set.ofPred (S.toSetoid x) := Set.ext fun _ => eq_comm.trans Quotient.eq'' theorem proj_surjective : Function.Surjective S.proj := @@ -121,7 +124,7 @@ theorem proj_continuous : Continuous S.proj := instance : DiscreteTopology S := discreteTopology_iff_isOpen_singleton.2 <| S.proj_surjective.forall.2 fun x => by rw [← S.proj_isQuotientMap.isOpen_preimage, fiber_eq] - exact S.isOpen_setOf_rel _ + exact S.isOpen_setOfPred_rel _ theorem proj_isLocallyConstant : IsLocallyConstant S.proj := (IsLocallyConstant.iff_continuous S.proj).2 S.proj_continuous @@ -135,10 +138,13 @@ theorem isOpen_preimage (A : Set S) : IsOpen (S.proj ⁻¹' A) := theorem isClosed_preimage (A : Set S) : IsClosed (S.proj ⁻¹' A) := (S.isClopen_preimage A).1 -theorem isClopen_setOf_rel (x : X) : IsClopen (setOf (S.toSetoid x)) := by +theorem isClopen_setOfPred_rel (x : X) : IsClopen (Set.ofPred (S.toSetoid x)) := by rw [← fiber_eq] apply isClopen_preimage +@[deprecated (since := "2026-07-09")] +alias isClopen_setOf_rel := isClopen_setOfPred_rel + instance : Min (DiscreteQuotient X) := ⟨fun S₁ S₂ => ⟨S₁.1 ⊓ S₂.1, fun x => (S₁.2 x).inter (S₂.2 x)⟩⟩ @@ -170,7 +176,7 @@ variable (g : C(Y, Z)) (f : C(X, Y)) /-- Comap a discrete quotient along a continuous map. -/ def comap (S : DiscreteQuotient Y) : DiscreteQuotient X where toSetoid := Setoid.comap f S.1 - isOpen_setOf_rel _ := (S.2 _).preimage f.continuous + isOpen_setOfPred_rel _ := (S.2 _).preimage f.continuous @[simp] theorem comap_id : S.comap (ContinuousMap.id X) = S := rfl @@ -228,12 +234,14 @@ end OfLE instance [LocallyConnectedSpace X] : OrderBot (DiscreteQuotient X) where bot := { toSetoid := connectedComponentSetoid X - isOpen_setOf_rel := fun x => by + isOpen_setOfPred_rel := fun x => by convert! isOpen_connectedComponent (x := x) ext y - simpa only [connectedComponentSetoid, ← connectedComponent_eq_iff_mem] using! eq_comm } + simpa only [connectedComponentSetoid, Set.mem_iff_mem, + ← connectedComponent_eq_iff_mem] using! eq_comm } bot_le S := fun x y (h : connectedComponent x = connectedComponent y) => - (S.isClopen_setOf_rel x).connectedComponent_subset (S.refl _) <| h.symm ▸ mem_connectedComponent + (S.isClopen_setOfPred_rel x).connectedComponent_subset (S.refl _) <| + h.symm ▸ mem_connectedComponent @[simp] theorem proj_bot_eq [LocallyConnectedSpace X] {x y : X} : @@ -367,7 +375,7 @@ lemma comp_finsetClopens [CompactSpace X] : (Set.image (fun (t : Clopens X) ↦ t.carrier) ∘ (↑)) ∘ finsetClopens X = fun ⟨f, _⟩ ↦ f.classes := by ext d - simp only [Setoid.classes, Set.mem_setOf_eq, Function.comp_apply, + simp only [Setoid.classes, Set.mem_ofPred_eq, Function.comp_apply, finsetClopens, Set.coe_toFinset, Set.mem_image, Set.mem_range, exists_exists_eq_and] constructor @@ -404,7 +412,7 @@ variable (f : LocallyConstant X α) /-- Any locally constant function induces a discrete quotient. -/ def discreteQuotient : DiscreteQuotient X where toSetoid := .comap f ⊥ - isOpen_setOf_rel _ := f.isLocallyConstant _ + isOpen_setOfPred_rel x := f.isLocallyConstant {y | f x = y} /-- The (locally constant) function from the discrete quotient associated to a locally constant function. -/ diff --git a/Mathlib/Topology/DiscreteSubset.lean b/Mathlib/Topology/DiscreteSubset.lean index 2cff2fe9277615..3e6c131f631bfb 100644 --- a/Mathlib/Topology/DiscreteSubset.lean +++ b/Mathlib/Topology/DiscreteSubset.lean @@ -468,7 +468,7 @@ alias finite_diff_of_mem_codiscreteWithin := finite_sdiff_of_mem_codiscreteWithi theorem cofinite_inf_le_codiscreteWithin (hK : IsCompact K) : cofinite ⊓ 𝓟 K ≤ codiscreteWithin K := by intro s hs - simpa [mem_inf_principal, compl_setOf] using! hK.finite_sdiff_of_mem_codiscreteWithin hs + simpa [mem_inf_principal, compl_ofPred] using! hK.finite_sdiff_of_mem_codiscreteWithin hs theorem codiscreteWithin_eq [T1Space X] (hK : IsCompact K) : codiscreteWithin K = cofinite ⊓ 𝓟 K := by diff --git a/Mathlib/Topology/EMetricSpace/Basic.lean b/Mathlib/Topology/EMetricSpace/Basic.lean index 4ff81c6ad493e4..2f755e399e3f56 100644 --- a/Mathlib/Topology/EMetricSpace/Basic.lean +++ b/Mathlib/Topology/EMetricSpace/Basic.lean @@ -322,28 +322,28 @@ variable {s : Set α} theorem lebesgue_number_lemma_of_emetric {ι : Sort*} {c : ι → Set α} (hs : IsCompact s) (hc₁ : ∀ i, IsOpen (c i)) (hc₂ : s ⊆ ⋃ i, c i) : ∃ δ > 0, ∀ x ∈ s, ∃ i, eball x δ ⊆ c i := by - simpa only [eball, UniformSpace.ball, preimage_setOf_eq, edist_comm] + simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm] using uniformity_basis_edist.lebesgue_number_lemma hs hc₁ hc₂ theorem lebesgue_number_lemma_of_emetric_nhds' {c : (x : α) → x ∈ s → Set α} (hs : IsCompact s) (hc : ∀ x hx, c x hx ∈ 𝓝 x) : ∃ δ > 0, ∀ x ∈ s, ∃ y : s, eball x δ ⊆ c y y.2 := by - simpa only [eball, UniformSpace.ball, preimage_setOf_eq, edist_comm] + simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm] using uniformity_basis_edist.lebesgue_number_lemma_nhds' hs hc theorem lebesgue_number_lemma_of_emetric_nhds {c : α → Set α} (hs : IsCompact s) (hc : ∀ x ∈ s, c x ∈ 𝓝 x) : ∃ δ > 0, ∀ x ∈ s, ∃ y, eball x δ ⊆ c y := by - simpa only [eball, UniformSpace.ball, preimage_setOf_eq, edist_comm] + simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm] using uniformity_basis_edist.lebesgue_number_lemma_nhds hs hc theorem lebesgue_number_lemma_of_emetric_nhdsWithin' {c : (x : α) → x ∈ s → Set α} (hs : IsCompact s) (hc : ∀ x hx, c x hx ∈ 𝓝[s] x) : ∃ δ > 0, ∀ x ∈ s, ∃ y : s, eball x δ ∩ s ⊆ c y y.2 := by - simpa only [eball, UniformSpace.ball, preimage_setOf_eq, edist_comm] + simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm] using uniformity_basis_edist.lebesgue_number_lemma_nhdsWithin' hs hc theorem lebesgue_number_lemma_of_emetric_nhdsWithin {c : α → Set α} (hs : IsCompact s) (hc : ∀ x ∈ s, c x ∈ 𝓝[s] x) : ∃ δ > 0, ∀ x ∈ s, ∃ y, eball x δ ∩ s ⊆ c y := by - simpa only [eball, UniformSpace.ball, preimage_setOf_eq, edist_comm] + simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm] using uniformity_basis_edist.lebesgue_number_lemma_nhdsWithin hs hc theorem lebesgue_number_lemma_of_emetric_sUnion {c : Set (Set α)} (hs : IsCompact s) diff --git a/Mathlib/Topology/EMetricSpace/BoundedVariation.lean b/Mathlib/Topology/EMetricSpace/BoundedVariation.lean index 20e89be5466d28..c4f5143c8fbf5b 100644 --- a/Mathlib/Topology/EMetricSpace/BoundedVariation.lean +++ b/Mathlib/Topology/EMetricSpace/BoundedVariation.lean @@ -1123,7 +1123,7 @@ theorem MonotoneOn.boundedVariationOn suffices eVariationOn f s ≤ ENNReal.ofReal (2 * C) from ne_of_lt (this.trans_lt (by simp [ENNReal.mul_lt_top])) rw [eVariationOn.eq_biSup_inter_Icc] - simp only [mem_setOf_eq, iSup_le_iff, and_imp, Prod.forall] + simp only [mem_ofPred_eq, iSup_le_iff, and_imp, Prod.forall] intro a b as bs hab grw [hf.eVariationOn_le as bs] exact ENNReal.ofReal_mono (by grind) diff --git a/Mathlib/Topology/EMetricSpace/Defs.lean b/Mathlib/Topology/EMetricSpace/Defs.lean index b9dbd634ed6d89..aa7fadaaa8b2a5 100644 --- a/Mathlib/Topology/EMetricSpace/Defs.lean +++ b/Mathlib/Topology/EMetricSpace/Defs.lean @@ -43,7 +43,7 @@ in terms of the elements of the uniformity. -/ theorem uniformity_dist_of_mem_uniformity [LT β] {U : Filter (α × α)} (z : β) (D : α → α → β) (H : ∀ s, s ∈ U ↔ ∃ ε > z, ∀ {a b : α}, D a b < ε → (a, b) ∈ s) : U = ⨅ ε > z, 𝓟 { p : α × α | D p.1 p.2 < ε } := - HasBasis.eq_biInf ⟨fun s => by simp only [H, subset_def, Prod.forall, mem_setOf]⟩ + HasBasis.eq_biInf ⟨fun s => by simp only [H, subset_def, Prod.forall, mem_ofPred]⟩ open scoped Uniformity Topology Filter NNReal ENNReal Pointwise @@ -392,7 +392,7 @@ instance Prod.pseudoEMetricSpaceMax [PseudoEMetricSpace β] : max_le (le_trans (edist_triangle _ _ _) (add_le_add (le_max_left _ _) (le_max_left _ _))) (le_trans (edist_triangle _ _ _) (add_le_add (le_max_right _ _) (le_max_right _ _))) uniformity_edist := uniformity_prod.trans <| by - simp [PseudoEMetricSpace.uniformity_edist, ← iInf_inf_eq, setOf_and] + simp [PseudoEMetricSpace.uniformity_edist, ← iInf_inf_eq, ofPred_and] toUniformSpace := inferInstance theorem Prod.edist_eq [PseudoEMetricSpace β] (x y : α × β) : @@ -416,7 +416,7 @@ theorem mem_closedEBall' : y ∈ closedEBall x ε ↔ edist x y ≤ ε := by @[simp] theorem closedEBall_top (x : α) : closedEBall x ∞ = univ := - eq_univ_of_forall fun _ => mem_setOf.2 le_top + eq_univ_of_forall fun _ => mem_ofPred.2 le_top theorem eball_subset_closedEBall : eball x ε ⊆ closedEBall x ε := fun _ h => le_of_lt h.out @@ -464,13 +464,20 @@ theorem eball_eq_empty_iff : eball x ε = ∅ ↔ ε = 0 := ⟨fun h => le_bot_iff.1 (le_of_not_gt fun ε0 => h _ (mem_eball_self ε0)), fun ε0 _ h => not_lt_of_ge (le_of_eq ε0) (pos_of_mem_eball h)⟩ -theorem ordConnected_setOf_closedEBall_subset (x : α) (s : Set α) : +theorem ordConnected_setOfPred_closedEBall_subset (x : α) (s : Set α) : OrdConnected { r | closedEBall x r ⊆ s } := ⟨fun _ _ _ h₁ _ h₂ => (closedEBall_subset_closedEBall h₂.2).trans h₁⟩ -theorem ordConnected_setOf_eball_subset (x : α) (s : Set α) : OrdConnected { r | eball x r ⊆ s } := +@[deprecated (since := "2026-07-09")] +alias ordConnected_setOf_closedEBall_subset := ordConnected_setOfPred_closedEBall_subset + +theorem ordConnected_setOfPred_eball_subset (x : α) (s : Set α) : + OrdConnected { r | eball x r ⊆ s } := ⟨fun _ _ _ h₁ _ h₂ => (eball_subset_eball h₂.2).trans h₁⟩ +@[deprecated (since := "2026-07-09")] +alias ordConnected_setOf_eball_subset := ordConnected_setOfPred_eball_subset + /-- Relation “two points are at a finite edistance” is an equivalence relation. -/ @[implicit_reducible] def edistLtTopSetoid : Setoid α where @@ -652,10 +659,10 @@ alias closedBall_subset_closedBall := closedEBall_subset_closedEBall @[deprecated (since := "2026-01-24")] alias ball_eq_empty_iff := eball_eq_empty_iff @[deprecated (since := "2026-01-24")] -alias ordConnected_setOf_closedBall_subset := ordConnected_setOf_closedEBall_subset +alias ordConnected_setOf_closedBall_subset := ordConnected_setOfPred_closedEBall_subset @[deprecated (since := "2026-01-24")] -alias ordConnected_setOf_ball_subset := ordConnected_setOf_eball_subset +alias ordConnected_setOf_ball_subset := ordConnected_setOfPred_eball_subset @[deprecated (since := "2026-01-24")] alias edistLtTopSetoid := edistLtTopSetoid @[deprecated (since := "2026-01-24")] alias ball_zero := eball_zero diff --git a/Mathlib/Topology/EMetricSpace/Paracompact.lean b/Mathlib/Topology/EMetricSpace/Paracompact.lean index 02ceccf4ed2b5e..5f460e82a6c3c6 100644 --- a/Mathlib/Topology/EMetricSpace/Paracompact.lean +++ b/Mathlib/Topology/EMetricSpace/Paracompact.lean @@ -55,7 +55,7 @@ instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : Paraco obtain ⟨_, wf⟩ := exists_wellFoundedLT ι -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`. let ind (x : α) : ι := wellFounded_lt.min { i : ι | x ∈ s i } (hcov x) - have mem_ind (x) : x ∈ s (ind x) := wellFounded_lt.min_mem _ (hcov x) + have mem_ind (x) : x ∈ s (ind x) := wellFounded_lt.min_mem {i : ι | x ∈ s i} (hcov x) have notMem_of_lt_ind {x i} (hlt : i < ind x) (hxi : x ∈ s i) : False := wellFounded_lt.not_lt_min {i | x ∈ s i} hxi hlt /- The refinement `D : ℕ → ι → Set α` is defined recursively. For each `n` and `i`, `D n i` diff --git a/Mathlib/Topology/EMetricSpace/Pi.lean b/Mathlib/Topology/EMetricSpace/Pi.lean index 7a106a7bcbd9c5..5b96678f747b7e 100644 --- a/Mathlib/Topology/EMetricSpace/Pi.lean +++ b/Mathlib/Topology/EMetricSpace/Pi.lean @@ -67,10 +67,10 @@ instance pseudoEMetricSpacePi [∀ b, PseudoEMetricSpace (X b)] : PseudoEMetricS toUniformSpace := Pi.uniformSpace _ uniformity_edist := by simp only [Pi.uniformity, PseudoEMetricSpace.uniformity_edist, comap_iInf, gt_iff_lt, - preimage_setOf_eq, comap_principal, edist_pi_def] + preimage_ofPred_eq, comap_principal, edist_pi_def] rw [iInf_comm]; congr; funext ε rw [iInf_comm]; congr; funext εpos - simp [setOf_forall, εpos] + simp [ofPred_forall, εpos] end Pi diff --git a/Mathlib/Topology/ExtremallyDisconnected.lean b/Mathlib/Topology/ExtremallyDisconnected.lean index 1916abbee2f674..83106a2571db21 100644 --- a/Mathlib/Topology/ExtremallyDisconnected.lean +++ b/Mathlib/Topology/ExtremallyDisconnected.lean @@ -161,7 +161,8 @@ lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {X : D fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩ -- prove intersection of chain is mapped onto $A$ by_cases hC : Nonempty C - · refine eq_univ_of_forall fun a => inter_nonempty_iff_exists_left.mp ?_ + · refine eq_univ_of_forall fun a => + (inter_nonempty_iff_exists_left (s := ⋂ c : C, (c : Set D)) (t := X ⁻¹' {a})).mp ?_ -- apply Cantor's intersection theorem refine iInter_inter (ι := C) (X ⁻¹' {a}) _ ▸ IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ diff --git a/Mathlib/Topology/Filter.lean b/Mathlib/Topology/Filter.lean index e78d810e846fc9..e774839202245d 100644 --- a/Mathlib/Topology/Filter.lean +++ b/Mathlib/Topology/Filter.lean @@ -53,9 +53,11 @@ instance : TopologicalSpace (Filter α) := theorem isOpen_Iic_principal {s : Set α} : IsOpen (Iic (𝓟 s)) := GenerateOpen.basic _ (mem_range_self _) -theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by +theorem isOpen_setOfPred_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by simpa only [Iic_principal] using isOpen_Iic_principal +@[deprecated (since := "2026-07-09")] alias isOpen_setOf_mem := isOpen_setOfPred_mem + theorem isTopologicalBasis_Iic_principal : IsTopologicalBasis (range (Iic ∘ 𝓟 : Set α → Set (Filter α))) := { exists_subset_inter := by @@ -71,7 +73,7 @@ theorem isOpen_iff {s : Set (Filter α)} : IsOpen s ↔ ∃ T : Set (Set α), s theorem nhds_eq (l : Filter α) : 𝓝 l = l.lift' (Iic ∘ 𝓟) := nhds_generateFrom.trans <| by - simp only [mem_setOf_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift, + simp only [mem_ofPred_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift, (· ∘ ·), mem_Iic, le_principal_iff] theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } := by @@ -79,7 +81,7 @@ theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } : protected theorem tendsto_nhds {la : Filter α} {lb : Filter β} {f : α → Filter β} : Tendsto f la (𝓝 lb) ↔ ∀ s ∈ lb, ∀ᶠ a in la, s ∈ f a := by - simp only [nhds_eq', tendsto_lift', mem_setOf_eq] + simp only [nhds_eq', tendsto_lift', mem_ofPred_eq] protected theorem HasBasis.nhds {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => Iic (𝓟 (s i)) := by @@ -136,7 +138,7 @@ theorem monotone_nhds : Monotone (𝓝 : Filter α → Filter (Filter α)) := theorem sInter_nhds (l : Filter α) : ⋂₀ { s | s ∈ 𝓝 l } = Iic l := by simp_rw [nhds_eq, Function.comp_def, sInter_lift'_sets monotone_principal.Iic, Iic, - le_principal_iff, ← setOf_forall, ← Filter.le_def] + le_principal_iff, ← ofPred_forall, ← Filter.le_def] @[simp] theorem nhds_mono {l₁ l₂ : Filter α} : 𝓝 l₁ ≤ 𝓝 l₂ ↔ l₁ ≤ l₂ := by @@ -191,7 +193,7 @@ theorem isInducing_nhds : IsInducing (𝓝 : X → Filter X) := isInducing_iff_nhds.2 fun x => (nhds_def' _).trans <| by simp +contextual only [nhds_nhds, comap_iInf, comap_principal, - Iic_principal, preimage_setOf_eq, ← mem_interior_iff_mem_nhds, setOf_mem_eq, + Iic_principal, preimage_ofPred_eq, ← mem_interior_iff_mem_nhds, ofPred_mem_eq, IsOpen.interior_eq] @[continuity] diff --git a/Mathlib/Topology/GDelta/Basic.lean b/Mathlib/Topology/GDelta/Basic.lean index 66109db6c0356e..66b18e575cb631 100644 --- a/Mathlib/Topology/GDelta/Basic.lean +++ b/Mathlib/Topology/GDelta/Basic.lean @@ -188,7 +188,7 @@ theorem residual_of_dense_Gδ {s : Set X} (ho : IsGδ s) (hd : Dense s) : s ∈ theorem mem_residual_iff {s : Set X} : s ∈ residual X ↔ ∃ S : Set (Set X), (∀ t ∈ S, IsOpen t) ∧ (∀ t ∈ S, Dense t) ∧ S.Countable ∧ ⋂₀ S ⊆ s := - mem_countableGenerate_iff.trans <| by simp_rw [subset_def, mem_setOf, forall_and, and_assoc] + mem_countableGenerate_iff.trans <| by simp_rw [subset_def, mem_ofPred, forall_and, and_assoc] end residual diff --git a/Mathlib/Topology/GDelta/MetrizableSpace.lean b/Mathlib/Topology/GDelta/MetrizableSpace.lean index 4d43e81eca6264..625f6c55c80d8e 100644 --- a/Mathlib/Topology/GDelta/MetrizableSpace.lean +++ b/Mathlib/Topology/GDelta/MetrizableSpace.lean @@ -36,7 +36,7 @@ instance (priority := 500) [PseudoMetrizableSpace X] : PerfectlyNormalSpace X wh have := pseudoMetrizableSpaceUniformity_countably_generated X rcases (@uniformity_hasBasis_open X _).exists_antitone_subbasis with ⟨U, hUo, hU, -⟩ rw [← hs.closure_eq, ← hU.biInter_biUnion_ball] - refine .biInter (to_countable _) fun n _ => IsOpen.isGδ ?_ + refine .iInter fun n => .iInter fun _ => IsOpen.isGδ ?_ exact isOpen_biUnion fun x _ => UniformSpace.isOpen_ball _ (hUo _).2 instance (priority := 100) [MetrizableSpace X] : T4Space X where @@ -48,16 +48,19 @@ end Metrizable section ContinuousAt variable {Y : Type*} [TopologicalSpace Y] -theorem IsGδ.setOf_continuousAt [PseudoMetrizableSpace Y] (f : X → Y) : +theorem IsGδ.setOfPred_continuousAt [PseudoMetrizableSpace Y] (f : X → Y) : IsGδ { x | ContinuousAt f x } := by let := pseudoMetrizableSpaceUniformity Y have := pseudoMetrizableSpaceUniformity_countably_generated Y obtain ⟨U, _, hU⟩ := (@uniformity_hasBasis_open_symmetric Y _).exists_antitone_subbasis simp only [Uniform.continuousAt_iff_prod, nhds_prod_eq] simp only [(nhds_basis_opens _).prod_self.tendsto_iff hU.toHasBasis, - forall_prop_of_true, setOf_forall] + forall_prop_of_true, ofPred_forall] refine .iInter fun k ↦ IsOpen.isGδ <| isOpen_iff_mem_nhds.2 fun x ↦ ?_ rintro ⟨s, ⟨hsx, hso⟩, hsU⟩ filter_upwards [IsOpen.mem_nhds hso hsx] with _ hy using ⟨s, ⟨hy, hso⟩, hsU⟩ +@[deprecated (since := "2026-07-09")] +alias IsGδ.setOf_continuousAt := IsGδ.setOfPred_continuousAt + end ContinuousAt diff --git a/Mathlib/Topology/Homeomorph/Defs.lean b/Mathlib/Topology/Homeomorph/Defs.lean index 2833bea0f96d53..dda79217df4a00 100644 --- a/Mathlib/Topology/Homeomorph/Defs.lean +++ b/Mathlib/Topology/Homeomorph/Defs.lean @@ -376,11 +376,13 @@ theorem nhds_eq_comap (h : X ≃ₜ Y) (x : X) : 𝓝 x = comap h (𝓝 (h x)) : theorem comap_nhds_eq (h : X ≃ₜ Y) (y : Y) : comap h (𝓝 y) = 𝓝 (h.symm y) := by rw [h.nhds_eq_comap, h.apply_symm_apply] -theorem isClosed_setOf_iff {p : X → Prop} {q : Y → Prop} (f : X ≃ₜ Y) (hs : IsClopen {x | p x}) +theorem isClosed_setOfPred_iff {p : X → Prop} {q : Y → Prop} (f : X ≃ₜ Y) (hs : IsClopen {x | p x}) (ht : IsClopen {y | q y}) : IsClosed { x : X | p x ↔ q (f x) } := by simpa [iff_def] using! (isClosed_imp hs.2 (f.isClosed_preimage.2 ht.1)).inter (isClosed_imp (f.isOpen_preimage.2 ht.2) hs.1) +@[deprecated (since := "2026-07-09")] alias isClosed_setOf_iff := isClosed_setOfPred_iff + end Homeomorph namespace Equiv diff --git a/Mathlib/Topology/Homotopy/Lifting.lean b/Mathlib/Topology/Homotopy/Lifting.lean index d6bb44b3bfee66..fdb7a288bd2c4a 100644 --- a/Mathlib/Topology/Homotopy/Lifting.lean +++ b/Mathlib/Topology/Homotopy/Lifting.lean @@ -98,7 +98,7 @@ theorem exists_lift_nhds {f : C(I × A, X)} {g : I × A → E} (g_lifts : p ∘ change g' (t n, a) ∈ (q e).source; rw [g'_a _ le_rfl] exact h_sub ⟨le_rfl, t_mono n.le_succ⟩ · rw [← t_0]; exact ⟨t_mono n.zero_le, le_rfl⟩ - · have ht := Set.mem_setOf.mp (frontier_le_subset_eq continuous_fst continuous_const hfr) + · have ht := Set.mem_ofPred.mp (frontier_le_subset_eq continuous_fst continuous_const hfr) have : f ta ∈ (q e).target := huv ⟨hu (by rw [ht]; exact ⟨le_rfl, t_mono n.le_succ⟩), hav⟩ rw [if_pos this] -- here we use that {tₙ} × Nₙ₊₁ is mapped to the domain of `q e` @@ -106,10 +106,12 @@ theorem exists_lift_nhds {f : C(I × A, X)} {g : I × A → E} (g_lifts : p ∘ rw [(q e).right_inv this, ← hpq e]; exact congr($g'_lifts ta) · rw [closure_le_eq continuous_fst continuous_const] at ht exact ⟨⟨hta.1.1, ht⟩, hta.2.2.1⟩ - · simp_rw [not_le]; exact (ContinuousOn.congr ((q e).continuousOn_invFun.comp f.2.continuousOn + · simp_rw [not_le] + refine ContinuousOn.mono ?_ + (Set.inter_subset_inter_right _ <| closure_lt_subset_le continuous_const continuous_fst) + exact ContinuousOn.congr ((q e).continuousOn_invFun.comp f.2.continuousOn fun _ h ↦ huv ⟨hu ⟨h.2, h.1.1.2⟩, h.1.2.1⟩) - fun _ h ↦ if_pos <| huv ⟨hu ⟨h.2, h.1.1.2⟩, h.1.2.1⟩).mono - (Set.inter_subset_inter_right _ <| closure_lt_subset_le continuous_const continuous_fst) + fun _ h ↦ if_pos <| huv ⟨hu ⟨h.2, h.1.1.2⟩, h.1.2.1⟩ · ext ta; rw [Function.comp_apply]; split_ifs with _ hv · exact congr($g'_lifts ta) · rw [hpq e, (q e).right_inv hv] @@ -458,7 +460,8 @@ lemma injective_path_homotopic_map (e₀ e₁ : E) : simp only [Path.Homotopic.Quotient.mk''_eq_mk] simp_rw [← Path.Homotopic.Quotient.mk_map] iterate 2 rw [Path.Homotopic.Quotient.eq] - exact (cov.homotopicRel_iff_comp ⟨0, .inl rfl, γ₀.source.trans γ₁.source.symm⟩).mpr + exact (cov.homotopicRel_iff_comp (S := {0, 1}) + ⟨0, .inl rfl, γ₀.source.trans γ₁.source.symm⟩).mpr @[deprecated (since := "2025-11-20")] alias injective_path_homotopic_mapFn := injective_path_homotopic_map diff --git a/Mathlib/Topology/Instances/AddCircle/Defs.lean b/Mathlib/Topology/Instances/AddCircle/Defs.lean index 19d0f23e4a5ce7..f983cc0bea66ea 100644 --- a/Mathlib/Topology/Instances/AddCircle/Defs.lean +++ b/Mathlib/Topology/Instances/AddCircle/Defs.lean @@ -177,7 +177,7 @@ theorem toIcoMod_eventuallyEq_toIocMod (hx : ¬x ≡ a [PMOD p]) : refine IsOpen.mem_nhds ?_ ?_ · rw [Ico_eq_locus_Ioc_eq_iUnion_Ioo] exact isOpen_iUnion fun i => isOpen_Ioo - · rwa [mem_setOf_eq, ← not_modEq_iff_toIcoMod_eq_toIocMod hp, AddCommGroup.modEq_comm] + · rwa [mem_ofPred_eq, ← not_modEq_iff_toIcoMod_eq_toIocMod hp, AddCommGroup.modEq_comm] theorem continuousAt_toIcoMod (hx : ¬x ≡ a [PMOD p]) : ContinuousAt (toIcoMod hp a) x := continuousAt_id.sub <| tendsto_nhds_of_eventually_eq <| @@ -241,7 +241,7 @@ theorem card_torsion_le_of_isSMulRegular (n : ℕ) (h0 : n ≠ 0) (hn : IsSMulRe have (x : {x : AddCircle p | n • x = 0}) : ∃ (k : Fin n) (y : 𝕜), y = x.1 ∧ n • y = k.1 • p := by obtain ⟨x, hx⟩ := x obtain ⟨y, rfl⟩ := mk_surjective x - rw [Set.mem_setOf, ← mk_nsmul, eq_zero_iff] at hx + rw [Set.mem_ofPred, ← mk_nsmul, eq_zero_iff] at hx have ⟨m', hm⟩ := hx have : NeZero n := ⟨h0⟩ rw [← (Int.divModEquiv n).symm_apply_apply m', Int.divModEquiv_symm_apply] at hm @@ -285,10 +285,13 @@ variable [LinearOrder 𝕜] [IsOrderedAddMonoid 𝕜] theorem finite_torsion {n : ℕ} (hn : 0 < n) : { u : AddCircle p | n • u = 0 }.Finite := finite_torsion_of_isSMulRegular _ _ <| .of_right_eq_zero_of_smul fun _ ↦ by simp [hn.ne'] -theorem finite_setOf_addOrderOf_eq {n : ℕ} (hn : 0 < n) : +theorem finite_setOfPred_addOrderOf_eq {n : ℕ} (hn : 0 < n) : {u : AddCircle p | addOrderOf u = n}.Finite := (finite_torsion p hn).subset fun _ h ↦ ((addOrderOf_eq_iff hn).mp h).1 +@[deprecated (since := "2026-07-09")] +alias finite_setOf_addOrderOf_eq := finite_setOfPred_addOrderOf_eq + theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : 𝕜} (hx : 0 < x) : (x : AddCircle p) = 0 ↔ ∃ n : ℕ, n • p = x := by rw [coe_eq_zero_iff] @@ -680,12 +683,12 @@ theorem card_addOrderOf_eq_totient {n : ℕ} : · simp only [Nat.totient_zero, addOrderOf_eq_zero_iff] rcases em (∃ u : AddCircle p, ¬IsOfFinAddOrder u) with (⟨u, hu⟩ | h) · have : Infinite { u : AddCircle p // ¬IsOfFinAddOrder u } := by - rw [← coe_setOf, infinite_coe_iff] + rw [← coe_ofPred, infinite_coe_iff] exact infinite_not_isOfFinAddOrder hu exact Nat.card_eq_zero_of_infinite · have : IsEmpty { u : AddCircle p // ¬IsOfFinAddOrder u } := by simpa [isEmpty_subtype] using h exact Nat.card_of_isEmpty - · rw [← coe_setOf, Nat.card_congr (setAddOrderOfEquiv p hn), + · rw [← coe_ofPred, Nat.card_congr (setAddOrderOfEquiv p hn), n.totient_eq_card_lt_and_coprime] simp only [Nat.gcd_comm] diff --git a/Mathlib/Topology/Instances/CantorSet.lean b/Mathlib/Topology/Instances/CantorSet.lean index fbbd91931ac4b0..6b9c63124a6103 100644 --- a/Mathlib/Topology/Instances/CantorSet.lean +++ b/Mathlib/Topology/Instances/CantorSet.lean @@ -39,7 +39,7 @@ This file defines the Cantor ternary set and proves a few properties. middle third of each interval. Formally, the order `n + 1` pre-Cantor set is the union of the images under the functions `(· / 3)` and `((2 + ·) / 3)` of `preCantorSet n`. -/ -def preCantorSet : ℕ → Set ℝ +noncomputable def preCantorSet : ℕ → Set ℝ | 0 => Set.Icc 0 1 | n + 1 => (· / 3) '' preCantorSet n ∪ (fun x ↦ (2 + x) / 3) '' preCantorSet n @@ -52,7 +52,7 @@ def preCantorSet : ℕ → Set ℝ pre-Cantor sets. This means that the Cantor set is obtained by iteratively removing the open middle third of each subinterval, starting from the unit interval `[0, 1]`. -/ -def cantorSet : Set ℝ := ⋂ n, preCantorSet n +noncomputable def cantorSet : Set ℝ := ⋂ n, preCantorSet n /-! diff --git a/Mathlib/Topology/Instances/ENNReal/Lemmas.lean b/Mathlib/Topology/Instances/ENNReal/Lemmas.lean index 06a8d14917dfe5..c81772ad5dbc68 100644 --- a/Mathlib/Topology/Instances/ENNReal/Lemmas.lean +++ b/Mathlib/Topology/Instances/ENNReal/Lemmas.lean @@ -146,7 +146,7 @@ theorem tendsto_nhds_top {m : α → ℝ≥0∞} {f : Filter α} (h : ∀ n : theorem tendsto_nat_nhds_top : Tendsto (fun n : ℕ => ↑n) atTop (𝓝 ∞) := tendsto_nhds_top fun n => - mem_atTop_sets.2 ⟨n + 1, fun _m hm => mem_setOf.2 <| Nat.cast_lt.2 <| Nat.lt_of_succ_le hm⟩ + mem_atTop_sets.2 ⟨n + 1, fun _m hm => mem_ofPred.2 <| Nat.cast_lt.2 <| Nat.lt_of_succ_le hm⟩ @[simp, norm_cast] theorem tendsto_coe_nhds_top {f : α → ℝ≥0} {l : Filter α} : @@ -418,13 +418,13 @@ theorem continuousOn_sub : ContinuousOn (fun p : ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) { p : ℝ≥0∞ × ℝ≥0∞ | p ≠ ⟨∞, ∞⟩ } := by rw [ContinuousOn] rintro ⟨x, y⟩ hp - simp only [Ne, Set.mem_setOf_eq, Prod.mk_inj] at hp + simp only [Ne, Set.mem_ofPred_eq, Prod.mk_inj] at hp exact tendsto_nhdsWithin_of_tendsto_nhds (tendsto_sub (not_and_or.mp hp)) theorem continuous_sub_left {a : ℝ≥0∞} (a_ne_top : a ≠ ∞) : Continuous (a - ·) := by change Continuous (Function.uncurry Sub.sub ∘ (a, ·)) refine continuousOn_sub.comp_continuous (.prodMk_right a) fun x => ?_ - simp only [a_ne_top, Ne, mem_setOf_eq, Prod.mk_inj, false_and, not_false_iff] + simp only [a_ne_top, Ne, mem_ofPred_eq, Prod.mk_inj, false_and, not_false_iff] theorem continuous_nnreal_sub {a : ℝ≥0} : Continuous fun x : ℝ≥0∞ => (a : ℝ≥0∞) - x := continuous_sub_left coe_ne_top @@ -441,7 +441,7 @@ theorem continuous_sub_right (a : ℝ≥0∞) : Continuous fun x : ℝ≥0∞ => · rw [show (fun x => x - a) = (fun p : ℝ≥0∞ × ℝ≥0∞ => p.fst - p.snd) ∘ fun x => ⟨x, a⟩ by rfl] apply continuousOn_sub.comp_continuous (by fun_prop) intro x - simp only [a_infty, Ne, mem_setOf_eq, Prod.mk_inj, and_false, not_false_iff] + simp only [a_infty, Ne, mem_ofPred_eq, Prod.mk_inj, and_false, not_false_iff] protected theorem Tendsto.pow {f : Filter α} {m : α → ℝ≥0∞} {a : ℝ≥0∞} {n : ℕ} (hm : Tendsto m f (𝓝 a)) : Tendsto (fun x => m x ^ n) f (𝓝 (a ^ n)) := @@ -661,15 +661,23 @@ theorem Metric.ediam_closure (s : Set α) : ediam (closure s) = ediam s := by theorem Metric.diam_closure {α : Type*} [PseudoMetricSpace α] (s : Set α) : Metric.diam (closure s) = diam s := by simp only [Metric.diam, Metric.ediam_closure] -theorem isClosed_setOf_lipschitzOnWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) +theorem isClosed_setOfPred_lipschitzOnWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] + (K : ℝ≥0) (s : Set α) : IsClosed { f : α → β | LipschitzOnWith K f s } := by - simp only [LipschitzOnWith, setOf_forall] + simp only [LipschitzOnWith, ofPred_forall] refine isClosed_biInter fun x _ => isClosed_biInter fun y _ => isClosed_le ?_ ?_ exacts [.edist (continuous_apply x) (continuous_apply y), continuous_const] -theorem isClosed_setOf_lipschitzWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) : +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_lipschitzOnWith := isClosed_setOfPred_lipschitzOnWith + +theorem isClosed_setOfPred_lipschitzWith {α β} [PseudoEMetricSpace α] [PseudoEMetricSpace β] + (K : ℝ≥0) : IsClosed { f : α → β | LipschitzWith K f } := by - simp only [← lipschitzOnWith_univ, isClosed_setOf_lipschitzOnWith] + simp only [← lipschitzOnWith_univ, isClosed_setOfPred_lipschitzOnWith] + +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_lipschitzWith := isClosed_setOfPred_lipschitzWith protected lemma LipschitzOnWith.closure [PseudoEMetricSpace β] {f : α → β} {s : Set α} {K : ℝ≥0} (hcont : ContinuousOn f (closure s)) (hf : LipschitzOnWith K f s) : @@ -929,6 +937,6 @@ lemma Dense.lipschitzWith_extend {α β : Type*} rintro ⟨x, y⟩ ⟨hx, hy⟩ have Ax : hs.extend f x = f ⟨x, hx⟩ := hs.extend_eq hf.continuous ⟨x, hx⟩ have Ay : hs.extend f y = f ⟨y, hy⟩ := hs.extend_eq hf.continuous ⟨y, hy⟩ - simp only [Set.mem_setOf_eq, Ax, Ay] + simp only [Set.mem_ofPred_eq, Ax, Ay] exact hf ⟨x, hx⟩ ⟨y, hy⟩ - simpa only [Dense, IsClosed.closure_eq, Set.mem_setOf_eq, Prod.forall] using! this + simpa only [Dense, IsClosed.closure_eq, Set.mem_ofPred_eq, Prod.forall] using! this diff --git a/Mathlib/Topology/Instances/Irrational.lean b/Mathlib/Topology/Instances/Irrational.lean index c41da3cb18631b..843286cf44a3db 100644 --- a/Mathlib/Topology/Instances/Irrational.lean +++ b/Mathlib/Topology/Instances/Irrational.lean @@ -15,8 +15,8 @@ public import Mathlib.Topology.Instances.Real.Lemmas In this file we prove the following theorems: -* `IsGδ.setOf_irrational`, `dense_irrational`, `eventually_residual_irrational`: irrational numbers - form a dense Gδ set; +* `IsGδ.setOfPred_irrational`, `dense_irrational`, `eventually_residual_irrational`: irrational + numbers form a dense Gδ set; * `Irrational.eventually_forall_le_dist_cast_div`, `Irrational.eventually_forall_le_dist_cast_div_of_denom_le`; @@ -38,9 +38,11 @@ open Set Filter Metric open Filter Topology -protected theorem IsGδ.setOf_irrational : IsGδ { x | Irrational x } := +protected theorem IsGδ.setOfPred_irrational : IsGδ { x | Irrational x } := (countable_range _).isGδ_compl +@[deprecated (since := "2026-07-09")] alias IsGδ.setOf_irrational := IsGδ.setOfPred_irrational + theorem dense_irrational : Dense { x : ℝ | Irrational x } := by refine Real.isTopologicalBasis_Ioo_rat.dense_iff.2 ?_ @@ -50,7 +52,7 @@ theorem dense_irrational : Dense { x : ℝ | Irrational x } := by exact exists_irrational_btwn (Rat.cast_lt.2 hlt) theorem eventually_residual_irrational : ∀ᶠ x in residual ℝ, Irrational x := - residual_of_dense_Gδ .setOf_irrational dense_irrational + residual_of_dense_Gδ .setOfPred_irrational dense_irrational namespace Irrational diff --git a/Mathlib/Topology/Instances/Matrix.lean b/Mathlib/Topology/Instances/Matrix.lean index c3758be01ab206..b0264407092214 100644 --- a/Mathlib/Topology/Instances/Matrix.lean +++ b/Mathlib/Topology/Instances/Matrix.lean @@ -308,12 +308,15 @@ theorem Continuous.matrix_blockDiag' Continuous fun x => blockDiag' (A x) := continuous_pi fun _i => continuous_matrix fun _j _k => hA.matrix_elem _ _ -theorem isClosed_setOf_blockTriangular {α : Type*} {b : m → α} [LinearOrder α] [Zero R] +theorem isClosed_setOfPred_blockTriangular {α : Type*} {b : m → α} [LinearOrder α] [Zero R] [T2Space R] : IsClosed {M : Matrix m m R | M.BlockTriangular b} := by - simp only [BlockTriangular, Set.setOf_forall] + simp only [BlockTriangular, Set.ofPred_forall] refine isClosed_iInter fun i => isClosed_iInter fun j => isClosed_iInter fun _ => ?_ exact isClosed_eq (continuous_id.matrix_elem i j) continuous_const +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_blockTriangular := isClosed_setOfPred_blockTriangular + end BlockMatrices end Continuity diff --git a/Mathlib/Topology/Irreducible.lean b/Mathlib/Topology/Irreducible.lean index e7e91d08c1cfee..c74d1fad3964bc 100644 --- a/Mathlib/Topology/Irreducible.lean +++ b/Mathlib/Topology/Irreducible.lean @@ -133,7 +133,7 @@ lemma exists_mem_irreducibleComponents_subset_of_isIrreducible (s : Set X) (hs : /-- A maximal irreducible set that contains a given point. -/ @[stacks 004W "(4)"] -def irreducibleComponent (x : X) : Set X := +noncomputable def irreducibleComponent (x : X) : Set X := Classical.choose (exists_preirreducible {x} isPreirreducible_singleton) theorem irreducibleComponent_property (x : X) : @@ -338,7 +338,7 @@ theorem isPreirreducible_iff_subset_closure_inter_open (S : Set X) : · intro a b ha hb ⟨p, pS, pa⟩ bS by_contra! h0 suffices p ∉ closure (S ∩ b) from this <| (h b hb bS) pS - simp only [closure, mem_sInter, mem_setOf_eq, and_imp, not_forall, exists_prop] + simp only [closure, mem_sInter, mem_ofPred_eq, and_imp, not_forall, exists_prop] use aᶜ grind [isClosed_compl_iff, subset_compl_iff_disjoint_left, disjoint_iff_inter_eq_empty] diff --git a/Mathlib/Topology/JacobsonSpace.lean b/Mathlib/Topology/JacobsonSpace.lean index 8dc924808ef18b..c035387e253acc 100644 --- a/Mathlib/Topology/JacobsonSpace.lean +++ b/Mathlib/Topology/JacobsonSpace.lean @@ -35,7 +35,7 @@ variable (X) {Y} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y} section closedPoints /-- The set of closed points. -/ -def closedPoints : Set X := setOf (IsClosed {·}) +def closedPoints : Set X := Set.ofPred (IsClosed {·}) variable {X} diff --git a/Mathlib/Topology/LocalAtTarget.lean b/Mathlib/Topology/LocalAtTarget.lean index 1ff14ed4d98080..a8b0228efad726 100644 --- a/Mathlib/Topology/LocalAtTarget.lean +++ b/Mathlib/Topology/LocalAtTarget.lean @@ -220,7 +220,7 @@ lemma isOpenMap_iff_comp : IsOpenMap f ↔ ∀ i, IsOpenMap (f ∘ ((↑) : U i intro V hV convert! isOpen_iUnion (fun i ↦ hf i _ <| isOpen_induced hV) simp_rw [Set.image_comp, Set.image_preimage_eq_inter_range, ← Set.image_iUnion, - Subtype.range_coe_subtype, SetLike.setOf_mem_eq, hU.iUnion_inter] + Subtype.range_coe_subtype, SetLike.setOfPred_mem_eq, hU.iUnion_inter] lemma generalizingMap_iff_comp : GeneralizingMap f ↔ ∀ i, GeneralizingMap (f ∘ ((↑) : U i → α)) := by diff --git a/Mathlib/Topology/LocallyFinite.lean b/Mathlib/Topology/LocallyFinite.lean index 21ae2a80a11d42..61ec1828ad70af 100644 --- a/Mathlib/Topology/LocallyFinite.lean +++ b/Mathlib/Topology/LocallyFinite.lean @@ -82,7 +82,7 @@ protected theorem nhdsWithin_iUnion (hf : LocallyFinite f) (a : X) : 𝓝[⋃ i, f i] a = 𝓝[⋃ i, f i ∩ U] a := by rw [← iUnion_inter, ← nhdsWithin_inter_of_mem' (nhdsWithin_le_nhds haU)] _ = 𝓝[⋃ i ∈ {j | (f j ∩ U).Nonempty}, (f i ∩ U)] a := by - simp only [mem_setOf_eq, iUnion_nonempty_self] + simp only [mem_ofPred_eq, iUnion_nonempty_self] _ = ⨆ i ∈ {j | (f j ∩ U).Nonempty}, 𝓝[f i ∩ U] a := nhdsWithin_biUnion hfin _ _ _ ≤ ⨆ i, 𝓝[f i ∩ U] a := iSup₂_le_iSup _ _ _ ≤ ⨆ i, 𝓝[f i] a := iSup_mono fun i ↦ nhdsWithin_mono _ inter_subset_left @@ -200,7 +200,7 @@ theorem Equiv.locallyFinite_comp_iff (e : ι' ≃ ι) : LocallyFinite (f ∘ e) theorem locallyFinite_sum {f : ι ⊕ ι' → Set X} : LocallyFinite f ↔ LocallyFinite (f ∘ Sum.inl) ∧ LocallyFinite (f ∘ Sum.inr) := by simp only [locallyFinite_iff_smallSets, ← forall_and, ← finite_preimage_inl_and_inr, - preimage_setOf_eq, (· ∘ ·), eventually_and] + preimage_ofPred_eq, (· ∘ ·), eventually_and] theorem LocallyFinite.sumElim {g : ι' → Set X} (hf : LocallyFinite f) (hg : LocallyFinite g) : LocallyFinite (Sum.elim f g) := diff --git a/Mathlib/Topology/LocallyFinsupp.lean b/Mathlib/Topology/LocallyFinsupp.lean index 69e86e21c6d843..e8f157606feec6 100644 --- a/Mathlib/Topology/LocallyFinsupp.lean +++ b/Mathlib/Topology/LocallyFinsupp.lean @@ -80,7 +80,7 @@ theorem supportDiscreteWithin_iff_locallyFiniteWithin [T1Space X] [Zero Y] {f : f =ᶠ[codiscreteWithin U] 0 ↔ ∀ z ∈ U, ∃ t ∈ 𝓝 z, Set.Finite (t ∩ f.support) := by have : f.support = (U \ {x | f x = (0 : X → Y) x}) := by ext x - simp only [mem_support, ne_eq, Pi.zero_apply, Set.mem_sdiff, mem_setOf_eq, iff_and_self] + simp only [mem_support, ne_eq, Pi.zero_apply, Set.mem_sdiff, mem_ofPred_eq, iff_and_self] exact (h ·) rw [EventuallyEq, Filter.Eventually, codiscreteWithin_iff_locallyFiniteComplementWithin, this] @@ -207,7 +207,7 @@ theorem eq_zero_codiscreteWithin [Zero Y] [T1Space X] (D : locallyFinsuppWithin apply codiscreteWithin_iff_locallyFiniteComplementWithin.2 have : D.support = (U \ {x | D x = (0 : X → Y) x}) := by ext x - simp only [mem_support, ne_eq, Pi.zero_apply, Set.mem_sdiff, Set.mem_setOf_eq, iff_and_self] + simp only [mem_support, ne_eq, Pi.zero_apply, Set.mem_sdiff, Set.mem_ofPred_eq, iff_and_self] exact (support_subset_iff.1 D.supportWithinDomain) x rw [← this] exact D.supportLocallyFiniteWithinDomain @@ -222,7 +222,7 @@ theorem discreteSupport [Zero Y] [T1Space X] (D : locallyFinsuppWithin U Y) : constructor · exact fun hx ↦ ⟨by tauto, D.supportWithinDomain hx⟩ · intro hx - rw [mem_inter_iff, mem_compl_iff, mem_setOf_eq] at hx + rw [mem_inter_iff, mem_compl_iff, mem_ofPred_eq] at hx tauto rw [this] apply isDiscrete_of_codiscreteWithin @@ -272,7 +272,7 @@ Functions with locally finite support within `U` form an additive submonoid of f protected def addSubmonoid [AddMonoid Y] : AddSubmonoid (X → Y) where carrier := {f | f.support ⊆ U ∧ ∀ z ∈ U, ∃ t ∈ 𝓝 z, Set.Finite (t ∩ f.support)} zero_mem' := by - simp only [support_subset_iff, ne_eq, mem_setOf_eq, Pi.zero_apply, not_true_eq_false, + simp only [support_subset_iff, ne_eq, mem_ofPred_eq, Pi.zero_apply, not_true_eq_false, IsEmpty.forall_iff, implies_true, support_zero, inter_empty, finite_empty, and_true, true_and] exact fun _ _ ↦ ⟨⊤, univ_mem⟩ @@ -287,7 +287,7 @@ protected def addSubmonoid [AddMonoid Y] : AddSubmonoid (X → Y) where use t₁ ∩ t₂, inter_mem ht₁.1 ht₂.1 apply Set.Finite.subset (s := (t₁ ∩ f.support) ∪ (t₂ ∩ g.support)) (ht₁.2.union ht₂.2) intro a ha - simp_all only [support_subset_iff, ne_eq, mem_setOf_eq, + simp_all only [support_subset_iff, ne_eq, mem_ofPred_eq, mem_inter_iff, mem_support, Pi.add_apply, mem_union, true_and] by_contra! hCon simp_all diff --git a/Mathlib/Topology/Maps/Basic.lean b/Mathlib/Topology/Maps/Basic.lean index 4efc1e7e0b3e4e..42f4f57a870468 100644 --- a/Mathlib/Topology/Maps/Basic.lean +++ b/Mathlib/Topology/Maps/Basic.lean @@ -161,10 +161,12 @@ theorem image_eq_isOpen_inter_range (hf : IsInducing f) {s : Set X} (hs : IsOpen obtain ⟨c, hc, rfl⟩ := hf.isOpen_iff.1 hs exact ⟨c, hc, image_preimage_eq_inter_range⟩ -theorem setOf_isOpen (hf : IsInducing f) : +theorem setOfPred_isOpen (hf : IsInducing f) : {s : Set X | IsOpen s} = preimage f '' {t | IsOpen t} := Set.ext fun _ ↦ hf.isOpen_iff +@[deprecated (since := "2026-07-09")] alias setOf_isOpen := setOfPred_isOpen + theorem dense_iff (hf : IsInducing f) {s : Set X} : Dense s ↔ ∀ x, f x ∈ closure (f '' s) := by simp only [Dense, hf.closure_eq_preimage_closure_image, mem_preimage] diff --git a/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean b/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean index 43615f5136d0e7..4fd7a3dbef3d91 100644 --- a/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean +++ b/Mathlib/Topology/Maps/Proper/UniversallyClosed.lean @@ -59,7 +59,7 @@ theorem isProperMap_iff_isClosedMap_filter {X : Type u} {Y : Type v} [Topologica -- must contain some element of the form `(z, pure z)`. In other words, we have `z ∈ U` and -- `Uᶜ ∈ pure z`, which means `z ∈ Uᶜ` by the definition of pure. -- This is a contradiction, which completes the proof. - rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU (isOpen_setOf_mem.mem_nhds hUc)) with + rcases hx (U ×ˢ {𝒢 | Uᶜ ∈ 𝒢}) (prod_mem_nhds hU (isOpen_setOfPred_mem.mem_nhds hUc)) with ⟨⟨z, 𝒢⟩, ⟨⟨hz : z ∈ U, hz' : Uᶜ ∈ 𝒢⟩, rfl : 𝒢 = pure z⟩⟩ exact hz' hz diff --git a/Mathlib/Topology/MetricSpace/Algebra.lean b/Mathlib/Topology/MetricSpace/Algebra.lean index f5fe9c63a1d14b..7064d168835556 100644 --- a/Mathlib/Topology/MetricSpace/Algebra.lean +++ b/Mathlib/Topology/MetricSpace/Algebra.lean @@ -177,7 +177,7 @@ theorem TendstoLocallyUniformlyOn.smul₀_of_isBoundedUnder {X ι : Type*} [Topo filter_upwards [hF x hx (Metric.dist_mem_uniformity one_pos), hG x hx (Metric.dist_mem_uniformity one_pos), tendsto_snd hC] with ⟨n, y⟩ hFn hGn hfg simp only [mem_prod, Metric.mem_ball, Prod.dist_eq, Prod.fst_zero, Prod.snd_zero, sup_lt_iff, - mem_preimage, mem_setOf] at hFn hGn hfg ⊢ + mem_preimage, mem_ofPred] at hFn hGn hfg ⊢ grw [dist_triangle_left (F n y) 0 (f y), dist_triangle_left (G n y) 0 (g y)] constructor <;> constructor <;> linarith diff --git a/Mathlib/Topology/MetricSpace/Bounded.lean b/Mathlib/Topology/MetricSpace/Bounded.lean index bd4e06e4f1504f..845c810581a25c 100644 --- a/Mathlib/Topology/MetricSpace/Bounded.lean +++ b/Mathlib/Topology/MetricSpace/Bounded.lean @@ -383,14 +383,12 @@ variable {α : Type*} [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] [CompactIccSpace α] lemma isBounded_of_abs_le (C : α) : Bornology.IsBounded {x : α | |x| ≤ C} := by - convert! Metric.isBounded_Icc (-C) C - ext1 x - simp [abs_le] + rw [show {x : α | |x| ≤ C} = Set.Icc (-C) C by ext x; simp [abs_le]] + exact Metric.isBounded_Icc (-C) C lemma isBounded_of_abs_lt (C : α) : Bornology.IsBounded {x : α | |x| < C} := by - convert! Metric.isBounded_Ioo (-C) C - ext1 x - simp [abs_lt] + rw [show {x : α | |x| < C} = Set.Ioo (-C) C by ext x; simp [abs_lt]] + exact Metric.isBounded_Ioo (-C) C end CompactIccSpace_abs @@ -650,7 +648,7 @@ theorem exists_forall_le_of_isBounded {f : β → α} (hf : Continuous f) (x₀ refine hf.exists_forall_le' (x₀ := x₀) ?_ have hU : {x : β | f x₀ < f x} ∈ Filter.cocompact β := by refine Filter.mem_cocompact'.mpr ⟨_, ?_, fun ⦃_⦄ a ↦ a⟩ - simp only [Set.compl_setOf, not_lt] + simp only [Set.compl_ofPred, not_lt] exact Metric.isCompact_of_isClosed_isBounded (isClosed_le (by fun_prop) (by fun_prop)) h filter_upwards [hU] with x hx using hx.le diff --git a/Mathlib/Topology/MetricSpace/CantorScheme.lean b/Mathlib/Topology/MetricSpace/CantorScheme.lean index baadcf3f8b6a98..0b9977d47176eb 100644 --- a/Mathlib/Topology/MetricSpace/CantorScheme.lean +++ b/Mathlib/Topology/MetricSpace/CantorScheme.lean @@ -142,7 +142,7 @@ theorem VanishingDiam.map_continuous [TopologicalSpace β] [DiscreteTopology β] rw [_root_.eventually_nhds_iff] refine ⟨(↑)⁻¹' cylinder x.1 n, ?_, ?_, by simp⟩ · rintro y hyx - rw [mem_preimage, Subtype.coe_mk, cylinder_eq_res, mem_setOf] at hyx + rw [mem_preimage, Subtype.coe_mk, cylinder_eq_res, mem_ofPred] at hyx apply hn · rw [← hyx] apply map_mem diff --git a/Mathlib/Topology/MetricSpace/Closeds.lean b/Mathlib/Topology/MetricSpace/Closeds.lean index 84b99c80909c4a..ea34c261152577 100644 --- a/Mathlib/Topology/MetricSpace/Closeds.lean +++ b/Mathlib/Topology/MetricSpace/Closeds.lean @@ -37,7 +37,7 @@ variable {α : Type*} [PseudoEMetricSpace α] theorem mem_hausdorffEntourage_of_hausdorffEDist_lt {s t : Set α} {δ : ℝ≥0∞} (h : hausdorffEDist s t < δ) : (s, t) ∈ hausdorffEntourage {p | edist p.1 p.2 < δ} := by rw [hausdorffEDist, max_lt_iff] at h - rw [hausdorffEntourage, Set.mem_setOf] + rw [hausdorffEntourage, Set.mem_ofPred] conv => enter [2, 2, 1, 1, _]; rw [edist_comm] have {s t : Set α} (h : ⨆ x ∈ s, infEDist x t < δ) : s ⊆ SetRel.preimage {p | edist p.1 p.2 < δ} t := by @@ -48,7 +48,7 @@ theorem mem_hausdorffEntourage_of_hausdorffEDist_lt {s t : Set α} {δ : ℝ≥0 theorem hausdorffEDist_le_of_mem_hausdorffEntourage {s t : Set α} {δ : ℝ≥0∞} (h : (s, t) ∈ hausdorffEntourage {p | edist p.1 p.2 ≤ δ}) : hausdorffEDist s t ≤ δ := by rw [hausdorffEDist, max_le_iff] - rw [hausdorffEntourage, Set.mem_setOf] at h + rw [hausdorffEntourage, Set.mem_ofPred] at h conv at h => enter [2, 2, 1, 1, _]; rw [edist_comm] have {s t : Set α} (h : s ⊆ SetRel.preimage {p | edist p.1 p.2 ≤ δ} t) : ⨆ x ∈ s, infEDist x t ≤ δ := by diff --git a/Mathlib/Topology/MetricSpace/Completion.lean b/Mathlib/Topology/MetricSpace/Completion.lean index 888e2d05587c21..9dd98004995c58 100644 --- a/Mathlib/Topology/MetricSpace/Completion.lean +++ b/Mathlib/Topology/MetricSpace/Completion.lean @@ -105,7 +105,7 @@ protected theorem mem_uniformity_dist (s : Set (Completion α × Completion α)) by_cases! h : ε ≤ dist x y · exact Or.inl h · have Z := hε h - simp only [Set.mem_setOf_eq] at Z + simp only [Set.mem_ofPred_eq] at Z exact Or.inr Z simp only [not_le.mpr hxy, false_or] at this exact ts this diff --git a/Mathlib/Topology/MetricSpace/GromovHausdorff.lean b/Mathlib/Topology/MetricSpace/GromovHausdorff.lean index 70934af7912b61..6db3ad0d025e84 100644 --- a/Mathlib/Topology/MetricSpace/GromovHausdorff.lean +++ b/Mathlib/Topology/MetricSpace/GromovHausdorff.lean @@ -226,7 +226,7 @@ theorem ghDist_le_hausdorffDist {X : Type u} [MetricSpace X] [CompactSpace X] [N rw [eq_toGHSpace_iff] exact ⟨fun x => F (Ψ' x), (kuratowskiEmbedding.isometry _).comp IΨ', range_comp _ _⟩ refine csInf_le ⟨0, ?_⟩ ?_ - · simp only [lowerBounds, mem_image, mem_prod, mem_setOf_eq, Prod.exists, and_imp, + · simp only [lowerBounds, mem_image, mem_prod, mem_ofPred_eq, Prod.exists, and_imp, forall_exists_index] intro t _ _ _ _ ht rw [← ht] @@ -289,7 +289,7 @@ theorem hausdorffDist_optimal {X : Type u} [MetricSpace X] [CompactSpace X] [Non -- check that the induced "distance" is a candidate have Fgood : F ∈ candidates X Y := by simp only [F, candidates, forall_const, - dist_eq_zero, Set.mem_setOf_eq] + dist_eq_zero, Set.mem_ofPred_eq] repeat' constructor · exact fun x y => calc @@ -398,7 +398,7 @@ instance : MetricSpace GHSpace where refine le_antisymm ?_ ?_ · apply csInf_le · exact ⟨0, by rintro b ⟨⟨u, v⟩, -, rfl⟩; exact hausdorffDist_nonneg⟩ - · simp only [mem_image, mem_prod, mem_setOf_eq, Prod.exists] + · simp only [mem_image, mem_prod, mem_ofPred_eq, Prod.exists] exists y, y simpa only [and_self_iff, hausdorffDist_self_zero, eq_self_iff_true, and_true] · apply le_csInf diff --git a/Mathlib/Topology/MetricSpace/GromovHausdorffRealized.lean b/Mathlib/Topology/MetricSpace/GromovHausdorffRealized.lean index f30003724c53e3..8dc9e1b6036bf2 100644 --- a/Mathlib/Topology/MetricSpace/GromovHausdorffRealized.lean +++ b/Mathlib/Topology/MetricSpace/GromovHausdorffRealized.lean @@ -231,7 +231,7 @@ private theorem closed_candidatesB : IsClosed (candidatesB X Y) := by ⋂ x, { f : Cb X Y | f (x, x) = 0 }) ∩ ⋂ (x) (y), { f : Cb X Y | f (x, y) ≤ maxVar X Y } := by ext - simp only [candidatesB, candidates, mem_inter_iff, mem_iInter, mem_setOf_eq] + simp only [candidatesB, candidates, mem_inter_iff, mem_iInter, mem_ofPred_eq] rw [this] repeat' first @@ -389,7 +389,7 @@ set_option backward.privateInPublic true in /-- The distance on `X ⊕ Y` is a candidate -/ private theorem dist_mem_candidates : (fun p : (X ⊕ Y) × (X ⊕ Y) => dist p.1 p.2) ∈ candidates X Y := by - simp_rw [candidates, Set.mem_setOf_eq, dist_comm, dist_triangle, dist_self, maxVar_bound, + simp_rw [candidates, Set.mem_ofPred_eq, dist_comm, dist_triangle, dist_self, maxVar_bound, forall_const, and_true] exact ⟨fun x y => rfl, fun x y => rfl⟩ diff --git a/Mathlib/Topology/MetricSpace/Holder.lean b/Mathlib/Topology/MetricSpace/Holder.lean index 11d9e8bf780056..5eb1eac1c7515a 100644 --- a/Mathlib/Topology/MetricSpace/Holder.lean +++ b/Mathlib/Topology/MetricSpace/Holder.lean @@ -223,18 +223,21 @@ lemma interpolate_const {C s t₁ t₂ : ℝ≥0} {A : Set X} variable (f) in /-- For fixed `f : X → Y`, `A : Set X` and `C : ℝ≥0`, the set of all parameters `r : ℝ≥0` such that `f` is `(C, r)`-Hölder on `A` is convex. -/ -lemma _root_.convex_setOf_holderOnWith (C : ℝ≥0) (A : Set X) : +lemma _root_.convex_setOfPred_holderOnWith (C : ℝ≥0) (A : Set X) : Convex ℝ≥0 {r | HolderOnWith C r f A} := by intro r hr s hs _ _ _ _ ht rw [smul_eq_mul, smul_eq_mul, ← mul_comm r, ← mul_comm s] exact hr.interpolate_const hs ht +@[deprecated (since := "2026-07-09")] +alias _root_.convex_setOf_holderOnWith := _root_.convex_setOfPred_holderOnWith + lemma of_le_of_le {C₁ C₂ s t : ℝ≥0} {A : Set X} (hf₁ : HolderOnWith C₁ r f A) (hf₂ : HolderOnWith C₂ s f A) (hrt : r ≤ t) (hts : t ≤ s) : HolderOnWith (max C₁ C₂) t f A := by replace hf₁ := hf₁.mono_const (le_max_left C₁ C₂) replace hf₂ := hf₂.mono_const (le_max_right C₁ C₂) - exact convex_setOf_holderOnWith f (max C₁ C₂) A |>.segment_subset hf₁ hf₂ + exact convex_setOfPred_holderOnWith f (max C₁ C₂) A |>.segment_subset hf₁ hf₂ (NNReal.Icc_subset_segment ⟨hrt, hts⟩) end HolderOnWith @@ -318,10 +321,13 @@ lemma interpolate_const {C s t₁ t₂ : ℝ≥0} variable (f) in /-- For fixed `f : X → Y` and `C : ℝ≥0`, the set of all parameters `r : ℝ≥0` such that `f` is `(C, r)`-Hölder is convex. -/ -lemma _root_.convex_setOf_holderWith (C : ℝ≥0) : +lemma _root_.convex_setOfPred_holderWith (C : ℝ≥0) : Convex ℝ≥0 {r | HolderWith C r f} := by simp_rw [← holderOnWith_univ] - exact convex_setOf_holderOnWith f C _ + exact convex_setOfPred_holderOnWith f C _ + +@[deprecated (since := "2026-07-09")] +alias _root_.convex_setOf_holderWith := _root_.convex_setOfPred_holderWith lemma of_le_of_le {C₁ C₂ s t : ℝ≥0} (hf₁ : HolderWith C₁ r f) (hf₂ : HolderWith C₂ s f) (hrt : r ≤ t) diff --git a/Mathlib/Topology/MetricSpace/Isometry.lean b/Mathlib/Topology/MetricSpace/Isometry.lean index c89bf11c768a84..e6bfdbcee01cf1 100644 --- a/Mathlib/Topology/MetricSpace/Isometry.lean +++ b/Mathlib/Topology/MetricSpace/Isometry.lean @@ -234,21 +234,23 @@ theorem diam_range (hf : Isometry f) : Metric.diam (range f) = Metric.diam (univ rw [← image_univ] exact hf.diam_image univ -theorem preimage_setOf_dist (hf : Isometry f) (x : α) (p : ℝ → Prop) : +theorem preimage_setOfPred_dist (hf : Isometry f) (x : α) (p : ℝ → Prop) : f ⁻¹' { y | p (dist y (f x)) } = { y | p (dist y x) } := by simp [hf.dist_eq] +@[deprecated (since := "2026-07-09")] alias preimage_setOf_dist := preimage_setOfPred_dist + theorem preimage_closedBall (hf : Isometry f) (x : α) (r : ℝ) : f ⁻¹' Metric.closedBall (f x) r = Metric.closedBall x r := - hf.preimage_setOf_dist x (· ≤ r) + hf.preimage_setOfPred_dist x (· ≤ r) theorem preimage_ball (hf : Isometry f) (x : α) (r : ℝ) : f ⁻¹' Metric.ball (f x) r = Metric.ball x r := - hf.preimage_setOf_dist x (· < r) + hf.preimage_setOfPred_dist x (· < r) theorem preimage_sphere (hf : Isometry f) (x : α) (r : ℝ) : f ⁻¹' Metric.sphere (f x) r = Metric.sphere x r := - hf.preimage_setOf_dist x (· = r) + hf.preimage_setOfPred_dist x (· = r) theorem mapsTo_ball (hf : Isometry f) (x : α) (r : ℝ) : MapsTo f (Metric.ball x r) (Metric.ball (f x) r) := diff --git a/Mathlib/Topology/MetricSpace/PartitionOfUnity.lean b/Mathlib/Topology/MetricSpace/PartitionOfUnity.lean index 4128bba223e4e3..a84ec966909b97 100644 --- a/Mathlib/Topology/MetricSpace/PartitionOfUnity.lean +++ b/Mathlib/Topology/MetricSpace/PartitionOfUnity.lean @@ -81,7 +81,7 @@ theorem exists_forall_closedEBall_subset_aux₂ (y : X) : (Ioi (0 : ℝ) ∩ ENNReal.ofReal ⁻¹' ⋂ (i) (_ : y ∈ K i), { r | closedEBall y r ⊆ U i }) := (convex_Ioi _).inter <| OrdConnected.convex <| OrdConnected.preimage_ennreal_ofReal <| ordConnected_iInter fun i => ordConnected_iInter fun (_ : y ∈ K i) => - ordConnected_setOf_closedEBall_subset y (U i) + ordConnected_setOfPred_closedEBall_subset y (U i) /-- Let `X` be an extended metric space. Let `K : ι → Set X` be a locally finite family of closed sets, let `U : ι → Set X` be a family of open sets such that `K i ⊆ U i` for all `i`. Then there diff --git a/Mathlib/Topology/MetricSpace/PiNat.lean b/Mathlib/Topology/MetricSpace/PiNat.lean index a503e533a8f72a..fd5e317c4bdb70 100644 --- a/Mathlib/Topology/MetricSpace/PiNat.lean +++ b/Mathlib/Topology/MetricSpace/PiNat.lean @@ -412,7 +412,7 @@ protected def metricSpaceOfDiscreteUniformity {E : ℕ → Type*} [∀ n, Unifor eq_of_dist_eq_zero := PiNat.eq_of_dist_eq_zero _ _ toUniformSpace := Pi.uniformSpace _ uniformity_dist := by - simp only [Pi.uniformity, h, SetRel.id, comap_principal, preimage_setOf_eq] + simp only [Pi.uniformity, h, SetRel.id, comap_principal, preimage_ofPred_eq] apply le_antisymm · simp only [le_iInf_iff, le_principal_iff] intro ε εpos @@ -420,9 +420,9 @@ protected def metricSpaceOfDiscreteUniformity {E : ℕ → Type*} [∀ n, Unifor apply @mem_iInf_of_iInter _ _ _ _ _ (Finset.range n).finite_toSet fun i => { p : (∀ n : ℕ, E n) × ∀ n : ℕ, E n | p.fst i = p.snd i } - · simp only [mem_principal, setOf_subset_setOf, imp_self, imp_true_iff] + · simp only [mem_principal, ofPred_subset_ofPred, imp_self, imp_true_iff] · rintro ⟨x, y⟩ hxy - simp only [Finset.mem_coe, Finset.mem_range, iInter_coe_set, mem_iInter, mem_setOf_eq] + simp only [Finset.mem_coe, Finset.mem_range, iInter_coe_set, mem_iInter, mem_ofPred_eq] at hxy apply lt_of_le_of_lt _ hn rw [← mem_cylinder_iff_dist_le, mem_cylinder_iff] @@ -431,7 +431,7 @@ protected def metricSpaceOfDiscreteUniformity {E : ℕ → Type*} [∀ n, Unifor intro n refine mem_iInf_of_mem ((1 / 2) ^ n : ℝ) ?_ refine mem_iInf_of_mem (by positivity) ?_ - simp only [mem_principal, setOf_subset_setOf, Prod.forall] + simp only [mem_principal, ofPred_subset_ofPred, Prod.forall] intro x y hxy exact apply_eq_of_dist_lt hxy le_rfl } @@ -842,7 +842,7 @@ protected def pseudoEMetricSpace : PseudoEMetricSpace (∀ i, F i) where _ = _ := ENNReal.tsum_add .. toUniformSpace := Pi.uniformSpace _ uniformity_edist := by - simp only [Pi.uniformity, comap_iInf, gt_iff_lt, preimage_setOf_eq, comap_principal, + simp only [Pi.uniformity, comap_iInf, gt_iff_lt, preimage_ofPred_eq, comap_principal, PseudoEMetricSpace.uniformity_edist, le_antisymm_iff, le_iInf_iff, le_principal_iff] constructor · intro ε hε @@ -859,7 +859,7 @@ protected def pseudoEMetricSpace : PseudoEMetricSpace (∀ i, F i) where refine mem_iInf_of_mem δ (mem_iInf_of_mem δpos ?_) simp only [mem_principal, Subset.rfl] · rintro ⟨x, y⟩ hxy - simp only [mem_iInter, mem_setOf_eq, SetCoe.forall, Finset.mem_coe] at hxy + simp only [mem_iInter, mem_ofPred_eq, SetCoe.forall, Finset.mem_coe] at hxy calc edist x y = ∑' i : ι, min (2⁻¹ ^ encode i) (edist (x i) (y i)) := rfl _ = ∑ i ∈ K, min (2⁻¹ ^ encode i) (edist (x i) (y i)) + @@ -879,7 +879,7 @@ protected def pseudoEMetricSpace : PseudoEMetricSpace (∀ i, F i) where · intro i ε hε₀ have : (0 : ℝ≥0∞) < 2⁻¹ ^ encode i := ENNReal.pow_pos (by norm_num) _ refine mem_iInf_of_mem (min (2⁻¹ ^ encode i) ε) <| mem_iInf_of_mem (by positivity) ?_ - simp only [and_imp, Prod.forall, setOf_subset_setOf, lt_min_iff, mem_principal] + simp only [and_imp, Prod.forall, ofPred_subset_ofPred, lt_min_iff, mem_principal] intro x y hn exact (edist_le_edist_pi_of_edist_lt hn).trans_lt diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Basic.lean b/Mathlib/Topology/MetricSpace/Pseudo/Basic.lean index 107e604e11d6c1..ca2761567bf355 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Basic.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Basic.lean @@ -70,7 +70,7 @@ nonrec theorem isUniformInducing_iff [PseudoMetricSpace β] {f : α → β} : ∀ δ > 0, ∃ ε > 0, ∀ {a b : α}, dist (f a) (f b) < ε → dist a b < δ := isUniformInducing_iff'.trans <| Iff.rfl.and <| ((uniformity_basis_dist.comap _).le_basis_iff uniformity_basis_dist).trans <| by - simp only [subset_def, Prod.forall, gt_iff_lt, preimage_setOf_eq, Prod.map_apply, mem_setOf] + simp only [subset_def, Prod.forall, gt_iff_lt, preimage_ofPred_eq, Prod.map_apply, mem_ofPred] nonrec theorem isUniformEmbedding_iff [PseudoMetricSpace β] {f : α → β} : IsUniformEmbedding f ↔ Function.Injective f ∧ UniformContinuous f ∧ diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean b/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean index b8af68161d020f..214bc4c0fb4e38 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean @@ -35,7 +35,7 @@ abbrev PseudoMetricSpace.induced {α β} (f : α → β) (m : PseudoMetricSpace uniformity_dist := (uniformity_basis_dist.comap _).eq_biInf toBornology := Bornology.induced f cobounded_sets := Set.ext fun s => mem_comap_iff_compl.trans <| by - simp only [← isBounded_def, isBounded_iff, forall_mem_image, mem_setOf] + simp only [← isBounded_def, isBounded_iff, forall_mem_image, mem_ofPred] /-- Pull back a pseudometric space structure by an inducing map. This is a version of `PseudoMetricSpace.induced` useful in case if the domain already has a `TopologicalSpace` diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean b/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean index 0de76b0b857754..df1b73d72ee1e2 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean @@ -624,7 +624,7 @@ theorem forall_of_forall_mem_ball (p : α → Prop) (x : α) theorem isBounded_iff {s : Set α} : IsBounded s ↔ ∃ C : ℝ, ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → dist x y ≤ C := by - rw [isBounded_def, ← Filter.mem_sets, @PseudoMetricSpace.cobounded_sets α, mem_setOf_eq, + rw [isBounded_def, ← Filter.mem_sets, @PseudoMetricSpace.cobounded_sets α, mem_ofPred_eq, compl_compl] lemma boundedSpace_iff : BoundedSpace α ↔ ∃ C, ∀ a b : α, dist a b ≤ C := by @@ -722,7 +722,7 @@ protected theorem mk_uniformity_basis_le {β : Type*} {p : β → Prop} {f : β rcases exists_between ε₀ with ⟨ε', hε'⟩ rcases hf ε' hε'.1 with ⟨i, hi, H⟩ exact ⟨i, hi, fun x (hx : _ ≤ _) => hε <| lt_of_le_of_lt (le_trans hx H) hε'.2⟩ - · exact fun ⟨i, hi, H⟩ => ⟨f i, hf₀ i hi, fun x (hx : _ < _) => H (mem_setOf.2 hx.le)⟩ + · exact fun ⟨i, hi, H⟩ => ⟨f i, hf₀ i hi, fun x (hx : _ < _) => H (mem_ofPred.2 hx.le)⟩ /-- Constant size closed neighborhoods of the diagonal form a basis of the uniformity filter. -/ @@ -939,7 +939,7 @@ iff the distances between distinct points are uniformly bounded away from zero. protected lemma uniformSpace_eq_bot : ‹PseudoMetricSpace α›.toUniformSpace = ⊥ ↔ ∃ r : ℝ, 0 < r ∧ Pairwise (r ≤ dist · · : α → α → Prop) := by - simp only [uniformity_basis_dist.uniformSpace_eq_bot, mem_setOf_eq, not_lt] + simp only [uniformity_basis_dist.uniformSpace_eq_bot, mem_ofPred_eq, not_lt] end Metric @@ -1105,7 +1105,7 @@ abbrev PseudoMetricSpace.replaceBornology {α} [B : Bornology α] (m : PseudoMet { m with toBornology := B cobounded_sets := Set.ext <| compl_surjective.forall.2 fun s => - (H s).trans <| by rw [isBounded_iff, mem_setOf_eq, compl_compl] } + (H s).trans <| by rw [isBounded_iff, mem_ofPred_eq, compl_compl] } theorem PseudoMetricSpace.replaceBornology_eq {α} [m : PseudoMetricSpace α] [B : Bornology α] (H : ∀ s, @IsBounded _ B s ↔ @IsBounded _ PseudoMetricSpace.toBornology s) : diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Lemmas.lean b/Mathlib/Topology/MetricSpace/Pseudo/Lemmas.lean index b904383d0ca551..bd5e7cc7d38204 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Lemmas.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Lemmas.lean @@ -119,7 +119,7 @@ end Metric theorem lebesgue_number_lemma_of_metric {s : Set α} {ι : Sort*} {c : ι → Set α} (hs : IsCompact s) (hc₁ : ∀ i, IsOpen (c i)) (hc₂ : s ⊆ ⋃ i, c i) : ∃ δ > 0, ∀ x ∈ s, ∃ i, ball x δ ⊆ c i := by - simpa only [ball, UniformSpace.ball, preimage_setOf_eq, dist_comm] + simpa only [ball, UniformSpace.ball, preimage_ofPred_eq, dist_comm] using uniformity_basis_dist.lebesgue_number_lemma hs hc₁ hc₂ theorem lebesgue_number_lemma_of_metric_sUnion {s : Set α} {c : Set (Set α)} (hs : IsCompact s) diff --git a/Mathlib/Topology/MetricSpace/ThickenedIndicator.lean b/Mathlib/Topology/MetricSpace/ThickenedIndicator.lean index 42a398918befbb..de806dfeab2a6e 100644 --- a/Mathlib/Topology/MetricSpace/ThickenedIndicator.lean +++ b/Mathlib/Topology/MetricSpace/ThickenedIndicator.lean @@ -85,7 +85,7 @@ theorem thickenedIndicatorAux_one_of_mem_closure (δ : ℝ) (E : Set α) {x : α theorem thickenedIndicatorAux_zero {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) {x : α} (x_out : x ∉ thickening δ E) : thickenedIndicatorAux δ E x = 0 := by - rw [thickening, mem_setOf_eq, not_lt] at x_out + rw [thickening, mem_ofPred_eq, not_lt] at x_out unfold thickenedIndicatorAux apply le_antisymm _ bot_le have key := tsub_le_tsub @@ -148,7 +148,7 @@ theorem thickenedIndicatorAux_tendsto_indicator_closure {δseq : ℕ → ℝ} rcases δseq_lim with ⟨N, hN⟩ apply tendsto_atTop_of_eventually_const (i₀ := N) intro n n_large - have key : x ∉ thickening ε E := by simpa only [thickening, mem_setOf_eq, not_lt] using ε_lt.le + have key : x ∉ thickening ε E := by simpa only [thickening, mem_ofPred_eq, not_lt] using ε_lt.le refine le_antisymm ?_ bot_le apply (thickenedIndicatorAux_mono (lt_of_abs_lt (hN n n_large)).le E x).trans exact (thickenedIndicatorAux_zero ε_pos E key).le diff --git a/Mathlib/Topology/MetricSpace/Thickening.lean b/Mathlib/Topology/MetricSpace/Thickening.lean index 943fff19de448d..6718f1919ccf03 100644 --- a/Mathlib/Topology/MetricSpace/Thickening.lean +++ b/Mathlib/Topology/MetricSpace/Thickening.lean @@ -63,7 +63,7 @@ lemma eventually_notMem_thickening_of_infEDist_pos {E : Set α} {x : α} (h : x ∀ᶠ δ in 𝓝 (0 : ℝ), x ∉ Metric.thickening δ E := by obtain ⟨ε, ⟨ε_pos, ε_lt⟩⟩ := exists_real_pos_lt_infEDist_of_notMem_closure h filter_upwards [eventually_lt_nhds ε_pos] with δ hδ - simp only [thickening, mem_setOf_eq, not_lt] + simp only [thickening, mem_ofPred_eq, not_lt] exact (ENNReal.ofReal_le_ofReal hδ.le).trans ε_lt.le @[deprecated (since := "2026-01-08")] @@ -85,7 +85,7 @@ theorem isOpen_thickening {δ : ℝ} {E : Set α} : IsOpen (thickening δ E) := /-- The (open) thickening of the empty set is empty. -/ @[simp] theorem thickening_empty (δ : ℝ) : thickening δ (∅ : Set α) = ∅ := by - simp only [thickening, setOf_false, infEDist_empty, not_top_lt] + simp only [thickening, ofPred_false, infEDist_empty, not_top_lt] theorem thickening_of_nonpos (hδ : δ ≤ 0) (s : Set α) : thickening δ s = ∅ := eq_empty_of_forall_notMem fun _ => ((ENNReal.ofReal_of_nonpos hδ).trans_le bot_le).not_gt @@ -128,9 +128,9 @@ theorem frontier_thickening_disjoint (A : Set α) : lemma subset_compl_thickening_compl_thickening_self (δ : ℝ) (E : Set α) : E ⊆ (thickening δ (thickening δ E)ᶜ)ᶜ := by intro x x_in_E - simp only [thickening, mem_compl_iff, mem_setOf_eq, not_lt] + simp only [thickening, mem_compl_iff, mem_ofPred_eq, not_lt] apply le_infEDist.mpr fun y hy ↦ ?_ - simp only [mem_compl_iff, mem_setOf_eq, not_lt] at hy + simp only [mem_compl_iff, mem_ofPred_eq, not_lt] at hy simpa only [edist_comm] using le_trans hy <| Metric.infEDist_le_edist_of_mem x_in_E /-- The δ-thickening of the complement of the δ-thickening of a set is contained in the complement @@ -201,7 +201,7 @@ lemma eventually_notMem_cthickening_of_infEDist_pos {E : Set α} {x : α} (h : x ∀ᶠ δ in 𝓝 (0 : ℝ), x ∉ Metric.cthickening δ E := by obtain ⟨ε, ⟨ε_pos, ε_lt⟩⟩ := exists_real_pos_lt_infEDist_of_notMem_closure h filter_upwards [eventually_lt_nhds ε_pos] with δ hδ - simp only [cthickening, mem_setOf_eq, not_le] + simp only [cthickening, mem_ofPred_eq, not_le] exact ((ofReal_lt_ofReal_iff ε_pos).mpr hδ).trans ε_lt @[deprecated (since := "2026-01-08")] @@ -232,7 +232,7 @@ theorem isClosed_cthickening {δ : ℝ} {E : Set α} : IsClosed (cthickening δ /-- The closed thickening of the empty set is empty. -/ @[simp] theorem cthickening_empty (δ : ℝ) : cthickening δ (∅ : Set α) = ∅ := by - simp only [cthickening, ENNReal.ofReal_ne_top, setOf_false, infEDist_empty, top_le_iff] + simp only [cthickening, ENNReal.ofReal_ne_top, ofPred_false, infEDist_empty, top_le_iff] theorem cthickening_of_nonpos {δ : ℝ} (hδ : δ ≤ 0) (E : Set α) : cthickening δ E = closure E := by ext x @@ -283,7 +283,7 @@ theorem cthickening_subset_thickening' {δ₁ δ₂ : ℝ} (δ₂_pos : 0 < δ `Metric.cthickening δ E` with the same radius. -/ theorem thickening_subset_cthickening (δ : ℝ) (E : Set α) : thickening δ E ⊆ cthickening δ E := by intro x hx - rw [thickening, mem_setOf_eq] at hx + rw [thickening, mem_ofPred_eq] at hx exact hx.le theorem thickening_subset_cthickening_of_le {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) : @@ -339,17 +339,17 @@ theorem cthickening_mem_nhdsSet (E : Set α) {δ : ℝ} (hδ : 0 < δ) : cthicke @[simp] theorem thickening_union (δ : ℝ) (s t : Set α) : thickening δ (s ∪ t) = thickening δ s ∪ thickening δ t := by - simp_rw [thickening, infEDist_union, min_lt_iff, setOf_or] + simp_rw [thickening, infEDist_union, min_lt_iff, ofPred_or] @[simp] theorem cthickening_union (δ : ℝ) (s t : Set α) : cthickening δ (s ∪ t) = cthickening δ s ∪ cthickening δ t := by - simp_rw [cthickening, infEDist_union, min_le_iff, setOf_or] + simp_rw [cthickening, infEDist_union, min_le_iff, ofPred_or] @[simp] theorem thickening_iUnion (δ : ℝ) (f : ι → Set α) : thickening δ (⋃ i, f i) = ⋃ i, thickening δ (f i) := by - simp_rw [thickening, infEDist_iUnion, iInf_lt_iff, setOf_exists] + simp_rw [thickening, infEDist_iUnion, iInf_lt_iff, ofPred_exists] lemma thickening_biUnion {ι : Type*} (δ : ℝ) (f : ι → Set α) (I : Set ι) : thickening δ (⋃ i ∈ I, f i) = ⋃ i ∈ I, thickening δ (f i) := by simp only [thickening_iUnion] @@ -475,7 +475,7 @@ theorem cthickening_eq_iInter_cthickening' {δ : ℝ} (s : Set ℝ) (hsδ : s · exact subset_iInter₂ fun _ hε => cthickening_mono (le_of_lt (hsδ hε)) E · unfold cthickening intro x hx - simp only [mem_iInter, mem_setOf_eq] at * + simp only [mem_iInter, mem_ofPred_eq] at * apply ENNReal.le_of_forall_pos_le_add intro η η_pos _ rcases hs (δ + η) (lt_add_of_pos_right _ (NNReal.coe_pos.mpr η_pos)) with ⟨ε, ⟨hsε, hε⟩⟩ diff --git a/Mathlib/Topology/MetricSpace/UniformConvergence.lean b/Mathlib/Topology/MetricSpace/UniformConvergence.lean index c63df0f2087219..6154a61cd1f937 100644 --- a/Mathlib/Topology/MetricSpace/UniformConvergence.lean +++ b/Mathlib/Topology/MetricSpace/UniformConvergence.lean @@ -239,7 +239,7 @@ noncomputable instance : PseudoEMetricSpace (α →ᵤ[𝔖] β) where let _ := Fintype.ofFinite 𝔖; simp_rw [← isUniformInducing_pi_restrict.comap_uniformity, PseudoEMetricSpace.uniformity_edist, comap_iInf, comap_principal, edist_eq_pi_restrict, - Set.preimage_setOf_eq] + Set.preimage_ofPred_eq] lemma edist_le {f g : α →ᵤ[𝔖] β} {C : ℝ≥0∞} : edist f g ≤ C ↔ ∀ x ∈ ⋃₀ 𝔖, edist (toFun 𝔖 f x) (toFun 𝔖 g x) ≤ C := by diff --git a/Mathlib/Topology/Metrizable/Uniformity.lean b/Mathlib/Topology/Metrizable/Uniformity.lean index 65a49d6ea9e06f..9c3cfa9fe82baf 100644 --- a/Mathlib/Topology/Metrizable/Uniformity.lean +++ b/Mathlib/Topology/Metrizable/Uniformity.lean @@ -136,7 +136,7 @@ theorem le_two_mul_dist_ofPreNNDist (d : X → X → ℝ≥0) (dist_self : ∀ x intro m hm rw [← not_lt, Nat.lt_iff_add_one_le, ← hL_len] intro hLm - rw [mem_setOf_eq, take_of_length_le hLm, two_mul, add_le_iff_nonpos_left, nonpos_iff_eq_zero, + rw [mem_ofPred_eq, take_of_length_le hLm, two_mul, add_le_iff_nonpos_left, nonpos_iff_eq_zero, sum_eq_zero_iff, ← forall_iff_forall_mem, forall_zipWith, ← isChain_cons_append_singleton_iff_forall₂] at hm <;> @@ -236,7 +236,7 @@ protected theorem UniformSpace.metrizable_uniformity (X : Type*) [UniformSpace X · refine fun n hn => ⟨n, hn, fun x hx => (hdist_le _ _).trans_lt ?_⟩ rwa [← NNReal.coe_pow, NNReal.coe_lt_coe, ← not_le, hle_d, Classical.not_not] · refine fun n _ => ⟨n + 1, trivial, fun x hx => ?_⟩ - rw [mem_setOf_eq] at hx + rw [mem_ofPred_eq] at hx contrapose! hx refine le_trans ?_ ((div_le_iff₀' zero_lt_two).2 (hd_le x.1 x.2)) rwa [← NNReal.coe_two, ← NNReal.coe_div, ← NNReal.coe_pow, NNReal.coe_le_coe, pow_succ, diff --git a/Mathlib/Topology/Neighborhoods.lean b/Mathlib/Topology/Neighborhoods.lean index 7423d380ff397c..8b53dae861eeb0 100644 --- a/Mathlib/Topology/Neighborhoods.lean +++ b/Mathlib/Topology/Neighborhoods.lean @@ -27,7 +27,7 @@ universe u v variable {X : Type u} [TopologicalSpace X] {ι : Sort v} {α : Type*} {x : X} {s t : Set X} theorem nhds_def' (x : X) : 𝓝 x = ⨅ (s : Set X) (_ : IsOpen s) (_ : x ∈ s), 𝓟 s := by - simp only [nhds_def, mem_setOf_eq, @and_comm (x ∈ _), iInf_and] + simp only [nhds_def, mem_ofPred_eq, @and_comm (x ∈ _), iInf_and] /-- The open sets containing `x` are a basis for the neighborhood filter. See `nhds_basis_opens'` for a variant using open neighborhoods instead. -/ @@ -67,7 +67,7 @@ theorem mem_nhds_iff : s ∈ 𝓝 x ↔ ∃ t ⊆ s, IsOpen t ∧ x ∈ t := containing `x`. -/ theorem eventually_nhds_iff {p : X → Prop} : (∀ᶠ y in 𝓝 x, p y) ↔ ∃ t : Set X, (∀ y ∈ t, p y) ∧ IsOpen t ∧ x ∈ t := - mem_nhds_iff.trans <| by simp only [subset_def, mem_setOf_eq] + mem_nhds_iff.trans <| by simp only [subset_def, mem_ofPred_eq] theorem frequently_nhds_iff {p : X → Prop} : (∃ᶠ y in 𝓝 x, p y) ↔ ∀ U : Set X, x ∈ U → IsOpen U → ∃ y ∈ U, p y := @@ -222,7 +222,7 @@ theorem Filter.EventuallyEq.tendsto {l : Filter α} {f : α → X} (hf : f =ᶠ[ /-! ### Interior, closure and frontier in terms of neighborhoods -/ theorem interior_eq_nhds' : interior s = { x | s ∈ 𝓝 x } := - Set.ext fun x => by simp only [mem_interior, mem_nhds_iff, mem_setOf_eq] + Set.ext fun x => by simp only [mem_interior, mem_nhds_iff, mem_ofPred_eq] theorem interior_eq_nhds : interior s = { x | 𝓝 x ≤ 𝓟 s } := interior_eq_nhds'.trans <| by simp only [le_principal_iff] @@ -232,11 +232,17 @@ theorem interior_mem_nhds : interior s ∈ 𝓝 x ↔ s ∈ 𝓝 x := ⟨fun h => mem_of_superset h interior_subset, fun h => IsOpen.mem_nhds isOpen_interior (mem_interior_iff_mem_nhds.2 h)⟩ -theorem interior_setOf_eq {p : X → Prop} : interior { x | p x } = { x | ∀ᶠ y in 𝓝 x, p y } := +theorem interior_setOfPred_eq {p : X → Prop} : interior { x | p x } = { x | ∀ᶠ y in 𝓝 x, p y } := interior_eq_nhds' -theorem isOpen_setOf_eventually_nhds {p : X → Prop} : IsOpen { x | ∀ᶠ y in 𝓝 x, p y } := by - simp only [← interior_setOf_eq, isOpen_interior] +@[deprecated (since := "2026-07-09")] +alias interior_setOf_eq := interior_setOfPred_eq + +theorem isOpen_setOfPred_eventually_nhds {p : X → Prop} : IsOpen { x | ∀ᶠ y in 𝓝 x, p y } := by + simp only [← interior_setOfPred_eq, isOpen_interior] + +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_eventually_nhds := isOpen_setOfPred_eventually_nhds theorem subset_interior_iff_nhds {V : Set X} : s ⊆ interior V ↔ ∀ x ∈ s, V ∈ 𝓝 x := by simp_rw [subset_def, mem_interior_iff_mem_nhds] @@ -244,7 +250,7 @@ theorem subset_interior_iff_nhds {V : Set X} : s ⊆ interior V ↔ ∀ x ∈ s, theorem isOpen_iff_nhds : IsOpen s ↔ ∀ x ∈ s, 𝓝 x ≤ 𝓟 s := calc IsOpen s ↔ s ⊆ interior s := subset_interior_iff_isOpen.symm - _ ↔ ∀ x ∈ s, 𝓝 x ≤ 𝓟 s := by simp_rw [interior_eq_nhds, subset_def, mem_setOf] + _ ↔ ∀ x ∈ s, 𝓝 x ≤ 𝓟 s := by simp_rw [interior_eq_nhds, subset_def, mem_ofPred] theorem TopologicalSpace.ext_iff_nhds {X} {t t' : TopologicalSpace X} : t = t' ↔ ∀ x, @nhds _ t x = @nhds _ t' x := @@ -326,7 +332,8 @@ theorem Dense.inter_of_isOpen_right (hs : Dense s) (ht : Dense t) (hto : IsOpen theorem Dense.inter_nhds_nonempty (hs : Dense s) (ht : t ∈ 𝓝 x) : (s ∩ t).Nonempty := let ⟨U, hsub, ho, hx⟩ := mem_nhds_iff.1 ht - (hs.inter_open_nonempty U ho ⟨x, hx⟩).mono fun _y hy => ⟨hy.2, hsub hy.1⟩ + let ⟨y, hyU, hys⟩ := hs.inter_open_nonempty U ho ⟨x, hx⟩ + ⟨y, hys, hsub hyU⟩ theorem closure_sdiff : closure s \ closure t ⊆ closure (s \ t) := calc diff --git a/Mathlib/Topology/NhdsKer.lean b/Mathlib/Topology/NhdsKer.lean index e8d5f418a6b623..33365f61695880 100644 --- a/Mathlib/Topology/NhdsKer.lean +++ b/Mathlib/Topology/NhdsKer.lean @@ -29,10 +29,10 @@ lemma nhdsKer_singleton_eq_ker_nhds (x : X) : nhdsKer {x} = (𝓝 x).ker := by s @[simp] theorem mem_nhdsKer_singleton : x ∈ nhdsKer {y} ↔ x ⤳ y := by - rw [nhdsKer_singleton_eq_ker_nhds, ker_nhds_eq_specializes, mem_setOf] + rw [nhdsKer_singleton_eq_ker_nhds, ker_nhds_eq_specializes, mem_ofPred] -lemma nhdsKer_def (s : Set X) : nhdsKer s = ⋂₀ {t : Set X | IsOpen t ∧ s ⊆ t} := - (hasBasis_nhdsSet _).ker.trans sInter_eq_biInter.symm +lemma nhdsKer_def (s : Set X) : nhdsKer s = ⋂₀ {t : Set X | IsOpen t ∧ s ⊆ t} := by + simp [nhdsKer, (hasBasis_nhdsSet _).ker, sInter_eq_biInter] lemma mem_nhdsKer : x ∈ nhdsKer s ↔ ∀ U, IsOpen U → s ⊆ U → x ∈ U := by simp [nhdsKer_def] diff --git a/Mathlib/Topology/NhdsWithin.lean b/Mathlib/Topology/NhdsWithin.lean index eb0c67cc29d980..3330cc6188911b 100644 --- a/Mathlib/Topology/NhdsWithin.lean +++ b/Mathlib/Topology/NhdsWithin.lean @@ -116,8 +116,9 @@ theorem mem_nhdsWithin_iff_eventually {s t : Set α} {x : α} : eventually_inf_principal theorem mem_nhdsWithin_iff_eventuallyEq {s t : Set α} {x : α} : - t ∈ 𝓝[s] x ↔ s =ᶠ[𝓝 x] (s ∩ t : Set α) := by - simp_rw [mem_nhdsWithin_iff_eventually, eventuallyEq_set, mem_inter_iff, iff_self_and] + t ∈ 𝓝[s] x ↔ s =ᶠˢ[𝓝 x] s ∩ t := by + simp_rw [mem_nhdsWithin_iff_eventually, Filter.EventuallyEq, eq_iff_iff, mem_inter_iff, + iff_self_and] lemma mem_nhdsWithin_inter_self {s t : Set α} {x : α} : t ∈ 𝓝[s ∩ t] x := mem_nhdsWithin_iff_eventuallyEq.mpr <| by simp [inter_assoc] @@ -125,7 +126,7 @@ lemma mem_nhdsWithin_inter_self {s t : Set α} {x : α} : t ∈ 𝓝[s ∩ t] x lemma mem_nhdsWithin_self_inter {s t : Set α} {x : α} : s ∈ 𝓝[s ∩ t] x := mem_nhdsWithin_iff_eventuallyEq.mpr <| by simp [inter_comm s t, inter_assoc] -theorem nhdsWithin_eq_iff_eventuallyEq {s t : Set α} {x : α} : 𝓝[s] x = 𝓝[t] x ↔ s =ᶠ[𝓝 x] t := +theorem nhdsWithin_eq_iff_eventuallyEq {s t : Set α} {x : α} : 𝓝[s] x = 𝓝[t] x ↔ s =ᶠˢ[𝓝 x] t := set_eventuallyEq_iff_inf_principal.symm theorem nhdsWithin_le_iff {s t : Set α} {x : α} : 𝓝[s] x ≤ 𝓝[t] x ↔ t ∈ 𝓝[s] x := @@ -150,6 +151,9 @@ theorem eventually_mem_nhdsWithin {a : α} {s : Set α} : ∀ᶠ x in 𝓝[s] a, theorem inter_mem_nhdsWithin (s : Set α) {t : Set α} {a : α} (h : t ∈ 𝓝 a) : s ∩ t ∈ 𝓝[s] a := inter_mem self_mem_nhdsWithin (mem_inf_of_left h) +lemma sdiff_mem_nhdsWithin (s : Set α) {t : Set α} {a : α} (h : tᶜ ∈ 𝓝 a) : s \ t ∈ 𝓝[s] a := + inter_mem_nhdsWithin _ h + theorem pure_le_nhdsWithin {a : α} {s : Set α} (ha : a ∈ s) : pure a ≤ 𝓝[s] a := le_inf (pure_le_nhds a) (le_principal_iff.2 ha) @@ -306,12 +310,12 @@ theorem nhdsWithin_prod [TopologicalSpace β] rw [nhdsWithin_prod_eq] exact prod_mem_prod hu hv -lemma Filter.EventuallyEq.mem_interior {x : α} {s t : Set α} (hst : s =ᶠ[𝓝 x] t) +lemma Filter.EventuallyEq.mem_interior {x : α} {s t : Set α} (hst : s =ᶠˢ[𝓝 x] t) (h : x ∈ interior s) : x ∈ interior t := by rw [← nhdsWithin_eq_iff_eventuallyEq] at hst simpa [mem_interior_iff_mem_nhds, ← nhdsWithin_eq_nhds, hst] using h -lemma Filter.EventuallyEq.mem_interior_iff {x : α} {s t : Set α} (hst : s =ᶠ[𝓝 x] t) : +lemma Filter.EventuallyEq.mem_interior_iff {x : α} {s t : Set α} (hst : s =ᶠˢ[𝓝 x] t) : x ∈ interior s ↔ x ∈ interior t := ⟨fun h ↦ hst.mem_interior h, fun h ↦ hst.symm.mem_interior h⟩ @@ -389,7 +393,7 @@ theorem tendsto_nhdsWithin_of_tendsto_nhds {f : α → β} {a : α} {s : Set α} theorem eventually_mem_of_tendsto_nhdsWithin {f : β → α} {a : α} {s : Set α} {l : Filter β} (h : Tendsto f l (𝓝[s] a)) : ∀ᶠ i in l, f i ∈ s := by - simp_rw [nhdsWithin_eq, tendsto_iInf, mem_setOf_eq, tendsto_principal, mem_inter_iff, + simp_rw [nhdsWithin_eq, tendsto_iInf, mem_ofPred_eq, tendsto_principal, mem_inter_iff, eventually_and] at h exact (h univ ⟨mem_univ a, isOpen_univ⟩).2 diff --git a/Mathlib/Topology/NoetherianSpace.lean b/Mathlib/Topology/NoetherianSpace.lean index 4444c3b1ee54c0..c05e3dc900efac 100644 --- a/Mathlib/Topology/NoetherianSpace.lean +++ b/Mathlib/Topology/NoetherianSpace.lean @@ -169,7 +169,7 @@ theorem NoetherianSpace.exists_finite_set_closeds_irreducible [NoetherianSpace lift z₂ to Closeds α using hz₂ rcases H (s ⊓ z₁) (inf_lt_left.2 hz₁') with ⟨S₁, hSf₁, hS₁, h₁⟩ rcases H (s ⊓ z₂) (inf_lt_left.2 hz₂') with ⟨S₂, hSf₂, hS₂, h₂⟩ - refine ⟨S₁ ∪ S₂, hSf₁.union hSf₂, Set.union_subset_iff.2 ⟨hS₁, hS₂⟩, ?_⟩ + refine ⟨S₁ ∪ S₂, hSf₁.union hSf₂, by grind, ?_⟩ rwa [sSup_union, ← h₁, ← h₂, ← inf_sup_left, left_eq_inf] /-- In a Noetherian space, every closed set is a finite union of irreducible closed sets. -/ diff --git a/Mathlib/Topology/OmegaCompletePartialOrder.lean b/Mathlib/Topology/OmegaCompletePartialOrder.lean index 009eb1cfc0a39f..a4a2c644fd0092 100644 --- a/Mathlib/Topology/OmegaCompletePartialOrder.lean +++ b/Mathlib/Topology/OmegaCompletePartialOrder.lean @@ -58,7 +58,9 @@ theorem IsOpen.inter (s t : Set α) : IsOpen α s → IsOpen α t → IsOpen α theorem isOpen_sUnion (s : Set (Set α)) (hs : ∀ t ∈ s, IsOpen α t) : IsOpen α (⋃₀ s) := by simp only [IsOpen] at hs ⊢ - convert! CompleteLattice.ωScottContinuous.sSup hs + have := CompleteLattice.ωScottContinuous.sSup (s := (fun t x => x ∈ t) '' s) + (fun f hf => by obtain ⟨t, ht, rfl⟩ := hf; exact hs t ht) + convert! this aesop theorem IsOpen.isUpperSet {s : Set α} (hs : IsOpen α s) : IsUpperSet s := hs.monotone diff --git a/Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean b/Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean index c4da199a4c8c67..f73f8832102607 100644 --- a/Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean +++ b/Mathlib/Topology/OpenPartialHomeomorph/Continuity.lean @@ -123,7 +123,7 @@ theorem eventually_nhdsWithin' {x : X} (p : X → Prop) {s : Set X} theorem preimage_eventuallyEq_target_inter_preimage_inter {e : OpenPartialHomeomorph X Y} {s : Set X} {t : Set Z} {x : X} {f : X → Z} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : - e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set Y) := by + e.symm ⁻¹' s =ᶠˢ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set Y) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] diff --git a/Mathlib/Topology/Order.lean b/Mathlib/Topology/Order.lean index 56f78491229fab..eb67e87bb0aa1c 100644 --- a/Mathlib/Topology/Order.lean +++ b/Mathlib/Topology/Order.lean @@ -91,7 +91,7 @@ theorem nhds_generateFrom {g : Set (Set α)} {a : α} : lemma tendsto_nhds_generateFrom_iff {β : Type*} {m : α → β} {f : Filter α} {g : Set (Set β)} {b : β} : Tendsto m f (@nhds β (generateFrom g) b) ↔ ∀ s ∈ g, b ∈ s → m ⁻¹' s ∈ f := by - simp only [nhds_generateFrom, @forall_comm (b ∈ _), tendsto_iInf, mem_setOf_eq, and_imp, + simp only [nhds_generateFrom, @forall_comm (b ∈ _), tendsto_iInf, mem_ofPred_eq, and_imp, tendsto_principal]; rfl /-- Construct a topology on α given the filter of neighborhoods of each point of α. -/ @@ -197,10 +197,13 @@ theorem generateFrom_anti {α} {g₁ g₂ : Set (Set α)} (h : g₁ ⊆ g₂) : generateFrom g₂ ≤ generateFrom g₁ := (gc_generateFrom _).monotone_u h -theorem generateFrom_setOf_isOpen (t : TopologicalSpace α) : +theorem generateFrom_setOfPred_isOpen (t : TopologicalSpace α) : generateFrom { s | IsOpen[t] s } = t := (gciGenerateFrom α).u_l_eq t +@[deprecated (since := "2026-07-09")] +alias generateFrom_setOf_isOpen := generateFrom_setOfPred_isOpen + theorem leftInverse_generateFrom : LeftInverse generateFrom fun t : TopologicalSpace α => { s | IsOpen[t] s } := (gciGenerateFrom α).leftInverse_u_l @@ -208,9 +211,11 @@ theorem leftInverse_generateFrom : theorem generateFrom_surjective : Surjective (generateFrom : Set (Set α) → TopologicalSpace α) := (gciGenerateFrom α).u_surjective -theorem setOf_isOpen_injective : Injective fun t : TopologicalSpace α => { s | IsOpen[t] s } := +theorem setOfPred_isOpen_injective : Injective fun t : TopologicalSpace α => { s | IsOpen[t] s } := (gciGenerateFrom α).l_injective +@[deprecated (since := "2026-07-09")] alias setOf_isOpen_injective := setOfPred_isOpen_injective + end Lattice end TopologicalSpace @@ -779,7 +784,7 @@ theorem continuous_iff_le_induced {t₁ : TopologicalSpace α} {t₂ : Topologic lemma continuous_generateFrom_iff {t : TopologicalSpace α} {b : Set (Set β)} : Continuous[t, generateFrom b] f ↔ ∀ s ∈ b, IsOpen (f ⁻¹' s) := by rw [continuous_iff_coinduced_le, le_generateFrom_iff_subset_isOpen] - simp only [isOpen_coinduced, subset_def, mem_setOf_eq] + simp only [isOpen_coinduced, subset_def, mem_ofPred_eq] @[continuity, fun_prop] theorem continuous_induced_dom {t : TopologicalSpace β} : Continuous[induced f t, t] f := @@ -991,26 +996,32 @@ theorem generateFrom_union (a₁ a₂ : Set (Set α)) : generateFrom (a₁ ∪ a₂) = generateFrom a₁ ⊓ generateFrom a₂ := (gc_generateFrom α).u_inf -theorem setOf_isOpen_sup (t₁ t₂ : TopologicalSpace α) : +theorem setOfPred_isOpen_sup (t₁ t₂ : TopologicalSpace α) : { s | IsOpen[t₁ ⊔ t₂] s } = { s | IsOpen[t₁] s } ∩ { s | IsOpen[t₂] s } := rfl +@[deprecated (since := "2026-07-09")] alias setOf_isOpen_sup := setOfPred_isOpen_sup + theorem generateFrom_iUnion {f : ι → Set (Set α)} : generateFrom (⋃ i, f i) = ⨅ i, generateFrom (f i) := (gc_generateFrom α).u_iInf -theorem setOf_isOpen_iSup {t : ι → TopologicalSpace α} : +theorem setOfPred_isOpen_iSup {t : ι → TopologicalSpace α} : { s | IsOpen[⨆ i, t i] s } = ⋂ i, { s | IsOpen[t i] s } := (gc_generateFrom α).l_iSup +@[deprecated (since := "2026-07-09")] alias setOf_isOpen_iSup := setOfPred_isOpen_iSup + theorem generateFrom_sUnion {S : Set (Set (Set α))} : generateFrom (⋃₀ S) = ⨅ s ∈ S, generateFrom s := (gc_generateFrom α).u_sInf -theorem setOf_isOpen_sSup {T : Set (TopologicalSpace α)} : +theorem setOfPred_isOpen_sSup {T : Set (TopologicalSpace α)} : { s | IsOpen[sSup T] s } = ⋂ t ∈ T, { s | IsOpen[t] s } := (gc_generateFrom α).l_sSup +@[deprecated (since := "2026-07-09")] alias setOf_isOpen_sSup := setOfPred_isOpen_sSup + theorem generateFrom_union_isOpen (a b : TopologicalSpace α) : generateFrom ({ s | IsOpen[a] s } ∪ { s | IsOpen[b] s }) = a ⊓ b := (gciGenerateFrom α).u_inf_l _ _ @@ -1036,7 +1047,7 @@ variable {t : ι → TopologicalSpace α} theorem isOpen_iSup_iff {s : Set α} : IsOpen[⨆ i, t i] s ↔ ∀ i, IsOpen[t i] s := show s ∈ {s | IsOpen[iSup t] s} ↔ s ∈ { x : Set α | ∀ i : ι, IsOpen[t i] x } by - simp [setOf_isOpen_iSup] + simp [setOfPred_isOpen_iSup] theorem isOpen_sSup_iff {s : Set α} {T : Set (TopologicalSpace α)} : IsOpen[sSup T] s ↔ ∀ t ∈ T, IsOpen[t] s := by diff --git a/Mathlib/Topology/Order/Basic.lean b/Mathlib/Topology/Order/Basic.lean index 477b11d1e552ac..2e9647958229d0 100644 --- a/Mathlib/Topology/Order/Basic.lean +++ b/Mathlib/Topology/Order/Basic.lean @@ -129,7 +129,7 @@ theorem le_mem_nhds [OrderTopology α] {a b : α} (h : a < b) : ∀ᶠ x in 𝓝 theorem nhds_eq_order [OrderTopology α] (a : α) : 𝓝 a = (⨅ b ∈ Iio a, 𝓟 (Ioi b)) ⊓ ⨅ b ∈ Ioi a, 𝓟 (Iio b) := by rw [OrderTopology.topology_eq_generate_intervals (α := α), nhds_generateFrom] - simp_rw [mem_setOf_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, + simp_rw [mem_ofPred_eq, @and_comm (a ∈ _), exists_or, or_and_right, iInf_or, iInf_and, iInf_exists, iInf_inf_eq, iInf_comm (ι := Set α), iInf_iInf_eq_left, mem_Ioi, mem_Iio] @[to_dual none] @@ -169,7 +169,7 @@ lemma exists_countable_generateFrom_Ioi_Iio refine ⟨a '' t, t_count.image _, ?_⟩ apply le_antisymm · apply le_generateFrom_iff_subset_isOpen.2 - simp only [mem_image, exists_exists_and_eq_and, setOf_subset_setOf, forall_exists_index, + simp only [mem_image, exists_exists_and_eq_and, ofPred_subset_ofPred, forall_exists_index, and_imp] grind [isOpen_Iio', isOpen_Ioi'] · rw [ht] @@ -192,7 +192,7 @@ lemma isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom (c : Set α) · apply hg_fin.isOpen_biInter (fun i hi ↦ ?_) rw [h] exact isOpen_generateFrom_of_mem ⟨i, hgc hi, Or.inr rfl⟩ - simp only [exists_and_left, image_subset_iff, preimage_setOf_eq, setOf_subset_setOf, and_imp] + simp only [exists_and_left, image_subset_iff, preimage_ofPred_eq, ofPred_subset_ofPred, and_imp] intro k k_fin hk let kl := {s ∈ k | ∃ a ∈ c, s = Ioi a} let kr := {s ∈ k | ∃ a ∈ c, s = Iio a} @@ -358,7 +358,7 @@ theorem nhdsGE_eq_iInf_principal [TopologicalSpace α] [Preorder α] [OrderTopol @[to_dual nhdsLE_basis_of_exists_lt] theorem nhdsGE_basis_of_exists_gt [TopologicalSpace α] [LinearOrder α] [OrderTopology α] {a : α} (ha : ∃ u, a < u) : (𝓝[≥] a).HasBasis (fun u => a < u) fun u => Ico a u := - nhdsGE_eq_iInf_principal ha ▸ hasBasis_biInf_principal + nhdsGE_eq_iInf_principal ha ▸ hasBasis_biInf_principal (S := {u | a < u}) (fun b hb c hc => ⟨min b c, lt_min hb hc, Ico_subset_Ico_right (min_le_left _ _), Ico_subset_Ico_right (min_le_right _ _)⟩) ha @@ -562,10 +562,10 @@ theorem SecondCountableTopology.of_separableSpace_orderTopology [DenselyOrdered /-- The set of points which are isolated on the right is countable when the space is second-countable. -/ -@[to_dual countable_setOf_covBy_left +@[to_dual countable_setOfPred_covBy_left /-- The set of points which are isolated on the left is countable when the space is second-countable. -/] -theorem countable_setOf_covBy_right [SecondCountableTopology α] : +theorem countable_setOfPred_covBy_right [SecondCountableTopology α] : Set.Countable { x : α | ∃ y, x ⋖ y } := by nontriviality α let s := { x : α | ∃ y, x ⋖ y } @@ -605,11 +605,17 @@ theorem countable_setOf_covBy_right [SecondCountableTopology α] : simp_rw [subset_def, mem_Ioo, mem_Ioc] exact fun u hu ↦ ⟨hu.1, Hy _ _ hx.1 hu.2⟩ +@[deprecated (since := "2026-07-09")] alias countable_setOf_covBy_right := + countable_setOfPred_covBy_right + +@[deprecated (since := "2026-07-09")] alias countable_setOf_covBy_left := + countable_setOfPred_covBy_left + /-- The set of points which are isolated on the left is countable when the space is second-countable. -/ theorem countable_of_isolated_left' [SecondCountableTopology α] : Set.Countable { x : α | ∃ y, y < x ∧ Ioo y x = ∅ } := by - simpa only [← covBy_iff_Ioo_eq] using countable_setOf_covBy_left + simpa only [← covBy_iff_Ioo_eq] using countable_setOfPred_covBy_left /-- Consider a disjoint family of intervals `(x, y)` with `x < y` in a second-countable space. Then the family is countable. @@ -622,7 +628,7 @@ theorem Set.PairwiseDisjoint.countable_of_Ioo [SecondCountableTopology α] have : (s \ { x | ∃ y, x ⋖ y }).Countable := (h.subset sdiff_subset).countable_of_isOpen (fun _ _ ↦ isOpen_Ioo) fun x hx ↦ (not_covBy_iff_exists_mem_Ioo (h' _ hx.1)).1 <| mt (Exists.intro (y x)) hx.2 - this.of_sdiff countable_setOf_covBy_right + this.of_sdiff countable_setOfPred_covBy_right /-- For a function taking values in a second countable space, the set of points `x` for which the image under `f` of `(x, ∞)` is separated above from `f x` is countable. We give @@ -703,7 +709,7 @@ instance instIsCountablyGenerated_atTop [SeparableSpace α] : · obtain ⟨s, s_count, hs⟩ := exists_countable_dense α have : atTop = generate (Ici '' s) := by refine atTop_eq_generate_of_not_bddAbove fun ⟨x, hx⟩ ↦ ?_ - simp only [eq_empty_iff_forall_notMem, IsTop, mem_setOf_eq, not_forall, not_le] at h + simp only [eq_empty_iff_forall_notMem, IsTop, mem_ofPred_eq, not_forall, not_le] at h obtain ⟨y, hy, hxy⟩ := hs.exists_mem_open isOpen_Ioi (h x) exact (hx hy).not_gt hxy rw [this] diff --git a/Mathlib/Topology/Order/Category/FrameAdjunction.lean b/Mathlib/Topology/Order/Category/FrameAdjunction.lean index 58466076192101..bca85b7a868217 100644 --- a/Mathlib/Topology/Order/Category/FrameAdjunction.lean +++ b/Mathlib/Topology/Order/Category/FrameAdjunction.lean @@ -59,7 +59,7 @@ points of `L`. -/ @[simps] def openOfElementHom : FrameHom L (Set (PT L)) where toFun u := {x | x u} - map_inf' a b := by simp [Set.setOf_and] + map_inf' a b := by simp [Set.ofPred_and] map_top' := by simp map_sSup' S := by ext; simp [Prop.exists_iff] @@ -73,7 +73,7 @@ instance instTopologicalSpace : TopologicalSpace (PT L) where isOpen_sUnion S hS := by choose f hf using hS use ⨆ t, ⨆ ht, f t ht - simp_rw [map_iSup, iSup_Prop_eq, setOf_exists, hf, sUnion_eq_biUnion] + simp_rw [map_iSup, iSup_Prop_eq, ofPred_exists, hf, sUnion_eq_biUnion] /-- Characterization of when a subset of the space of points is open. -/ lemma isOpen_iff (U : Set (PT L)) : IsOpen U ↔ ∃ u : L, {x | x u} = U := Iff.rfl diff --git a/Mathlib/Topology/Order/CountableSeparating.lean b/Mathlib/Topology/Order/CountableSeparating.lean index ac0d56692ea459..0f40972928b231 100644 --- a/Mathlib/Topology/Order/CountableSeparating.lean +++ b/Mathlib/Topology/Order/CountableSeparating.lean @@ -33,7 +33,7 @@ instance range_Iio : HasCountableSeparatingOn X (· ∈ range Iio) s := by rcases TopologicalSpace.exists_countable_dense X with ⟨s, hsc, hsd⟩ set t := s ∪ {x | ∃ y, y ⋖ x} refine ⟨Iio '' t, .image ?_ _, ?_, ?_⟩ - · exact hsc.union countable_setOf_covBy_left + · exact hsc.union countable_setOfPred_covBy_left · exact image_subset_range _ _ · rintro x - y - h by_contra! hne diff --git a/Mathlib/Topology/Order/HullKernel.lean b/Mathlib/Topology/Order/HullKernel.lean index ba4af9ac21b64f..2ece9ff852e789 100644 --- a/Mathlib/Topology/Order/HullKernel.lean +++ b/Mathlib/Topology/Order/HullKernel.lean @@ -112,12 +112,12 @@ Lower topology. lemma isTopologicalBasis_relativeLower (hT : ∀ p ∈ T, InfPrime p) : IsTopologicalBasis { S : Set T | ∃ (a : α), (hull T a)ᶜ = S } := by convert! isTopologicalBasis_subtype Topology.IsLower.isTopologicalBasis (· ∈ T) - ext R - simp only [preimage_compl, mem_setOf_eq, IsLower.lowerBasis, mem_image, exists_exists_and_eq_and] + simp only [preimage_compl, mem_ofPred_eq, mem_iff_mem, IsLower.lowerBasis, mem_image, + exists_exists_and_eq_and] constructor <;> intro ha · obtain ⟨a, ha'⟩ := ha use {a} - rw [← (Function.Injective.preimage_image Subtype.val_injective R), ← ha'] + rw [← ha', ← Function.Injective.preimage_image Subtype.val_injective (hull T a)ᶜ] simp only [finite_singleton, upperClosure_singleton, UpperSet.coe_Ici, image_val_compl, Subtype.image_preimage_coe, sdiff_self_inter, preimage_sdiff, Subtype.coe_preimage_self, true_and] diff --git a/Mathlib/Topology/Order/IntermediateValue.lean b/Mathlib/Topology/Order/IntermediateValue.lean index 843b1fb9c18b9b..8568304aef359d 100644 --- a/Mathlib/Topology/Order/IntermediateValue.lean +++ b/Mathlib/Topology/Order/IntermediateValue.lean @@ -288,7 +288,7 @@ theorem IsPreconnected.mem_intervals {s : Set α} (hs : IsPreconnected s) : `Iic`, `Iio`, or `univ`, or `∅`. The converse statement requires `α` to be densely ordered. Though one can represent `∅` as `(Inf ∅, Inf ∅)`, we include it into the list of possible cases to improve readability. -/ -theorem setOf_isPreconnected_subset_of_ordered : +theorem setOfPred_isPreconnected_subset_of_ordered : { s : Set α | IsPreconnected s } ⊆ -- bounded intervals (range (uncurry Icc) ∪ range (uncurry Ico) ∪ range (uncurry Ioc) ∪ range (uncurry Ioo)) ∪ @@ -299,6 +299,9 @@ theorem setOf_isPreconnected_subset_of_ordered : simp only [union_insert, union_singleton, mem_insert_iff, mem_union, mem_range, Prod.exists, uncurry_apply_pair, exists_apply_eq_apply, true_or, or_true, exists_apply_eq_apply2] +@[deprecated (since := "2026-07-09")] +alias setOf_isPreconnected_subset_of_ordered := setOfPred_isPreconnected_subset_of_ordered + /-! ### Intervals are connected @@ -378,7 +381,7 @@ lemma IsClosed.Icc_subset_of_forall_mem_nhdsGT_of_Icc_subset {a b : α} {s : Set refine ⟨t₁_mem, fun t ht ↦ ?_⟩ rcases ht.2.eq_or_lt with rfl | h · have : closure A ⊆ s ∩ Icc a b := by - apply (closure_subset_iff hs).2 (fun t ht ↦ ⟨?_, ht.1⟩) + apply (closure_subset_iff hs).2 (fun t (ht : t ∈ A) ↦ ⟨?_, ht.1⟩) have : t ∈ Icc a t := ⟨ht.1.1, le_rfl⟩ exact ht.2 this apply this.trans inter_subset_left @@ -511,19 +514,22 @@ instance (priority := 100) ordered_connected_space : PreconnectedSpace α := the set of the intervals `Icc`, `Ico`, `Ioc`, `Ioo`, `Ici`, `Ioi`, `Iic`, `Iio`, `(-∞, +∞)`, or `∅`. Though one can represent `∅` as `(sInf s, sInf s)`, we include it into the list of possible cases to improve readability. -/ -theorem setOf_isPreconnected_eq_of_ordered : +theorem setOfPred_isPreconnected_eq_of_ordered : { s : Set α | IsPreconnected s } = -- bounded intervals range (uncurry Icc) ∪ range (uncurry Ico) ∪ range (uncurry Ioc) ∪ range (uncurry Ioo) ∪ -- unbounded intervals and `univ` (range Ici ∪ range Ioi ∪ range Iic ∪ range Iio ∪ {univ, ∅}) := by - refine Subset.antisymm setOf_isPreconnected_subset_of_ordered ?_ + refine Subset.antisymm setOfPred_isPreconnected_subset_of_ordered ?_ simp only [subset_def, forall_mem_range, uncurry, or_imp, forall_and, mem_union, - mem_setOf_eq, insert_eq, mem_singleton_iff, forall_eq, forall_true_iff, and_true, + mem_ofPred_eq, insert_eq, mem_singleton_iff, forall_eq, forall_true_iff, and_true, isPreconnected_Icc, isPreconnected_Ico, isPreconnected_Ioc, isPreconnected_Ioo, isPreconnected_Ioi, isPreconnected_Iio, isPreconnected_Ici, isPreconnected_Iic, isPreconnected_univ, isPreconnected_empty] +@[deprecated (since := "2026-07-09")] +alias setOf_isPreconnected_eq_of_ordered := setOfPred_isPreconnected_eq_of_ordered + /-- This lemma characterizes when a subset `s` of a densely ordered conditionally complete linear order is totally disconnected with respect to the order topology: between any two distinct points of `s` must lie a point not in `s`. -/ diff --git a/Mathlib/Topology/Order/LawsonTopology.lean b/Mathlib/Topology/Order/LawsonTopology.lean index f55cea77976f08..0825189b7251c1 100644 --- a/Mathlib/Topology/Order/LawsonTopology.lean +++ b/Mathlib/Topology/Order/LawsonTopology.lean @@ -231,9 +231,10 @@ instance (priority := 90) toT1Space : T1Space α where t1 a := by simp +instances only [IsLawson.topology_eq_lawson] rw [← (Set.OrdConnected.upperClosure_inter_lowerClosure ordConnected_singleton), - ← WithLawson.isClosed_preimage_ofLawson] - apply IsClosed.inter - (lawsonClosed_of_lowerClosed _ (IsLower.isClosed_upperClosure (finite_singleton a))) + ← WithLawson.isClosed_preimage_ofLawson, preimage_inter] + have h₁ : IsClosed (WithLower.ofLower ⁻¹' (↑(upperClosure {a}) : Set α)) := + IsLower.isClosed_upperClosure (α := WithLower α) (finite_singleton a) + apply IsClosed.inter (lawsonClosed_of_lowerClosed _ h₁) rw [lowerClosure_singleton, LowerSet.coe_Iic, ← WithLawson.isClosed_preimage_ofLawson] exact lawsonClosed_of_scottClosed _ isClosed_Iic diff --git a/Mathlib/Topology/Order/LeftRightLim.lean b/Mathlib/Topology/Order/LeftRightLim.lean index 349daa40030a6a..88d24dc3be2e2a 100644 --- a/Mathlib/Topology/Order/LeftRightLim.lean +++ b/Mathlib/Topology/Order/LeftRightLim.lean @@ -302,7 +302,7 @@ theorem le_leftLim (h : x < y) : f x ≤ leftLim f y := by rw [leftLim_eq_sSup hf] refine le_csSup ⟨f y, ?_⟩ (mem_image_of_mem _ h) simp only [upperBounds, mem_image, mem_Iio, forall_exists_index, and_imp, - forall_apply_eq_imp_iff₂, mem_setOf_eq] + forall_apply_eq_imp_iff₂, mem_ofPred_eq] intro z hz exact hf hz.le diff --git a/Mathlib/Topology/Order/LeftRightNhds.lean b/Mathlib/Topology/Order/LeftRightNhds.lean index 6d518605ac27d8..29b7caa8de370e 100644 --- a/Mathlib/Topology/Order/LeftRightNhds.lean +++ b/Mathlib/Topology/Order/LeftRightNhds.lean @@ -106,22 +106,28 @@ theorem mem_nhdsGT_iff_exists_Ioo_subset [NoMaxOrder α] {a : α} {s : Set α} : /-- The set of points which are isolated on the right is countable when the space is second-countable. -/ -theorem countable_setOf_isolated_right [SecondCountableTopology α] : +theorem countable_setOfPred_isolated_right [SecondCountableTopology α] : { x : α | 𝓝[>] x = ⊥ }.Countable := by - simp only [nhdsGT_eq_bot_iff, setOf_or] - exact (subsingleton_isTop α).countable.union countable_setOf_covBy_right + simp only [nhdsGT_eq_bot_iff, ofPred_or] + exact (subsingleton_isTop α).countable.union countable_setOfPred_covBy_right + +@[deprecated (since := "2026-07-09")] +alias countable_setOf_isolated_right := countable_setOfPred_isolated_right /-- The set of points which are isolated on the left is countable when the space is second-countable. -/ -theorem countable_setOf_isolated_left [SecondCountableTopology α] : +theorem countable_setOfPred_isolated_left [SecondCountableTopology α] : { x : α | 𝓝[<] x = ⊥ }.Countable := - countable_setOf_isolated_right (α := αᵒᵈ) + countable_setOfPred_isolated_right (α := αᵒᵈ) + +@[deprecated (since := "2026-07-09")] +alias countable_setOf_isolated_left := countable_setOfPred_isolated_left /-- The set of points in a set which are isolated on the right in this set is countable when the space is second-countable. -/ -theorem countable_setOf_isolated_right_within [SecondCountableTopology α] {s : Set α} : +theorem countable_setOfPred_isolated_right_within [SecondCountableTopology α] {s : Set α} : { x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥ }.Countable := by - /- This does not follow from `countable_setOf_isolated_right`, which gives the result when `s` + /- This does not follow from `countable_setOfPred_isolated_right`, which gives the result when `s` is the whole space, as one cannot use it inside the subspace since it doesn't have the order topology. Instead, we follow the main steps of its proof. -/ let t := { x ∈ s | 𝓝[s ∩ Ioi x] x = ⊥ ∧ ¬ IsTop x} @@ -135,7 +141,7 @@ theorem countable_setOf_isolated_right_within [SecondCountableTopology α] {s : simp [H, (subsingleton_isTop α).countable] have (x) (hx : x ∈ t) : ∃ y > x, s ∩ Ioo x y = ∅ := by simp only [← empty_mem_iff_bot, mem_nhdsWithin_iff_exists_mem_nhds_inter, - subset_empty_iff, IsTop, not_forall, not_le, mem_setOf_eq, t] at hx + subset_empty_iff, IsTop, not_forall, not_le, mem_ofPred_eq, t] at hx rcases hx.2.1 with ⟨u, hu, h'u⟩ obtain ⟨y, hxy, hy⟩ : ∃ y, x < y ∧ Ico x y ⊆ u := exists_Ico_subset_of_mem_nhds hu hx.2.2 refine ⟨y, hxy, ?_⟩ @@ -157,11 +163,17 @@ theorem countable_setOf_isolated_right_within [SecondCountableTopology α] {s : rw [disjoint_iff_forall_ne] exact fun u hu v hv ↦ ((hu.2.trans_le this).trans hv.1).ne +@[deprecated (since := "2026-07-09")] +alias countable_setOf_isolated_right_within := countable_setOfPred_isolated_right_within + /-- The set of points in a set which are isolated on the left in this set is countable when the space is second-countable. -/ -theorem countable_setOf_isolated_left_within [SecondCountableTopology α] {s : Set α} : +theorem countable_setOfPred_isolated_left_within [SecondCountableTopology α] {s : Set α} : { x ∈ s | 𝓝[s ∩ Iio x] x = ⊥ }.Countable := - countable_setOf_isolated_right_within (α := αᵒᵈ) + countable_setOfPred_isolated_right_within (α := αᵒᵈ) + +@[deprecated (since := "2026-07-09")] +alias countable_setOf_isolated_left_within := countable_setOfPred_isolated_left_within /-- A set is a neighborhood of `a` within `(a, +∞)` if and only if it contains an interval `(a, u]` with `a < u`. -/ @@ -357,7 +369,7 @@ variable {l : Filter β} {f g : β → α} @[to_additive] theorem nhds_eq_iInf_mabs_div (a : α) : 𝓝 a = ⨅ r > 1, 𝓟 { b | |a / b|ₘ < r } := by - simp only [nhds_eq_order, mabs_lt, setOf_and, ← inf_principal, iInf_inf_eq] + simp only [nhds_eq_order, mabs_lt, ofPred_and, ← inf_principal, iInf_inf_eq] refine (congr_arg₂ _ ?_ ?_).trans (inf_comm ..) · refine (Equiv.divLeft a).iInf_congr fun x => ?_; simp [Ioi] · refine (Equiv.divRight a).iInf_congr fun x => ?_; simp [Iio] @@ -429,8 +441,10 @@ theorem nhds_basis_mabs_div_lt [NoMaxOrder α] (a : α) : @[to_additive] theorem nhds_basis_Ioo_one_lt [NoMaxOrder α] (a : α) : (𝓝 a).HasBasis (fun ε : α => (1 : α) < ε) fun ε => Ioo (a / ε) (a * ε) := by - convert! nhds_basis_mabs_div_lt a - simp only [Ioo, mabs_lt, ← div_lt_iff_lt_mul, inv_lt_div_iff_lt_mul, div_lt_comm] + refine (nhds_basis_mabs_div_lt a).congr (fun _ => Iff.rfl) fun ε _ => ?_ + ext b + simp only [mem_ofPred_eq, mem_Ioo, mabs_lt, ← div_lt_iff_lt_mul, inv_lt_div_iff_lt_mul, + div_lt_comm] @[to_additive] theorem nhds_basis_Icc_one_lt [NoMaxOrder α] [DenselyOrdered α] (a : α) : diff --git a/Mathlib/Topology/Order/LowerUpperTopology.lean b/Mathlib/Topology/Order/LowerUpperTopology.lean index dea040dc9c0ff3..639e295b37acc0 100644 --- a/Mathlib/Topology/Order/LowerUpperTopology.lean +++ b/Mathlib/Topology/Order/LowerUpperTopology.lean @@ -267,7 +267,7 @@ theorem isUpperSet_of_isClosed (h : IsClosed s) : IsUpperSet s := theorem tendsto_nhds_iff_not_le {β : Type*} {f : β → α} {l : Filter β} {x : α} : Filter.Tendsto f l (𝓝 x) ↔ ∀ y, ¬y ≤ x → ∀ᶠ z in l, ¬y ≤ f z := by simp +instances [topology_eq_lowerTopology, tendsto_nhds_generateFrom_iff, Filter.Eventually, Ici, - compl_setOf] + compl_ofPred] /-- The closure of a singleton `{a}` in the lower topology is the left-closed right-infinite interval @@ -275,7 +275,7 @@ $[a, ∞)$. -/ @[simp] theorem closure_singleton (a : α) : closure {a} = Ici a := - Subset.antisymm ((closure_minimal fun _ h => h.ge) <| isClosed_Ici) <| + Subset.antisymm ((closure_minimal fun _ h => (eq_of_mem_singleton h).ge) <| isClosed_Ici) <| (isUpperSet_of_isClosed isClosed_closure).Ici_subset <| subset_closure rfl protected theorem isTopologicalBasis : IsTopologicalBasis (lowerBasis α) := by @@ -363,7 +363,7 @@ lemma isTopologicalSpace_basis (U : Set α) : IsOpen U ↔ U = univ ∨ ∃ a, ( intro s hs obtain ⟨a, ha⟩ := (subset_insert_iff_of_notMem hUS).mp hS1 hs subst hS2 ha - simp_all only [compl_Ici, mem_Ici, sSup_le_iff, mem_setOf_eq, mem_Iio, not_lt] + simp_all only [compl_Ici, mem_Ici, sSup_le_iff, mem_ofPred_eq, mem_Iio, not_lt] · intro b hb rw [mem_Ici, sSup_le_iff] intro c hc @@ -554,7 +554,7 @@ instance : IsUpper Prop where congr exact le_antisymm (fun h hs => by - simp only [compl_Iic, mem_setOf_eq] + simp only [compl_Iic, mem_ofPred_eq] rw [← Ioi_True, ← Ioi_False] at hs rcases hs with (rfl | rfl) · use True diff --git a/Mathlib/Topology/Order/Monotone.lean b/Mathlib/Topology/Order/Monotone.lean index 667414ec596d7e..803e7a26eb70cf 100644 --- a/Mathlib/Topology/Order/Monotone.lean +++ b/Mathlib/Topology/Order/Monotone.lean @@ -51,7 +51,7 @@ lemma MonotoneOn.insert_of_continuousWithinAt [TopologicalSpace β] [OrderClosed /-- If a function is monotone on a set in a second countable topological space, then there are only countably many points that have several preimages. -/ -lemma MonotoneOn.countable_setOf_two_preimages [SecondCountableTopology α] +lemma MonotoneOn.countable_setOfPred_two_preimages [SecondCountableTopology α] (hf : MonotoneOn f s) : Set.Countable {c | ∃ x y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c} := by nontriviality α @@ -84,27 +84,39 @@ lemma MonotoneOn.countable_setOf_two_preimages [SecondCountableTopology α] rw [hfx _ hd, hfy _ hc] at this exact not_le.2 H this +@[deprecated (since := "2026-07-09")] alias MonotoneOn.countable_setOf_two_preimages := + MonotoneOn.countable_setOfPred_two_preimages + /-- If a function is monotone in a second countable topological space, then there are only countably many points that have several preimages. -/ -lemma Monotone.countable_setOf_two_preimages [SecondCountableTopology α] +lemma Monotone.countable_setOfPred_two_preimages [SecondCountableTopology α] (hf : Monotone f) : Set.Countable {c | ∃ x y, x < y ∧ f x = c ∧ f y = c} := by rw [← monotoneOn_univ] at hf - simpa using hf.countable_setOf_two_preimages + simpa using hf.countable_setOfPred_two_preimages + +@[deprecated (since := "2026-07-09")] alias Monotone.countable_setOf_two_preimages := + Monotone.countable_setOfPred_two_preimages /-- If a function is antitone on a set in a second countable topological space, then there are only countably many points that have several preimages. -/ -lemma AntitoneOn.countable_setOf_two_preimages [SecondCountableTopology α] +lemma AntitoneOn.countable_setOfPred_two_preimages [SecondCountableTopology α] (hf : AntitoneOn f s) : Set.Countable {c | ∃ x y, x ∈ s ∧ y ∈ s ∧ x < y ∧ f x = c ∧ f y = c} := - (MonotoneOn.countable_setOf_two_preimages hf.dual_right :) + (MonotoneOn.countable_setOfPred_two_preimages hf.dual_right :) + +@[deprecated (since := "2026-07-09")] alias AntitoneOn.countable_setOf_two_preimages := + AntitoneOn.countable_setOfPred_two_preimages /-- If a function is antitone in a second countable topological space, then there are only countably many points that have several preimages. -/ -lemma Antitone.countable_setOf_two_preimages [SecondCountableTopology α] +lemma Antitone.countable_setOfPred_two_preimages [SecondCountableTopology α] (hf : Antitone f) : Set.Countable {c | ∃ x y, x < y ∧ f x = c ∧ f y = c} := - (Monotone.countable_setOf_two_preimages hf.dual_right :) + (Monotone.countable_setOfPred_two_preimages hf.dual_right :) + +@[deprecated (since := "2026-07-09")] alias Antitone.countable_setOf_two_preimages := + Antitone.countable_setOfPred_two_preimages section Continuity @@ -117,7 +129,7 @@ theorem MonotoneOn.countable_not_continuousWithinAt_Ioi (hf : MonotoneOn f s) : Set.Countable {x ∈ s | ¬ContinuousWithinAt f (s ∩ Ioi x) x} := by apply (countable_image_lt_image_Ioi_within s f).mono rintro x ⟨xs, hx : ¬ContinuousWithinAt f (s ∩ Ioi x) x⟩ - dsimp only [mem_setOf_eq] + dsimp only [mem_ofPred_eq] contrapose! hx refine tendsto_order.2 ⟨fun m hm => ?_, fun u hu => ?_⟩ · filter_upwards [@self_mem_nhdsWithin _ _ x (s ∩ Ioi x)] with y hy @@ -143,7 +155,7 @@ theorem MonotoneOn.countable_not_continuousWithinAt (hf : MonotoneOn f s) : refine compl_subset_compl.1 ?_ simp only [compl_union] rintro x ⟨hx, h'x⟩ - simp only [mem_compl_iff, mem_setOf_eq, not_and, not_not] at hx h'x ⊢ + simp only [mem_compl_iff, mem_ofPred_eq, not_and, not_not] at hx h'x ⊢ intro xs exact continuousWithinAt_iff_continuous_left'_right'.2 ⟨h'x xs, hx xs⟩ diff --git a/Mathlib/Topology/Order/OrderClosed.lean b/Mathlib/Topology/Order/OrderClosed.lean index be6dcbf83ed2f9..f77d6490c2920d 100644 --- a/Mathlib/Topology/Order/OrderClosed.lean +++ b/Mathlib/Topology/Order/OrderClosed.lean @@ -326,11 +326,11 @@ theorem Icc_mem_nhdsLT (H : a < b) : Icc a b ∈ 𝓝[<] b := Icc_mem_nhdsLT_of_ @[to_dual (attr := simp)] theorem nhdsWithin_Ico_eq_nhdsLT (h : a < b) : 𝓝[Ico a b] b = 𝓝[<] b := - nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ici_mem_nhds h + nhdsWithin_inter_of_mem (t := Iio b) <| nhdsWithin_le_nhds <| Ici_mem_nhds h @[to_dual (attr := simp)] theorem nhdsWithin_Ioo_eq_nhdsLT (h : a < b) : 𝓝[Ioo a b] b = 𝓝[<] b := - nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ioi_mem_nhds h + nhdsWithin_inter_of_mem (t := Iio b) <| nhdsWithin_le_nhds <| Ioi_mem_nhds h @[to_dual (attr := simp)] theorem continuousWithinAt_Ico_iff_Iio (h : a < b) : @@ -379,11 +379,11 @@ theorem Icc_mem_nhdsLE (H : a < b) : Icc a b ∈ 𝓝[≤] b := Icc_mem_nhdsLE_o @[to_dual (attr := simp)] theorem nhdsWithin_Icc_eq_nhdsLE (h : a < b) : 𝓝[Icc a b] b = 𝓝[≤] b := - nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ici_mem_nhds h + nhdsWithin_inter_of_mem (t := Iic b) <| nhdsWithin_le_nhds <| Ici_mem_nhds h @[to_dual (attr := simp)] theorem nhdsWithin_Ioc_eq_nhdsLE (h : a < b) : 𝓝[Ioc a b] b = 𝓝[≤] b := - nhdsWithin_inter_of_mem <| nhdsWithin_le_nhds <| Ioi_mem_nhds h + nhdsWithin_inter_of_mem (t := Iic b) <| nhdsWithin_le_nhds <| Ioi_mem_nhds h @[to_dual (attr := simp)] theorem continuousWithinAt_Icc_iff_Iic (h : a < b) : @@ -661,7 +661,7 @@ theorem frontier_Iic_subset (a : α) : frontier (Iic a) ⊆ {a} := @[to_dual (reorder := f g, hf hg) frontier_gt_subset_eq] theorem frontier_lt_subset_eq (hf : Continuous f) (hg : Continuous g) : frontier { b | f b < g b } ⊆ { b | f b = g b } := by - simpa only [← not_lt, ← compl_setOf, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf + simpa only [← not_lt, ← compl_ofPred, frontier_compl, eq_comm] using frontier_le_subset_eq hg hf @[to_dual none] theorem continuous_if_le [TopologicalSpace γ] [∀ x, Decidable (f x ≤ g x)] {f' g' : β → γ} @@ -755,7 +755,7 @@ instance [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [Preorder instance {ι : Type*} {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, TopologicalSpace (α i)] [∀ i, OrderClosedTopology (α i)] : OrderClosedTopology (∀ i, α i) := by constructor - simp only [Pi.le_def, setOf_forall] + simp only [Pi.le_def, ofPred_forall] exact isClosed_iInter fun i => isClosed_le (continuous_apply i).fst' (continuous_apply i).snd' instance Pi.orderClosedTopology' [Preorder β] [TopologicalSpace β] [OrderClosedTopology β] : diff --git a/Mathlib/Topology/Order/Rolle.lean b/Mathlib/Topology/Order/Rolle.lean index 80920414548d6c..a720c41bec0b9d 100644 --- a/Mathlib/Topology/Order/Rolle.lean +++ b/Mathlib/Topology/Order/Rolle.lean @@ -50,7 +50,7 @@ theorem exists_Ioo_extr_on_Icc (hab : a < b) (hfc : ContinuousOn f (Icc a b)) (h -- `f` is a constant, so we can take any point in `Ioo a b` rcases nonempty_Ioo.2 hab with ⟨c', hc'⟩ refine ⟨c', hc', Or.inl fun x hx ↦ ?_⟩ - simp only [mem_setOf_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl] + simp only [mem_ofPred_eq, this x hx, this c' (Ioo_subset_Icc_self hc'), le_rfl] · refine ⟨C, ⟨lt_of_le_of_ne Cmem.1 <| mt ?_ hC, lt_of_le_of_ne Cmem.2 <| mt ?_ hC⟩, Or.inr Cge⟩ exacts [fun h => by rw [h], fun h => by rw [h, hfI]] · refine ⟨c, ⟨lt_of_le_of_ne cmem.1 <| mt ?_ hc, lt_of_le_of_ne cmem.2 <| mt ?_ hc⟩, Or.inl cle⟩ diff --git a/Mathlib/Topology/Order/ScottTopology.lean b/Mathlib/Topology/Order/ScottTopology.lean index 5e77f371f9f738..5c9ac4267194f9 100644 --- a/Mathlib/Topology/Order/ScottTopology.lean +++ b/Mathlib/Topology/Order/ScottTopology.lean @@ -257,7 +257,7 @@ lemma monotone_of_continuous [IsScott α D] (hf : Continuous f) : Monotone f := rw [isOpen_iff_isUpperSet_and_dirSupInaccOn (D := D)] at hu obtain ⟨c, hcd, hfcb⟩ := hu.2 h₀ d₁ d₂ d₃ h simp only [upperBounds, mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, - mem_setOf] at hb + mem_ofPred] at hb exact hfcb <| hb _ hcd end Preorder diff --git a/Mathlib/Topology/Order/WithTop.lean b/Mathlib/Topology/Order/WithTop.lean index 504ce112af04bf..766479ffb59071 100644 --- a/Mathlib/Topology/Order/WithTop.lean +++ b/Mathlib/Topology/Order/WithTop.lean @@ -76,7 +76,7 @@ instance [ts : TopologicalSpace ι] [ht : OrderTopology ι] [SecondCountableTopo have h_basis : IsTopologicalBasis basis := isTopologicalBasis_biInter_Ioi_Iio_of_generateFrom c hc rw [OrderTopology.topology_eq_generate_intervals (α := WithTop ι)] apply le_generateFrom_iff_subset_isOpen.2 - simp only [setOf_subset_setOf, forall_exists_index] + simp only [ofPred_subset_ofPred, forall_exists_index] rintro u a (rfl | rfl) -- Consider an interval of the form `Ioi a`. We should cover it by finite intersections of -- our sets. @@ -232,7 +232,7 @@ lemma continuousOn_untopA [Nonempty ι] : ContinuousOn untopA { a : WithTop ι | lemma tendsto_untop (a : {a : WithTop ι | a ≠ ⊤}) : Tendsto (fun x ↦ untop x.1 x.2) (𝓝 a) (𝓝 (untop a.1 a.2)) := by have : Nonempty ι := ⟨untop a.1 a.2⟩ - simp only [← untopA_eq_untop, ne_eq, coe_setOf, mem_setOf_eq] + simp only [← untopA_eq_untop, ne_eq, coe_ofPred, mem_ofPred_eq] exact (tendsto_untopA a.2).comp <| tendsto_subtype_rng.mp tendsto_id @[to_dual] diff --git a/Mathlib/Topology/PartitionOfUnity.lean b/Mathlib/Topology/PartitionOfUnity.lean index 4f168a7c767a55..e0615be6724b7d 100644 --- a/Mathlib/Topology/PartitionOfUnity.lean +++ b/Mathlib/Topology/PartitionOfUnity.lean @@ -185,7 +185,7 @@ def finsupport : Finset ι := (ρ.locallyFinite.point_finite x₀).toFinset @[simp] theorem mem_finsupport (x₀ : X) {i} : i ∈ ρ.finsupport x₀ ↔ i ∈ support fun i ↦ ρ i x₀ := by - simp only [finsupport, mem_support, Finite.mem_toFinset, mem_setOf_eq] + simp only [finsupport, mem_support, Finite.mem_toFinset, mem_ofPred_eq] @[simp] theorem coe_finsupport (x₀ : X) : diff --git a/Mathlib/Topology/Perfect.lean b/Mathlib/Topology/Perfect.lean index 5bf5d949327568..d40c37eddb2811 100644 --- a/Mathlib/Topology/Perfect.lean +++ b/Mathlib/Topology/Perfect.lean @@ -227,7 +227,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α] simp only [V, iUnion_inter] apply Countable.biUnion · exact bct.mono (sep_subset _ _) - · exact sep_subset_setOf _ _ + · exact sep_subset_ofPred _ _ refine ⟨V ∩ C, D, Vct, ⟨?_, ?_⟩, ?_⟩ · refine hclosed.sdiff (isOpen_biUnion fun _ ↦ ?_) exact fun ⟨Ub, _⟩ ↦ IsTopologicalBasis.isOpen bbasis Ub @@ -248,7 +248,7 @@ theorem exists_countable_union_perfect_of_isClosed [SecondCountableTopology α] apply xD.2 exact mem_biUnion this xU by_contra! h - exact absurd (Countable.mono h (Set.countable_singleton _)) this + exact this <| (Set.countable_singleton x).mono fun y hy ↦ h y hy · rw [inter_comm, inter_union_sdiff] /-- Any uncountable closed set in a second countable space contains a nonempty perfect subset. -/ diff --git a/Mathlib/Topology/Semicontinuity/Basic.lean b/Mathlib/Topology/Semicontinuity/Basic.lean index 989b1b661f0a15..35c67f7c3071c1 100644 --- a/Mathlib/Topology/Semicontinuity/Basic.lean +++ b/Mathlib/Topology/Semicontinuity/Basic.lean @@ -334,7 +334,7 @@ variable [TopologicalSpace γ] [ClosedIciTopology γ] theorem lowerSemicontinuousOn_iff_isClosed_epigraph {f : α → γ} {s : Set α} (hs : IsClosed s) : LowerSemicontinuousOn f s ↔ IsClosed {p : α × γ | p.1 ∈ s ∧ f p.1 ≤ p.2} := by simp_rw [lowerSemicontinuousOn_iff, lowerSemicontinuousWithinAt_iff, - eventually_nhdsWithin_iff, ← isOpen_compl_iff, compl_setOf, isOpen_iff_eventually, mem_setOf, + eventually_nhdsWithin_iff, ← isOpen_compl_iff, compl_ofPred, isOpen_iff_eventually, mem_ofPred, not_and, not_le] constructor · intro hf ⟨x, y⟩ h diff --git a/Mathlib/Topology/Semicontinuity/Hemicontinuity.lean b/Mathlib/Topology/Semicontinuity/Hemicontinuity.lean index a0b3a823bdedf4..b7271bbeb3fcdd 100644 --- a/Mathlib/Topology/Semicontinuity/Hemicontinuity.lean +++ b/Mathlib/Topology/Semicontinuity/Hemicontinuity.lean @@ -116,7 +116,7 @@ lemma isClosedMap_iff_upperHemicontinuous {f : α → β} : lemma lowerHemicontinuous_iff_isOpen_inter_nonempty : LowerHemicontinuous f ↔ ∀ u, IsOpen u → IsOpen {x | (f x ∩ u).Nonempty} := by simp_rw [lowerHemicontinuous_iff, lowerHemicontinuousAt_iff, isOpen_iff_mem_nhds, - forall_comm (α := α), mem_setOf, Filter.Eventually] + forall_comm (α := α), mem_ofPred, Filter.Eventually] /-- A correspondence `f : α → Set β` is lower hemicontinuous if and only if its *lower inverse* (i.e., `u : Set β ↦ (f ⁻¹' (Iic uᶜ))ᶜ`, note that `f ⁻¹' (Iic u) = {x | (f x ∩ u).Nonempty}`) @@ -341,7 +341,7 @@ The more general fact is that if `f` is upper hemicontinuous at `x₀` within `s `x₀` is a cluster point of `s ∩ {x | (f x).Nonempty}`, then `(f x₀).Nonempty`. -/ lemma UpperHemicontinuous.isClosed_domain (hf : UpperHemicontinuous f) : IsClosed {x | (f x).Nonempty} := by - simp only [← isOpen_compl_iff, compl_setOf, not_nonempty_iff_eq_empty, isOpen_iff_mem_nhds] + simp only [← isOpen_compl_iff, compl_ofPred, not_nonempty_iff_eq_empty, isOpen_iff_mem_nhds] intro x (hx : f x = ∅) simp_rw [upperHemicontinuous_iff, upperHemicontinuousAt_iff] at hf simpa [hx, empty_mem_iff_bot, nhdsSet_eq_bot_iff] using! hf x ∅ @@ -389,7 +389,7 @@ lemma UpperHemicontinuousAt.mem_of_tendsto {ι : Type*} [RegularSpace β] {x₀ exact hst.notMem_of_mem_left hyn hn apply hy.mp filter_upwards [hx (hf s hs)] with n hn hyn - simp only [← subset_interior_iff_mem_nhdsSet, preimage_setOf_eq, mem_setOf_eq] at hn + simp only [← subset_interior_iff_mem_nhdsSet, preimage_ofPred_eq, mem_ofPred_eq] at hn exact interior_subset <| hn hyn /-! ### Open lower sections -/ diff --git a/Mathlib/Topology/Semicontinuity/Lindelof.lean b/Mathlib/Topology/Semicontinuity/Lindelof.lean index 6165315e2729d1..ed6fc5f882357a 100644 --- a/Mathlib/Topology/Semicontinuity/Lindelof.lean +++ b/Mathlib/Topology/Semicontinuity/Lindelof.lean @@ -80,7 +80,7 @@ theorem exists_countable_upperSemicontinuous_isGLB {s : X → E} {𝓕 : Set (X rcases D_dense.exists_between H with ⟨d, d_mem, hd⟩ obtain ⟨f, f_mem, hf⟩ : ∃ f ∈ A d, f x < d := by have : x ∈ {y | s y < d} := hd.1 - simpa only [hA d, mem_iUnion₂, exists_prop, U, mem_setOf_eq] using this + simpa only [hA d, mem_iUnion₂, exists_prop, U, mem_ofPred_eq] using this suffices e < e by simpa exact (he (mem_image_of_mem _ (mem_iUnion₂_of_mem d_mem f_mem))).trans_lt hf |>.trans hd.2 diff --git a/Mathlib/Topology/Separation/Basic.lean b/Mathlib/Topology/Separation/Basic.lean index 2e3d88286a9baf..3985fb9b445d13 100644 --- a/Mathlib/Topology/Separation/Basic.lean +++ b/Mathlib/Topology/Separation/Basic.lean @@ -379,7 +379,7 @@ lemma nhdsWithin_compl_singleton_le [T1Space X] (x y : X) : 𝓝[{x}ᶜ] x ≤ · rw [Ne.nhdsWithin_compl_singleton hy] exact nhdsWithin_le_nhds -theorem isOpen_setOf_eventually_nhdsWithin [T1Space X] {p : X → Prop} : +theorem isOpen_setOfPred_eventually_nhdsWithin [T1Space X] {p : X → Prop} : IsOpen { x | ∀ᶠ y in 𝓝[≠] x, p y } := by refine isOpen_iff_mem_nhds.mpr fun a ha => ?_ filter_upwards [eventually_nhds_nhdsWithin.mpr ha] with b hb @@ -388,6 +388,9 @@ theorem isOpen_setOf_eventually_nhdsWithin [T1Space X] {p : X → Prop} : · rw [h.symm.nhdsWithin_compl_singleton] at hb exact hb.filter_mono nhdsWithin_le_nhds +@[deprecated (since := "2026-07-09")] +alias isOpen_setOf_eventually_nhdsWithin := isOpen_setOfPred_eventually_nhdsWithin + @[simp] protected lemma Set.Finite.isClosed [T1Space X] {s : Set X} (hs : s.Finite) : IsClosed s := by rw [← biUnion_of_singleton s] @@ -525,7 +528,7 @@ theorem continuousOn_update_iff [T1Space X] [DecidableEq X] [TopologicalSpace Y] rw [continuousWithinAt_update_of_ne hz.2] at H exact H.mono sdiff_subset · rw [continuousWithinAt_update_of_ne hzx] - refine (H z ⟨hzs, hzx⟩).mono_of_mem_nhdsWithin (inter_mem_nhdsWithin _ ?_) + refine (H z ⟨hzs, hzx⟩).mono_of_mem_nhdsWithin (sdiff_mem_nhdsWithin s ?_) exact isOpen_ne.mem_nhds hzx · exact continuousWithinAt_update_same @@ -615,8 +618,8 @@ theorem insert_mem_nhdsWithin_of_subset_insert [T1Space X] {x y : X} {s t : Set rw [nhdsWithin_insert_of_ne h] exact mem_of_superset self_mem_nhdsWithin (subset_insert x s) -lemma eventuallyEq_insert [T1Space X] {s t : Set X} {x y : X} (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : - (insert x s : Set X) =ᶠ[𝓝 x] (insert x t : Set X) := by +lemma eventuallyEq_insert [T1Space X] {s t : Set X} {x y : X} (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : + insert x s =ᶠˢ[𝓝 x] insert x t := by simp_rw [eventuallyEq_set] at h ⊢ simp_rw [← union_singleton, ← nhdsWithin_univ, ← compl_union_self {x}, nhdsWithin_union, eventually_sup, nhdsWithin_singleton, @@ -749,7 +752,7 @@ alias continuousWithinAt_diff_singleton := continuousWithinAt_sdiff_singleton /-- If two sets coincide locally around `x`, except maybe at `y`, then it is equivalent to be continuous at `x` within one set or the other. -/ theorem continuousWithinAt_congr_set' [TopologicalSpace Y] [T1Space X] - {x : X} {s t : Set X} {f : X → Y} (y : X) (h : s =ᶠ[𝓝[{y}ᶜ] x] t) : + {x : X} {s t : Set X} {f : X → Y} (y : X) (h : s =ᶠˢ[𝓝[{y}ᶜ] x] t) : ContinuousWithinAt f s x ↔ ContinuousWithinAt f t x := by rw [← continuousWithinAt_insert_self (s := s), ← continuousWithinAt_insert_self (s := t)] exact continuousWithinAt_congr_set (eventuallyEq_insert h) @@ -943,12 +946,18 @@ theorem tendsto_nhds_unique_inseparable {f : Y → X} {l : Filter Y} {a b : X} [ (ha : Tendsto f l (𝓝 a)) (hb : Tendsto f l (𝓝 b)) : Inseparable a b := .of_nhds_neBot <| neBot_of_le <| le_inf ha hb -theorem isClosed_setOf_specializes : IsClosed { p : X × X | p.1 ⤳ p.2 } := by - simp only [← isOpen_compl_iff, compl_setOf, ← disjoint_nhds_nhds_iff_not_specializes, - isOpen_setOf_disjoint_nhds_nhds] +theorem isClosed_setOfPred_specializes : IsClosed { p : X × X | p.1 ⤳ p.2 } := by + simp only [← isOpen_compl_iff, compl_ofPred, ← disjoint_nhds_nhds_iff_not_specializes, + isOpen_setOfPred_disjoint_nhds_nhds] + +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_specializes := isClosed_setOfPred_specializes + +theorem isClosed_setOfPred_inseparable : IsClosed { p : X × X | Inseparable p.1 p.2 } := by + simp only [← specializes_iff_inseparable, isClosed_setOfPred_specializes] -theorem isClosed_setOf_inseparable : IsClosed { p : X × X | Inseparable p.1 p.2 } := by - simp only [← specializes_iff_inseparable, isClosed_setOf_specializes] +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_inseparable := isClosed_setOfPred_inseparable /-- In an R₁ space, a point belongs to the closure of a compact set `K` if and only if it is topologically inseparable from some point of `K`. -/ @@ -970,7 +979,7 @@ theorem IsCompact.closure_eq_biUnion_inseparable {K : Set X} (hK : IsCompact K) theorem IsCompact.closure_eq_biUnion_closure_singleton {K : Set X} (hK : IsCompact K) : closure K = ⋃ x ∈ K, closure {x} := by simp only [hK.closure_eq_biUnion_inseparable, ← specializes_iff_inseparable, - specializes_iff_mem_closure, setOf_mem_eq] + specializes_iff_mem_closure, ofPred_mem_eq] /-- In an R₁ space, if a compact set `K` is contained in an open set `U`, then its closure is also contained in `U`. -/ diff --git a/Mathlib/Topology/Separation/GDelta.lean b/Mathlib/Topology/Separation/GDelta.lean index 0a6c0a5fbd5982..2270e9c0fbf6fb 100644 --- a/Mathlib/Topology/Separation/GDelta.lean +++ b/Mathlib/Topology/Separation/GDelta.lean @@ -55,7 +55,7 @@ protected theorem IsGδ.singleton [FirstCountableTopology X] [T1Space X] (x : X) IsGδ ({x} : Set X) := by rcases (nhds_basis_opens x).exists_antitone_subbasis with ⟨U, hU, h_basis⟩ rw [← biInter_basis_nhds h_basis.toHasBasis] - exact .biInter (to_countable _) fun n _ => (hU n).2.isGδ + exact .biInter (to_countable {_n : ℕ | True}) fun n _ => (hU n).2.isGδ theorem Set.Finite.isGδ [FirstCountableTopology X] {s : Set X} [T1Space X] (hs : s.Finite) : IsGδ s := diff --git a/Mathlib/Topology/Separation/Hausdorff.lean b/Mathlib/Topology/Separation/Hausdorff.lean index bdcb3685f9d283..5a5f972fe8d5e1 100644 --- a/Mathlib/Topology/Separation/Hausdorff.lean +++ b/Mathlib/Topology/Separation/Hausdorff.lean @@ -514,7 +514,7 @@ theorem eqOn_closure₂' [T2Space Z] {s : Set X} {t : Set Y} {f g : X → Y → (hf₂ : ∀ y, Continuous fun x => f x y) (hg₁ : ∀ x, Continuous (g x)) (hg₂ : ∀ y, Continuous fun x => g x y) : ∀ x ∈ closure s, ∀ y ∈ closure t, f x y = g x y := suffices closure s ⊆ ⋂ y ∈ closure t, { x | f x y = g x y } by simpa only [subset_def, mem_iInter] - (closure_minimal fun x hx => mem_iInter₂.2 <| Set.EqOn.closure (h x hx) (hf₁ _) (hg₁ _)) <| + (closure_minimal fun x hx => by simpa [EqOn] using Set.EqOn.closure (h x hx) (hf₁ _) (hg₁ _)) <| isClosed_biInter fun _ _ => isClosed_eq (hf₂ _) (hg₂ _) theorem eqOn_closure₂ [T2Space Z] {s : Set X} {t : Set Y} {f g : X → Y → Z} diff --git a/Mathlib/Topology/Separation/PerfectlyNormal.lean b/Mathlib/Topology/Separation/PerfectlyNormal.lean index 6e405d69ec8117..8317576c61b0e3 100644 --- a/Mathlib/Topology/Separation/PerfectlyNormal.lean +++ b/Mathlib/Topology/Separation/PerfectlyNormal.lean @@ -55,7 +55,7 @@ theorem perfectlyNormalSpace_iff_forall_isClosed_preimage_zero : · suffices ∀ n, f n x = 0 from by simp [h, this] exact fun n => hfs n hp · contrapose h - simp only [preimage, notMem_setOf_iff, ContinuousMap.coe_mk, mem_singleton_iff] + simp only [preimage, notMem_ofPred_iff, ContinuousMap.coe_mk, mem_singleton_iff] apply ne_of_gt obtain ⟨i, hi⟩ := mem_iUnion.1 <| compl_iInter _ ▸ mem_compl (hu ▸ h) calc diff --git a/Mathlib/Topology/Separation/SeparatedNhds.lean b/Mathlib/Topology/Separation/SeparatedNhds.lean index 905097149c4464..9a049291bf1ea5 100644 --- a/Mathlib/Topology/Separation/SeparatedNhds.lean +++ b/Mathlib/Topology/Separation/SeparatedNhds.lean @@ -86,8 +86,8 @@ theorem hasSeparatingCovers_iff_separatedNhds {s t : Set X} : intro m xinvm have n_le_m : n ≤ m := by by_contra m_gt_n - exact xinun.2 (subset_closure (mem_biUnion (le_of_lt (not_le.mp m_gt_n)) xinvm)) - exact subset_closure (mem_biUnion n_le_m xinun.1) + exact xinun.2 (subset_closure (mem_iUnion₂_of_mem (le_of_lt (not_le.mp m_gt_n)) xinvm)) + exact subset_closure (mem_iUnion₂_of_mem n_le_m xinun.1) · rintro ⟨U, V, U_open, V_open, h_sub_U, k_sub_V, UV_dis⟩ exact ⟨⟨fun _ ↦ U, diff --git a/Mathlib/Topology/Sequences.lean b/Mathlib/Topology/Sequences.lean index 7fc21d9d8bcf05..d9b52d84ce2218 100644 --- a/Mathlib/Topology/Sequences.lean +++ b/Mathlib/Topology/Sequences.lean @@ -383,7 +383,8 @@ protected theorem IsSeqCompact.isComplete (hs : IsSeqCompact s) : IsComplete s : choose t htl htW hts using this have : ∀ n : ℕ, ⋂ k ≤ n, t k ⊆ t n := fun n => by apply iInter₂_subset; rfl exact ⟨fun n => ⋂ k ≤ n, t k, fun m n h => - biInter_subset_biInter_left fun k (hk : k ≤ m) => hk.trans h, fun n => + biInter_subset_biInter_left (s := {k | k ≤ n}) (s' := {k | k ≤ m}) + fun k (hk : k ≤ m) => hk.trans h, fun n => (biInter_mem (finite_le_nat n)).2 fun k _ => htl k, fun n => (prod_mono (this n) (this n)).trans (htW n), fun n => (this n).trans (hts n)⟩ choose u hu using fun n => Filter.nonempty_of_mem (htl n) diff --git a/Mathlib/Topology/Sets/Opens.lean b/Mathlib/Topology/Sets/Opens.lean index c9a12554fea78d..5719f35ee0e3f1 100644 --- a/Mathlib/Topology/Sets/Opens.lean +++ b/Mathlib/Topology/Sets/Opens.lean @@ -345,7 +345,7 @@ theorem isBasis_iff_cover {B : Set (Opens α)} : · intro hB U refine ⟨{ V : Opens α | V ∈ B ∧ V ≤ U }, fun U hU => hU.left, ext ?_⟩ rw [coe_sSup, hB.open_eq_sUnion' U.isOpen] - simp_rw [sUnion_eq_biUnion, iUnion, mem_setOf_eq, iSup_and, iSup_image] + simp_rw [sUnion_eq_biUnion, iUnion, mem_ofPred_eq, iSup_and, iSup_image] rfl · intro h rw [isBasis_iff_nbhd] diff --git a/Mathlib/Topology/Sets/VietorisTopology.lean b/Mathlib/Topology/Sets/VietorisTopology.lean index b2feab21cf604d..3cc03baf64fedc 100644 --- a/Mathlib/Topology/Sets/VietorisTopology.lean +++ b/Mathlib/Topology/Sets/VietorisTopology.lean @@ -65,12 +65,12 @@ theorem isOpen_inter_nonempty_of_isOpen {U : Set α} (h : IsOpen U) : /-- When `Set` is equipped with the Vietoris topology, the powerset of a closed set is closed. -/ theorem _root_.IsClosed.powerset_vietoris {F : Set α} (h : IsClosed F) : IsClosed F.powerset := by - simp_rw [powerset, ← isOpen_compl_iff, compl_setOf, ← inter_compl_nonempty_iff] + simp_rw [powerset, ← isOpen_compl_iff, compl_ofPred, ← inter_compl_nonempty_iff] exact isOpen_inter_nonempty_of_isOpen h.isOpen_compl theorem isClosed_inter_nonempty_of_isClosed {F : Set α} (h : IsClosed F) : IsClosed {s | (s ∩ F).Nonempty} := by - simp_rw +singlePass [← compl_compl F, inter_compl_nonempty_iff, ← compl_setOf] + simp_rw +singlePass [← compl_compl F, inter_compl_nonempty_iff, ← compl_ofPred] exact h.isOpen_compl.powerset_vietoris.isClosed_compl theorem isClopen_singleton_empty : IsClopen {(∅ : Set α)} := by @@ -86,7 +86,7 @@ theorem isTopologicalBasis : refine isTopologicalBasis_of_subbasis rfl |>.isTopologicalBasis_of_exists_subset ?_ ?_ <;> rw [forall_mem_image] · intro u ⟨hu₁, hu₂⟩ - simp_rw [setOf_and, setOf_forall] + simp_rw [ofPred_and, ofPred_forall] exact (isOpen_sUnion hu₂).powerset_vietoris.inter <| hu₁.isOpen_biInter fun U hU => isOpen_inter_nonempty_of_isOpen (hu₂ U hU) · intro t ⟨ht₁, ht₂⟩ s hs @@ -106,7 +106,7 @@ theorem isTopologicalBasis : at hs ⊢ rw [mem_inter_iff, mem_powerset_iff, mem_iInter₂] at hs exists insert U ((U ∩ ·) '' v) - simp_rw [show ⋃₀ (insert U ((U ∩ ·) '' v)) = U by simp, mem_setOf, finite_insert, + simp_rw [show ⋃₀ (insert U ((U ∩ ·) '' v)) = U by simp, mem_ofPred, finite_insert, forall_mem_insert, forall_mem_image, ← inter_assoc, inter_eq_left.mpr hs.1] refine ⟨⟨hv₂.image _, hU, fun V hV => hU.inter (hv₁ hV)⟩, by grind, fun t ⟨htU, _, ht⟩ => ⟨htU, mem_iInter₂_of_mem ?_⟩⟩ @@ -123,7 +123,7 @@ theorem _root_.TopologicalSpace.IsTopologicalBasis.vietoris refine isTopologicalBasis.isTopologicalBasis_of_exists_subset ?_ ?_ <;> rw [forall_mem_image] · intro ⟨V, u⟩ ⟨hV, hu, huB, _⟩ - simp_rw [setOf_and, setOf_forall] + simp_rw [ofPred_and, ofPred_forall] exact hV.powerset_vietoris.inter <| hu.isOpen_biInter fun V hV => isOpen_inter_nonempty_of_isOpen <| hB.isOpen <| huB hV · intro u ⟨hu₁, hu₂⟩ s ⟨hs₁, hs₂⟩ @@ -163,7 +163,8 @@ theorem continuous_iff {f : α → Set β} : rw [continuous_generateFrom_iff] rintro _ (⟨U, hU, rfl⟩ | ⟨U, hU, rfl⟩) · exact h₁ U hU - · simp_rw [preimage_setOf_eq, ← not_disjoint_iff_nonempty_inter, ← compl_setOf, isOpen_compl_iff, + · simp_rw [preimage_ofPred_eq, ← not_disjoint_iff_nonempty_inter, ← compl_ofPred, + isOpen_compl_iff, ← subset_compl_iff_disjoint_right] exact h₂ Uᶜ hU.isClosed_compl @@ -172,8 +173,8 @@ theorem isEmbedding_singleton : IsEmbedding ({·} : α → Set α) where injective := Set.singleton_injective eq_induced := by simp_rw [TopologicalSpace.vietoris, induced_generateFrom_eq, image_union, image_image, - powerset, preimage_setOf_eq, singleton_subset_iff, singleton_inter_nonempty, union_self, - setOf_mem_eq, image_id', generateFrom_setOf_isOpen] + powerset, preimage_ofPred_eq, singleton_subset_iff, singleton_inter_nonempty, union_self, + ofPred_mem_eq, image_id', generateFrom_setOfPred_isOpen] @[fun_prop] theorem continuous_singleton : Continuous ({·} : α → Set α) := @@ -194,7 +195,7 @@ theorem _root_.TopologicalSpace.isClosed_range_singleton [T2Space α] {t : Topol obtain ⟨U, V, hU, hV, hxU, hyV, hUV⟩ := t2_separation hxy filter_upwards [(h₂ hU).inter (h₂ hV) |>.mem_nhds ⟨⟨x, hx, hxU⟩, ⟨y, hy, hyV⟩⟩] rintro _ ⟨hzU, hzV⟩ ⟨z, rfl⟩ - rw [Set.mem_setOf, Set.singleton_inter_nonempty] at hzU hzV + rw [Set.mem_ofPred, Set.singleton_inter_nonempty] at hzU hzV exact hUV.notMem_of_mem_left hzU hzV @[fun_prop] @@ -206,7 +207,7 @@ theorem isClosedEmbedding_singleton [T2Space α] : @[fun_prop] theorem continuous_union : Continuous (fun x : Set α × Set α => x.1 ∪ x.2) := by - simp_rw [continuous_iff, powerset, preimage_setOf_eq, union_subset_iff, setOf_and] + simp_rw [continuous_iff, powerset, preimage_ofPred_eq, union_subset_iff, ofPred_and] exact ⟨ fun U hU => .inter (hU.powerset_vietoris.preimage continuous_fst) @@ -218,7 +219,7 @@ theorem continuous_union : Continuous (fun x : Set α × Set α => x.1 ∪ x.2) @[fun_prop] theorem continuous_range_of_finite {ι : Type*} [Finite ι] : Continuous (range : (ι → α) → Set α) := by - simp_rw [continuous_iff, powerset, preimage_setOf_eq, range_subset_iff, setOf_forall] + simp_rw [continuous_iff, powerset, preimage_ofPred_eq, range_subset_iff, ofPred_forall] exact ⟨ fun U hU => isOpen_iInter_of_finite fun i => hU.preimage <| continuous_apply i, fun F hF => isClosed_iInter fun i => hF.preimage <| continuous_apply i⟩ @@ -227,7 +228,7 @@ theorem continuous_range_of_finite {ι : Type*} [Finite ι] : continuous. -/ @[fun_prop] theorem _root_.Continuous.image_vietoris (hf : Continuous f) : Continuous (f '' ·) := by - simp_rw [continuous_iff, powerset, preimage_setOf_eq, image_subset_iff] + simp_rw [continuous_iff, powerset, preimage_ofPred_eq, image_subset_iff] constructor <;> exact fun U hU => (hU.preimage hf).powerset_vietoris /-- When `Set` is equipped with the Vietoris topology, taking the image under an inducing map is @@ -238,7 +239,7 @@ theorem _root_.Topology.IsInducing.image_vietoris (hf : IsInducing f) : IsInduci have : {U : Set α | IsOpen U} = (f ⁻¹' ·) '' {V : Set β | IsOpen V} := Set.ext fun _ => hf.isOpen_iff simp_rw [TopologicalSpace.vietoris, this, induced_generateFrom_eq, image_union, image_image, - powerset, preimage_setOf_eq, image_subset_iff, image_inter_nonempty_iff] + powerset, preimage_ofPred_eq, image_subset_iff, image_inter_nonempty_iff] /-- When `Set` is equipped with the Vietoris topology, taking the image under an embedding is an embedding. -/ @@ -262,9 +263,10 @@ private theorem isCompact_aux {K : Set α} (hK : IsCompact K) the compactness of `Lᵢ`. -/ obtain ⟨L, hL, hLu⟩ := hsu rw [sUnion_eq_biUnion] at hLu - obtain ⟨T, hTS, hT, hLT⟩ := (hs L hL).elim_finite_subcover_image (fun _ h => h.1) hLu + obtain ⟨T, hTS, hT, hLT⟩ := + (hs L hL).elim_finite_subcover_image (b := u) (fun _ h => h.1) hLu refine ⟨(fun U => {s | (s ∩ U).Nonempty}) '' T, by grind [image_subset_iff], hT.image _, ?_⟩ - simp_rw [sUnion_image, ← setOf_exists, ← nonempty_iUnion, ← inter_iUnion] + simp_rw [sUnion_image, ← ofPred_exists, ← nonempty_iUnion, ← inter_iUnion] grw [← hLT] grind · -- Otherwise, the set `K \ ⋃ Uⱼ` intersects every `Lᵢ`, so it is in one of the covering sets. @@ -275,7 +277,8 @@ private theorem isCompact_aux {K : Set α} (hK : IsCompact K) · /- If `K \ ⋃ Uⱼ ⊆ U`, then every subset of `K` is either a subset of `U` or intersects some `Uⱼ`. By the compactness of `K \ U`, `Uⱼ` can be chosen from a finite subfamily. -/ rw [mem_powerset_iff, sdiff_subset_comm, sUnion_eq_biUnion] at hUu - obtain ⟨T, hTS, hT, hKT⟩ := (hK.diff hU).elim_finite_subcover_image (fun _ h => h.1) hUu + obtain ⟨T, hTS, hT, hKT⟩ := + (hK.diff hU).elim_finite_subcover_image (b := u) (fun _ h => h.1) hUu refine ⟨insert U.powerset ((fun V => {s | (s ∩ V).Nonempty}) '' T), insert_subset hUS <| Set.image_subset_iff.mpr <| hTS.trans fun _ h => h.2, (hT.image _).insert _, ?_⟩ @@ -357,12 +360,12 @@ theorem isOpen_inter_nonempty_of_isOpen {U : Set α} (h : IsOpen U) : theorem isClosed_subsets_of_isClosed {F : Set α} (h : IsClosed F) : IsClosed {K : Compacts α | ↑K ⊆ F} := by - simp_rw [← isOpen_compl_iff, Set.compl_setOf, ← Set.inter_compl_nonempty_iff] + simp_rw [← isOpen_compl_iff, Set.compl_ofPred, ← Set.inter_compl_nonempty_iff] exact isOpen_inter_nonempty_of_isOpen h.isOpen_compl theorem isClosed_inter_nonempty_of_isClosed {F : Set α} (h : IsClosed F) : IsClosed {K : Compacts α | (↑K ∩ F).Nonempty} := by - simp_rw +singlePass [← compl_compl F, Set.inter_compl_nonempty_iff, ← Set.compl_setOf] + simp_rw +singlePass [← compl_compl F, Set.inter_compl_nonempty_iff, ← Set.compl_ofPred] exact (isOpen_subsets_of_isOpen h.isOpen_compl).isClosed_compl theorem isClopen_singleton_bot : IsClopen {(⊥ : Compacts α)} := by @@ -390,9 +393,12 @@ theorem closure_finite_subsets (s : Set α) : vietoris.closure_finite_subsets] exact fun K ⟨hK, _⟩ => ⟨⟨K, hK.isCompact⟩, rfl⟩ -theorem dense_setOf_finite : Dense {K : Compacts α | (K : Set α).Finite} := by +theorem dense_setOfPred_finite : Dense {K : Compacts α | (K : Set α).Finite} := by simpa [dense_iff_closure_eq] using closure_finite_subsets univ +@[deprecated (since := "2026-07-09")] +alias dense_setOf_finite := dense_setOfPred_finite + /-- Given a basis `B` on a topological space `α`, the topology of `Compacts α` has a basis consisting of sets of the form `{K | K ⊆ U₁ ∪ … ∪ Uₙ, K ∩ U₁ ≠ ∅, …, K ∩ Uₙ ≠ ∅}`, where `U₁, …, Uₙ ∈ B`. -/ @@ -404,7 +410,7 @@ theorem _root_.TopologicalSpace.IsTopologicalBasis.compacts refine hB.vietoris.isInducing isEmbedding_coe.isInducing |>.isTopologicalBasis_of_exists_subset ?_ ?_ <;> simp_rw [forall_mem_image] · intro u ⟨hu, huB⟩ - simp_rw [setOf_and, setOf_forall] + simp_rw [ofPred_and, ofPred_forall] exact .inter (isOpen_subsets_of_isOpen <| isOpen_sUnion fun U hU => hB.isOpen <| huB hU) (hu.isOpen_biInter fun U hU => isOpen_inter_nonempty_of_isOpen <| hB.isOpen <| huB hU) @@ -472,7 +478,7 @@ theorem continuous_prod : Continuous fun p : Compacts α × Compacts β => p.1 · rw [isOpen_iff_forall_mem_open] intro ⟨K, L⟩ ⟨⟨x, y⟩, ⟨(hx : x ∈ K), (hy : y ∈ L)⟩, hxy⟩ obtain ⟨V, W, hV, hW, hxV, hyW, hVW⟩ := isOpen_prod_iff.mp hU x y hxy - grw [preimage_setOf_eq, ← hVW] + grw [preimage_ofPred_eq, ← hVW] simp_rw [Function.comp_apply, coe_prod, prod_inter_prod, prod_nonempty_iff] exact ⟨_, .rfl, (isOpen_inter_nonempty_of_isOpen hV).prod (isOpen_inter_nonempty_of_isOpen hW), @@ -518,8 +524,8 @@ instance [DiscreteTopology α] : DiscreteTopology (Compacts α) := by (isOpen_subsets_of_isOpen (isOpen_discrete (K : Set α))).inter (K.isCompact.finite_of_discrete.isOpen_biInter fun x hx => isOpen_inter_nonempty_of_isOpen (isOpen_discrete { x })) - simp_rw [← setOf_forall, inter_singleton_nonempty, ← Set.subset_def, ← setOf_and, - ← subset_antisymm_iff, SetLike.coe_set_eq, setOf_eq_eq_singleton] + simp_rw [← ofPred_forall, inter_singleton_nonempty, ← Set.subset_def, ← ofPred_and, + ← subset_antisymm_iff, SetLike.coe_set_eq, ofPred_eq_eq_singleton] @[simp] theorem discreteTopology_iff : DiscreteTopology (Compacts α) ↔ DiscreteTopology α := @@ -544,14 +550,14 @@ theorem t2Space_iff : T2Space (Compacts α) ↔ T2Space α := instance [RegularSpace α] : RegularSpace (Compacts α) := by simp_rw [regularSpace_generateFrom induced_generateFrom_eq, image_union, image_image, powerset, - preimage_setOf_eq, Filter.disjoint_iff] + preimage_ofPred_eq, Filter.disjoint_iff] rintro _ (⟨U, hU, rfl⟩ | ⟨U, hU, rfl⟩) K hK · obtain ⟨V, W, hV, hW, hKV, hUW, hVW⟩ := SeparatedNhds.of_isCompact_isClosed K.isCompact hU.isClosed_compl (disjoint_compl_right_iff_subset.mpr hK) refine ⟨{K | (↑K ∩ W).Nonempty}, ?_, {K | ↑K ⊆ V}, (isOpen_subsets_of_isOpen hV).mem_nhds_iff.mpr hKV, by grind [Set.Nonempty]⟩ - simp_rw [(isOpen_inter_nonempty_of_isOpen hW).mem_nhdsSet, compl_setOf, + simp_rw [(isOpen_inter_nonempty_of_isOpen hW).mem_nhdsSet, compl_ofPred, ← inter_compl_nonempty_iff] grw [hUW] · obtain ⟨x, hx₁, hx₂⟩ := hK @@ -559,7 +565,7 @@ instance [RegularSpace α] : RegularSpace (Compacts α) := by SeparatedNhds.of_isCompact_isClosed (isCompact_singleton (x := x)) hU.isClosed_compl (by simpa) refine ⟨{K | ↑K ⊆ W}, ?_, {K | (↑K ∩ V).Nonempty}, ?_, by grind [Set.Nonempty]⟩ - · simp_rw [(isOpen_subsets_of_isOpen hW).mem_nhdsSet, compl_setOf, not_nonempty_iff_eq_empty, + · simp_rw [(isOpen_subsets_of_isOpen hW).mem_nhdsSet, compl_ofPred, not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty, ← subset_compl_iff_disjoint_right] gcongr · rw [(isOpen_inter_nonempty_of_isOpen hV).mem_nhds_iff] @@ -575,7 +581,7 @@ theorem t3Space_iff : T3Space (Compacts α) ↔ T3Space α := instance [SecondCountableTopology α] : SecondCountableTopology (Compacts α) := by obtain ⟨b, hb₁, -, hb₂⟩ := exists_countable_basis α - exact hb₂.compacts.secondCountableTopology <| (countable_setOf_finite_subset hb₁).image _ + exact hb₂.compacts.secondCountableTopology <| (countable_ofPred_finite_subset hb₁).image _ @[simp] theorem secondCountableTopology_iff : @@ -725,8 +731,11 @@ theorem closure_finite_subsets (s : Set α) : simpa [isOpenEmbedding_toCompacts.isOpenMap.preimage_closure_eq_closure_preimage continuous_toCompacts] using congr(toCompacts ⁻¹' $(Compacts.closure_finite_subsets s)) -theorem dense_setOf_finite : Dense {K : NonemptyCompacts α | (K : Set α).Finite} := - Compacts.dense_setOf_finite.preimage isOpenEmbedding_toCompacts.isOpenMap +theorem dense_setOfPred_finite : Dense {K : NonemptyCompacts α | (K : Set α).Finite} := + Compacts.dense_setOfPred_finite.preimage isOpenEmbedding_toCompacts.isOpenMap + +@[deprecated (since := "2026-07-09")] +alias dense_setOf_finite := dense_setOfPred_finite /-- Given a basis `B` on a topological space `α`, the topology of `NonemptyCompacts α` has a basis consisting of sets of the form `{K | K ⊆ U₁ ∪ … ∪ Uₙ, K ∩ U₁ ≠ ∅, …, K ∩ Uₙ ≠ ∅}`, where @@ -739,7 +748,7 @@ theorem _root_.TopologicalSpace.IsTopologicalBasis.nonemptyCompacts refine hB.compacts.isInducing isEmbedding_toCompacts.isInducing |>.isTopologicalBasis_of_exists_subset ?_ ?_ <;> simp_rw [forall_mem_image] · rintro u ⟨hu, -, huB⟩ - simp_rw [setOf_and, setOf_forall] + simp_rw [ofPred_and, ofPred_forall] exact .inter (isOpen_subsets_of_isOpen <| isOpen_sUnion fun U hU => hB.isOpen <| huB hU) (hu.isOpen_biInter fun U hU => isOpen_inter_nonempty_of_isOpen <| hB.isOpen <| huB hU) diff --git a/Mathlib/Topology/Sheaves/EtaleSpace.lean b/Mathlib/Topology/Sheaves/EtaleSpace.lean index a097299154aab9..8c559b3dd6c2a7 100644 --- a/Mathlib/Topology/Sheaves/EtaleSpace.lean +++ b/Mathlib/Topology/Sheaves/EtaleSpace.lean @@ -66,7 +66,7 @@ then a neighborhood of `g` consists of germs of `s` at points `x ∈ U`. -/ protected theorem eventually_nhds (g : EtaleSpace F) {U : Opens X} (h : g.base ∈ U) (s : ToType (F.obj (op U))) (hs : F.germ U g.base h s = g.germ) : ∀ᶠ g' : EtaleSpace F in 𝓝 g, ∃ hgU : g'.base ∈ U, g'.germ = F.germ U g'.base hgU s := by - simp only [nhds_generateFrom, Filter.Eventually, mem_setOf_eq, iInf_and, iInf_exists] + simp only [nhds_generateFrom, Filter.Eventually, mem_ofPred_eq, iInf_and, iInf_exists] refine mem_iInf_of_mem _ <| mem_iInf_of_mem ?_ <| mem_iInf_of_mem U <| mem_iInf_of_mem s <| mem_iInf_of_mem rfl <| mem_principal_self _ simp [*] @@ -133,9 +133,9 @@ noncomputable def homeomorph (U : Opens X) simp_rw [continuous_iff_continuousAt, continuousAt_prod_of_discrete_right] rintro ⟨y, ⟨g⟩⟩ simp only [ContinuousAt, nhds_subtype_eq_comap, tendsto_comap_iff, comp_def, - nhds_generateFrom, tendsto_iInf, mem_setOf_eq, tendsto_principal] + nhds_generateFrom, tendsto_iInf, mem_ofPred_eq, tendsto_principal] rintro _ ⟨hmem, V, f, rfl⟩ - simp only [mem_setOf_eq] at hmem + simp only [mem_ofPred_eq] at hmem rcases hmem with ⟨hyV, hgf⟩ rcases F.germ_eq _ _ _ _ _ hgf with ⟨W, hyW, ιWU, ιWV, hW⟩ filter_upwards [W.isOpen.preimage continuous_subtype_val |>.mem_nhds hyW] with z hz diff --git a/Mathlib/Topology/ShrinkingLemma.lean b/Mathlib/Topology/ShrinkingLemma.lean index 770cac4e18c0b6..b6e52331a0c2d2 100644 --- a/Mathlib/Topology/ShrinkingLemma.lean +++ b/Mathlib/Topology/ShrinkingLemma.lean @@ -174,7 +174,8 @@ theorem exists_gt [NormalSpace X] (v : PartialRefinement u s ⊤) (hs : IsClosed rcases mem_iUnion.1 (v.subset_iUnion hxs) with ⟨j, hj⟩ exact (em (j = i)).elim (fun h => h ▸ hj) fun h => (H j h hj).elim have C : IsClosed (s ∩ ⋂ (j) (_ : j ≠ i), (v j)ᶜ) := - IsClosed.inter hs (isClosed_biInter fun _ _ => isClosed_compl_iff.2 <| v.isOpen _) + IsClosed.inter hs + (isClosed_biInter (s := {j | j ≠ i}) fun _ _ => isClosed_compl_iff.2 <| v.isOpen _) rcases normal_exists_closure_subset C (v.isOpen i) I with ⟨vi, ovi, hvi, cvi⟩ classical refine ⟨⟨update v i vi, insert i v.carrier, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_⟩ @@ -187,7 +188,7 @@ theorem exists_gt [NormalSpace X] (v : PartialRefinement u s ⊤) (hs : IsClosed rwa [update_of_ne hji] · use i rw [update_self] - exact hvi ⟨hx, mem_biInter h⟩ + exact hvi ⟨hx, mem_biInter (s := {j | j ≠ i}) h⟩ · rintro j (rfl | hj) · rwa [update_self, ← v.apply_eq hi] · rw [update_of_ne (ne_of_mem_of_not_mem hj hi)] @@ -277,7 +278,7 @@ theorem exists_gt_t2space (v : PartialRefinement u s (fun w => IsCompact (closur have hsic : IsCompact si := by apply IsCompact.of_isClosed_subset hs _ Set.inter_subset_left · have : IsOpen (⋃ j ≠ i, v j) := by - apply isOpen_biUnion + apply isOpen_biUnion (s := {j | j ≠ i}) intro j _ exact v.isOpen j exact IsClosed.inter (IsCompact.isClosed hs) (IsOpen.isClosed_compl this) diff --git a/Mathlib/Topology/Sion.lean b/Mathlib/Topology/Sion.lean index 4b16ccbc13a746..59ff9611d1e314 100644 --- a/Mathlib/Topology/Sion.lean +++ b/Mathlib/Topology/Sion.lean @@ -175,26 +175,29 @@ variable [TopologicalSpace F] [AddCommGroup F] [Module ℝ F] variable (X Y f) in /-- The set of parameters `z` in the segment `[y, y']` such that `f b z ≤ f b' y`. -/ -def setOf_sublevelLeft_subset (b b' : β) (y y' : Y) : Set (segment ℝ y.val y'.val) := +def setOfPred_sublevelLeft_subset (b b' : β) (y y' : Y) : Set (segment ℝ y.val y'.val) := {z | sublevelLeft X f b z ⊆ sublevelLeft X f b' y} +@[deprecated (since := "2026-07-09")] +alias setOf_sublevelLeft_subset := setOfPred_sublevelLeft_subset + include ne_X kX hfx hfx' cY hfy hfy' in -/-- Under suitable inequalities, `setOf_sublevelLeft_subset` is closed -/ -theorem isClosed_setOf_sublevelLeft_subset +/-- Under suitable inequalities, `setOfPred_sublevelLeft_subset` is closed -/ +theorem isClosed_setOfPred_sublevelLeft_subset (a : E) (b b' : β) (y y' : Y) (ha : ∀ x ∈ X, f a y ⊔ f a y' ≤ f x y ⊔ f x y') (hb : ∀ y ∈ Y, ∃ x ∈ X, f x y ≤ b) (hb' : b' < f a y ⊔ f a y') (hbb' : b < b') : - IsClosed (setOf_sublevelLeft_subset X Y f b b' y y') := by - set J := setOf_sublevelLeft_subset X Y f b b' y y' - -- Write `J` for `setOf_sublevelLeft_subset X Y f b b' y y'`. + IsClosed (setOfPred_sublevelLeft_subset X Y f b b' y y') := by + set J := setOfPred_sublevelLeft_subset X Y f b b' y y' + -- Write `J` for `setOfPred_sublevelLeft_subset X Y f b b' y y'`. rw [isClosed_iff_clusterPt] /- Let `z in segment ℝ y y'` be a cluster point of `J`; we have to show that `z ∈ J`, i.e `sublevelLeft t z ⊆ sublevelLeft t' y1`. Let `x ∈ sublevelLeft t z` and let us prove that `x ∈ sublevelLeft X f b' y`. -/ intro z hz x hx - suffices ∃ z' ∈ setOf_sublevelLeft_subset X Y f b b' y y', x ∈ sublevelLeft X f b' (z' : F) by + suffices ∃ z' ∈ setOfPred_sublevelLeft_subset X Y f b b' y y', x ∈ sublevelLeft X f b' (z' : F) by obtain ⟨z', hz', hxz'⟩ := this /- We need to prove `x ∈ sublevelLeft X f b' y`. Assume that there is `z' ∈ J` such that `x ∈ sublevelLeft b' z'`. @@ -221,13 +224,16 @@ theorem isClosed_setOf_sublevelLeft_subset rw [clusterPt_principal_subtype_iff_frequently (cY.segment_subset y.prop y'.prop)] at hz suffices ∀ᶠ z' : F in nhdsWithin z Y, (∃ hz' : z' ∈ segment ℝ y.val y'.val, - (⟨z', hz'⟩ : segment ℝ y.val y'.val) ∈ setOf_sublevelLeft_subset X Y f b b' y y') → + (⟨z', hz'⟩ : segment ℝ y.val y'.val) ∈ setOfPred_sublevelLeft_subset X Y f b b' y y') → ∃ hz' : z' ∈ segment ℝ y.val y'.val, x ∈ sublevelLeft X f b' z' - ∧ (⟨z', hz'⟩ : segment ℝ y.val y'.val) ∈ setOf_sublevelLeft_subset X Y f b b' y y' by + ∧ (⟨z', hz'⟩ : segment ℝ y.val y'.val) ∈ setOfPred_sublevelLeft_subset X Y f b b' y y' by obtain ⟨z', hz', hxz'1, hxz'2⟩ := hz.mp this |>.exists exact ⟨⟨z', hz'⟩, ⟨hxz'2, hxz'1⟩⟩ exact hfx.mp <| .of_forall fun z hzt' ⟨hz, hz'⟩ ↦ ⟨hz, ⟨hzt'.le, hz'⟩⟩ +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_sublevelLeft_subset := isClosed_setOfPred_sublevelLeft_subset + variable [DenselyOrdered β] variable [IsTopologicalAddGroup F] [ContinuousSMul ℝ F] @@ -241,15 +247,15 @@ public theorem exists_lt_iInf_of_lt_iInf_of_sup obtain ⟨t', htt', ht'⟩ := exists_between (ht a ha) lift y1 to Y using hy1 lift y2 to Y using hy2 - let J1 := setOf_sublevelLeft_subset X Y f t t' y1 y2 + let J1 := setOfPred_sublevelLeft_subset X Y f t t' y1 y2 have mem_J1_iff (z : segment ℝ (y1 : F) y2) : z ∈ J1 ↔ sublevelLeft X f t z ⊆ sublevelLeft X f t' y1 := by - simp [J1, setOf_sublevelLeft_subset] + simp [J1, setOfPred_sublevelLeft_subset] let φ : segment ℝ (y1 : F) y2 ≃ₜ segment ℝ (y2 : F) y1 := .setCongr (segment_symm ℝ (y1 : F) y2) - let J2 := φ ⁻¹' (setOf_sublevelLeft_subset X Y f t t' y2 y1) + let J2 := φ ⁻¹' (setOfPred_sublevelLeft_subset X Y f t t' y2 y1) have mem_J2_iff (z : segment ℝ (y1 : F) y2) : z ∈ J2 ↔ sublevelLeft X f t z ⊆ sublevelLeft X f t' y2 := by - simp [J2, setOf_sublevelLeft_subset, φ, Homeomorph.setCongr] + simp [J2, setOfPred_sublevelLeft_subset, φ, Homeomorph.setCongr] have h_mem_Y (z : segment ℝ (y1 : F) y2) : (z : F) ∈ Y := cY.segment_subset y1.2 y2.2 z.prop have hJ1J2 : J1 ∩ J2 = ∅ := by rw [Set.eq_empty_iff_forall_notMem] @@ -268,11 +274,11 @@ public theorem exists_lt_iInf_of_lt_iInf_of_sup have this : IsPreconnected (Set.univ : Set (segment ℝ (y1 : F) y2)) := by simpa [← Topology.IsInducing.subtypeVal.isPreconnected_image] using (convex_segment (y1 : F) y2).isPreconnected - have hJ1 : IsClosed J1 := isClosed_setOf_sublevelLeft_subset ne_X kX hfy hfy' + have hJ1 : IsClosed J1 := isClosed_setOfPred_sublevelLeft_subset ne_X kX hfy hfy' cY hfx hfx' a t t' y1 y2 ha' hinfi_le ht' htt' have hJ2 : IsClosed J2 := by simp only [sup_comm (f _ y1)] at ha' ht' - simpa [J2, sup_comm] using isClosed_setOf_sublevelLeft_subset ne_X kX hfy hfy' + simpa [J2, sup_comm] using isClosed_setOfPred_sublevelLeft_subset ne_X kX hfy hfy' cY hfx hfx' a t t' y2 y1 ha' hinfi_le ht' htt' have h_univ : univ ⊆ J1 ∪ J2 := image_subset_image_iff Subtype.val_injective |>.mp <| by simp [hJ1_union_J2] @@ -353,12 +359,12 @@ public theorem minimax rcases eq_empty_or_nonempty Y with ⟨rfl⟩ | ne_Y · -- the case when `Y` is empty is trivial simp only [mem_empty_iff_false, IsEmpty.forall_iff, implies_true, false_and, exists_const, - setOf_false, isLUB_empty_iff] at * + ofPred_false, isLUB_empty_iff] at * replace hsup_y : ∀ x ∈ X, sup_y x = sup_inf := fun x hx ↦ le_antisymm (hsup_y x hx sup_inf) (hsup_inf (sup_y x)) suffices {t | ∃ x ∈ X, sup_y x = t} = {sup_inf} from (this ▸ hinf_sup).unique (by simp) |>.le ext t - simp only [mem_setOf_eq, mem_singleton_iff] + simp only [mem_ofPred_eq, mem_singleton_iff] constructor · rintro ⟨x, hx, rfl⟩ exact hsup_y x hx @@ -374,7 +380,7 @@ public theorem minimax simp only [mem_iInter, mem_preimage, mem_Iic] at hx' rw [lt_isGLB_iff hinf_sup] at ht obtain ⟨c, hc, htc⟩ := ht - simp only [mem_lowerBounds, mem_setOf_eq, forall_exists_index, and_imp, + simp only [mem_lowerBounds, mem_ofPred_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] at hc apply not_le.mpr htc (le_trans (hc x hx) _) rw [isLUB_le_iff (hsup_y x hx), mem_upperBounds] @@ -388,7 +394,7 @@ public theorem minimax ne_X kX hfy hfy' cY hfx hfx' cX (t := t) (toFinite _) (Subtype.coe_image_subset Y ↑s) - simp only [lt_isLUB_iff hsup_inf, mem_setOf_eq, exists_exists_and_eq_and] + simp only [lt_isLUB_iff hsup_inf, mem_ofPred_eq, exists_exists_and_eq_and] use y0 hs', hy0 hs' specialize ht0 hs' obtain ⟨a, ha, h⟩ := LowerSemicontinuousOn.exists_isMinOn ne_X kX (hfy (y0 hs') (hy0 hs')) diff --git a/Mathlib/Topology/Sober.lean b/Mathlib/Topology/Sober.lean index 30a25e0eba280b..5b668974bf36f3 100644 --- a/Mathlib/Topology/Sober.lean +++ b/Mathlib/Topology/Sober.lean @@ -98,7 +98,7 @@ theorem isGenericPoint_iff_forall_closed (hS : IsClosed S) (hxS : x ∈ S) : IsGenericPoint x S ↔ ∀ Z : Set α, IsClosed Z → x ∈ Z → S ⊆ Z := by have : closure {x} ⊆ S := closure_minimal (singleton_subset_iff.2 hxS) hS simp_rw [IsGenericPoint, subset_antisymm_iff, this, true_and, closure, subset_sInter_iff, - mem_setOf_eq, and_imp, singleton_subset_iff] + mem_ofPred_eq, and_imp, singleton_subset_iff] end genericPoint diff --git a/Mathlib/Topology/Spectral/ConstructibleTopology.lean b/Mathlib/Topology/Spectral/ConstructibleTopology.lean index 307c535b393481..c0e912fdf18cb3 100644 --- a/Mathlib/Topology/Spectral/ConstructibleTopology.lean +++ b/Mathlib/Topology/Spectral/ConstructibleTopology.lean @@ -117,7 +117,7 @@ instance compactSpace_withConstructibleTopology [CompactSpace X] [QuasiSober X] have hZ_closed : IsClosed Z := isClosed_sInter fun b hb ↦ hb.2 have hZ_nonempty : Z.Nonempty := CompactSpace.nonempty_sInter (fun _ ht ↦ ht.2) fun t ht hf ↦ - hB.prop.2.1 _ (subset_trans ht (by simp [B'])) hf + hB.prop.2.1 _ (subset_trans ht fun _ hx ↦ hx.1) hf by_cases hZ_irred : IsIrreducible Z · -- If `Z` is irreducible, the intersection `⋂₀ B` contains the generic point of `Z`. suffices (⋂₀ B).Nonempty by simp_all [hB.prop.2.2] diff --git a/Mathlib/Topology/Spectral/Prespectral.lean b/Mathlib/Topology/Spectral/Prespectral.lean index c259887f6e8c49..2e41be46b31be5 100644 --- a/Mathlib/Topology/Spectral/Prespectral.lean +++ b/Mathlib/Topology/Spectral/Prespectral.lean @@ -62,14 +62,14 @@ lemma PrespectralSpace.of_isOpenCover {ι : Type*} {U : ι → Opens X} (hU : IsOpenCover U) [∀ i, PrespectralSpace (U i)] : PrespectralSpace X := by refine .of_isTopologicalBasis (hU.isTopologicalBasis fun i ↦ isTopologicalBasis) ?_ - simp only [Set.mem_iUnion, Set.mem_image, Set.mem_setOf_eq, forall_exists_index, and_imp, + simp only [Set.mem_iUnion, Set.mem_image, Set.mem_ofPred_eq, forall_exists_index, and_imp, forall_comm (α := Set _), forall_apply_eq_imp_iff₂] exact fun i V hV hV' ↦ hV'.image continuous_subtype_val lemma PrespectralSpace.of_isInducing [PrespectralSpace Y] (f : X → Y) (hf : IsInducing f) (hf' : IsSpectralMap f) : PrespectralSpace X := .of_isTopologicalBasis (PrespectralSpace.isTopologicalBasis.isInducing hf) (by - simp only [Set.mem_image, Set.mem_setOf_eq, forall_exists_index, and_imp] + simp only [Set.mem_image, Set.mem_ofPred_eq, forall_exists_index, and_imp] rintro _ U h₁ h₂ rfl exact hf'.isCompact_preimage_of_isOpen h₁ h₂) @@ -84,7 +84,8 @@ lemma Topology.IsOpenEmbedding.prespectralSpace [PrespectralSpace Y] {f : X → Y} (hf : IsOpenEmbedding f) : PrespectralSpace X where isTopologicalBasis := by - apply isTopologicalBasis_of_isOpen_of_nhds (fun U hU ↦ hU.1) <| fun x U hx hU ↦ ?_ + apply isTopologicalBasis_of_isOpen_of_nhds (s := {U : Set X | IsOpen U ∧ IsCompact U}) + (fun U hU ↦ hU.1) <| fun x U hx hU ↦ ?_ obtain ⟨V, ⟨hoV, hcV⟩, hfx, hVf⟩ : ∃ V ∈ {V | IsOpen V ∧ IsCompact V}, f x ∈ V ∧ V ⊆ f '' U := (PrespectralSpace.isTopologicalBasis (X := Y)).isOpen_iff.mp (hf.isOpen_iff_image_isOpen.mp hU) (f x) ⟨x, hx, rfl⟩ @@ -103,7 +104,9 @@ variable (X) in lemma PrespectralSpace.isBasis_opens [PrespectralSpace X] : TopologicalSpace.Opens.IsBasis { U : Opens X | IsCompact (U : Set X) } := by dsimp only [TopologicalSpace.Opens.IsBasis] - convert! isTopologicalBasis (X := X) + suffices h : SetLike.coe '' {U : Opens X | IsCompact (U : Set X)} = + {U : Set X | IsOpen U ∧ IsCompact U} by + rw [h]; exact isTopologicalBasis (X := X) ext s exact ⟨fun ⟨V, hV, heq⟩ ↦ heq ▸ ⟨V.2, hV⟩, fun h ↦ ⟨⟨s, h.1⟩, h.2, rfl⟩⟩ diff --git a/Mathlib/Topology/UniformSpace/Basic.lean b/Mathlib/Topology/UniformSpace/Basic.lean index 17bb184e5be4b0..8d63a23ef8d1e4 100644 --- a/Mathlib/Topology/UniformSpace/Basic.lean +++ b/Mathlib/Topology/UniformSpace/Basic.lean @@ -63,7 +63,7 @@ lemma IsOpen.relInv [TopologicalSpace α] [TopologicalSpace β] lemma IsOpen.relImage [TopologicalSpace α] [TopologicalSpace β] {s : SetRel α β} (hs : IsOpen s) {t : Set α} : IsOpen (s.image t) := by - simp_rw [SetRel.image, ← exists_prop, Set.setOf_exists] + simp_rw [SetRel.image, ← exists_prop, Set.ofPred_exists] exact isOpen_biUnion fun _ _ => hs.preimage <| .prodMk_right _ lemma IsOpen.relPreimage [TopologicalSpace α] [TopologicalSpace β] @@ -76,7 +76,7 @@ lemma IsClosed.relInv [TopologicalSpace α] [TopologicalSpace β] lemma IsClosed.relImage_of_finite [TopologicalSpace α] [TopologicalSpace β] {s : SetRel α β} (hs : IsClosed s) {t : Set α} (ht : t.Finite) : IsClosed (s.image t) := by - simp_rw [SetRel.image, ← exists_prop, Set.setOf_exists] + simp_rw [SetRel.image, ← exists_prop, Set.ofPred_exists] exact ht.isClosed_biUnion fun _ _ => hs.preimage <| .prodMk_right _ lemma IsClosed.relPreimage_of_finite [TopologicalSpace α] [TopologicalSpace β] @@ -201,7 +201,7 @@ theorem closure_eq_uniformity (s : Set <| α × α) : closure s = ⋂ V ∈ {V | V ∈ 𝓤 α ∧ SetRel.IsSymm V}, V ○ s ○ V := by ext ⟨x, y⟩ simp +contextual only - [mem_closure_iff_nhds_basis (UniformSpace.hasBasis_nhds_prod x y), mem_iInter, mem_setOf_eq, + [mem_closure_iff_nhds_basis (UniformSpace.hasBasis_nhds_prod x y), mem_iInter, mem_ofPred_eq, and_imp, mem_comp_comp, ← mem_inter_iff, inter_comm, Set.Nonempty] theorem uniformity_hasBasis_closed : @@ -785,7 +785,7 @@ theorem entourageProd_mem_uniformity [t₁ : UniformSpace α] [t₂ : UniformSpa theorem ball_entourageProd (u : SetRel α α) (v : SetRel β β) (x : α × β) : ball x (entourageProd u v) = ball x.1 u ×ˢ ball x.2 v := by - ext p; simp only [ball, entourageProd, Set.mem_setOf_eq, Set.mem_prod, Set.mem_preimage] + ext p; simp only [ball, entourageProd, Set.mem_ofPred_eq, Set.mem_prod, Set.mem_preimage] instance IsSymm_entourageProd {u : SetRel α α} {v : SetRel β β} [u.IsSymm] [v.IsSymm] : (entourageProd u v).IsSymm where diff --git a/Mathlib/Topology/UniformSpace/Cauchy.lean b/Mathlib/Topology/UniformSpace/Cauchy.lean index 74fd21c99e4b5b..17d7fc7e007c2b 100644 --- a/Mathlib/Topology/UniformSpace/Cauchy.lean +++ b/Mathlib/Topology/UniformSpace/Cauchy.lean @@ -550,7 +550,8 @@ theorem Filter.TotallyBounded.mono {f g : Filter α} (h : f ≤ g) (hg : g.Total f.TotallyBounded := fun U hU => (hg U hU).imp fun _ => And.imp_right (@h _) -theorem Filter.TotallyBounded.totallyBounded_setOf_clusterPt {f : Filter α} (h : f.TotallyBounded) : +theorem Filter.TotallyBounded.totallyBounded_setOfPred_clusterPt {f : Filter α} + (h : f.TotallyBounded) : TotallyBounded {x | ClusterPt x f} := by refine uniformity_hasBasis_closed.totallyBounded_iff.2 fun V hV => ?_ obtain ⟨t, htf, hst⟩ := h V hV.1 @@ -558,10 +559,14 @@ theorem Filter.TotallyBounded.totallyBounded_setOf_clusterPt {f : Filter α} (h rw [← SetRel.preimage_eq_biUnion, id, ← (hV.2.relPreimage_of_finite htf).closure_eq] exact hx.mem_closure_of_mem _ hst +@[deprecated (since := "2026-07-09")] +alias Filter.TotallyBounded.totallyBounded_setOf_clusterPt := + Filter.TotallyBounded.totallyBounded_setOfPred_clusterPt + /-- The closure of a totally bounded set is totally bounded. -/ theorem TotallyBounded.closure {s : Set α} (h : TotallyBounded s) : TotallyBounded (closure s) := by rw [closure_eq_cluster_pts] - exact (Filter.totallyBounded_principal_iff.mpr h).totallyBounded_setOf_clusterPt + exact (Filter.totallyBounded_principal_iff.mpr h).totallyBounded_setOfPred_clusterPt @[simp] lemma totallyBounded_closure {s : Set α} : TotallyBounded (closure s) ↔ TotallyBounded s := @@ -749,9 +754,13 @@ theorem TotallyBounded.isCompact_of_isComplete {s : Set α} (ht : TotallyBounded theorem TotallyBounded.isCompact_of_isClosed [CompleteSpace α] {s : Set α} (ht : TotallyBounded s) (hc : IsClosed s) : IsCompact s := ht.isCompact_of_isComplete hc.isComplete -theorem Filter.TotallyBounded.isCompact_setOf_clusterPt +theorem Filter.TotallyBounded.isCompact_setOfPred_clusterPt [CompleteSpace α] {f : Filter α} (hf : f.TotallyBounded) : IsCompact {x | ClusterPt x f} := - hf.totallyBounded_setOf_clusterPt.isCompact_of_isClosed isClosed_setOf_clusterPt + hf.totallyBounded_setOfPred_clusterPt.isCompact_of_isClosed isClosed_setOfPred_clusterPt + +@[deprecated (since := "2026-07-09")] +alias Filter.TotallyBounded.isCompact_setOf_clusterPt := + Filter.TotallyBounded.isCompact_setOfPred_clusterPt theorem Filter.TotallyBounded.exists_clusterPt [CompleteSpace α] {f : Filter α} [f.NeBot] (hf : f.TotallyBounded) : ∃ x, ClusterPt x f := by diff --git a/Mathlib/Topology/UniformSpace/Closeds.lean b/Mathlib/Topology/UniformSpace/Closeds.lean index 9306374ea70f17..e1e4444cc16b8d 100644 --- a/Mathlib/Topology/UniformSpace/Closeds.lean +++ b/Mathlib/Topology/UniformSpace/Closeds.lean @@ -163,7 +163,7 @@ theorem isOpen_inter_nonempty_of_isOpen {U : Set α} (hU : IsOpen U) : /-- In the Hausdorff uniformity, the powerset of a closed set is closed. -/ theorem _root_.IsClosed.powerset_hausdorff {F : Set α} (hF : IsClosed F) : IsClosed F.powerset := by - simp_rw [Set.powerset, ← isOpen_compl_iff, Set.compl_setOf, ← Set.inter_compl_nonempty_iff] + simp_rw [Set.powerset, ← isOpen_compl_iff, Set.compl_ofPred, ← Set.inter_compl_nonempty_iff] exact isOpen_inter_nonempty_of_isOpen hF.isOpen_compl @[deprecated (since := "2025-11-23")] alias isClosed_powerset := IsClosed.powerset_hausdorff @@ -233,7 +233,7 @@ theorem isUniformInducing_closure : IsUniformInducing (closure (X := α)) := by theorem nhds_closure (s : Set α) : 𝓝 (closure s) = 𝓝 s := by simp_rw +singlePass [isUniformInducing_closure.isInducing.nhds_eq_comap, closure_closure] -theorem isClosed_setOf_totallyBounded : IsClosed {s : Set α | TotallyBounded s} := by +theorem isClosed_setOfPred_totallyBounded : IsClosed {s : Set α | TotallyBounded s} := by simp_rw [isClosed_iff_frequently, nhds_eq_comap_uniformity] intro s hs U hU obtain ⟨V : SetRel α α, hV, hVU⟩ := comp_mem_uniformity_sets hU @@ -245,6 +245,9 @@ theorem isClosed_setOf_totallyBounded : IsClosed {s : Set α | TotallyBounded s} simp [Set.subset_def] grind +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_totallyBounded := isClosed_setOfPred_totallyBounded + instance [DiscreteUniformity α] : DiscreteUniformity (Set α) := by rw [discreteUniformity_iff_setRelId_mem_uniformity] convert! Filter.mem_lift' (DiscreteUniformity.relId_mem_uniformity α) @@ -272,7 +275,7 @@ theorem IsUniformInducing.image_hausdorff {f : α → β} (hf : IsUniformInducin Filter.comap_lift'_eq2 monotone_hausdorffEntourage] congr with U ⟨s, t⟩ simp only [Function.comp, hausdorffEntourage, SetRel.preimage, SetRel.image, Set.preimage, - Set.mem_setOf, Set.image_subset_iff, Set.exists_mem_image] + Set.mem_ofPred, Set.image_subset_iff, Set.exists_mem_image] /-- When `Set` is equipped with the Hausdorff uniformity, taking the image under a uniform embedding is a uniform embedding. -/ @@ -285,7 +288,7 @@ theorem IsUniformEmbedding.image_hausdorff {f : α → β} (hf : IsUniformEmbedd theorem TotallyBounded.powerset_hausdorff {t : Set α} (ht : TotallyBounded t) : TotallyBounded t.powerset := by simp_rw [(𝓤 α).basis_sets.uniformity_hausdorff.totallyBounded_iff, Function.comp_id, - Set.powerset, Set.setOf_subset, Set.mem_iUnion] + Set.powerset, Set.ofPred_subset, Set.mem_iUnion] intro (U : SetRel α α) hU obtain ⟨u, hu, ht⟩ := ht U hU refine ⟨u.powerset, hu.powerset, fun s hs => ⟨u ∩ U.image s, by grind, fun x hx => ?_, @@ -300,7 +303,7 @@ theorem TotallyBounded.nhds_vietoris_le_nhds_hausdorff {s : Set α} (hs : Totall open UniformSpace TopologicalSpace.vietoris in simp_rw [nhds_eq_comap_uniformity, uniformity_hasBasis_open.uniformity_hausdorff |>.comap _ |>.ge_iff, Function.comp_id, - hausdorffEntourage, Set.preimage_setOf_eq, Set.setOf_and] + hausdorffEntourage, Set.preimage_ofPred_eq, Set.ofPred_and] intro U ⟨hU₁, hU₂⟩ have : U.IsRefl := ⟨fun _ => refl_mem_uniformity hU₁⟩ let := TopologicalSpace.vietoris α @@ -379,8 +382,11 @@ theorem totallyBounded_subsets_of_totallyBounded {t : Set α} (ht : TotallyBound TotallyBounded {F : Closeds α | ↑F ⊆ t} := totallyBounded_preimage isUniformEmbedding_coe.isUniformInducing ht.powerset_hausdorff -theorem isClosed_setOf_totallyBounded : IsClosed {s : Closeds α | TotallyBounded (s : Set α)} := - UniformSpace.hausdorff.isClosed_setOf_totallyBounded.preimage uniformContinuous_coe.continuous +theorem isClosed_setOfPred_totallyBounded : IsClosed {s : Closeds α | TotallyBounded (s : Set α)} := + UniformSpace.hausdorff.isClosed_setOfPred_totallyBounded.preimage uniformContinuous_coe.continuous + +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_totallyBounded := isClosed_setOfPred_totallyBounded instance [DiscreteUniformity α] : DiscreteUniformity (Closeds α) := isUniformEmbedding_coe.discreteUniformity @@ -478,8 +484,8 @@ theorem compactSpace_iff : CompactSpace (Closeds α) ↔ CompactSpace α := by (fun i => {C : Closeds α | ↑C ⊆ F i}) (fun i => isClosed_subsets_of_isClosed (hF₁ i)) simp_rw [← Set.disjoint_iff_inter_eq_empty, Set.disjoint_compl_left_iff_subset, - ← Set.setOf_forall, ← Set.subset_iInter_iff, hF₂, Set.subset_empty_iff, coe_eq_empty, - Set.setOf_eq_eq_singleton] at this + ← Set.ofPred_forall, ← Set.subset_iInter_iff, hF₂, Set.subset_empty_iff, coe_eq_empty, + Set.ofPred_eq_eq_singleton] at this obtain ⟨s, hs⟩ := this .rfl specialize @hs ⟨⋂ i ∈ s, F i, isClosed_biInter fun i _ => hF₁ i⟩ .rfl exact ⟨s, congr($hs)⟩ @@ -535,10 +541,12 @@ theorem isClosedEmbedding_toCloseds [T2Space α] [CompleteSpace α] : IsClosedEmbedding (toCloseds (α := α)) where __ := isEmbedding_toCloseds isClosed_range := by - convert! Closeds.isClosed_setOf_totallyBounded - exact subset_antisymm - (Set.range_subset_iff.mpr fun K => K.isCompact.totallyBounded) - (fun K hK => ⟨⟨K, hK.isCompact_of_isClosed K.isClosed⟩, rfl⟩) + have : Set.range (toCloseds (α := α)) = {s : Closeds α | TotallyBounded (s : Set α)} := + subset_antisymm + (Set.range_subset_iff.mpr fun K : Compacts α => K.isCompact.totallyBounded) + (fun (K : Closeds α) hK => ⟨⟨K, hK.isCompact_of_isClosed K.isClosed⟩, rfl⟩) + rw [this] + exact Closeds.isClosed_setOfPred_totallyBounded theorem totallyBounded_subsets_of_totallyBounded {t : Set α} (ht : TotallyBounded t) : TotallyBounded {K : Compacts α | ↑K ⊆ t} := @@ -608,7 +616,7 @@ instance [CompleteSpace α] : CompleteSpace (Compacts α) := by rw [Set.iUnion₂_subset_iff] intro K' ⟨_, (hK' : ↑K' ⊆ V.preimage K)⟩ grw [← hVU, SetRel.preimage_comp, ← ht₂, hK'] - let L : Compacts α := ⟨{x | ClusterPt x l}, hl.isCompact_setOf_clusterPt⟩ + let L : Compacts α := ⟨{x | ClusterPt x l}, hl.isCompact_setOfPred_clusterPt⟩ exists L simp_rw [nhds_eq_comap_uniformity'] rw [uniformity_hasBasis_closed.uniformity_compacts.comap _ |>.ge_iff] diff --git a/Mathlib/Topology/UniformSpace/CompactConvergence.lean b/Mathlib/Topology/UniformSpace/CompactConvergence.lean index 4406312173f31f..bf83bd7aaa24be 100644 --- a/Mathlib/Topology/UniformSpace/CompactConvergence.lean +++ b/Mathlib/Topology/UniformSpace/CompactConvergence.lean @@ -283,7 +283,8 @@ theorem isUniformEmbedding_comp (g : C(β, δ)) (hg : IsUniformEmbedding g) : theorem uniformContinuous_comp_left (g : C(α, γ)) : UniformContinuous (fun f ↦ f.comp g : C(γ, β) → C(α, β)) := isUniformEmbedding_toUniformOnFunIsCompact.uniformContinuous_iff.mpr <| - UniformOnFun.precomp_uniformContinuous (fun _ hK ↦ hK.image g.continuous) |>.comp + UniformOnFun.precomp_uniformContinuous (𝔗 := {K : Set α | IsCompact K}) + (fun _ (hK : IsCompact _) ↦ hK.image g.continuous) |>.comp isUniformEmbedding_toUniformOnFunIsCompact.uniformContinuous /-- Any pair of a homeomorphism `X ≃ₜ Z` and an isomorphism `Y ≃ᵤ T` of uniform spaces gives rise @@ -405,7 +406,7 @@ theorem uniformSpace_eq_iInf_precomp_of_cover {δ : ι → Type*} [∀ i, Topolo have h_cover' : ∀ S ∈ 𝔖, ∃ I : Set ι, I.Finite ∧ S ⊆ ⋃ i ∈ I, range (φ i) := fun S hS ↦ by refine ⟨{i | (range (φ i) ∩ S).Nonempty}, h_lf.finite_nonempty_inter_compact hS, inter_eq_right.mp ?_⟩ - simp_rw [iUnion₂_inter, mem_setOf, iUnion_nonempty_self, ← iUnion_inter, h_cover, univ_inter] + simp_rw [iUnion₂_inter, mem_ofPred, iUnion_nonempty_self, ← iUnion_inter, h_cover, univ_inter] -- ... and we just pull it back. simp_rw +zetaDelta [compactConvergenceUniformSpace, replaceTopology_eq, UniformOnFun.uniformSpace_eq_iInf_precomp_of_cover _ _ _ h_image h_preimage h_cover', @@ -426,7 +427,7 @@ instance instCompleteSpaceOfCompactlyCoherentSpace [CompactlyCoherentSpace α] : rw [completeSpace_iff_isComplete_range isUniformEmbedding_toUniformOnFunIsCompact.isUniformInducing, range_toUniformOnFunIsCompact, ← completeSpace_coe_iff_isComplete] - exact (UniformOnFun.isClosed_setOf_continuous + exact (UniformOnFun.isClosed_setOfPred_continuous CompactlyCoherentSpace.isCoherentWith).completeSpace_coe end CompleteSpace @@ -439,7 +440,7 @@ Note that this set does not have to be a closed set when `β` is not T0. This lemma is useful to prove that, e.g., the space of paths between two points and the space of homotopies between two continuous maps are complete spaces, without assuming that the codomain is a Hausdorff space. -/ -theorem isComplete_setOf_eqOn [CompleteSpace C(α, β)] (f : α → β) (s : Set α) : +theorem isComplete_setOfPred_eqOn [CompleteSpace C(α, β)] (f : α → β) (s : Set α) : IsComplete {g : C(α, β) | EqOn g f s} := by classical intro l hlc hlf @@ -456,4 +457,6 @@ theorem isComplete_setOf_eqOn [CompleteSpace C(α, β)] (f : α → β) (s : Set refine ⟨g, Set.piecewise_eqOn _ _ _, hf'.trans_eq ?_⟩ rwa [eq_comm, ← Inseparable, ← inseparable_coe, inseparable_pi] +@[deprecated (since := "2026-07-09")] alias isComplete_setOf_eqOn := isComplete_setOfPred_eqOn + end ContinuousMap diff --git a/Mathlib/Topology/UniformSpace/Completion.lean b/Mathlib/Topology/UniformSpace/Completion.lean index de432525d28e07..71b55c667e8fd1 100644 --- a/Mathlib/Topology/UniformSpace/Completion.lean +++ b/Mathlib/Topology/UniformSpace/Completion.lean @@ -75,7 +75,7 @@ def gen (s : SetRel α α) : SetRel (CauchyFilter α) (CauchyFilter α) := { p | s ∈ p.1.val ×ˢ p.2.val } theorem monotone_gen : Monotone (gen : SetRel α α → _) := - monotone_setOf fun p => @Filter.monotone_mem _ (p.1.val ×ˢ p.2.val) + monotone_ofPred fun p => @Filter.monotone_mem _ (p.1.val ×ˢ p.2.val) -- Porting note: this was a calc proof, but I could not make it work private theorem symm_gen : map Prod.swap ((𝓤 α).lift' gen) ≤ (𝓤 α).lift' gen := by @@ -83,12 +83,12 @@ private theorem symm_gen : map Prod.swap ((𝓤 α).lift' gen) ≤ (𝓤 α).lif { p : CauchyFilter α × CauchyFilter α | s ∈ (p.2.val ×ˢ p.1.val : Filter (α × α)) } have h₁ : map Prod.swap ((𝓤 α).lift' gen) = (𝓤 α).lift' f := by delta gen - simp [f, map_lift'_eq, monotone_setOf, Filter.monotone_mem, Function.comp_def, + simp [f, map_lift'_eq, monotone_ofPred, Filter.monotone_mem, Function.comp_def, image_swap_eq_preimage_swap] have h₂ : (𝓤 α).lift' f ≤ (𝓤 α).lift' gen := uniformity_lift_le_swap (monotone_principal.comp - (monotone_setOf fun p => @Filter.monotone_mem _ (p.2.val ×ˢ p.1.val))) + (monotone_ofPred fun p => @Filter.monotone_mem _ (p.2.val ×ˢ p.1.val))) (by have h := fun p : CauchyFilter α × CauchyFilter α => @Filter.prod_comm _ _ p.2.val p.1.val simp only [Function.comp, h, mem_map, f] @@ -173,7 +173,7 @@ theorem denseRange_pureCauchy : DenseRange (pureCauchy : α → CauchyFilter α) ht'₂ <| SetRel.prodMk_mem_comp (@h (a, x) ⟨h₁, hx⟩) h₂⟩ ⟨x, ht''₂ <| by dsimp [gen]; exact this⟩ simp only [closure_eq_cluster_pts, ClusterPt, nhds_eq_uniformity, lift'_inf_principal_eq, - Set.inter_comm _ (range pureCauchy), mem_setOf_eq] + Set.inter_comm _ (range pureCauchy), mem_ofPred_eq] refine (lift'_neBot_iff ?_).mpr (fun s hs => ?_) · exact monotone_const.inter monotone_preimage · let ⟨y, hy⟩ := h_ex s hs diff --git a/Mathlib/Topology/UniformSpace/Defs.lean b/Mathlib/Topology/UniformSpace/Defs.lean index 17cc02dd2e4d84..10ba9241a5b590 100644 --- a/Mathlib/Topology/UniformSpace/Defs.lean +++ b/Mathlib/Topology/UniformSpace/Defs.lean @@ -500,7 +500,7 @@ theorem mem_nhds_uniformity_iff_right {x : α} {s : Set α} : theorem mem_nhds_uniformity_iff_left {x : α} {s : Set α} : s ∈ 𝓝 x ↔ { p : α × α | p.2 = x → p.1 ∈ s } ∈ 𝓤 α := by rw [uniformity_eq_symm, mem_nhds_uniformity_iff_right] - simp only [mem_map, preimage_setOf_eq, Prod.snd_swap, Prod.fst_swap] + simp only [mem_map, preimage_ofPred_eq, Prod.snd_swap, Prod.fst_swap] theorem nhdsWithin_eq_comap_uniformity_of_mem {x : α} {T : Set α} (hx : x ∈ T) (S : Set α) : 𝓝[S] x = (𝓤 α ⊓ 𝓟 (T ×ˢ S)).comap (Prod.mk x) := by diff --git a/Mathlib/Topology/UniformSpace/DiscreteUniformity.lean b/Mathlib/Topology/UniformSpace/DiscreteUniformity.lean index e9e3813a70882c..30186a0ca1954c 100644 --- a/Mathlib/Topology/UniformSpace/DiscreteUniformity.lean +++ b/Mathlib/Topology/UniformSpace/DiscreteUniformity.lean @@ -78,7 +78,7 @@ variable {X} in instance {Y : Type*} [UniformSpace Y] [DiscreteUniformity Y] : DiscreteUniformity (X × Y) := by simp [discreteUniformity_iff_eq_principal_setRelId, uniformity_prod_eq_comap_prod, - eq_principal_setRelId, SetRel.id, Set.prod_eq, Prod.ext_iff, Set.setOf_and] + eq_principal_setRelId, SetRel.id, Set.prod_eq, Prod.ext_iff, Set.ofPred_and] variable {x} in /-- On a space with a discrete uniformity, any function is uniformly continuous. -/ diff --git a/Mathlib/Topology/UniformSpace/Equicontinuity.lean b/Mathlib/Topology/UniformSpace/Equicontinuity.lean index 65e2ca29f6eaae..c13f968f195452 100644 --- a/Mathlib/Topology/UniformSpace/Equicontinuity.lean +++ b/Mathlib/Topology/UniformSpace/Equicontinuity.lean @@ -977,12 +977,15 @@ theorem EquicontinuousAt.tendsto_of_mem_closure {l : Filter ι} {F : ι → X /-- If `F : ι → X → α` is an equicontinuous family of functions, `f : X → α` is a continuous function, and `l` is a filter on `ι`, then `{x | Filter.Tendsto (F · x) l (𝓝 (f x))}` is a closed set. -/ -theorem Equicontinuous.isClosed_setOf_tendsto {l : Filter ι} {F : ι → X → α} {f : X → α} +theorem Equicontinuous.isClosed_setOfPred_tendsto {l : Filter ι} {F : ι → X → α} {f : X → α} (hF : Equicontinuous F) (hf : Continuous f) : IsClosed {x | Tendsto (F · x) l (𝓝 (f x))} := closure_subset_iff_isClosed.mp fun x hx ↦ (hF x).tendsto_of_mem_closure (hf.continuousAt.mono_left inf_le_left) (fun _ ↦ id) hx +@[deprecated (since := "2026-07-09")] +alias Equicontinuous.isClosed_setOf_tendsto := Equicontinuous.isClosed_setOfPred_tendsto + end end diff --git a/Mathlib/Topology/UniformSpace/OfFun.lean b/Mathlib/Topology/UniformSpace/OfFun.lean index 5cf81b8e13dbbb..ee0d8226936ff1 100644 --- a/Mathlib/Topology/UniformSpace/OfFun.lean +++ b/Mathlib/Topology/UniformSpace/OfFun.lean @@ -39,7 +39,7 @@ def ofFun [AddCommMonoid M] [PartialOrder M] { uniformity := ⨅ r > 0, 𝓟 { x | d x.1 x.2 < r } refl := le_iInf₂ fun r hr => principal_mono.2 <| by simp [Set.subset_def, *] symm := tendsto_iInf_iInf fun r => tendsto_iInf_iInf fun _ => tendsto_principal_principal.2 - fun x hx => by rwa [mem_setOf, symm] + fun x hx => by rwa [mem_ofPred, symm] comp := le_iInf₂ fun r hr => let ⟨δ, h0, hδr⟩ := half r hr; le_principal_iff.2 <| mem_of_superset (mem_lift' <| mem_iInf_of_mem δ <| mem_iInf_of_mem h0 <| mem_principal_self _) diff --git a/Mathlib/Topology/UniformSpace/Path.lean b/Mathlib/Topology/UniformSpace/Path.lean index da9af285d290ff..e02ce8da7fe7c2 100644 --- a/Mathlib/Topology/UniformSpace/Path.lean +++ b/Mathlib/Topology/UniformSpace/Path.lean @@ -79,6 +79,6 @@ theorem uniformContinuous_trans : is a complete uniform space. -/ instance instCompleteSpace [CompleteSpace X] : CompleteSpace (Path x y) := isUniformEmbedding_coe.completeSpace <| by simpa [Set.EqOn, range_coe] - using ContinuousMap.isComplete_setOf_eqOn (Function.update (fun _ : I ↦ y) 0 x) {0, 1} + using ContinuousMap.isComplete_setOfPred_eqOn (Function.update (fun _ : I ↦ y) 0 x) {0, 1} end Path diff --git a/Mathlib/Topology/UniformSpace/Pi.lean b/Mathlib/Topology/UniformSpace/Pi.lean index e16e31c44cdca3..fc2b794a72f7b8 100644 --- a/Mathlib/Topology/UniformSpace/Pi.lean +++ b/Mathlib/Topology/UniformSpace/Pi.lean @@ -130,7 +130,7 @@ protected theorem CompleteSpace.iInf {ι X : Type*} {u : ι → UniformSpace X} Filter.comap_comap, comp_def, const, Prod.eta, comap_id'] -- Hence, it suffices to show that its range, the diagonal, is closed in `Π i, (X, u i)`. simp_rw [@completeSpace_iff_isComplete_range _ _ (_) (_) _ this, range_const_eq_diagonal, - setOf_forall] + ofPred_forall] -- The separation of `t` ensures that this is the case in `Π i, (X, t)`, hence the result -- since the topology associated to each `u i` is finer than `t`. have : Pi.topologicalSpace (t₂ := fun i ↦ (u i).toTopologicalSpace) ≤ diff --git a/Mathlib/Topology/UniformSpace/ProdApproximation.lean b/Mathlib/Topology/UniformSpace/ProdApproximation.lean index 7ee1f6bc4a8a3c..2bc0d117b938a2 100644 --- a/Mathlib/Topology/UniformSpace/ProdApproximation.lean +++ b/Mathlib/Topology/UniformSpace/ProdApproximation.lean @@ -106,7 +106,7 @@ lemma denseRange_tensorHom [CompactSpace X] [T2Space X] [CompactSpace Y] obtain ⟨J, hJu, hJ'⟩ := (hasBasis_compactConvergenceUniformity_of_compact).mem_iff.mp this obtain ⟨n, g, h, hgh⟩ := exists_finite_sum_mul_approximation_of_mem_uniformity f hJu have hG := Set.mem_of_subset_of_mem hJ' (a := (f, tensorHom <| ∑ i, g i ⊗ₜ h i)) - simp only [Prod.forall, Set.mem_setOf_eq, forall_const] at hG + simp only [Prod.forall, Set.mem_ofPred_eq, forall_const] at hG simpa using ⟨_, hG <| by simpa [tensorHom] using hgh⟩ end prodMul diff --git a/Mathlib/Topology/UniformSpace/UniformConvergenceTopology.lean b/Mathlib/Topology/UniformSpace/UniformConvergenceTopology.lean index 57505e711eab51..0d6a3eac9b5b85 100644 --- a/Mathlib/Topology/UniformSpace/UniformConvergenceTopology.lean +++ b/Mathlib/Topology/UniformSpace/UniformConvergenceTopology.lean @@ -455,7 +455,7 @@ instance [T2Space β] : T2Space (α →ᵤ β) := protected theorem tendsto_iff_tendstoUniformly {F : ι → α →ᵤ β} {f : α →ᵤ β} : Tendsto F p (𝓝 f) ↔ TendstoUniformly (toFun ∘ F) (toFun f) p := by rw [(UniformFun.hasBasis_nhds α β f).tendsto_right_iff, TendstoUniformly] - simp only [mem_setOf, UniformFun.gen, Function.comp_def] + simp only [mem_ofPred, UniformFun.gen, Function.comp_def] set_option backward.isDefEq.respectTransparency false in /-- The natural bijection between `α → β × γ` and `(α → β) × (α → γ)`, upgraded to a uniform @@ -509,12 +509,15 @@ protected def uniformEquivPiComm : UniformEquiv (α →ᵤ ∀ i, δ i) (∀ i, /-- The set of continuous functions is closed in the uniform convergence topology. This is a simple wrapper over `TendstoUniformly.continuous`. -/ -theorem isClosed_setOf_continuous [TopologicalSpace α] : +theorem isClosed_setOfPred_continuous [TopologicalSpace α] : IsClosed {f : α →ᵤ β | Continuous (toFun f)} := by refine isClosed_iff_forall_filter.2 fun f u _ hu huf ↦ ?_ rw [← tendsto_id', UniformFun.tendsto_iff_tendstoUniformly] at huf exact huf.continuous <| Eventually.frequently (le_principal_iff.mp hu) +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_continuous := isClosed_setOfPred_continuous + variable {α} (β) in theorem uniformSpace_eq_inf_precomp_of_cover {δ₁ δ₂ : Type*} (φ₁ : δ₁ → α) (φ₂ : δ₂ → α) (h_cover : range φ₁ ∪ range φ₂ = univ) : @@ -761,7 +764,7 @@ protected theorem uniformity_eq_of_basis {ι : Sort*} {p : ι → Prop} {V : ι 𝓤 (α →ᵤ[𝔖] β) = ⨅ s ∈ 𝔖, ⨅ (i) (_ : p i), 𝓟 (UniformOnFun.gen 𝔖 s (V i)) := by simp_rw [iInf_uniformity, uniformity_comap, (UniformFun.hasBasis_uniformity_of_basis _ _ h).eq_biInf, comap_iInf, comap_principal, - Function.comp_apply, UniformFun.gen, Subtype.forall, UniformOnFun.gen, preimage_setOf_eq, + Function.comp_apply, UniformFun.gen, Subtype.forall, UniformOnFun.gen, preimage_ofPred_eq, Prod.map_fst, Prod.map_snd, Function.comp_apply, UniformFun.toFun_ofFun, restrict_apply] protected theorem uniformity_eq : 𝓤 (α →ᵤ[𝔖] β) = ⨅ s ∈ 𝔖, ⨅ V ∈ 𝓤 β, 𝓟 (UniformOnFun.gen 𝔖 s V) := @@ -781,7 +784,7 @@ protected theorem nhds_eq_of_basis {ι : Sort*} {p : ι → Prop} {V : ι → Se (h : (𝓤 β).HasBasis p V) (f : α →ᵤ[𝔖] β) : 𝓝 f = ⨅ s ∈ 𝔖, ⨅ (i) (_ : p i), 𝓟 {g | ∀ x ∈ s, (toFun 𝔖 f x, toFun 𝔖 g x) ∈ V i} := by simp_rw [nhds_eq_comap_uniformity, UniformOnFun.uniformity_eq_of_basis _ _ h, comap_iInf, - comap_principal, UniformOnFun.gen, preimage_setOf_eq] + comap_principal, UniformOnFun.gen, preimage_ofPred_eq] protected theorem nhds_eq (f : α →ᵤ[𝔖] β) : 𝓝 f = ⨅ s ∈ 𝔖, ⨅ V ∈ 𝓤 β, 𝓟 {g | ∀ x ∈ s, (toFun 𝔖 f x, toFun 𝔖 g x) ∈ V} := @@ -824,7 +827,7 @@ lemma uniformContinuous_ofFun_toFun (𝔗 : Set (Set α)) (h : ∀ s ∈ 𝔖, intro s hs obtain ⟨T, hT𝔗, hT, hsT⟩ := h s hs refine ⟨T, hT, hT𝔗, fun f hf ↦ ?_⟩ - simp only [UniformOnFun.gen, Set.mem_iInter, Set.mem_setOf_eq, Function.comp_apply] at hf ⊢ + simp only [UniformOnFun.gen, Set.mem_iInter, Set.mem_ofPred_eq, Function.comp_apply] at hf ⊢ intro x hx obtain ⟨t, ht, hxt⟩ := Set.mem_sUnion.mp <| hsT hx exact hf t ht x hxt @@ -1026,7 +1029,7 @@ of `TendstoUniformlyOn`) for all `S ∈ 𝔖`. -/ protected theorem tendsto_iff_tendstoUniformlyOn {F : ι → α →ᵤ[𝔖] β} {f : α →ᵤ[𝔖] β} : Tendsto F p (𝓝 f) ↔ ∀ s ∈ 𝔖, TendstoUniformlyOn (toFun 𝔖 ∘ F) (toFun 𝔖 f) p s := by simp only [UniformOnFun.nhds_eq, tendsto_iInf, tendsto_principal, TendstoUniformlyOn, - Function.comp_apply, mem_setOf] + Function.comp_apply, mem_ofPred] protected lemma continuous_rng_iff {X : Type*} [TopologicalSpace X] {f : X → (α →ᵤ[𝔖] β)} : Continuous f ↔ ∀ s ∈ 𝔖, @@ -1109,12 +1112,15 @@ protected def uniformEquivPiComm : (α →ᵤ[𝔖] ((i : ι) → δ i)) ≃ᵤ Then the set of continuous functions is closed in the topology of uniform convergence on the sets of `𝔖`. -/ -theorem isClosed_setOf_continuous [TopologicalSpace α] (h : IsCoherentWith 𝔖) : +theorem isClosed_setOfPred_continuous [TopologicalSpace α] (h : IsCoherentWith 𝔖) : IsClosed {f : α →ᵤ[𝔖] β | Continuous (toFun 𝔖 f)} := by refine isClosed_iff_forall_filter.2 fun f u _ hu huf ↦ h.continuous_iff.2 fun s hs ↦ ?_ rw [← tendsto_id', UniformOnFun.tendsto_iff_tendstoUniformlyOn] at huf exact (huf s hs).continuousOn <| Eventually.frequently <| hu fun _ ↦ Continuous.continuousOn +@[deprecated (since := "2026-07-09")] +alias isClosed_setOf_continuous := isClosed_setOfPred_continuous + variable (𝔖) in theorem uniformSpace_eq_inf_precomp_of_cover {δ₁ δ₂ : Type*} (φ₁ : δ₁ → α) (φ₂ : δ₂ → α) (𝔗₁ : Set (Set δ₁)) (𝔗₂ : Set (Set δ₂)) diff --git a/Mathlib/Topology/UniformSpace/UniformEmbedding.lean b/Mathlib/Topology/UniformSpace/UniformEmbedding.lean index 9a494e7eedb9ec..cefe4f07f63865 100644 --- a/Mathlib/Topology/UniformSpace/UniformEmbedding.lean +++ b/Mathlib/Topology/UniformSpace/UniformEmbedding.lean @@ -405,7 +405,7 @@ instance CompleteSpace.sum [CompleteSpace α] [CompleteSpace β] : CompleteSpace theorem IsUniformEmbedding.discreteUniformity [DiscreteUniformity β] {f : α → β} (hf : IsUniformEmbedding f) : DiscreteUniformity α := by simp_rw [discreteUniformity_iff_eq_principal_setRelId, ← hf.comap_uniformity, - DiscreteUniformity.eq_principal_setRelId, comap_principal, SetRel.id, preimage_setOf_eq, + DiscreteUniformity.eq_principal_setRelId, comap_principal, SetRel.id, preimage_ofPred_eq, hf.injective.eq_iff] end diff --git a/Mathlib/Topology/UrysohnsLemma.lean b/Mathlib/Topology/UrysohnsLemma.lean index aa2e075d08d5fc..31d65655f0cfb3 100644 --- a/Mathlib/Topology/UrysohnsLemma.lean +++ b/Mathlib/Topology/UrysohnsLemma.lean @@ -123,7 +123,7 @@ variable {P : Set X → Set X → Prop} /-- By assumption, for each `c : CU P` there exists an open set `u` such that `c.C ⊆ u` and `closure u ⊆ c.U`. `c.left` is the pair `(c.C, u)`. -/ @[simps C] -def left (c : CU P) : CU P where +noncomputable def left (c : CU P) : CU P where C := c.C U := (c.hP c.closed_C c.P_C_U c.open_U c.subset).choose closed_C := c.closed_C @@ -135,7 +135,7 @@ def left (c : CU P) : CU P where /-- By assumption, for each `c : CU P` there exists an open set `u` such that `c.C ⊆ u` and `closure u ⊆ c.U`. `c.right` is the pair `(closure u, c.U)`. -/ @[simps U] -def right (c : CU P) : CU P where +noncomputable def right (c : CU P) : CU P where C := closure (c.hP c.closed_C c.P_C_U c.open_U c.subset).choose U := c.U closed_C := isClosed_closure diff --git a/MathlibTest/DifferentialGeometry/Notation/Basic.lean b/MathlibTest/DifferentialGeometry/Notation/Basic.lean index 055a66b9f12458..34ebdba01e1cc5 100644 --- a/MathlibTest/DifferentialGeometry/Notation/Basic.lean +++ b/MathlibTest/DifferentialGeometry/Notation/Basic.lean @@ -1004,32 +1004,32 @@ variable {EM' : Type*} [NormedAddCommGroup EM'] {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] {f : M → M'} {s : Set M} -/-- info: setOf fun x ↦ MDifferentiableAt I I' f x : Set M -/ +/-- info: Set.ofPred fun x ↦ MDifferentiableAt I I' f x : Set M -/ #guard_msgs in #check {x | MDiffAt f x} -/-- info: setOf fun x ↦ MDifferentiableWithinAt I I' f s x : Set M -/ +/-- info: Set.ofPred fun x ↦ MDifferentiableWithinAt I I' f s x : Set M -/ #guard_msgs in #check {x | MDiffAt[s] f x} -/-- info: setOf fun x ↦ ContMDiffAt I I' Top.top f x : Set M -/ +/-- info: Set.ofPred fun x ↦ ContMDiffAt I I' Top.top f x : Set M -/ #guard_msgs in #check {x | CMDiffAt ⊤ f x} -/-- info: setOf fun x ↦ ContMDiffWithinAt I I' 2 f s x : Set M -/ +/-- info: Set.ofPred fun x ↦ ContMDiffWithinAt I I' 2 f s x : Set M -/ #guard_msgs in #check {x | CMDiffAt[s] 2 f x} open ContDiff in -- for the ∞ notation -/-- info: setOf fun x ↦ ContMDiffAt I I' (↑Top.top) f x : Set M -/ +/-- info: Set.ofPred fun x ↦ ContMDiffAt I I' (↑Top.top) f x : Set M -/ #guard_msgs in #check {x | CMDiffAt ∞ f x} -/-- info: setOf fun x ↦ Injective ⇑(mfderiv I I' f x) : Set M -/ +/-- info: Set.ofPred fun x ↦ Injective ⇑(mfderiv I I' f x) : Set M -/ #guard_msgs in #check {x | Function.Injective (mfderiv% f x) } -/-- info: setOf fun x ↦ Surjective ⇑(mfderivWithin I I' f s x) : Set M -/ +/-- info: Set.ofPred fun x ↦ Surjective ⇑(mfderivWithin I I' f s x) : Set M -/ #guard_msgs in #check {x | Function.Surjective (mfderiv[s] f x) } diff --git a/MathlibTest/FinsetBuilder.lean b/MathlibTest/FinsetBuilder.lean index 84374a51e25cca..81ec255fa934d1 100644 --- a/MathlibTest/FinsetBuilder.lean +++ b/MathlibTest/FinsetBuilder.lean @@ -23,12 +23,12 @@ example : ({x : α | p x} : Finset α) = univ.filter p := rfl -- If the type of `s` (or the entire expression) is `Finset ?α`, elaborate as `Finset`; -- otherwise as `Set` example (s : Finset α) : {x ∈ s | p x} = s.filter p := rfl -example (s : Finset α) : ({x ∈ s | p x} : Set α) = setOf fun x => x ∈ s ∧ p x := rfl -example (s : Finset α) : {x ∈ (s : Set α) | p x} = setOf fun x => x ∈ s ∧ p x := rfl +example (s : Finset α) : ({x ∈ s | p x} : Set α) = Set.ofPred fun x => x ∈ s ∧ p x := rfl +example (s : Finset α) : {x ∈ (s : Set α) | p x} = Set.ofPred fun x => x ∈ s ∧ p x := rfl -- elaborate as `Set` if no expected type present -example : {x | p x} = setOf p := rfl -example : {x : α | p x} = setOf p := rfl +example : {x | p x} = Set.ofPred p := rfl +example : {x : α | p x} = Set.ofPred p := rfl variable [DecidableEq α] @@ -36,8 +36,8 @@ example (s : Finset α) : {x ∉ s | p x} = sᶜ.filter p := rfl example (a : α) : ({x ≠ a | p x} : Finset α) = ({a}ᶜ : Finset α).filter p := rfl -- elaborate as `Set` if the `s` or the expected type is not `Finset ?α` -example (s : Set α) : {x ∉ s | p x} = setOf fun x => x ∉ s ∧ p x := rfl -example (a : α) : {x ≠ a | p x} = setOf fun x => x ≠ a ∧ p x := rfl +example (s : Set α) : {x ∉ s | p x} = Set.ofPred fun x => x ∉ s ∧ p x := rfl +example (a : α) : {x ≠ a | p x} = Set.ofPred fun x => x ≠ a ∧ p x := rfl end Fintype @@ -50,8 +50,8 @@ example (a : α) : ({x ≤ a | p x} : Finset α) = (Iic a).filter p := rfl example (a : α) : ({x < a | p x} : Finset α) = (Iio a).filter p := rfl -- elaborate as `Set` if the expected type is not `Finset ?α` -example (a : α) : {x ≤ a | p x} = setOf fun x => x ≤ a ∧ p x := rfl -example (a : α) : {x < a | p x} = setOf fun x => x < a ∧ p x := rfl +example (a : α) : {x ≤ a | p x} = Set.ofPred fun x => x ≤ a ∧ p x := rfl +example (a : α) : {x < a | p x} = Set.ofPred fun x => x < a ∧ p x := rfl end LocallyFiniteOrderBot @@ -62,7 +62,7 @@ example (a : α) : ({x ≥ a | p x} : Finset α) = (Ici a).filter p := rfl example (a : α) : ({x > a | p x} : Finset α) = (Ioi a).filter p := rfl -- elaborate as `Set` if the expected type is not `Finset ?α` -example (a : α) : {x ≥ a | p x} = setOf fun x => x ≥ a ∧ p x := rfl -example (a : α) : {x > a | p x} = setOf fun x => x > a ∧ p x := rfl +example (a : α) : {x ≥ a | p x} = Set.ofPred fun x => x ≥ a ∧ p x := rfl +example (a : α) : {x > a | p x} = Set.ofPred fun x => x > a ∧ p x := rfl end LocallyFiniteOrderTop