Skip to content

Commit 3f1ac20

Browse files
Jonathan D.A. Jewellhyperpolymath
authored andcommitted
chore(machine-readable): housekeeping checkpoint — refresh 6a2, add ANCHOR, fix bot_directives
Reconciles the repo's machine-readable metadata with the post-echo-types basis (PR #34, #36) and fixes accumulated template drift found in a structural audit. - 6a2/STATE.a2ml: was stale to 2026-02-12 ("begin lexer implementation"); now reflects the OCaml compiler + Lean metatheory + echo types + decidability + CI bootstrap, with the live milestone/next-action list. - 6a2/META.a2ml: record ADR-1..6 (Lean spec is source of truth; de Bruijn ctx; echo types intrinsic; decidability via infer; toolchain bootstrap; open echo value-shape fork). - 6a2/ECOSYSTEM.a2ml: real stack position + related projects; documents the echoClose-residue ↔ QuandleDB quandle-presentation seam. - anchors/ANCHOR.a2ml: NEW authoritative anchor (schema hyperpolymath.anchor/1), established on the echo-types realignment; golden path = lean oracle. - bot_directives/: NEW — fixes the dangling .bot_directives symlink (target never existed); directives for hypatia/gitbot-fleet/git-private-farm. - contractiles/README.adoc: corrected stale refs (trust/Trustfile.hs → trust/Trustfile.a2ml; lust/Intentfile → intend/Intentfile.a2ml) and noted the dual-representation / template-generation status. https://claude.ai/code/session_01PgHpCFzwYB7Qy9L6kmR8CE
1 parent cd3f401 commit 3f1ac20

7 files changed

Lines changed: 224 additions & 37 deletions

File tree

.machine_readable/6a2/ECOSYSTEM.a2ml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,29 @@
33
#
44
# ECOSYSTEM.a2ml — Tangle ecosystem position
55
[metadata]
6-
version = "1.0.0"
7-
last-updated = "2026-04-11"
6+
version = "1.1.0"
7+
last-updated = "2026-06-05"
88

99
[project]
1010
name = "Tangle"
1111
purpose = "A Turing-complete topological programming language where programs are isotopy classes of tangles"
12-
role = "specification"
12+
role = "semantic-core"
1313

1414
[position-in-ecosystem]
15-
category = ""
15+
category = "language / verified semantic core"
16+
summary = """Tangle is the semantic core of a four-layer federated stack:
17+
KRL (surface) → TangleIR (interchange) → Tangle core (this repo; Lean metatheory
18+
+ OCaml/Rust impl) → Skein.jl + QuandleDB (persistence/invariants). KRL and
19+
QuandleDB rest on Tangle's metatheory."""
1620

1721
[related-projects]
1822
projects = [
19-
# No related projects recorded
23+
"hyperpolymath/krl — KRL surface language; lowers to TangleIR (rests on Tangle's type safety). NOTE: repo currently half-instantiated from rsr-template (see checkpoint 2026-06-05).",
24+
"hyperpolymath/quandledb — consumes TangleIR via quandle_presentation(ir)::QuandlePresentation. SEAM: echoClose's residue is the pre-closure braid, exactly the data QuandleDB extracts the quandle from.",
25+
"hyperpolymath/Skein.jl — knot-theoretic database (Julia); persistence/invariants layer. No Julia development from the Tangle side.",
26+
"hyperpolymath/echo-types — reference theory for echo types (Echo f y := Σ(x:A), f x ≡ y). Tangle ships a simply-typed shadow as a type-system feature (TG-10).",
2027
]
28+
29+
[downstream-contract]
30+
conservative-extension = "Echo-type additions to Ty/Expr/HasType are conservative; prior theorems unchanged. Flag any change that surfaces in TangleIR."
31+
coordinate-with = ["quandledb session — echo residue → TangleIR threading"]

.machine_readable/6a2/META.a2ml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,29 @@
33
#
44
# META.a2ml — Tangle meta-level information
55
[metadata]
6-
version = "1.0.0"
7-
last-updated = "2026-04-11"
6+
version = "1.1.0"
7+
last-updated = "2026-06-05"
88

