l3lab/ntp-mathlib huggingface dataset:
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc i), series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ i))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) (Fin.castSucc (e i)),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) (Fin.succ (e i)))

Next tactic:
dsimp only []
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc i), series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ i))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.castSucc ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) i)),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.succ ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) i)))

Next tactic:
refine' Fin.lastCases _ (fun i => _) i
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · 

Proof state:
case refine'_1
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc (Fin.last (snoc s x₁ hsat₁).length)),
      series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ (Fin.last (snoc s x₁ hsat₁).length)))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.castSucc
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length)))
            (Fin.last (snoc s x₁ hsat₁).length))),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.succ
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length)))
            (Fin.last (snoc s x₁ hsat₁).length))))

Next tactic:
erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      

Proof state:
case refine'_1
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
⊢ Iso (x₁, y₁) (series s (Fin.last s.length), x₂)

Next tactic:
exact hr₂
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      exact hr₂
    · 

Proof state:
case refine'_2
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i✝ : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
i : Fin (snoc s x₁ hsat₁).length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc (Fin.castSucc i)),
      series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ (Fin.castSucc i)))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.castSucc ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) (Fin.castSucc i))),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.succ ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) (Fin.castSucc i))))

Next tactic:
refine' Fin.lastCases _ (fun i => _) i
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      exact hr₂
    · refine' Fin.lastCases _ (fun i => _) i
      · 

Proof state:
case refine'_2.refine'_1
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i✝ : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
i : Fin (snoc s x₁ hsat₁).length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc (Fin.castSucc (Fin.last s.length))),
      series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ (Fin.castSucc (Fin.last s.length))))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.castSucc
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length)))
            (Fin.castSucc (Fin.last s.length)))),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.succ
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length)))
            (Fin.castSucc (Fin.last s.length)))))

Next tactic:
erw [Equiv.swap_apply_right, snoc_castSucc, snoc_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, Fin.succ_last, snoc_last, snoc_last,
          Fin.succ_last, snoc_last]
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      exact hr₂
    · refine' Fin.lastCases _ (fun i => _) i
      · erw [Equiv.swap_apply_right, snoc_castSucc, snoc_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, Fin.succ_last, snoc_last, snoc_last,
          Fin.succ_last, snoc_last]
        

Proof state:
case refine'_2.refine'_1
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i✝ : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
i : Fin (snoc s x₁ hsat₁).length
⊢ Iso (series s (Fin.last s.length), x₁) (x₂, y₂)

Next tactic:
exact hr₁
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      exact hr₂
    · refine' Fin.lastCases _ (fun i => _) i
      · erw [Equiv.swap_apply_right, snoc_castSucc, snoc_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, Fin.succ_last, snoc_last, snoc_last,
          Fin.succ_last, snoc_last]
        exact hr₁
      · 

Proof state:
case refine'_2.refine'_2
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i✝¹ : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
i✝ : Fin (snoc s x₁ hsat₁).length
i : Fin s.length
⊢ Iso
    (series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.castSucc (Fin.castSucc (Fin.castSucc i))),
      series (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (Fin.succ (Fin.castSucc (Fin.castSucc i))))
    (series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.castSucc
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) (Fin.castSucc (Fin.castSucc i)))),
      series (snoc (snoc s x₂ hsat₂) y₂ hsaty₂)
        (Fin.succ
          ((Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))) (Fin.castSucc (Fin.castSucc i)))))

Next tactic:
erw [Equiv.swap_apply_of_ne_of_ne h2 h1, snoc_castSucc, snoc_castSucc,
          snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, snoc_castSucc, snoc_castSucc]
theorem snoc_snoc_swap {s : CompositionSeries X} {x₁ x₂ y₁ y₂ : X} {hsat₁ : IsMaximal s.top x₁}
    {hsat₂ : IsMaximal s.top x₂} {hsaty₁ : IsMaximal (snoc s x₁ hsat₁).top y₁}
    {hsaty₂ : IsMaximal (snoc s x₂ hsat₂).top y₂} (hr₁ : Iso (s.top, x₁) (x₂, y₂))
    (hr₂ : Iso (x₁, y₁) (s.top, x₂)) :
    Equivalent (snoc (snoc s x₁ hsat₁) y₁ hsaty₁) (snoc (snoc s x₂ hsat₂) y₂ hsaty₂) :=
  let e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
    Equiv.swap (Fin.last _) (Fin.castSucc (Fin.last _))
  have h1 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ (Fin.castSucc (Fin.last _)) := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  have h2 : ∀ {i : Fin s.length},
      (Fin.castSucc (Fin.castSucc i)) ≠ Fin.last _ := fun {_} =>
    ne_of_lt (by simp [Fin.castSucc_lt_last])
  ⟨e, by
    intro i
    dsimp only []
    refine' Fin.lastCases _ (fun i => _) i
    · erw [Equiv.swap_apply_left, snoc_castSucc, snoc_last, Fin.succ_last, snoc_last,
        snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc, Fin.succ_last,
        snoc_last]
      exact hr₂
    · refine' Fin.lastCases _ (fun i => _) i
      · erw [Equiv.swap_apply_right, snoc_castSucc, snoc_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, Fin.succ_last, snoc_last, snoc_last,
          Fin.succ_last, snoc_last]
        exact hr₁
      · erw [Equiv.swap_apply_of_ne_of_ne h2 h1, snoc_castSucc, snoc_castSucc,
          snoc_castSucc, snoc_castSucc, Fin.succ_castSucc, snoc_castSucc,
          Fin.succ_castSucc, snoc_castSucc, snoc_castSucc, snoc_castSucc]
        

