Skip to content

spwplace/ergolang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

(imagine you hit your head really hard and nothing quite makes sense anymore before continuing too deep into this one)

Ergolang

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 (Δ).

Etymology

ergo =

  • Latin "therefore" (logical consequence)
  • Greek "ergon" (work, energy - computation has thermodynamic cost)
  • Ergonomics (human-centered symbolic manipulation)

Core Concepts

Tags Define Topology

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

Structured Defect (Δ)

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.

Semantic Charges

Charge Meaning
! assert - add fact to local section
? observe - IRREVERSIBLE, cuts backtracking
~ explore - REVERSIBLE, creates choice points
& unify - attempt unification, record clash on failure

Irreversible Observation

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

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))])

Quick Start

# Requires SWI-Prolog
swipl ergo.pl

# Or run a file
swipl ergo.pl examples/topology.ergo

REPL Commands

:help   - show help
:ctx    - show current context
:delta  - show structured defect
:clear  - clear context
:quit   - exit

Example Session

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

  • examples/topology.ergo - Tag-based overlap demonstration
  • examples/collapse.ergo - Irreversible observation (? vs ~)
  • examples/shatter.ergo - High rigidity failure mode

Honest Limitations

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

Why Prolog?

  • Unification = local coherence (most general unifier)
  • Backtracking = reversible exploration (superposition)
  • Cut = irreversible observation (wave collapse)
  • DCG = elegant parsing
  • Terms = natural representation for clashes

Philosophical Background

"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

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages