Skip to content

Commit ba688d8

Browse files
committed
chore(Data): remove primes from names (#25163)
This PR renames lemmas that use a `'`, addressing technical debt. This focuses on declarations that seem simple to rename. Co-authored-by: Bolton Bailey <bolton.bailey@gmail.com>
1 parent 8cdf10c commit ba688d8

File tree

11 files changed

+33
-20
lines changed

11 files changed

+33
-20
lines changed

Mathlib/Data/Finset/Functor.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ instance lawfulApplicative : LawfulApplicative Finset :=
116116
exact hb
117117
pure_seq := fun f s => by simp only [pure_def, seq_def, sup_singleton, fmap_def]
118118
map_pure := fun _ _ => image_singleton _ _
119-
seq_pure := fun _ _ => sup_singleton'' _ _
119+
seq_pure := fun _ _ => sup_singleton_apply _ _
120120
seq_assoc := fun s t u => by
121121
ext a
122122
simp_rw [seq_def, fmap_def]
@@ -153,7 +153,7 @@ theorem bind_def {α β} : (· >>= ·) = sup (α := Finset α) (β := β) :=
153153

154154
instance : LawfulMonad Finset :=
155155
{ Finset.lawfulApplicative with
156-
bind_pure_comp := fun _ _ => sup_singleton'' _ _
156+
bind_pure_comp := fun _ _ => sup_singleton_apply _ _
157157
bind_map := fun _ _ => rfl
158158
pure_bind := fun _ _ => sup_singleton
159159
bind_assoc := fun s f g => by simp only [bind, ← sup_biUnion, sup_eq_biUnion, biUnion_biUnion] }

Mathlib/Data/Finset/Lattice/Fold.lean

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,14 +1132,20 @@ set_option linter.docPrime false in
11321132
induction' s using cons_induction <;> simp [*]
11331133

11341134
@[simp]
1135-
theorem sup_singleton'' (s : Finset β) (f : β → α) :
1135+
theorem sup_singleton_apply (s : Finset β) (f : β → α) :
11361136
(s.sup fun b => {f b}) = s.image f := by
11371137
ext a
11381138
rw [mem_sup, mem_image]
11391139
simp only [mem_singleton, eq_comm]
11401140

1141+
@[deprecated (since := "2025-05-24")]
1142+
alias sup_singleton'' := sup_singleton_apply
1143+
11411144
@[simp]
1142-
theorem sup_singleton' (s : Finset α) : s.sup singleton = s :=
1143-
(s.sup_singleton'' _).trans image_id
1145+
theorem sup_singleton_eq_self (s : Finset α) : s.sup singleton = s :=
1146+
(s.sup_singleton_apply _).trans image_id
1147+
1148+
@[deprecated (since := "2025-05-24")]
1149+
alias sup_singleton' := sup_singleton_eq_self
11441150

11451151
end Finset

Mathlib/Data/Int/Init.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,16 @@ lemma sign_add_eq_of_sign_eq : ∀ {m n : ℤ}, m.sign = n.sign → (m + n).sign
310310
@[simp] lemma toNat_pred_coe_of_pos {i : ℤ} (h : 0 < i) : ((i.toNat - 1 : ℕ) : ℤ) = i - 1 := by
311311
simp only [lt_toNat, Int.cast_ofNat_Int, h, natCast_pred_of_pos, Int.le_of_lt h, toNat_of_nonneg]
312312

313-
lemma toNat_lt'' {n : ℕ} (hn : n ≠ 0) : m.toNat < n ↔ m < n := by omega
313+
lemma toNat_lt_of_ne_zero {n : ℕ} (hn : n ≠ 0) : m.toNat < n ↔ m < n := by omega
314+
315+
@[deprecated (since := "2025-05-24")]
316+
alias toNat_lt'' := toNat_lt_of_ne_zero
314317

315318
/-- The modulus of an integer by another as a natural. Uses the E-rounding convention. -/
316319
def natMod (m n : ℤ) : ℕ := (m % n).toNat
317320

318321
lemma natMod_lt {n : ℕ} (hn : n ≠ 0) : m.natMod n < n :=
319-
(toNat_lt'' hn).2 <| emod_lt_of_pos _ <| by omega
322+
(toNat_lt_of_ne_zero hn).2 <| emod_lt_of_pos _ <| by omega
320323

321324
/-- For use in `Mathlib/Tactic/NormNum/Pow.lean` -/
322325
@[simp] lemma pow_eq (m : ℤ) (n : ℕ) : m.pow n = m ^ n := rfl

Mathlib/Data/Int/NatPrime.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Int
1818

1919
theorem not_prime_of_int_mul {a b : ℤ} {c : ℕ} (ha : a.natAbs ≠ 1) (hb : b.natAbs ≠ 1)
2020
(hc : a * b = (c : ℤ)) : ¬Nat.Prime c :=
21-
not_prime_mul' (natAbs_mul_natAbs_eq hc) ha hb
21+
not_prime_of_mul_eq (natAbs_mul_natAbs_eq hc) ha hb
2222

2323
theorem succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : Nat.Prime p) {m n : ℤ}
2424
{k l : ℕ} (hpm : ↑(p ^ k) ∣ m) (hpn : ↑(p ^ l) ∣ n) (hpmn : ↑(p ^ (k + l + 1)) ∣ m * n) :

