l3lab/ntp-mathlib huggingface dataset:
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
⊢ Equivalent (snoc (eraseTop s) (top s) (_ : IsMaximal (top (eraseTop s)) (top s)))
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))

Next tactic:
exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by 

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
⊢ Iso (top (eraseTop s), top s) (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))), top s)

Next tactic:
simpa using (isMaximal_eraseTop_top h0s).iso_refl
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
      

Proof state:
case h
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
this :
  Equivalent s
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
⊢ Equivalent s (snoc (snoc t x hmtx) (top s) (_ : IsMaximal (top (snoc t x hmtx)) (top s)))

Next tactic:
refine' this.trans _
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
      refine' this.trans _
      

Proof state:
case h
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
this :
  Equivalent s
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
⊢ Equivalent
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
    (snoc (snoc t x hmtx) (top s) (_ : IsMaximal (top (snoc t x hmtx)) (top s)))

Next tactic:
refine' Equivalent.snoc_snoc_swap _ _
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
      refine' this.trans _
      refine' Equivalent.snoc_snoc_swap _ _
      · 

Proof state:
case h.refine'_1
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
this :
  Equivalent s
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
⊢ Iso (top t, top (eraseTop s)) (x, top s)

Next tactic:
exact
          iso_symm
            (second_iso_of_eq hm
              (sup_eq_of_isMaximal hm (isMaximal_eraseTop_top h0s) (Ne.symm hetx)) htt.symm)
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
      refine' this.trans _
      refine' Equivalent.snoc_snoc_swap _ _
      · exact
          iso_symm
            (second_iso_of_eq hm
              (sup_eq_of_isMaximal hm (isMaximal_eraseTop_top h0s) (Ne.symm hetx)) htt.symm)
      · 

Proof state:
case h.refine'_2
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
this :
  Equivalent s
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
⊢ Iso (top (eraseTop s), top s) (top t, x)

Next tactic:
exact
          second_iso_of_eq (isMaximal_eraseTop_top h0s)
            (sup_eq_of_isMaximal (isMaximal_eraseTop_top h0s) hm hetx) (by rw [inf_comm, htt])
/-- Given a `CompositionSeries`, `s`, and an element `x`
such that `x` is maximal inside `s.top` there is a series, `t`,
such that `t.top = x`, `t.bot = s.bot`
and `snoc t s.top _` is equivalent to `s`. -/
theorem exists_top_eq_snoc_equivalant (s : CompositionSeries X) (x : X) (hm : IsMaximal x s.top)
    (hb : s.bot ≤ x) :
    ∃ t : CompositionSeries X,
      t.bot = s.bot ∧ t.length + 1 = s.length ∧
      ∃ htx : t.top = x, Equivalent s (snoc t s.top (htx.symm ▸ hm)) := by
  induction' hn : s.length with n ih generalizing s x
  · exact
      (ne_of_gt (lt_of_le_of_lt hb (lt_of_isMaximal hm))
          (forall_mem_eq_of_length_eq_zero hn s.top_mem s.bot_mem)).elim
  · have h0s : 0 < s.length := hn.symm ▸ Nat.succ_pos _
    by_cases hetx : s.eraseTop.top = x
    · use s.eraseTop
      simp [← hetx, hn]
      -- Porting note: `rfl` is required.
      rfl
    · have imxs : IsMaximal (x ⊓ s.eraseTop.top) s.eraseTop.top :=
        isMaximal_of_eq_inf x s.top rfl (Ne.symm hetx) hm (isMaximal_eraseTop_top h0s)
      have := ih _ _ imxs (le_inf (by simpa) (le_top_of_mem s.eraseTop.bot_mem)) (by simp [hn])
      rcases this with ⟨t, htb, htl, htt, hteqv⟩
      have hmtx : IsMaximal t.top x :=
        isMaximal_of_eq_inf s.eraseTop.top s.top (by rw [inf_comm, htt]) hetx
          (isMaximal_eraseTop_top h0s) hm
      use snoc t x hmtx
      refine' ⟨by simp [htb], by simp [htl], by simp, _⟩
      have : s.Equivalent ((snoc t s.eraseTop.top (htt.symm ▸ imxs)).snoc s.top
          (by simpa using isMaximal_eraseTop_top h0s)) := by
        conv_lhs => rw [eq_snoc_eraseTop h0s]
        exact Equivalent.snoc hteqv (by simpa using (isMaximal_eraseTop_top h0s).iso_refl)
      refine' this.trans _
      refine' Equivalent.snoc_snoc_swap _ _
      · exact
          iso_symm
            (second_iso_of_eq hm
              (sup_eq_of_isMaximal hm (isMaximal_eraseTop_top h0s) (Ne.symm hetx)) htt.symm)
      · exact
          second_iso_of_eq (isMaximal_eraseTop_top h0s)
            (sup_eq_of_isMaximal (isMaximal_eraseTop_top h0s) hm hetx) (by 

Proof state:
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih :
  ∀ (s : CompositionSeries X) (x : X) (hm : IsMaximal x (top s)),
    bot s ≤ x →
      s.length = n →
        ∃ t,
          bot t = bot s ∧
            t.length + 1 = n ∧ ∃ (htx : top t = x), Equivalent s (snoc t (top s) (_ : IsMaximal (top t) (top s)))
s : CompositionSeries X
x : X
hm : IsMaximal x (top s)
hb : bot s ≤ x
hn : s.length = Nat.succ n
h0s : 0 < s.length
hetx : ¬top (eraseTop s) = x
imxs : IsMaximal (x ⊓ top (eraseTop s)) (top (eraseTop s))
t : CompositionSeries X
htb : bot t = bot (eraseTop s)
htl : t.length + 1 = n
htt : top t = x ⊓ top (eraseTop s)
hteqv : Equivalent (eraseTop s) (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))
hmtx : IsMaximal (top t) x
this :
  Equivalent s
    (snoc (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s)))) (top s)
      (_ : IsMaximal (top (snoc t (top (eraseTop s)) (_ : IsMaximal (top t) (top (eraseTop s))))) (top s)))
