Theorem: Nat.size_shiftLeft'
File: Mathlib/Data/Nat/Size.lean

tactic: induction' n with n IH <;> simp [shiftLeft'] at h ⊢
state_before: b : Bool
m n : ℕ
h : shiftLeft' b m n ≠ 0
⊢ (shiftLeft' b m n).size = m.size + n
state_after: case succ
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
⊢ (bit b (shiftLeft' b m n)).size = m.size + (n + 1)

tactic: rw [size_bit h, Nat.add_succ]
state_before: case succ
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
⊢ (bit b (shiftLeft' b m n)).size = m.size + (n + 1)
state_after: case succ
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
⊢ (shiftLeft' b m n).size.succ = (m.size + n).succ

tactic: by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
state_before: case succ
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
⊢ (shiftLeft' b m n).size.succ = (m.size + n).succ
state_after: case pos
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
s0 : shiftLeft' b m n = 0
⊢ (shiftLeft' b m n).size.succ = (m.size + n).succ

tactic: rw [s0] at h ⊢
state_before: case pos
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b (shiftLeft' b m n) = 0
s0 : shiftLeft' b m n = 0
⊢ (shiftLeft' b m n).size.succ = (m.size + n).succ
state_after: case pos
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b 0 = 0
s0 : shiftLeft' b m n = 0
⊢ (size 0).succ = (m.size + n).succ

tactic: cases b
state_before: case pos
b : Bool
m n : ℕ
IH : shiftLeft' b m n ≠ 0 → (shiftLeft' b m n).size = m.size + n
h : ¬bit b 0 = 0
s0 : shiftLeft' b m n = 0
⊢ (size 0).succ = (m.size + n).succ
state_after: case pos.false
m n : ℕ
IH : shiftLeft' false m n ≠ 0 → (shiftLeft' false m n).size = m.size + n
h : ¬bit false 0 = 0
s0 : shiftLeft' false m n = 0
⊢ (size 0).succ = (m.size + n).succ

case pos.true
m n : ℕ
IH : shiftLeft' true m n ≠ 0 → (shiftLeft' true m n).size = m.size + n
h : ¬bit true 0 = 0
s0 : shiftLeft' true m n = 0
⊢ (size 0).succ = (m.size + n).succ

tactic: rw [shiftLeft'_tt_eq_mul_pow] at this
state_before: case pos.true
m n : ℕ
IH : shiftLeft' true m n ≠ 0 → (shiftLeft' true m n).size = m.size + n
h : ¬bit true 0 = 0
s0 : shiftLeft' true m n = 0
this : shiftLeft' true m n + 1 = 1
⊢ (size 0).succ = (m.size + n).succ
state_after: case pos.true
m n : ℕ
IH : shiftLeft' true m n ≠ 0 → (shiftLeft' true m n).size = m.size + n
h : ¬bit true 0 = 0
s0 : shiftLeft' true m n = 0
this : (m + 1) * 2 ^ n = 1
⊢ (size 0).succ = (m.size + n).succ

tactic: obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩)
state_before: case pos.true
m n : ℕ
IH : shiftLeft' true m n ≠ 0 → (shiftLeft' true m n).size = m.size + n
h : ¬bit true 0 = 0
s0 : shiftLeft' true m n = 0
this : (m + 1) * 2 ^ n = 1
⊢ (size 0).succ = (m.size + n).succ
state_after: case pos.true
n : ℕ
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 n ≠ 0 → (shiftLeft' true 0 n).size = size 0 + n
s0 : shiftLeft' true 0 n = 0
this : (0 + 1) * 2 ^ n = 1
⊢ (size 0).succ = (size 0 + n).succ

tactic: simp only [zero_add, one_mul] at this
state_before: case pos.true
n : ℕ
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 n ≠ 0 → (shiftLeft' true 0 n).size = size 0 + n
s0 : shiftLeft' true 0 n = 0
this : (0 + 1) * 2 ^ n = 1
⊢ (size 0).succ = (size 0 + n).succ
state_after: case pos.true
n : ℕ
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 n ≠ 0 → (shiftLeft' true 0 n).size = size 0 + n
s0 : shiftLeft' true 0 n = 0
this : 2 ^ n = 1
⊢ (size 0).succ = (size 0 + n).succ

tactic: obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
state_before: case pos.true
n : ℕ
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 n ≠ 0 → (shiftLeft' true 0 n).size = size 0 + n
s0 : shiftLeft' true 0 n = 0
this : 2 ^ n = 1
⊢ (size 0).succ = (size 0 + n).succ
state_after: case pos.true
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 0 ≠ 0 → (shiftLeft' true 0 0).size = size 0 + 0
s0 : shiftLeft' true 0 0 = 0
this : 2 ^ 0 = 1
⊢ (size 0).succ = (size 0 + 0).succ

tactic: rfl
state_before: case pos.true
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 0 ≠ 0 → (shiftLeft' true 0 0).size = size 0 + 0
s0 : shiftLeft' true 0 0 = 0
this : 2 ^ 0 = 1
⊢ (size 0).succ = (size 0 + 0).succ
state_after: no goals

tactic: exact absurd rfl h
state_before: case pos.false
m n : ℕ
IH : shiftLeft' false m n ≠ 0 → (shiftLeft' false m n).size = m.size + n
h : ¬bit false 0 = 0
s0 : shiftLeft' false m n = 0
⊢ (size 0).succ = (m.size + n).succ
state_after: no goals

tactic: decide
state_before: n : ℕ
h : ¬bit true 0 = 0
IH : shiftLeft' true 0 n ≠ 0 → (shiftLeft' true 0 n).size = size 0 + n
s0 : shiftLeft' true 0 n = 0
this : 2 ^ n = 1
hn : n ≠ 0
⊢ 1 < 2
state_after: no goals