-- Mathlib/Algebra/Order/CauSeq/Basic.lean
lemma bounded (hf : IsCauSeq abv f) : ∃ r, ∀ i, abv (f i) < r

Proof state:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
⊢ abv (f j) < R i + 1

Tactic:
obtain hji | hij := le_total j i

Result:
case intro.inl
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
hji : j ≤ i
⊢ abv (f j) < R i + 1

case intro.inr
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
hij : i ≤ j
⊢ abv (f j) < R i + 1

Proof state:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
⊢ ∃ r, ∀ (i : ℕ), abv (f i) < r

Tactic:
refine ⟨R i + 1, fun j ↦ ?_⟩

Result:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
⊢ abv (f j) < R i + 1

Proof state:
case step
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i✝ : ℕ
h : ∀ j ≥ i✝, abv (f j - f i✝) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
i : ℕ
hi : ∀ j ≤ i, abv (f j) ≤ R i
j : ℕ
hj : j.le i
⊢ abv (f j) ≤ R i.succ

Tactic:
exact (hi j hj).trans (le_max_left _ _)

Result:
no goals

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
⊢ ∃ r, ∀ (i : ℕ), abv (f i) < r

Tactic:
obtain ⟨i, h⟩ := hf _ zero_lt_one

Result:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
⊢ ∃ r, ∀ (i : ℕ), abv (f i) < r

Proof state:
case intro.inl
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
hji : j ≤ i
⊢ abv (f j) < R i + 1

Tactic:
exact (this i _ hji).trans_lt (lt_add_one _)

Result:
no goals

Proof state:
case intro.inr
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
this : ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i
j : ℕ
hij : i ≤ j
⊢ abv (f j) < R i + 1

Tactic:
simpa using (abv_add abv _ _).trans_lt <| add_lt_add_of_le_of_lt (this i _ le_rfl) (h _ hij)

Result:
no goals

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
⊢ ∀ (n : ℕ), (∀ j ≤ n, abv (f j) ≤ R n) → ∀ j ≤ n.succ, abv (f j) ≤ R n.succ

Tactic:
rintro i hi j (rfl | hj)

Result:
case refl
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i✝ : ℕ
h : ∀ j ≥ i✝, abv (f j - f i✝) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
i : ℕ
hi : ∀ j ≤ i, abv (f j) ≤ R i
⊢ abv (f i.succ) ≤ R i.succ

case step
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i✝ : ℕ
h : ∀ j ≥ i✝, abv (f j - f i✝) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
i : ℕ
hi : ∀ j ≤ i, abv (f j) ≤ R i
j : ℕ
hj : j.le i
⊢ abv (f j) ≤ R i.succ

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
⊢ ∀ j ≤ Nat.zero, abv (f j) ≤ R Nat.zero

Tactic:
simp [hR]

Result:
no goals

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
⊢ ∀ (i j : ℕ), j ≤ i → abv (f j) ≤ R i

Tactic:
refine Nat.rec (by simp [hR]) ?_

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
⊢ ∀ (n : ℕ), (∀ j ≤ n, abv (f j) ≤ R n) → ∀ j ≤ n.succ, abv (f j) ≤ R n.succ

Proof state:
case refl
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i✝ : ℕ
h : ∀ j ≥ i✝, abv (f j - f i✝) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
i : ℕ
hi : ∀ j ≤ i, abv (f j) ≤ R i
⊢ abv (f i.succ) ≤ R i.succ

Tactic:
simp [R]

Result:
no goals

Proof state:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
⊢ ∃ r, ∀ (i : ℕ), abv (f i) < r

Tactic:
set R : ℕ → α := @Nat.rec (fun _ => α) (abv (f 0)) fun i c => max c (abv (f i.succ)) with hR

Result:
case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
hf : IsCauSeq abv f
i : ℕ
h : ∀ j ≥ i, abv (f j - f i) < 1
R : ℕ → α := Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
hR : R = Nat.rec (abv (f 0)) fun i c => c ⊔ abv (f i.succ)
⊢ ∃ r, ∀ (i : ℕ), abv (f i) < r