99
[project-info]
1010
license = "MPL-2.0"
1111
author = "Jonathan D.A. Jewell (hyperpolymath)"
1212

1313
[architecture-decisions]
1414
decisions = [
15-
# No ADRs recorded
15+
"ADR-1: The Lean 4 inductives (HasType, Step) in proofs/Tangle.lean ARE the formal spec; the OCaml compiler refines them (TG-3). Metatheory is the source of truth.",
16+
"ADR-2: Typing context is de Bruijn (Ctx = List Ty), so the core is ready for binders (let, TG-1) without renaming machinery.",
17+
"ADR-3: Echo types are intrinsic to the type system, not a bolt-on. `close : Word[n]→Word[0]` is the canonical lossy map; Ty.echo ρ τ is the simply-typed shadow of echo-types' Echo f y := Σ(x:A), f x ≡ y (hyperpolymath/echo-types). echoClose=echo-intro, lower=collapse, residue=witness. All four safety theorems cover it.",
18+
"ADR-4: Decidability is proved by an algorithmic `infer : Ctx → Expr → Option Ty` shown equivalent to HasType (infer_sound/infer_complete); yields type uniqueness + a Decidable instance (TG-2).",
19+
"ADR-5: Lean toolchain setup is a single source of truth (proofs/bootstrap-lean.sh): normal elan path on open networks, GitHub-asset fallback when release.lean-lang.org is off-allowlist (sandboxed/web). CI and the SessionStart hook both call it.",
20+
"ADR-6 (OPEN): echo value shape — uniform `echoVal (residue,result)` (faithful to Echo=Σ; reworks merged single-step capstones to Step*) vs per-operation lower/residue computation rules. Decision pending; gates the add/eq generalisation.",
1621
]
1722

1823
[development-practices]
1924
versioning = "SemVer"
2025
documentation = "AsciiDoc"
2126
build-tool = "just"
27+
proof-assistant = "Lean 4 (pinned leanprover/lean4:v4.14.0)"
28+
proof-discipline = "no sorry/axiom/admit (CI-enforced); every edit ends with a Lean compile"
2229

2330
[maintenance-axes]
2431
scoping-first = true

.machine_readable/6a2/STATE.a2ml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,53 @@
44
# STATE.a2ml — Tangle project state
55
[metadata]
66
project = "tangle"
7-
version = "0.1.0"
8-
last-updated = "2026-02-12"
7+
version = "0.2.0-dev"
8+
last-updated = "2026-06-05"
99
status = "active"
10-
session = "converted from scheme — 2026-04-11"
10+
session = "echo-types realignment + decidability + CI bootstrap — 2026-06-05"
1111

1212
[project-context]
1313
name = "Tangle"
14-
purpose = """A Turing-complete topological programming language"""
15-
completion-percentage = 35
14+
purpose = """A Turing-complete topological programming language whose core type
15+
system is mechanised in Lean 4. `close` (braid closure) is the canonical lossy
16+
map; echo types make that loss recoverable at the type level."""
17+
completion-percentage = 55
1618

1719
[position]
18-
phase = "specification-complete" # design | implementation | testing | maintenance | archived
19-
maturity = "experimental" # experimental | alpha | beta | production | lts
20+
phase = "implementation" # design | implementation | testing | maintenance | archived
21+
maturity = "alpha" # experimental | alpha | beta | production | lts
2022

