no goals
case zero
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
nth_stream_eq_none : IntFractPair.stream v Nat.zero = none
⊢ v = convergents (of v) (Nat.zero - 1)
contradiction
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
⊢ v = convergents (of v) (Nat.succ n - 1)
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
⊢ v = convergents (of v) (Nat.succ n - 1)
let g := of v
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
⊢ v = convergents g n
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
⊢ v = convergents (of v) (Nat.succ n - 1)
change v = g.convergents n
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
this : IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0
⊢ v = convergents g n
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
⊢ v = convergents g n
have :
  IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0 :=
  IntFractPair.succ_nth_stream_eq_none_iff.1 nth_stream_eq_none
case succ.inl
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
nth_stream_eq_none : IntFractPair.stream v n = none
⊢ v = convergents g n

case succ.inr.intro.intro
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
ifp_n : IntFractPair K
nth_stream_eq : IntFractPair.stream v n = some ifp_n
nth_stream_fr_eq_zero : ifp_n.fr = 0
⊢ v = convergents g n
case succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
this : IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0
⊢ v = convergents g n
rcases this with (⟨nth_stream_eq_none⟩ | ⟨ifp_n, nth_stream_eq, nth_stream_fr_eq_zero⟩)
case succ.inl.zero
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
IH : IntFractPair.stream v Nat.zero = none → v = convergents (of v) (Nat.zero - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ Nat.zero) = none
nth_stream_eq_none : IntFractPair.stream v Nat.zero = none
⊢ v = convergents g Nat.zero

case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
⊢ v = convergents g (Nat.succ n')
case succ.inl
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
nth_stream_eq_none : IntFractPair.stream v n = none
⊢ v = convergents g n
cases' n with n'
no goals
case succ.inl.zero
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
IH : IntFractPair.stream v Nat.zero = none → v = convergents (of v) (Nat.zero - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ Nat.zero) = none
nth_stream_eq_none : IntFractPair.stream v Nat.zero = none
⊢ v = convergents g Nat.zero
contradiction
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this : TerminatedAt g n'
⊢ v = convergents g (Nat.succ n')
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
⊢ v = convergents g (Nat.succ n')
have : g.TerminatedAt n' :=
  of_terminatedAt_n_iff_succ_nth_intFractPair_stream_eq_none.2
    nth_stream_eq_none
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this✝ : TerminatedAt g n'
this : convergents g (n' + 1) = convergents g n'
⊢ v = convergents g (Nat.succ n')
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this : TerminatedAt g n'
⊢ v = convergents g (Nat.succ n')
have : g.convergents (n' + 1) = g.convergents n' :=
  convergents_stable_of_terminated n'.le_succ this
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this✝ : TerminatedAt g n'
this : convergents g (n' + 1) = convergents g n'
⊢ v = convergents g n'
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this✝ : TerminatedAt g n'
this : convergents g (n' + 1) = convergents g n'
⊢ v = convergents g (Nat.succ n')
rw [this]
no goals
case succ.inl.succ
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n : ℕ
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n' : ℕ
IH : IntFractPair.stream v (Nat.succ n') = none → v = convergents (of v) (Nat.succ n' - 1)
nth_stream_eq_none✝ : IntFractPair.stream v (Nat.succ (Nat.succ n')) = none
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n') = none
this✝ : TerminatedAt g n'
this : convergents g (n' + 1) = convergents g n'
⊢ v = convergents g n'
exact IH nth_stream_eq_none
no goals
case succ.inr.intro.intro
K : Type u_1
inst✝¹ : LinearOrderedField K
v : K
n✝ : ℕ
inst✝ : FloorRing K
n : ℕ
IH : IntFractPair.stream v n = none → v = convergents (of v) (n - 1)
nth_stream_eq_none : IntFractPair.stream v (Nat.succ n) = none
g : GeneralizedContinuedFraction K := of v
ifp_n : IntFractPair K
nth_stream_eq : IntFractPair.stream v n = some ifp_n
nth_stream_fr_eq_zero : ifp_n.fr = 0
⊢ v = convergents g n
simpa [nth_stream_fr_eq_zero, compExactValue] using
  compExactValue_correctness_of_stream_eq_some nth_stream_eq