Theorem: Nat.toNat_decide_mod2 (Lib.lean)

State before:
n : ℕ
⊢ Bool.toNat (decide (n % 2 = 0)) = (n + 1) % 2
Tactic:
cases n using binaryRec with
| z => simp
| f b _ _ => cases b <;> simp [← Nat.two_mul, Nat.mul_add_mod]
State after:
no goals

State before:
case z

⊢ Bool.toNat (decide (0 % 2 = 0)) = (0 + 1) % 2
Tactic:
simp
State after:
no goals

State before:
case f
b : Bool
n✝ : ℕ
a✝ : bit b n✝ = n✝ → Bool.toNat (decide (bit b n✝ % 2 = 0)) = (bit b n✝ + 1) % 2
⊢ Bool.toNat (decide (bit b n✝ % 2 = 0)) = (bit b n✝ + 1) % 2
Tactic:
cases b <;> simp [← Nat.two_mul, Nat.mul_add_mod]
State after:
no goals