2123
[route-to-mvp]
2224
milestones = [
23-
# No milestones recorded
25+
"DONE: OCaml compiler — lexer, parser, typecheck, eval, pretty, compositional (compiler/lib/*.ml)",
26+
"DONE: Rust tangle-wasm backend + tangle-lsp",
27+
"DONE (TG-0): proofs/Tangle.lean compiles clean; CI build oracle wired (lean-proofs.yml)",
28+
"DONE: Type safety (Progress/Preservation/Determinism/TypeSafety) for the let-free core",
29+
"DONE (TG-10): echo types integrated into the type system (Ty.echo, echoClose/lower/residue); all four theorems extended; residue-recovery + non-injectivity capstones",
30+
"DONE (TG-2): decidability — infer ≡ HasType, type uniqueness, Decidable instance",
31+
"DONE: reproducible Lean toolchain bootstrap (proofs/bootstrap-lean.sh) + SessionStart hook; CI consolidated onto it",
32+
"NEXT (TG-1): extend type safety to let-binding (full de Bruijn substitution)",
33+
"NEXT: generalise echo to add/eq (needs a product/residue type in Ty)",
34+
"NEXT: thread echo residue into TangleIR (coordinate with quandledb)",
35+
"NEXT: full OCaml echo pipeline (ast/typecheck/eval/parser/pretty)",
36+
"LATER (TG-3): OCaml typecheck.ml refines the Lean HasType spec",
37+
"LATER (TG-5/6/7): compositional rewriter preservation; WASM semantic preservation; braid-group eqBraids",
2438
]
2539

2640
[blockers-and-issues]
2741
issues = [
28-
# No blockers recorded
42+
"DESIGN (open, user): echo value shape — uniform `echoVal (residue,result)` (faithful to Echo=Σ, reworks merged capstones to multi-step Step*) vs per-operation lower/residue rules. Blocks the echo generalisation to add/eq.",
2943
]
3044

3145
[critical-next-actions]
3246
actions = [
33-
"Begin lexer implementation (Task 1 in SONNET-TASKS.md)",
34-
"Set up Rust project structure with cargo",
35-
"Complete lexer with mode switching",
36-
"Begin TANGLE parser (recursive descent)",
37-
"Complete parser + type checker",
38-
"Begin evaluator",
47+
"Resolve the echo value-shape design fork (A vs B), then add the product type",
48+
"TG-1: let-binding type safety via de Bruijn substitution",
49+
"Generalise echo to add/eq; thread residue into TangleIR with the quandledb session",
50+
"Extend the OCaml typechecker (typecheck.ml/ast.ml) with echo types",
3951
]
4052

