Skip to content

Commit 7a023a4

Browse files
claudehyperpolymath
authored andcommitted
docs: ADR-0007 (addition-only mandate + Echo reversibility tiering) + STATE refresh
Durable capture of the 2026-06 design basis so it survives context loss. * docs/design-decisions/0007-…: records the core mandates re-affirmed in the 2026-06 sessions — - D1 addition-only is absolute (no ×, no primitive −; ×/÷ generated, not Data primitives); - D2 subtraction = REVERSE addition (not twos-complement, not a primitive) — flags the open `DataExpr.neg`-as-primitive tension; - D3 Turing-completeness via a Harvard block embedded in a von-Neumann host, both graftable as AOLD aspects (universal extender); - D4 computation = shortest-path-to-equality with Echo recording lineage (incl. cross-number-system routing); - D5 reversal is a fallback ladder: algorithmic (Safe) → residue/token (Neutral, Bennett) → Breaking; - D6 the additive algebra of a number system fixes its Echo tier: group→Safe, cancellative monoid→Neutral, idempotent monoid→Breaking (Echo's own join is idempotent — why Breaking is one-way; answers "a number system with no subtraction at all" = idempotent semirings). * .machine_readable/6a2/STATE.a2ml: reflect PR #26 (Lean repair + Echo structural type-system gate + root-cause Rust-CI revival), PR #27 (de-vacuation of 8 True-typed believeme theorems), ADR-0007, the reordered next-actions (governance hardening → number-system semantics → v2 (c) bridge → (b)), and the Int-only semantic-scope gap. https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742
1 parent c83786e commit 7a023a4

2 files changed

Lines changed: 193 additions & 8 deletions

File tree

.machine_readable/6a2/STATE.a2ml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
[metadata]
66
project = "julia-the-viper"
77
version = "0.0.1"
8-
last-updated = "2026-06-02"
8+
last-updated = "2026-06-13"
99
status = "active"
10-
session = "2026-06-02Proof repair complete; Echo Phase 2 design; build-truth CI fixes; documentation refresh"
10+
session = "2026-06-13PR #26 (Lean repair + Echo as structural type-system gate + root-cause Rust-CI fix) and PR #27 (de-vacuation of 8 True-typed believeme theorems) merged; ADR-0007 records the addition-only mandate + Echo reversibility tiering; governance-hardening + number-system-semantics + v2 (c) bridge queued"
1111

1212
[project-context]
1313
name = "Julia The Viper"
@@ -37,23 +37,30 @@ milestones = [
3737
"Lean 4 proof repair — COMPLETE (2026-06-02): all 5 libraries compile; zero sorry; JtvCore/Theorems/Operational/Types/Security",
3838
"Idris2 ABI repair — COMPLETE (2026-06-02): Types.idr compiles; %default total; CanWiden extended; dataIsNeverControl proved",
3939
"Build-truth CI — COMPLETE (2026-06-02): patacl-core path dep removed; proof-regression.yml fixed; coverage/governance/language-policy CI clean",
40-
"Documentation refresh — COMPLETE (2026-06-02): README.adoc, EXPLAINME.adoc, STATUS.adoc, 6a2, contractiles updated to highest standards"
40+
"Documentation refresh — COMPLETE (2026-06-02): README.adoc, EXPLAINME.adoc, STATUS.adoc, 6a2, contractiles updated to highest standards",
41+
"Lean suite repair + Echo structural type-system gate — COMPLETE (PR #26): JtvEcho.neg_injective fixed; orphan JtvExtended wired into lakefile (8 libs build); Echo admissibility gates BOTH reverse{} and reversible{}->tok, checked structurally and before type inference; fixed a pre-existing failing reverse-block echo test",
42+
"Root-cause Rust CI fix — COMPLETE (PR #26): rust-ci.yml + coverage.yml startup-failed since ~2026-05-27 (hashFiles() invalid in a job-level if:); un-gated → Rust build/fmt/clippy/test (3-OS matrix) + coverage now actually run; cleared a hidden clippy lint; pinned coverage upload-artifact; added timeout-minutes across workflows; pinned *.jtv/*.pata to eol=lf",
43+
"Proof honesty: believeme de-vacuation — COMPLETE (PR #27): 8 True-typed vacuous theorems (incl. string_not_executable, confluence) replaced with real compiled statements; NO-VACUITY invariant + Int-only semantic-scope recorded in PROOF-CAPABILITY-MATRIX.adoc; 0 sorry/admit/axiom AND 0 True-typed theorems",
44+
"ADR-0007 addition-only mandate + Echo reversibility tiering — COMPLETE (2026-06-13): addition-only absolute; reverse-addition (not 2s-complement/not primitive); Harvard-in-von-Neumann AOLD insertability; shortest-path-to-equality + Echo lineage + cross-system routing; group/cancellative/idempotent → Safe/Neutral/Breaking tiering"
4145
]
4246

4347
[blockers-and-issues]
4448
issues = [
4549
{ id = "gap-001", description = "Verification chain incomplete: proofs validate models but not wired to Rust interpreter", severity = "medium", status = "known" },
4650
{ id = "gap-002", description = "typing_coercion in JtvTypes.lean weaker than docstring — proves existence not coercion to target type", severity = "low", status = "known", follow-up = "ADR needed" },
4751
{ id = "gap-003", description = "Coprocessor implementation gated on PataCL Phase 1", severity = "medium", status = "external-dependency" },
48-
{ id = "gap-004", description = "Reversibility round-trip not guaranteed end-to-end at integration level", severity = "medium", status = "known" }
52+
{ id = "gap-004", description = "Reversibility round-trip not guaranteed end-to-end at integration level", severity = "medium", status = "known" },
53+
{ id = "gap-005", description = "Semantic model is Int-only: the 7 number systems are typed but stated-unproven at the value level; type_preservation mechanised only for τ=int (see ADR-0007 D6 + PROOF-CAPABILITY-MATRIX.adoc)", severity = "medium", status = "known", follow-up = "number-system-semantics work" }
4954
]
5055

5156
[critical-next-actions]
5257
actions = [
53-
"PataCL Phase 1 → unblocks JtV coproc implementation Phase 2",
58+
"Governance hardening (branch claude/jtv-governance-hardening): pin governance-reusable@main → SHA (consistent with sibling standards reusables); add secret-scanner.yml wrapper (standards reusable exists at 524523c); add 'actions' language to codeql.yml; harden proof-regression download-then-run; NOTE the reusable-call-job missing-timeout Hypatia findings are false-positives (timeout-minutes is invalid on reusable-call jobs)",
59+
"Number-system semantics (ADR-0007 D6): value model for the 7 systems + per-system additive-algebra → Echo-tier classification; keep addition-only (×/÷ generated, not primitive); lift type_preservation beyond τ=int",
60+
"v2 (c) token/residue neutral-reversal bridge (ADR-0007 D5 Neutral tier): JtvEcho admissibleWithResidue + Neutral-recoverable-given-token theorem; typechecker reversible{}->tok admits Neutral; runtime residue in reversible.rs (or documented conservative scope)",
61+
"Echo as first-class function effect ('(b)') — after (c) stabilises",
5462
"Verification bridge: correlation tests between Lean semantics and Rust interpreter",
55-
"Echo Phase 3: residue availability and audit trail implementation",
56-
"Reversibility round-trip guarantee: integration-level property test"
63+
"PataCL Phase 1 → unblocks JtV coproc implementation Phase 2"
5764
]
5865

5966
[maintenance-status]
@@ -70,11 +77,16 @@ sessions = [
7077
{ date = "2026-04-27", subject = "C2 reversibility: reversible { } -> tok / reverse tok / abandon tok; ReversalToken(u64) opaque-ID token store; token linearity; typechecker + cli sexpr arms; 5 C2 tests green; commit a6b9e83" },
7178
{ date = "2026-04-27", subject = "WASM extern-coproc bridge: list_coproc_decls on Interpreter + JtvWasm; register_coproc_impl wraps js_sys::Function via unsafe Send+Sync; Value<->JsValue helpers; 4 tests; commit 75be523 — all roadmap items complete" },
7279
{ date = "2026-06-02", subject = "Echo Phase 2 design: retained-loss lineage; EchoSafe/Neutral/Breaking; infer+@echo; 3-way numeric; JtvEcho.lean; ALIGNMENT-AFFINESCRIPT.adoc; spec §7/§12" },
73-
{ date = "2026-06-02", subject = "Build-truth: patacl-core path dep removed from workspace; [features] patacl = [] pure code feature; proof-regression.yml startup failure fixed; Lean 4 all 5 libs compile; Idris2 Types.idr compiles; CI governance/language-policy/deno-lint fixes; documentation refresh" }
80+
{ date = "2026-06-02", subject = "Build-truth: patacl-core path dep removed from workspace; [features] patacl = [] pure code feature; proof-regression.yml startup failure fixed; Lean 4 all 5 libs compile; Idris2 Types.idr compiles; CI governance/language-policy/deno-lint fixes; documentation refresh" },
81+
{ date = "2026-06-13", subject = "PR #26 merged: Lean suite repaired (JtvEcho.neg_injective; orphan JtvExtended wired in → 8 libs); Echo a structural type-system gate over BOTH reverse{} and reversible{}->tok (checked first, before type inference); fixed pre-existing failing reverse-block echo test; root-cause Rust-CI revival (rust-ci/coverage hashFiles-in-job-if startup failure since ~05-27); clippy lint cleared; workflow pins+timeouts; *.jtv/*.pata eol=lf" },
82+
{ date = "2026-06-13", subject = "PR #27 merged: de-vacuated 8 True-typed believeme theorems (string_not_executable, confluence, no_vulnerable_constructs, no_reverse_joinpoints, dataExpr_no_control, data_evaluation_secure, control_data_noninterference, rev_composition) into real compiled statements; NO-VACUITY + Int-only-scope recorded in capability matrix" },
83+
{ date = "2026-06-13", subject = "ADR-0007: addition-only mandate (absolute; ×/÷ generated, not primitive); subtraction = reverse addition (not 2s-complement/not primitive); Harvard-in-von-Neumann AOLD insertability; shortest-path-to-equality + Echo lineage + cross-system routing; additive-algebra → reversibility-tier (group→Safe / cancellative→Neutral / idempotent→Breaking; Echo's own join is idempotent)" }
7484
]
7585

7686
[design-artefact-locations]
7787
coproc-adrs = "docs/design-decisions/0001-0006-*.adoc"
88+
addition-only-mandate-adr = "docs/design-decisions/0007-addition-only-mandate-and-reversibility-tiering.adoc"
89+
proof-capability-matrix = "verification/PROOF-CAPABILITY-MATRIX.adoc"
7890
coproc-trajectories = ".machine_readable/COPROC-TRAJECTORIES.a2ml"
7991
v2-reversibility-design = "docs/language/DESIGN-JTV-V2-REVERSIBILITY.md"
8092
echo-alignment = "ALIGNMENT-AFFINESCRIPT.adoc"
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
// (MPL-2.0 is automatic legal fallback until PMPL is formally recognised)
3+
// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
5+
= ADR-0007: Addition-Only Mandate, Reverse Addition, and the Echo Reversibility Tiering
6+
Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
7+
:revdate: 2026-06-13
8+
:revnumber: 0.1
9+
:toc: left
10+
:sectnums:
11+
12+
[.lead]
13+
This ADR records the *core mandate* re-affirmed in the 2026-06 design
14+
sessions and the new unifying result that ties JtV's number systems,
15+
its reverse-addition semantics, and the Echo type lattice together: the
16+
*algebraic structure of a number system determines its reversibility
17+
tier*, and Echo is the bookkeeping of that tier. It is the durable
18+
basis for the planned number-system-semantics work and the v2
19+
token/residue ("(c)") reversal bridge. Capturing it here makes the
20+
basis survive any loss of conversational context.
21+
22+
== Status
23+
24+
*Decided / re-affirmed (2026-06-13).* Foundational; constrains all v2
25+
and number-system work. Does not supersede prior ADRs; it makes
26+
explicit an invariant that was always implicit and adds the
27+
reversibility-tier model. Source of truth for the items it states;
28+
where any other document disagrees, this ADR is right and the other is
29+
a bug (mirrors the capability-matrix discipline).
30+
31+
== Context
32+
33+
Across the 2026-06 sessions the proof suite was repaired and made
34+
honest (PR #26: Lean repair + Echo as a structural type-system gate +
35+
root-cause CI fix; PR #27: de-vacuation of eight `True`-typed
36+
"believeme" theorems — see `verification/PROOF-CAPABILITY-MATRIX.adoc`).
37+
That work surfaced design questions about how far v2 reversibility and
38+
multi-number-system support may go *without* eroding JtV's identity.
39+
The answers below are mandates, not preferences.
40+
41+
== Decision
42+
43+
=== D1 — Addition-only is absolute
44+
45+
All of the language is *addition-only*. There is **no multiplication
46+
primitive** and **no primitive subtraction**. This is a core mandate,
47+
not a default. It holds for every number system JtV traverses.
48+
49+
* Multiplication, division, and any higher operation are *generated*
50+
(e.g. via Control loops) — never Data primitives. "Addition + Control
51+
loops = Turing-complete; addition without loops = total" remains the
52+
spine.
53+
* `×`/`÷`, where admissible, are *inverse-structured* operations under
54+
the relevant algebra ("inverse multiplication or whatever"), not new
55+
Data-plane tokens.
56+
57+
=== D2 — Subtraction is REVERSE addition (not twos-complement, not a primitive)
58+
59+
Subtraction is the *reversal of an addition* — the `reverse` of `+`
60+
— recovered via the reverse/echo mechanism, **not** twos-complement
61+
bit manipulation and **not** a standalone operator. The mechanised
62+
model already reflects this: `RevOp.execBackward (addAssign x e)` is
63+
`σ x - eval e`, proved an inverse by `JtvTheorems.rev_forward_backward`
64+
under exactly the Safe condition `x ∉ e.freeVars`.
65+
66+
[NOTE]
67+
====
68+
*Open tension (flagged, to resolve in the number-system work):* the
69+
`DataExpr`/`Negate` (Lean `DataExpr.neg`) constructor still exists as a
70+
*primitive* in the AST. Under D2, negation/subtraction should be
71+
*generated by reversal*, not a Data primitive. Revisit whether `neg`
72+
stays, becomes reverse-only sugar, or is removed.
73+
====
74+
75+
=== D3 — Turing-completeness = a Harvard block embedded in a von-Neumann host; both are graftable (AOLD)
76+
77+
JtV achieves Turing-completeness by embedding a *Harvard block*
78+
(the Data/Control-separated, total, addition-only island) inside a
79+
von-Neumann host language. Crucially, *both* the addition primitive
80+
*and* the Harvard block are **insertable into other language grammars**
81+
as aspects — Aspect-Oriented Language Development (AOLD) — exactly as in
82+
v1. This is the "universal extender": injection-safety and totality are
83+
retrofitted into legacy grammars by grafting these aspects, not by
84+
rewriting the host. (See `JtvSecurity.AOLDGuarantee`,
85+
`no_control_to_data_flow`, and `no_reverse_joinpoints`.)
86+
87+
=== D4 — Computation is shortest-path-to-equality, with Echo as lineage
88+
89+
A result is reached by the *shortest addition-path to equality*. From
90+
`8` to `10`, the paths `8 + 2` and `8 - 6 + 4` both reach `10`; JtV
91+
takes `8 + 2` (shorter), and *Echo types record the lineage* of the
92+
path actually taken. The shortest path may *route through other number
93+
systems* (`x → … → z`, switching representation mid-path) when that is
94+
shorter; Echo then carries the *cross-system* provenance.
95+
96+
Consequence: number systems are not merely supported types — they are
97+
*path-optimisation spaces*, and Echo is the provenance of which spaces
98+
a computation traversed and what (if anything) was lost crossing them.
99+
100+
=== D5 — Reversal strategy is a fallback ladder (algorithmic, else step down)
101+
102+
Reverse "wherever possible" is *algorithmic*; where an algorithmic
103+
inverse is infeasible, *step down through lesser tiers of reversibility*
104+
rather than abandon it outright. This is precisely the Echo lattice read
105+
as a strategy:
106+
107+
* *Safe* — algorithmic, bijective reverse; no residue needed.
108+
* *Neutral* — reverse only *from retained lineage* (a residue / linear
109+
`ReversalToken`, Bennett-style). This is the v2 "(c)" bridge.
110+
* *Breaking* — no reverse even with lineage; forward-only.
111+
112+
=== D6 — The Echo tier of a number system is fixed by its additive algebra
113+
114+
The unifying result. The algebraic structure of a number system's
115+
"addition" determines, *a priori*, the best reversibility tier
116+
attainable in it:
117+
118+
[cols="1,2,2,1",options="header"]
119+
|===
120+
| Additive structure | Example | Reverse addition? | Echo tier
121+
122+
| Group | `ℤ` | always, algorithmic | *Safe*
123+
| Cancellative monoid | `ℕ` (`a+b=a+c ⇒ b=c`) | only *given the lineage/residue* | *Neutral*
124+
| Idempotent monoid | tropical / max-plus, lattices, `min`/`max`/`∪` | never, even with lineage | *Breaking*
125+
|===
126+
127+
Therefore "switching number system for a shorter path" (D4) also
128+
*switches reversibility tier*, and Echo records both the hop and the
129+
residue that a later reverse would require.
130+
131+
[NOTE]
132+
====
133+
*Self-reference / open challenge.* JtV's own Echo lattice
134+
`{Safe ⊑ Neutral ⊑ Breaking}` under join is itself an *idempotent*
135+
monoid (`join_idem` is a proved theorem) — so it has **no inverse**,
136+
which is *why* `Breaking` is one-way and you cannot "un-join" back to
137+
`Safe`. The standing question "is there a number system with no
138+
subtraction equivalent at all (not even reverse addition)?" is answered
139+
*yes* — any non-trivial idempotent additive structure (tropical
140+
semirings, lattices). In such systems the D5 ladder is *forced*: Safe
141+
is impossible, so one must keep a residue (Neutral) or accept Breaking.
142+
====
143+
144+
== Consequences
145+
146+
. *Number-system semantics work (next-but-one priority).* The Lean model
147+
is currently `Int`-only (`evalDataExpr : DataExpr → State → Int`);
148+
the seven systems are *typed* but `stated-unproven` at the value
149+
level, and `type_preservation` is mechanised only for `τ = int`. The
150+
semantics layer must (a) give each system a value model, (b) classify
151+
each by its additive algebra → Echo tier per D6, and (c) keep
152+
addition-only (D1) — `×`/`÷` generated, not primitive.
153+
. *v2 "(c)" bridge.* Implements the Neutral tier of D5: `reverse { }`
154+
stays Safe-only; `reversible { } -> tok` admits Neutral via the
155+
retained log/token (Bennett). Lean: extend `JtvEcho` with
156+
`admissibleWithResidue` + a "Neutral recoverable given its token"
157+
theorem mirroring `rev_forward_backward`. Runtime: `reversible.rs`
158+
must record/invert residue for Neutral, or the gate stays
159+
conservative with the scope documented.
160+
. *Revisit `DataExpr.neg`* per the D2 note.
161+
. *Identity preserved.* D1–D3 confirm v2/Echo do **not** erode JtV:
162+
injection-impossibility rests on `no_control_to_data_flow` + disjoint
163+
Data/Control types + data-inertness; the Data plane stays total,
164+
pure, addition-only; Echo is a third orthogonal axis living in
165+
Control's reverse blocks.
166+
167+
== References
168+
169+
* `verification/PROOF-CAPABILITY-MATRIX.adoc` — authoritative proof status.
170+
* `jtv_proofs/JtvEcho.lean` — Echo lattice + admissibility (impl-semantics source of truth).
171+
* `jtv_proofs/JtvTheorems.lean` — `rev_forward_backward`, totality, flow separation.
172+
* `jtv_proofs/JtvSecurity.lean` — `no_control_to_data_flow`, `no_reverse_joinpoints`, `AOLDGuarantee`.
173+
* PRs #26 (proof repair + structural Echo gate + CI root-fix), #27 (believeme de-vacuation).

0 commit comments

Comments
 (0)