-- Mathlib/Algebra/Order/CauSeq/Basic.lean
theorem rat_mul_continuous_lemma {ε K₁ K₂ : α} (ε0 : 0 < ε) :
    ∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ →
      abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
ha₁ : abv a₁ < 1 ⊔ (K₁ ⊔ K₂)
hb₂ : abv b₂ < 1 ⊔ (K₁ ⊔ K₂)
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
set M := max 1 (max K₁ K₂)

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
this : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
rw [← abv_mul abv, mul_comm, div_mul_cancel₀ _ (ne_of_gt K0), ← abv_mul abv, add_halves] at this

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
this : abv ((a₁ - b₁) * b₂) + abv (a₁ * (a₂ - b₂)) < ε
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
⊢ ∃ δ > 0,
    ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
refine ⟨_, εK, fun {a₁ a₂ b₁ b₂} ha₁ hb₂ h₁ h₂ => ?_⟩

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
ha₁ : abv a₁ < K₁
hb₂ : abv b₂ < K₂
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
hb₂ : abv b₂ < K₂
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
ha₁ : abv a₁ < 1 ⊔ (K₁ ⊔ K₂)
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
replace hb₂ := lt_of_lt_of_le hb₂ (le_trans (le_max_right K₁ _) (le_max_right 1 _))

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
ha₁ : abv a₁ < 1 ⊔ (K₁ ⊔ K₂)
hb₂ : abv b₂ < 1 ⊔ (K₁ ⊔ K₂)
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
have : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M := by
  gcongr

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
this : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
ha₁ : abv a₁ < K₁
hb₂ : abv b₂ < K₂
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
replace ha₁ := lt_of_lt_of_le ha₁ (le_trans (le_max_left _ K₂) (le_max_right 1 _))

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
a₁ a₂ b₁ b₂ : β
hb₂ : abv b₂ < K₂
h₁ : abv (a₁ - b₁) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
h₂ : abv (a₂ - b₂) < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
ha₁ : abv a₁ < 1 ⊔ (K₁ ⊔ K₂)
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
⊢ ∃ δ > 0,
    ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
have K0 : (0 : α) < max 1 (max K₁ K₂) := lt_of_lt_of_le zero_lt_one (le_max_left _ _)

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
⊢ ∃ δ > 0,
    ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
⊢ abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M

Tactic:
gcongr

Result:
no goals

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
⊢ ∃ δ > 0,
    ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
have εK := div_pos (half_pos ε0) K0

Result:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
K0 : 0 < 1 ⊔ (K₁ ⊔ K₂)
εK : 0 < ε / 2 / (1 ⊔ (K₁ ⊔ K₂))
⊢ ∃ δ > 0,
    ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε

Proof state:
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
ε K₁ K₂ : α
ε0 : 0 < ε
a₁ a₂ b₁ b₂ : β
M : α := 1 ⊔ (K₁ ⊔ K₂)
K0 : 0 < M
εK : 0 < ε / 2 / M
h₁ : abv (a₁ - b₁) < ε / 2 / M
h₂ : abv (a₂ - b₂) < ε / 2 / M
ha₁ : abv a₁ < M
hb₂ : abv b₂ < M
this : abv ((a₁ - b₁) * b₂) + abv (a₁ * (a₂ - b₂)) < ε
⊢ abv (a₁ * a₂ - b₁ * b₂) < ε

Tactic:
simpa [sub_eq_add_neg, mul_add, add_mul, add_left_comm] using
  lt_of_le_of_lt (abv_add abv _ _) this

Result:
no goals