Theorem: GeneralizedContinuedFraction.of_convergence_epsilon
File: Mathlib/Algebra/ContinuedFractions/Computation/ApproximationCorollaries.lean

tactic: intro ε ε_pos
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
⊢ ∀ ε > 0, ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε
state_after: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε

tactic: rcases (exists_nat_gt (1 / ε) : ∃ N' : ℕ, 1 / ε < N') with ⟨N', one_div_ε_lt_N'⟩
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε
state_after: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε

tactic: let N := max N' 5
state_before: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε
state_after: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε

tactic: exists N
state_before: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
⊢ ∃ N, ∀ n ≥ N, |v - (of v).convergents n| < ε
state_after: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
⊢ ∀ n ≥ N, |v - (of v).convergents n| < ε

tactic: intro n n_ge_N
state_before: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
⊢ ∀ n ≥ N, |v - (of v).convergents n| < ε
state_after: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
⊢ |v - (of v).convergents n| < ε

tactic: let g := of v
state_before: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
⊢ |v - (of v).convergents n| < ε
state_after: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
⊢ |v - (of v).convergents n| < ε

tactic: cases' Decidable.em (g.TerminatedAt n) with terminated_at_n not_terminated_at_n
state_before: case intro
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
⊢ |v - (of v).convergents n| < ε

case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
⊢ |v - (of v).convergents n| < ε

tactic: have : v = g.convergents n := of_correctness_of_terminatedAt terminated_at_n
state_before: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this : v = g.convergents n
⊢ |v - (of v).convergents n| < ε

tactic: have : v - g.convergents n = 0 := sub_eq_zero.mpr this
state_before: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this : v = g.convergents n
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this✝ : v = g.convergents n
this : v - g.convergents n = 0
⊢ |v - (of v).convergents n| < ε

tactic: rw [this]
state_before: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this✝ : v = g.convergents n
this : v - g.convergents n = 0
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this✝ : v = g.convergents n
this : v - g.convergents n = 0
⊢ |0| < ε

tactic: exact mod_cast ε_pos
state_before: case intro.inl
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
terminated_at_n : g.TerminatedAt n
this✝ : v = g.convergents n
this : v - g.convergents n = 0
⊢ |0| < ε
state_after: no goals

tactic: let B := g.denominators n
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
⊢ |v - (of v).convergents n| < ε

tactic: let nB := g.denominators (n + 1)
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
⊢ |v - (of v).convergents n| < ε

tactic: have abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB) :=
  abs_sub_convergents_le not_terminated_at_n
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
⊢ |v - (of v).convergents n| < ε

tactic: suffices 1 / (B * nB) < ε from lt_of_le_of_lt abs_v_sub_conv_le this
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
⊢ |v - (of v).convergents n| < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
⊢ 1 / (B * nB) < ε

tactic: have nB_ineq : (fib (n + 2) : K) ≤ nB :=
  haveI : ¬g.TerminatedAt (n + 1 - 1) := not_terminated_at_n
  succ_nth_fib_le_of_nth_denom (Or.inr this)
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
⊢ 1 / (B * nB) < ε

tactic: have B_ineq : (fib (n + 1) : K) ≤ B :=
  haveI : ¬g.TerminatedAt (n - 1) := mt (terminated_stable n.pred_le) not_terminated_at_n
  succ_nth_fib_le_of_nth_denom (Or.inr this)
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
⊢ 1 / (B * nB) < ε

tactic: have zero_lt_B : 0 < B := B_ineq.trans_lt' <| mod_cast fib_pos.2 n.succ_pos
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
⊢ 1 / (B * nB) < ε

tactic: have nB_pos : 0 < nB := nB_ineq.trans_lt' <| mod_cast fib_pos.2 <| succ_pos _
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
⊢ 1 / (B * nB) < ε

tactic: have zero_lt_mul_conts : 0 < B * nB := by positivity
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ 1 / (B * nB) < ε

tactic: suffices 1 < ε * (B * nB) from (div_lt_iff zero_lt_mul_conts).mpr this
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ 1 / (B * nB) < ε
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ 1 < ε * (B * nB)

tactic: calc 1 < ε * (N' : K) := (div_lt_iff' ε_pos).mp one_div_ε_lt_N'
  _ ≤ ε * (B * nB) := ?_
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ 1 < ε * (B * nB)
state_after: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ε * ↑N' ≤ ε * (B * nB)

tactic: gcongr
state_before: case intro.inr
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ε * ↑N' ≤ ε * (B * nB)
state_after: case intro.inr.h
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑N' ≤ B * nB

tactic: calc
  (N' : K) ≤ (N : K) := by exact_mod_cast le_max_left _ _
  _ ≤ n := by exact_mod_cast n_ge_N
  _ ≤ fib n := by exact_mod_cast le_fib_self <| le_trans (le_max_right N' 5) n_ge_N
  _ ≤ fib (n + 1) := by exact_mod_cast fib_le_fib_succ
  _ ≤ fib (n + 1) * fib (n + 1) := by exact_mod_cast (fib (n + 1)).le_mul_self
  _ ≤ fib (n + 1) * fib (n + 2) := by gcongr; exact_mod_cast fib_le_fib_succ
  _ ≤ B * nB := by gcongr
state_before: case intro.inr.h
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑N' ≤ B * nB
state_after: no goals

tactic: positivity
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
⊢ 0 < B * nB
state_after: no goals

tactic: exact_mod_cast le_max_left _ _
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑N' ≤ ↑N
state_after: no goals

tactic: exact_mod_cast n_ge_N
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑N ≤ ↑n
state_after: no goals

tactic: exact_mod_cast le_fib_self <| le_trans (le_max_right N' 5) n_ge_N
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑n ≤ ↑(fib n)
state_after: no goals

tactic: exact_mod_cast fib_le_fib_succ
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑(fib n) ≤ ↑(fib (n + 1))
state_after: no goals

tactic: exact_mod_cast (fib (n + 1)).le_mul_self
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑(fib (n + 1)) ≤ ↑(fib (n + 1)) * ↑(fib (n + 1))
state_after: no goals

tactic: gcongr
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑(fib (n + 1)) * ↑(fib (n + 1)) ≤ ↑(fib (n + 1)) * ↑(fib (n + 2))
state_after: case h.h
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ fib (n + 1) ≤ fib (n + 2)

tactic: exact_mod_cast fib_le_fib_succ
state_before: case h.h
K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ fib (n + 1) ≤ fib (n + 2)
state_after: no goals

tactic: gcongr
state_before: K : Type u_1
v : K
inst✝² : LinearOrderedField K
inst✝¹ : FloorRing K
inst✝ : Archimedean K
ε : K
ε_pos : ε > 0
N' : ℕ
one_div_ε_lt_N' : 1 / ε < ↑N'
N : ℕ := max N' 5
n : ℕ
n_ge_N : n ≥ N
g : GeneralizedContinuedFraction K := of v
not_terminated_at_n : ¬g.TerminatedAt n
B : K := g.denominators n
nB : K := g.denominators (n + 1)
abs_v_sub_conv_le : |v - g.convergents n| ≤ 1 / (B * nB)
nB_ineq : ↑(fib (n + 2)) ≤ nB
B_ineq : ↑(fib (n + 1)) ≤ B
zero_lt_B : 0 < B
nB_pos : 0 < nB
zero_lt_mul_conts : 0 < B * nB
⊢ ↑(fib (n + 1)) * ↑(fib (n + 2)) ≤ B * nB
state_after: no goals