⊢ top (eraseTop s) ⊓ x = top t

Next tactic:
rw [inf_comm, htt]
/-- The **Jordan-Hölder** theorem, stated for any `JordanHolderLattice`.
If two composition series start and finish at the same place, they are equivalent. -/
theorem jordan_holder (s₁ s₂ : CompositionSeries X) (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) :
    Equivalent s₁ s₂ := 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₂
⊢ Equivalent s₁ s₂

Next tactic:
induction' hle : s₁.length with n ih generalizing s₁ s₂
/-- The **Jordan-Hölder** theorem, stated for any `JordanHolderLattice`.
If two composition series start and finish at the same place, they are equivalent. -/
theorem jordan_holder (s₁ s₂ : CompositionSeries X) (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) :
    Equivalent s₁ s₂ := by
  induction' hle : s₁.length with n ih generalizing s₁ s₂
  · 

Proof state:
case zero
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hle : s₁.length = Nat.zero
⊢ Equivalent s₁ s₂

Next tactic:
rw [eq_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero hb ht hle]
/-- The **Jordan-Hölder** theorem, stated for any `JordanHolderLattice`.
If two composition series start and finish at the same place, they are equivalent. -/
theorem jordan_holder (s₁ s₂ : CompositionSeries X) (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) :
    Equivalent s₁ s₂ := by
  induction' hle : s₁.length with n ih generalizing s₁ s₂
  · rw [eq_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero hb ht hle]
  · 

Proof state:
case succ
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih : ∀ (s₁ s₂ : CompositionSeries X), bot s₁ = bot s₂ → top s₁ = top s₂ → s₁.length = n → Equivalent s₁ s₂
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hle : s₁.length = Nat.succ n
⊢ Equivalent s₁ s₂

Next tactic:
have h0s₂ : 0 < s₂.length :=
      length_pos_of_bot_eq_bot_of_top_eq_top_of_length_pos hb ht (hle.symm ▸ Nat.succ_pos _)
/-- The **Jordan-Hölder** theorem, stated for any `JordanHolderLattice`.
If two composition series start and finish at the same place, they are equivalent. -/
theorem jordan_holder (s₁ s₂ : CompositionSeries X) (hb : s₁.bot = s₂.bot) (ht : s₁.top = s₂.top) :
    Equivalent s₁ s₂ := by
  induction' hle : s₁.length with n ih generalizing s₁ s₂
  · rw [eq_of_bot_eq_bot_of_top_eq_top_of_length_eq_zero hb ht hle]
  · have h0s₂ : 0 < s₂.length :=
      length_pos_of_bot_eq_bot_of_top_eq_top_of_length_pos hb ht (hle.symm ▸ Nat.succ_pos _)
    

Proof state:
case succ
X : Type u
inst✝¹ : Lattice X
inst✝ : JordanHolderLattice X
n : ℕ
ih : ∀ (s₁ s₂ : CompositionSeries X), bot s₁ = bot s₂ → top s₁ = top s₂ → s₁.length = n → Equivalent s₁ s₂
s₁ s₂ : CompositionSeries X
hb : bot s₁ = bot s₂
ht : top s₁ = top s₂
hle : s₁.length = Nat.succ n
h0s₂ : 0 < s₂.length
⊢ Equivalent s₁ s₂

Next tactic:
rcases exists_top_eq_snoc_equivalant s₁ s₂.eraseTop.top
        (ht.symm ▸ isMaximal_eraseTop_top h0s₂)
        (hb.symm ▸ s₂.bot_eraseTop ▸ bot_le_of_mem (top_mem _)) with
      ⟨t, htb, htl, htt, hteq⟩