File: Mathlib/Algebra/ContinuedFractions/Computation/TerminatesIffRat.lean

full_name: GenContFract.exists_gcf_pair_rat_eq_of_nth_contsAux
code: nonrec theorem exists_gcf_pair_rat_eq_of_nth_contsAux :
    ∃ conts : Pair ℚ, (of v).contsAux n = (conts.map (↑) : Pair K) 
goal: ∃ conts, (GenContFract.of v).contsAux n = GenContFract.Pair.map Rat.cast conts

full_name: GenContFract.exists_gcf_pair_rat_eq_nth_conts
code: theorem exists_gcf_pair_rat_eq_nth_conts :
    ∃ conts : Pair ℚ, (of v).conts n = (conts.map (↑) : Pair K) 
goal: ∃ conts, (GenContFract.of v).conts n = GenContFract.Pair.map Rat.cast conts

full_name: GenContFract.exists_rat_eq_nth_num
code: theorem exists_rat_eq_nth_num : ∃ q : ℚ, (of v).nums n = (q : K) 
goal: ∃ q, (GenContFract.of v).nums n = ↑q

full_name: GenContFract.exists_rat_eq_nth_den
code: theorem exists_rat_eq_nth_den : ∃ q : ℚ, (of v).dens n = (q : K) 
goal: ∃ q, (GenContFract.of v).dens n = ↑q

full_name: GenContFract.exists_rat_eq_nth_conv
code: /-- Every finite convergent corresponds to a rational number. -/
theorem exists_rat_eq_nth_conv : ∃ q : ℚ, (of v).convs n = (q : K) 
goal: ∃ q, (GenContFract.of v).convs n = ↑q

full_name: GenContFract.exists_rat_eq_of_terminates
code: /-- Every terminating continued fraction corresponds to a rational number. -/
theorem exists_rat_eq_of_terminates (terminates : (of v).Terminates) : ∃ q : ℚ, v = ↑q 
goal: ∃ q, v = ↑q

full_name: GenContFract.IntFractPair.coe_of_rat_eq
code: theorem coe_of_rat_eq : ((IntFractPair.of q).mapFr (↑) : IntFractPair K) = IntFractPair.of v 
goal: GenContFract.IntFractPair.mapFr Rat.cast (GenContFract.IntFractPair.of q) = GenContFract.IntFractPair.of v

full_name: GenContFract.IntFractPair.coe_stream_nth_rat_eq
code: theorem coe_stream_nth_rat_eq :
    ((IntFractPair.stream q n).map (mapFr (↑)) : Option <| IntFractPair K) =
      IntFractPair.stream v n 
goal: Option.map (GenContFract.IntFractPair.mapFr Rat.cast) (GenContFract.IntFractPair.stream q n) =
  GenContFract.IntFractPair.stream v n

