l3lab/ntp-mathlib huggingface dataset:
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  

Proof state:
case zero
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s Nat.zero = none
⊢ convergents'Aux s (Nat.zero + 1) = convergents'Aux s Nat.zero
case succ
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s Nat.zero = none
⊢ convergents'Aux s (Nat.zero + 1) = convergents'Aux s Nat.zero

Next tactic:
case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => 

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s Nat.zero = none
⊢ convergents'Aux s (Nat.zero + 1) = convergents'Aux s Nat.zero

Next tactic:
simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  

Proof state:
case succ
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      rw [convergents'Aux] at this
      simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      rw [convergents'Aux] at this
      simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
cases' s_head_eq : s.head with gp_head
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    

Proof state:
case none
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
s_head_eq : Stream'.Seq.head s = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)
case some
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case none => simp only [convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
s_head_eq : Stream'.Seq.head s = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case none => simp only [convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => 

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
s_head_eq : Stream'.Seq.head s = none
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
simp only [convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    

Proof state:
case some
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      rw [convergents'Aux] at this
      simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      rw [convergents'Aux] at this
      simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
⊢ Stream'.Seq.TerminatedAt (Stream'.Seq.tail s) n

Next tactic:
simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
this : Stream'.Seq.TerminatedAt (Stream'.Seq.tail s) n
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
have := IH this
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
this✝ : Stream'.Seq.TerminatedAt (Stream'.Seq.tail s) n
this : convergents'Aux (Stream'.Seq.tail s) (n + 1) = convergents'Aux (Stream'.Seq.tail s) n
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
rw [convergents'Aux] at this
theorem convergents'Aux_stable_step_of_terminated {s : Stream'.Seq <| Pair K}
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s (n + 1) = convergents'Aux s n := by
  change s.get? n = none at terminated_at_n
  induction' n with n IH generalizing s
  case zero => simp only [convergents'Aux, terminated_at_n, Stream'.Seq.head]
  case succ =>
    cases' s_head_eq : s.head with gp_head
    case none => simp only [convergents'Aux, s_head_eq]
    case some =>
      have : s.tail.TerminatedAt n := by
        simp only [Stream'.Seq.TerminatedAt, s.get?_tail, terminated_at_n]
      have := IH this
      rw [convergents'Aux] at this
      

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n✝ m : ℕ
inst✝ : DivisionRing K
n : ℕ
IH : ∀ {s : Stream'.Seq (Pair K)}, Stream'.Seq.get? s n = none → convergents'Aux s (n + 1) = convergents'Aux s n
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.get? s (Nat.succ n) = none
gp_head : Pair K
s_head_eq : Stream'.Seq.head s = some gp_head
this✝ : Stream'.Seq.TerminatedAt (Stream'.Seq.tail s) n
this :
  (match Stream'.Seq.head (Stream'.Seq.tail s) with
    | none => 0
    | some gp => gp.a / (gp.b + convergents'Aux (Stream'.Seq.tail (Stream'.Seq.tail s)) n)) =
    convergents'Aux (Stream'.Seq.tail s) n
⊢ convergents'Aux s (Nat.succ n + 1) = convergents'Aux s (Nat.succ n)

Next tactic:
simp [this, Nat.add_eq, add_zero, convergents'Aux, s_head_eq]
theorem convergents'Aux_stable_of_terminated {s : Stream'.Seq <| Pair K} (n_le_m : n ≤ m)
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s m = convergents'Aux s n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
n_le_m : n ≤ m
terminated_at_n : Stream'.Seq.TerminatedAt s n
⊢ convergents'Aux s m = convergents'Aux s n

Next tactic:
induction' n_le_m with m n_le_m IH
theorem convergents'Aux_stable_of_terminated {s : Stream'.Seq <| Pair K} (n_le_m : n ≤ m)
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s m = convergents'Aux s n := by
  induction' n_le_m with m n_le_m IH
  · 

Proof state:
case refl
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.TerminatedAt s n
⊢ convergents'Aux s n = convergents'Aux s n

Next tactic:
rfl
theorem convergents'Aux_stable_of_terminated {s : Stream'.Seq <| Pair K} (n_le_m : n ≤ m)
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s m = convergents'Aux s n := by
  induction' n_le_m with m n_le_m IH
  · rfl
  · 

Proof state:
case step
K : Type u_1
g : GeneralizedContinuedFraction K
n m✝ : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.TerminatedAt s n
m : ℕ
n_le_m : Nat.le n m
IH : convergents'Aux s m = convergents'Aux s n
⊢ convergents'Aux s (Nat.succ m) = convergents'Aux s n

Next tactic:
refine' (convergents'Aux_stable_step_of_terminated _).trans IH
theorem convergents'Aux_stable_of_terminated {s : Stream'.Seq <| Pair K} (n_le_m : n ≤ m)
    (terminated_at_n : s.TerminatedAt n) : convergents'Aux s m = convergents'Aux s n := by
  induction' n_le_m with m n_le_m IH
  · rfl
  · refine' (convergents'Aux_stable_step_of_terminated _).trans IH
    

