l3lab/ntp-mathlib huggingface dataset:
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
⊢ pred_conts.a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      pred_conts.b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
let pB := pred_conts.b
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
⊢ pred_conts.a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      pred_conts.b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
let ppA := ppred_conts.a
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
⊢ pred_conts.a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      pred_conts.b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
let ppB := ppred_conts.b
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ pred_conts.a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      pred_conts.b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ pA * conts.b - pB * conts.a = (-1) ^ (n + 1)

Next tactic:
have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
⊢ pA * conts.b - pB * conts.a = (-1) ^ (n + 1)

Next tactic:
obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
⊢ ∃ gp, Stream'.Seq.get? g.s n = some gp
case intro
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
⊢ pA * conts.b - pB * conts.a = (-1) ^ (n + 1)

Next tactic:
exact Option.ne_none_iff_exists'.1 not_terminated_at_n
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    exact Option.ne_none_iff_exists'.1 not_terminated_at_n
    -- unfold the recurrence relation for `conts` once and simplify to derive the following
    

Proof state:
case intro
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
⊢ pA * conts.b - pB * conts.a = (-1) ^ (n + 1)

Next tactic:
suffices pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1) by
      simp only [continuantsAux_recurrence s_nth_eq ppred_conts_eq pred_conts_eq]
      have gp_a_eq_one : gp.a = 1 := of_part_num_eq_one (part_num_eq_s_a s_nth_eq)
      rw [gp_a_eq_one, this.symm]
      ring
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    exact Option.ne_none_iff_exists'.1 not_terminated_at_n
    -- unfold the recurrence relation for `conts` once and simplify to derive the following
    suffices pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1) by
      

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
this : pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1)
⊢ pA * conts.b - pB * conts.a = (-1) ^ (n + 1)

Next tactic:
simp only [continuantsAux_recurrence s_nth_eq ppred_conts_eq pred_conts_eq]
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    exact Option.ne_none_iff_exists'.1 not_terminated_at_n
    -- unfold the recurrence relation for `conts` once and simplify to derive the following
    suffices pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1) by
      simp only [continuantsAux_recurrence s_nth_eq ppred_conts_eq pred_conts_eq]
      

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
this : pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1)
⊢ (continuantsAux (of v) (n + 1)).a * (gp.b * (continuantsAux (of v) (n + 1)).b + gp.a * (continuantsAux (of v) n).b) -
      (continuantsAux (of v) (n + 1)).b *
        (gp.b * (continuantsAux (of v) (n + 1)).a + gp.a * (continuantsAux (of v) n).a) =
    (-1) ^ (n + 1)

Next tactic:
have gp_a_eq_one : gp.a = 1 := of_part_num_eq_one (part_num_eq_s_a s_nth_eq)
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    exact Option.ne_none_iff_exists'.1 not_terminated_at_n
    -- unfold the recurrence relation for `conts` once and simplify to derive the following
    suffices pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1) by
      simp only [continuantsAux_recurrence s_nth_eq ppred_conts_eq pred_conts_eq]
      have gp_a_eq_one : gp.a = 1 := of_part_num_eq_one (part_num_eq_s_a s_nth_eq)
      

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
this : pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1)
gp_a_eq_one : gp.a = 1
⊢ (continuantsAux (of v) (n + 1)).a * (gp.b * (continuantsAux (of v) (n + 1)).b + gp.a * (continuantsAux (of v) n).b) -
      (continuantsAux (of v) (n + 1)).b *
        (gp.b * (continuantsAux (of v) (n + 1)).a + gp.a * (continuantsAux (of v) n).a) =
    (-1) ^ (n + 1)

Next tactic:
rw [gp_a_eq_one, this.symm]
theorem determinant_aux (hyp : n = 0 ∨ ¬(of v).TerminatedAt (n - 1)) :
    ((of v).continuantsAux n).a * ((of v).continuantsAux (n + 1)).b -
      ((of v).continuantsAux n).b * ((of v).continuantsAux (n + 1)).a = (-1) ^ n := by
  induction' n with n IH
  case zero => simp [continuantsAux]
  case succ =>
    -- set up some shorthand notation
    let g := of v
    let conts := continuantsAux g (n + 2)
    set pred_conts := continuantsAux g (n + 1) with pred_conts_eq
    set ppred_conts := continuantsAux g n with ppred_conts_eq
    let pA := pred_conts.a
    let pB := pred_conts.b
    let ppA := ppred_conts.a
    let ppB := ppred_conts.b
    -- let's change the goal to something more readable
    change pA * conts.b - pB * conts.a = (-1) ^ (n + 1)
    have not_terminated_at_n : ¬TerminatedAt g n := Or.resolve_left hyp n.succ_ne_zero
    obtain ⟨gp, s_nth_eq⟩ : ∃ gp, g.s.get? n = some gp
    exact Option.ne_none_iff_exists'.1 not_terminated_at_n
    -- unfold the recurrence relation for `conts` once and simplify to derive the following
    suffices pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1) by
      simp only [continuantsAux_recurrence s_nth_eq ppred_conts_eq pred_conts_eq]
      have gp_a_eq_one : gp.a = 1 := of_part_num_eq_one (part_num_eq_s_a s_nth_eq)
      rw [gp_a_eq_one, this.symm]
      

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
g : GeneralizedContinuedFraction K := of v
conts : Pair K := continuantsAux g (n + 2)
pred_conts : Pair K := continuantsAux g (n + 1)
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
ppred_conts : Pair K := continuantsAux g n
IH : n = 0 ∨ ¬TerminatedAt (of v) (n - 1) → ppred_conts.a * pred_conts.b - ppred_conts.b * pred_conts.a = (-1) ^ n
ppred_conts_eq : ppred_conts = continuantsAux g n
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
not_terminated_at_n : ¬TerminatedAt g n
gp : Pair K
s_nth_eq : Stream'.Seq.get? g.s n = some gp
this : pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) = (-1) ^ (n + 1)
gp_a_eq_one : gp.a = 1
⊢ (continuantsAux (of v) (n + 1)).a * (gp.b * (continuantsAux (of v) (n + 1)).b + 1 * (continuantsAux (of v) n).b) -
      (continuantsAux (of v) (n + 1)).b * (gp.b * (continuantsAux (of v) (n + 1)).a + 1 * (continuantsAux (of v) n).a) =
    pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA)

Next tactic:
ring