full_name: GenContFract.IntFractPair.coe_stream'_rat_eq
code: theorem coe_stream'_rat_eq :
    ((IntFractPair.stream q).map (Option.map (mapFr (↑))) : Stream' <| Option <| IntFractPair K) =
      IntFractPair.stream v 
goal: Stream'.map (Option.map (GenContFract.IntFractPair.mapFr Rat.cast)) (GenContFract.IntFractPair.stream q) =
  GenContFract.IntFractPair.stream v

full_name: GenContFract.coe_of_h_rat_eq
code: theorem coe_of_h_rat_eq : (↑((of q).h : ℚ) : K) = (of v).h 
goal: ↑(GenContFract.of q).h = (GenContFract.of v).h

full_name: GenContFract.coe_of_s_get?_rat_eq
code: theorem coe_of_s_get?_rat_eq :
    (((of q).s.get? n).map (Pair.map (↑)) : Option <| Pair K) = (of v).s.get? n 
goal: Option.map (GenContFract.Pair.map Rat.cast) ((GenContFract.of q).s.get? n) = (GenContFract.of v).s.get? n

full_name: GenContFract.coe_of_s_rat_eq
code: theorem coe_of_s_rat_eq : ((of q).s.map (Pair.map ((↑))) : Stream'.Seq <| Pair K) = (of v).s 
goal: Stream'.Seq.map (GenContFract.Pair.map Rat.cast) (GenContFract.of q).s = (GenContFract.of v).s

full_name: GenContFract.coe_of_rat_eq
code: /-- Given `(v : K), (q : ℚ), and v = q`, we have that `of q = of v` -/
theorem coe_of_rat_eq :
    (⟨(of q).h, (of q).s.map (Pair.map (↑))⟩ : GenContFract K) = of v 
goal: { h := ↑(GenContFract.of q).h, s := Stream'.Seq.map (GenContFract.Pair.map Rat.cast) (GenContFract.of q).s } =
  GenContFract.of v

full_name: GenContFract.of_terminates_iff_of_rat_terminates
code: theorem of_terminates_iff_of_rat_terminates {v : K} {q : ℚ} (v_eq_q : v = (q : K)) :
    (of v).Terminates ↔ (of q).Terminates 
goal: (GenContFract.of v).Terminates ↔ (GenContFract.of q).Terminates

full_name: GenContFract.IntFractPair.of_inv_fr_num_lt_num_of_pos
code: /-- Shows that for any `q : ℚ` with `0 < q < 1`, the numerator of the fractional part of
`IntFractPair.of q⁻¹` is smaller than the numerator of `q`.
-/
theorem of_inv_fr_num_lt_num_of_pos (q_pos : 0 < q) : (IntFractPair.of q⁻¹).fr.num < q.num 
goal: (GenContFract.IntFractPair.of q⁻¹).fr.num < q.num

full_name: GenContFract.IntFractPair.stream_succ_nth_fr_num_lt_nth_fr_num_rat
code: /-- Shows that the sequence of numerators of the fractional parts of the stream is strictly
antitone. -/
theorem stream_succ_nth_fr_num_lt_nth_fr_num_rat {ifp_n ifp_succ_n : IntFractPair ℚ}
    (stream_nth_eq : IntFractPair.stream q n = some ifp_n)
    (stream_succ_nth_eq : IntFractPair.stream q (n + 1) = some ifp_succ_n) :
    ifp_succ_n.fr.num < ifp_n.fr.num 
goal: ifp_succ_n.fr.num < ifp_n.fr.num

full_name: GenContFract.IntFractPair.stream_nth_fr_num_le_fr_num_sub_n_rat
code: theorem stream_nth_fr_num_le_fr_num_sub_n_rat :
    ∀ {ifp_n : IntFractPair ℚ},
      IntFractPair.stream q n = some ifp_n → ifp_n.fr.num ≤ (IntFractPair.of q).fr.num - n 
goal: GenContFract.IntFractPair.stream q n = some ifp_n → ifp_n.fr.num ≤ (GenContFract.IntFractPair.of q).fr.num - ↑n

full_name: GenContFract.IntFractPair.exists_nth_stream_eq_none_of_rat
code: theorem exists_nth_stream_eq_none_of_rat (q : ℚ) : ∃ n : ℕ, IntFractPair.stream q n = none 
goal: ∃ n, GenContFract.IntFractPair.stream q n = none

full_name: GenContFract.terminates_of_rat
code: /-- The continued fraction of a rational number terminates. -/
theorem terminates_of_rat (q : ℚ) : (of q).Terminates 
goal: (GenContFract.of q).Terminates

full_name: GenContFract.terminates_iff_rat
code: /-- The continued fraction `GenContFract.of v` terminates if and only if `v ∈ ℚ`. -/
theorem terminates_iff_rat (v : K) : (of v).Terminates ↔ ∃ q : ℚ, v = (q : K) 
goal: (GenContFract.of v).Terminates ↔ ∃ q, v = ↑q