Proof state:
case step
K : Type u_1
g : GeneralizedContinuedFraction K
n m✝ : ℕ
inst✝ : DivisionRing K
s : Stream'.Seq (Pair K)
terminated_at_n : Stream'.Seq.TerminatedAt s n
m : ℕ
n_le_m : Nat.le n m
IH : convergents'Aux s m = convergents'Aux s n
⊢ Stream'.Seq.TerminatedAt s m

Next tactic:
exact s.terminated_stable n_le_m terminated_at_n
theorem continuants_stable_of_terminated (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) :
    g.continuants m = g.continuants n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
n_le_m : n ≤ m
terminated_at_n : TerminatedAt g n
⊢ continuants g m = continuants g n

Next tactic:
simp only [nth_cont_eq_succ_nth_cont_aux,
    continuantsAux_stable_of_terminated (Nat.pred_le_iff.mp n_le_m) terminated_at_n]
theorem numerators_stable_of_terminated (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) :
    g.numerators m = g.numerators n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
n_le_m : n ≤ m
terminated_at_n : TerminatedAt g n
⊢ numerators g m = numerators g n

Next tactic:
simp only [num_eq_conts_a, continuants_stable_of_terminated n_le_m terminated_at_n]
theorem denominators_stable_of_terminated (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) :
    g.denominators m = g.denominators n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
n_le_m : n ≤ m
terminated_at_n : TerminatedAt g n
⊢ denominators g m = denominators g n

Next tactic:
simp only [denom_eq_conts_b, continuants_stable_of_terminated n_le_m terminated_at_n]
theorem convergents_stable_of_terminated (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) :
    g.convergents m = g.convergents n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
n_le_m : n ≤ m
terminated_at_n : TerminatedAt g n
⊢ convergents g m = convergents g n

Next tactic:
simp only [convergents, denominators_stable_of_terminated n_le_m terminated_at_n,
    numerators_stable_of_terminated n_le_m terminated_at_n]
theorem convergents'_stable_of_terminated (n_le_m : n ≤ m) (terminated_at_n : g.TerminatedAt n) :
    g.convergents' m = g.convergents' n := by
  

Proof state:
K : Type u_1
g : GeneralizedContinuedFraction K
n m : ℕ
inst✝ : DivisionRing K
n_le_m : n ≤ m
terminated_at_n : TerminatedAt g n
⊢ convergents' g m = convergents' g n

