Theorem: List.map_length_splitWrtCompositionAux
File: Mathlib/Combinatorics/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 α}, sum ns ≤ length l → map length (splitWrtCompositionAux l ns) = ns

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

case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, sum ns ≤ length l → map length (splitWrtCompositionAux l ns) = ns
l : List α
h : n + sum ns ≤ length l
⊢ map length (splitWrtCompositionAux l (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 α}, sum ns ≤ length l → map length (splitWrtCompositionAux l ns) = ns
l : List α
h : n + sum ns ≤ length l
⊢ map length (splitWrtCompositionAux l (n :: ns)) = n :: ns

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

tactic: dsimp
state_before: case cons
n✝ : ℕ
α : Type u_1
n : ℕ
ns : List ℕ
IH : ∀ {l : List α}, sum ns ≤ length l → map length (splitWrtCompositionAux l ns) = ns
l : List α
h : n + sum ns ≤ length l
this : n ≤ length l
⊢ map length (take n l :: splitWrtCompositionAux (drop n l) 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 α}, sum ns ≤ length l → map length (splitWrtCompositionAux l ns) = ns
l : List α
h : n + sum ns ≤ length l
this : n ≤ length l
⊢ length (take n l) :: map length (splitWrtCompositionAux (drop n l) ns) = n :: ns

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

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

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

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

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

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