theorem
proved
x_squared_is_O_x_squared
show as:
view math explainer →
open explainer
Read the cached plain-language explainer.
open lean source
IndisputableMonolith.Relativity.Analysis.Limits on GitHub at line 58.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
formal source
55 exact h2
56
57/-- x² is O(x²) (reflexive). -/
58theorem x_squared_is_O_x_squared :
59 IsBigOPower (fun x => x ^ 2) 2 := by
60 unfold IsBigOPower IsBigO
61 refine ⟨1, by norm_num, 1, by norm_num, ?_⟩
62 intro x _
63 have : |(x ^ 2)| ≤ 1 * |(x ^ 2)| := by simpa
64 simpa using this
65
66/-- O(f) + O(g) = O(h). -/
67theorem bigO_add (f g h : ℝ → ℝ) (a : ℝ) :
68 IsBigO f h a → IsBigO g h a → IsBigO (fun x => f x + g x) h a := by
69 intro hf hg
70 rcases hf with ⟨C₁, hC₁pos, M₁, hM₁pos, hf⟩
71 rcases hg with ⟨C₂, hC₂pos, M₂, hM₂pos, hg⟩
72 have hMinPos : 0 < min M₁ M₂ := lt_min hM₁pos hM₂pos
73 refine ⟨C₁ + C₂, by linarith, min M₁ M₂, hMinPos, ?_⟩
74 intro x hx
75 have hx₁ : |x - a| < M₁ := lt_of_lt_of_le hx (min_le_left _ _)
76 have hx₂ : |x - a| < M₂ := lt_of_lt_of_le hx (min_le_right _ _)
77 have hf' := hf x hx₁
78 have hg' := hg x hx₂
79 have htri : |f x + g x| ≤ |f x| + |g x| := abs_add_le _ _
80 have hsum : |f x| + |g x| ≤ (C₁ + C₂) * |h x| := by
81 have hadd := add_le_add hf' hg'
82 linarith [mul_nonneg (le_of_lt hC₁pos) (abs_nonneg (h x)),
83 mul_nonneg (le_of_lt hC₂pos) (abs_nonneg (h x))]
84 exact le_trans htri hsum
85
86/-- O(f) · O(g) = O(f·g). -/
87theorem bigO_mul (f₁ f₂ g₁ g₂ : ℝ → ℝ) (a : ℝ) :
88 IsBigO f₁ g₁ a → IsBigO f₂ g₂ a → IsBigO (fun x => f₁ x * f₂ x) (fun x => g₁ x * g₂ x) a := by