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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
terminated_at_n : TerminatedAt g n
⊢ convergents g (n + 1) = convergents (squashGCF g n) 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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
cases' Decidable.em (g.TerminatedAt n) with terminated_at_n not_terminated_at_n
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
terminated_at_n : TerminatedAt g n
this : squashGCF g n = g
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
terminated_at_n : TerminatedAt g n
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
have : squashGCF g n = g := squashGCF_eq_self_of_terminated terminated_at_n
no goals
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
terminated_at_n : TerminatedAt g n
this : squashGCF g n = g
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
simp only [this, convergents_stable_of_terminated n.le_succ terminated_at_n]
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
⊢ ∃ gp_n, Stream'.Seq.get? g.s n = some gp_n

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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
⊢ convergents g (n + 1) = convergents (squashGCF g n) 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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
obtain ⟨⟨a, b⟩, s_nth_eq⟩ : ∃ gp_n, g.s.get? n = some gp_n
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
K : Type u_1
n : ℕ
g : GeneralizedContinuedFraction K
s : Stream'.Seq (Pair K)
inst✝ : Field K
nth_part_denom_ne_zero : ∀ {b : K}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
⊢ ∃ gp_n, Stream'.Seq.get? g.s n = some gp_n

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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
exact Option.ne_none_iff_exists'.mp not_terminated_at_n
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
b_ne_zero : b ≠ 0
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
have b_ne_zero : b ≠ 0 := nth_part_denom_ne_zero (part_denom_eq_s_b s_nth_eq)
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ convergents g (Nat.zero + 1) = convergents (squashGCF g Nat.zero) Nat.zero

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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
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}, Stream'.Seq.get? (partialDenominators g) n = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g n
a b : K
s_nth_eq : Stream'.Seq.get? g.s n = some { a := a, b := b }
b_ne_zero : b ≠ 0
⊢ convergents g (n + 1) = convergents (squashGCF g n) n
cases' n with n'
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ convergents g (Nat.zero + 1) = convergents (squashGCF g Nat.zero) Nat.zero

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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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]
no goals
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case succ =>
  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 [*, (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 _ b_ne_zero]
  field_simp
  congr 1 <;> ring
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ (b * g.h + a) / b = g.h + a / b
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ convergents g (Nat.zero + 1) = convergents (squashGCF g Nat.zero) Nat.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]
no goals
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ (b * g.h + a) / b = g.h + a / b
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]
no goals
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
this : (b * g.h + a) / b = g.h + a / b
⊢ convergents g (Nat.zero + 1) = convergents (squashGCF g Nat.zero) Nat.zero
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]
no goals
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ (b * g.h + a) / b = b * g.h / b + a / b
ring
no goals
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}, Stream'.Seq.get? (partialDenominators g) Nat.zero = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g Nat.zero
s_nth_eq : Stream'.Seq.get? g.s Nat.zero = some { a := a, b := b }
⊢ b * g.h / b + a / b = g.h + a / b
rw [mul_div_cancel_left _ b_ne_zero]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.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
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let g' := squashGCF g (n' + 1)
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
set pred_conts := g.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
set ppred_conts := g.continuantsAux n' with n'th_conts_aux_eq
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let pA := pred_conts.a
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let pB := pred_conts.b
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let ppA := ppred_conts.a
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let ppB := ppred_conts.b
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
set pred_conts' := g'.continuantsAux (n' + 1) with succ_n'th_conts_aux_eq'
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
set ppred_conts' := g'.continuantsAux n' with n'th_conts_aux_eq'
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let pA' := pred_conts'.a
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let pB' := pred_conts'.b
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let ppA' := ppred_conts'.a
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
let ppB' := ppred_conts'.b
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
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]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ convergents g (Nat.succ n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ convergents g (Nat.succ n' + 1) = convergents (squashGCF g (Nat.succ n')) (Nat.succ n')
rw [this]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ convergents g (Nat.succ n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ convergents g (Nat.succ n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
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]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (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')
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ convergents g (Nat.succ n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
rw [this]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (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)
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (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')
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 [*, (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 _ b_ne_zero]
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb * b + a) * (continuantsAux g (n' + 1)).a + pa * (continuantsAux g n').a * b) /
      ((pb * b + a) * (continuantsAux g (n' + 1)).b + pa * (continuantsAux g n').b * b) =
    (b * (pb * (continuantsAux g (n' + 1)).a + pa * (continuantsAux g n').a) + a * (continuantsAux g (n' + 1)).a) /
      (b * (pb * (continuantsAux g (n' + 1)).b + pa * (continuantsAux g n').b) + a * (continuantsAux g (n' + 1)).b)
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (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)
field_simp
no goals
case 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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
⊢ ((pb * b + a) * (continuantsAux g (n' + 1)).a + pa * (continuantsAux g n').a * b) /
      ((pb * b + a) * (continuantsAux g (n' + 1)).b + pa * (continuantsAux g n').b * b) =
    (b * (pb * (continuantsAux g (n' + 1)).a + pa * (continuantsAux g n').a) + a * (continuantsAux g (n' + 1)).a) /
      (b * (pb * (continuantsAux g (n' + 1)).b + pa * (continuantsAux g n').b) + a * (continuantsAux g (n' + 1)).b)
congr 1 <;> ring
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : Stream'.Seq.get? g'.s n' = some { a := pa, b := pb + a / b }
⊢ convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
⊢ convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
have : g'.s.get? n' = some ⟨pa, pb + a / b⟩ :=
  squashSeq_nth_of_not_terminated s_n'th_eq s_nth_eq
no goals
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : Stream'.Seq.get? g'.s n' = some { a := pa, b := pb + a / b }
⊢ convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
rw [convergent_eq_conts_a_div_conts_b,
  continuants_recurrenceAux this n'th_conts_aux_eq'.symm succ_n'th_conts_aux_eq'.symm]
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : continuantsAux g (n' + 2) = { a := pb * pA + pa * ppA, b := pb * pB + pa * ppB }
⊢ convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
⊢ convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
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
no goals
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this : continuantsAux g (n' + 2) = { a := pb * pA + pa * ppA, b := pb * pB + pa * ppB }
⊢ convergents g (n' + 2) = (b * (pb * pA + pa * ppA) + a * pA) / (b * (pb * pB + pa * ppB) + a * pB)
rw [convergent_eq_conts_a_div_conts_b,
  continuants_recurrenceAux s_nth_eq succ_n'th_conts_aux_eq.symm this]
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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')
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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')
obtain ⟨eq1, eq2, eq3, eq4⟩ : pA' = pA ∧ pB' = pB ∧ ppA' = ppA ∧ ppB' = ppB := by
  simp [*, (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
    (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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)
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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')
symm
no goals
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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)
simpa only [eq1, eq2, eq3, eq4, mul_div_cancel _ b_ne_zero]
no goals
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}, Stream'.Seq.get? (partialDenominators g) (Nat.succ n') = some b → b ≠ 0
not_terminated_at_n : ¬TerminatedAt g (Nat.succ n')
s_nth_eq : Stream'.Seq.get? g.s (Nat.succ n') = some { a := a, b := b }
pa pb : K
s_n'th_eq : Stream'.Seq.get? g.s n' = some { a := pa, b := pb }
g' : GeneralizedContinuedFraction K := squashGCF g (n' + 1)
pred_conts : Pair K := continuantsAux g (n' + 1)
succ_n'th_conts_aux_eq : pred_conts = continuantsAux g (n' + 1)
ppred_conts : Pair K := continuantsAux g n'
n'th_conts_aux_eq : ppred_conts = continuantsAux g n'
pA : K := pred_conts.a
pB : K := pred_conts.b
ppA : K := ppred_conts.a
ppB : K := ppred_conts.b
pred_conts' : Pair K := continuantsAux g' (n' + 1)
succ_n'th_conts_aux_eq' : pred_conts' = continuantsAux g' (n' + 1)
ppred_conts' : Pair K := continuantsAux g' n'
n'th_conts_aux_eq' : ppred_conts' = continuantsAux g' n'
pA' : K := pred_conts'.a
pB' : K := pred_conts'.b
ppA' : K := ppred_conts'.a
ppB' : K := ppred_conts'.b
this✝¹ : convergents g' (n' + 1) = ((pb + a / b) * pA' + pa * ppA') / ((pb + a / b) * pB' + pa * ppB')
this✝ : convergents g (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
simp [*, (continuantsAux_eq_continuantsAux_squashGCF_of_le <| le_refl <| n' + 1).symm,
  (continuantsAux_eq_continuantsAux_squashGCF_of_le n'.le_succ).symm]