Theorem: Nat.bitIndices_twoPowsum
File: Mathlib/Data/Nat/BitIndices.lean

Proof steps:
state_before: a n : ℕ
L : List ℕ
hL : Sorted (fun x x_1 => x < x_1) L
⊢ (map (fun i => 2 ^ i) L).sum.bitIndices = L
state_after: case nil
a n : ℕ
hL : Sorted (fun x x_1 => x < x_1) []
⊢ (map (fun i => 2 ^ i) []).sum.bitIndices = []

case cons
a✝ n a : ℕ
L : List ℕ
hL : Sorted (fun x x_1 => x < x_1) (a :: L)
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
tactic: cases' L with a L
state_before: case cons
a✝ n a : ℕ
L : List ℕ
hL : Sorted (fun x x_1 => x < x_1) (a :: L)
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
state_after: case cons.intro
a✝ n a : ℕ
L : List ℕ
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: L)
haL : ∀ b ∈ L, a < b
hL : Sorted (fun x x_1 => x < x_1) L
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
tactic: obtain ⟨haL, hL⟩ := sorted_cons.1 hL
state_before: case cons.intro
a✝ n a : ℕ
L : List ℕ
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: L)
haL : ∀ b ∈ L, a < b
hL : Sorted (fun x x_1 => x < x_1) L
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
state_after: case cons.intro
a✝ n a : ℕ
L : List ℕ
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: L)
hL : Sorted (fun x x_1 => x < x_1) L
haL : ∀ b ∈ L, a + 1 ≤ b
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
tactic: simp_rw [Nat.lt_iff_add_one_le] at haL
state_before: case cons.intro
a✝ n a : ℕ
L : List ℕ
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: L)
hL : Sorted (fun x x_1 => x < x_1) L
haL : ∀ b ∈ L, a + 1 ≤ b
h' : ∃ L₀, Sorted (fun x x_1 => x < x_1) L₀ ∧ L = map (fun x => x + a + 1) L₀
⊢ (map (fun i => 2 ^ i) (a :: L)).sum.bitIndices = a :: L
state_after: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
⊢ (map (fun i => 2 ^ i) (a :: map (fun x => x + a + 1) L₀)).sum.bitIndices = a :: map (fun x => x + a + 1) L₀
tactic: obtain ⟨L₀, hL₀, rfl⟩ := h'
state_before: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ (map (fun i => 2 ^ i) (a :: map (fun x => x + a + 1) L₀)).sum.bitIndices = a :: map (fun x => x + a + 1) L₀
state_after: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ (2 ^ a + 2 ^ a * (2 * (map (HPow.hPow 2) L₀).sum)).bitIndices = a :: map (fun x => x + a + 1) L₀
tactic: simp only [List.map_cons, List.map_map, List.sum_map_mul_left, List.sum_cons, hrw]
state_before: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ (2 ^ a + 2 ^ a * (2 * (map (HPow.hPow 2) L₀).sum)).bitIndices = a :: map (fun x => x + a + 1) L₀
state_after: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ (2 ^ a * 1 + 2 ^ a * (2 * (map (HPow.hPow 2) L₀).sum)).bitIndices = a :: map (fun x => x + a + 1) L₀
tactic: nth_rw 1 [← mul_one (a := 2^a)]
state_before: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ (2 ^ a * 1 + 2 ^ a * (2 * (map (HPow.hPow 2) L₀).sum)).bitIndices = a :: map (fun x => x + a + 1) L₀
state_after: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ map (fun x => x + a) (0 :: map (fun x => x + 1) L₀) = a :: map (fun x => x + a + 1) L₀
tactic: rw [← mul_add, bitIndices_two_pow_mul, add_comm, bitIndices_two_mul_add_one,
    bitIndices_twoPowsum hL₀]
state_before: case cons.intro.intro.intro
a✝ n a : ℕ
L₀ : List ℕ
hL₀ : Sorted (fun x x_1 => x < x_1) L₀
hL✝ : Sorted (fun x x_1 => x < x_1) (a :: map (fun x => x + a + 1) L₀)
hL : Sorted (fun x x_1 => x < x_1) (map (fun x => x + a + 1) L₀)
haL : ∀ b ∈ map (fun x => x + a + 1) L₀, a + 1 ≤ b
x✝ : L₀.length < (a :: map (fun x => x + a + 1) L₀).length
hrw : ((fun x => 2 ^ x) ∘ fun x => x + a + 1) = fun i => 2 ^ a * (2 * 2 ^ i)
⊢ map (fun x => x + a) (0 :: map (fun x => x + 1) L₀) = a :: map (fun x => x + a + 1) L₀
state_after: no goals
tactic: simp [add_comm (a := 1), add_assoc]