Theorem: GeneralizedContinuedFraction.succ_nth_convergent_eq_squashGCF_nth_convergent
File: Mathlib/Algebra/ContinuedFractions/ConvergentsEquiv.lean

tactic: cases' Decidable.em (g.TerminatedAt n) with terminated_at_n not_terminated_at_n
state_before: K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: case inl
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
terminated_at_n : g.TerminatedAt n
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n

case inr
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n

tactic: have : squashGCF g n = g := squashGCF_eq_self_of_terminated terminated_at_n
state_before: case inl
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
terminated_at_n : g.TerminatedAt n
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: case inl
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
terminated_at_n : g.TerminatedAt n
this : g.squashGCF n = g
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n

tactic: simp only [this, convergents_stable_of_terminated n.le_succ terminated_at_n]
state_before: case inl
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
terminated_at_n : g.TerminatedAt n
this : g.squashGCF n = g
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: no goals

tactic: obtain ⟨⟨a, b⟩, s_nth_eq⟩ : ∃ gp_n, g.s.get? n = some gp_n :=
  Option.ne_none_iff_exists'.mp not_terminated_at_n
state_before: case inr
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: case inr.intro.mk
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
a b : K
s_nth_eq : g.s.get? n = some { a := a, b := b }
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n

tactic: have b_ne_zero : b ≠ 0 := nth_part_denom_ne_zero (part_denom_eq_s_b s_nth_eq)
state_before: case inr.intro.mk
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
a b : K
s_nth_eq : g.s.get? n = some { a := a, b := b }
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: case inr.intro.mk
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
a b : K
s_nth_eq : g.s.get? n = some { a := a, b := b }
b_ne_zero : b ≠ 0
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n

tactic: cases n with
| zero =>
  suffices (b * g.h + a) / b = g.h + a / b by
    simpa [squashGCF, s_nth_eq, convergent_eq_conts_a_div_conts_b,
      continuants_recurrenceAux s_nth_eq zeroth_continuant_aux_eq_one_zero
        first_continuant_aux_eq_h_one]
  calc
    (b * g.h + a) / b = b * g.h / b + a / b := by ring
    _ = g.h + a / b := by rw [mul_div_cancel_left₀ _ b_ne_zero]
| succ n' =>
  obtain ⟨⟨pa, pb⟩, s_n'th_eq⟩ : ∃ gp_n', g.s.get? n' = some gp_n' :=
    g.s.ge_stable n'.le_succ s_nth_eq
  let g' := squashGCF g (n' + 1)
  set pred_conts := g.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq
  set ppred_conts := g.continuantsAux n' with n'th_conts_aux_eq
  let pA := pred_conts.a
  let pB := pred_conts.b
  let ppA := ppred_conts.a
  let ppB := ppred_conts.b
  set pred_conts' := g'.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq'
  set ppred_conts' := g'.continuantsAux n' with n'th_conts_aux_eq'
  let pA' := pred_conts'.a
  let pB' := pred_conts'.b
  let ppA' := ppred_conts'.a
  let ppB' := ppred_conts'.b
  have : g'.convergents (n' + 1) =
      ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB') := by
    have : g'.s.get? n' = some ⟨pa, pb + a / b⟩ :=
      squashSeq_nth_of_not_terminated s_n'th_eq s_nth_eq
    rw [convergent_eq_conts_a_div_conts_b,
      continuants_recurrenceAux this n'th_conts_aux_eq'.symm succ_n'th_conts_aux_eq'.symm]
  rw [this]
  have : g.convergents (n' + 2) =
      (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) := by
    have : g.continuantsAux (n' + 2) = ⟨pb * pA + pa * ppA, pb * pB + pa * ppB⟩ :=
      continuantsAux_recurrence s_n'th_eq n'th_conts_aux_eq.symm succ_n'th_conts_aux_eq.symm
    rw [convergent_eq_conts_a_div_conts_b,
      continuants_recurrenceAux s_nth_eq succ_n'th_conts_aux_eq.symm this]
  rw [this]
  suffices
    ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
      (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) by
    obtain ⟨eq1, eq2, eq3, eq4⟩ : pA' = pA ∧ pB' = pB ∧ ppA' = ppA ∧ ppB' = ppB := by
      simp [*, pA', pB', ppA', ppB',
        (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
        (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
    symm
    simpa only [eq1, eq2, eq3, eq4, mul_div_cancel_right₀ _ b_ne_zero]
  field_simp
  congr 1 <;> ring
state_before: case inr.intro.mk
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? n = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt n
a b : K
s_nth_eq : g.s.get? n = some { a := a, b := b }
b_ne_zero : b ≠ 0
⊢ g.convergents (n + 1) = (g.squashGCF n).convergents n
state_after: no goals

tactic: suffices (b * g.h + a) / b = g.h + a / b by
  simpa [squashGCF, s_nth_eq, convergent_eq_conts_a_div_conts_b,
    continuants_recurrenceAux s_nth_eq zeroth_continuant_aux_eq_one_zero
      first_continuant_aux_eq_h_one]
state_before: case inr.intro.mk.zero
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
⊢ g.convergents (0 + 1) = (g.squashGCF 0).convergents 0
state_after: case inr.intro.mk.zero
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
⊢ (b * g.h + a) / b = g.h + a / b

tactic: calc
  (b * g.h + a) / b = b * g.h / b + a / b := by ring
  _ = g.h + a / b := by rw [mul_div_cancel_left₀ _ b_ne_zero]
state_before: case inr.intro.mk.zero
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
⊢ (b * g.h + a) / b = g.h + a / b
state_after: no goals

tactic: simpa [squashGCF, s_nth_eq, convergent_eq_conts_a_div_conts_b,
  continuants_recurrenceAux s_nth_eq zeroth_continuant_aux_eq_one_zero
    first_continuant_aux_eq_h_one]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
this : (b * g.h + a) / b = g.h + a / b
⊢ g.convergents (0 + 1) = (g.squashGCF 0).convergents 0
state_after: no goals

tactic: ring
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
⊢ (b * g.h + a) / b = b * g.h / b + a / b
state_after: no goals

tactic: rw [mul_div_cancel_left₀ _ b_ne_zero]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? 0 = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt 0
s_nth_eq : g.s.get? 0 = some { a := a, b := b }
⊢ b * g.h / b + a / b = g.h + a / b
state_after: no goals

tactic: obtain ⟨⟨pa, pb⟩, s_n'th_eq⟩ : ∃ gp_n', g.s.get? n' = some gp_n' :=
  g.s.ge_stable n'.le_succ s_nth_eq
state_before: case inr.intro.mk.succ
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let g' := squashGCF g (n' + 1)
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: set pred_conts := g.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: set ppred_conts := g.continuantsAux n' with n'th_conts_aux_eq
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let pA := pred_conts.a
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let pB := pred_conts.b
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let ppA := ppred_conts.a
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let ppB := ppred_conts.b
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: set pred_conts' := g'.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq'
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: set ppred_conts' := g'.continuantsAux n' with n'th_conts_aux_eq'
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let pA' := pred_conts'.a
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let pB' := pred_conts'.b
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let ppA' := ppred_conts'.a
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: let ppB' := ppred_conts'.b
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: have : g'.convergents (n' + 1) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB') := by
  have : g'.s.get? n' = some ⟨pa, pb + a / b⟩ :=
    squashSeq_nth_of_not_terminated s_n'th_eq s_nth_eq
  rw [convergent_eq_conts_a_div_conts_b,
    continuants_recurrenceAux this n'th_conts_aux_eq'.symm succ_n'th_conts_aux_eq'.symm]
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)

tactic: rw [this]
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ g.convergents (n' + 1 + 1) = (g.squashGCF (n' + 1)).convergents (n' + 1)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ g.convergents (n' + 1 + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')

tactic: have : g.convergents (n' + 2) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) := by
  have : g.continuantsAux (n' + 2) = ⟨pb * pA + pa * ppA, pb * pB + pa * ppB⟩ :=
    continuantsAux_recurrence s_n'th_eq n'th_conts_aux_eq.symm succ_n'th_conts_aux_eq.symm
  rw [convergent_eq_conts_a_div_conts_b,
    continuants_recurrenceAux s_nth_eq succ_n'th_conts_aux_eq.symm this]
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ g.convergents (n' + 1 + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ g.convergents (n' + 1 + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')

tactic: rw [this]
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ g.convergents (n' + 1 + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')

tactic: suffices
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) by
  obtain ⟨eq1, eq2, eq3, eq4⟩ : pA' = pA ∧ pB' = pB ∧ ppA' = ppA ∧ ppB' = ppB := by
    simp [*, pA', pB', ppA', ppB',
      (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
      (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
  symm
  simpa only [eq1, eq2, eq3, eq4, mul_div_cancel_right₀ _ b_ne_zero]
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)

tactic: field_simp
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
state_after: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb * b + a) * pA + pa * ppA * b) / ((pb * b + a) * pB + pa * ppB * b) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)

tactic: congr 1 <;> ring
state_before: case inr.intro.mk.succ.intro.mk
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb * b + a) * pA + pa * ppA * b) / ((pb * b + a) * pB + pa * ppB * b) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
state_after: no goals

tactic: have : g'.s.get? n' = some ⟨pa, pb + a / b⟩ :=
  squashSeq_nth_of_not_terminated s_n'th_eq s_nth_eq
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.s.get? n' = some { a := pa, b := pb + a / b }
⊢ g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')

tactic: rw [convergent_eq_conts_a_div_conts_b,
  continuants_recurrenceAux this n'th_conts_aux_eq'.symm succ_n'th_conts_aux_eq'.symm]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.s.get? n' = some { a := pa, b := pb + a / b }
⊢ g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: no goals

tactic: have : g.continuantsAux (n' + 2) = ⟨pb * pA + pa * ppA, pb * pB + pa * ppB⟩ :=
  continuantsAux_recurrence s_n'th_eq n'th_conts_aux_eq.symm succ_n'th_conts_aux_eq.symm
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
state_after: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.continuantsAux (n' + 2) = { a := pb * pA + pa * ppA, b := pb * pB + pa * ppB }
⊢ g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)

tactic: rw [convergent_eq_conts_a_div_conts_b,
  continuants_recurrenceAux s_nth_eq succ_n'th_conts_aux_eq.symm this]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : g.continuantsAux (n' + 2) = { a := pb * pA + pa * ppA, b := pb * pB + pa * ppB }
⊢ g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
state_after: no goals

tactic: obtain ⟨eq1, eq2, eq3, eq4⟩ : pA' = pA ∧ pB' = pB ∧ ppA' = ppA ∧ ppB' = ppB := by
  simp [*, pA', pB', ppA', ppB',
    (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
    (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: case intro.intro.intro
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
eq1 : pA' = pA
eq2 : pB' = pB
eq3 : ppA' = ppA
eq4 : ppB' = ppB
⊢ (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')

tactic: symm
state_before: case intro.intro.intro
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
eq1 : pA' = pA
eq2 : pB' = pB
eq3 : ppA' = ppA
eq4 : ppB' = ppB
⊢ (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB) =
    ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
state_after: case intro.intro.intro
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
eq1 : pA' = pA
eq2 : pB' = pB
eq3 : ppA' = ppA
eq4 : ppB' = ppB
⊢ ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB') =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)

tactic: simpa only [eq1, eq2, eq3, eq4, mul_div_cancel_right₀ _ b_ne_zero]
state_before: case intro.intro.intro
K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
eq1 : pA' = pA
eq2 : pB' = pB
eq3 : ppA' = ppA
eq4 : ppB' = ppB
⊢ ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB') =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
state_after: no goals

tactic: simp [*, pA', pB', ppA', ppB',
  (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
  (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
state_before: K : Type u_1
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
a b : K
b_ne_zero : b ≠ 0
n' : ℕ
nth_part_denom_ne_zero : ∀ {b : K}, g.partialDenominators.get? (n' + 1) = some b → b ≠ 0
not_terminated_at_n : ¬g.TerminatedAt (n' + 1)
s_nth_eq : g.s.get? (n' + 1) = some { a := a, b := b }
pa pb : K
s_n'th_eq : g.s.get? n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := g.squashGCF (n' + 1)
pred_conts : Pair K := g.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = g.continuantsAux (n' + 1)
ppred_conts : Pair K := g.continuantsAux n'
n'th_conts_aux_eq : ppred_conts = g.continuantsAux n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := g'.continuantsAux (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = g'.continuantsAux (n' + 1)
ppred_conts' : Pair K := g'.continuantsAux n'
n'th_conts_aux_eq' : ppred_conts' = g'.continuantsAux n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : g'.convergents (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : g.convergents (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
this :
  ((pb + a / b) * pA + pa * ppA) / ((pb + a / b) * pB + pa * ppB) =
    (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ pA' = pA ∧ pB' = pB ∧ ppA' = ppA ∧ ppB' = ppB
state_after: no goals