l3lab/ntp-mathlib huggingface dataset:
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    

Proof state:
case inl
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
terminated : Stream'.Seq.TerminatedAt (partialDenominators g) n
this : Stream'.Seq.get? (partialDenominators g) n = none
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by 

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
terminated : Stream'.Seq.TerminatedAt (partialDenominators g) n
this : Stream'.Seq.get? (partialDenominators g) n = none
⊢ Stream'.Seq.get? (partialDenominators g) n = none

Next tactic:
rwa [Stream'.Seq.TerminatedAt] at terminated
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    

Proof state:
case inl
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
terminated : Stream'.Seq.TerminatedAt (partialDenominators g) n
this✝ : Stream'.Seq.get? (partialDenominators g) n = none
this : TerminatedAt g n
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    

Proof state:
case inl
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
terminated : Stream'.Seq.TerminatedAt (partialDenominators g) n
this✝¹ : Stream'.Seq.get? (partialDenominators g) n = none
this✝ : TerminatedAt g n
this : denominators g (n + 1) = denominators g n
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
rw [this]
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    rw [this]
  · 

Proof state:
case inr
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
obtain ⟨b, nth_part_denom_eq⟩ : ∃ b, g.partialDenominators.get? n = some b
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    rw [this]
  · obtain ⟨b, nth_part_denom_eq⟩ : ∃ b, g.partialDenominators.get? n = some b
    

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
⊢ ∃ b, Stream'.Seq.get? (partialDenominators g) n = some b
case inr.intro
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
b : K
nth_part_denom_eq : Stream'.Seq.get? (partialDenominators g) n = some b
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
exact Option.ne_none_iff_exists'.mp not_terminated
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    rw [this]
  · obtain ⟨b, nth_part_denom_eq⟩ : ∃ b, g.partialDenominators.get? n = some b
    exact Option.ne_none_iff_exists'.mp not_terminated
    

Proof state:
case inr.intro
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
b : K
nth_part_denom_eq : Stream'.Seq.get? (partialDenominators g) n = some b
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
have : 1 ≤ b := of_one_le_get?_part_denom nth_part_denom_eq
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    rw [this]
  · obtain ⟨b, nth_part_denom_eq⟩ : ∃ b, g.partialDenominators.get? n = some b
    exact Option.ne_none_iff_exists'.mp not_terminated
    have : 1 ≤ b := of_one_le_get?_part_denom nth_part_denom_eq
    

Proof state:
case inr.intro
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
b : K
nth_part_denom_eq : Stream'.Seq.get? (partialDenominators g) n = some b
this : 1 ≤ b
⊢ denominators (of v) n ≤ denominators (of v) (n + 1)

Next tactic:
calc
      g.denominators n ≤ b * g.denominators n := by
        simpa using mul_le_mul_of_nonneg_right this zero_le_of_denom
      _ ≤ g.denominators (n + 1) := le_of_succ_get?_denom nth_part_denom_eq
/-- Shows that the sequence of denominators is monotone, that is `Bₙ ≤ Bₙ₊₁`. -/
theorem of_denom_mono : (of v).denominators n ≤ (of v).denominators (n + 1) := by
  let g := of v
  cases' Decidable.em <| g.partialDenominators.TerminatedAt n with terminated not_terminated
  · have : g.partialDenominators.get? n = none := by rwa [Stream'.Seq.TerminatedAt] at terminated
    have : g.TerminatedAt n :=
      terminatedAt_iff_part_denom_none.2 (by rwa [Stream'.Seq.TerminatedAt] at terminated)
    have : g.denominators (n + 1) = g.denominators n :=
      denominators_stable_of_terminated n.le_succ this
    rw [this]
  · obtain ⟨b, nth_part_denom_eq⟩ : ∃ b, g.partialDenominators.get? n = some b
    exact Option.ne_none_iff_exists'.mp not_terminated
    have : 1 ≤ b := of_one_le_get?_part_denom nth_part_denom_eq
    calc
      g.denominators n ≤ b * g.denominators n := by
        

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
not_terminated : ¬Stream'.Seq.TerminatedAt (partialDenominators g) n
b : K
nth_part_denom_eq : Stream'.Seq.get? (partialDenominators g) n = some b
this : 1 ≤ b
⊢ denominators g n ≤ b * denominators g n

Next tactic:
simpa using mul_le_mul_of_nonneg_right this zero_le_of_denom
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
  

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
hyp : n = 0 ∨ ¬TerminatedAt (of v) (n - 1)
⊢ (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
      (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
    (-1) ^ n

Next tactic:
induction' n with n IH
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
  

Proof state:
case zero
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
hyp : zero = 0 ∨ ¬TerminatedAt (of v) (zero - 1)
⊢ (continuantsAux (of v) zero).a * (continuantsAux (of v) (zero + 1)).b -
      (continuantsAux (of v) zero).b * (continuantsAux (of v) (zero + 1)).a =
    (-1) ^ zero
case succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
        (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
      (-1) ^ n
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
⊢ (continuantsAux (of v) (Nat.succ n)).a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      (continuantsAux (of v) (Nat.succ n)).b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
case zero => simp [continuantsAux]
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
  

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
hyp : zero = 0 ∨ ¬TerminatedAt (of v) (zero - 1)
⊢ (continuantsAux (of v) zero).a * (continuantsAux (of v) (zero + 1)).b -
      (continuantsAux (of v) zero).b * (continuantsAux (of v) (zero + 1)).a =
    (-1) ^ zero

Next tactic:
case zero => simp [continuantsAux]
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 => 

Proof state:
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
hyp : zero = 0 ∨ ¬TerminatedAt (of v) (zero - 1)
⊢ (continuantsAux (of v) zero).a * (continuantsAux (of v) (zero + 1)).b -
      (continuantsAux (of v) zero).b * (continuantsAux (of v) (zero + 1)).a =
    (-1) ^ zero

Next tactic:
simp [continuantsAux]
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]
  

Proof state:
case succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
        (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
      (-1) ^ n
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
⊢ (continuantsAux (of v) (Nat.succ n)).a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      (continuantsAux (of v) (Nat.succ n)).b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
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]
      ring
    suffices : pA * ppB - pB * ppA = (-1) ^ (n + 1);
    calc
      pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) =
          pA * ppB + pA * gp.b * pB - pB * ppA - pB * gp.b * pA := by ring
      _ = pA * ppB - pB * ppA := by ring
      _ = (-1) ^ (n + 1) := by assumption
    suffices ppA * pB - ppB * pA = (-1) ^ n by
      have pow_succ_n : (-1 : K) ^ (n + 1) = -1 * (-1) ^ n := pow_succ (-1) n
      rw [pow_succ_n, ← this]
      ring
    exact IH <| Or.inr <| mt (terminated_stable <| n.sub_le 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]
  

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
        (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
      (-1) ^ n
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
⊢ (continuantsAux (of v) (Nat.succ n)).a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      (continuantsAux (of v) (Nat.succ n)).b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
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]
      ring
    suffices : pA * ppB - pB * ppA = (-1) ^ (n + 1);
    calc
      pA * (ppB + gp.b * pB) - pB * (ppA + gp.b * pA) =
          pA * ppB + pA * gp.b * pB - pB * ppA - pB * gp.b * pA := by ring
      _ = pA * ppB - pB * ppA := by ring
      _ = (-1) ^ (n + 1) := by assumption
    suffices ppA * pB - ppB * pA = (-1) ^ n by
      have pow_succ_n : (-1 : K) ^ (n + 1) = -1 * (-1) ^ n := pow_succ (-1) n
      rw [pow_succ_n, ← this]
      ring
    exact IH <| Or.inr <| mt (terminated_stable <| n.sub_le 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
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
        (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
      (-1) ^ n
hyp : Nat.succ n = 0 ∨ ¬TerminatedAt (of v) (Nat.succ n - 1)
⊢ (continuantsAux (of v) (Nat.succ n)).a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      (continuantsAux (of v) (Nat.succ n)).b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
let g := of v
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
    

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

Next tactic:
let conts := continuantsAux g (n + 2)
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)
    

Proof state:
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
n : ℕ
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * (continuantsAux (of v) (n + 1)).b -
        (continuantsAux (of v) n).b * (continuantsAux (of v) (n + 1)).a =
      (-1) ^ 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)
⊢ (continuantsAux (of v) (Nat.succ n)).a * (continuantsAux (of v) (Nat.succ n + 1)).b -
      (continuantsAux (of v) (Nat.succ n)).b * (continuantsAux (of v) (Nat.succ n + 1)).a =
    (-1) ^ Nat.succ n

Next tactic:
set pred_conts := continuantsAux g (n + 1) with 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
    

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)
IH :
  n = 0 ∨ ¬TerminatedAt (of v) (n - 1) →
    (continuantsAux (of v) n).a * pred_conts.b - (continuantsAux (of v) n).b * pred_conts.a = (-1) ^ n
pred_conts_eq : pred_conts = continuantsAux g (n + 1)
⊢ 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:
set ppred_conts := continuantsAux g n with ppred_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
    

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
⊢ 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 pA := pred_conts.a