q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum ↑n ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ ↑n) ++ [Γ'.cons]) [] c d }
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trList [n]) [] c d }
    { l := some q, var := none, stk := elim (trList [Nat.succ n]) [] c d }
simp [trNat, Num.add_one]
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum Num.zero ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }

case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum (Num.pos a) ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ (Num.pos a)) ++ [Γ'.cons]) [] c d }
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum ↑n ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ ↑n) ++ [Γ'.cons]) [] c d }
cases' (n : Num) with a
case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum (Num.pos a) ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ (Num.pos a)) ++ [Γ'.cons]) [] c d }
simp [Num.succ, trNum, Num.succ']
case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
suffices ∀ l₁, ∃ l₁' l₂' s',
    List.reverseAux l₁ (trPosNum a.succ) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr) ⟨some q.succ, s, K'.elim (trPosNum a ++ [Γ'.cons]) l₁ c d⟩
        ⟨some (unrev q), s', K'.elim (l₂' ++ [Γ'.cons]) l₁' c d⟩ by
  obtain ⟨l₁', l₂', s', e, h⟩ := this []
  simp [List.reverseAux] at e
  refine' h.trans _
  convert unrev_ok using 2
  simp [e, List.reverseAux_eq]
case pos.one
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
s : Option Γ'
l₁ : List Γ'
⊢ ∃ l₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ PosNum.one)) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum PosNum.one ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }

case pos.bit1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit1 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }

