Theorem: List.length_foldr_permutationsAux2'
File: Mathlib/Data/List/Permutation.lean

tactic: rw [length_foldr_permutationsAux2, (_ : Nat.sum (map length L) = n * length L)]
state_before: α : Type u_1
β : Type u_2
t : α
ts : List α
r L : List (List α)
n : ℕ
H : ∀ (l : List α), l ∈ L → l.length = n
⊢ (foldr (fun y r => (permutationsAux2 t ts r y id).2) r L).length = n * L.length + r.length
state_after: α : Type u_1
β : Type u_2
t : α
ts : List α
r L : List (List α)
n : ℕ
H : ∀ (l : List α), l ∈ L → l.length = n
⊢ Nat.sum (map length L) = n * L.length

tactic: induction' L with l L ih
state_before: α : Type u_1
β : Type u_2
t : α
ts : List α
r L : List (List α)
n : ℕ
H : ∀ (l : List α), l ∈ L → l.length = n
⊢ Nat.sum (map length L) = n * L.length
state_after: case nil
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
H : ∀ (l : List α), l ∈ [] → l.length = n
⊢ Nat.sum (map length []) = n * [].length

case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length

tactic: have sum_map : Nat.sum (map length L) = n * length L := ih fun l m => H l (mem_cons_of_mem _ m)
state_before: case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length
state_after: case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
sum_map : Nat.sum (map length L) = n * L.length
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length

tactic: have length_l : length l = n := H _ (mem_cons_self _ _)
state_before: case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
sum_map : Nat.sum (map length L) = n * L.length
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length
state_after: case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
sum_map : Nat.sum (map length L) = n * L.length
length_l : l.length = n
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length

tactic: simp [sum_map, length_l, Nat.mul_add, Nat.add_comm, mul_succ]
state_before: case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
l : List α
L : List (List α)
ih : (∀ (l : List α), l ∈ L → l.length = n) → Nat.sum (map length L) = n * L.length
H : ∀ (l_1 : List α), l_1 ∈ l :: L → l_1.length = n
sum_map : Nat.sum (map length L) = n * L.length
length_l : l.length = n
⊢ Nat.sum (map length (l :: L)) = n * (l :: L).length
state_after: no goals

tactic: simp
state_before: case nil
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List (List α)
n : ℕ
H : ∀ (l : List α), l ∈ [] → l.length = n
⊢ Nat.sum (map length []) = n * [].length
state_after: no goals