Metadata-Version: 2.4
Name: constraint-theory
Version: 0.2.0
Summary: Exact geometric computation on Pythagorean constraint manifolds — snap, holonomy, and adaptive tolerance
Author-email: Forgemaster <forgemaster@cocapn.fleet>
License-Expression: MIT
Keywords: constraint-theory,pythagorean,manifold,snap,holonomy,exact-arithmetic
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"

# constraint-theory

Exact geometric computation on Pythagorean 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.

**Benefits:**
- **Zero drift** — snap operations are exact by construction
- **Provable correctness** — snapped values satisfy a²+b²=c² exactly
- **Deterministic** — same input, same output, any hardware

## Install

```bash
pip install constraint-theory
```

## Quick Start

```python
from constraint_theory import PythagoreanManifold, snap

# Generate a manifold of Pythagorean triples
m = PythagoreanManifold(max_c=10000)
print(f"Loaded {m.size} triples")

# Snap a float to the nearest triple
triple = snap(5.1)
print(triple)  # (3, 4, 5)
```

## Holonomy Measurement

```python
from constraint_theory import holonomy_loop

result = holonomy_loop(steps=100, max_c=10000, seed=42)
print(f"Displacement: {result.final_displacement:.6f}")
print(f"Angle drift: {result.total_angle_drift:.6f} rad")
```

## Adaptive Tolerance

```python
from constraint_theory import AdaptiveTolerance, FixedTolerance

adaptive = AdaptiveTolerance(k=1.0)
print(adaptive.epsilon(10.0))   # 0.1
print(adaptive.epsilon(100.0))  # 0.01

fixed = FixedTolerance(epsilon=0.05)
print(fixed.epsilon(100.0))     # 0.05
```

## License

MIT