case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit0 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
case pos
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
⊢ ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
induction' a with m IH m _ generalizing s <;> intro l₁
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ TransGen
    (fun a b =>
      b ∈
        (fun x =>
            match x with
            | { l := none, var := var, stk := stk } => none
            | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
          a)
    (TM2.stepAux (tr (Λ'.succ q)) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d))
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trNum Num.zero ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }
refine' TransGen.head rfl _
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ TransGen
    (fun a b =>
      (match a with
        | { l := none, var := var, stk := stk } => none
        | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S)) =
        some b)
    { l := some (unrev q), var := List.head? (trNum Num.zero ++ [Γ'.cons]),
      stk := elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ TransGen
    (fun a b =>
      b ∈
        (fun x =>
            match x with
            | { l := none, var := var, stk := stk } => none
            | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
          a)
    (TM2.stepAux (tr (Λ'.succ q)) s (elim (trNum Num.zero ++ [Γ'.cons]) [] c d))
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }
simp
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d =
    update (update (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d) rev []) main
      (List.reverseAux (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d rev)
        (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d main))
case zero
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ TransGen
    (fun a b =>
      (match a with
        | { l := none, var := var, stk := stk } => none
        | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S)) =
        some b)
    { l := some (unrev q), var := List.head? (trNum Num.zero ++ [Γ'.cons]),
      stk := elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d }
    { l := some q, var := none, stk := elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d }
convert unrev_ok using 2
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d =
    elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d =
    update (update (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d) rev []) main
      (List.reverseAux (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d rev)
        (elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d main))
simp
no goals
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
⊢ elim (trNum (Num.succ Num.zero) ++ [Γ'.cons]) [] c d =
    elim (Γ'.bit1 :: Γ'.cons :: List.tail (trNum Num.zero ++ [Γ'.cons])) [] c d
rfl
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : List.reverseAux [] (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
obtain ⟨l₁', l₂', s', e, h⟩ := this []
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : List.reverseAux [] (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
simp [List.reverseAux] at e
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ TransGen (fun a b => b ∈ TM2.step tr a) { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ Reaches₁
    (fun x =>
      match x with
      | { l := none, var := var, stk := stk } => none
      | { l := some l, var := v, stk := S } => some (TM2.stepAux (tr l) v S))
    { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
refine' h.trans _
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d =
    update (update (elim (l₂' ++ [Γ'.cons]) l₁' c d) rev []) main
      (List.reverseAux (elim (l₂' ++ [Γ'.cons]) l₁' c d rev) (elim (l₂' ++ [Γ'.cons]) l₁' c d main))
case intro.intro.intro.intro
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ TransGen (fun a b => b ∈ TM2.step tr a) { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
    { l := some q, var := none, stk := elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d }
convert unrev_ok using 2
no goals
case h.e'_2.h.e'_7
q : Λ'
s : Option Γ'
n : ℕ
c d : List Γ'
a : PosNum
this :
  ∀ (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ a)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) l₁ c d }
          { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
l₁' l₂' : List Γ'
s' : Option Γ'
e : trPosNum (PosNum.succ a) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum a ++ [Γ'.cons]) [] c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ elim (trPosNum (PosNum.succ a) ++ [Γ'.cons]) [] c d =
    update (update (elim (l₂' ++ [Γ'.cons]) l₁' c d) rev []) main
      (List.reverseAux (elim (l₂' ++ [Γ'.cons]) l₁' c d rev) (elim (l₂' ++ [Γ'.cons]) l₁' c d main))
simp [e, List.reverseAux_eq]
case pos.one
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
s : Option Γ'
l₁ : List Γ'
⊢ { l := some (unrev q), var := some Γ'.cons, stk := elim ([Γ'.bit1] ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr (TM2.stepAux (tr (Λ'.succ q)) s (elim (trPosNum PosNum.one ++ [Γ'.cons]) l₁ c d))
case pos.one
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
s : Option Γ'
l₁ : List Γ'
⊢ ∃ l₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ PosNum.one)) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), var := s, stk := elim (trPosNum PosNum.one ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
refine' ⟨Γ'.bit0 :: l₁, [Γ'.bit1], some Γ'.cons, rfl, TransGen.head rfl (TransGen.single _)⟩
no goals
case pos.one
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
s : Option Γ'
l₁ : List Γ'
⊢ { l := some (unrev q), var := some Γ'.cons, stk := elim ([Γ'.bit1] ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr (TM2.stepAux (tr (Λ'.succ q)) s (elim (trPosNum PosNum.one ++ [Γ'.cons]) l₁ c d))
simp [trPosNum]
case pos.bit1.intro.intro.intro.intro
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?m.513910, stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ ∃ l₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit1 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
case pos.bit1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit1 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
obtain ⟨l₁', l₂', s', e, h⟩ := IH (Γ'.bit0 :: l₁)
case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'

case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
case pos.bit1.intro.intro.intro.intro
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?m.513910, stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ ∃ l₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit1 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
refine' ⟨l₁', l₂', s', e, TransGen.head _ h⟩
case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }

case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'
case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'

case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }
swap
case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ some Γ'.bit1 = ?pos.bit1.intro.intro.intro.intro.refine'_1

case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'
case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit1 m) ++ [Γ'.cons]) l₁ c d }

case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'
simp [PosNum.succ, trPosNum]
no goals
case pos.bit1.intro.intro.intro.intro.refine'_2
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 : List.reverseAux (Γ'.bit0 :: l₁) (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂'
h :
  Reaches₁ (TM2.step tr)
    { l := some (Λ'.succ q), var := ?pos.bit1.intro.intro.intro.intro.refine'_1,
      stk := elim (trPosNum m ++ [Γ'.cons]) (Γ'.bit0 :: l₁) c d }
    { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
⊢ some Γ'.bit1 = ?pos.bit1.intro.intro.intro.intro.refine'_1

case pos.bit1.intro.intro.intro.intro.refine'_1
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
IH :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 Γ'
⊢ Option Γ'
rfl
case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 (PosNum.succ (PosNum.bit0 m)) ++ [Γ'.cons]) l₁ c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) l₁ c d }
case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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₁' l₂' s',
    List.reverseAux l₁ (trPosNum (PosNum.succ (PosNum.bit0 m))) = List.reverseAux l₁' l₂' ∧
      Reaches₁ (TM2.step tr)
        { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) l₁ c d }
        { l := some (unrev q), var := s', stk := elim (l₂' ++ [Γ'.cons]) l₁' c d }
refine' ⟨l₁, _, some Γ'.bit0, rfl, TransGen.single _⟩
case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 (List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) = some Γ'.bit1) then
      { l := some (Λ'.succ q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
        stk := elim (List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) (Γ'.bit0 :: l₁) c d }
    else
      bif decide (List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) = some Γ'.cons) then
        { l := some (unrev q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
          stk := elim (Γ'.bit1 :: Γ'.cons :: List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) l₁ c d }
      else
        { l := some (unrev q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
          stk := elim (Γ'.bit1 :: List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) l₁ c d }) =
    { l := some (unrev q), var := some Γ'.bit0,
      stk := elim (trPosNum (PosNum.succ (PosNum.bit0 m)) ++ [Γ'.cons]) l₁ c d }
case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 (PosNum.succ (PosNum.bit0 m)) ++ [Γ'.cons]) l₁ c d } ∈
    TM2.step tr { l := some (Λ'.succ q), var := s, stk := elim (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) l₁ c d }
simp
no goals
case pos.bit0
q : Λ'
s✝ : Option Γ'
n : ℕ
c d : List Γ'
m : PosNum
a_ih✝ :
  ∀ {s : Option Γ'} (l₁ : List Γ'),
    ∃ l₁' l₂' s',
      List.reverseAux l₁ (trPosNum (PosNum.succ m)) = List.reverseAux l₁' l₂' ∧
        Reaches₁ (TM2.step tr) { l := some (Λ'.succ q), 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 (List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) = some Γ'.bit1) then
      { l := some (Λ'.succ q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
        stk := elim (List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) (Γ'.bit0 :: l₁) c d }
    else
      bif decide (List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]) = some Γ'.cons) then
        { l := some (unrev q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
          stk := elim (Γ'.bit1 :: Γ'.cons :: List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) l₁ c d }
      else
        { l := some (unrev q), var := List.head? (trPosNum (PosNum.bit0 m) ++ [Γ'.cons]),
          stk := elim (Γ'.bit1 :: List.tail (trPosNum (PosNum.bit0 m) ++ [Γ'.cons])) l₁ c d }) =
    { l := some (unrev q), var := some Γ'.bit0,
      stk := elim (trPosNum (PosNum.succ (PosNum.bit0 m)) ++ [Γ'.cons]) l₁ c d }
rfl