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

Commit ae8f197

Browse files
sgouezelmergify[bot]
authored andcommitted
feat(data/nat/basic): decreasing induction (#1031)
* feat(data/nat/basic): decreasing induction * feat(data/nat/basic): better proof of decreasing induction
1 parent e7b64c5 commit ae8f197

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/data/nat/basic.lean

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ theorem succ_inj' {n m : ℕ} : succ n = succ m ↔ n = m :=
2727
theorem succ_le_succ_iff {m n : ℕ} : succ m ≤ succ n ↔ m ≤ n :=
2828
⟨le_of_succ_le_succ, succ_le_succ⟩
2929

30-
lemma zero_max {m : nat} : max 0 m = m :=
30+
lemma zero_max {m : nat} : max 0 m = m :=
3131
max_eq_right (zero_le _)
3232

3333
theorem max_succ_succ {m n : ℕ} :
@@ -45,7 +45,7 @@ succ_le_succ_iff
4545
lemma succ_le_iff {m n : ℕ} : succ m ≤ n ↔ m < n :=
4646
⟨lt_of_succ_le, succ_le_of_lt⟩
4747

48-
lemma lt_iff_add_one_le {m n : ℕ} : m < n ↔ m + 1 ≤ n :=
48+
lemma lt_iff_add_one_le {m n : ℕ} : m < n ↔ m + 1 ≤ n :=
4949
by rw succ_le_iff
5050

5151
theorem of_le_succ {n m : ℕ} (H : n ≤ m.succ) : n ≤ m ∨ n = m.succ :=
@@ -1061,4 +1061,9 @@ lemma with_bot.add_eq_one_iff : ∀ {n m : with_bot ℕ}, n + m = 1 ↔ (n = 0
10611061
∀ n ≥ m, P n :=
10621062
by apply nat.less_than_or_equal.rec h0; exact h1
10631063

1064+
@[elab_as_eliminator]
1065+
lemma decreasing_induction {P : ℕ → Prop} (h : ∀n, P (n+1) → P n) {m n : ℕ} (nm : m ≤ n) (hP : P n) :
1066+
P m :=
1067+
by { induction nm with n nm ih, exact hP, exact ih (h _ hP) }
1068+
10641069
end nat

0 commit comments

Comments
 (0)