constraint-theory-core
Exact geometric computation on discrete constraint manifolds.
What is Constraint Theory?
Constraint theory replaces floating-point arithmetic with operations on discrete mathematical manifolds. Values are "snapped" to exact points (like Pythagorean triples) rather than approximated as floats. This provides:
- Zero drift — snap operations are exact by construction
- Provable correctness — snapped values satisfy algebraic identities (a²+b²=c²)
- Deterministic — same input always produces same output, regardless of hardware
Features
| Feature | Description |
|---|---|
PythagoreanManifold |
Generate and query primitive Pythagorean triples |
AdaptiveTolerance |
ε(c) = k/c — adaptive tolerance for sparse boundary regions |
FixedTolerance |
Constant tolerance for backward compatibility |
HolonomyMeter |
Closed-loop displacement measurement |
SnapReport |
Per-snap diagnostics (distance, time, resolution, tolerance) |
ConstraintSurface |
Object-safe trait for multi-manifold composition |
MultiManifold |
Compose multiple constraint surfaces with conflict resolution |
Quick Start
use ;
let config = medium;
let manifold = new;
// Snap a value to the nearest Pythagorean triple
let report = manifold.snap?;
println!; // (3, 4, 5)
println!;
Holonomy Measurement
use ;
let manifold = new;
let meter = new;
let result = meter.holonomy_loop?;
println!;
println!;
Multi-Manifold
use ;
let surface = Boxnew;
let multi = new;
Architecture
TolerancePolicy (trait)
├─ AdaptiveTolerance (ε = k/c)
└─ FixedTolerance (ε = constant)
PythagoreanManifold
├─ snap() → Result<SnapReport, SnapError>
└─ hint_region()
HolonomyMeter
├─ holonomy_loop() → HolonomyResult
└─ survey()
ConstraintSurface (trait)
├─ PythagoreanSurface (adapter)
└─ MultiManifold (composition)
License
MIT