Boxes versus Balls: An Expressiveness Story
📍 Where we are: Part II · Region and Geometric Embeddings — Chapter 7. Beta and Probabilistic Embeddings bought negation by trading regions for densities; before Part II closes, its first two shapes, the ball and the box, must face the operation that started the whole Part: conjunction.
Part II has now assembled three geometries for concepts: balls and cones placed by hand, boxes intersected along query paths, and Beta densities that can negate. This chapter puts the first two head-to-head on a single, decidable criterion. There is no training here, no loss, no gradient: only exact two-dimensional geometry, every claim derived by hand and then verified deterministically on a dense grid by the companion module boxes_vs_balls.py. The verdict is not a benchmark score a better optimizer might overturn next year; it is a closure property of a family of sets, and it is permanent.
Imagine two round spotlights on a dark stage, aimed so their circles of light overlap. The doubly lit patch in the middle is shaped like an almond, or a lens. Now the director hands you one spotlight and says: light up exactly the doubly lit patch, nothing more, nothing less. You cannot. A round beam either leaves almond corners in the dark or spills light onto singly lit floor; the almond is simply not a circle. But give the director rectangular masking flags instead of round beams, and the problem vanishes: where two rectangles of light overlap, the overlap is itself a perfect rectangle, so one flag frames it exactly. "Concept AND concept" is the overlap. Rectangles survive AND; circles do not.
What this chapter covers
- The closure criterion: if concepts are regions and conjunction is intersection, then whether a family of regions is closed under intersection decides, before any learning, whether conjunctive concepts are representable exactly.
- The lens, derived: two balls of radius 1.5 centered at (0, 0) and (2, 0): the overlap's span on the axis, and the two corner points at (1, ±√1.25), each algebraic step shown.
- The smallest enclosing ball: a lower bound from the triangle inequality, a containment proof from adding two inequalities, and the grid verification: center (1, 0), radius √1.25 ≈ 1.1180, zero lens points escaping.
- A false positive by coordinates: the committed point p = (−0.1173, −0.0160), inside the cover, inside ball A, and 2.1174 away from ball B's center; then the area accounting: 60.56 percent of the best covering ball is geometrically wrong.
- Boxes on the same test: the corner max/min intersection proved exact per coordinate, then confirmed with zero membership mismatches at all 4,000,000 grid points.
- The parameter ledger: a ball costs d+1 numbers, a box 2d, and the extra d−1 numbers buy d independent interval constraints instead of one isotropic radius.
- A fair hearing for the ball: rotation invariance, a single scale, smooth gradients; why the practical verdict is task-relative even though the closure fact is absolute.
The criterion: closure under intersection
Recall the reading of concepts that opened this Part. Entities of the academic world are points in , the space of lists of real numbers, where is the embedding dimension (throughout this chapter , so everything can be drawn and checked by eye). A concept such as Student or Professor is a region, a subset of that space, and an entity belongs to the concept exactly when its point falls inside the region. A region family is the set of all regions of one parametric shape: all balls, or all axis-aligned boxes. Every concept the model can ever represent must be drawn from the chosen family.
Volume 2 fixed the meaning of conjunction: the concept (read "C and D") denotes, in every interpretation, the set of individuals belonging to both, the set intersection (the symbol builds the set of points lying in both operands). So the region of a conjunction is forced: it must be the intersection of the two operand regions. The academic world asks such questions constantly; "students who have authored a paper" is the conjunction Student ⊓ ∃authored.Paper, and answering it geometrically means intersecting two regions [1].
Here is the criterion, stated as a principle. Say is closed under intersection if for every pair of regions (the symbol reads "is a member of"), the intersection is again a member of . Then:
If concepts are regions drawn from a family and conjunction is intersection, conjunctive concepts are representable exactly for every pair if and only if is closed under intersection.
Both directions are short. If is closed, the true region is itself a family member, so the model can store it, intersect it again, and pass it along like any atomic concept; nothing is lost. If is not closed, there exist whose intersection lies outside the family. Whatever region the model substitutes for the conjunction, as sets, so some witness point separates them: either a point in but not in , which the model wrongly calls a member (a false positive), or a point in but not in , which the model wrongly excludes (a false negative). This error exists before any data is seen or any optimizer runs; it is a property of the shape catalogue, not of the training. Closure is exactly why boxes were chosen for conjunctive query answering [1], why box intersection can be treated as the meet of a lattice [2], and why the ontology-embedding work that Part III examines migrated toward boxes [3]. The rest of the chapter makes both verdicts concrete.
Two balls make a lens
Fix the two operand regions once, in coordinates, exactly as boxes_vs_balls.py lines 42–44 declare them. A ball with center and radius is the set of points within distance of the center, , where the double bars denote Euclidean length, the square root of the sum of squared components. Our two balls are
so a point belongs to when and to when , with (squaring both sides of the distance condition removes the square root without changing the set, because both sides are non-negative).
First, the overlap's extent along the axis through the two centers, the line . Membership in there requires ; taking square roots of both sides, and remembering that both signs satisfy a squared bound, gives . Membership in requires , which is , and adding to all three parts gives . A point of the intersection must satisfy both chains at once, so on the axis the overlap spans
the interval the module stores as LENS_X_MIN and LENS_X_MAX (boxes_vs_balls.py lines 49–50).
Second, the points where the two boundary circles cross. On the boundaries the inequalities become equalities: and . Subtract the second equation from the first; the terms cancel:
Expanding and substituting,
Back-substituting into gives , so (boxes_vs_balls.py lines 55–56). Call these two corner points and . Each lies at distance from both centers, exactly on both boundary circles, so both belong to the closed intersection.
The intersection is the lens: a convex region bounded by two circular arcs of radius meeting at the corners and . And a lens is not a ball: informally, its boundary has two corners where arcs meet at an angle, while a circle bends smoothly everywhere; a watertight version of the argument, by area, arrives two sections below. The committed run prints the derived geometry verbatim:
1. two balls and their lens
A = ball((0.0, 0.0), r = 1.5) B = ball((2.0, 0.0), r = 1.5)
lens spans x ∈ [0.50, 1.50] on the axis; boundaries cross at (1.0, ±1.1180)
smallest enclosing ball: center (1.0, 0.0), radius √1.25 = 1.1180
grid check (2000×2000): lens points escaping the ball = 0
farthest lens point from the center: 1.1175 (= radius 1.1180 — the crossing points are diameter ends)
The smallest ball that covers the lens
A ball-based model asked to represent must answer with a ball. The most charitable choice for recall is the smallest ball containing the whole lens, so that no genuine member of the conjunction is excluded. That ball can be found exactly, in two steps: a lower bound on the radius, and a matching construction.
The lower bound. Suppose some ball contains the lens. It then contains both corners and . The triangle inequality states that for any three points the direct distance between two of them is at most the sum of the distances through the third; applied to , , :
The corners share the coordinate , so their distance is the difference of their heights, . Substituting, , hence . No ball of radius under can cover the lens.
The construction. The bound is achieved by the ball centered at the corners' midpoint, , with radius exactly , and the proof that it contains the entire lens is three lines of algebra. Let be any lens point, so both membership inequalities hold:
the second being with the square expanded. Add the two inequalities term by term:
Divide every term by :
Complete the square in : since , the left side is , and subtracting from both sides gives
That is precisely the statement "the point lies within distance of ." Every lens point satisfies it, so the ball contains the lens; by the lower bound no smaller ball does; therefore it is the smallest enclosing ball, and , are the two ends of one of its diameters (boxes_vs_balls.py lines 65–66). Note where the slack went: equality in the sum requires equality in both operand inequalities at once, which happens only at the two corners, so every other lens point sits strictly inside the cover. That is the first hint the cover is loose.
The module then verifies the construction numerically. It lays a grid of cell centers over the cover's bounding square (centers rather than lattice corners, so no sample sits exactly on a region boundary; boxes_vs_balls.py lines 102–110), evaluates all three memberships at all points, and counts lens points that escape the cover (boxes_vs_balls.py lines 149–158):
X, Y, cell = _cell_grid(BEST_CENTER[0] - r, BEST_CENTER[0] + r, -r, r)
in_a = _sq_dist(X, Y, CENTER_A) <= RADIUS ** 2
in_b = _sq_dist(X, Y, CENTER_B) <= RADIUS ** 2
lens = in_a & in_b # membership in A ∩ B
ball = _sq_dist(X, Y, BEST_CENTER) <= r ** 2 # membership in best ball
lens_cnt, ball_cnt = int(lens.sum()), int(ball.sum())
lens_area_grid = lens_cnt * cell
ball_area_grid = ball_cnt * cell
escaped = int(np.count_nonzero(lens & ~ball)) # lens points outside ball
max_dist = float(np.sqrt(_sq_dist(X, Y, BEST_CENTER)[lens].max()))
The run reports escaped = 0: not one of the millions of lens samples falls outside the cover, matching the containment proof. It also reports the farthest lens sample at distance from the center, half a grid cell short of the radius : the grid spans across cells, about per cell, and cell centers cannot land exactly on the corner points, so a gap of is the expected discretization. The competency assert at line 192 demands both facts, so the enclosure is real and tight.
The false positive, by name
The cover contains the lens. The question with teeth is what else it contains, because every extra point is an entity the ball model must call a member of although the conjunction's semantics excludes it. The module hunts for the worst such point with a seeded search: uniform samples in the cover's bounding square, filtered to those inside the cover, taking the one that violates the lens condition by the largest margin (boxes_vs_balls.py lines 164–174):
rng = np.random.default_rng(0)
pts = rng.uniform([BEST_CENTER[0] - r, -r], [BEST_CENTER[0] + r, r],
size=(20_000, 2))
d_a = np.sqrt((pts[:, 0] - CENTER_A[0]) ** 2 + (pts[:, 1] - CENTER_A[1]) ** 2)
d_b = np.sqrt((pts[:, 0] - CENTER_B[0]) ** 2 + (pts[:, 1] - CENTER_B[1]) ** 2)
d_c = np.sqrt((pts[:, 0] - BEST_CENTER[0]) ** 2 + (pts[:, 1] - BEST_CENTER[1]) ** 2)
violation = np.maximum(d_a, d_b) - RADIUS # > 0 ⟺ outside the lens
violation[d_c > r] = -np.inf # keep only points inside the ball
i = int(np.argmax(violation))
fp: Point = (float(pts[i, 0]), float(pts[i, 1]))
fp_da, fp_db, fp_dc = float(d_a[i]), float(d_b[i]), float(d_c[i])
The violation line encodes lens membership in one expression: a point belongs to the lens exactly when its distance to both centers is at most , that is, when the larger of the two distances is at most , so a positive certifies non-membership. Because the generator is seeded (default_rng(0)), every run finds the identical point, printed with its three distances:
2. the ball's false positives (the price of forcing a lens into a ball)
exhibit p = (-0.1173, -0.0160) [seeded search, rng(0), 20000 samples]
|p − c_A| = 0.1184 vs 1.5 → inside A
|p − c_B| = 2.1174 vs 1.5 → OUTSIDE B ⇒ p ∉ lens A ∩ B
|p − c_ball| = 1.1174 vs 1.1180 → inside the enclosing ball
areas analytic | grid
lens A ∩ B 1.5487 | 1.5487
best ball 3.9270 | 3.9271
false-positive fraction (ball − lens)/ball = 0.6056 | 0.6056
Read the three lines as a small indictment. The point sits a mere from ball 's center, deep inside . It sits from ball 's center, far beyond 's radius of ; it fails one operand of the conjunction outright, so it is not in the lens. Yet its distance to the cover's center is , just inside the cover's radius , so the ball model asserts . The search converged to the cover's western rim, near , the part of the cover farthest from 's center, where the violation is largest. The assert at line 189 pins the certificate: inside the cover, outside an operand ball.
The price in area: 60.56 percent
One named point proves existence; the honest measure of the failure is how much of the cover is wrong. Both areas can be computed exactly, and the derivation is a nice piece of circle geometry, so we work it in full.
The chord splits the lens into two mirror-image halves. On the far side of the chord, membership in already implies membership in : a point with satisfies , because expanding gives , which is exactly ; so its distance to 's center is at most its distance to 's center, and being in puts that distance at or less. The half-lens right of the chord is therefore precisely the circular segment of beyond , and by the reflection symmetry of the whole configuration about the line , the left half is a congruent segment of .
A segment's area is a sector minus a triangle. The radius of drawn to the corner has length and horizontal component , so the angle it makes with the positive -axis satisfies (adjacent over hypotenuse). Thus radians, where is the inverse cosine, the angle whose cosine is the given value. The sector of swept from angle to is the fraction of the full disk of area :
where is carried unrounded through the product (rounding it to four decimals first would drift the last shown digit). The triangle with vertices at 's center, , and has base the chord between the corners, of length , and height the distance from the center to the chord, which is :
Subtracting, the segment has area , and the lens is two such segments:
This matches the closed form the module computes at lines 71–74, with and center distance . The cover's area is . The false-positive fraction of the cover, the share of its area lying outside the lens, is therefore
| quantity | analytic | dense grid (4,000,000 cell centers) |
|---|---|---|
| lens area | ||
| smallest enclosing ball area | ||
| false-positive fraction |
The grid column is computed by counting cells (areas at lines 154–156, the fraction at lines 176–179), the analytic column by the formulas above, and they agree to within one unit in the last printed digit (the best-ball row reads against ); the asserts at lines 195–198 require agreement within and the bound on the fraction. More than three fifths of the best possible ball is geometrically false, and "best possible" is doing real work: any ball covering the lens has radius at least , hence area at least , hence false-positive area at least ; a trained model with a sloppier cover only does worse. Shrinking the ball to fit inside the lens merely converts the guaranteed error into false negatives. Because the lens is not a ball, some error of one kind or the other is unavoidable; that is the first section's criterion, now carrying numbers. The area accounting also redeems the promise made when the lens was first drawn: were the lens itself a ball, it would be a ball containing the lens, so by the lower bound its radius would be at least and its area at least ; its actual area is , so the lens is not a ball.
The same conjunction, two geometries: the best ball covering the lens A ∩ B is 60.56 percent false positive by area, while the box intersection A′ ∩ B′ is exact at every one of four million grid points.
Original diagram by the authors, created with AI assistance.
Boxes pass the same test, exactly
Now run the identical test on the other family. An axis-aligned box in is a product of intervals, one per coordinate: a point belongs to the box with lower corner and upper corner exactly when for every coordinate index from to . The test boxes are and (the is the set product: first coordinate from the first interval, second from the second), chosen so their overlap spans the same interval on the -axis as the lens did.
The closure claim is that the intersection of two boxes is again a box, computable by corner arithmetic: the coordinatewise maximum of the lower corners and minimum of the upper corners. The proof is one equivalence per coordinate. For real numbers , , , where denotes the larger of and :
Left to right: is at least both numbers, in particular at least whichever is larger, and the larger one is . Right to left: is itself at least and at least , so gives and by transitivity of (a number at least a second, which is at least a third, is at least the third). The mirror-image equivalence holds for upper bounds with , the smaller of two numbers. Applying both in every coordinate : a point lies in exactly when, for each ,
which is verbatim the membership condition of a box with those corners. If in some coordinate the max of lows exceeds the min of highs, the interval is empty and so is the intersection, which the family still represents (an empty box); in lattice terms, intersection is the meet and the empty box is the bottom element [2]. The implementation is the proof transcribed, two comparisons per coordinate, so the running time is proportional to for a -dimensional implementation; the committed 2-D version spells out both coordinates (boxes_vs_balls.py lines 84–93):
def box_intersection(a: Box, b: Box) -> Box:
"""The intersection of two axis-aligned boxes, computed in O(d).
A point p satisfies a_lo ≤ p ≤ a_hi AND b_lo ≤ p ≤ b_hi exactly when
max(a_lo, b_lo) ≤ p ≤ min(a_hi, b_hi), coordinate by coordinate — so the
intersection IS a box (possibly empty), with no approximation at all.
"""
lo = (max(a[0][0], b[0][0]), max(a[0][1], b[0][1]))
hi = (min(a[1][0], b[1][0]), min(a[1][1], b[1][1]))
return (lo, hi)
On the test pair: lower corner , upper corner , so : a box, with no approximation step anywhere. The module then applies the same dense-grid discipline as before, testing at every one of the cell centers of the union's bounding box whether membership in the computed intersection box equals the conjunction "in AND in " (boxes_vs_balls.py lines 182–185):
ibox = box_intersection(BOX_A, BOX_B)
Xb, Yb, _ = _cell_grid(BOX_A[0][0], BOX_B[1][0], BOX_A[0][1], BOX_A[1][1])
mismatches = int(np.count_nonzero(
_in_box(Xb, Yb, ibox) != (_in_box(Xb, Yb, BOX_A) & _in_box(Xb, Yb, BOX_B))))
3. boxes: intersection by corner arithmetic IS a box
A′ = [-1.5, 1.5] × [-1.0, 1.0]
B′ = [0.5, 3.5] × [-1.0, 1.0]
A′ ∩ B′ = [max lows, min highs] = [0.5, 1.5] × [-1.0, 1.0]
grid check (2000×2000 over the union's bounding box): membership mismatches = 0
Zero mismatches at four million points, guarded by the assert at line 200. Be precise about what the grid establishes: the mathematics was settled by the per-coordinate equivalence, which quantifies over all points; the grid verifies that the implementation realizes the theorem, the same role the oracle checks played for Volume 2's completion rules. Where the ball's report card read "0.6056 of the cover is false," the box's reads "0 of anything is false." That asymmetry is the expressiveness story of the chapter's title, and it is why multi-hop query engines chose boxes for conjunction [1]; an engine that uses the exact corner intersection compounds no geometric error when it chains conjunctions.
The parameter ledger in d dimensions
The comparison so far lived in the plane; the families are defined in any dimension, and counting parameters explains both the box's power and its cost. A ball in is a center, numbers, plus a single radius applied isotropically, the same extent in every direction: parameters. A box is a center plus a separate half-width per dimension (equivalently, a lower and an upper corner): parameters (boxes_vs_balls.py lines 124–129):
def param_counts(d: int) -> tuple[int, int]:
"""(ball, box) parameter counts in ℝ^d. A ball is a center (d numbers)
plus ONE isotropic radius — the same extent in every direction — for
d + 1 parameters; a box is a center plus a per-dimension half-width, 2d
parameters, i.e. d independent interval constraints."""
return d + 1, 2 * d
| dimension | ball: | box: | what the box's extra numbers buy |
|---|---|---|---|
| 2 independent interval constraints (a ball has 1 radius) | |||
| 16 independent interval constraints | |||
| 64 independent interval constraints |
The right column is the real content. A box is a conjunction of independent one-dimensional constraints: coordinate 1 within this interval, AND coordinate 2 within that one, each interval set separately. If the model's coordinates come to encode attributes, a box can carve "seniority between here and there, AND paper count above this line, AND anything at all elsewhere" by widening the uninformative intervals. A ball can express none of that structure: its single inequality couples all coordinates into one aggregate distance, so it can only say "near this prototype, uniformly in every direction." The same per-coordinate independence powers the box calculus for relational patterns, where translated and resized boxes capture inference rules that point embeddings provably cannot [4]. At the box pays numbers against the ball's , roughly double the memory per concept; exact conjunction is what the doubled budget purchases.
A fair hearing for the ball
The verdict above is one-sided because the criterion is one-sided, so honesty requires the other column of the ledger. Balls hold real advantages. They are rotation invariant: membership depends only on the distance , which no rotation of the space about the center changes, so a ball model privileges no coordinate direction. Boxes are welded to the axes: rotate a box by 45 degrees and the result is a diamond no box can represent, and a boundary that correlates coordinates, such as "coordinate one at most coordinate two," is invisible to the family. Axis-alignment is a modeling bias, a silent bet that the learned basis will line up with meaningful directions, and nothing in the training objective enforces the bet. Balls also carry a single interpretable scale, cost as few parameters as any practical region family, and are kind to gradient descent: the signed distance is smooth everywhere except the center, supplying informative gradients from any direction of approach. Hard box membership is a flat indicator with kinks along faces and corners, and disjoint boxes yield zero gradient entirely, a failure that pushed the literature toward smoothed and probabilistic box variants [2].
So the practical verdict is task-relative: a task dominated by "near this prototype" structure, indifferent to conjunctions, may be served better by balls at half the cost. But the closure argument is not task-relative, not empirical, and not repealable by a better optimizer. The intersection of two balls is not a ball; the best ball covering our lens is 60.56 percent false by area; the intersection of two boxes is a box, with error exactly zero. Choosing a region family means choosing, in advance, which logical operations your geometry can perform without lying.
The unsolved part
Everything in this chapter was placed by hand, and that is both its strength and its honest limit. The strength: the false positive at is a theorem about the family, a floor under every ball model, unbeatable by any amount of training. The limit: the chapter does not say how much this floor hurts in practice. When a real objective trains balls against a real ontology, radii stretch and centers drift under many competing constraints, and the conjunction error might be swamped by ordinary learning error, masked by slack in high dimensions, or surface exactly where the geometry predicts. Volume 2's normalized TBox makes the question concrete: its NF2 axioms have the shape (the reads "is subsumed by": every member of the conjunction is a member of ), so a geometry that cannot represent exactly must approximate the very region whose containment in the axiom asserts. Whether that forced approximation shows up as measurable unsoundness in a learned embedding is an empirical question this chapter can only predict, not settle. And the criterion cuts both ways going forward: boxes are closed under intersection but not under union, complement, or rotation, so no family met so far is closed under every constructor a logic might demand [3]. Closure is a per-operator property; picking a geometry means picking which operators come exact, and where that frontier can be pushed is an open design problem of the field.
Why it matters
This chapter is the hinge on which Part II turns into Part III. The neuro-symbolic programme needs geometric or differentiable counterparts for logical operators, and it needs them to obey the operators' laws, not merely gesture at them; closure under intersection is the first such law, and it is checkable with circle geometry and a grid. Conjunctive query answering in vector space chose boxes because the family is closed under intersection [1]; with the exact corner intersection (the specification the published system's learned intersection operator approximates), chaining conjunctions compounds no geometric error. The soundness arguments of ontology embedding, where reaching zero loss is supposed to certify that the geometry is a genuine model of the axioms, lean on the region family being able to represent what the axioms demand at all; that is the closure argument carried into Part III's subject matter [3]. And the method here, state an algebraic law and test a geometry against it deterministically with committed numbers, is the probe template the rest of this volume applies to trained models. When Volume 4 makes logic differentiable, the same discipline returns at larger scale: every soft operator owes its hard counterpart an account of which laws it preserves and which it quietly breaks.
Key terms
- Region family — all regions of one parametric shape (all balls, all boxes); every representable concept must be drawn from it.
- Closure under intersection — intersecting any two family members yields another family member; holds for boxes (corner arithmetic), fails for balls (the lens).
- Lens — the intersection of two overlapping balls: a convex region bounded by two circular arcs meeting at two corners; not a ball.
- Smallest enclosing ball — the minimum-radius ball containing a region; for our lens, center and radius , minimal by the triangle inequality, containing by summed inequalities.
- Geometric false positive — a point a family is forced to misclassify before any training, by the gap between a true region and its best family approximation; exhibited at , with a area fraction.
- Circular segment — the region of a disk beyond a chord; area = sector − triangle = for chord distance ; two make the lens.
- Corner arithmetic — box intersection by coordinatewise max of lower corners and min of upper corners; exact, linear in the dimension.
- Isotropy — the ball's one-radius-fits-all-directions property: rotation invariance and a single scale, at the price of no per-coordinate structure.
- Parameter counts versus — ball versus box cost in ; the box's extra numbers buy independent interval constraints.
Where this leads
This chapter placed its regions by hand and proved what the shapes can and cannot do. The next chapter, EL Embeddings, hands the placement to gradient descent: the ELEm construction turns each normal form of Volume 2's real TBox into a geometric loss over balls, with NF1 demanding ball containment, NF3 and NF4 routing existentials through per-role translations, disjointness pushing balls apart, and NF2, conjunction, asking balls for precisely what this chapter proved they cannot deliver exactly. Training reaches a low but nonzero loss, and then the probing begins: over all ordered pairs of satisfiable concepts, does the learned geometry reproduce Volume 2's eight entailed subsumptions and nothing else? This chapter has filed its prediction about where the geometry will bend; the next one runs the experiment.
Companion code: examples/neural/boxes_vs_balls.py contains every construction in this chapter: the lens constants and their derivations in comments (lines 42–74), the corner-arithmetic intersection (lines 84–93), the cell-center grid (lines 102–110), the parameter counts (lines 124–129), and the full verification with its competency asserts (lines 135–200). Run python3 examples/neural/boxes_vs_balls.py to reproduce every number quoted here, byte for byte; the run ends with SUMMARY boxes_vs_balls: ball_radius=1.1180 fp_point=(-0.1173,-0.0160) fp_ratio=0.6056 lens_area=1.5487 ball_area=3.9270 box_mismatches=0.