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
ResidueConstraintMembership in a residue class: x = r (mod m)
CarryConstraintCarry propagation pattern in ring arithmetic
DepthConstraintBounds on factorization depth
CompositeConstraintComposition of two or more simpler constraints

A ConstrainedType links to its constraints via hasConstraint.

Constraint Properties

Each constraint kind has specialized parameters:

PropertyDomainRangeDescription
modulusResidueConstraintxsd:positiveIntegerThe modulus m
residueResidueConstraintxsd:nonNegativeIntegerThe residue r
carryPatternCarryConstraintxsd:stringBinary carry pattern
minDepthDepthConstraintxsd:nonNegativeIntegerMinimum depth
maxDepthDepthConstraintxsd:nonNegativeIntegerMaximum depth
composedFromCompositeConstraintConstraintComponent 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 CompositeConstraint pins the union of sites pinned by its components.

Example: Residue + Depth

<https://uor.foundation/instance/constraint-odd>
    a               type:ResidueConstraint ;
    type:modulus     "2"^^xsd:positiveInteger ;
    type:residue     "1"^^xsd:nonNegativeInteger ;
    type:metricAxis  type:verticalAxis .

<https://uor.foundation/instance/constraint-shallow>
    a               type:DepthConstraint ;
    type:minDepth   "0"^^xsd:nonNegativeInteger ;
    type:maxDepth   "2"^^xsd:nonNegativeInteger ;
    type:metricAxis  type:verticalAxis .

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