Theorem: Int.testBit_bitwise
File: Mathlib/Data/Int/Bitwise.lean

tactic: cases m <;> cases n <;> simp only [testBit, bitwise, natBitwise]
state_before: f : Bool → Bool → Bool
m n : ℤ
k : ℕ
⊢ testBit (bitwise f m n) k = f (testBit m k) (testBit n k)

tactic: . by_cases h : f false false <;> simp [h]
state_before: case ofNat.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match bif f false false then -[Nat.bitwise' (fun x y => !f x y) a✝¹ a✝+1] else ↑(Nat.bitwise' f a✝¹ a✝), k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

case ofNat.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f false !false then -[Nat.bitwise' (fun x y => !f x !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f x !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (Nat.testBit a✝¹ k) !Nat.testBit a✝ k

case negSucc.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) false then -[Nat.bitwise' (fun x y => !f (!x) y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

case negSucc.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) !false then -[Nat.bitwise' (fun x y => !f (!x) !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) !Nat.testBit a✝ k

tactic: . by_cases h : f false true <;> simp [h]
state_before: case ofNat.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f false !false then -[Nat.bitwise' (fun x y => !f x !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f x !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (Nat.testBit a✝¹ k) !Nat.testBit a✝ k

case negSucc.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) false then -[Nat.bitwise' (fun x y => !f (!x) y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

case negSucc.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) !false then -[Nat.bitwise' (fun x y => !f (!x) !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) !Nat.testBit a✝ k

tactic: . by_cases h : f true false <;> simp [h]
state_before: case negSucc.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) false then -[Nat.bitwise' (fun x y => !f (!x) y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

case negSucc.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) !false then -[Nat.bitwise' (fun x y => !f (!x) !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) !Nat.testBit a✝ k

tactic: . by_cases h : f true true <;> simp [h]
state_before: case negSucc.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) !false then -[Nat.bitwise' (fun x y => !f (!x) !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) !Nat.testBit a✝ k

tactic: by_cases h : f false false <;> simp [h]
state_before: case ofNat.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match bif f false false then -[Nat.bitwise' (fun x y => !f x y) a✝¹ a✝+1] else ↑(Nat.bitwise' f a✝¹ a✝), k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

tactic: by_cases h : f false true <;> simp [h]
state_before: case ofNat.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f false !false then -[Nat.bitwise' (fun x y => !f x !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f x !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (Nat.testBit a✝¹ k) !Nat.testBit a✝ k

tactic: by_cases h : f true false <;> simp [h]
state_before: case negSucc.ofNat
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) false then -[Nat.bitwise' (fun x y => !f (!x) y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) (Nat.testBit a✝ k)

tactic: by_cases h : f true true <;> simp [h]
state_before: case negSucc.negSucc
f : Bool → Bool → Bool
k a✝¹ a✝ : ℕ
⊢ (match
      bif f (!false) !false then -[Nat.bitwise' (fun x y => !f (!x) !y) a✝¹ a✝+1]
      else ↑(Nat.bitwise' (fun x y => f (!x) !y) a✝¹ a✝),
      k with
    | ofNat m, n => Nat.testBit m n
    | -[m+1], n => !Nat.testBit m n) =
    f (!Nat.testBit a✝¹ k) !Nat.testBit a✝ k