Skip to content

Commit 5482712

Browse files
F3 PASSED: GradedComonadStructure + two non-isomorphic-grade-monoid instances (#88)
## Summary Gate **F3** of the earn-back plan (`docs/echo-types/earn-back-plan.adoc §F3`) now passes. Two non-isomorphic-grade-monoid instances of an abstract graded-comonad interface, with no `⊑-prop`-equivalent field in the interface itself, are mechanised: * **`nat-instance`** at the **commutative** monoid `(ℕ, +, 0)` — packages the F1 (#86) iterated-residue construction. * **`list-instance`** at the **non-commutative** free monoid `(List Tag, ++, [])` over a two-element `Tag` with per-element residue layers `R smol A = A × Bool`, `R big A = A × ℕ`. All three graded-comonad laws proved. The non-isomorphism is constructively witnessed by `tag-list-non-commutative` (one direction: only a non-commutative monoid satisfies it). The two earn-back gates F1 and F3 — both landed today — close the comonad-side earn-back programme as specified. ## Three new modules ### `EchoGradedComonadInterface.agda` — abstract record `GradedComonadStructure` fields: * Grade monoid: `G`, `1G`, `_·G_`, the three monoid laws. * Graded carrier: `D : G → Set → Set`, `mapD`, functor laws. * Counit `ε : D 1G A → A` at the unit grade. * **Nested** comultiplication `δ : D (g ·G h) A → D g (D h A)`. * The three graded-comonad laws stated against `subst` along the monoid's propositional identities. **No `⊑-prop`-equivalent field** — F3 guardrail honoured by construction. Inspect the field list at the top of the module. ### `EchoGradedComonadInstance1.agda` — F1 packaged `nat-instance : GradedComonadStructure` reuses `EchoGradedComonadF1.D / mapD / ε / δ / gc-counit-l / gc-counit-r / gc-coassoc` verbatim; stdlib's `+-identityˡ / +-identityʳ / +-assoc` supply the monoid laws. No adapter lemma needed — F1's signatures already use `subst` along the corresponding ℕ-equation proofs. ### `EchoGradedComonadInstance2.agda` — free-monoid instance `list-instance : GradedComonadStructure` at `(List Tag, ++, [])`. Construction parallels F1: * `D [] A = A`; `D (x ∷ xs) A = R x (D xs A)`. * `mapD-id`, `mapD-∘` by structural induction (per Tag). * `D-++` proves the type equality `D (xs ++ ys) A ≡ D xs (D ys A)` inductively; `δ = coe (D-++ xs ys A)`. * `gc-counit-r`: definitional (`++-identityˡ _ = refl` in stdlib). * `gc-counit-l` / `gc-coassoc`: structural induction on the grade list, cons step splitting on the head `Tag`. Same `δ`-naturality + `subst`-over-residue factoring as F1's `gc-coassoc`. * `D-nontrivial`: separating witness that `D (smol ∷ big ∷ []) Bool` is not collapsing to `⊤` / a prop. ## Build invariant * `agda proofs/agda/All.agda` exit 0 under `--safe --without-K` * `agda proofs/agda/Smoke.agda` exit 0 under `--safe --without-K` * **zero postulates, no funext, no escape pragmas** anywhere in the three new modules * both instances wired into `All.agda`; record + both instances + non-isomorphism witness + non-triviality witness pinned in `Smoke.agda` ## Scope (please re-read with care) F3 earns back the two-models claim **for the graded-comonad witness introduced by F1** — there are two genuinely non-isomorphic grade-monoid models of the `GradedComonadStructure` interface, the laws hold at each, the interface itself is `⊑-prop`-free. That is exactly what the gate asked for. F3 does **NOT** earn back the older `EchoRelModel`/`GCLaws` two-models claim retracted at R-2026-05-18 finding 3. That retraction concerned `set-model` and `rel-model` (both at the same grade poset, with `⊑-prop` baked in as a field, `rel-model = set-model × ⊤`, agreement by `refl`). The `GradedLossModel` interface there still has `⊑-prop`; that situation is unchanged. F3 here is about a **different** abstract interface and a **different** pair of models. The two earn-backs are not interconvertible — do not cite one as evidence for the other. `paper.adoc`, `types-abstract.adoc`, and `conservativity.adoc` remain untouched. Their bodies are about `EchoGraded`'s thin-poset structure, which neither F1 nor F3 changes. The combined F1+F3 result strengthens the case for a bounded "new contribution" paragraph, but the title / thesis / reindexing-modality framing should not move on these gates alone — owner-gated, as for F1. ## Doc updates (gated, scoped) * `docs/echo-types/earn-back-plan.adoc` — ledger row A3 (Unstarted → PASSED), Sequencing entry added, Status entry with the strict scope qualifier above. * `docs/retractions.adoc` — follow-up **F-2026-05-20b** appended (append-only revision policy preserved); the scope qualifier pinned in prose. ## Dependencies * Builds on **#86** (F1 PASSED). Branch based on `f1-coassoc-earn-back`; will rebase cleanly onto `main` once #86 lands. * Disjoint from **#82** (AbsInt) and **#84** (paper Evaluation — already merged). ## Test plan * [x] Interface module typechecks * [x] Instance 1 (nat) typechecks * [x] Instance 2 (list) typechecks — all three comonad laws * [x] Full `All.agda` build green * [x] `Smoke.agda` build green * [x] No postulates, no escape pragmas, no funext in any new module * [x] No `⊑-prop`-equivalent field in the interface record * [x] Non-commutativity witness for the second grade monoid * [x] Non-triviality witness for the second carrier * [ ] (owner) inspect field list of `GradedComonadStructure` — flag anything `⊑-prop`-shaped if present * [ ] (owner) ratify the F-2026-05-20b scope language in `retractions.adoc` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3cf9558 commit 5482712

7 files changed

Lines changed: 615 additions & 1 deletion

File tree

docs/echo-types/earn-back-plan.adoc

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,16 @@ single index; it moves no claim.
209209
| A3
210210
| *F3* — independent second model of the comonad at a different grade
211211
monoid (no `× ⊤` carrier, no `⊑-prop`-equivalent field).
212-
| Unstarted. Gated on F1.
212+
| *PASSED 2026-05-20* — `proofs/agda/EchoGradedComonadInterface.agda`
213+
+ `EchoGradedComonadInstance1.agda` (F1 at the *commutative*
214+
monoid `(ℕ, +, 0)`) + `EchoGradedComonadInstance2.agda`
215+
(free-monoid `(List Tag, ++, [])` over a two-element `Tag` with
216+
per-element residue `R smol A = A × Bool` / `R big A = A × ℕ`).
217+
The two grade monoids are non-isomorphic (one commutative, one
218+
not; witness `tag-list-non-commutative`); the interface record
219+
carries no `⊑-prop`-equivalent field. `--safe --without-K`, zero
220+
postulates, no funext. Wired into `All`/`Smoke`. Retraction
221+
follow-up F-2026-05-20b.
213222

214223
| A4
215224
| *F4* — strict universal property as a function of an explicit
@@ -274,6 +283,10 @@ single index; it moves no claim.
274283
independently of F1.
275284
. *F1 coassoc* (A1) — *DONE 2026-05-20*: passed via the predicted
276285
`δ`-naturality-over-`R` factoring; unblocks *F3* (A3).
286+
. *F3* (A3) — *DONE 2026-05-20*: passed via the
287+
`GradedComonadStructure` interface plus two non-isomorphic-
288+
grade-monoid instances. Closes the second-models claim *for the
289+
graded comonad witness* — see follow-up F-2026-05-20b for scope.
277290
. *Doc-integrity* (D) — reconcile alongside step 1; removes a drift
278291
vector at near-zero cost.
279292
. *Buchholz* (B) — separate long-tail; keep the `ExtendedOrder`
@@ -347,3 +360,39 @@ unchanged; the F1 result is an *additional* mechanised contribution
347360
sitting beside `EchoGraded`, not a reinstatement of it. F3
348361
(independent second comonad model at a different grade monoid) is
349362
now unblocked.
363+
364+
* *2026-05-20 — Gate F3 PASSED.*
365+
`EchoGradedComonadInterface.GradedComonadStructure` is an abstract
366+
record packaging the F1 graded-comonad signature (grade monoid +
367+
graded functor + counit + nested comultiplication + monoid laws +
368+
functor laws + the three comonad laws) without a `⊑-prop`-equivalent
369+
field. Two non-isomorphic-grade-monoid instances inhabit it:
370+
+
371+
[loweralpha]
372+
. `EchoGradedComonadInstance1.nat-instance` — F1 at the commutative
373+
monoid `(ℕ, +, 0)`;
374+
. `EchoGradedComonadInstance2.list-instance` — the free monoid
375+
`(List Tag, ++, [])` over a two-element `Tag` with per-element
376+
residue layers `R smol A = A × Bool` and `R big A = A × ℕ`. All
377+
three comonad laws proved (`gc-counit-r` definitional;
378+
`gc-counit-l`/`gc-coassoc` by structural induction on the list,
379+
cons step splitting on the head `Tag`, mirroring F1's
380+
`δ`-naturality + `subst-D-suc` factoring).
381+
+
382+
The grade monoids are non-isomorphic — one commutative, one not;
383+
the witness `tag-list-non-commutative` discharges this directly. The
384+
interface record contains no `⊑-prop`-equivalent field; both
385+
instances inhabit it cleanly without one. `--safe --without-K`,
386+
zero postulates, no funext; wired into `All.agda` and pinned in
387+
`Smoke.agda`. Retraction follow-up F-2026-05-20b.
388+
+
389+
*Strictly scoped (re-read with care):* F3 earns back the
390+
"two-models" claim *for the graded-comonad witness* introduced by
391+
F1 — there are two genuinely non-isomorphic grade-monoid models of
392+
that interface. It does *not* earn back the older `EchoRelModel`
393+
two-models claim retracted at R-2026-05-18 finding 3, which was
394+
about `GCLaws` instantiated at `set-model` and `rel-model`. Those
395+
instantiations remain at the same grade poset with `⊑-prop` baked
396+
in as a field; that retraction stands. The two earn-backs (F3 here,
397+
and the original `GCLaws` claim) are about different abstract
398+
interfaces and are not interconvertible.

docs/retractions.adoc

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,86 @@ new contribution paragraph mentioning the F1 side-construction
260260
(without altering the title / thesis / reindexing-modality
261261
framing).
262262

263+
==== Follow-up F-2026-05-20b (2026-05-20) — Gate F3 passed
264+
265+
Gate F3 — a *genuinely independent* second model of the graded
266+
comonad at a *different grade monoid* (not the same monoid with a
267+
`× ⊤` carrier, no field equivalent to `⊑-prop`) — also passes,
268+
following F1. The combined F1 + F3 result earns back the
269+
"two-models" claim *for the graded-comonad witness specifically*;
270+
the older retracted "two-models" claim about `EchoRelModel`/`GCLaws`
271+
remains retracted (see scope qualifier at end).
272+
273+
[cols="1,4", options="header"]
274+
|===
275+
| Gate | Earned-back claim (exact strength — nothing beyond)
276+
277+
| *F3*
278+
| `proofs/agda/EchoGradedComonadInterface.GradedComonadStructure`
279+
packages the F1 graded-comonad signature into an abstract record:
280+
a grade monoid `(G, 1G, _·G_)` with the three monoid laws; a
281+
graded carrier `D : G → Set → Set` with functorial action and the
282+
two functor laws; counit `ε` at the unit grade; *nested*
283+
comultiplication `δ : D (g ·G h) A → D g (D h A)`; and the three
284+
graded-comonad laws stated against `subst` along the monoid's
285+
propositional identities. The record contains **no
286+
`⊑-prop`-equivalent field** — only structure, monoid laws, and
287+
comonad laws. Two non-isomorphic-grade-monoid instances inhabit
288+
it: `nat-instance` at the commutative monoid `(ℕ, +, 0)` (F1)
289+
and `list-instance` at the non-commutative free monoid
290+
`(List Tag, ++, [])` over a two-element `Tag` with per-element
291+
residue layers `R smol A = A × Bool`, `R big A = A × ℕ`. The
292+
non-isomorphism is constructively witnessed
293+
(`tag-list-non-commutative`: one monoid is commutative, the other
294+
isn't). All three comonad laws hold at both instances —
295+
definitional `gc-counit-r`, structural-induction `gc-counit-l` and
296+
`gc-coassoc` with the same `δ`-naturality + `subst`-over-residue
297+
factoring used for F1. `--safe --without-K`, zero postulates, no
298+
funext, no escape pragmas; wired into `All.agda`, pinned in
299+
`Smoke.agda`.
300+
|===
301+
302+
*Strictly scoped (re-read with care).* F3 earns back the
303+
two-models claim **for the graded-comonad witness introduced by F1**.
304+
There are two genuinely non-isomorphic grade-monoid models of the
305+
`GradedComonadStructure` interface, the laws hold at each, the
306+
interface itself is `⊑-prop`-free. That is exactly what the gate
307+
asked for, and the gate passes at exactly that strength.
308+
309+
What is **NOT** earned back by F3. The retraction's finding 3 ("Not
310+
two models") was about `EchoRelModel`'s `GCLaws`, instantiated at
311+
`set-model` and `rel-model` — both fixing the *same* grade poset
312+
(`_≤g_`, `≤g-prop`, `_⊔g_`, `keep`), with `rel-model`'s carrier
313+
being the Set carrier `× ⊤` and `model-agreement` being `refl`. The
314+
`GradedLossModel` interface bakes `⊑-prop` in as a field. That
315+
situation is unchanged: `EchoRelModel` still has its retracted
316+
"two-models" claim retracted; the `⊑-prop` field is still there;
317+
`rel-model` is still `set-model × ⊤`. F3 here is about a
318+
*different* abstract interface (`GradedComonadStructure`, no order,
319+
no `⊑-prop`) and a *different* pair of models. The two earn-backs
320+
are not interconvertible; do not cite one as evidence for the other.
321+
322+
*What this unblocks.* No further earn-back gates depend on F3. The
323+
sequence F1 → F3 closes the comonad-side earn-back programme as
324+
specified. The remaining open earn-back debt (`paper.adoc` /
325+
`types-abstract.adoc` / `conservativity.adoc` prose updates, which
326+
F1's follow-up F-2026-05-20a deferred as owner-gated) is now an
327+
even stronger candidate for a bounded "new contribution" paragraph
328+
— but the bodies of those documents are still about `EchoGraded`'s
329+
thin-poset structure, which F3 does not change. The owner-gated
330+
decision stands.
331+
332+
*Artefacts edited 2026-05-20 pursuant to this follow-up:*
333+
`proofs/agda/EchoGradedComonadInterface.agda` (new — abstract
334+
record); `proofs/agda/EchoGradedComonadInstance1.agda` (new — F1
335+
packaged); `proofs/agda/EchoGradedComonadInstance2.agda` (new —
336+
free-monoid instance); `proofs/agda/All.agda` (wired both new
337+
modules); `proofs/agda/Smoke.agda` (pinned the record, both
338+
instances, `tag-list-non-commutative`, `D-nontrivial`);
339+
`docs/echo-types/earn-back-plan.adoc` (ledger row A3, Sequencing,
340+
Status). No edits to `paper.adoc`, `types-abstract.adoc`, or
341+
`conservativity.adoc` — owner-gated, as for F1's follow-up.
342+
263343
== Revision policy
264344

265345
Append-only. New retractions get the next `R-YYYY-MM-DD` id. An entry

proofs/agda/All.agda

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ open import EchoRelModel -- Pillar D (scaffold)
6262
open import EchoPullbackUnivF4 -- Gate F4 PASSED (funext-qualified UP)
6363
open import EchoStepNDModelF2 -- Gate F2 PASSED (StepND second model)
6464
open import EchoGradedComonadF1 -- Gate F1 PASSED (graded comonad on iterated-residue)
65+
open import EchoGradedComonadInterface -- Gate F3 abstract record
66+
open import EchoGradedComonadInstance1 -- Gate F3 instance 1 (F1 at (ℕ, +, 0))
67+
open import EchoGradedComonadInstance2 -- Gate F3 PASSED — instance 2 at (List Tag, ++, [])
6568

6669
-- Foundation P1: external-fibre triangulation. Echo agrees with the
6770
-- standard library's OWN independently-authored notions
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- Gate F3 phase 1 — instance 1 of N.
4+
--
5+
-- Packages the F1 iterated-residue construction
6+
-- (`EchoGradedComonadF1.agda`) as an inhabitant of the
7+
-- `EchoGradedComonadInterface.GradedComonadStructure` record at the
8+
-- grade monoid `(ℕ, +, 0)`. The structure and laws are reused
9+
-- verbatim — F1 already discharged them — so this module is purely
10+
-- structural: it shows the abstract interface is *inhabitable* by
11+
-- the existing F1 witness, with no shape mismatch and no extra
12+
-- assumptions imported.
13+
--
14+
-- F1's gc-counit-l/r/coassoc are stated against ℕ's specific
15+
-- equation proofs (`+-identityˡ`, `+-identityʳ`, `+-assoc`), so the
16+
-- interface's monoid-equation `subst` reduces exactly to F1's
17+
-- existing equations. The `gc-counit-r` field reduces by `refl`
18+
-- because stdlib's `+-identityˡ` is itself `refl` for every
19+
-- argument (`+` recurses on the left; `0 + n` is `n` definitionally).
20+
--
21+
-- F3 only PASSES when at least two non-isomorphic-grade-monoid
22+
-- instances of the interface are mechanised. This module is one of
23+
-- them; instance 2 (e.g. `(List X, ++, [])` for a non-trivial `X`)
24+
-- is the phase-2 follow-up.
25+
26+
module EchoGradedComonadInstance1 where
27+
28+
open import Data.Nat.Base using (ℕ; zero; suc; _+_)
29+
open import Data.Nat.Properties using (+-identityˡ; +-identityʳ; +-assoc)
30+
31+
open import EchoGradedComonadInterface using (GradedComonadStructure)
32+
open import EchoGradedComonadF1 using
33+
( D
34+
; mapD ; mapD-id ; mapD-∘
35+
; ε
36+
; δ
37+
; gc-counit-l
38+
; gc-counit-r
39+
; gc-coassoc
40+
)
41+
42+
----------------------------------------------------------------------
43+
-- The ℕ-graded instance.
44+
45+
nat-instance : GradedComonadStructure
46+
nat-instance = record
47+
{ G =
48+
; 1G = 0
49+
; _·G_ = _+_
50+
; ·G-identityˡ = +-identityˡ
51+
; ·G-identityʳ = +-identityʳ
52+
; ·G-assoc = +-assoc
53+
54+
; D = D
55+
; mapD = mapD
56+
; mapD-id = mapD-id
57+
; mapD-∘ = mapD-∘
58+
59+
; ε = ε
60+
; δ = δ
61+
62+
; gc-counit-r = gc-counit-r
63+
; gc-counit-l = gc-counit-l
64+
; gc-coassoc = gc-coassoc
65+
}

0 commit comments

Comments
 (0)