Theorem: Nat.diag_induction
File: Mathlib/Data/Nat/Defs.lean

tactic: apply hd _ _ (Nat.add_lt_add_iff_right.1 h)
state_before: a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ P (a + 1) (b + 1)
state_after: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ P (a + 1) b

case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ P a (b + 1)

tactic: have _ : a + (b + 1) < (a + 1) + (b + 1) := by simp
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ P a (b + 1)
state_after: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ P a (b + 1)

tactic: apply diag_induction P ha hb hd a (b + 1)
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ P a (b + 1)
state_after: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ a < b + 1

tactic: apply Nat.lt_of_le_of_lt (Nat.le_succ _) h
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ a < b + 1
state_after: no goals

tactic: have this : a + 1 = b ∨ a + 1 < b := by omega
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ P (a + 1) b
state_after: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
this : a + 1 = b ∨ a + 1 < b
⊢ P (a + 1) b

tactic: have wf : (a + 1) + b < (a + 1) + (b + 1) := by simp
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
this : a + 1 = b ∨ a + 1 < b
⊢ P (a + 1) b
state_after: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
this : a + 1 = b ∨ a + 1 < b
wf : a + 1 + b < a + 1 + (b + 1)
⊢ P (a + 1) b

tactic: rcases this with (rfl | h)
state_before: case a
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
this : a + 1 = b ∨ a + 1 < b
wf : a + 1 + b < a + 1 + (b + 1)
⊢ P (a + 1) b
state_after: case a.inl
a✝ b c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a : ℕ
h : a + 1 < a + 1 + 1
wf : a + 1 + (a + 1) < a + 1 + (a + 1 + 1)
⊢ P (a + 1) (a + 1)

case a.inr
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h✝ : a + 1 < b + 1
wf : a + 1 + b < a + 1 + (b + 1)
h : a + 1 < b
⊢ P (a + 1) b

tactic: apply diag_induction P ha hb hd (a + 1) b h
state_before: case a.inr
a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h✝ : a + 1 < b + 1
wf : a + 1 + b < a + 1 + (b + 1)
h : a + 1 < b
⊢ P (a + 1) b
state_after: no goals

tactic: omega
state_before: a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ a + 1 = b ∨ a + 1 < b
state_after: no goals

tactic: simp
state_before: a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
this : a + 1 = b ∨ a + 1 < b
⊢ a + 1 + b < a + 1 + (b + 1)
state_after: no goals

tactic: exact ha _
state_before: case a.inl
a✝ b c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a : ℕ
h : a + 1 < a + 1 + 1
wf : a + 1 + (a + 1) < a + 1 + (a + 1 + 1)
⊢ P (a + 1) (a + 1)
state_after: no goals

tactic: simp
state_before: a✝ b✝ c d m n k : ℕ
p q : ℕ → Prop
P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
a b : ℕ
h : a + 1 < b + 1
⊢ a + (b + 1) < a + 1 + (b + 1)
state_after: no goals

tactic: all_goals assumption
state_before: P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
x : (a : ℕ) ×' (b : ℕ) ×' a < b
a✝⁴ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y x →
      P y.1 y.2.1
a✝³ : ℕ
b✝¹ : (x : ℕ) ×' a✝³ < x
a✝² :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, b✝¹⟩ →
      P y.1 y.2.1
b✝ : ℕ
a✝¹ : a✝³ < b✝
a✝ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, ⟨b✝, a✝¹⟩⟩ →
      P y.1 y.2.1
a b : ℕ
h✝ : a + 1 < b + 1
x✝ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a.succ, ⟨b.succ, h✝⟩⟩ →
      P y.1 y.2.1
this : a + 1 = b ∨ a + 1 < b
wf : a + 1 + b < a + 1 + (b + 1)
h : a + 1 < b
⊢ (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
        instWellFoundedRelationOfSizeOf).1
    ⟨a + 1, ⟨b, h⟩⟩ ⟨a.succ, ⟨b.succ, h✝⟩⟩

P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
x : (a : ℕ) ×' (b : ℕ) ×' a < b
a✝⁴ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y x →
      P y.1 y.2.1
a✝³ : ℕ
b✝¹ : (x : ℕ) ×' a✝³ < x
a✝² :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, b✝¹⟩ →
      P y.1 y.2.1
b✝ : ℕ
a✝¹ : a✝³ < b✝
a✝ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, ⟨b✝, a✝¹⟩⟩ →
      P y.1 y.2.1
a b : ℕ
h : a + 1 < b + 1
x✝¹ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a.succ, ⟨b.succ, h⟩⟩ →
      P y.1 y.2.1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
        instWellFoundedRelationOfSizeOf).1
    ⟨a, ⟨b + 1, ⋯⟩⟩ ⟨a.succ, ⟨b.succ, h⟩⟩
state_after: no goals

tactic: assumption
state_before: P : ℕ → ℕ → Prop
ha : ∀ (a : ℕ), P (a + 1) (a + 1)
hb : ∀ (b : ℕ), P 0 (b + 1)
hd : ∀ (a b : ℕ), a < b → P (a + 1) b → P a (b + 1) → P (a + 1) (b + 1)
x : (a : ℕ) ×' (b : ℕ) ×' a < b
a✝⁴ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y x →
      P y.1 y.2.1
a✝³ : ℕ
b✝¹ : (x : ℕ) ×' a✝³ < x
a✝² :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, b✝¹⟩ →
      P y.1 y.2.1
b✝ : ℕ
a✝¹ : a✝³ < b✝
a✝ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a✝³, ⟨b✝, a✝¹⟩⟩ →
      P y.1 y.2.1
a b : ℕ
h : a + 1 < b + 1
x✝¹ :
  ∀ (y : (a : ℕ) ×' (b : ℕ) ×' a < b),
    (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
            instWellFoundedRelationOfSizeOf).1
        y ⟨a.succ, ⟨b.succ, h⟩⟩ →
      P y.1 y.2.1
x✝ : a + (b + 1) < a + 1 + (b + 1)
⊢ (invImage (fun x => PSigma.casesOn x fun a b => PSigma.casesOn b fun b a_1 => a + b)
        instWellFoundedRelationOfSizeOf).1
    ⟨a, ⟨b + 1, ⋯⟩⟩ ⟨a.succ, ⟨b.succ, h⟩⟩
state_after: no goals