-- Mathlib/Computability/TMToPartrec.lean
theorem succ_ok {q s n} {c d : List Γ'} :
    Reaches₁ (TM2.step tr) ⟨some (Λ'.succ q), s, K'.elim (trList [n]) [] c d⟩
      ⟨some q, none, K'.elim (trList [n.succ]) [] c d⟩

Proof state:
case h.e'_2
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ { l := some q, var := none, stk := elim (trNum Num.zero.succ ++ [Γ'.cons]) [] c d } =
    { l := some q, var := none,
      stk :=
        update
          (update
            (update
              (update
                (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                  (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                main
                ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                  update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                    (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main))
              main
              ((fun x => Γ'.bit1) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                update
                  (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                    (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                  main
                  ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                    update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                      (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main)
                  main))
            rev [])
          main
          ((update
                (update
                  (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                    (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                  main
                  ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                    update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                      (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main))
                main
                ((fun x => Γ'.bit1) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                  update
                    (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                      (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                    main
                    ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                      update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                        (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main)
                    main)
                rev).reverseAux
            (update
              (update
                (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                  (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                main
                ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                  update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                    (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main))
              main
              ((fun x => Γ'.bit1) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                update
                  (update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                    (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail)
                  main
                  ((fun x => Γ'.cons) ((fun x v => v) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).head?) ::
                    update (elim (trNum Num.zero ++ [Γ'.cons]) [] c d) main
                      (elim (trNum Num.zero ++ [Γ'.cons]) [] c d main).tail main)
                  main)
              main)) }

Tactic:
simp only [elim_update_rev, elim_rev, elim_main, List.reverseAux_nil, elim_update_main]

Result:
case h.e'_2
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ { l := some q, var := none, stk := elim (trNum Num.zero.succ ++ [Γ'.cons]) [] c d } =
    { l := some q, var := none, stk := elim (Γ'.bit1 :: Γ'.cons :: (trNum Num.zero ++ [Γ'.cons]).tail) [] c d }

Proof state:
case pos.bit1.intro.intro.intro.intro
q : Λ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      l₁.reverseAux (trPosNum m.succ) = l₁'.reverseAux l₂' ∧
        Reaches₁ (TM2.step tr) { l := some q.succ, var := s, stk := elim (trPosNum m ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
s : Option Γ'
l₁ l₁' l₂' : List Γ'
s' : Option Γ'
e : (Γ'.bit0 :: l₁).reverseAux (trPosNum m.succ) = l₁'.reverseAux l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some q.succ, var := ?m.108487, stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ some Γ'.bit1 = ?m.108487

Tactic:
rfl

Result:
no goals

Proof state:
case pos.bit0
q : Λ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      l₁.reverseAux (trPosNum m.succ) = l₁'.reverseAux l₂' ∧
        Reaches₁ (TM2.step tr) { l := some q.succ, var := s, stk := elim (trPosNum m ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
s : Option Γ'
l₁ : List Γ'
⊢ { l := some (unrev q), var := some Γ'.bit0, stk := elim (trPosNum m.bit0.succ ++ [Γ'.cons]) l₁ c d } ∈
    some
      (TM2.stepAux
        (pop' main
          (branch (fun s => decide (s = some Γ'.bit1)) (push rev (fun x => Γ'.bit0) (goto fun x => q.succ))
            (branch (fun s => decide (s = some Γ'.cons))
              (push main (fun x => Γ'.cons) (push main (fun x => Γ'.bit1) (goto fun x => unrev q)))
              (push main (fun x => Γ'.bit1) (goto fun x => unrev q)))))
        s (elim (trPosNum m.bit0 ++ [Γ'.cons]) l₁ c d))

Tactic:
simp only [TM2.stepAux, pop', elim_main, elim_update_main, ne_eq, Function.update_of_ne,
  elim_rev, elim_update_rev, Function.update_self, Option.mem_def, Option.some.injEq]

Result:
case pos.bit0
q : Λ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      l₁.reverseAux (trPosNum m.succ) = l₁'.reverseAux l₂' ∧
        Reaches₁ (TM2.step tr) { l := some q.succ, var := s, stk := elim (trPosNum m ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
s : Option Γ'
l₁ : List Γ'
⊢ (bif decide ((trPosNum m.bit0 ++ [Γ'.cons]).head? = some Γ'.bit1) then
      { l := some q.succ, var := (trPosNum m.bit0 ++ [Γ'.cons]).head?,
        stk := elim (trPosNum m.bit0 ++ [Γ'.cons]).tail (Γ'.bit0 :: l₁) c d }
    else
      bif decide ((trPosNum m.bit0 ++ [Γ'.cons]).head? = some Γ'.cons) then
        { l := some (unrev q), var := (trPosNum m.bit0 ++ [Γ'.cons]).head?,
          stk := elim (Γ'.bit1 :: Γ'.cons :: (trPosNum m.bit0 ++ [Γ'.cons]).tail) l₁ c d }
      else
        { l := some (unrev q), var := (trPosNum m.bit0 ++ [Γ'.cons]).head?,
          stk := elim (Γ'.bit1 :: (trPosNum m.bit0 ++ [Γ'.cons]).tail) l₁ c d }) =
    { l := some (unrev q), var := some Γ'.bit0, stk := elim (trPosNum m.bit0.succ ++ [Γ'.cons]) l₁ c d }