Module docstring
{"# Successors and predecessors of naturals
In this file, we show that ℕ is both an archimedean succOrder and an archimedean predOrder.
"}
{"# Successors and predecessors of naturals
In this file, we show that ℕ is both an archimedean succOrder and an archimedean predOrder.
"}
Nat.instSuccOrder
abbrev
: SuccOrder ℕ
@[instance] abbrev instSuccOrder : SuccOrder ℕ :=
SuccOrder.ofSuccLeIff succ Nat.succ_le
Nat.instSuccAddOrder
instance
: SuccAddOrder ℕ
instance instSuccAddOrder : SuccAddOrder ℕ := ⟨fun _ => rfl⟩
Nat.instPredOrder
abbrev
: PredOrder ℕ
@[instance] abbrev instPredOrder : PredOrder ℕ where
pred := pred
pred_le := pred_le
min_of_le_pred {a} ha := by
cases a
· exact isMin_bot
· exact (not_succ_le_self _ ha).elim
le_pred_of_lt {a} {b} h := by
cases b
· exact (a.not_lt_zero h).elim
· exact le_of_succ_le_succ h
Nat.instPredSubOrder
instance
: PredSubOrder ℕ
instance instPredSubOrder : PredSubOrder ℕ := ⟨fun _ => rfl⟩
Nat.succ_eq_succ
theorem
: Order.succ = succ
@[simp]
theorem succ_eq_succ : Order.succ = succ :=
rfl
Nat.pred_eq_pred
theorem
: Order.pred = pred
@[simp]
theorem pred_eq_pred : Order.pred = pred :=
rfl
Nat.succ_iterate
theorem
(a : ℕ) : ∀ n, succ^[n] a = a + n
protected theorem succ_iterate (a : ℕ) : ∀ n, succsucc^[n] a = a + n :=
Order.succ_iterate a
Nat.pred_iterate
theorem
(a : ℕ) : ∀ n, pred^[n] a = a - n
protected theorem pred_iterate (a : ℕ) : ∀ n, predpred^[n] a = a - n
| 0 => rfl
| n + 1 => by
rw [Function.iterate_succ', sub_succ]
exact congr_arg _ (Nat.pred_iterate a n)
Nat.le_succ_iff_eq_or_le
theorem
: m ≤ n.succ ↔ m = n.succ ∨ m ≤ n
lemma le_succ_iff_eq_or_le : m ≤ n.succ ↔ m = n.succ ∨ m ≤ n := Order.le_succ_iff_eq_or_le
Nat.instIsSuccArchimedean
instance
: IsSuccArchimedean ℕ
Nat.instIsPredArchimedean
instance
: IsPredArchimedean ℕ
Nat.forall_ne_zero_iff
theorem
(P : ℕ → Prop) : (∀ i, i ≠ 0 → P i) ↔ (∀ i, P (i + 1))
lemma forall_ne_zero_iff (P : ℕ → Prop) :
(∀ i, i ≠ 0 → P i) ↔ (∀ i, P (i + 1)) :=
SuccOrder.forall_ne_bot_iff P
Fin.coe_covBy_iff
theorem
{n : ℕ} {a b : Fin n} : (a : ℕ) ⋖ b ↔ a ⋖ b
@[simp, norm_cast]
theorem Fin.coe_covBy_iff {n : ℕ} {a b : Fin n} : (a : ℕ) ⋖ b(a : ℕ) ⋖ b ↔ a ⋖ b :=
and_congr_right' ⟨fun h _c hc => h hc, fun h c ha hb => @h ⟨c, hb.trans b.prop⟩ ha hb⟩
withBotSucc_zero
theorem
: WithBot.succ 0 = 1
@[simp]
theorem withBotSucc_zero : WithBot.succ 0 = 1 := rfl
withBotSucc_one
theorem
: WithBot.succ 1 = 2
@[simp]
theorem withBotSucc_one : WithBot.succ 1 = 2 := rfl