4.3

The metric E and the ℤ₂ swap

The direct and the swapped pairing of two endpoint pairs, and the axis flip
E takes the cheaper of the two ways to pair up the endpoints (left, middle). Flipping the screw and negating the limits redraws the same segment (right), so the quotient makes the axis sign irrelevant.

Two unordered pairs can be matched in two ways, direct (z₁⁻ ↔ z₂⁻, z₁⁺ ↔ z₂⁺) or swapped. Each way has a flat distance in se(3) × se(3), the square root of the two squared endpoint differences, and

E(J₁, J₂) = min{ ‖z₁⁻ − z₂⁻‖² + ‖z₁⁺ − z₂⁺‖², ‖z₁⁻ − z₂⁺‖² + ‖z₁⁺ − z₂⁻‖² }1/2.

This is the quotient distance of a flat space by the group ℤ₂ acting as the swap, and a quotient by a finite group of isometries is again a metric. That single fact gives the triangle inequality, which no hand-built combination of component errors has.

What the swap buys. Reversing the screw orientation maps (ξ, [l⁻, l⁺]) to (−ξ, [−l⁺, −l⁻]). The two endpoint twists are unchanged as a set, only their labels trade places, so the swapped pairing scores zero against the original. The axis-sign ambiguity that breaks the prior limit score is removed structurally, not patched.
Squares then a root, not a sum of norms. The two endpoint differences are combined in quadrature. This is what makes E the flat distance of the product space and what makes EB an RMS quantity later.
Where E is not smooth. Only on the tie locus where the two pairings cost the same. For training, training_loss replaces the min by a smooth swap-invariant surrogate.