Mathlib/Data/Nat/ChineseRemainder.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
3939
cases i using Fin.cases <;> simp_all
4040
· intro h; exact ⟨h 0, fun i => h i.succ⟩
4141

42-
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
42+
lemma modEq_list_map_prod_iff {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
4343
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
4444
induction' l with i l ih
4545
· simp [modEq_one]
@@ -50,6 +50,9 @@ lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise
5050
exact (List.pairwise_cons.mp co).1 j hj
5151
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
5252

53+
@[deprecated (since := "2025-05-24")]
54+
alias modEq_list_prod_iff' := modEq_list_map_prod_iff
55+
5356
variable (a s : ι → ℕ)
5457

5558
/-- The natural number less than `(l.map s).prod` congruent to
@@ -68,7 +71,7 @@ def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
6871
use k
6972
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
7073
intro j hj
71-
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
74+
exact ((modEq_list_map_prod_iff co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
7275

7376
@[simp] theorem chineseRemainderOfList_nil :
7477
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl

Mathlib/Data/Nat/Pairing.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by
5050
(Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add)
5151
simp [s, pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm]
5252

53-
theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by
53+
theorem pair_eq_of_unpair_eq {n a b} (H : unpair n = (a, b)) : pair a b = n := by
5454
simpa [H] using pair_unpair n
5555

56+
@[deprecated (since := "2025-05-24")]
57+
alias pair_unpair' := pair_eq_of_unpair_eq
58+
5659
@[simp]
5760
theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
5861
dsimp only [pair]; split_ifs with h

Mathlib/Data/Nat/Prime/Basic.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ theorem prime_mul_iff {a b : ℕ} : Nat.Prime (a * b) ↔ a.Prime ∧ b = 1 ∨
2828
theorem not_prime_mul {a b : ℕ} (a1 : a ≠ 1) (b1 : b ≠ 1) : ¬Prime (a * b) := by
2929
simp [prime_mul_iff, _root_.not_or, *]
3030

31-
theorem not_prime_mul' {a b n : ℕ} (h : a * b = n) (h₁ : a ≠ 1) (h₂ : b ≠ 1) : ¬Prime n :=
31+
theorem not_prime_of_mul_eq {a b n : ℕ} (h : a * b = n) (h₁ : a ≠ 1) (h₂ : b ≠ 1) : ¬Prime n :=
3232
h ▸ not_prime_mul h₁ h₂
3333

34+
@[deprecated (since := "2025-05-24")]
35+
alias not_prime_mul' := not_prime_of_mul_eq
36+
3437
theorem Prime.dvd_iff_eq {p a : ℕ} (hp : p.Prime) (a1 : a ≠ 1) : a ∣ p ↔ p = a := by
3538
refine ⟨?_, by rintro rfl; rfl⟩
3639
rintro ⟨j, rfl⟩

Mathlib/Logic/Equiv/List.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encode
136136
⟨a, h₁, h₂⟩
137137
rw [Option.mem_def] at h₁
138138
use ofNat α v₁ :: a
139-
simp [decodeList, e, h₂, h₁, encodeList, pair_unpair' e]
139+
simp [decodeList, e, h₂, h₁, encodeList, pair_eq_of_unpair_eq e]
140140

141141
/-- If `α` is denumerable, then so is `List α`. -/
142142
instance denumerableList : Denumerable (List α) :=

Mathlib/Order/Partition/Finpartition.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ instance (s : Finset α) : Bot (Finpartition s) :=
603603
supIndep := Set.PairwiseDisjoint.supIndep <| by
604604
rw [Finset.coe_map]
605605
exact Finset.pairwiseDisjoint_range_singleton.subset (Set.image_subset_range _ _)
606-
sup_parts := by rw [sup_map, id_comp, Embedding.coeFn_mk, Finset.sup_singleton']
606+
sup_parts := by rw [sup_map, id_comp, Embedding.coeFn_mk, Finset.sup_singleton_eq_self]
607607
bot_notMem := by simp }⟩
608608

609609
@[simp]

Mathlib/Tactic/NormNum/Prime.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Mathlib.Meta.NormNum
3030

3131
theorem not_prime_mul_of_ble (a b n : ℕ) (h : a * b = n) (h₁ : a.ble 1 = false)
3232
(h₂ : b.ble 1 = false) : ¬ n.Prime :=
33-
not_prime_mul' h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne'
33+
not_prime_of_mul_eq h (ble_eq_false.mp h₁).ne' (ble_eq_false.mp h₂).ne'
3434

3535
/-- Produce a proof that `n` is not prime from a factor `1 < d < n`. `en` should be the expression
3636
that is the natural number literal `n`. -/

0 commit comments

Comments
 (0)