Theorem: Composition.toCompositionAsSet_blocks
File: Mathlib/Combinatorics/Enumerative/Composition.lean

tactic: let d := c.toCompositionAsSet
state_before: n : ℕ
c : Composition n
⊢ c.toCompositionAsSet.blocks = c.blocks
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
⊢ c.toCompositionAsSet.blocks = c.blocks

tactic: change d.blocks = c.blocks
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
⊢ c.toCompositionAsSet.blocks = c.blocks
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
⊢ d.blocks = c.blocks

tactic: have length_eq : d.blocks.length = c.blocks.length := by simp [d, blocks_length]
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
⊢ d.blocks = c.blocks
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
⊢ d.blocks = c.blocks

tactic: suffices H : ∀ i ≤ d.blocks.length, (d.blocks.take i).sum = (c.blocks.take i).sum from
  eq_of_sum_take_eq length_eq H
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
⊢ d.blocks = c.blocks
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
⊢ ∀ i ≤ d.blocks.length, (take i d.blocks).sum = (take i c.blocks).sum

tactic: intro i hi
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
⊢ ∀ i ≤ d.blocks.length, (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: have i_lt : i < d.boundaries.card := by
  simpa [CompositionAsSet.blocks, length_ofFn,
    d.card_boundaries_eq_succ_length] using Nat.lt_succ_iff.2 hi
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: have i_lt' : i < c.boundaries.card := i_lt
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: have i_lt'' : i < c.length + 1 := by rwa [c.card_boundaries_eq_succ_length] at i_lt'
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: have A :
  d.boundaries.orderEmbOfFin rfl ⟨i, i_lt⟩ =
    c.boundaries.orderEmbOfFin c.card_boundaries_eq_succ_length ⟨i, i_lt''⟩ :=
  rfl
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
A : (d.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt⟩ = (c.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt''⟩
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: have B : c.sizeUpTo i = c.boundary ⟨i, i_lt''⟩ := rfl
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
A : (d.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt⟩ = (c.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt''⟩
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
A : (d.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt⟩ = (c.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt''⟩
B : c.sizeUpTo i = ↑(c.boundary ⟨i, i_lt''⟩)
⊢ (take i d.blocks).sum = (take i c.blocks).sum

tactic: rw [d.blocks_partial_sum i_lt, CompositionAsSet.boundary, ← Composition.sizeUpTo, B, A,
  c.orderEmbOfFin_boundaries]
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
i_lt'' : i < c.length + 1
A : (d.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt⟩ = (c.boundaries.orderEmbOfFin ⋯) ⟨i, i_lt''⟩
B : c.sizeUpTo i = ↑(c.boundary ⟨i, i_lt''⟩)
⊢ (take i d.blocks).sum = (take i c.blocks).sum
state_after: no goals

tactic: simp [d, blocks_length]
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
⊢ d.blocks.length = c.blocks.length
state_after: no goals

tactic: simpa [CompositionAsSet.blocks, length_ofFn,
  d.card_boundaries_eq_succ_length] using Nat.lt_succ_iff.2 hi
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
⊢ i < d.boundaries.card
state_after: no goals

tactic: rwa [c.card_boundaries_eq_succ_length] at i_lt'
state_before: n : ℕ
c : Composition n
d : CompositionAsSet n := c.toCompositionAsSet
length_eq : d.blocks.length = c.blocks.length
i : ℕ
hi : i ≤ d.blocks.length
i_lt : i < d.boundaries.card
i_lt' : i < c.boundaries.card
⊢ i < c.length + 1
state_after: no goals