Theorem: CauSeq.bounded
File: Mathlib/Data/Real/CauSeq.lean

tactic: cases' f.cauchy zero_lt_one with i h
state_before: α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
⊢ ∃ 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
state_before: case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
⊢ ∃ r, ∀ (i : ℕ), abv (↑f i) < r

tactic: refine' ⟨R i + 1, fun j => _⟩
state_before: case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
⊢ ∃ r, ∀ (i : ℕ), abv (↑f i) < r

tactic: cases' lt_or_le j i with ij ij
state_before: case intro
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
⊢ abv (↑f j) < R i + 1

tactic: refine' Nat.rec (by simp [hR]) _
state_before: α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
⊢ ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i

tactic: rintro i hi j (rfl | hj)
state_before: α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
⊢ ∀ (n : ℕ), (∀ (j : ℕ), j ≤ n → abv (↑f j) ≤ R n) → ∀ (j : ℕ), j ≤ Nat.succ n → abv (↑f j) ≤ R (Nat.succ n)

tactic: exact (hi j hj).trans (le_max_left _ _)
state_before: case step
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i✝ : ℕ
h : ∀ (j : ℕ), j ≥ i✝ → abv (↑f j - ↑f i✝) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
i : ℕ
hi : ∀ (j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
hj : Nat.le j i
⊢ abv (↑f j) ≤ R (Nat.succ i)

tactic: simp [hR]
state_before: α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
⊢ ∀ (j : ℕ), j ≤ Nat.zero → abv (↑f j) ≤ R Nat.zero

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

tactic: exact lt_of_le_of_lt (this i _ (le_of_lt ij)) (lt_add_one _)
state_before: case intro.inl
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
ij : j < i
⊢ abv (↑f j) < R i + 1

tactic: have := lt_of_le_of_lt (abv_add abv _ _) (add_lt_add_of_le_of_lt (this i _ le_rfl) (h _ ij))
state_before: case intro.inr
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
ij : i ≤ j
⊢ abv (↑f j) < R i + 1

tactic: rw [add_sub, add_comm] at this
state_before: case intro.inr
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this✝ : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
ij : i ≤ j
this : abv (↑f i + (↑f j - ↑f i)) < R i + 1
⊢ abv (↑f j) < R i + 1

tactic: simpa using this
state_before: case intro.inr
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : CauSeq β abv
i : ℕ
h : ∀ (j : ℕ), j ≥ i → abv (↑f j - ↑f i) < 1
R : ℕ → α := Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
hR : R = Nat.rec (abv (↑f 0)) fun i c => max c (abv (↑f (Nat.succ i)))
this✝ : ∀ (i j : ℕ), j ≤ i → abv (↑f j) ≤ R i
j : ℕ
ij : i ≤ j
this : abv (↑f j + ↑f i - ↑f i) < R i + 1
⊢ abv (↑f j) < R i + 1