Theorem: List.map_length_splitWrtCompositionAux
File: Mathlib/Combinatorics/Enumerative/Composition.lean

tactic: induction' ns with n ns IH <;> intro l h <;> simp at h
state_before: n : ℕ
α : Type u_1
ns : List ℕ
⊢ ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
state_after: case nil
n : ℕ
α : Type u_1
l : List α
h : True
⊢ map length (l.splitWrtCompositionAux []) = []

case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
⊢ map length (l.splitWrtCompositionAux (n :: ns)) = n :: ns

tactic: have := le_trans (Nat.le_add_right _ _) h
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
⊢ map length (l.splitWrtCompositionAux (n :: ns)) = n :: ns
state_after: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ map length (l.splitWrtCompositionAux (n :: ns)) = n :: ns

tactic: simp only [splitWrtCompositionAux_cons, this]
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ map length (l.splitWrtCompositionAux (n :: ns)) = n :: ns
state_after: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ map length (take n l :: (drop n l).splitWrtCompositionAux ns) = n :: ns

tactic: dsimp
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ map length (take n l :: (drop n l).splitWrtCompositionAux ns) = n :: ns
state_after: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ (take n l).length :: map length ((drop n l).splitWrtCompositionAux ns) = n :: ns

tactic: rw [length_take, IH] <;> simp [length_drop]
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ (take n l).length :: map length ((drop n l).splitWrtCompositionAux ns) = n :: ns
state_after: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ n ≤ l.length

case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ ns.sum ≤ l.length - n

tactic: simp [splitWrtCompositionAux]
state_before: case nil
n : ℕ
α : Type u_1
l : List α
h : True
⊢ map length (l.splitWrtCompositionAux []) = []
state_after: no goals

tactic: assumption
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ n ≤ l.length
state_after: no goals

tactic: exact le_tsub_of_add_le_left h
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, ns.sum ≤ l.length → map length (l.splitWrtCompositionAux ns) = ns
l : List α
h : n + ns.sum ≤ l.length
this : n ≤ l.length
⊢ ns.sum ≤ l.length - n
state_after: no goals