4153
[maintenance-status]
42-
last-run-utc = "2026-02-12T00:00:00Z"
43-
last-result = "unknown" # unknown | pass | warn | fail
54+
last-run-utc = "2026-06-05T00:00:00Z"
55+
last-result = "pass" # unknown | pass | warn | fail
56+
notes = "lean-proofs oracle GREEN (PR #34, #36 merged); Tangle.lean 0 errors, no sorry/axiom/admit"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# ANCHOR.a2ml - authoritative anchor for this repository
5+
#
6+
# Established 2026-06-05 on the echo-types realignment: echo types became an
7+
# intrinsic feature of the Tangle type system (not external reference), the
8+
# safety metatheory was extended to cover them, and type checking was proved
9+
# decidable. This anchor records the post-realignment canonical baseline.
10+
11+
[metadata]
12+
version = "1.0.0"
13+
last-updated = "2026-06-05"
14+
15+
[anchor]
16+
schema = "hyperpolymath.anchor/1"
17+
repo = "hyperpolymath/tangle"
18+
authority = "upstream-canonical"
19+
20+
purpose = [
21+
"Define the canonical type-system semantics for the Tangle stack.",
22+
"Declare what downstream repos (KRL, QuandleDB) may extend but not redefine.",
23+
"Provide a stable golden path and invariant contract for proof/release readiness.",
24+
]
25+
26+
[identity]
27+
project = "Tangle"
28+
kind = "language"
29+
one-sentence = "Tangle — a Turing-complete topological (braid/tangle) programming language whose core type system is mechanised in Lean 4."
30+
domain = "knot-theory / topological computing"
31+
32+
[semantic-authority]
33+
policy = "canonical"
34+
35+
owns = [
36+
"Core type system: HasType (typing) and Step (small-step) inductives.",
37+
"Type-safety metatheory: Progress, Preservation, Determinism, Type Safety.",
38+
"Echo-types semantics: Ty.echo, echoClose/lower/residue (structured loss over `close`).",
39+
"Decidability of type checking: infer ≡ HasType.",
40+
"TangleIR semantics consumed by KRL (lowering) and QuandleDB (quandle extraction).",
41+
]
42+
43+
[realignment-log]
44+
events = [
45+
"2026-06-05 R1: echo types integrated into the type system (TG-10); all four safety theorems extended; echo-types audit verdict changed from NOT-RELEVANT to integrated feature.",
46+
"2026-06-05 R2: decidability landed (TG-2) — infer/HasType equivalence, type uniqueness, Decidable instance.",
47+
]
48+
49+
[implementation-policy]
50+
allowed = ["Lean4", "OCaml", "Rust", "Scheme", "Shell", "Just", "AsciiDoc", "Markdown", "Nickel"]
51+
forbidden = ["TypeScript", "Node.js", "npm", "Go", "Python", "Java", "Kotlin", "Swift"]
52+
53+
[golden-path]
54+
smoke-test-command = [
55+
"cd proofs && lean Tangle.lean",
56+
"just test",
57+
]
58+
59+
success-criteria = [
60+
"proofs/Tangle.lean reports 0 errors under the pinned toolchain",
61+
"No sorry/axiom/admit/Admitted outside comments (CI-enforced)",
62+
"Core tests pass; quality gates pass",
63+
]
64+
65+
[satellite-policy]
66+
must-pin-upstream = true
67+
must-declare-authority = true
68+
must-have-anchor = true
69+
must-have-golden-path = true
70+
71+
[semantic-authority-files]
72+
formal-proofs = "proofs/Tangle.lean"
73+
language-spec = "docs/spec/FORMAL-SEMANTICS.md"
74+
proof-narrative = "PROOF-NARRATIVE.md"
75+
proof-needs = "PROOF-NEEDS.md"
76+
build-proofs = "proofs/README.md"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath)
3+
= Bot directives — Tangle
4+
5+
Machine-readable directives for the hyperpolymath bot fleet operating on this
6+
repository (Hypatia governance/scan, gitbot-fleet, and the `.git-private-farm`
7+
automation). The repo-root `.bot_directives` symlink points here.
8+
9+
Until 2026-06-05 the `.bot_directives` symlink dangled (target did not exist);
10+
it was created during the echo-types realignment housekeeping checkpoint.
11+
12+
== Files
13+
14+
* `tangle.directives.a2ml` — the active directive set for bots on this repo:
15+
development branch, proof discipline, toolchain bootstrap, and cross-repo
16+
coordination notes.
17+
18+
== Authority
19+
20+
These directives are subordinate to `.machine_readable/anchors/ANCHOR.a2ml`
21+
(canonical semantics) and the contractiles (`MUST` / `TRUST` / `INTENT` /
22+
`ADJUST`). Where a directive conflicts with the anchor or a contractile, the
23+
anchor/contractile wins and the directive must be corrected.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# tangle.directives.a2ml — directives for the bot fleet on hyperpolymath/tangle
5+
[metadata]
6+
version = "1.0.0"
7+
last-updated = "2026-06-05"
8+
applies-to = ["hypatia", "gitbot-fleet", "git-private-farm"]
9+
10+
[development]
11+
# Where bots should develop. Never push to main directly.
12+
dev-branch = "claude/<session>"
13+
default-base = "main"
14+
pr-policy = "open as draft; CI must be green before ready-for-review"
15+
16+
[proof-discipline]
17+
# Tangle owns a real metatheory — these are hard gates.
18+
prover = "Lean 4"
19+
toolchain-pin = "proofs/lean-toolchain (leanprover/lean4:v4.14.0)"
20+
banned-tokens = ["sorry", "axiom", "admit", "Admitted"] # CI-enforced, outside comments
21+
rule = "every edit to proofs/ ends with: cd proofs && lean Tangle.lean (expect 0 errors)"
22+
oracle-workflow = ".github/workflows/lean-proofs.yml"
23+
24+
[toolchain-bootstrap]
25+
# Sandboxed/web environments cannot reach release.lean-lang.org.
26+
script = "proofs/bootstrap-lean.sh" # normal elan path + GitHub-asset fallback
27+
session-hook = ".claude/hooks/session-start.sh" # auto-bootstraps web sessions
28+
note = "Do NOT hand-roll elan installs; call the bootstrap script (single source of truth)."
29+
30+
[cross-repo-coordination]
31+
# Tangle is the semantic core; KRL and QuandleDB rest on its metatheory.
32+
downstream = ["hyperpolymath/krl", "hyperpolymath/quandledb"]
33+
tangle-ir = "Changes to Ty/Expr/HasType are conservative extensions; flag any that reach TangleIR (QuandleDB consumes it)."
34+
quandle-seam = "echoClose's residue is the pre-closure braid — exactly what QuandleDB extracts a quandle presentation from. Coordinate echo→IR threading with the quandledb session."
35+
echo-types = "hyperpolymath/echo-types is the reference theory (Echo f y := Σ(x:A), f x ≡ y); Tangle ships a simply-typed shadow as a type-system feature."
36+
37+
[no-go]
38+
# Do not develop these here.
39+
julia = "No Julia development in this repo (Skein.jl/QuandleDB own the Julia layer)."
40+
languages = "No TypeScript/Node/npm/Go/Python/Kotlin/Swift (see ANCHOR implementation-policy)."

