Constraint Algebra

Definition

The constraint algebra provides composable predicates that refine types by pinning site indices. A Constraint is a predicate that, when applied to a type, determines the value of one or more sites in the iterated Z/2Z fibration.

Constraint Hierarchy

Four concrete constraint kinds are provided, mutually disjoint:

ClassDescription
residueConstraintKindMembership in a residue class: x = r (mod m)
carryConstraintKindCarry propagation pattern in ring arithmetic
depthConstraintKindBounds on factorization depth
ConjunctionComposition of two or more simpler constraints

A ConstrainedType links to its constraints via hasConstraint.

Constraint Properties

v0.2.2 Phase D parametrized the constraint surface: instead of seven disjoint subclasses, every constraint is now a BoundConstraint<O, B> selecting one (Observable, BoundShape) pair from the closed catalogue. The legacy names survive as Rust type aliases (ResidueConstraint, HammingConstraint, ...) over the parametric carrier.

Constraint kindObservableBound shape
ResidueConstraintobservable:ValueModObservabletype:ResidueClassBound
HammingConstraintobservable:HammingMetrictype:LessEqBound
DepthConstraintderivation:DerivationDepthObservabletype:LessEqBound
CarryConstraintcarry:CarryDepthObservabletype:LessEqBound
SiteConstraintpartition:FreeRankObservabletype:LessEqBound
AffineConstraintobservable:ValueModObservabletype:AffineEqualBound

Each kind's parameters are passed via BoundArguments. The legacy property triples are retained on BoundConstraint for ergonomic access (modulus, residue, hammingBound, minDepth, maxDepth, etc.):

PropertyStored onRangeDescription
modulusBoundConstraintxsd:positiveIntegerThe modulus m (residue / affine kinds)
residueBoundConstraintxsd:nonNegativeIntegerThe residue r
carryPatternBoundConstraintxsd:stringBinary carry pattern
minDepthBoundConstraintxsd:nonNegativeIntegerMinimum depth
maxDepthBoundConstraintxsd:nonNegativeIntegerMaximum depth
composedFromConjunctionBoundConstraintComponent constraints

Metric Axes

Every constraint operates along a MetricAxis, classified by its geometric effect. The three axes form the tri-metric coordinate system of UOR:

IndividualDescription
verticalAxisRing/additive: residue classes, divisibility
horizontalAxisHamming/bitwise: bit positions, carry patterns
diagonalAxisIncompatibility: the gap between ring and Hamming

The property metricAxis assigns each constraint to its axis. The property crossingCost records how many axis boundaries a constraint must traverse.

Site Pinning

The property pinsSites declares which SiteIndex instances a constraint pins when applied. A Conjunction pins the union of sites pinned by its components.

Example: Residue + Depth

In v0.2.2 Phase D, both kinds are BoundConstraint instances. The Rust call-site syntax stays compatible via the type aliases:

use uor_foundation::enforcement::{ResidueConstraint, DepthConstraint};
let odd = ResidueConstraint::new(2, 1);
let shallow = DepthConstraint::new(0, 2);

The Turtle representation uses the parametric form:

<https://uor.foundation/instance/constraint-odd>
    a                   type:BoundConstraint ;
    type:boundObservable observable:ValueModObservable ;
    type:boundShape      type:ResidueClassBound ;
    type:boundArguments  "modulus=2;residue=1" ;
    type:metricAxis      type:verticalAxis .

<https://uor.foundation/instance/constraint-shallow>
    a                   type:BoundConstraint ;
    type:boundObservable derivation:DerivationDepthObservable ;
    type:boundShape      type:LessEqBound ;
    type:boundArguments  "min_depth=0;max_depth=2" ;
    type:metricAxis      type:verticalAxis .

Each constraint pins specific sites tracked by the FreeRank — see Free Rank for how pinned sites accumulate toward resolution closure.