Skip to content

Commit 09fd413

Browse files
hyperpolymathclaude
andcommitted
feat(experimental): echo-additive R2/R3 — graded carrier + φ monad line (all laws) + δ comonad line (vacuous on inert carrier; content-faithfulness obstruction parked)
EXPERIMENTAL — proofs/agda/experimental/echo-additive/ only. Author-authorised open of R2/R3 (2026-06-15). NOT for main merge: the merge gate's terminating-condition half is now met (case ii), but author merge-authorisation is still required. R-2026-05-18 retraction untouched; no shipped module edited or imported from here. R2 (GradedCarrier.agda): D : Grade -> Set -> Set, the ⊤-padded tower (D (fin 0)=Id, D inf=Top, D (fin (suc n)) = Top × ...). The additive signature admits only the payload-independent ⊤ layer K-free (Echo-comp-iso has no codomain map/base point to pin a non-trivial residue), so D (fin n) A ≅ A — information-inert, the carrier-side shadow of the variance finding. D-fin-+-split = the definitional additive shadow of Echo-comp-iso. R3 primary (GradedMonad.agda): laxator φ via Echo-comp-iso-from (combine/μ). Pentagon + left-unit + right-unit ALL discharged as real --safe --without-K proofs, zero parked, zero postulates. R3 secondary (GradedComonad.agda): colaxator δ via Echo-comp-iso-to (split). Coassoc + both counit laws discharge — but VACUOUSLY: D-fin-⊤-contr + δ-fin-inf-unique mechanise that the inert carrier makes δ's structure- manufacturing branch the unique inhabitant. The genuine variance obstruction is parked as the §7 OBLIGATION (no postulate): a content-faithful δ's fin/inf case is ⊤ -> Σ A, uninhabited for generic A, with no K-free term — δ would fail to type without a postulate, while μ never needs to invent. That asymmetry IS the variance finding, mechanised one level deeper than R1. Terminating condition: (ii) both-discharge (honest; predicted (i) holds only at the content-faithful level). Next discriminator (author-gated): the separate F_r ⊣ U_r adjunction on a content-faithful carrier. Firewalled (GradedMonad / GradedComonad do not import each other); both import only Grade + GradedCarrier + read-only Echo + stdlib. Design-panel (2 lenses) + 2 firewalled line mechanics + independent adversary (fresh recompile, planted- postulate negative control rejected, md5-pinned). STATE.adoc findings recorded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 44de47e commit 09fd413

4 files changed

Lines changed: 872 additions & 1 deletion

File tree

experimental/echo-additive/STATE.adoc

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
33
= Echo-Additive Experimental — Session State
44
:revdate: 2026-06-14
5-
:status: R1 resolved — comparative protocol active (2026-06-14)
5+
:status: R2+R3 built (2026-06-15) — both lines discharge on the inert carrier (terminating condition (ii)); the genuine variance obstruction is parked at the content-faithful level (GradedComonad §7). Author-authorised open of R2/R3 2026-06-15; NOT merged to main.
66
:session-guard: R-2026-05-18 do-not-reopen preserved
77

88
[IMPORTANT]
@@ -315,3 +315,78 @@ Deliverables at gate close:
315315

