Theorem: CompositionAsSet.toComposition_boundaries
File: Mathlib/Combinatorics/Enumerative/Composition.lean

tactic: ext j
state_before: n : ℕ
c : CompositionAsSet n
⊢ c.toComposition.boundaries = c.boundaries
state_after: case a
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ j ∈ c.toComposition.boundaries ↔ j ∈ c.boundaries

tactic: simp only [c.mem_boundaries_iff_exists_blocks_sum_take_eq, Composition.boundaries, Finset.mem_map]
state_before: case a
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ j ∈ c.toComposition.boundaries ↔ j ∈ c.boundaries
state_after: case a
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j) ↔ ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j

tactic: constructor
state_before: case a
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j) ↔ ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j
state_after: case a.mp
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j) → ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j

case a.mpr
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j) → ∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j

tactic: rintro ⟨i, _, hi⟩
state_before: case a.mp
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j) → ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j
state_after: case a.mp.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j

tactic: refine ⟨i.1, ?_, ?_⟩
state_before: case a.mp.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ ∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j
state_after: case a.mp.intro.intro.refine_1
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ ↑i < c.boundaries.card

case a.mp.intro.intro.refine_2
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ (take (↑i) c.blocks).sum = ↑j

tactic: simpa [c.card_boundaries_eq_succ_length] using i.2
state_before: case a.mp.intro.intro.refine_1
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ ↑i < c.boundaries.card
state_after: no goals

tactic: simp [Composition.boundary, Composition.sizeUpTo, ← hi]
state_before: case a.mp.intro.intro.refine_2
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : Fin (c.toComposition.length + 1)
left✝ : i ∈ Finset.univ
hi : c.toComposition.boundary.toEmbedding i = j
⊢ (take (↑i) c.blocks).sum = ↑j
state_after: no goals

tactic: rintro ⟨i, i_lt, hi⟩
state_before: case a.mpr
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
⊢ (∃ i < c.boundaries.card, (take i c.blocks).sum = ↑j) → ∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j
state_after: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.boundaries.card
hi : (take i c.blocks).sum = ↑j
⊢ ∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j

tactic: refine ⟨i, by simp, ?_⟩
state_before: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.boundaries.card
hi : (take i c.blocks).sum = ↑j
⊢ ∃ a ∈ Finset.univ, c.toComposition.boundary.toEmbedding a = j
state_after: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.boundaries.card
hi : (take i c.blocks).sum = ↑j
⊢ c.toComposition.boundary.toEmbedding ↑i = j

tactic: rw [c.card_boundaries_eq_succ_length] at i_lt
state_before: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.boundaries.card
hi : (take i c.blocks).sum = ↑j
⊢ c.toComposition.boundary.toEmbedding ↑i = j
state_after: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.length + 1
hi : (take i c.blocks).sum = ↑j
⊢ c.toComposition.boundary.toEmbedding ↑i = j

tactic: simp [Composition.boundary, Nat.mod_eq_of_lt i_lt, Composition.sizeUpTo, hi]
state_before: case a.mpr.intro.intro
n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.length + 1
hi : (take i c.blocks).sum = ↑j
⊢ c.toComposition.boundary.toEmbedding ↑i = j
state_after: no goals

tactic: simp
state_before: n : ℕ
c : CompositionAsSet n
j : Fin (n + 1)
i : ℕ
i_lt : i < c.boundaries.card
hi : (take i c.blocks).sum = ↑j
⊢ ↑i ∈ Finset.univ
state_after: no goals