Theorem: CompositionSeries.toList_injective
File: Mathlib/Order/JordanHolder.lean

tactic: have h₁ : s₁.length = s₂.length :=
  Nat.succ_injective
    ((List.length_ofFn s₁).symm.trans <| (congr_arg List.length h).trans <| List.length_ofFn s₂)
state_before: X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
h : List.ofFn s₁.series = List.ofFn s₂.series
⊢ s₁ = s₂

tactic: have h₂ : ∀ i : Fin s₁.length.succ, s₁ i = s₂ (Fin.cast (congr_arg Nat.succ h₁) i) :=
  congr_fun <| List.ofFn_injective <| h.trans <| List.ofFn_congr (congr_arg Nat.succ h₁).symm _
state_before: X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
h : List.ofFn s₁.series = List.ofFn s₂.series
h₁ : s₁.length = s₂.length
⊢ s₁ = s₂

tactic: cases s₁
state_before: X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
h : List.ofFn s₁.series = List.ofFn s₂.series
h₁ : s₁.length = s₂.length
h₂ :
  ∀ (i : Fin (Nat.succ s₁.length)),
    series s₁ i = series s₂ (↑(Fin.cast (_ : Nat.succ s₁.length = Nat.succ s₂.length)) i)
⊢ s₁ = s₂

tactic: cases s₂
state_before: case mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₂ : CompositionSeries X
length✝ : ℕ
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h : List.ofFn { length := length✝, series := series✝, step' := step'✝ }.series = List.ofFn s₂.series
h₁ : { length := length✝, series := series✝, step' := step'✝ }.length = s₂.length
h₂ :
  ∀ (i : Fin (Nat.succ { length := length✝, series := series✝, step' := step'✝ }.length)),
    series { length := length✝, series := series✝, step' := step'✝ } i =
      series s₂
        (↑(Fin.cast
              (_ : Nat.succ { length := length✝, series := series✝, step' := step'✝ }.length = Nat.succ s₂.length))
          i)
⊢ { length := length✝, series := series✝, step' := step'✝ } = s₂

tactic: dsimp at h h₁ h₂
state_before: case mk.mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
length✝¹ : ℕ
series✝¹ : Fin (length✝¹ + 1) → X
step'✝¹ : ∀ (i : Fin length✝¹), IsMaximal (series✝¹ (↑Fin.castSucc i)) (series✝¹ (Fin.succ i))
length✝ : ℕ
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h :
  List.ofFn { length := length✝¹, series := series✝¹, step' := step'✝¹ }.series =
    List.ofFn { length := length✝, series := series✝, step' := step'✝ }.series
h₁ :
  { length := length✝¹, series := series✝¹, step' := step'✝¹ }.length =
    { length := length✝, series := series✝, step' := step'✝ }.length
h₂ :
  ∀ (i : Fin (Nat.succ { length := length✝¹, series := series✝¹, step' := step'✝¹ }.length)),
    series { length := length✝¹, series := series✝¹, step' := step'✝¹ } i =
      series { length := length✝, series := series✝, step' := step'✝ }
        (↑(Fin.cast
              (_ :
                Nat.succ { length := length✝¹, series := series✝¹, step' := step'✝¹ }.length =
                  Nat.succ { length := length✝, series := series✝, step' := step'✝ }.length))
          i)
⊢ { length := length✝¹, series := series✝¹, step' := step'✝¹ } =
    { length := length✝, series := series✝, step' := step'✝ }

tactic: subst h₁
state_before: case mk.mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
length✝¹ : ℕ
series✝¹ : Fin (length✝¹ + 1) → X
step'✝¹ : ∀ (i : Fin length✝¹), IsMaximal (series✝¹ (↑Fin.castSucc i)) (series✝¹ (Fin.succ i))
length✝ : ℕ
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h : List.ofFn series✝¹ = List.ofFn series✝
h₁ : length✝¹ = length✝
h₂ : ∀ (i : Fin (Nat.succ length✝¹)), series✝¹ i = series✝ (↑(Fin.cast (_ : Nat.succ length✝¹ = Nat.succ length✝)) i)
⊢ { length := length✝¹, series := series✝¹, step' := step'✝¹ } =
    { length := length✝, series := series✝, step' := step'✝ }

tactic: simp only [mk.injEq, heq_eq_eq, true_and]
state_before: case mk.mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
length✝ : ℕ
series✝¹ : Fin (length✝ + 1) → X
step'✝¹ : ∀ (i : Fin length✝), IsMaximal (series✝¹ (↑Fin.castSucc i)) (series✝¹ (Fin.succ i))
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h : List.ofFn series✝¹ = List.ofFn series✝
h₂ : ∀ (i : Fin (Nat.succ length✝)), series✝¹ i = series✝ (↑(Fin.cast (_ : Nat.succ length✝ = Nat.succ length✝)) i)
⊢ { length := length✝, series := series✝¹, step' := step'✝¹ } =
    { length := length✝, series := series✝, step' := step'✝ }

tactic: simp only [Fin.cast_refl] at h₂
state_before: case mk.mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
length✝ : ℕ
series✝¹ : Fin (length✝ + 1) → X
step'✝¹ : ∀ (i : Fin length✝), IsMaximal (series✝¹ (↑Fin.castSucc i)) (series✝¹ (Fin.succ i))
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h : List.ofFn series✝¹ = List.ofFn series✝
h₂ : ∀ (i : Fin (Nat.succ length✝)), series✝¹ i = series✝ (↑(Fin.cast (_ : Nat.succ length✝ = Nat.succ length✝)) i)
⊢ series✝¹ = series✝

tactic: exact funext h₂
state_before: case mk.mk
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
length✝ : ℕ
series✝¹ : Fin (length✝ + 1) → X
step'✝¹ : ∀ (i : Fin length✝), IsMaximal (series✝¹ (↑Fin.castSucc i)) (series✝¹ (Fin.succ i))
series✝ : Fin (length✝ + 1) → X
step'✝ : ∀ (i : Fin length✝), IsMaximal (series✝ (↑Fin.castSucc i)) (series✝ (Fin.succ i))
h : List.ofFn series✝¹ = List.ofFn series✝
h₂ : ∀ (i : Fin (Nat.succ length✝)), series✝¹ i = series✝ (↑(OrderIso.refl (Fin (Nat.succ length✝))) i)
⊢ series✝¹ = series✝