316316
No shipped module edited. No postulate introduced. R2 (per-grade degrade
317317
coherence in ℕ∪{∞}) is the next rung, gated on author return.
318+
319+
== R2 + R3 — findings (2026-06-15, author-authorised open)
320+
321+
Author authorised opening R2/R3 on 2026-06-15. Built design-panel (2 scope
322+
lenses) -> R2 carrier mechanic -> 2 firewalled R3 line mechanics -> 1
323+
independent adversary. Three new files, all `--safe --without-K` exit 0, zero
324+
postulates, zero holes (independently re-typechecked by the adversary on a
325+
fresh scratch tree; planted-postulate negative control rejected `[SafeFlagPostulate]`
326+
exit 42, so the clean exits are meaningful). NOT merged to main (HEAD f7a965f;
327+
3 untracked files; zero shipped edits; R-2026-05-18 retraction untouched).
328+
329+
=== R2 — `GradedCarrier.agda` (the ℕ∪{∞} carrier)
330+
331+
`D : Grade -> Set -> Set`, `D (fin 0) A = A` (= Id), `D inf A = Top` (= collapse),
332+
`D (fin (suc n)) A = Top × D-fin n A` — the **payload-independent ⊤-padded tower**.
333+
The R2 design question (what is a finite layer?) is answered by an *obstruction
334+
that is itself the finding*: instantiating `Echo-comp-iso` needs a codomain map
335+
`g` and base point `y` that the bare signature `Grade -> Set -> Set` does not
336+
supply; the only generic map is `id/id`, whose residue is doubly-contractible
337+
(refl-only). So the only K-free finite layer is the `⊤` factor, hence
338+
**`D (fin n) A ≅ A` for every finite n** — the grade counts layers, the layers
339+
carry no recoverable content. This information-inertness IS the carrier-side
340+
shadow of the R1 variance finding. The content-bearing alternative
341+
`Σ A (λ _ → …)` was rejected (it gives `A^((m+1)(n+1))`, which does not fuse with
342+
addition's `A^(n+m+1)`). Keystone: `D-fin-+-split m n : D-fin (m+n) A ≡ D-fin m
343+
(D-fin n A)` — the *definitional* additive shadow of `Echo-comp-iso`; φ reads its
344+
`sym` (combine), δ reads it forward (split).
345+
346+
=== R3 primary — `GradedMonad.agda` (laxator φ, the monadic μ direction)
347+
348+
`φ_{r,s} : D r (D s A) -> D (r +g s) A` via `subst id (sym (D-fin-+-split n m))`
349+
(the `Echo-comp-iso-from` / combine direction). **ALL THREE laws discharged as
350+
real proofs, ZERO parked**: pentagon (induction peeling the outer ⊤-layer),
351+
left-unit (refl), right-unit (genuine non-refl, via the UIP-free lemma
352+
`split0-is-coercion-proof`). Matches the variance-finding prediction that the
353+
monadic line is the natural fit.
354+
355+
=== R3 secondary — `GradedComonad.agda` (colaxator δ, the comonadic direction)
356+
357+
`δ_{r,s} : D (r +g s) A -> D r (D s A)` via the forward `D-fin-+-split`
358+
(the `Echo-comp-iso-to` / split direction). δ is total and coassociativity +
359+
**both** counit laws discharge clean — so by the *letter* of the terminating
360+
condition this is **(ii) both-discharge, NOT (i)**. BUT the line mechanises why
361+
this is **VACUOUS**: `D-fin-⊤-contr` proves every finite ⊤-tower over `⊤` is
362+
contractible, and `δ-fin-inf-unique` proves δ's structure-manufacturing `fin/inf`
363+
branch is the *unique* inhabitant — so the laws structurally cannot detect the
364+
invention. The genuine obstruction is preserved as the precisely-named, parked
365+
**§7 OBLIGATION** (35 comment lines, zero code, no postulate): on any
366+
*content-faithful* carrier (`D-fin-content (suc n) A = Σ A (λ _ → …)`), δ's
367+
`fin/inf` case becomes a total map `⊤ -> Σ A (…)`, **uninhabited for generic A**,
368+
with no K-free term — δ would *fail to type without a postulate*. The monad μ
369+
faces no such obligation (it only discards/fuses, never invents).
370+
371+
=== Terminating condition + reading
372+
373+
**(ii) both-discharge** — recorded honestly (the protocol's *predicted* (i) is
374+
correct only at the content-faithful level). The φ win is real but cheap (the
375+
carrier the additive signature can support is information-trivial); the δ
376+
obstruction is currently NAMED/parked, not a live type error. The deep reading
377+
that DEEPENS the R1 finding: it is not merely that the combining map is monadic —
378+
it is that the comonad's comultiplication would have to **fabricate the information
379+
that total collapse destroyed**, which is impossible K-free on any carrier that
380+
actually tracks loss, whereas the monad only ever forgets/fuses. This is the
381+
mechanism-level vindication of the R-2026-05-18 retraction (the original
382+
"coassoc needs no path algebra beyond ≤g-prop" *looked* fine precisely because it
383+
was vacuous over the inert carrier).
384+
385+
=== Next discriminator (DECISION — author's, see DECISIONS.adoc; NOT taken here)
386+
387+
Per terminating condition (ii): the separate `F_r ⊣ U_r` adjunction construction
388+
on a **content-faithful** carrier, where the variance finding predicts δ's
389+
`fin/inf` case finally FAILS TO TYPE (the `⊤ -> Σ A` obstruction becomes a live
390+
error) and crowns φ. Explicitly OUT OF SCOPE for the R2/R3 open; gated on author
391+
authorisation. The merge-to-main gate's terminating-condition half is now met;
392+
merge still awaits explicit author authorisation (both required).
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- EXPERIMENTAL — R2 deliverable (SHARED CARRIER).
4+
-- Carrier D : Grade → Set → Set for the echo-additive composition lines,
5+
-- PLUS the degrade reindexing action over the loss order extended to all of
6+
-- Grade, PLUS the carrier-level helpers the R3 laws consume (the fin 0 ≅ Id
7+
-- coercion, the D inf ≅ ⊤ collapse, the D-functor map, the ⊤-tower point).
8+
--
9+
-- Imported by BOTH GradedMonad.agda (primary, φ) and GradedComonad.agda
10+
-- (secondary, δ). The two lines MUST NOT import each other; this module is
11+
-- their only shared dependency beyond Grade / Echo / stdlib (firewall W2).
12+
--
13+
-- INVARIANTS (per STATE.adoc / DECISIONS.adoc D-2026-06-14-R1):
14+
-- --safe --without-K, zero postulates, no holes, no escape pragmas (W3/W4).
15+
-- No shipped module edited. Not imported by any shipped module (W5).
16+
-- NOT merged to main; experimental working-tree only (W6).
17+
18+
module experimental.echo-additive.GradedCarrier where
19+
20+
open import Data.Nat.Base using (ℕ; zero; suc; _+_; _≤_; z≤n; s≤s)
21+
open import Data.Unit.Base using (⊤; tt)
22+
open import Data.Product.Base using (Σ; _,_; proj₁; proj₂; _×_)
23+
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong)
24+
25+
open import experimental.echo-additive.Grade
26+
using (Grade; fin; inf; _+g_)
27+
28+
----------------------------------------------------------------------
29+
-- R2 §1 — The carrier D : Grade → Set → Set
30+
--
31+
-- Required endpoints (prompt + VarianceGate):
32+
-- D (fin 0) A = Id = A (Old.keep / no loss)
33+
-- D inf A = ⊤ (Old.forget / total collapse)
34+
-- D (fin (suc n)) A = ? (THE R2 QUESTION)
35+
--
36+
-- ── Grounding in Echo / Echo-comp-iso ──────────────────────────────
37+
-- Echo-comp-iso (Echo.agda:73-96) is the bidirectional law
38+
-- Echo (g∘f) y ≅ Σ B (λ b → Echo f b × (g b ≡ y)).
39+
-- The COMBINING ("from") direction Echo-comp-iso-from FUSES an accumulated
40+
-- two-layer witness into one — this is the monadic μ the primary line φ
41+
-- builds on. The SPLITTING ("to") direction Echo-comp-iso-to SPLITS one
42+
-- layer into two — this is the comonadic δ the secondary line builds on.
43+
-- The nested RHS `Σ B (Echo f b × …)` is the shape of D r (D s A): an
44+
-- outer layer (the Σ-over-intermediate-base carrying a residue equation)
45+
-- wrapping an inner Echo. ONE additive grade-unit = ONE residue layer.
46+
--
47+
-- ── THE R2 DESIGN CHOICE (the load-bearing honesty point) ──────────
48+
-- A residue layer of `Echo f b × (g b ≡ y)` needs a codomain map (`g`)
49+
-- and a base point (`y`) to pin a NON-TRIVIAL equation. The additive
50+
-- carrier has signature `Grade → Set → Set`: it receives a payload `A`
51+
-- and NOTHING ELSE — no codomain map, no base point. The only generic
52+
-- map available to instantiate Echo-comp-iso-{to,from} is `id`, and at
53+
-- `id`/`id` both the inner `Echo id b` (singleton at b) and the residue
54+
-- `id b ≡ y` (singleton at y) are CONTRACTIBLE. Hence every residue
55+
-- equation a finite additive layer could carry is `refl`-only, and the
56+
-- only K-free finite layer the carrier supports is PAYLOAD-INDEPENDENT —
57+
-- a `⊤` factor carrying the trivial residue. This is what makes the
58+
-- additive composition law DEFINITIONAL (D-fin-+-split below) and is the
59+
-- same fact that makes the additive grade STRUCTURALLY INERT:
60+
-- D (fin n) A ≅ A for every finite n. The grade counts layers; the layers
61+
-- carry no recoverable content because there is no codomain to recover
62+
-- against. This inertness is the carrier-side shadow of the R1 variance
63+
-- finding, and it is what both lines' law-discharge tests expose.
64+
--
65+
-- The rejected alternative (recorded for honesty): a content-bearing
66+
-- finite layer `D-fin (suc n) A = Σ A (λ _ → D-fin n A)` — a real copy of
67+
-- A per layer — gives A^((m+1)(n+1)) under nesting, which does NOT fuse
68+
-- with addition's A^(n+m+1). The outer Σ would be over A vs over D-fin n A,
69+
-- so the additive split below would FAIL definitionally. Only the ⊤-padded
70+
-- tower fuses; making φ constructible via Echo-comp-iso-from forces it.
71+
72+
-- Finite-grade carrier: n payload-independent residue layers over A.
73+
-- The trivial (refl-only) residue layer is written as a `⊤ ×` factor on
74+
-- the LEFT, so the additive split D-fin (m + n) A ≡ D-fin m (D-fin n A)
75+
-- is DEFINITIONAL. The δ line reads this LEFT-to-RIGHT (split, the
76+
-- additive image of Echo-comp-iso-TO); the φ line reads its `sym`
77+
-- RIGHT-to-LEFT (combine, the additive image of Echo-comp-iso-FROM).
78+
D-fin : Set Set
79+
D-fin zero A = A
80+
D-fin (suc n) A = ⊤ × D-fin n A
81+
82+
-- Full carrier.
83+
D : Grade Set Set
84+
D (fin n) A = D-fin n A
85+
D inf A =
86+
87+
----------------------------------------------------------------------
88+
-- R2 §2 — Endpoint sanity (all refl)
89+
90+
D-fin0-Id : {A} D (fin 0) A ≡ A
91+
D-fin0-Id = refl
92+
93+
D-inf-Top : {A} D inf A ≡ ⊤
94+
D-inf-Top = refl
95+
96+
-- The fin 0 ≅ Id coercion as named functions (definitional, so both refl).
97+
-- The R3 unit laws state "φ (fin 0) r = the D (fin 0)(−) ≅ Id coercion";
98+
-- exposing the coercion by name lets that law be read against this carrier.
99+
D-fin0-coe : {A} D (fin 0) A A
100+
D-fin0-coe x = x
101+
102+
D-fin0-coe-inv : {A} A D (fin 0) A
103+
D-fin0-coe-inv x = x
104+
105+
-- The D inf ≅ ⊤ collapse, named for the same reason.
106+
D-inf-collapse : {A} D inf A
107+
D-inf-collapse _ = tt
108+
109+
----------------------------------------------------------------------
110+
-- R2 §3 — Additive composition shape on FINITE grades
111+
--
112+
-- The pivotal R2 lemma: on finite grades the additive carrier splits
113+
-- DEFINITIONALLY along +. D-fin (m + n) A ≡ D-fin m (D-fin n A) by a
114+
-- chain of refl, proved by induction on m. This is the carrier-level
115+
-- statement BOTH lines build their composition maps on top of, and is
116+
-- the additive shadow of Echo-comp-iso.
117+
--
118+
-- The δ (secondary) line reads it LEFT-to-RIGHT (split: D (m+n) A →
119+
-- D m (D n A)); the φ (primary) line reads `sym` of it RIGHT-to-LEFT
120+
-- (combine: D m (D n A) → D (m+n) A). Both are transports along this same
121+
-- path — which is itself the symptom the variance finding predicts.
122+
123+
D-fin-+-split : m n {A} D-fin (m + n) A ≡ D-fin m (D-fin n A)
124+
D-fin-+-split zero n = refl
125+
D-fin-+-split (suc m) n {A} = cong (λ T ⊤ × T) (D-fin-+-split m n)
126+
127+
----------------------------------------------------------------------
128+
-- R2 §4 — The carrier functor (D-fin-map / D-map)
129+
--
130+
-- Needed to state D_r(φ_{s,t}) in the φ pentagon and D_r(δ_{s,t}) in the
131+
-- δ coassociativity. On the ⊤-padded carrier this is map-on-innermost-
132+
-- payload, leaving every trivial ⊤ layer fixed. Function-first argument
133+
-- order (matching the primary φ line's local convention). Hosted here so
134+
-- the carrier is self-describing; the line files keep their own local
135+
-- copies for their reasoning, but this is the canonical shared form.
136+
137+
D-fin-map : {A B : Set} (f : A B) (n : ℕ) D-fin n A D-fin n B
138+
D-fin-map f zero x = f x
139+
D-fin-map f (suc n) (tt , y) = tt , D-fin-map f n y
140+
141+
D-map : {A B : Set} (f : A B) (r : Grade) D r A D r B
142+
D-map f (fin n) x = D-fin-map f n x
143+
D-map f inf _ = tt
144+
145+
-- Functor identity law (witness that D-map is a genuine functorial action).
146+
D-fin-map-id : {A : Set} (n : ℕ) (x : D-fin n A)
147+
D-fin-map (λ a a) n x ≡ x
148+
D-fin-map-id zero x = refl
149+
D-fin-map-id (suc n) (tt , y) = cong (λ z tt , z) (D-fin-map-id n y)
150+
151+
----------------------------------------------------------------------
152+
-- R2 §5 — The ⊤-tower point
153+
--
154+
-- Canonical inhabitant of any finite ⊤-padded carrier over ⊤. The δ line
155+
-- needs this to MANUFACTURE the m intermediate layers that total collapse
156+
-- (inf) destroyed when splitting D inf A = ⊤ into D (fin m) (D inf A) =
157+
-- D-fin m ⊤. Its inhabitedness is exactly carrier inertness — the
158+
-- carrier-side shadow of the variance finding on the δ side.
159+
160+
D-fin-⊤-pt : m D-fin m ⊤
161+
D-fin-⊤-pt zero = tt
162+
D-fin-⊤-pt (suc m) = tt , D-fin-⊤-pt m
163+
164+
----------------------------------------------------------------------
165+
-- R2 §6 — The loss order on all of Grade, and the degrade reindexing
166+
-- action over it (fin 0 = Id unit; inf = Top collapse)
167+
--
168+
-- The loss order ⊑g extends ℕ's ≤ with inf as the top (most lossy):
169+
-- fin m ⊑g fin n iff m ≤ n (losing MORE layers is higher)
170+
-- g ⊑g inf (total collapse is the cap)
171+
-- This is the same order whose 3-point restriction {fin 0, fin 1, inf}
172+
-- is the shipped EchoGraded `keep ≤g residue ≤g forget` action (read-only;
173+
-- mirrored here, NOT edited). fin 0 (no loss) is the bottom; inf the top.
174+
175+
infix 4 _⊑g_
176+
data _⊑g_ : Grade Grade Set where
177+
fin⊑fin : {m n} m ≤ n fin m ⊑g fin n
178+
⊑inf : {g} g ⊑g inf
179+
180+
-- degrade: reindex a carrier value UP the loss order (forgetting structure).
181+
-- On the inert ⊤-tower, degrading fin m → fin n (m ≤ n) re-pads to n layers;
182+
-- degrading anything → inf collapses to tt. Total and K-free.
183+
--
184+
-- The finite case recurses on the ≤ proof: the z≤n base re-pads a bare
185+
-- payload to n trivial layers (D-fin0-pad); the s≤s step peels one ⊤ on
186+
-- each side.
187+
188+
-- pad a bare payload (D-fin 0 A = A) up to n trivial ⊤ layers.
189+
D-fin0-pad : {A} n A D-fin n A
190+
D-fin0-pad zero x = x
191+
D-fin0-pad (suc n) x = tt , D-fin0-pad n x
192+
193+
degrade-fin : {A} {m n} m ≤ n D-fin m A D-fin n A
194+
degrade-fin {n = n} z≤n x = D-fin0-pad n x
195+
degrade-fin (s≤s p) (tt , y) = tt , degrade-fin p y
196+
197+
degrade : {A} {r s} r ⊑g s D r A D s A
198+
degrade (fin⊑fin p) x = degrade-fin p x
199+
degrade ⊑inf _ = tt
200+
201+
-- degrade at a reflexive finite step is the identity (the fin 0 unit law in
202+
-- carrier form: degrading along m ≤ m changes nothing). Witnessed via the
203+
-- ≤-reflexive proof built structurally.
204+
≤-refl-nat : n n ≤ n
205+
≤-refl-nat zero = z≤n
206+
≤-refl-nat (suc n) = s≤s (≤-refl-nat n)
207+
208+
degrade-fin-refl : {A} n (x : D-fin n A)
209+
degrade-fin (≤-refl-nat n) x ≡ x
210+
degrade-fin-refl zero x = refl
211+
degrade-fin-refl (suc n) (tt , y) = cong (λ z tt , z) (degrade-fin-refl n y)
212+
213+
-- degrade into inf is the total collapse (the Old.forget endpoint, in
214+
-- carrier form): every value maps to the unique ⊤ inhabitant.
215+
degrade-to-inf : {A} {r} (p : r ⊑g inf) (x : D r A) degrade p x ≡ tt
216+
degrade-to-inf ⊑inf x = refl

0 commit comments

Comments
 (0)