Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 9bb1256

Browse files
committed
feat(order/succ_pred/basic): a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥ and related (#15567)
We use these new results to golf down the ordinal API.
1 parent b6fa37e commit 9bb1256

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

src/order/succ_pred/basic.lean

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,15 @@ lt_succ_iff_not_is_max.trans not_is_max_iff_ne_top
362362
end order_top
363363

364364
section order_bot
365-
variables [order_bot α] [nontrivial α]
365+
variable [order_bot α]
366+
367+
@[simp] lemma lt_succ_bot_iff [no_max_order α] : a < succ ⊥ ↔ a = ⊥ :=
368+
by rw [lt_succ_iff, le_bot_iff]
369+
370+
lemma le_succ_bot_iff : a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥ :=
371+
by rw [le_succ_iff_eq_or_le, le_bot_iff, or_comm]
372+
373+
variable [nontrivial α]
366374

367375
lemma bot_lt_succ (a : α) : ⊥ < succ a :=
368376
(lt_succ_of_not_is_max not_is_max_bot).trans_le $ succ_mono bot_le
@@ -575,7 +583,15 @@ variables [order_bot α]
575583
end order_bot
576584

577585
section order_top
578-
variables [order_top α] [nontrivial α]
586+
587+
variable [order_top α]
588+
589+
@[simp] lemma pred_top_lt_iff [no_min_order α] : pred ⊤ < a ↔ a = ⊤ :=
590+
@lt_succ_bot_iff αᵒᵈ _ _ _ _ _
591+
592+
lemma pred_top_le_iff : pred ⊤ ≤ a ↔ a = ⊤ ∨ a = pred ⊤ := @le_succ_bot_iff αᵒᵈ _ _ _ _
593+
594+
variable [nontrivial α]
579595

580596
lemma pred_lt_top (a : α) : pred a < ⊤ :=
581597
(pred_mono le_top).trans_lt $ pred_lt_of_not_is_min not_is_min_top

src/set_theory/ordinal/arithmetic.lean

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ theorem nat_cast_succ (n : ℕ) : ↑n.succ = succ (n : ordinal) := rfl
120120
theorem add_left_cancel (a) {b c : ordinal} : a + b = a + c ↔ b = c :=
121121
by simp only [le_antisymm_iff, add_le_add_iff_left]
122122

123-
theorem lt_one_iff_zero {a : ordinal} : a < 1 ↔ a = 0 :=
124-
by rw [←succ_zero, lt_succ_iff, ordinal.le_zero]
123+
theorem lt_one_iff_zero {a : ordinal} : a < 1 ↔ a = 0 := by simpa using @lt_succ_bot_iff _ _ _ a _ _
125124

126125
private theorem add_lt_add_iff_left' (a) {b c : ordinal} : a + b < a + c ↔ b < c :=
127126
by rw [← not_le, ← not_le, add_le_add_iff_left]
@@ -185,13 +184,7 @@ unique.eq_default x
185184
by rw [one_out_eq x, typein_enum]
186185

187186
theorem le_one_iff {a : ordinal} : a ≤ 1 ↔ a = 0 ∨ a = 1 :=
188-
begin
189-
refine ⟨λ ha, _, _⟩,
190-
{ rcases eq_or_lt_of_le ha with rfl | ha,
191-
exacts [or.inr rfl, or.inl (lt_one_iff_zero.1 ha)], },
192-
{ rintro (rfl | rfl),
193-
exacts [zero_le_one, le_rfl], }
194-
end
187+
by simpa using @le_succ_bot_iff _ _ _ a _
195188

196189
theorem add_eq_zero_iff {a b : ordinal} : a + b = 0 ↔ (a = 0 ∧ b = 0) :=
197190
induction_on a $ λ α r _, induction_on b $ λ β s _, begin

src/set_theory/ordinal/basic.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,9 @@ induction_on o $ λ α r _, ⟨⟨⟨embedding.of_is_empty, is_empty_elim⟩, is
408408

409409
instance : order_bot ordinal := ⟨0, ordinal.zero_le⟩
410410

411-
@[simp] protected theorem le_zero {o : ordinal} : o ≤ 0 ↔ o = 0 :=
412-
by simp only [le_antisymm_iff, ordinal.zero_le, and_true]
411+
@[simp] protected theorem le_zero {o : ordinal} : o ≤ 0 ↔ o = 0 := le_bot_iff
413412

414-
protected theorem pos_iff_ne_zero {o : ordinal} : 0 < o ↔ o ≠ 0 :=
415-
by simp only [lt_iff_le_and_ne, ordinal.zero_le, true_and, ne.def, eq_comm]
413+
protected theorem pos_iff_ne_zero {o : ordinal} : 0 < o ↔ o ≠ 0 := bot_lt_iff_ne_bot
416414

417415
@[simp] theorem out_empty_iff_eq_zero {o : ordinal} : is_empty o.out.α ↔ o = 0 :=
418416
by rw [←@type_eq_zero_iff_is_empty o.out.α (<), type_lt]

0 commit comments

Comments
 (0)