Proof state:
case refine'_2.refine'_2
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s : CompositionSeries X
x₁ x₂ y₁ y₂ : X
hsat₁ : IsMaximal (top s) x₁
hsat₂ : IsMaximal (top s) x₂
hsaty₁ : IsMaximal (top (snoc s x₁ hsat₁)) y₁
hsaty₂ : IsMaximal (top (snoc s x₂ hsat₂)) y₂
hr₁ : Iso (top s, x₁) (x₂, y₂)
hr₂ : Iso (x₁, y₁) (top s, x₂)
e : Fin (s.length + 1 + 1) ≃ Fin (s.length + 1 + 1) :=
  Equiv.swap (Fin.last (s.length + 1)) (Fin.castSucc (Fin.last s.length))
h1 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.castSucc (Fin.last s.length)
h2 : ∀ {i : Fin s.length}, Fin.castSucc (Fin.castSucc i) ≠ Fin.last (s.length + 1)
i✝¹ : Fin (snoc (snoc s x₁ hsat₁) y₁ hsaty₁).length
i✝ : Fin (snoc s x₁ hsat₁).length
i : Fin s.length
⊢ Iso (series s (Fin.castSucc i), series s (Fin.succ i)) (series s (Fin.castSucc i), series s (Fin.succ i))

Next tactic:
exact (s.step i).iso_refl
theorem length_eq_zero_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) (hs₁ : s₁.length = 0) : s₂.length = 0 := by
  

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hs₁ : s₁.length = 0
⊢ s₂.length = 0

Next tactic:
have : s₁.bot = s₁.top := congr_arg s₁ (Fin.ext (by simp [hs₁]))
theorem length_eq_zero_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) (hs₁ : s₁.length = 0) : s₂.length = 0 := by
  have : s₁.bot = s₁.top := congr_arg s₁ (Fin.ext (by 

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hs₁ : s₁.length = 0
⊢ ↑0 = ↑(Fin.last s₁.length)

Next tactic:
simp [hs₁]
theorem length_eq_zero_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) (hs₁ : s₁.length = 0) : s₂.length = 0 := by
  have : s₁.bot = s₁.top := congr_arg s₁ (Fin.ext (by simp [hs₁]))
  

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hs₁ : s₁.length = 0
this : bot s₁ = top s₁
⊢ s₂.length = 0

Next tactic:
have : Fin.last s₂.length = (0 : Fin s₂.length.succ) :=
    s₂.injective (hb.symm.trans (this.trans ht)).symm
theorem length_eq_zero_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) (hs₁ : s₁.length = 0) : s₂.length = 0 := by
  have : s₁.bot = s₁.top := congr_arg s₁ (Fin.ext (by simp [hs₁]))
  have : Fin.last s₂.length = (0 : Fin s₂.length.succ) :=
    s₂.injective (hb.symm.trans (this.trans ht)).symm
  -- Porting note: Was `simpa [Fin.ext_iff]`.
  

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hs₁ : s₁.length = 0
this✝ : bot s₁ = top s₁
this : Fin.last s₂.length = 0
⊢ s₂.length = 0

Next tactic:
rw [Fin.ext_iff] at this
theorem length_eq_zero_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) (hs₁ : s₁.length = 0) : s₂.length = 0 := by
  have : s₁.bot = s₁.top := congr_arg s₁ (Fin.ext (by simp [hs₁]))
  have : Fin.last s₂.length = (0 : Fin s₂.length.succ) :=
    s₂.injective (hb.symm.trans (this.trans ht)).symm
  -- Porting note: Was `simpa [Fin.ext_iff]`.
  rw [Fin.ext_iff] at this
  

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hs₁ : s₁.length = 0
this✝ : bot s₁ = top s₁
this : ↑(Fin.last s₂.length) = ↑0
⊢ s₂.length = 0

Next tactic:
simpa
theorem length_pos_of_bot_eq_bot_of_top_eq_top_of_length_pos {s₁ s₂ : CompositionSeries X}
    (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) : 0 < s₁.length → 0 < s₂.length :=
  not_imp_not.1
    (by
      

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
⊢ ¬0 < s₂.length → ¬0 < s₁.length

Next tactic:
simp only [pos_iff_ne_zero, Ne.def, not_iff_not, Classical.not_not]