Theorem: Nat.size_le
File: Mathlib/Data/Nat/Size.lean

tactic: decide
state_before: m n : ℕ
h : m.size ≤ n
⊢ 2 > 0
state_after: no goals

tactic: rw [← one_shiftLeft]
state_before: m n : ℕ
⊢ m < 2 ^ n → m.size ≤ n
state_after: m n : ℕ
⊢ m < 1 <<< n → m.size ≤ n

tactic: revert n
state_before: m n : ℕ
⊢ m < 1 <<< n → m.size ≤ n
state_after: m : ℕ
⊢ ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n

tactic: apply binaryRec _ _ m
state_before: m : ℕ
⊢ ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
state_after: m : ℕ
⊢ ∀ {n : ℕ}, 0 < 1 <<< n → size 0 ≤ n

m : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    (∀ {n_1 : ℕ}, n < 1 <<< n_1 → n.size ≤ n_1) → ∀ {n_1 : ℕ}, bit b n < 1 <<< n_1 → (bit b n).size ≤ n_1

tactic: intro n
state_before: m : ℕ
⊢ ∀ {n : ℕ}, 0 < 1 <<< n → size 0 ≤ n
state_after: m n : ℕ
⊢ 0 < 1 <<< n → size 0 ≤ n

tactic: simp
state_before: m n : ℕ
⊢ 0 < 1 <<< n → size 0 ≤ n
state_after: no goals

tactic: intro b m IH n h
state_before: m : ℕ
⊢ ∀ (b : Bool) (n : ℕ),
    (∀ {n_1 : ℕ}, n < 1 <<< n_1 → n.size ≤ n_1) → ∀ {n_1 : ℕ}, bit b n < 1 <<< n_1 → (bit b n).size ≤ n_1
state_after: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
⊢ (bit b m).size ≤ n

tactic: by_cases e : bit b m = 0
state_before: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
⊢ (bit b m).size ≤ n
state_after: case pos
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : bit b m = 0
⊢ (bit b m).size ≤ n

case neg
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : ¬bit b m = 0
⊢ (bit b m).size ≤ n

tactic: rw [size_bit e]
state_before: case neg
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : ¬bit b m = 0
⊢ (bit b m).size ≤ n
state_after: case neg
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : ¬bit b m = 0
⊢ m.size.succ ≤ n

tactic: cases' n with n
state_before: case neg
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : ¬bit b m = 0
⊢ m.size.succ ≤ n
state_after: case neg.zero
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
h : bit b m < 1 <<< 0
⊢ m.size.succ ≤ 0

case neg.succ
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ m.size.succ ≤ n + 1

tactic: simp [e]
state_before: case pos
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
n : ℕ
h : bit b m < 1 <<< n
e : bit b m = 0
⊢ (bit b m).size ≤ n
state_after: no goals

tactic: exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h))
state_before: case neg.zero
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
h : bit b m < 1 <<< 0
⊢ m.size.succ ≤ 0
state_after: no goals

tactic: apply succ_le_succ (IH _)
state_before: case neg.succ
m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ m.size.succ ≤ n + 1
state_after: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ m < 1 <<< n

tactic: apply Nat.lt_of_mul_lt_mul_left (a := 2)
state_before: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ m < 1 <<< n
state_after: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ 2 * m < 2 * 1 <<< n

tactic: simp only [← bit0_val, shiftLeft_succ] at *
state_before: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < 1 <<< (n + 1)
⊢ 2 * m < 2 * 1 <<< n
state_after: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < bit0 (1 <<< n)
⊢ bit0 m < bit0 (1 <<< n)

tactic: exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h
state_before: m✝ : ℕ
b : Bool
m : ℕ
IH : ∀ {n : ℕ}, m < 1 <<< n → m.size ≤ n
e : ¬bit b m = 0
n : ℕ
h : bit b m < bit0 (1 <<< n)
⊢ bit0 m < bit0 (1 <<< n)
state_after: no goals