"Intention becomes calculation without loss."
FLUX is a constraint-native language where the constraint IS the computation. Variables aren't assigned — they're constrained. The Laplacian IS the type system. Conservation is enforced by the runtime.
In normal programming:
- You assign values to variables
- You check constraints after the fact
- Constraint violations are bugs
In FLUX:
- You declare constrained variables with domains
- You express conservation constraints
- The solver finds values that satisfy ALL constraints simultaneously
- Conservation guarantees satisfaction
Constraint Graph → Laplacian Matrix → Eigenvectors → Solution
↓ ↓ ↓ ↓
(variables) (structure) (conservation) (values)
The constraint graph's Laplacian encodes the structure of all constraints. The Fiedler vector (eigenvector for the second-smallest eigenvalue) gives the optimal partition of constraint space — the solution that maximizes conservation across all constraints.
cd flux-lang
pip install -e .
python -m flux_lang.repl # Interactive REPL
python examples/music_harmony.py # Music harmony example
python examples/scheduling.py # Scheduling example
python examples/circuit.py # Circuit design examplefrom flux_lang import FluxLang
flux = FluxLang()
flux.var("key", ["C", "G", "D", "F"])
flux.var("mode", ["major", "minor"])
flux.var("chord1", ["I", "IV", "V", "vi"])
flux.var("chord2", ["I", "IV", "V", "vi"])
flux.constrain("chord1.tension + chord2.tension < 1.5")
flux.constrain("key.signature preserves mode")
flux.constrain("chord1 → chord2 follows circle_of_fifths")
solution = flux.solve()
assert flux.verify(solution)| Type | Description |
|---|---|
tension |
Smoothness between successive values |
conservation |
A quantity is preserved through transformation |
smoothness |
Adjacent variables change gradually |
structure |
Structural pattern (e.g., circle of fifths) |
Given N variables each with a discrete domain, FLUX:
- Builds a constraint graph where edges encode pairwise constraints
- Constructs the graph Laplacian L = D - A
- Computes eigendecomposition of L
- The Fiedler vector gives the optimal solution in continuous space
- Projects back to discrete domains via nearest-neighbor snapping
- Verifies all constraints are satisfied (conservation check)
This is conservation-as-computation: the eigenvectors of the Laplacian are the modes that preserve the constraint structure.
github.com/SuperInstance/flux-lang
Part of the SuperInstance OpenConstruct ecosystem.