Theorem: GeneralizedContinuedFraction.zero_le_of_continuantsAux_b
File: Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean

tactic: let g := of v
state_before: K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
⊢ 0 ≤ ((of v).continuantsAux n).b
state_after: K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
⊢ 0 ≤ ((of v).continuantsAux n).b

tactic: rfl
state_before: case zero
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
⊢ 0 ≤ ((of v).continuantsAux 0).b
state_after: no goals

tactic: cases' Decidable.em <| g.TerminatedAt (n - 1) with terminated not_terminated
state_before: case succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux n).b
⊢ 0 ≤ ((of v).continuantsAux (n + 1)).b
state_after: case succ.inl
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux n).b
terminated : g.TerminatedAt (n - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1)).b

case succ.inr
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux n).b
not_terminated : ¬g.TerminatedAt (n - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1)).b

tactic: cases' n with n
state_before: case succ.inl
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux n).b
terminated : g.TerminatedAt (n - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1)).b
state_after: case succ.inl.zero
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
IH : 0 ≤ ((of v).continuantsAux 0).b
terminated : g.TerminatedAt (0 - 1)
⊢ 0 ≤ ((of v).continuantsAux (0 + 1)).b

case succ.inl.succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux (n + 1)).b
terminated : g.TerminatedAt (n + 1 - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1 + 1)).b

tactic: simp [zero_le_one]
state_before: case succ.inl.zero
K : Type u_1
v : K
n : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
IH : 0 ≤ ((of v).continuantsAux 0).b
terminated : g.TerminatedAt (0 - 1)
⊢ 0 ≤ ((of v).continuantsAux (0 + 1)).b
state_after: no goals

tactic: have : g.continuantsAux (n + 2) = g.continuantsAux (n + 1) :=
  continuantsAux_stable_step_of_terminated terminated
state_before: case succ.inl.succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux (n + 1)).b
terminated : g.TerminatedAt (n + 1 - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1 + 1)).b
state_after: case succ.inl.succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux (n + 1)).b
terminated : g.TerminatedAt (n + 1 - 1)
this : g.continuantsAux (n + 2) = g.continuantsAux (n + 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1 + 1)).b

tactic: simp only [this, IH]
state_before: case succ.inl.succ
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux (n + 1)).b
terminated : g.TerminatedAt (n + 1 - 1)
this : g.continuantsAux (n + 2) = g.continuantsAux (n + 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1 + 1)).b
state_after: no goals

tactic: calc
  (0 : K) ≤ fib (n + 1) := mod_cast (n + 1).fib.zero_le
  _ ≤ ((of v).continuantsAux (n + 1)).b := fib_le_of_continuantsAux_b (Or.inr not_terminated)
state_before: case succ.inr
K : Type u_1
v : K
n✝ : ℕ
inst✝¹ : LinearOrderedField K
inst✝ : FloorRing K
g : GeneralizedContinuedFraction K := of v
n : ℕ
IH : 0 ≤ ((of v).continuantsAux n).b
not_terminated : ¬g.TerminatedAt (n - 1)
⊢ 0 ≤ ((of v).continuantsAux (n + 1)).b
state_after: no goals