Module docstring
{"# Successor function on WithBot
This file defines the successor of a : WithBot α as an element of α, and dually for WithTop.
"}
{"# Successor function on WithBot
This file defines the successor of a : WithBot α as an element of α, and dually for WithTop.
"}
WithBot.succ
definition
(a : WithBot α) : α
/-- The successor of `a : WithBot α` as an element of `α`. -/
def succ (a : WithBot α) : α := a.recBotCoe ⊥ Order.succ
WithBot.succ_bot
theorem
: succ (⊥ : WithBot α) = ⊥
WithBot.succ_coe
theorem
(a : α) : succ (a : WithBot α) = Order.succ a
/-- Not to be confused with `WithBot.orderSucc_coe`, which is about `Order.succ`. -/
@[simp] lemma succ_coe (a : α) : succ (a : WithBot α) = Order.succ a := rfl
WithBot.succ_eq_succ
theorem
: ∀ a : WithBot α, succ a = Order.succ a
lemma succ_eq_succ : ∀ a : WithBot α, succ a = Order.succ a
| ⊥ => rfl
| (a : α) => rfl
WithBot.succ_mono
theorem
: Monotone (succ : WithBot α → α)
WithBot.succ_strictMono
theorem
[NoMaxOrder α] : StrictMono (succ : WithBot α → α)
lemma succ_strictMono [NoMaxOrder α] : StrictMono (succ : WithBot α → α)
| ⊥, (b : α), hab => by simp
| (a : α), (b : α), hab => Order.succ_lt_succ (by simpa using hab)
WithBot.succ_le_succ
theorem
(hxy : x ≤ y) : x.succ ≤ y.succ
@[gcongr] lemma succ_le_succ (hxy : x ≤ y) : x.succ ≤ y.succ := succ_mono hxy
WithBot.succ_lt_succ
theorem
[NoMaxOrder α] (hxy : x < y) : x.succ < y.succ
@[gcongr] lemma succ_lt_succ [NoMaxOrder α] (hxy : x < y) : x.succ < y.succ := succ_strictMono hxy
WithBot.succ_eq_bot
theorem
(a : WithBot α) : WithBot.succ a = ⊥ ↔ a = ⊥
@[simp]
theorem succ_eq_bot (a : WithBot α) : WithBot.succWithBot.succ a = ⊥ ↔ a = ⊥ := by
cases a
· simp
· simp only [WithBot.succ_coe, WithBot.coe_ne_bot, iff_false]
apply ne_of_gt
by_contra! h
have h₂ : _ = ⊥ := le_bot_iff.mp ((Order.le_succ _).trans h)
exact not_isMax_bot (h₂ ▸ Order.max_of_succ_le (h.trans bot_le))
WithTop.pred
definition
(a : WithTop α) : α
/-- The predecessor of `a : WithTop α` as an element of `α`. -/
def pred (a : WithTop α) : α := a.recTopCoe ⊤ Order.pred
WithTop.pred_top
theorem
: pred (⊤ : WithTop α) = ⊤
WithTop.pred_coe
theorem
(a : α) : pred (a : WithTop α) = Order.pred a
/-- Not to be confused with `WithTop.orderPred_coe`, which is about `Order.pred`. -/
@[simp] lemma pred_coe (a : α) : pred (a : WithTop α) = Order.pred a := rfl
WithTop.pred_eq_pred
theorem
: ∀ a : WithTop α, pred a = Order.pred a
lemma pred_eq_pred : ∀ a : WithTop α, pred a = Order.pred a
| ⊤ => rfl
| (a : α) => rfl
WithTop.pred_mono
theorem
: Monotone (pred : WithTop α → α)
WithTop.pred_strictMono
theorem
[NoMinOrder α] : StrictMono (pred : WithTop α → α)
lemma pred_strictMono [NoMinOrder α] : StrictMono (pred : WithTop α → α)
| (b : α), ⊤, hab => by simp
| (a : α), (b : α), hab => Order.pred_lt_pred (by simpa using hab)
WithTop.pred_le_pred
theorem
(hxy : x ≤ y) : x.pred ≤ y.pred
@[gcongr] lemma pred_le_pred (hxy : x ≤ y) : x.pred ≤ y.pred := pred_mono hxy
WithTop.pred_lt_pred
theorem
[NoMinOrder α] (hxy : x < y) : x.pred < y.pred
@[gcongr] lemma pred_lt_pred [NoMinOrder α] (hxy : x < y) : x.pred < y.pred := pred_strictMono hxy
WithTop.pred_eq_top
theorem
(a : WithTop α) : WithTop.pred a = ⊤ ↔ a = ⊤
@[simp]
theorem pred_eq_top (a : WithTop α) : WithTop.predWithTop.pred a = ⊤ ↔ a = ⊤ := by
cases a
· simp
· simp only [WithTop.pred_coe, WithTop.coe_ne_top, iff_false]
apply ne_of_lt
by_contra! h
have h₂ : _ = ⊤ := top_le_iff.mp (h.trans (Order.pred_le _))
exact not_isMin_top (h₂ ▸ Order.min_of_le_pred (le_top.trans h))