Next tactic:
simp only [convergents', convergents'Aux_stable_of_terminated n_le_m terminated_at_n]
/-- There is always a satellite configuration with a single point. -/
instance Besicovitch.SatelliteConfig.instInhabited {α : Type*} {τ : ℝ}
    [Inhabited α] [MetricSpace α] : Inhabited (Besicovitch.SatelliteConfig α 0 τ) :=
  ⟨{  c := default
      r := fun _ => 1
      rpos := fun _ => zero_lt_one
      h := fun i j hij => (hij (Subsingleton.elim (α := Fin 1) i j)).elim
      hlast := fun i hi => by
        

Proof state:
α : Type u_1
τ : ℝ
inst✝¹ : Inhabited α
inst✝ : MetricSpace α
i : Fin (0 + 1)
hi : i < last 0
⊢ (fun x => 1) i ≤ dist (default i) (default (last 0)) ∧ (fun x => 1) (last 0) ≤ τ * (fun x => 1) i

Next tactic:
rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi
/-- There is always a satellite configuration with a single point. -/
instance Besicovitch.SatelliteConfig.instInhabited {α : Type*} {τ : ℝ}
    [Inhabited α] [MetricSpace α] : Inhabited (Besicovitch.SatelliteConfig α 0 τ) :=
  ⟨{  c := default
      r := fun _ => 1
      rpos := fun _ => zero_lt_one
      h := fun i j hij => (hij (Subsingleton.elim (α := Fin 1) i j)).elim
      hlast := fun i hi => by
        rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; 

Proof state:
α : Type u_1
τ : ℝ
inst✝¹ : Inhabited α
inst✝ : MetricSpace α
i : Fin (0 + 1)
hi : last 0 < last 0
⊢ (fun x => 1) i ≤ dist (default i) (default (last 0)) ∧ (fun x => 1) (last 0) ≤ τ * (fun x => 1) i

Next tactic:
exact (lt_irrefl _ hi).elim
/-- There is always a satellite configuration with a single point. -/
instance Besicovitch.SatelliteConfig.instInhabited {α : Type*} {τ : ℝ}
    [Inhabited α] [MetricSpace α] : Inhabited (Besicovitch.SatelliteConfig α 0 τ) :=
  ⟨{  c := default
      r := fun _ => 1
      rpos := fun _ => zero_lt_one
      h := fun i j hij => (hij (Subsingleton.elim (α := Fin 1) i j)).elim
      hlast := fun i hi => by
        rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; exact (lt_irrefl _ hi).elim
      inter := fun i hi => by
        

Proof state:
α : Type u_1
τ : ℝ
inst✝¹ : Inhabited α
inst✝ : MetricSpace α
i : Fin (0 + 1)
hi : i < last 0
⊢ dist (default i) (default (last 0)) ≤ (fun x => 1) i + (fun x => 1) (last 0)

Next tactic:
rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi
/-- There is always a satellite configuration with a single point. -/
instance Besicovitch.SatelliteConfig.instInhabited {α : Type*} {τ : ℝ}
    [Inhabited α] [MetricSpace α] : Inhabited (Besicovitch.SatelliteConfig α 0 τ) :=
  ⟨{  c := default
      r := fun _ => 1
      rpos := fun _ => zero_lt_one
      h := fun i j hij => (hij (Subsingleton.elim (α := Fin 1) i j)).elim
      hlast := fun i hi => by
        rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; exact (lt_irrefl _ hi).elim
      inter := fun i hi => by
        rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; 

Proof state:
α : Type u_1
τ : ℝ
inst✝¹ : Inhabited α
inst✝ : MetricSpace α
i : Fin (0 + 1)
hi : last 0 < last 0
⊢ dist (default i) (default (last 0)) ≤ (fun x => 1) i + (fun x => 1) (last 0)

Next tactic:
exact (lt_irrefl _ hi).elim
theorem inter' (i : Fin N.succ) : dist (a.c i) (a.c (last N)) ≤ a.r i + a.r (last N) := by
  

Proof state:
α : Type u_1
inst✝ : MetricSpace α
N : ℕ
τ : ℝ
a : SatelliteConfig α N τ
i : Fin (Nat.succ N)
⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N)

Next tactic:
rcases lt_or_le i (last N) with (H | H)
theorem inter' (i : Fin N.succ) : dist (a.c i) (a.c (last N)) ≤ a.r i + a.r (last N) := by
  rcases lt_or_le i (last N) with (H | H)
  · 

Proof state:
case inl
α : Type u_1
inst✝ : MetricSpace α
N : ℕ
τ : ℝ
a : SatelliteConfig α N τ
i : Fin (Nat.succ N)
H : i < last N
⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N)

Next tactic:
exact a.inter i H