Ball arithmetic #
Ball arithmetic (midpoint–radius arithmetic) encloses an unknown element x of a normed ring R
in a ball ⟨c, r⟩, a center c : R and a radius r ≥ 0 that stand for closedBall c r.
The operations on balls have the inclusion property: if x ∈ B₁ and y ∈ B₂, then
x + y ∈ B₁ + B₂, x * y ∈ B₁ * B₂, and so on. Hence evaluating an expression in balls
gives a ball that contains the value of the expression at every point of the input balls. This
is the arithmetic of Arb Johansson, Arb and of van der Hoeven's
Ball arithmetic; on ℝ it is Rump's midpoint–radius interval arithmetic
Rump, Fast and parallel interval arithmetic. The theorems that turn enclosures into
existence proofs are in ConvexAnalysis.RadiiPolynomial.
Main definitions #
ConvexAnalysis.Ball R: a ball, a center and a radius inℝ≥0.ConvexAnalysis.Ball.toSet B: the setclosedBall B.center B.radiusthatBstands for. It is theInclusion.ToSetinstance of Mathlib'sinclusiontactic, which givesx ∈ B.- The ball order
B ≤ B':‖B.center - B'.center‖ + B.radius ≤ B'.radius, a preorder, and a partial order in normed groups. - The operations
B₁ + B₂,-B,B₁ - B₂,a • B,B₁ * B₂with radius‖c₁‖ r₂ + ‖c₂‖ r₁ + r₁ r₂,B ^ nwith radius(‖c‖ + r) ^ n - ‖c‖ ^ n, andB⁻¹with centerc⁻¹and radius‖c⁻¹‖² r / (1 - ‖c⁻¹‖ r)(the radius is0, andB⁻¹no enclosure, if‖c⁻¹‖ r ≥ 1). ConvexAnalysis.Ball.horner X A n: Horner's schemeA 0 + (A 1 + ⋯ * X) * Xin balls.ConvexAnalysis.Ball.enlarge B ε: the ball with the radius enlarged byε.ConvexAnalysis.Ball.ofIcc a b: the ball[a, b]inℝ;ConvexAnalysis.Ball.toInterval,ConvexAnalysis.Ball.ofInterval: the maps between balls inℝand Mathlib'sNonemptyInterval ℝ, andConvexAnalysis.Ball.orderIsoInterval, the order isomorphism they form.
Main statements #
- The inclusion property:
ConvexAnalysis.Ball.add_mem_add,neg_mem_neg,sub_mem_sub,smul_mem_smul,mul_mem_mul,pow_mem_pow,inverse_mem_inv(in a complete normed ring: if‖c⁻¹‖ r < 1, every element ofBis a unit,isUnit_of_mem, and its inverse lies inB⁻¹),inv_mem_inv(normed division rings),sum_mem_hornerandeval_mem_horner(polynomials). - Inclusion isotonicity in the ball order:
ConvexAnalysis.Ball.add_mono,neg_mono,sub_mono,smul_mono,mul_mono,pow_mono,inv_mono,horner_mono. WithtoSet_mono, a ball computed from bigger input balls, or rounded outwards, still encloses the exact values. ConvexAnalysis.Ball.le_iff_toSet_subset: in a nontrivial real normed space the ball order is inclusion of the sets.ConvexAnalysis.Ball.toSet_add: in a real normed space, ball addition is exact, it is the Minkowski sum of the two sets.ConvexAnalysis.Ball.toSet_eq_Icc,ConvexAnalysis.Ball.coe_toInterval: inℝ, a ball is the interval[c - r, c + r];ConvexAnalysis.Ball.orderIsoInterval: balls inℝwith the ball order are intervals with inclusion, and ball addition and negation are the interval operations (ConvexAnalysis.Ball.toInterval_add,ConvexAnalysis.Ball.toInterval_neg).ConvexAnalysis.Ball.radius_mul_le_of_forall_mul_mem_Icc: Rump's overestimation bound: inℝ, the radius of the ball product is at most3 / 2times the radius of the interval product, the smallest interval containing all products.
Implementation notes #
- A ball is a structure with a radius in
ℝ≥0, so that every ball denotes a nonempty set, as in Arb, where radii are unsigned. With negative radii (empty balls) the ball order would no longer agree with inclusion of sets. - The order on balls is the one of van der Hoeven:
B ≤ B'if‖c - c'‖ + r ≤ r'. It impliesB.toSet ⊆ B'.toSet(toSet_mono) in every seminormed group, and is equivalent to it in nontrivial real normed spaces (le_iff_toSet_subset). Isotonicity is stated for this order: in a general normed ring set inclusion carries too little information (in the trivial ring all balls are equal as sets). - Rounding is modelled abstractly: an implementation with floating-point centers and radii
computes, instead of the exact result
Bof an operation, a ballB'withB ≤ B', that is a centerc'with‖c - c'‖ ≤ δand a radiusr' ≥ r + δrounded upwards (le_mk). Every suchB'encloses all values (mem_of_le), and by isotonicity so does every later operation on it.enlargeis the special case of an enlarged radius. No floating-point format is formalized. - The operations are instances (
Add,Neg,Sub,SMul,Mul,Pow,Inv), but balls form no ring:B * (B₁ + B₂)andB * B₁ + B * B₂have the same center, and the radius of the first is smaller in general (subdistributivity).B ^ nhas its own radius formula; inℝit agrees with the radius of the repeated productB * ⋯ * B. The inverse usesRing.inverse, which is0at non-units; the inclusion theorems assume that the center is a unit. - The power uses
‖(c + h) ^ n - c ^ n‖ ≤ (‖c‖ + ‖h‖) ^ n - ‖c‖ ^ n, valid in every normed ring, commutative or not, and without‖1‖ = 1. Horner's scheme multiplies byXon the right, so that it evaluates∑ aᵢ xⁱalso in noncommutative rings, asPolynomial.evaldoes. - Relation to Mathlib's
inclusiontactic. The tactic (Mathlib PR #42850, by David Ledvinka) proves goals by evaluating them in a typeIαof enclosures with a classInclusion.ToSet Iα α,toSet : Iα → Set α; its PR names ball arithmetic as one intended instance. HereBall Ris such anIαforα = R, withtoSet B = closedBall c r, and it has the tactic'sRefineandCoarseninstances (intersection and union enclosures). The tactic computes in the kernel, so its enclosure types have computable endpoints (Interval Dyadicforℝ);Ball ℝhas real centers and is the mathematical model, which an extension with dyadic centers and radii would map intoℝ. No inclusion extension for balls is registered here; the examples inConvexAnalysis.ComputerAssistedProofsuse the existing interval extensiondyadic_intervalto check the numerical conditions of the radii polynomial theorem. - On 2026-11-30 Mathlib had no ball arithmetic and no open pull request for it; searches for
"ball arithmetic", "midpoint radius", "radii polynomial", "rigorous numerics" and "validated
numerics" found only the
inclusiontactic (#42850, merged) and its extensions (#45638 and #46487 merged; #45720 and #46628 open).
References #
- J. van der Hoeven, Ball arithmetic, in: A. Beckmann, C. Gaßner, B. Löwe (eds.), Logical Approaches to Barriers in Computing and Complexity, Preprint-Reihe Mathematik 6, Universität Greifswald, 2010, 179–208 (HAL preprint hal-00432152, 2009).
- S. M. Rump, Fast and parallel interval arithmetic, BIT 39 (1999), 534–554.
- S. M. Rump, Verification methods: Rigorous results using floating-point arithmetic, Acta Numerica 19 (2010), 287–449.
- F. Johansson, Arb: efficient arbitrary-precision midpoint-radius interval arithmetic, IEEE Trans. Comput. 66 (2017), 1281–1292.
Tags #
ball arithmetic, midpoint–radius arithmetic, interval arithmetic, inclusion property, inclusion isotonicity, rigorous numerics, validated numerics
A ball in R: a center c and a radius r ≥ 0, standing for the closed ball
closedBall c r (ConvexAnalysis.Ball.toSet).
- center : R
The center (midpoint) of the ball.
- radius : NNReal
The radius of the ball.
Instances For
Balls are enclosures in the sense of Mathlib's inclusion tactic. This instance gives the
membership x ∈ B, which means x ∈ B.toSet.
Equations
Membership in a ball is membership in its set.
The center lies in the ball.
The ball order of van der Hoeven: B ≤ B' if ‖B.center - B'.center‖ + B.radius ≤ B'.radius. It implies B.toSet ⊆ B'.toSet (ConvexAnalysis.Ball.toSet_mono).
The ball order implies inclusion of the sets.
A bigger ball contains every element of a smaller one.
Rounding: replacing the center c by c' with ‖c - c'‖ ≤ δ and the radius r by
r' ≥ r + δ gives a bigger ball. This is how a floating-point implementation of an operation
returns an enclosure of the exact result.
Enlarging the radius keeps a valid enclosure.
The ball ⟨c, 0⟩ that stands for the point c (in a normed group).
Equations
- ConvexAnalysis.Ball.point c = { center := c, radius := 0 }
Instances For
c lies in the point ball ⟨c, 0⟩.
Addition, negation, subtraction #
The ball sum: center c₁ + c₂ and radius r₁ + r₂.
Inclusion property of ball addition.
Inclusion isotonicity of ball addition.
The ball negation: center -c and radius r.
Equations
- ConvexAnalysis.Ball.instNeg = { neg := fun (B : ConvexAnalysis.Ball R) => { center := -B.center, radius := B.radius } }
The center of a ball negation.
The radius of a ball negation.
Inclusion property of ball negation.
Inclusion isotonicity of ball negation.
The ball difference: center c₁ - c₂ and radius r₁ + r₂.
Ball subtraction is the sum with the negation.
Inclusion property of ball subtraction.
Inclusion isotonicity of ball subtraction.
Scalar multiples #
The scalar multiple: center a • c and radius ‖a‖ r.
The center of a scalar multiple.
The radius of a scalar multiple.
Inclusion property of scalar multiples.
Inclusion isotonicity of scalar multiples.
In a normed group the ball order is a partial order: B ≤ B' and B' ≤ B give
2 ‖c - c'‖ ≤ 0, so the centers and then the radii agree.
Equations
- ConvexAnalysis.Ball.instPartialOrderOfNormedAddCommGroup = let __spread.0 := inferInstance; { toPreorder := __spread.0, le_antisymm := ⋯ }
The ball order and inclusion of sets #
In a nontrivial real normed space, the ball order is inclusion of the sets: if
closedBall c r ⊆ closedBall c' r' with r ≥ 0, the point c + r u, for the unit vector u in
the direction c - c', gives ‖c - c'‖ + r ≤ r'.
In a real normed space, ball addition is exact: the set of B₁ + B₂ is the Minkowski sum
of the sets of B₁ and B₂.
Multiplication and powers #
The ball product: center c₁ c₂ and radius ‖c₁‖ r₂ + ‖c₂‖ r₁ + r₁ r₂.
Equations
- One or more equations did not get rendered due to their size.
Inclusion property of the ball product.
Inclusion isotonicity of the ball product.
The power bound in a normed ring: ‖x ^ n - c ^ n‖ ≤ (‖c‖ + r) ^ n - ‖c‖ ^ n for
‖x - c‖ ≤ r. It needs neither commutativity nor ‖1‖ = 1.
The ball power: center c ^ n and radius (‖c‖ + r) ^ n - ‖c‖ ^ n.
Inclusion property of the ball power.
Inclusion isotonicity of the ball power.
Polynomials: Horner's scheme #
Horner's scheme in ball arithmetic: horner X A n = A 0 + (A 1 + (⋯ + A n * X) ⋯ * X) * X
evaluates the polynomial with ball coefficients A 0, …, A n at the ball X. The multiplication
by X is on the right, as in ∑ aᵢ xⁱ.
Instances For
Horner's scheme for a constant.
Polynomial evaluation in balls: p.eval x lies in the ball computed by Horner's scheme
from the exact coefficients of p, for every x ∈ X.
Inverse #
The ball inverse: center c⁻¹ (Ring.inverse c) and radius
‖c⁻¹‖² r / (1 - ‖c⁻¹‖ r). It is an enclosure of the inverses if c is a unit and
‖c⁻¹‖ r < 1 (ConvexAnalysis.Ball.inverse_mem_inv). If ‖c⁻¹‖ r ≥ 1, the truncated subtraction
of ℝ≥0 gives the denominator 0 and the radius 0: then B⁻¹ is the point c⁻¹ and no
enclosure (the ball may contain 0).
Equations
- One or more equations did not get rendered due to their size.
The center of a ball inverse.
If the center c of B is a unit and ‖c⁻¹‖ r < 1, every element of B is a unit.
Inclusion property of the ball inverse in a complete normed ring: if the center c is a
unit and ‖c⁻¹‖ r < 1, then the inverse of every element of B lies in B⁻¹, the ball around
c⁻¹ of radius ‖c⁻¹‖² r / (1 - ‖c⁻¹‖ r). The proof uses x⁻¹ - c⁻¹ = x⁻¹ (c - x) c⁻¹.
Inclusion isotonicity of the ball inverse: if B ≤ B' and B' satisfies the hypotheses
of ConvexAnalysis.Ball.inverse_mem_inv, then so does B, and B⁻¹ ≤ B'⁻¹. With
s = ‖c'⁻¹‖, d = ‖c - c'‖, the proof bounds ‖c⁻¹ - c'⁻¹‖ by s² d / (1 - s d) and ‖c⁻¹‖ by
s / (1 - s d), and uses s² d / (1 - s d) + s² r / ((1 - s d) (1 - s d - s r)) = s² (d + r) / (1 - s (d + r)).
Inclusion property of the ball inverse in a normed division ring: if c ≠ 0 and
‖c⁻¹‖ r < 1, then x⁻¹ ∈ B⁻¹ for every x ∈ B, and x ≠ 0.
Balls and intervals in ℝ #
The ball ⟨(a + b) / 2, (b - a) / 2⟩ of an interval [a, b].
Equations
Instances For
The interval of a ball has the points of the ball.
The ball of an interval has the points of the interval.
Turning an interval into a ball and back gives the interval.
Turning a ball into an interval and back gives the ball.
Balls and intervals in ℝ are the same: ConvexAnalysis.Ball.toInterval is an order
isomorphism from balls with van der Hoeven's order onto intervals ordered by inclusion.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The length of the interval of a ball is twice the radius.
Ball addition in ℝ is interval addition.
Ball negation in ℝ is interval negation.
Rump's overestimation bound: in ℝ, if [l, u] contains every product x y with
x ∈ B₁ and y ∈ B₂, then the radius of the ball product B₁ * B₂ is at most 3 / 2 times the
radius (u - l) / 2 of [l, u] Rump, Fast and parallel interval arithmetic. For the
interval product, the smallest such interval, this bounds the overestimation of midpoint–radius
multiplication; ball products contain the interval product by mul_mem_mul.
The inclusion tactic's interface #
Any of two enclosures of x is an enclosure of x; the one with the smaller radius is
kept. This is the Refine operation of Mathlib's inclusion tactic.
The ball around the center of B₁ that contains B₁ and B₂, the Coarsen operation of
Mathlib's inclusion tactic.
Equations
- One or more equations did not get rendered due to their size.