Mathlib.Analysis.CertifiedContourIntervalArithmetic
Certified numerical-analysis infrastructure: exact rational intervals, effective certified-real refinement, transcendental enclosures, Lipschitz mesh quadrature, and measurable finite selection.
Basic 18 core · 29 supporting This module provides closed intervals with rational endpoints and exact endpoint algorithms for the elementary arithmetic operations. ★ mul_sound
Exact rational interval arithmetic
This module provides closed intervals with rational endpoints and exact endpoint algorithms for the elementary arithmetic operations. Each operation is proved to enclose the corresponding real-number calculation, and the inclusion order records safe refinement of an enclosure.
A rational closed interval consists of a rational lower endpoint and a rational upper endpoint, with the lower endpoint no greater than the upper endpoint.
Definition (Lean source)
For a rational interval and a real number, the containment relation holds precisely when the real number is no smaller than the interval's lower endpoint and no larger than its upper endpoint, after the rational endpoints are viewed as real numbers.
Definition (Lean source)
For a rational interval, its width is the upper rational endpoint minus the lower rational endpoint.
Definition (Lean source)
For a rational interval, its maximum endpoint magnitude is the larger of the absolute values of its two rational endpoints.
Definition (Lean source)
For two rational intervals, the subinterval relation holds precisely when the second interval's lower endpoint is no greater than the first interval's lower endpoint and the first interval's upper endpoint is no greater than the second interval's upper endpoint.
Definition (Lean source)
For a rational number, the point interval at that number is the rational interval whose lower endpoint is that number, upper endpoint is that number, and endpoints are ordered because they are equal.
Definition (Lean source)
For two rational intervals, their rational interval hull has the smaller lower endpoint, the larger upper endpoint, and these endpoints in weakly increasing order.
Definition (Lean source)
For two rational intervals, their interval sum has lower endpoint equal to the sum of the lower endpoints, upper endpoint equal to the sum of the upper endpoints, and valid endpoint order.
Definition (Lean source)
For a rational interval, its interval negation has lower endpoint equal to the negative of the original upper endpoint, upper endpoint equal to the negative of the original lower endpoint, and valid endpoint order.
Definition (Lean source)
For two rational intervals, their interval difference is the interval sum of the first interval and the interval negation of the second.
Definition (Lean source)
For two rational intervals, their interval product has lower endpoint equal to the least of the four products of one endpoint from each interval, upper endpoint equal to the greatest of those four products, and valid endpoint order.
Definition (Lean source)
For a rational interval, the property of being separated from zero holds precisely when the interval lies strictly below zero or strictly above zero.
Definition (Lean source)
For a rational interval that is separated from zero, its interval reciprocal has lower endpoint equal to the reciprocal of the original upper endpoint, upper endpoint equal to the reciprocal of the original lower endpoint, and valid endpoint order.
Definition (Lean source)
For a numerator rational interval and a denominator rational interval whose denominator interval is separated from zero, their interval quotient is the interval product of the numerator interval and the interval reciprocal of the denominator interval.
Definition (Lean source)
For a rational interval, its natural-power interval sequence assigns the point interval at one to exponent zero and the interval product of the preceding power and the original interval to each positive exponent.
Definition (Lean source)
For two rational intervals, their conditional tightening is their exact intersection when its lower endpoint does not exceed its upper endpoint, and the first interval otherwise.
Definition (Lean source)
For a rational interval, a rational widening amount that is nonnegative, the expanded interval has lower endpoint equal to the original lower endpoint minus the widening amount, upper endpoint equal to the original upper endpoint plus the widening amount, and valid endpoint order.
Definition (Lean source)
For rational intervals I and J, if x is a real number contained in I and y is a real number contained in J, then the interval-multiplication enclosure mul I J contains the real product x * y.
Formal statement
Proof (Lean source)
29 supporting declarations (lemmas, instances)
-
width_nonnegtheorem — Every rational interval has nonnegative width.Proof (Lean source)
theorem width_nonneg (I : RatInterval) : 0 ≤ I.width := by exact sub_nonneg.mpr I.lo_le_hi -
contains_point_ifftheorem — Containment in a point interval is equality with that rational point.hypothesesq :ℚx :ℝconclusion(point q).Contains x ↔ x = (q : ℝ)Proof (Lean source)
@[simp] theorem contains_point_iff (q : ℚ) (x : ℝ) : (point q).Contains x ↔ x = (q : ℝ) := by constructor · rintro ⟨hlo, hhi⟩ exact le_antisymm hhi hlo · rintro rfl exact ⟨le_rfl, le_rfl⟩ -
subinterval_refltheorem — Subinterval is reflexive.Proof (Lean source)
theorem subinterval_refl (I : RatInterval) : I.Subinterval I := by exact ⟨le_rfl, le_rfl⟩ -
subinterval_transtheorem — Subinterval is transitive.Proof (Lean source)
theorem subinterval_trans {I J K : RatInterval} : I.Subinterval J → J.Subinterval K → I.Subinterval K := by rintro ⟨hlo₁, hhi₁⟩ ⟨hlo₂, hhi₂⟩ exact ⟨hlo₂.trans hlo₁, hhi₁.trans hhi₂⟩ -
monotheorem — A real point contained in a subinterval is contained in the enclosing interval.Proof (Lean source)
theorem Contains.mono {I J : RatInterval} {x : ℝ} (hIJ : I.Subinterval J) (hx : I.Contains x) : J.Contains x := by have hlo : (J.lo : ℝ) ≤ I.lo := by exact_mod_cast hIJ.1 have hhi : (I.hi : ℝ) ≤ J.hi := by exact_mod_cast hIJ.2 exact ⟨hlo.trans hx.1, hx.2.trans hhi⟩ -
width_monotheorem — Inclusion of rational intervals cannot increase their width.Proof (Lean source)
theorem width_mono {I J : RatInterval} (hIJ : I.Subinterval J) : I.width ≤ J.width := by unfold width linarith [hIJ.1, hIJ.2] -
point_soundtheorem — The point interval soundly encloses its rational value viewed as a real.hypothesesq :ℚconclusion(point q).Contains (q : ℝ)Proof (Lean source)
theorem point_sound (q : ℚ) : (point q).Contains (q : ℝ) := by simp -
add_soundtheorem — Rational interval addition encloses the sum of any enclosed real operands.hypothesesconclusion(add I J).Contains (x + y)Proof (Lean source)
theorem add_sound {I J : RatInterval} {x y : ℝ} (hx : I.Contains x) (hy : J.Contains y) : (add I J).Contains (x + y) := by constructor <;> simp only [add, Contains, Rat.cast_add] · exact add_le_add hx.1 hy.1 · exact add_le_add hx.2 hy.2 -
neg_soundtheorem — Rational interval negation encloses the negation of every enclosed real operand.Proof (Lean source)
theorem neg_sound {I : RatInterval} {x : ℝ} (hx : I.Contains x) : I.neg.Contains (-x) := by constructor <;> simp only [neg, Contains, Rat.cast_neg] · exact neg_le_neg hx.2 · exact neg_le_neg hx.1 -
sub_soundtheorem — Rational interval subtraction encloses the difference of any enclosed real operands.hypothesesconclusion(sub I J).Contains (x - y)Proof (Lean source)
theorem sub_sound {I J : RatInterval} {x y : ℝ} (hx : I.Contains x) (hy : J.Contains y) : (sub I J).Contains (x - y) := by simpa [sub_eq_add_neg, sub] using add_sound hx (neg_sound hy) -
ne_zero_of_containstheorem — A real number contained in an interval separated from zero is nonzero.Proof (Lean source)
theorem ne_zero_of_contains {I : RatInterval} {x : ℝ} (hI : I.AwayFromZero) (hx : I.Contains x) : x ≠ 0 := by rcases hI with hI | hI · have hI' : (I.hi : ℝ) < 0 := by exact_mod_cast hI exact ne_of_lt (hx.2.trans_lt hI') · have hI' : (0 : ℝ) < I.lo := by exact_mod_cast hI exact ne_of_gt (hI'.trans_le hx.1) -
inv_soundtheorem — Rational interval reciprocal encloses the reciprocal of every enclosed real operand.hypothesesconclusion(inv I hI).Contains x⁻¹Proof (Lean source)
theorem inv_sound {I : RatInterval} {x : ℝ} (hI : I.AwayFromZero) (hx : I.Contains x) : (inv I hI).Contains x⁻¹ := by rcases hI with hneg | hpos · have hhineg : (I.hi : ℝ) < 0 := by exact_mod_cast hneg have hloneg : (I.lo : ℝ) < 0 := by exact_mod_cast I.lo_le_hi.trans_lt hneg have hxneg : x < 0 := hx.2.trans_lt hhineg simp only [inv, Contains, Rat.cast_inv] exact ⟨(inv_le_inv_of_neg hhineg hxneg).2 hx.2, (inv_le_inv_of_neg hxneg hloneg).2 hx.1⟩ · have hlopos : (0 : ℝ) < I.lo := by exact_mod_cast hpos have hhipos : (0 : ℝ) < I.hi := by exact_mod_cast hpos.trans_le I.lo_le_hi have hxpos : 0 < x := hlopos.trans_le hx.1 simp only [inv, Contains, Rat.cast_inv] exact ⟨(inv_le_inv₀ hhipos hxpos).2 hx.2, (inv_le_inv₀ hxpos hlopos).2 hx.1⟩ -
div_soundtheorem — Rational interval division encloses every quotient whose denominator interval avoids zero.hypothesesconclusion(div I J hJ).Contains (x / y)Proof (Lean source)
theorem div_sound {I J : RatInterval} {x y : ℝ} (hJ : J.AwayFromZero) (hx : I.Contains x) (hy : J.Contains y) : (div I J hJ).Contains (x / y) := by simpa [div, div_eq_mul_inv] using mul_sound hx (inv_sound hJ hy) -
npow_soundtheorem — Repeated interval multiplication encloses every natural power of an enclosed real number.Proof (Lean source)
theorem npow_sound {I : RatInterval} {x : ℝ} (hx : I.Contains x) (n : ℕ) : (I.npow n).Contains (x ^ n) := by induction n with | zero => simpa [npow] using point_sound 1 | succ n ih => simpa [npow, pow_succ] using mul_sound ih hx -
tighten_soundtheorem — Tightening two intervals that share an enclosed real point returns their intersection and continues to enclose that point.hypothesesconclusion(tighten I J).Contains xProof (Lean source)
theorem tighten_sound {I J : RatInterval} {x : ℝ} (hI : I.Contains x) (hJ : J.Contains x) : (tighten I J).Contains x := by have hlohi : max I.lo J.lo ≤ min I.hi J.hi := by apply max_le · apply le_min I.lo_le_hi exact_mod_cast hI.1.trans hJ.2 · apply le_min · exact_mod_cast hJ.1.trans hI.2 · exact J.lo_le_hi simp only [tighten, hlohi, dif_pos, Contains, Rat.cast_max, Rat.cast_min] exact ⟨max_le hI.1 hJ.1, le_min hI.2 hJ.2⟩ -
tighten_subinterval_lefttheorem — Tightening by another sound interval produces a subinterval of the first interval.hypothesesconclusion(tighten I J).Subinterval IProof (Lean source)
theorem tighten_subinterval_left {I J : RatInterval} {x : ℝ} (hI : I.Contains x) (hJ : J.Contains x) : (tighten I J).Subinterval I := by have hlohi : max I.lo J.lo ≤ min I.hi J.hi := by apply max_le · apply le_min I.lo_le_hi exact_mod_cast hI.1.trans hJ.2 · apply le_min · exact_mod_cast hJ.1.trans hI.2 · exact J.lo_le_hi simp only [tighten, hlohi, dif_pos, Subinterval] exact ⟨le_max_left _ _, min_le_left _ _⟩ -
add_monotheorem — Addition is inclusion-isotone in both interval arguments.hypothesesconclusion(add I J).Subinterval (add I' J')Proof (Lean source)
theorem add_mono {I I' J J' : RatInterval} (hI : I.Subinterval I') (hJ : J.Subinterval J') : (add I J).Subinterval (add I' J') := by exact ⟨add_le_add hI.1 hJ.1, add_le_add hI.2 hJ.2⟩ -
neg_monotheorem — Negation preserves interval inclusion.Proof (Lean source)
theorem neg_mono {I J : RatInterval} (hIJ : I.Subinterval J) : I.neg.Subinterval J.neg := by exact ⟨neg_le_neg hIJ.2, neg_le_neg hIJ.1⟩ -
sub_monotheorem — Subtraction is inclusion-isotone in both interval arguments.hypothesesconclusion(sub I J).Subinterval (sub I' J')Proof (Lean source)
theorem sub_mono {I I' J J' : RatInterval} (hI : I.Subinterval I') (hJ : J.Subinterval J') : (sub I J).Subinterval (sub I' J') := by exact add_mono hI (neg_mono hJ) -
mul_monotheorem — Multiplication is inclusion-isotone in both interval arguments.hypothesesProof (Lean source)
theorem mul_mono {I I' J J' : RatInterval} (hI : I.Subinterval I') (hJ : J.Subinterval J') : (mul I J).Subinterval (mul I' J') := by have Ilo : I.Contains (I.lo : ℝ) := ⟨le_rfl, by exact_mod_cast I.lo_le_hi⟩ have Ihi : I.Contains (I.hi : ℝ) := ⟨by exact_mod_cast I.lo_le_hi, le_rfl⟩ have Jlo : J.Contains (J.lo : ℝ) := ⟨le_rfl, by exact_mod_cast J.lo_le_hi⟩ have Jhi : J.Contains (J.hi : ℝ) := ⟨by exact_mod_cast J.lo_le_hi, le_rfl⟩ have p₁ : (mul I' J').Contains ((I.lo : ℝ) * (J.lo : ℝ)) := mul_sound (Contains.mono hI Ilo) (Contains.mono hJ Jlo) have p₂ : (mul I' J').Contains ((I.lo : ℝ) * (J.hi : ℝ)) := mul_sound (Contains.mono hI Ilo) (Contains.mono hJ Jhi) have p₃ : (mul I' J').Contains ((I.hi : ℝ) * (J.lo : ℝ)) := mul_sound (Contains.mono hI Ihi) (Contains.mono hJ Jlo) have p₄ : (mul I' J').Contains ((I.hi : ℝ) * (J.hi : ℝ)) := mul_sound (Contains.mono hI Ihi) (Contains.mono hJ Jhi) simp only [Subinterval, mul] constructor · apply le_min · apply le_min · exact_mod_cast p₁.1 · exact_mod_cast p₂.1 · apply le_min · exact_mod_cast p₃.1 · exact_mod_cast p₄.1 · apply max_le · apply max_le · exact_mod_cast p₁.2 · exact_mod_cast p₂.2 · apply max_le · exact_mod_cast p₃.2 · exact_mod_cast p₄.2 -
npow_monotheorem — Natural interval powers preserve interval inclusion.hypothesesconclusion(I.npow n).Subinterval (J.npow n)Proof (Lean source)
theorem npow_mono {I J : RatInterval} (hIJ : I.Subinterval J) (n : ℕ) : (I.npow n).Subinterval (J.npow n) := by induction n with | zero => exact subinterval_refl _ | succ n ih => exact mul_mono ih hIJ -
inv_monotheorem — Reciprocal preserves inclusion when both intervals are certified away from zero.hypothesesconclusion(inv I hI).Subinterval (inv J hJ)Proof (Lean source)
theorem inv_mono {I J : RatInterval} (hIJ : I.Subinterval J) (hI : I.AwayFromZero) (hJ : J.AwayFromZero) : (inv I hI).Subinterval (inv J hJ) := by simp only [Subinterval, inv] constructor · rcases hJ with hJneg | hJpos · exact (inv_le_inv_of_neg hJneg (hIJ.2.trans_lt hJneg)).2 hIJ.2 · exact (inv_le_inv₀ (hJpos.trans_le J.lo_le_hi) ((hJpos.trans_le hIJ.1).trans_le I.lo_le_hi)).2 hIJ.2 · rcases hJ with hJneg | hJpos · exact (inv_le_inv_of_neg (I.lo_le_hi.trans_lt (hIJ.2.trans_lt hJneg)) (J.lo_le_hi.trans_lt hJneg)).2 hIJ.1 · exact (inv_le_inv₀ (hJpos.trans_le hIJ.1) hJpos).2 hIJ.1 -
div_monotheorem — Division is inclusion-isotone when both denominator intervals avoid zero.hypothesesI I' J J' :hI :I.Subinterval I'hJ :J.Subinterval J'hJ0 :J.AwayFromZerohJ0' :J'.AwayFromZeroconclusion(div I J hJ0).Subinterval (div I' J' hJ0')Proof (Lean source)
theorem div_mono {I I' J J' : RatInterval} (hI : I.Subinterval I') (hJ : J.Subinterval J') (hJ0 : J.AwayFromZero) (hJ0' : J'.AwayFromZero) : (div I J hJ0).Subinterval (div I' J' hJ0') := by exact mul_mono hI (inv_mono hJ hJ0 hJ0') -
width_addtheorem — Addition makes widths add exactly.Proof (Lean source)
theorem width_add (I J : RatInterval) : (add I J).width = I.width + J.width := by simp [width, add] ring -
width_negtheorem — Negation preserves interval width exactly.Proof (Lean source)
-
width_subtheorem — Subtraction makes widths add exactly.Proof (Lean source)
theorem width_sub (I J : RatInterval) : (sub I J).width = I.width + J.width := by simp [sub, width_add, width_neg] -
width_expandtheorem — Widening an interval by a nonnegative amount on each side increases its width by twice that amount.Proof (Lean source)
theorem width_expand (I : RatInterval) (e : ℚ) (he : 0 ≤ e) : (expand I e he).width = I.width + 2 * e := by simp [expand, width] ring
CertifiedReal 8 core · 5 supporting This module represents a real quantity by nested rational enclosures together with a precision rule (an arbitrary function; computability is not encoded). ★ refine_width
Certified real names and effective refinement
This module represents a real quantity by nested rational enclosures together with a precision rule (an arbitrary function; computability is not encoded). It turns any positive rational error target into a concrete interval that still contains the quantity and is no wider than that target.
A positive rational number is a rational number that is strictly greater than zero.
Definition (Lean source)
A certified real name represents a real number by a sequence of rational interval enclosures indexed by precision that is nested — each successive enclosure a subinterval of the one before — and always contains the represented value, together with a rule (an arbitrary function, not required to be computable) selecting, for any requested positive rational error, a precision level whose enclosure is no wider than that error.
Definition (Lean source)
For a certified real number and a requested positive rational tolerance, its refinement is the rational interval returned at the precision selected by that certificate's modulus for the requested tolerance.
Definition (Lean source)
For a certified real number x and a requested positive rational tolerance ε, refining x to the precision selected by ε's modulus yields an enclosure whose width is at most ε.
Formal statement
Proof (Lean source)
For a rational number, its certified real name denotes that rational number and uses its degenerate one-point rational interval at every precision.
Definition (Lean source)
For a certified real number, its certified negation denotes the negative of the real number named by the certificate, negates every rational interval enclosure, and retains the same precision-selection rule.
Definition (Lean source)
For two certified real numbers, their certified sum denotes the sum of their named real numbers, adds their rational interval enclosures at each common precision, and selects a precision sufficient to make each input enclosure no wider than half the requested tolerance.
Definition (Lean source)
For two certified real numbers, their certified difference is their certified sum after negating the second certificate; it therefore denotes the first named real number minus the second.
Definition (Lean source)
5 supporting declarations (lemmas, instances)
-
approx_monotheorem — Nestedness extends from successive precisions to every pair of ordered precisions.Proof (Lean source)
theorem approx_mono (x : CertifiedReal) {m n : ℕ} (hmn : m ≤ n) : (x.approx n).Subinterval (x.approx m) := by induction n, hmn using Nat.le_induction with | base => exact RatInterval.subinterval_refl _ | succ n hmn ih => exact RatInterval.subinterval_trans (x.nested n) ih -
refine_containstheorem — Refinement always encloses the real value named by the certificate.Proof (Lean source)
theorem refine_contains (x : CertifiedReal) (ε : PosRat) : (x.refine ε).Contains x.value := by exact x.contains (x.modulus ε) -
exists_refinementtheorem — Every positive rational tolerance admits an explicitly returned enclosing interval of at most that width.hypothesesconclusion∃ n : ℕ,conclusion 1(x.approx n).Contains x.valueconclusion 2(x.approx n).width ≤ εProof (Lean source)
theorem exists_refinement (x : CertifiedReal) (ε : ℚ) (hε : 0 < ε) : ∃ n : ℕ, (x.approx n).Contains x.value ∧ (x.approx n).width ≤ ε := by exact ⟨x.modulus ⟨ε, hε⟩, x.contains _, x.width_modulus ⟨ε, hε⟩⟩ -
sub_valuetheorem — Certified subtraction denotes the difference of the two named real values.Proof (Lean source)
-
value_eq_of_common_approximationstheorem — Two certified names whose every approximation is shared denote the same real value.Proof (Lean source)
theorem value_eq_of_common_approximations (x y : CertifiedReal) (hxy : ∀ n, x.approx n = y.approx n) : x.value = y.value := by apply le_antisymm · by_contra h have hlt : y.value < x.value := lt_of_not_ge h obtain ⟨ε, hεpos, hεlt⟩ : ∃ ε : ℚ, 0 < ε ∧ (ε : ℝ) < x.value - y.value := by exact exists_pos_rat_lt (sub_pos.mpr hlt) let n := x.modulus ⟨ε, hεpos⟩ have hx := x.contains n have hy : (x.approx n).Contains y.value := by simpa [hxy n] using y.contains n have hw : ((x.approx n).width : ℝ) ≤ ε := by exact_mod_cast x.width_modulus ⟨ε, hεpos⟩ have hspan : x.value - y.value ≤ ((x.approx n).width : ℝ) := by simp only [RatInterval.width, Rat.cast_sub] linarith [hx.2, hy.1] exact (not_lt_of_ge (hspan.trans hw)) hεlt · by_contra h have hlt : x.value < y.value := lt_of_not_ge h obtain ⟨ε, hεpos, hεlt⟩ : ∃ ε : ℚ, 0 < ε ∧ (ε : ℝ) < y.value - x.value := by exact exists_pos_rat_lt (sub_pos.mpr hlt) let n := x.modulus ⟨ε, hεpos⟩ have hx := x.contains n have hy : (x.approx n).Contains y.value := by simpa [hxy n] using y.contains n have hw : ((x.approx n).width : ℝ) ≤ ε := by exact_mod_cast x.width_modulus ⟨ε, hεpos⟩ have hspan : y.value - x.value ≤ ((x.approx n).width : ℝ) := by simp only [RatInterval.width, Rat.cast_sub] linarith [hy.2, hx.1] exact (not_lt_of_ge (hspan.trans hw)) hεlt
Mesh 19 core · 10 supporting This module provides rational rectangles for complex values and finite uniform mesh enclosures for the infimum and supremum of a real function. ★ infEnclosure_sound
Certified finite mesh extrema
This module provides rational rectangles for complex values and finite uniform mesh enclosures for the infimum and supremum of a real function. A supplied Lipschitz bound turns rational node enclosures into global enclosures with an explicit mesh-error allowance.
A rational rectangle in the complex plane consists of a rational interval enclosing the real coordinate and a rational interval enclosing the imaginary coordinate.
Definition (Lean source)
Given a rational rectangle and a complex number, rectangle membership means that both the real and imaginary coordinates of the number lie in their respective rational intervals.
Definition (Lean source)
Given two rational rectangles in the complex plane, the refinement relation holds exactly when each coordinate interval of the first is contained in the corresponding coordinate interval of the second.
Definition (Lean source)
For two rational rectangles in the complex plane, their sum rectangle is obtained by adding their real-coordinate intervals and their imaginary-coordinate intervals separately.
Definition (Lean source)
For a rational scalar and a rational rectangle in the complex plane, the scalar-multiple rectangle is obtained by multiplying each coordinate interval by that scalar.
Definition (Lean source)
For a rational rectangle in the complex plane, a rational error allowance, and the condition that this allowance is nonnegative, the expanded rectangle widens each coordinate interval by that allowance.
Definition (Lean source)
The zero rectangle is the rational rectangle whose real and imaginary coordinate intervals are both the singleton interval containing zero.
Definition (Lean source)
For a mesh size and a node index, the mesh point is the real number . It is a mesh point for positive mesh size; for every point is zero by the division convention.
Definition (Lean source)
For a complex center, a real radius, and a real parameter, the circle point is .
For a real radius and a real parameter, the circle tangent is .
For a complex-valued function, a complex center, a real radius, and a real parameter, the parameterized contour integrand is the value of the function at the corresponding circle point multiplied by the circle tangent there.
Definition (Lean source)
For a complex-valued function, a complex center, and a real radius, the circle contour integral is the integral from to of the parameterized contour integrand. No integrability is required: for an integrand that is not interval integrable the integral is zero by convention, so this is the contour integral only when the parameterized integrand is integrable.
Definition (Lean source)
Given a sequence of rational intervals, the minimum lower endpoint up to a terminal node index is computed recursively: at index zero it is the lower endpoint of the initial interval, and at each successor index it is the smaller of the preceding result and the new lower endpoint.
Definition (Lean source)
Given a sequence of rational intervals, the minimum upper endpoint up to a terminal node index is computed recursively: at index zero it is the upper endpoint of the initial interval, and at each successor index it is the smaller of the preceding result and the new upper endpoint.
Definition (Lean source)
Given a sequence of rational intervals, the maximum lower endpoint up to a terminal node index is computed recursively: at index zero it is the lower endpoint of the initial interval, and at each successor index it is the larger of the preceding result and the new lower endpoint.
Definition (Lean source)
Given a sequence of rational intervals, the maximum upper endpoint up to a terminal node index is computed recursively: at index zero it is the upper endpoint of the initial interval, and at each successor index it is the larger of the preceding result and the new upper endpoint.
Definition (Lean source)
Given a sequence of rational node intervals, a rational Lipschitz constant, the condition that the constant is nonnegative, a mesh size, and the condition that the mesh size is positive, the infimum enclosure has lower endpoint equal to the minimum node lower endpoint minus and upper endpoint equal to the minimum node upper endpoint.
Definition (Lean source)
Given a sequence of rational node intervals, a rational Lipschitz constant, the condition that the constant is nonnegative, a mesh size, and the condition that the mesh size is positive, the supremum enclosure has lower endpoint equal to the maximum node lower endpoint and upper endpoint equal to the maximum node upper endpoint plus .
Definition (Lean source)
Certified infimum enclosure on the unit mesh. Fix a nonnegative Lipschitz constant and a positive number of mesh nodes, and suppose the real function is Lipschitz on [0, 1] with that constant and each rational node interval contains the function's value at the corresponding mesh point. Then the infimum enclosure built from those node intervals contains the true infimum of the function over [0, 1].
Formal statement
Proof (Lean source)
10 supporting declarations (lemmas, instances)
-
exttheorem∀ {x y : ComplexRatInterval}, x.re = y.re → x.im = y.im → x = yProof (Lean source)
@[ext] -
ext_ifftheorem∀ {x y : ComplexRatInterval}, x = y ↔ x.re = y.re ∧ x.im = y.imProof (Lean source)
@[ext] -
add_soundtheorem — Complex rectangle addition encloses sums of enclosed complex numbers.hypothesesconclusion(I.add J).Contains (z + w)Proof (Lean source)
theorem add_sound {I J : ComplexRatInterval} {z w : ℂ} (hz : I.Contains z) (hw : J.Contains w) : (I.add J).Contains (z + w) := by exact ⟨RatInterval.add_sound hz.1 hw.1, RatInterval.add_sound hz.2 hw.2⟩ -
smulRat_soundtheorem — Rational scalar multiplication encloses the corresponding complex scalar multiple.hypothesesconclusion(smulRat q I).Contains ((q : ℂ) * z)Proof (Lean source)
theorem smulRat_sound {I : ComplexRatInterval} {z : ℂ} (q : ℚ) (hz : I.Contains z) : (smulRat q I).Contains ((q : ℂ) * z) := by constructor · simpa [smulRat] using RatInterval.mul_sound (RatInterval.point_sound q) hz.1 · simpa [smulRat] using RatInterval.mul_sound (RatInterval.point_sound q) hz.2 -
expand_containstheorem — Coordinatewise widening preserves containment.hypothesesconclusion(I.expand e he).Contains zProof (Lean source)
theorem expand_contains {I : ComplexRatInterval} {z : ℂ} {e : ℚ} (he : 0 ≤ e) (hz : I.Contains z) : (I.expand e he).Contains z := by have he' : (0 : ℝ) ≤ e := by exact_mod_cast he constructor <;> constructor <;> simp only [expand, RatInterval.expand, RatInterval.Contains, Rat.cast_sub, Rat.cast_add] <;> linarith [hz.1.1, hz.1.2, hz.2.1, hz.2.2] -
meshPoint_memtheorem — A node of a nonempty uniform mesh lies in the unit parameter interval.Proof (Lean source)
theorem meshPoint_mem {n k : ℕ} (hn : 0 < n) (hk : k ≤ n) : meshPoint n k ∈ Icc (0 : ℝ) 1 := by constructor · exact div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) · rw [meshPoint, div_le_one (by exact_mod_cast hn)] exact_mod_cast hk -
continuousOn_of_lipschitz_boundtheorem — A function satisfying a finite Lipschitz bound on the unit interval is continuous there.hypothesesE :C :ℝhC :0 ≤ Ch :∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, ‖g s - g t‖ ≤ C * |s - t|conclusionContinuousOn g (Icc (0 : ℝ) 1)Proof (Lean source)
theorem continuousOn_of_lipschitz_bound {E : Type*} [NormedAddCommGroup E] {g : ℝ → E} {C : ℝ} (hC : 0 ≤ C) (h : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, ‖g s - g t‖ ≤ C * |s - t|) : ContinuousOn g (Icc (0 : ℝ) 1) := by intro x hx rw [Metric.continuousWithinAt_iff] intro ε hε refine ⟨ε / (C + 1), div_pos hε (by linarith), ?_⟩ intro y hy hyx change ‖y - x‖ < ε / (C + 1) at hyx rw [dist_eq_norm] rw [Real.norm_eq_abs] at hyx by_cases hC0 : C = 0 · have hzle : ‖g y - g x‖ ≤ 0 := by simpa [hC0] using h y hy x hx exact (le_antisymm hzle (norm_nonneg _)).trans_lt hε calc ‖g y - g x‖ ≤ C * |y - x| := h y hy x hx _ < C * (ε / (C + 1)) := by exact mul_lt_mul_of_pos_left hyx (lt_of_le_of_ne hC (Ne.symm hC0)) _ < ε := by rw [mul_div_assoc'] exact (div_lt_iff₀ (by linarith : 0 < C + 1)).2 (by nlinarith) -
supEnclosure_soundtheorem — Rational node enclosures and a Lipschitz bound enclose the supremum of a real function on the unit mesh interval.hypothesesf :ℝ → ℝnodes :ℕ → RatIntervalL :ℚhL :0 ≤ Ln :ℕhn :0 < nhLip :∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |f s - f t| ≤ (L : ℝ) * |s - t|hnodes :∀ k ≤ n, (nodes k).Contains (f (meshPoint n k))conclusion(supEnclosure nodes L hL n hn).Contains (sSup (f '' Icc (0 : ℝ) 1))Proof (Lean source)
theorem supEnclosure_sound {f : ℝ → ℝ} {nodes : ℕ → RatInterval} {L : ℚ} (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hLip : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |f s - f t| ≤ (L : ℝ) * |s - t|) (hnodes : ∀ k ≤ n, (nodes k).Contains (f (meshPoint n k))) : (supEnclosure nodes L hL n hn).Contains (sSup (f '' Icc (0 : ℝ) 1)) := by have hL' : (0 : ℝ) ≤ L := by exact_mod_cast hL have hcont : ContinuousOn f (Icc (0 : ℝ) 1) := continuousOn_of_lipschitz_bound hL' (by simpa [Real.norm_eq_abs] using hLip) have hbdd : BddAbove (f '' Icc (0 : ℝ) 1) := isCompact_Icc.bddAbove_image hcont have hne : (f '' Icc (0 : ℝ) 1).Nonempty := ⟨f 0, ⟨0, ⟨le_rfl, zero_le_one⟩, rfl⟩⟩ constructor · simp only [supEnclosure, RatInterval.Contains] obtain ⟨k, hk, heq⟩ := exists_maxLoUpTo nodes n have hs : f (meshPoint n k) ≤ sSup (f '' Icc (0 : ℝ) 1) := le_csSup hbdd ⟨meshPoint n k, meshPoint_mem hn hk, rfl⟩ have hlo := (hnodes k hk).1 rw [heq] exact hlo.trans hs · simp only [supEnclosure, RatInterval.Contains, Rat.cast_add, Rat.cast_div, Rat.cast_natCast] apply csSup_le hne rintro y ⟨x, hx, rfl⟩ obtain ⟨k, hk, hdist⟩ := exists_near_meshPoint hn hx have hm := hnodes k hk have hmesh := meshPoint_mem hn hk have hlip := hLip x hx (meshPoint n k) hmesh have hHi : ((nodes k).hi : ℝ) ≤ maxHiUpTo nodes n := by exact_mod_cast hi_le_maxHiUpTo nodes hk have hdist' : |x - meshPoint n k| ≤ (n : ℝ)⁻¹ := by simpa [one_div] using hdist have habs : |f x - f (meshPoint n k)| ≤ (L : ℝ) / n := by simpa [div_eq_mul_inv] using hlip.trans (mul_le_mul_of_nonneg_left hdist' hL') linarith [hm.2, le_abs_self (f x - f (meshPoint n k))] -
width_infEnclosuretheorem — The infimum enclosure width is at most one mesh error plus the uniform node-enclosure width.hypothesesnodes :ℕ → RatIntervalw L :ℚhw :0 ≤ whL :0 ≤ Ln :ℕhn :0 < nhnodes :∀ k ≤ n, (nodes k).width ≤ wconclusion(infEnclosure nodes L hL n hn).width ≤ w + L / nProof (Lean source)
theorem width_infEnclosure {nodes : ℕ → RatInterval} {w L : ℚ} (hw : 0 ≤ w) (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hnodes : ∀ k ≤ n, (nodes k).width ≤ w) : (infEnclosure nodes L hL n hn).width ≤ w + L / n := by obtain ⟨k, hk, heq⟩ := exists_minLoUpTo nodes n have hhi := minHiUpTo_le nodes hk have hwk := hnodes k hk simp only [infEnclosure, RatInterval.width] rw [heq] unfold RatInterval.width at hwk linarith -
width_supEnclosuretheorem — The supremum enclosure width is at most one mesh error plus the uniform node-enclosure width.hypothesesnodes :ℕ → RatIntervalw L :ℚhw :0 ≤ whL :0 ≤ Ln :ℕhn :0 < nhnodes :∀ k ≤ n, (nodes k).width ≤ wconclusion(supEnclosure nodes L hL n hn).width ≤ w + L / nProof (Lean source)
theorem width_supEnclosure {nodes : ℕ → RatInterval} {w L : ℚ} (hw : 0 ≤ w) (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hnodes : ∀ k ≤ n, (nodes k).width ≤ w) : (supEnclosure nodes L hL n hn).width ≤ w + L / n := by obtain ⟨k, hk, heq⟩ := exists_maxHiUpTo nodes n have hlo := lo_le_maxLoUpTo nodes hk have hwk := hnodes k hk simp only [supEnclosure, RatInterval.width] rw [heq] unfold RatInterval.width at hwk linarith
Exponential 10 core · 6 supporting This module computes nested rational intervals for the exponential of a rational input. ★ expScalar_width
Certified rational exponential enclosures
This module computes nested rational intervals for the exponential of a rational input. Range reduction, Taylor bounds, and an explicit precision rule yield a certified real name whose returned interval meets every positive rational error target.
For a rational exponential argument, the exponential scaling factor is the larger of one and the absolute value of the argument's numerator.
Definition (Lean source)
For a rational exponential argument, the reduced exponential argument is the argument divided by its exponential scaling factor.
Definition (Lean source)
For a rational number and a nonnegative polynomial degree, the exponential Taylor partial sum is the sum of the terms for every integer from zero through .
Definition (Lean source)
For a rational number and a nonnegative polynomial degree, the exponential remainder radius is .
Definition (Lean source)
For a rational number and a nonnegative polynomial degree, the reduced exponential enclosure has lower endpoint equal to the Taylor partial sum minus the remainder radius, upper endpoint equal to the Taylor partial sum plus the remainder radius, and valid endpoint order.
Definition (Lean source)
For a rational exponential argument and a nonnegative polynomial degree, the raw exponential enclosure is the natural-power interval obtained by raising the reduced exponential enclosure to the exponential scaling factor.
Definition (Lean source)
For a rational exponential argument, the scalar exponential enclosure sequence assigns the raw exponential enclosure at degree zero to index zero and the conditional tightening of the preceding enclosure with the next raw enclosure to each positive index.
Definition (Lean source)
For a rational exponential argument and a strictly positive rational target width, the exponential precision index is the product of one plus the target-width denominator and two copies of one plus the exponential scaling factor.
For a rational input q and a requested positive rational tolerance ε, evaluating the certified scalar exponential at the precision level selected for that tolerance yields an enclosure whose width is no larger than ε.
Formal statement
Proof (Lean source)
For a rational number, the certified-real representation of its exponential has value equal to the real exponential of that rational number, approximating intervals given by the scalar exponential enclosure sequence, nested approximations, containment of the exact value, the exponential precision index as its modulus, and the corresponding target-width guarantee.
Definition (Lean source)
6 supporting declarations (lemmas, instances)
-
abs_expReduced_le_onetheorem — Range reduction puts the exponential Taylor argument in the closed unit interval.Proof (Lean source)
theorem abs_expReduced_le_one (q : ℚ) : |expReduced q| ≤ 1 := by have hsN : 0 < expScale q := lt_of_lt_of_le Nat.zero_lt_one (le_max_left _ _) have hs : (0 : ℚ) < expScale q := by exact_mod_cast hsN have hnum : |q| ≤ (q.num.natAbs : ℚ) := by have hd : (0 : ℚ) < q.den := by exact_mod_cast q.den_pos calc |q| = |(q.num : ℚ) / (q.den : ℚ)| := by rw [Rat.num_div_den] _ = (q.num.natAbs : ℚ) / q.den := by rw [abs_div, abs_of_pos hd] norm_num _ ≤ (q.num.natAbs : ℚ) := by apply (div_le_iff₀ hd).2 have hd1 : (1 : ℚ) ≤ q.den := by exact_mod_cast q.den_pos nlinarith rw [expReduced, abs_div, abs_of_pos hs] apply (div_le_iff₀ hs).2 have hscale : (q.num.natAbs : ℚ) ≤ expScale q := by exact_mod_cast (le_max_right 1 q.num.natAbs) simpa only [one_mul] using hnum.trans hscale -
expRaw_soundtheorem — The raw rational exponential interval encloses the real exponential of the rational input.Proof (Lean source)
theorem expRaw_sound (q : ℚ) (n : ℕ) : (expRaw q n).Contains (exp (q : ℝ)) := by let z := expReduced q have hzR : |(z : ℝ)| ≤ 1 := by exact_mod_cast abs_expReduced_le_one q have hb := Real.exp_bound hzR (n := n + 1) (Nat.succ_pos n) have hp : ((expPartial z n : ℚ) : ℝ) = ∑ k ∈ range (n + 1), (z : ℝ) ^ k / (k.factorial : ℝ) := by simp [expPartial] have hr : ((expRemainder z n : ℚ) : ℝ) = |(z : ℝ)| ^ (n + 1) * ((n + 2 : ℕ) : ℝ) / (((n + 1).factorial : ℝ) * (n + 1 : ℕ)) := by simp [expRemainder] rw [← hp] at hb have hb' : |exp (z : ℝ) - (expPartial z n : ℝ)| ≤ (expRemainder z n : ℝ) := by rw [hr] convert hb using 1 <;> norm_num [Nat.cast_succ] <;> ring have hred : (expReducedRaw z n).Contains (exp (z : ℝ)) := by rw [abs_le] at hb' simp only [expReducedRaw, RatInterval.Contains, Rat.cast_sub, Rat.cast_add] constructor <;> linarith [hb'.1, hb'.2] have hpow := RatInterval.npow_sound hred (expScale q) have hs : (expScale q : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (lt_of_lt_of_le Nat.zero_lt_one (le_max_left 1 q.num.natAbs))) have hq : (q : ℝ) = (expScale q : ℝ) * (z : ℝ) := by dsimp [z, expReduced] push_cast field_simp [hs] simpa [expRaw, ← Real.exp_nat_mul, hq] using hpow -
expScalar_soundtheorem — Every tightened scalar exponential interval encloses the real exponential.Proof (Lean source)
theorem expScalar_sound (q : ℚ) (n : ℕ) : (expScalar q n).Contains (exp (q : ℝ)) := by induction n with | zero => exact expRaw_sound q 0 | succ n ih => exact RatInterval.tighten_sound ih (expRaw_sound q (n + 1)) -
expScalar_nestedtheorem — Scalar exponential enclosures are nested as precision increases.Proof (Lean source)
theorem expScalar_nested (q : ℚ) (n : ℕ) : (expScalar q (n + 1)).Subinterval (expScalar q n) := by exact RatInterval.tighten_subinterval_left (expScalar_sound q n) (expRaw_sound q (n + 1)) -
tighten_subinterval_righttheorem — Tightening two enclosures of the same real value is contained in either input enclosure.hypothesesconclusion(RatInterval.tighten I J).Subinterval JProof (Lean source)
theorem tighten_subinterval_right {I J : RatInterval} {x : ℝ} (hI : I.Contains x) (hJ : J.Contains x) : (RatInterval.tighten I J).Subinterval J := by have hlohi : max I.lo J.lo ≤ min I.hi J.hi := by apply max_le · apply le_min I.lo_le_hi exact_mod_cast hI.1.trans hJ.2 · apply le_min · exact_mod_cast hJ.1.trans hI.2 · exact J.lo_le_hi simp only [RatInterval.tighten, hlohi, dif_pos, RatInterval.Subinterval] exact ⟨le_max_right _ _, min_le_right _ _⟩ -
inv_den_le_of_postheorem — The reciprocal of a positive rational's denominator is no larger than the rational itself.hypothesesu :ℚhu :0 < uconclusion1 / (u.den : ℚ) ≤ uProof (Lean source)
theorem inv_den_le_of_pos (u : ℚ) (hu : 0 < u) : 1 / (u.den : ℚ) ≤ u := by have hnum0 : 0 ≤ u.num := Rat.num_nonneg.mpr hu.le have hnumne : u.num ≠ 0 := by intro h have hu0 : u = 0 := by rw [← Rat.num_div_den u, h] simp linarith have hnum1 : (1 : ℚ) ≤ u.num := by exact_mod_cast (lt_of_le_of_ne hnum0 (Ne.symm hnumne)) calc 1 / (u.den : ℚ) ≤ (u.num : ℚ) / u.den := div_le_div_of_nonneg_right hnum1 (by positivity) _ = u := Rat.num_div_den u
Quadrature 4 core · 3 supporting This module turns complex rational node rectangles on a uniform mesh into a sound enclosure of an interval integral. ★ integralEnclosure_sound
Certified trapezoidal contour quadrature
This module turns complex rational node rectangles on a uniform mesh into a sound enclosure of an interval integral. The deterministic trapezoidal rule is widened by an explicit Lipschitz error, and the result specializes to a circle contour through its standard parameterization.
Given a sequence of complex rational rectangles, the unscaled trapezoidal rectangle sum at a nonnegative index is computed recursively: at zero it is the zero rectangle, and at each successor it adds the two rectangles at the new cell's endpoints to the preceding sum.
Definition (Lean source)
For a sequence of complex rational rectangles and a mesh size, the trapezoidal enclosure is the unscaled trapezoidal rectangle sum multiplied by . It is meaningful for positive mesh size, as required by the integral enclosure built from it; at mesh size zero the scale factor is zero by the division convention.
Definition (Lean source)
Given a sequence of complex rational node rectangles, a rational Lipschitz constant, the condition that this constant is nonnegative, a mesh size, and the condition that the mesh size is positive, the integral enclosure widens the trapezoidal enclosure by in both coordinates.
Definition (Lean source)
Certified trapezoidal enclosure of an integral. Fix a nonnegative Lipschitz constant and a positive node count, and suppose the complex-valued integrand is Lipschitz on [0, 1] with that constant and each complex rational rectangle contains the integrand's value at the corresponding mesh point. Then the trapezoidal enclosure built from those rectangles contains the true integral of the integrand over [0, 1].
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
norm_integral_sub_trapezoid_letheorem — A Lipschitz complex function on the unit parameter interval differs from its deterministic trapezoidal rule by at most half a Lipschitz mesh unit.hypothesesg :ℝ → ℂL :ℚhL :0 ≤ Ln :ℕhn :0 < nhLip :∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, ‖g s - g t‖ ≤ (L : ℝ) * |s - t|Proof (Lean source)
theorem norm_integral_sub_trapezoid_le {g : ℝ → ℂ} {L : ℚ} (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hLip : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, ‖g s - g t‖ ≤ (L : ℝ) * |s - t|) : ‖(∫ u in (0 : ℝ)..1, g u) - ((1 / (2 * n : ℝ)) * ∑ k ∈ range n, (g (meshPoint n k) + g (meshPoint n (k + 1))))‖ ≤ (L : ℝ) / (2 * n) := by have hL' : (0 : ℝ) ≤ L := by exact_mod_cast hL have hn' : (0 : ℝ) < n := by exact_mod_cast hn have hcont : ContinuousOn g (Icc (0 : ℝ) 1) := continuousOn_of_lipschitz_bound hL' hLip have hcell : ∀ k < n, ‖(∫ u in meshPoint n k..meshPoint n (k + 1), g u) - (1 / (2 * n : ℝ)) * (g (meshPoint n k) + g (meshPoint n (k + 1)))‖ ≤ (L : ℝ) / (2 * n * n) := by intro k hk let a := meshPoint n k let b := meshPoint n (k + 1) have hka : k ≤ n := (le_of_lt hk) have hkb : k + 1 ≤ n := hk have hab : a ≤ b := meshPoint_mono hn k.le_succ have ha : a ∈ Icc (0 : ℝ) 1 := meshPoint_mem hn hka have hb : b ∈ Icc (0 : ℝ) 1 := meshPoint_mem hn hkb have hgi : IntervalIntegrable g volume a b := (hcont.mono (by rw [uIcc_of_le hab] intro x hx exact ⟨ha.1.trans hx.1, hx.2.trans hb.2⟩)).intervalIntegrable have hp : ∀ u ∈ uIcc a b, ‖g u - ((1 / 2 : ℝ) : ℂ) * (g a + g b)‖ ≤ (L : ℝ) / (2 * n) := by intro u hu rw [uIcc_of_le hab] at hu have huI : u ∈ Icc (0 : ℝ) 1 := ⟨ha.1.trans hu.1, hu.2.trans hb.2⟩ have hla := hLip u huI a ha have hlb := hLip u huI b hb have hdist : |u - a| + |u - b| = b - a := by rw [abs_of_nonneg (sub_nonneg.mpr hu.1), abs_of_nonpos (sub_nonpos.mpr hu.2)] ring have halg : g u - ((1 / 2 : ℝ) : ℂ) * (g a + g b) = ((1 / 2 : ℝ) : ℂ) * (g u - g a) + ((1 / 2 : ℝ) : ℂ) * (g u - g b) := by norm_num ring rw [halg] calc ‖((1 / 2 : ℝ) : ℂ) * (g u - g a) + ((1 / 2 : ℝ) : ℂ) * (g u - g b)‖ ≤ ‖((1 / 2 : ℝ) : ℂ) * (g u - g a)‖ + ‖((1 / 2 : ℝ) : ℂ) * (g u - g b)‖ := norm_add_le _ _ _ = (1 / 2 : ℝ) * ‖g u - g a‖ + (1 / 2 : ℝ) * ‖g u - g b‖ := by simp [norm_mul] _ ≤ (1 / 2 : ℝ) * ((L : ℝ) * |u - a|) + (1 / 2 : ℝ) * ((L : ℝ) * |u - b|) := by gcongr _ = (L : ℝ) / 2 * (b - a) := by rw [← hdist]; ring _ = (L : ℝ) / (2 * n) := by rw [show b - a = 1 / (n : ℝ) by exact meshPoint_succ_sub hn] ring have hbound : ‖∫ u in a..b, (g u - ((1 / 2 : ℝ) : ℂ) * (g a + g b))‖ ≤ ((L : ℝ) / (2 * n)) * |b - a| := intervalIntegral.norm_integral_le_of_norm_le_const (by intro u hu apply hp u rw [uIcc_of_le hab] rw [show Ι a b = Ioc a b from uIoc_of_le hab] at hu exact ⟨le_of_lt hu.1, hu.2⟩) have hrewrite : (∫ u in a..b, g u) - (1 / (2 * n : ℝ)) * (g a + g b) = ∫ u in a..b, (g u - ((1 / 2 : ℝ) : ℂ) * (g a + g b)) := by have hscale : (1 / (2 * n : ℝ)) * (g a + g b) = (1 / (n : ℝ)) • (((1 / 2 : ℝ) : ℂ) * (g a + g b)) := by rw [Complex.real_smul] push_cast field_simp rw [intervalIntegral.integral_sub hgi intervalIntegrable_const, intervalIntegral.integral_const] rw [show b - a = 1 / (n : ℝ) by exact meshPoint_succ_sub hn] rw [hscale] rw [hrewrite] calc ‖∫ u in a..b, (g u - ((1 / 2 : ℝ) : ℂ) * (g a + g b))‖ ≤ ((L : ℝ) / (2 * n)) * |b - a| := hbound _ = (L : ℝ) / (2 * n * n) := by rw [show b - a = 1 / (n : ℝ) by exact meshPoint_succ_sub hn, abs_of_nonneg (by positivity)] ring rw [sum_cell_integrals hn hcont, Finset.mul_sum, ← Finset.sum_sub_distrib] calc _ ≤ ∑ k ∈ range n, ‖(∫ u in meshPoint n k..meshPoint n (k + 1), g u) - (1 / (2 * n : ℝ)) * (g (meshPoint n k) + g (meshPoint n (k + 1)))‖ := by convert norm_sum_le _ _ using 1 <;> norm_num [Nat.cast_mul] _ ≤ ∑ _k ∈ range n, (L : ℝ) / (2 * n * n) := by gcongr with k hk exact hcell k (Finset.mem_range.mp hk) _ = (L : ℝ) / (2 * n) := by simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] field_simp -
integralEnclosure_widththeorem — Each coordinate width of the certified integral is bounded by the uniform node width plus one mesh-scale Lipschitz allowance.hypothesesnodes :w L :ℚhw :0 ≤ whL :0 ≤ Ln :ℕhn :0 < nhnodes :∀ k ≤ n, (nodes k).re.width ≤ w ∧ (nodes k).im.width ≤ wconclusionconclusion 1(integralEnclosure nodes L hL n hn).re.width ≤ w + L / nconclusion 2(integralEnclosure nodes L hL n hn).im.width ≤ w + L / nProof (Lean source)
theorem integralEnclosure_width {nodes : ℕ → ComplexRatInterval} {w L : ℚ} (hw : 0 ≤ w) (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hnodes : ∀ k ≤ n, (nodes k).re.width ≤ w ∧ (nodes k).im.width ≤ w) : (integralEnclosure nodes L hL n hn).re.width ≤ w + L / n ∧ (integralEnclosure nodes L hL n hn).im.width ≤ w + L / n := by have hs := width_trapezoidSum hw hnodes have hq : (0 : ℚ) ≤ 1 / (2 * n : ℚ) := by positivity have hscale := width_smulRat_of_nonneg (trapezoidSum nodes n) hq have htre : (trapezoidEnclosure nodes n).re.width ≤ w := by rw [trapezoidEnclosure, hscale.1] calc (1 / (2 * n : ℚ)) * (trapezoidSum nodes n).re.width ≤ (1 / (2 * n : ℚ)) * (2 * n * w) := mul_le_mul_of_nonneg_left hs.1 hq _ = w := by field_simp have htim : (trapezoidEnclosure nodes n).im.width ≤ w := by rw [trapezoidEnclosure, hscale.2] calc (1 / (2 * n : ℚ)) * (trapezoidSum nodes n).im.width ≤ (1 / (2 * n : ℚ)) * (2 * n * w) := mul_le_mul_of_nonneg_left hs.2 hq _ = w := by field_simp have herr : L / (2 * n : ℚ) + L / (2 * n : ℚ) = L / n := by field_simp ring unfold RatInterval.width at htre htim constructor <;> simp only [integralEnclosure, ComplexRatInterval.expand, RatInterval.expand, RatInterval.width] <;> linarith [herr] -
circleContourIntegral_enclosedtheorem — Applying the complex mesh theorem to the parameterized circle integrand encloses the contour integral.hypothesesf :ℂ → ℂc :ℂr :ℝnodes :L :ℚhL :0 ≤ Ln :ℕhn :0 < nhLip :∀ s ∈ Icc (0 : ℝ) 1,∀ t ∈ Icc (0 : ℝ) 1,‖circleIntegrand f c r s - circleIntegrand f c r t‖ ≤ (L : ℝ) * |s - t|hnodes :∀ k ≤ n, (nodes k).Contains (circleIntegrand f c r (meshPoint n k))conclusion(integralEnclosure nodes L hL n hn).Contains (circleContourIntegral f c r)Proof (Lean source)
theorem circleContourIntegral_enclosed {f : ℂ → ℂ} {c : ℂ} {r : ℝ} {nodes : ℕ → ComplexRatInterval} {L : ℚ} (hL : 0 ≤ L) {n : ℕ} (hn : 0 < n) (hLip : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, ‖circleIntegrand f c r s - circleIntegrand f c r t‖ ≤ (L : ℝ) * |s - t|) (hnodes : ∀ k ≤ n, (nodes k).Contains (circleIntegrand f c r (meshPoint n k))) : (integralEnclosure nodes L hL n hn).Contains (circleContourIntegral f c r) := by exact integralEnclosure_sound hL hn hLip hnodes
API 2 core · 0 supporting This module collects exact rational interval arithmetic, certified-real refinement, transcendental interval extensions, finite mesh enclosures, and total measurable finite searches into one paper-independent interface.
Packaged certified contour interval arithmetic
This module collects exact rational interval arithmetic, certified-real refinement, transcendental interval extensions, finite mesh enclosures, and total measurable finite searches into one paper-independent interface.
This interface packages sound rational interval arithmetic and total certified-real refinement behind a paper-independent interface.
Definition (Lean source)
The concrete certified interval-arithmetic package provides outwardly sound rational interval operations for addition, subtraction, multiplication, division away from zero, exponentiation, logarithms and real powers on their positive domains, together with certified-real refinement of any requested positive rational precision.
Definition (Lean source)
FiniteSearch 4 core · 13 supporting This module provides the finite control flow used by certified numerical procedures. ★ measurable_leastScoreIndex
Total finite searches, deterministic ties, and measurability
This module provides the finite control flow used by certified numerical procedures. It returns a least successful candidate with an explicit fallback, breaks equal real scores by index, and proves that the resulting finite outputs are Borel measurable.
For a nonnegative integer and a Boolean-valued family indexed by the indices from zero through $n, the least-successful-index rule returns the smallest index whose Boolean value is true when such an index exists, and index zero when none exists.
For a nonnegative integer, a family of rational candidate intervals, and a strictly positive rational width tolerance, the finite-refinement interval is the candidate at the least index whose width is at most the tolerance, or the zeroth candidate when no candidate meets that condition.
Definition (Lean source)
For a nonnegative integer and a real-valued score for each of the indices from zero through $n, the least-score index is obtained by forming the finite set of pairs consisting of each score and its index, ordered first by score and then by index, certifying that this finite set is nonempty, and returning the index in its least pair.
Definition (Lean source)
For a sample-size index n, the function that selects, from a vector of n+1 real scores, the smallest index attaining the least score is measurable with respect to the Borel σ-algebra on the score vector space and the discrete σ-algebra on the finite index set.
Formal statement
Proof (Lean source)
13 supporting declarations (lemmas, instances)
-
instMeasurableSpaceRatIntervalinstance — The measurable structure on rational intervals is the discrete $\sigma$-algebra, so every collection of rational intervals is measurable.instancegiven by⊤ -
instMeasurableSpaceComplexRatIntervalinstance — The measurable structure on complex rational rectangles is the discrete $\sigma$-algebra, so every collection of complex rational rectangles is measurable.instancegiven by⊤ -
leastTrue_acceptstheorem — When at least one Boolean test succeeds, the returned index succeeds.hypothesesProof (Lean source)
theorem leastTrue_accepts {n : ℕ} {accept : Fin (n + 1) → Bool} (h : ∃ i, accept i = true) : accept (leastTrue accept) = true := by unfold leastTrue split_ifs with hne · have hm := Finset.min'_mem (Finset.univ.filter fun i => accept i) hne exact (Finset.mem_filter.mp hm).2 · obtain ⟨i, hi⟩ := h exfalso apply hne refine ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, ?_⟩⟩ exact hi -
leastTrue_letheorem — Every successful index is no smaller than the successful index returned by the search.Proof (Lean source)
theorem leastTrue_le {n : ℕ} {accept : Fin (n + 1) → Bool} {i : Fin (n + 1)} (hi : accept i = true) : leastTrue accept ≤ i := by unfold leastTrue split_ifs with hne · apply Finset.min'_le exact Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩ · exfalso apply hne exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩⟩ -
leastTrue_eq_zerotheorem — If no Boolean test succeeds, the total search returns index zero. -
finiteRefine_widththeorem — If a candidate meets the requested width, finite refinement returns the least such candidate and meets the width.hypothesesconclusion(finiteRefine candidates ε).width ≤ ε.1Proof (Lean source)
theorem finiteRefine_width {n : ℕ} {candidates : Fin (n + 1) → RatInterval} (ε : PosRat) (h : ∃ i, (candidates i).width ≤ ε.1) : (finiteRefine candidates ε).width ≤ ε.1 := by unfold finiteRefine apply of_decide_eq_true apply leastTrue_accepts (accept := fun i => decide ((candidates i).width ≤ ε.1)) obtain ⟨i, hi⟩ := h refine ⟨i, ?_⟩ rw [decide_eq_true_eq] exact hi -
measurable_finiteRefinetheorem — Finite refinement is measurable as a function of a finite vector of rational interval candidates.hypothesesn :ℕε :conclusionProof (Lean source)
@[fun_prop] theorem measurable_finiteRefine {n : ℕ} (ε : PosRat) : Measurable (fun candidates : Fin (n + 1) → RatInterval => finiteRefine candidates ε) := by letI : Countable RatInterval := countable_ratInterval exact fun s _ => (Set.to_countable _).measurableSet -
leastScoreIndex_minimaltheorem — The selected least-score index has score no larger than every competing score.hypothesesconclusionscore (leastScoreIndex score) ≤ score iProof (Lean source)
theorem leastScoreIndex_minimal {n : ℕ} (score : Fin (n + 1) → ℝ) (i : Fin (n + 1)) : score (leastScoreIndex score) ≤ score i := by classical let keys : Finset (ℝ ×ₗ Fin (n + 1)) := Finset.univ.image (fun j => toLex (score j, j)) have hkeys : keys.Nonempty := by refine ⟨toLex (score 0, 0), ?_⟩ exact Finset.mem_image.mpr ⟨0, Finset.mem_univ _, rfl⟩ have hm := Finset.min'_mem keys hkeys obtain ⟨j, -, hj⟩ := Finset.mem_image.mp hm have hselected : leastScoreIndex score = j := by rw [leastScoreIndex] change (ofLex (keys.min' hkeys)).2 = j rw [← hj] rfl rw [hselected] have hle := Finset.min'_le keys (toLex (score i, i)) (Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩) rw [← hj] at hle exact le_of_not_gt fun hgt => by have hlex : toLex (score i, i) < toLex (score j, j) := Prod.Lex.left _ _ hgt exact (not_lt_of_ge hle) hlex -
leastScoreIndex_tietheorem — Equal minimal scores are resolved in favor of the smaller original index.hypothesesconclusionleastScoreIndex score ≤ iProof (Lean source)
theorem leastScoreIndex_tie {n : ℕ} (score : Fin (n + 1) → ℝ) {i : Fin (n + 1)} (hi : score i = score (leastScoreIndex score)) : leastScoreIndex score ≤ i := by classical let keys : Finset (ℝ ×ₗ Fin (n + 1)) := Finset.univ.image (fun j => toLex (score j, j)) have hkeys : keys.Nonempty := by refine ⟨toLex (score 0, 0), ?_⟩ exact Finset.mem_image.mpr ⟨0, Finset.mem_univ _, rfl⟩ have hm := Finset.min'_mem keys hkeys obtain ⟨j, -, hj⟩ := Finset.mem_image.mp hm have hselected : leastScoreIndex score = j := by rw [leastScoreIndex] change (ofLex (keys.min' hkeys)).2 = j rw [← hj] rfl rw [hselected] at hi ⊢ have hle := Finset.min'_le keys (toLex (score i, i)) (Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩) rw [← hj] at hle exact le_of_not_gt fun hgt => by have hlex : toLex (score i, i) < toLex (score j, j) := by rw [hi] exact Prod.Lex.right _ hgt exact (not_lt_of_ge hle) hlex -
measurable_leastTruetheorem — A finite least-success search is measurable when every individual success event is measurable.hypothesesconclusionMeasurable (fun ω => leastTrue (fun i => accept i ω))Proof (Lean source)
@[fun_prop] theorem measurable_leastTrue {Ω : Type*} [MeasurableSpace Ω] {n : ℕ} (accept : Fin (n + 1) → Ω → Bool) (haccept : ∀ i, Measurable (accept i)) : Measurable (fun ω => leastTrue (fun i => accept i ω)) := by have hvector : Measurable (fun ω => fun i => accept i ω) := by fun_prop apply (show Measurable (leastTrue : (Fin (n + 1) → Bool) → Fin (n + 1)) from ?_).comp hvector exact fun s _ => (Set.to_countable _).measurableSet -
measurable_infEnclosuretheorem — The rational infimum enclosure is measurable as a function of its finite rational node vector.hypothesesn :ℕhn :0 < nL :ℚhL :0 ≤ LconclusionMeasurable (fun nodes : Fin (n + 1) → RatInterval => CircleMesh.infEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn)Proof (Lean source)
@[fun_prop] theorem measurable_infEnclosure {n : ℕ} (hn : 0 < n) (L : ℚ) (hL : 0 ≤ L) : Measurable (fun nodes : Fin (n + 1) → RatInterval => CircleMesh.infEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn) := by letI : Countable RatInterval := countable_ratInterval exact fun s _ => (Set.to_countable _).measurableSet -
measurable_supEnclosuretheorem — The rational supremum enclosure is measurable as a function of its finite rational node vector.hypothesesn :ℕhn :0 < nL :ℚhL :0 ≤ LconclusionMeasurable (fun nodes : Fin (n + 1) → RatInterval => CircleMesh.supEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn)Proof (Lean source)
@[fun_prop] theorem measurable_supEnclosure {n : ℕ} (hn : 0 < n) (L : ℚ) (hL : 0 ≤ L) : Measurable (fun nodes : Fin (n + 1) → RatInterval => CircleMesh.supEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn) := by letI : Countable RatInterval := countable_ratInterval exact fun s _ => (Set.to_countable _).measurableSet -
measurable_integralEnclosuretheorem — The rational complex integral enclosure is measurable as a function of its finite node rectangles.hypothesesn :ℕhn :0 < nL :ℚhL :0 ≤ LconclusionMeasurable (fun nodes : Fin (n + 1) → ComplexRatInterval => CircleMesh.integralEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn)Proof (Lean source)
@[fun_prop] theorem measurable_integralEnclosure {n : ℕ} (hn : 0 < n) (L : ℚ) (hL : 0 ≤ L) : Measurable (fun nodes : Fin (n + 1) → ComplexRatInterval => CircleMesh.integralEnclosure (fun k => if hk : k < n + 1 then nodes ⟨k, hk⟩ else nodes 0) L hL n hn) := by letI : Countable ComplexRatInterval := countable_complexRatInterval exact fun s _ => (Set.to_countable _).measurableSet
Logarithm 8 core · 4 supporting This module computes nested rational intervals for the logarithm of a positive rational input. ★ logScalar_width
Certified rational logarithm enclosures
This module computes nested rational intervals for the logarithm of a positive rational input. The atanh series and an explicit geometric remainder bound produce a certified real name with a computable precision for every positive rational error target.
For a rational number, the logarithm coordinate is . It is the atanh coordinate of the logarithm for positive , the regime used by the logarithm enclosures; at the denominator vanishes and the value is zero by the division convention.
Definition (Lean source)
For a rational number and a nonnegative polynomial degree, the logarithm Taylor partial sum is twice the sum, for every integer from zero through , of the st power of the logarithm coordinate divided by . It approximates the logarithm of only for positive ; no positivity is imposed by the definition itself.
Definition (Lean source)
For a rational number and a nonnegative polynomial degree, the logarithm remainder bound is , where . It bounds the series tail only for positive , where ; at (where ) and at the formula divides by zero and gives zero by the division convention.
Definition (Lean source)
For a rational number that is strictly positive and a nonnegative polynomial degree, the raw logarithm enclosure has lower endpoint equal to the logarithm partial sum minus its remainder bound, upper endpoint equal to the logarithm partial sum plus its remainder bound, and valid endpoint order.
Definition (Lean source)
For a strictly positive rational number, the scalar logarithm enclosure sequence assigns the raw logarithm enclosure at degree zero to index zero and the conditional tightening of the preceding enclosure with the next raw enclosure to each positive index.
Definition (Lean source)
For a rational number and a strictly positive rational target width, the logarithm precision index is the product of one plus the target-width denominator and two copies of one plus the sum of the absolute numerator and denominator of the rational number.
Definition (Lean source)
Precision-driven logarithm enclosure width. For a positive rational number and a requested positive rational tolerance, evaluating the scalar logarithm enclosure at the precision level determined from those two inputs produces an interval no wider than the requested tolerance.
Formal statement
Proof (Lean source)
For a rational number that is strictly positive, the certified-real representation of its logarithm has value equal to the real logarithm of that rational number, approximating intervals given by the scalar logarithm enclosure sequence, nested approximations, containment of the exact value, the logarithm precision index as its modulus, and the corresponding target-width guarantee.
Definition (Lean source)
4 supporting declarations (lemmas, instances)
-
abs_logCoordinate_lt_onetheorem — A positive rational logarithm argument has atanh coordinate of absolute value strictly below one.Proof (Lean source)
theorem abs_logCoordinate_lt_one (q : ℚ) (hq : 0 < q) : |logCoordinate q| < 1 := by exact abs_logCoordinate_lt_one_aux q hq -
logRaw_soundtheorem — The raw rational logarithm interval encloses the real logarithm of its positive rational input.Proof (Lean source)
theorem logRaw_sound (q : ℚ) (hq : 0 < q) (n : ℕ) : (logRaw q hq n).Contains (log (q : ℝ)) := by let z := logCoordinate q have hz : |(z : ℝ)| < 1 := by exact_mod_cast abs_logCoordinate_lt_one q hq have hb := log_series_remainder_bound (z : ℝ) hz n have hratio : (1 + (z : ℝ)) / (1 - (z : ℝ)) = (q : ℝ) := by have hd : (q : ℝ) + 1 ≠ 0 := by positivity dsimp [z, logCoordinate] push_cast field_simp [hd] ring have hplus : (1 + (z : ℝ)) ≠ 0 := by have := (abs_lt.mp hz).1 linarith have hminus : (1 - (z : ℝ)) ≠ 0 := by have := (abs_lt.mp hz).2 linarith have hlog : log (q : ℝ) = log (1 + (z : ℝ)) - log (1 - (z : ℝ)) := by rw [← Real.log_div hplus hminus, hratio] have hp : ((logPartial q n : ℚ) : ℝ) = 2 * ∑ k ∈ range (n + 1), (z : ℝ) ^ (2 * k + 1) / (2 * k + 1 : ℕ) := by simp [logPartial, z] have hr : ((logRemainder q n : ℚ) : ℝ) = 2 * |(z : ℝ)| ^ (2 * n + 3) / ((2 * n + 3 : ℕ) * (1 - |(z : ℝ)| ^ 2)) := by simp [logRemainder, z] rw [← hlog, ← hp, ← hr] at hb rw [abs_le] at hb simp only [logRaw, RatInterval.Contains, Rat.cast_sub, Rat.cast_add] constructor <;> linarith [hb.1, hb.2] -
logScalar_soundtheorem — Every tightened scalar logarithm interval encloses the real logarithm.Proof (Lean source)
theorem logScalar_sound (q : ℚ) (hq : 0 < q) (n : ℕ) : (logScalar q hq n).Contains (log (q : ℝ)) := by induction n with | zero => exact logRaw_sound q hq 0 | succ n ih => exact RatInterval.tighten_sound ih (logRaw_sound q hq (n + 1)) -
logScalar_nestedtheorem — Scalar logarithm enclosures are nested as precision increases.hypothesesq :ℚhq :0 < qn :ℕProof (Lean source)
theorem logScalar_nested (q : ℚ) (hq : 0 < q) (n : ℕ) : (logScalar q hq (n + 1)).Subinterval (logScalar q hq n) := by exact RatInterval.tighten_subinterval_left (logScalar_sound q hq n) (logRaw_sound q hq (n + 1))
Operations 5 core · 5 supporting This module lifts the certified scalar exponential and logarithm constructions to rational input intervals. ★ rpowInterval_sound
Transcendental interval extensions
This module lifts the certified scalar exponential and logarithm constructions to rational input intervals. It supplies sound and nested interval extensions for exponential, positive-domain logarithm, and positive-base real powers.
For a rational interval and a precision index, the exponential interval evaluation has lower endpoint equal to the lower endpoint of the scalar exponential enclosure at the input interval's lower endpoint, upper endpoint equal to the upper endpoint of the scalar exponential enclosure at the input interval's upper endpoint, and valid endpoint order.
Definition (Lean source)
For a rational interval whose lower endpoint is strictly positive and a precision index, the logarithm interval evaluation has lower endpoint equal to the lower endpoint of the scalar logarithm enclosure at the original lower endpoint, upper endpoint equal to the upper endpoint of the scalar logarithm enclosure at the original upper endpoint, and valid endpoint order.
Definition (Lean source)
For a base rational interval and an exponent rational interval whose base interval has a strictly positive lower endpoint, and a precision index, the raw real-power interval is the exponential interval of the product of the exponent interval and the logarithm interval of the base.
Definition (Lean source)
For a base rational interval and an exponent rational interval whose base interval has a strictly positive lower endpoint, the real-power interval sequence assigns the raw real-power interval at precision zero to index zero and the conditional tightening of the preceding interval with the next raw real-power interval to each positive index.
Definition (Lean source)
Certified real-power interval evaluation. For a base rational interval whose lower endpoint is strictly positive that encloses a real base value, and an exponent rational interval enclosing a real exponent value, the real-power interval evaluation of the base and exponent, at any precision level, contains the true value of the base raised to that exponent.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
expInterval_soundtheorem — Exponential interval evaluation encloses the exponential of every enclosed real input.hypothesesconclusion(expInterval I n).Contains (exp x)Proof (Lean source)
theorem expInterval_sound {I : RatInterval} {x : ℝ} (hx : I.Contains x) (n : ℕ) : (expInterval I n).Contains (exp x) := by constructor · exact (expScalar_sound I.lo n).1.trans (Real.exp_monotone hx.1) · exact (Real.exp_monotone hx.2).trans (expScalar_sound I.hi n).2 -
logInterval_soundtheorem — Positive logarithm interval evaluation encloses the logarithm of every enclosed real input.hypothesesconclusion(logInterval I hI n).Contains (log x)Proof (Lean source)
theorem logInterval_sound {I : RatInterval} {x : ℝ} (hI : 0 < I.lo) (hx : I.Contains x) (n : ℕ) : (logInterval I hI n).Contains (log x) := by have hlo : (0 : ℝ) < I.lo := by exact_mod_cast hI have hxpos : 0 < x := (by exact_mod_cast hI : (0 : ℝ) < I.lo).trans_le hx.1 have hhipos : (0 : ℝ) < I.hi := hxpos.trans_le hx.2 constructor · exact (logScalar_sound I.lo hI n).1.trans (Real.strictMonoOn_log.monotoneOn hlo hxpos hx.1) · exact (Real.strictMonoOn_log.monotoneOn hxpos hhipos hx.2).trans (logScalar_sound I.hi (hI.trans_le I.lo_le_hi) n).2 -
expInterval_nestedtheorem — Exponential interval evaluation is nested in its precision argument.Proof (Lean source)
theorem expInterval_nested (I : RatInterval) (n : ℕ) : (expInterval I (n + 1)).Subinterval (expInterval I n) := by change expIntervalLo I n ≤ expIntervalLo I (n + 1) ∧ expIntervalHi I (n + 1) ≤ expIntervalHi I n unfold expIntervalLo expIntervalHi exact ⟨(expScalar_nested I.lo n).1, (expScalar_nested I.hi n).2⟩ -
logInterval_nestedtheorem — Positive logarithm interval evaluation is nested in its precision argument.hypothesesconclusion(logInterval I hI (n + 1)).Subinterval (logInterval I hI n)Proof (Lean source)
theorem logInterval_nested (I : RatInterval) (hI : 0 < I.lo) (n : ℕ) : (logInterval I hI (n + 1)).Subinterval (logInterval I hI n) := by change (logScalar I.lo hI n).lo ≤ (logScalar I.lo hI (n + 1)).lo ∧ (logScalar I.hi (hI.trans_le I.lo_le_hi) (n + 1)).hi ≤ (logScalar I.hi (hI.trans_le I.lo_le_hi) n).hi exact ⟨(logScalar_nested I.lo hI n).1, (logScalar_nested I.hi (hI.trans_le I.lo_le_hi) n).2⟩ -
rpowInterval_nestedtheorem — Real-power interval evaluation is nested in its precision argument.hypothesesconclusion(rpowInterval base exponent hbase (n + 1)).Subinterval (rpowInterval base exponent hbase n)Proof (Lean source)
theorem rpowInterval_nested (base exponent : RatInterval) (hbase : 0 < base.lo) (n : ℕ) : (rpowInterval base exponent hbase (n + 1)).Subinterval (rpowInterval base exponent hbase n) := by rw [rpowInterval_succ] let x : ℝ := base.lo let y : ℝ := exponent.lo have hx : base.Contains x := ⟨le_rfl, by dsimp [x]; exact_mod_cast base.lo_le_hi⟩ have hy : exponent.Contains y := ⟨le_rfl, by dsimp [y]; exact_mod_cast exponent.lo_le_hi⟩ have h₀ := rpowInterval_sound hbase hx hy n have h₁ := rpowRaw_sound hbase hx hy (n + 1) exact RatInterval.tighten_subinterval_left h₀ h₁