(imagine you hit your head really hard and nothing quite makes sense anymore before continuing too deep into this one)
Programs as Sheaf Sections
A Prolog-based language where programs are local sections over a context space. Composition isn't guaranteed - it produces measurable defect (Δ).
ergo =
- Latin "therefore" (logical consequence)
- Greek "ergon" (work, energy - computation has thermodynamic cost)
- Ergonomics (human-centered symbolic manipulation)
Contexts carry tags - sets of atoms that define their topological location.
section physics [energy, classical] { !c(299792458). }
section quantum [energy, planck] { !c(1). }
- Open sets = subsets of the tag universe
- Overlap = tag intersection: physics ∩ quantum = {energy}
- Neighborhood = contexts with non-empty tag overlap
When sections disagree on shared topics, gluing produces structured defect:
Δ = [clash(c(299792458), c(1))]This is NOT a float. You know what disagrees, not just that something does.
| Charge | Meaning |
|---|---|
! |
assert - add fact to local section |
? |
observe - IRREVERSIBLE, cuts backtracking |
~ |
explore - REVERSIBLE, creates choice points |
& |
unify - attempt unification, record clash on failure |
The key innovation: ? is a cut.
section schrodinger [quantum] {
~cat(alive).
~cat(dead).
}
?cat(X). % X = alive, CANNOT backtrack to get dead
Once you observe, the universe has chosen. This resolves the conflict between Prolog's backtracking and thermodynamic irreversibility.
Rigidity (ρ) controls merge behavior:
- Low ρ (< 0.3): Fluid - merges succeed, defect accumulates
- High ρ (> 0.7): Solid - merges FAIL on clash (shatter)
section math [numbers] (rho=0.9) { !pi(3.14159). }
section indiana [numbers] (rho=0.9) { !pi(3.2). }
combined <- math =>> indiana.
% throws: shatter([clash(pi(3.14159), pi(3.2))])
# Requires SWI-Prolog
swipl ergo.pl
# Or run a file
swipl ergo.pl examples/topology.ergo:help - show help
:ctx - show current context
:delta - show structured defect
:clear - clear context
:quit - exit
ergo> !speed(100).
ergo> !mass(50).
ergo> ?speed(X).
X = 100
ergo> :delta
Structured Defect (Delta):
(none)
ergo> !speed(200).
ergo[Δ=1]> :delta
Structured Defect (Delta):
clash(speed(100), speed(200))
examples/topology.ergo- Tag-based overlap demonstrationexamples/collapse.ergo- Irreversible observation (? vs ~)examples/shatter.ergo- High rigidity failure mode
What ergolang v0.2 is NOT:
- A full sheaf theory implementation (no actual cohomology computation)
- Quantum computing (inspired by, not implementing)
- Production-ready (it's executable metaphysics)
What it IS:
- A concrete experiment in defect-as-data
- A demonstration that
?and~can have different reversibility - A language where topology matters for composition
- Unification = local coherence (most general unifier)
- Backtracking = reversible exploration (superposition)
- Cut = irreversible observation (wave collapse)
- DCG = elegant parsing
- Terms = natural representation for clashes
"the semantics of spw constructs are substantially non-functorial"
Classical composition preserves structure (functorial). Ergolang measures how much composition fails to preserve structure. The failure is data.
Related concepts:
- Čech cohomology: Obstructions over open covers
- Non-commutative geometry: When composition depends on path
- Contextual semantics: Meaning depends on tag-neighborhood
MIT