Skip to content

Commit

Permalink
feat(order/succ_pred/basic): a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥ and re…
Browse files Browse the repository at this point in the history
…lated (#15567)

We use these new results to golf down the ordinal API.
  • Loading branch information
vihdzp committed Jul 31, 2022
1 parent b6fa37e commit 9bb1256
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
20 changes: 18 additions & 2 deletions src/order/succ_pred/basic.lean
Expand Up @@ -362,7 +362,15 @@ lt_succ_iff_not_is_max.trans not_is_max_iff_ne_top
end order_top

section order_bot
variables [order_bot α] [nontrivial α]
variable [order_bot α]

@[simp] lemma lt_succ_bot_iff [no_max_order α] : a < succ ⊥ ↔ a = ⊥ :=
by rw [lt_succ_iff, le_bot_iff]

lemma le_succ_bot_iff : a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥ :=
by rw [le_succ_iff_eq_or_le, le_bot_iff, or_comm]

variable [nontrivial α]

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

section order_top
variables [order_top α] [nontrivial α]

variable [order_top α]

@[simp] lemma pred_top_lt_iff [no_min_order α] : pred ⊤ < a ↔ a = ⊤ :=
@lt_succ_bot_iff αᵒᵈ _ _ _ _ _

lemma pred_top_le_iff : pred ⊤ ≤ a ↔ a = ⊤ ∨ a = pred ⊤ := @le_succ_bot_iff αᵒᵈ _ _ _ _

variable [nontrivial α]

lemma pred_lt_top (a : α) : pred a < ⊤ :=
(pred_mono le_top).trans_lt $ pred_lt_of_not_is_min not_is_min_top
Expand Down
11 changes: 2 additions & 9 deletions src/set_theory/ordinal/arithmetic.lean
Expand Up @@ -120,8 +120,7 @@ theorem nat_cast_succ (n : ℕ) : ↑n.succ = succ (n : ordinal) := rfl
theorem add_left_cancel (a) {b c : ordinal} : a + b = a + c ↔ b = c :=
by simp only [le_antisymm_iff, add_le_add_iff_left]

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

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

theorem le_one_iff {a : ordinal} : a ≤ 1 ↔ a = 0 ∨ a = 1 :=
begin
refine ⟨λ ha, _, _⟩,
{ rcases eq_or_lt_of_le ha with rfl | ha,
exacts [or.inr rfl, or.inl (lt_one_iff_zero.1 ha)], },
{ rintro (rfl | rfl),
exacts [zero_le_one, le_rfl], }
end
by simpa using @le_succ_bot_iff _ _ _ a _

theorem add_eq_zero_iff {a b : ordinal} : a + b = 0 ↔ (a = 0 ∧ b = 0) :=
induction_on a $ λ α r _, induction_on b $ λ β s _, begin
Expand Down
6 changes: 2 additions & 4 deletions src/set_theory/ordinal/basic.lean
Expand Up @@ -408,11 +408,9 @@ induction_on o $ λ α r _, ⟨⟨⟨embedding.of_is_empty, is_empty_elim⟩, is

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

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

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

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

0 comments on commit 9bb1256

Please sign in to comment.