Deterministic manifold snapping — maps continuous vectors to exact Pythagorean coordinates
Project description
constraint-theory
Deterministic manifold snapping — maps continuous vectors to exact Pythagorean coordinates.
Part of the PLATO framework — deterministic AI knowledge management through tile-based architecture.
For the high-performance Rust implementation, see constraint-theory-core on crates.io.
Installation
pip install constraint-theory
Usage
from constraint_theory import PythagoreanManifold, find_pythagorean_triples
m = PythagoreanManifold(density=100)
# Snap continuous vector to exact Pythagorean coordinates
point = m.snap((1.414, 0.707))
print(point) # (3, 1) — on 3^2 + 1^2 = 10
# Verify it's a real Pythagorean triple
print(m.is_pythagorean(3, 1)) # True
# Zero drift — snap the same vector a million times, always the same result
print(m.drift_test(10000)) # 0.0
# Generate all triples up to max_side
triples = find_pythagorean_triples(100)
print(len(triples)) # 52 distinct triples
The Core Insight
Float arithmetic drifts. After 1 billion operations, float error reaches 29,666.
Constraint theory trades continuous precision for discrete exactness. By snapping vectors to Pythagorean coordinates — points where a² + b² = c² exactly — we get:
- Zero drift: Same input, same output, every machine, every time
- 4% faster: 9,875 vs 9,433 million vector operations per second
- 93.8% perfectly idempotent: Worst-case drift bounded at 0.000112
- 2,780 distinct directions in 2D with sides < 1000 (11.4 bits of precision)
Zero external dependencies. Compatible with Python 3.8+.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file constraint_theory-0.1.0.tar.gz.
File metadata
- Download URL: constraint_theory-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4164a7c526a69fce62e92b9b1146e53e257d38f4a6b322e7142acb17e918c9
|
|
| MD5 |
6492a97ac53342a4e8a2031de893c225
|
|
| BLAKE2b-256 |
fcc32f58af7db7527723dde38b34748089f3edcc7d020cdfe505bcbb1202f3ed
|
File details
Details for the file constraint_theory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: constraint_theory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
894d811286df57fb03f3cbe869cdfe50e90b5f8775a27618d66a6773e0e0a120
|
|
| MD5 |
6f5a12ea91a2f87b759eac646e257a05
|
|
| BLAKE2b-256 |
1428e2eed5d28b2ee4ec5b01592e623a6d63f3cbac734df547e888a797256367
|