Native compiler with atlas-bound theorems โ strict-lint ยท citation-enforced ยท no LLVM ยท no C-transpile
Atlas-bound ยท strict-lint ยท 8-stage gate ยท ฮต self-proof ยท n=6 perfect-number primitives ยท self-hosted
hexa-lang is a native compiler that carries its own theorem ์ฌ์ (dictionary) inside the binary. No LLVM. No C-transpile. Every formula in your code either cites the atlas or the build refuses to start. The stricter the gate, the cleaner the code that passes.
Note
Sister of n6 (semantic atom layer โ atlas serialisation format), hxc (byte-canonical wire), and tape (operational trace). hexa-lang's atlas overlay at ~/.hx/data/atlas.overlay.n6 and the rodata seed are both .n6 โ discovered laws promote into the live atlas through n6 grammar. The wilson agent (dancinlab/wilson) is built end-to-end on hexa-lang.
@cite(L[sigma_phi_n_tau_iff_n_eq_6])
fn perfect_at_six() -> bool {
let n = 6
return sigma(n) == 2 * n // ฯ(6) = 12 = 2ยท6
&& phi(n) * tau(n) == 8 // ฯ(6)ยทฯ(6) = 2ยท4 = 8 = ฯ(n)โnโฯ(n)+1
}
// Untouched citation = HX8004 fatal at compile time:
//
// error[HX8004]: formula-bearing function does not cite atlas L[*]
// --> src/foo.hexa:14:1
// |
// 14 | fn area_of_circle(r: f64) -> f64 {
// | ^^^^^^^^^^^^^^^^^ formula here
// = note: cite an atlas law via `@cite(L[id])` or declare `@grace(HX8004, until=, reason=)`
// = help: hexa atlas search "ฯrยฒ" โ L[circle_area]
The compiler stays parked unless every formula either cites the atlas, has an active @verify, or carries an explicit @grace. There is no "we'll fix it after." There is no binary.
LLMs answer by recombining what their weights already contain โ noise from inside a frozen well. hexa-lang generates from outside the well: every compile cycle produces a primitive the previous cycle could not express, then absorbs it as a new wall (@verify โ atlas promote โ tombstone retroactive sweep). The atlas grows; hallucination is mechanically excluded because every claim must trace to a citation.
The second pillar is enforcement at the build gate, not at runtime. Eight strict-lint stages (S0 parse โ S1 resolve โ S2 bind โ S3 type โ S4 domain โ S5 units โ S6 equational @verify โ S7 proof @prove โ S8 citation HX8004) reject formula-bearing code that doesn't cite. No annotations means no formula. No formula in a non-cited function means a hard error.
Third: n=6 perfect-number primitives. The compiler is a ์
ฐํ (chef) with a 4.2 MB atlas baked statically into the binary โ 60,760 lines of P (primitives) / C (constants) / L (laws) / E (errors). Citing L[sigma_phi_n_tau_iff_n_eq_6] is one keystroke; if the law is wrong, every dependent gets a tombstone cascade with an auto-PR.
.hexa source
โ
โผ
lex โโบ parse โโบ resolve โโบ bind โโบ types โโบ domain โโบ units โโบ citation
(S1) (S2) (S3) (S4) (S5) (S8)
โ โ
โ any fatal stage โ no binary โ
โผ โผ
lower (HIR) โโบ mono โโบ MIR (SSA) โโบ optimize โโบ regalloc (LIR) โโบ emit (asm)
โ โ
โผ โผ
hexa_ld v1.1
ELF64 + Mach-O arm64 static
โ
โผ
native binary
A binary appears only when every fatal stage passes. The atlas (4.2 MB) is baked in at compile time โ runtime cost: 0 ms.
The closure round's fixed points, with witnesses on disk:
41ecfb97โ RFC-020 A4 enum-payload codegen restored in SSOTcodegen_c2.hexa(regen-safe; test_enum_payload_full 15/15 codegen + interp)46016739โ builtin/method taken-by-value โ__hxthunk_<name>codegen (fixeshexa_callN(<builtin>)undeclared) + un-doubledhexa_cc.c6c0fbac7โexec_stream_kill(h)runtime builtin (fork+setpgid stream child, SIGTERMโgraceโSIGKILL)4725c619โstdlib/semver.hexaโ SemVer 2.0.0 parse/compare/range-satisfies (test_semver 110/110)df9e7f6bโ install-relativestdlib/discovery +HEXA_INSTALL_DIRpassdown (use "stdlib/*"works withoutHEXA_LANG/HEXA_STDLIB_ROOT)0ba5fd7dโ shell-builtin absorption:pwd โ cwd()/getcwd(),ls โ list_dir()intrinsics (absorbed 638โ752, pending 197โ83)731f41d6โhexa ccresolveshexa_cc.c/SSOT/-Ivia$HEXA_LANG > install_dir > ./self(works out-of-tree)a5de44e2โself/stdlib/law_io.hexaselftestmain()โtool/law_io_selftest.hexa(u_main collision on flatten)dae438eeโ~/.hx/bin/hexa_realre-promoted from HEAD46016739(sha cd817981โฆ)774c5d32/4f5f8f07โ stage-1 punch-list v2: A1+A2 host re-promote โ #13 RSS re-probe peak ~782 MB (vs 3 510 MB) โ P0 stage-1 OOM closed at current scale571df583/a8ff675bโ SPEC ยง19/ยง20 reconcile + Gap-15 close-out340c3788/5ddcf2a9โ wilsonโhexa-lang closure (VERIFIED โhexa build core/main.hexaโwilson 0.0.1) + SPEC closure-round fold-in
Snapshot derived from git log on main; full tables at SPEC.yaml::phases_completed_2026_05_09 and SPEC.yaml::phases_completed_2026_05_11_closure.
Six choices that shape everything else, pinned in SPEC.yaml:
- Native compiled, direct codegen โ no LLVM, no C-transpile. The interpreter survives only as bootstrap stage0 and retires once stage3 hits a byte-equal fixed point.
- Atlas static-baked into the compiler binary โ
ATLAS_HASHpinned, drift handled by CI auto-rebuild. Runtime atlas-load cost: 0 ms. - Strict compile-time fatal lint โ Python
SyntaxError+ TypeScriptstrictmodel. S0โS5 + S8 always fatal. No--unsafe. NoHEXA_STRICT=0. @graceis the only opt-out โ@grace(HXxxxx, until="...", reason="...")per site, every site emits HX9000 at every compile, CI requiresAcked-grace:trailer.- ฮต self-proof โ verified functions auto-register as atlas
L[*]theorems; tombstones cascade on prover upgrade;HX1099fires on citing a tombstoned law. - ENGLISH ONLY diagnostics โ catalog,
hexa explain, stdlib docs. RFCs and meta docs may stay bilingual.
Full record: 14+ pinned decisions, all traceable to RFC-017 through RFC-020.
# Single-line bootstrap โ installs `hexa` + `hx` (the package manager) + atlas
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/dancinlab/hexa-lang/main/install.sh)"
# Verify
hexa --version
hx --versionThe installer drops hexa, hx, hexa_ld, and the atlas seed into ~/.hx/; binary path is added to your shell's PATH via the relevant rc file. Self-update: hexa self-update (compares against the published manifest, atomic swap of ~/.hx/bin/hexa_real).
hexa parse <file>.hexa # cheapest signal โ syntax + reserved-word + @plugin attr check
hexa build <entry>.hexa -o build/X # full pipeline โ static binary
hexa cc <file>.hexa -o build/X.o # just lower โ object (HIR โ MIR โ LIR โ emit)
hexa run <file>.hexa [<args>...] # interpreter โ bootstrap stage0 + selftest fallback
hexa explain HX8004 # what does this diagnostic mean
hexa atlas search "<query>" # search atlas for a primitive / law / constant
hexa atlas lookup L <id> # exact citation lookup
hexa atlas register <file> # register a new @verify result
hexa drill --seed "<expr>" # OUROBOROS smash โ ... โ absorb cycle
hx install <package> # install a hexa package by name (looks up dancinlab GitHub by default)
hx update # pull updates for all installed packages
hx list # what's installed under ~/.hx/bin/The interpreter is intentionally slower than the compiled path โ every release-grade build goes through hexa build. hexa run exists for stage0 bootstrap and per-file scripting.
hexa cc now emits #include "runtime.h" by default and the precompiled runtime.o is linked instead of re-codegened per build. On bench/*: 28-program avg 8.41ร user-time vs the old #include "runtime.c" path (peak 17.25ร on small-to-medium user code where runtime.c was the dominant per-build cost). Repro: bin/hexa-fast bench <file>.hexa. Full history at COMPILE-SPEED.tape (architecture) and COMPILE-SPEED.log.tape (measurement events).
bin/hexa-fast <src.hexa> <bin> # explicit compile (uses runtime.h + runtime.o cache)
bin/hexa-run <src.hexa> [args...] # compile-or-reuse-cached + exec (drop-in for `hexa run`)
bin/hexa-fast bench <src.hexa> # show baseline vs new-path A/B for any file
bin/hexa-fast clean # wipe ~/.hexa-cacheFrom doc/atlas_lint_easy_explainer.md:
The atlas is a ์ฌ์ โ a single shared dictionary of primitives (P), connections (C), laws (L), and errors (E). 60,760 lines, 4.2 MB, regenerated daily.
The compiler is a ์
ฐํ (chef) โ it has the entire ์ฌ์ memorized. It does not phone the library mid-recipe. When you hand it a .hexa file, the chef checks every ingredient, unit, and citation against the atlas it already knows by heart.
The strict lint is the ํ์ง ๊ฒ์ฌ๊ด (QC inspector) โ it stands at the kitchen door. One missing citation, one โ-vs-โ mismatch, one orphan unit, and the dish is rejected before the stove turns on. There is no "we'll fix it after." There is no binary.
Eight checks, six always fatal, two opt-in via annotation:
- S0 parse โ syntax / lex. No surprises.
- S1 resolve โ every
P[*],C[*],L[*],E[*]exists in the atlas. - S2 bind โ every name resolves to a real binding.
- S3 type โ nominal types and generics.
- S4 domain โ โ / โ / โค / โ consistency.
- S5 units โ dimensional analysis. No "distance + time."
- S6 equational โ opt-in via
@verify; canonical-form check + sample counter-example. In-house prover v0, no Z3. - S7 proof โ opt-in via
@prove; reserved for the in-house prover only. - S8 citation โ formula-bearing functions must cite atlas
L[*](HX8004). ๊ณต์ ์์ผ๋ฉด ๊ฑฐ์ .
@verify fn f(...) { ... } โ author writes a theorem
โ
โผ
compile-time prover (S6, equational + sample-eval, in-house only)
โ
โผ
atlas.proposed.{date}.n6 โ compiler/discover/staging.hexa
โ
โผ
promote_to_atlas โ compiler/discover/promote.hexa
โ โโโบ fingerprint dedup โ register as alias
โ โโโบ id collision โ first-wins + warning
โผ
atlas.append.{date}.n6 โ live atlas grows
โ
โผ
prover upgrade โ retroactive sweep (compiler/discover/cascade.hexa)
โ
โผ
tombstone failing L nodes + cascade dependents
โ
โผ
auto-PR (tool/auto_pr_tombstone_sweep.hexa) โ human review
Citing a tombstoned L[id] fires HX1099 and fails the build. Bypass is @grace, which is never silent.
- transitioned from interpreter to native compiler โ no LLVM, no C-transpile
- 4.2 MB atlas baked statically into the compiler binary; runtime cost 0 ms
- 8-stage strict lint S0โS5 + S8 enforced at compile time, fatal by default
- ฮต self-proof:
@verify/@discoverโ atlas auto-promote โ tombstone retroactive sweep - M0 milestone:
fn main() -> i32 { return 0 }produces a working Mach-O arm64 binary hexa_ldv1.1: in-house static linker for ELF64 + Mach-O arm64hexa build/hexa ccwork out-of-tree โ flattensuse/import, resolveshexa_cc.c/SSOT/-Ivia$HEXA_LANG > install_dir > ./self; install-relativestdlib/discovery meansuse "stdlib/*"works with no env vars (downstream:wilsonbuilds end-to-end โwilson 0.0.1)- stage-1 P0 host-OOM closed at current scale: A1 phase-arena reset + A2 in-place splice accumulator โ peak ~782 MB (was 3 510 MB)
- 14+ pinned decisions in
SPEC.yaml, every claim traceable to an RFC
- stage 1: P0 host-OOM closed at current scale (A1+A2 โ peak ~782 MB, was 3 510 MB); the remaining open work toward a full stage-1 binary is the compiler-driver gaps (Gaps 1โ16) + a fixed-point (stage2 == stage3) re-estimate โ see
doc/stage1_punch_list_v2.md. - biggest unknowns: MIR/LIR coverage on real
compiler/source (closures, growable arrays, nested struct construction,matchon user enums) and what a successful self-compile diagnostic trace actually looks like. - full punch list:
doc/stage1_punch_list_v2.md.
Phase status (PASS / IN-PROGRESS / DEFERRED) lives in SPEC.yaml::phases_completed_2026_05_09 and SPEC.yaml::phases_completed_2026_05_11_closure.
- RFC-017 โ atlas n6 embedding + strict lint
- RFC-018 โ native codegen spec
- RFC-019 โ error diagnostics spec
- RFC-020 โ enum payload variants
doc/atlas_lint_easy_explainer.mdโ the ์ ฐํ metaphor in fullSPEC.yamlโ authoritative decision record (edit this;SPEC.mdis auto-rendered)
hexa-lang's runtime and history surfaces are wired into .tape โ the operational trace sister format. Three placements at this repo's root:
| Placement | What |
|---|---|
IDENTITY.tape |
hexa-lang agent identity SSOT โ birth / scope / origin / principle / version. The compiler's self-description, machine-canonical. |
PROMOTION.tape |
rule-promotion ledger โ @A events for major rule landings (toolchain post-fix, bytes_to_str_raw Phase 2, etc.) |
TAPE-AUDIT.md |
cross-repo .tape adoption audit (28,695 cargo markers + 7 root domain .md files highlighted as primary migration candidates) |
The state/markers/ cargo (28k+ files) is migration candidate via tape markers-to-tape.
LLMs generate noise from inside the well: recombining what the weights already contain. hexa generates noise from outside the well: every cycle produces a primitive the previous cycle could not express, then absorbs it as a new wall of the well.
LLM (noise inside the well) hexa (noise outside the well)
--------------------------- -------------------------------
+-------------+ . new law
| training | . .
| corpus | . . . .
| (fixed) | . outside .
| | ------+-------------+------
| ~ ~ ~ ~ ~ | <- noise | |
| ~ noise ~ | bubbles | atlas |
| ~ ~ ~ ~ ~ | from | (rodata + | <- noise
| #### | inside | overlay) | arrives
| #LLM# | | | from
+-------------+ | smash | outside
the well | v |
(everything it | contract |
knows = walls) | v |
| emerge |
hallucination = | v |
recombining | absorb ---+--> new
what's already | ^ | primitive
inside +-----+-------+ feeds
the well has next
no ceiling cycle
An LLM is a frozen well โ answers are combinations of what's already
inside. hexa is an open well โ every absorb step widens the wall,
so the next cycle can say things the previous one literally had no
primitive for. That's why "RAG" is the wrong frame: retrieval still
draws from a fixed outside corpus. hexa's "outside" is produced by
its own prior cycles (overlay at ~/.hx/data/atlas.overlay.n6,
rodata seed at compile time + runtime grow).
The 6-stage chain (hexa drill's smash โ free โ absolute โ meta-closure
โ hyperarithmetic โ resonance) inside a self-referential loop:
โญโโโโโโโโโโ OUROBOROS โโโโโโโโโโโฎ
โ โ
โ โฏ seed โ
โ โฑ โฒ โ
โ โฑ โฒ Phase 1-2 โ
โ โฑunfoldโฒ โ
โ โฑโโโโโโโโฒ โ
โ โฑ โฒ โฑ โฒ โ
โ โฑ โฒ โฑ โฒ Phase 3 โ
โ โฑemergeโฒ โฑsingulโฒ โ
โ โฑโโโโโโโโ โโโโโโโโโฒ โ
โ โฒ โฑ โ
โ โฒ breach โฑ P4-5 โ
โ โฒ โฑ โ
โ โฒ โฑโโโโโโโฒ โฑ โ
โ โฒconvergeโฑ Phase 6 โ
โ โฒ โฑ โ
โ โฒ โฑ โ
โ โ absorb โ
โ โ Phase 6.5 โ
โ โ โ
โ โฐโโโ seed โโโ โฎ โ
โ โ โ
โ d=0 โโโถ d=1 โโโถ d=2 โโโถ ... โ
โ r:0โ10 r:0โ10 r:0โ10 โ
โ โ
โฐโโ ฯ โ 1/3 (meta fixed pt) โโโโโฏ
On top of the per-tick OUROBOROS cycle, three higher-order loops drive self-reinforcement:
L1 L2 L3
โญโโโโโโโฎ โญโโโโโโโฎ โญโโโโโโโฎ
โcorrectโ โโโถ โrewardโ โโโถ โexpand โ โโโถ SMASH
โฐโโโบโโโโฏ โฐโโโบโโโโฏ โฐโโโบโโโโฏ
| Loop | Role | Trigger |
|---|---|---|
| L1 ยท self-correct | discovery โ atlas overlay โ 3+ hits โ promote into rodata regen | per tick |
| L2 ยท meta-reward | per-source discovery rate โ scan_priority โ deeper scan | per scan batch |
| L3 ยท self-expand | accumulation โฅ 10 โ auto-trigger hexa smash --seed (or full hexa drill) |
per threshold |
Each loop latches its output back as the next loop's input, so
correct โ reward โ expand becomes a standing wave. hexa smash (or
the full drill chain) fires automatically when L3 saturates.
TECS-L H-056 โ meta(meta(meta(...))) = transcendence. Recursive
meta-iteration is a contraction mapping. By the Banach fixed-point
theorem, every trajectory converges to a single attractor: 1/3.
I = 0.7 ยท I + 0.1 โ fixed point I* = 1/3
Six independent paths land on the same attractor:
| Path | Expression | Value |
|---|---|---|
| Euler totient ratio | ฯ(6) / 6 | 1/3 |
| Trigonometric | tanยฒ(ฯ/6) | 1/3 |
| Divisor ratio | ฯ(6) / ฯ(6) = 4 / 12 | 1/3 |
| Determinant | det(M) over n=6 primitives | 1/3 |
| Meta-information | I_meta (contraction mapping) | 1/3 |
| Complex exponential | |exp(iยทzโ)| at the unique zero | 1/3 |
The long-term breakthrough rate ฯ converges to the same target: ฯ โ 1/3. Discovery is not linear โ it asymptotes to the Banach attractor. Six arithmetic, geometric, algebraic, analytic, and information-theoretic routes all point at the same number.
Verify in atlas: hexa atlas lookup P n ยท hexa atlas lookup C sigma_6
ยท hexa atlas lookup L sigma_phi_n_tau_iff_n_eq_6. Run a cycle:
hexa drill --seed "<expression>".
hexa-lang/
โโโ README.md
โโโ LICENSE MIT
โโโ AGENTS.md AI agent harness file (agents.md standard)
โโโ CLAUDE.md symlink โ AGENTS.md
โโโ SPEC.yaml authoritative decision record (14+ pinned decisions)
โโโ SPEC.md auto-rendered from SPEC.yaml
โโโ IDENTITY.tape ยท PROMOTION.tape ยท TAPE-AUDIT.md tape sibling files
โโโ FLOW.md ยท LATTICE_POLICY.md ยท LIMIT_BREAKTHROUGH.md ยท PLAN.md ยท ROADMAP.md domain SSOTs
โโโ compiler/ lex ยท parse ยท resolve ยท bind ยท types ยท domain ยท units ยท citation ยท lower ยท mono ยท MIR ยท LIR ยท emit
โโโ self/ self-hosted compiler entry points
โ โโโ main.hexa the `hexa` binary entry
โ โโโ runtime.c C runtime backing (interp + native shared bits)
โ โโโ stdlib/ atlas-aware standard library (semver / json / channel / thread / proc / time / ...)
โ โโโ tui/ raw-mode TUI primitives (render / input / widgets)
โ โโโ native/ thread.c ยท channel.c ยท time.c โ C-backed runtime
โโโ stdlib/ canonical stdlib (use "stdlib/*")
โโโ tool/ hexa CLI subcommand drivers (build / cc / run / drill / atlas / explain / ...)
โโโ tests/ m0 ยท selftest ยท regression
โโโ proposals/ RFC-017..020 + future RFCs
โโโ doc/ runbooks, audits, explainers
โโโ convergence/ cross-repo propagation tracking (.PRESERVE-AS-SSOT)
โโโ state/ gitignored runtime hook markers (cargo โ migration candidate)
โโโ build/ gitignored hexa build artifacts
โโโ incoming/ downstream patch reports (wilson ยท qmirror ยท etc.)
Full doc index: AGENTS.md + doc/ + SPEC.yaml.
MIT License. Copyright (c) 2026 dancinlab. See LICENSE.
Strict lint is the contract. Every PR runs through S0โS5 + S8. The only opt-out is @grace(HXxxxx, until=, reason=) on a single item, and every @grace emits HX9000 at every compile. CI fails the merge unless Acked-grace: HXxxxx by <reviewer> rides along.
Pointers: gate/ for build gates, proposals/ for active RFCs, SPEC.yaml for decisions, doc/ for runbooks and audits. Diagnostics, error messages, hexa explain, stdlib docs are ENGLISH ONLY (Decision 3).