contractiles/README.adoc

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
1-
= Contractiles Template Set
1+
// SPDX-License-Identifier: MPL-2.0
2+
= Tangle Contractiles
23
:toc:
34
:sectnums:
45

5-
This directory contains the generalized contractiles templates. Copy the `contractiles/` directory into a new repo to establish a consistent operational, validation, trust, recovery, and intent framework.
6+
The contractiles for this repository: a consistent operational, validation,
7+
trust, recovery, and intent framework. (Originally scaffolded from the RSR
8+
template; the file references below are corrected to the files actually
9+
shipped here.)
610

7-
== Fill-In Instructions
11+
== Contents
812

9-
1. Update the Mustfile to reflect your real invariants (paths, schema versions, ports).
10-
2. Replace Trustfile.hs placeholders with your actual key paths and verification commands.
11-
3. Adjust Dustfile handlers to match your rollback and recovery tooling.
12-
4. Update Intentfile to mirror the roadmap you want the system to evolve toward.
13+
* `must/Mustfile` — required invariants and validations.
14+
* `trust/Trustfile.a2ml` — trust / verification steps.
15+
* `dust/Dustfile` — rollback and recovery semantics.
16+
* `intend/Intentfile.a2ml` — future intent and roadmap direction.
1317

14-
== Contents
18+
NOTE: This repo also carries the S-expression companion set under
19+
`.machine_readable/` (`MUST.contractile`, `TRUST.contractile`,
20+
`INTENT.contractile`, `ADJUST.contractile`). The two representations coexist
21+
because tangle was scaffolded at an intermediate RSR-template generation; the
22+
canonical layout is being reconciled estate-wide (the template master, krl,
23+
has since relocated `contractiles/` *into* `.machine_readable/` and added
24+
`adjust/` + `bust/`). Until that reconciliation lands, treat
25+
`.machine_readable/*.contractile` as authoritative and the `contractiles/<name>/`
26+
tree as the human-readable mirror.
27+
28+
== Maintenance
29+
30+
Keep these in step with reality:
1531

16-
* `must/Mustfile` - required invariants and validations.
17-
* `trust/Trustfile.hs` - cryptographic verification steps.
18-
* `dust/Dustfile` - rollback and recovery semantics.
19-
* `lust/Intentfile` - future intent and roadmap direction.
32+
1. `must/Mustfile` — real invariants (proof discipline, paths, schema versions).
33+
2. `trust/Trustfile.a2ml` — actual key paths and verification commands.
34+
3. `dust/Dustfile` — rollback and recovery tooling.
35+
4. `intend/Intentfile.a2ml` — the roadmap (see `.machine_readable/6a2/STATE.a2ml`
36+
`route-to-mvp` for the live milestone list).

0 commit comments

Comments
 (0)