Skip to content

Commit 4b5956c

Browse files
committed
chore: deprecate duplicate theorems on ENat (#39854)
These exist more generally in the setting of `SuccAddOrder`.
1 parent d4830ba commit 4b5956c

21 files changed

Lines changed: 93 additions & 86 deletions

File tree

Mathlib/Algebra/Order/SuccPred.lean

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,34 +241,36 @@ theorem add_one_inj [NoMaxOrder α] : x + 1 = y + 1 ↔ x = y := by
241241

242242
end Add
243243

244+
@[simp]
245+
theorem lt_two_iff [AddMonoidWithOne α] [SuccAddOrder α] [NoMaxOrder α] : x < 2 ↔ x ≤ 1 := by
246+
rw [← one_add_one_eq_two, lt_add_one_iff]
247+
244248
section AddMonoidWithOne
245-
variable [AddMonoidWithOne α] [NoMaxOrder α] [SuccAddOrder α]
249+
variable [AddMonoidWithOne α] [SuccAddOrder α] [IsBotZeroClass α] [NeZero (1 : α)]
246250

247251
@[simp]
248-
theorem lt_one_iff [IsBotZeroClass α] : x < 1 ↔ x = 0 := by
249-
rw [← zero_add 1, lt_add_one_iff, nonpos_iff_eq_zero]
252+
theorem lt_one_iff : x < 1 ↔ x = 0 := by
253+
simpa using (one_le_iff_ne_zero (x := x)).not
250254

251-
theorem le_one_iff [IsBotZeroClass α] : x ≤ 1 ↔ x = 0 ∨ x = 1 := by
255+
theorem le_one_iff : x ≤ 1 ↔ x = 0 ∨ x = 1 := by
252256
rw [le_iff_lt_or_eq, lt_one_iff]
253257

254258
@[simp]
255-
theorem Iio_one [IsBotZeroClass α] : Set.Iio (1 : α) = {0} := by
259+
theorem Iio_one : Set.Iio (1 : α) = {0} := by
256260
ext; simp
257261

258-
theorem Iic_one [IsBotZeroClass α] : Set.Iic (1 : α) = {0, 1} := by
262+
theorem Iic_one : Set.Iic (1 : α) = {0, 1} := by
259263
ext; simp [le_one_iff]
260264

261-
@[simp]
262-
theorem lt_two_iff : x < 2 ↔ x ≤ 1 := by
263-
rw [← one_add_one_eq_two, lt_add_one_iff]
265+
variable [NoMaxOrder α]
264266

265-
theorem le_two_iff [IsBotZeroClass α] : x ≤ 2 ↔ x = 0 ∨ x = 1 ∨ x = 2 := by
267+
theorem le_two_iff : x ≤ 2 ↔ x = 0 ∨ x = 1 ∨ x = 2 := by
266268
rw [le_iff_lt_or_eq, lt_two_iff, le_one_iff, or_assoc]
267269

268-
theorem Iio_two [IsBotZeroClass α] : Set.Iio (2 : α) = {0, 1} := by
270+
theorem Iio_two : Set.Iio (2 : α) = {0, 1} := by
269271
ext; simp [le_one_iff]
270272

271-
theorem Iic_two [IsBotZeroClass α] : Set.Iic (2 : α) = {0, 1, 2} := by
273+
theorem Iic_two : Set.Iic (2 : α) = {0, 1, 2} := by
272274
ext; simp [le_two_iff]
273275

274276
end AddMonoidWithOne

Mathlib/Analysis/Analytic/Order.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ theorem AnalyticAt.analyticOrderAt_deriv_add_one {x : 𝕜} (hf : AnalyticAt
298298
· simp_rw [← Nat.cast_smul_eq_nsmul 𝕜]
299299
fun_prop
300300
rwa [← Pi.add_def, analyticOrderAt_add_eq_right_of_lt]
301-
rw [this, ← Order.succ_le_iff_of_not_isMax (not_isMax_iff.mpr ⟨⊤, ENat.coe_lt_top s⟩),
302-
ENat.succ_def, ← Nat.cast_add_one, natCast_le_analyticOrderAt (by fun_prop)]
301+
rw [this, ← ENat.add_one_le_iff (ENat.coe_ne_top _), ← Nat.cast_add_one,
302+
natCast_le_analyticOrderAt (by fun_prop)]
303303
exact ⟨deriv F, hFa.deriv, by simp⟩
304304

305305
theorem AnalyticAt.analyticOrderAt_sub_eq_one_of_deriv_ne_zero {x : 𝕜} (hf : AnalyticAt 𝕜 f x)

Mathlib/Analysis/Distribution/ContDiffMapSupportedIn.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,14 @@ noncomputable def fderivLM :
381381
else 0
382382
map_add' f g := by
383383
split_ifs with hk
384-
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (ENat.add_one_pos.trans_le hk)
384+
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (add_pos_of_right zero_lt_one k).trans_le hk
385385
ext
386386
simp [fderiv_add (f.contDiff.differentiable hk'.ne').differentiableAt
387387
(g.contDiff.differentiable hk'.ne').differentiableAt]
388388
· simp
389389
map_smul' c f := by
390390
split_ifs with hk
391-
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (ENat.add_one_pos.trans_le hk)
391+
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (add_pos_of_right zero_lt_one k).trans_le hk
392392
ext
393393
simp [fderiv_const_smul (f.contDiff.differentiable hk'.ne').differentiableAt]
394394
· simp

Mathlib/Analysis/Distribution/TestFunction.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ lemma lineDerivCLM_apply {f : 𝓓^{n}(Ω, F)} {v : E} {x : E} :
567567
(lineDerivCLM 𝕜 v f : 𝓓^{k}(Ω, F)) x = if k + 1 ≤ n then lineDeriv ℝ f x v else 0 := by
568568
rw [lineDerivCLM_eq_fderivCLM, fderivCLM_apply]
569569
split_ifs with hk
570-
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (ENat.add_one_pos.trans_le hk)
570+
· have hk' : 0 < (n : ℕ∞ω) := mod_cast (add_pos_of_right zero_lt_one k).trans_le hk
571571
rw [(f.contDiff.differentiable hk'.ne').differentiableAt.lineDeriv_eq_fderiv]
572572
· rfl
573573

Mathlib/Combinatorics/SimpleGraph/Connectivity/EdgeConnectivity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected lemma IsEdgeReachable.zero : G.IsEdgeReachable 0 u v := by simp [IsEdg
6868

6969
@[simp]
7070
lemma isEdgeReachable_one : G.IsEdgeReachable 1 u v ↔ G.Reachable u v := by
71-
simp [IsEdgeReachable, ENat.lt_one_iff_eq_zero]
71+
simp [IsEdgeReachable, Order.lt_one_iff]
7272

7373
@[simp]
7474
lemma isEdgeConnected_one : G.IsEdgeConnected 1 ↔ G.Preconnected := by

Mathlib/Combinatorics/SimpleGraph/Diam.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ lemma eccent_le_one_iff (u : α) : G.eccent u ≤ 1 ↔ ∀ v, u ≠ v → G.Adj
114114

115115
lemma eccent_eq_one_iff [Nontrivial α] (u : α) :
116116
G.eccent u = 1 ↔ ∀ v, u ≠ v → G.Adj u v := by
117-
have h : 1 ≤ G.eccent u := ENat.one_le_iff_ne_zero.mpr (eccent_ne_zero u)
117+
have h : 1 ≤ G.eccent u := Order.one_le_iff_ne_zero.mpr (eccent_ne_zero u)
118118
rw [← h.ge_iff_eq']
119119
exact eccent_le_one_iff u
120120

@@ -368,9 +368,9 @@ lemma radius_ne_top_iff [Nonempty α] [Finite α] : G.radius ≠ ⊤ ↔ G.Conne
368368
exact h u v
369369

370370
lemma radius_ne_zero_of_nontrivial [Nontrivial α] : G.radius ≠ 0 := by
371-
rw [← ENat.one_le_iff_ne_zero]
371+
rw [← Order.one_le_iff_ne_zero]
372372
apply le_iInf
373-
simp [ENat.one_le_iff_ne_zero, G.eccent_ne_zero]
373+
simp [Order.one_le_iff_ne_zero, G.eccent_ne_zero]
374374

375375
lemma radius_eq_zero_iff : G.radius = 0 ↔ Nonempty α ∧ Subsingleton α := by
376376
refine ⟨fun h ↦ ⟨?_, ?_⟩, fun ⟨_, _⟩ ↦ ?_⟩

Mathlib/Combinatorics/SimpleGraph/Metric.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ lemma edist_eq_two_iff {u v : V} :
157157
rw [mem_commonNeighbors] at hw
158158
have := (Walk.cons hw.1 <| .cons hw.2.symm .nil).edist_le
159159
simp_all
160-
· by_contra! hc
161-
cases ENat.le_one_iff_eq_zero_or_eq_one.mp (Order.le_of_lt_succ hc) <;> simp_all
160+
· by_contra
161+
simp_all [Order.le_one_iff]
162162

163163
lemma two_lt_edist_iff {u v : V} :
164164
2 < G.edist u v ↔ u ≠ v ∧ ¬ G.Adj u v ∧ (G.commonNeighbors u v) = ∅ := by
@@ -418,7 +418,7 @@ theorem ball_zero : G.ball c 0 = ∅ := by simp [ball]
418418
/-- The ball of radius one consists of just the center. -/
419419
@[simp]
420420
theorem ball_one : G.ball c 1 = {c} := by
421-
simp [ball, ENat.lt_one_iff_eq_zero]
421+
simp [ball]
422422

423423
/-- The ball of radius two consists of the center and its neighbors. -/
424424
@[simp]

Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,10 @@ theorem IsSRGWith.ediam_eq_two [Nontrivial V] (h : G.IsSRGWith n k ℓ μ) (ht :
7474
by_contra! hc
7575
obtain ⟨hn, ha, he⟩ := two_lt_edist_iff.mp hc
7676
have h := h.of_not_adj hn ha
77-
simp_rw [he, Fintype.card_eq_zero] at h
78-
exact false_of_ne (h ▸ hm)
79-
· by_contra! hc
80-
cases ENat.le_one_iff_eq_zero_or_eq_one.mp (Order.le_of_lt_succ hc) with
81-
| inl hc =>
82-
rw [ediam_eq_zero_iff_subsingleton] at hc
83-
exact false_of_nontrivial_of_subsingleton V
84-
| inr hc => exact ht.elim (ediam_eq_one.mp hc)
77+
simp_all
78+
· by_contra
79+
have := not_subsingleton V
80+
simp_all [Order.le_one_iff]
8581

8682
/-- **Conway's 99-graph problem** (from https://oeis.org/A248380/a248380.pdf)
8783
can be reformulated as the existence of a strongly regular graph with params (99, 14, 1, 2).

Mathlib/Data/ENat/Basic.lean

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ def lift (x : ℕ∞) (h : x < ⊤) : ℕ := WithTop.untop x (WithTop.lt_top_iff
126126

127127
instance canLift : CanLift ℕ∞ ℕ (↑) (· ≠ ⊤) := WithTop.canLift
128128

129-
instance : WellFoundedRelation ℕ∞ where
130-
rel := (· < ·)
131-
wf := IsWellFounded.wf
129+
instance : WellFoundedRelation ℕ∞ :=
130+
WellFoundedLT.toWellFoundedRelation
132131

133132
/-- Conversion of `ℕ∞` to `ℕ` sending `∞` to `0`. -/
134133
def toNat : ℕ∞ → ℕ := WithTop.untopD 0
@@ -272,7 +271,7 @@ lemma toNat_le_of_le_coe {m : ℕ∞} {n : ℕ} (h : m ≤ n) : toNat m ≤ n :=
272271
lemma toNat_le_toNat {m n : ℕ∞} (h : m ≤ n) (hn : n ≠ ⊤) : toNat m ≤ toNat n :=
273272
toNat_le_of_le_coe <| h.trans_eq (coe_toNat hn).symm
274273

275-
-- TODO: deprecate
274+
@[deprecated Order.succ_eq_add_one (since := "2026-05-25")]
276275
theorem succ_def (m : ℕ∞) : Order.succ m = m + 1 :=
277276
Order.succ_eq_add_one m
278277

@@ -284,21 +283,25 @@ theorem add_one_le_iff' (hn : n ≠ ⊤) : m + 1 ≤ n ↔ m < n := by
284283
· simpa
285284
· exact add_one_le_iff hm
286285

287-
theorem one_le_iff_ne_zero : 1 ≤ n ↔ n ≠ 0 :=
288-
Order.one_le_iff_pos.trans pos_iff_ne_zero
286+
@[deprecated Order.one_le_iff_ne_zero (since := "2026-05-25")]
287+
protected theorem one_le_iff_ne_zero : 1 ≤ n ↔ n ≠ 0 :=
288+
Order.one_le_iff_ne_zero
289289

290+
@[deprecated Order.lt_one_iff (since := "2026-05-25")]
290291
lemma lt_one_iff_eq_zero : n < 1 ↔ n = 0 :=
291-
not_le.symm.trans one_le_iff_ne_zero.not_left
292+
Order.lt_one_iff
292293

293-
lemma le_one_iff_eq_zero_or_eq_one : n ≤ 1 ↔ n = 0 ∨ n = 1 := by
294-
refine ⟨fun h ↦ ?_, fun h ↦ by cases h <;> simp_all⟩
295-
cases n
296-
· simp at h
297-
· rwa [← lt_one_iff_eq_zero, ← le_iff_lt_or_eq]
294+
@[deprecated Order.le_one_iff (since := "2026-05-25")]
295+
lemma le_one_iff_eq_zero_or_eq_one : n ≤ 1 ↔ n = 0 ∨ n = 1 :=
296+
Order.le_one_iff
298297

299298
theorem lt_add_one_iff (hm : n ≠ ⊤) : m < n + 1 ↔ m ≤ n :=
300299
Order.lt_add_one_iff_of_not_isMax (not_isMax_iff_ne_top.mpr hm)
301300

301+
@[simp]
302+
theorem lt_two_iff : n < 2 ↔ n ≤ 1 := by
303+
rw [← one_add_one_eq_two, lt_add_one_iff one_ne_top]
304+
302305
theorem add_le_add_iff_left {m n k : ENat} (h : k ≠ ⊤) :
303306
k + n ≤ k + m ↔ n ≤ m :=
304307
WithTop.add_le_add_iff_left h
@@ -337,8 +340,9 @@ theorem nat_induction {motive : ℕ∞ → Prop} (a : ℕ∞) (zero : motive 0)
337340
· exact top A
338341
· exact A _
339342

343+
@[deprecated add_pos_of_right (since := "2026-05-25")]
340344
lemma add_one_pos : 0 < n + 1 :=
341-
succ_def n ▸ Order.bot_lt_succ n
345+
add_pos_of_right zero_lt_one n
342346

343347
lemma natCast_lt_succ {n : ℕ} :
344348
(n : ℕ∞) < (n : ℕ∞) + 1 := by
@@ -438,7 +442,7 @@ lemma self_le_mul_right (a : ℕ∞) (hc : c ≠ 0) : a ≤ a * c := by
438442
· simp [top_mul hc]
439443
obtain rfl | h0 := eq_or_ne a 0
440444
· simp
441-
nth_rewrite 1 [← mul_one a, ENat.mul_le_mul_left_iff h0 hne, ENat.one_le_iff_ne_zero]
445+
nth_rewrite 1 [← mul_one a, ENat.mul_le_mul_left_iff h0 hne, Order.one_le_iff_ne_zero]
442446
assumption
443447

444448
lemma self_le_mul_left (a : ℕ∞) (hc : c ≠ 0) : a ≤ c * a := by

Mathlib/Data/ENat/Lattice.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ lemma iInf_toNat : (⨅ i, (f i : ℕ∞)).toNat = ⨅ i, f i := by
6969
· norm_cast
7070

7171
@[simp] lemma iInf_eq_zero {f : ι → ℕ∞} : ⨅ i, f i = 0 ↔ ∃ i, f i = 0 := by
72-
simpa [lt_one_iff_eq_zero] using iInf_lt_iff (α := ℕ∞) (a := 1)
72+
simpa [Order.lt_one_iff] using iInf_lt_iff (α := ℕ∞) (a := 1)
7373

7474
variable {f : ι → ℕ∞} {s : Set ℕ∞}
7575

7676
lemma sSup_eq_zero : sSup s = 0 ↔ ∀ a ∈ s, a = 0 :=
7777
sSup_eq_bot
7878

7979
lemma sInf_eq_zero : sInf s = 00 ∈ s := by
80-
rw [← lt_one_iff_eq_zero]
81-
simp only [sInf_lt_iff, lt_one_iff_eq_zero, exists_eq_right]
80+
rw [← Order.lt_one_iff, sInf_lt_iff]
81+
simp
8282

8383
lemma sSup_eq_zero' : sSup s = 0 ↔ s = ∅ ∨ s = {0} :=
8484
sSup_eq_bot'

0 commit comments

Comments
 (0)