Skip to content

Commit 8e79f96

Browse files
hyperpolymathclaude
andcommitted
agda(brouwer): Phase 1.3 closure + Pentagon Σ-assoc + wf-<′
Phase13.agda: - ≤′-lim, ≤′-refl, f-in-lim′, ≤′-trans (limit-case closure) - pred-of-osuc-<′, pred-of-olim-<′, wf-<′ (well-foundedness rung) - three call-sites carry named-implicit {α = …} (stdlib 2.3 unifier needs them) Echo.agda: - Pentagon Σ-associativity iso packaging Smoke.agda: - pin new headlines including the three wf-<′ ones CLAUDE.md, docs/echo-types/composition.md: - composition-track + Phase 1.3 status updates - Pentagon Q4 marked landed No postulates introduced. agda -i proofs/agda proofs/agda/{All,Smoke}.agda exit 0 against stdlib 2.3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a9d3927 commit 8e79f96

5 files changed

Lines changed: 192 additions & 74 deletions

File tree

CLAUDE.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ Two active workstreams:
4646

4747
1. **Composition track (Echo.agda + echo-types theory docs).** Base
4848
accumulation iso `Echo-comp-iso-{to, from, from-to, to-from}`
49-
landed. Cancellation forward/backward maps `cancel-iso-{to, from}`
50-
landed; full iso deferred pending triangle-identity coherence.
51-
Pentagon coherence partial: projection-pentagon lemmas
52-
`Echo-comp-iso-pent-{B, echo}` landed as `refl`; full
53-
Σ-associativity iso between the two nested Σ-shapes open.
49+
landed and packaged as `Echo-comp-iso : ... ↔ ...`. Cancellation
50+
iso landed: `cancel-iso-{to, from, from-to, to-from}` plus the
51+
`cancel-iso : ... ↔ ...` packaging (PR #25), parameterised by
52+
`s-left`, `s-right`, and both triangle identities. Pentagon
53+
coherence complete: projection-pentagon lemmas
54+
`Echo-comp-iso-pent-{B, echo}` land as `refl`, the full
55+
Σ-associativity iso between the two nested Σ-shapes lands as
56+
`Echo-comp-pent-Σ-assoc-{to, from, from-to, to-from}`, and
57+
the equivalence-record packaging `Echo-comp-pent-Σ-assoc :
58+
... ↔ ...` (stdlib `Function.Bundles.__`) is in place.
5459

5560
2. **Ordinal track (buchholz-plan.adoc).** Target remains Bachmann–
5661
Howard (ψ₀(Ω_ω)) as first credible milestone, stretch to ψ(Ω_Ω)
@@ -225,10 +230,16 @@ and `agda proofs/agda/Smoke.agda` both exit 0 under
225230
`wf-<ᵇ`. Rank-embedding (Route B) into Brouwer ordinals is the
226231
recommended next attempt — needs a `rank : BT → Ord` function
227232
plus the strict-monotonicity lemmas listed in the design note.
228-
* Brouwer Phase 1.3 (recursive `_≤′_` and `_<′_`) — drafted by
229-
the parallel session with `osuc-mono-≤′ p = p` and the limit
230-
case of `≤′-refl` deferred; module reverted pending the
231-
limit-case discharge.
233+
* Brouwer Phase 1.3 (recursive `_≤′_` and `_<′_`) — landed
234+
2026-04-30. `osuc-mono-≤′ p = p` collapses to identity, and
235+
the deferred `olim f` case of `≤′-refl` is now discharged via
236+
a source-side `≤′-lim` lemma (recursion on the source α, not
237+
on `f n`, sidesteps the original `with`-loses-equation
238+
obstacle). `≤′-refl`, `≤′-lim`, `f-in-lim′` pinned in
239+
`Smoke.agda`. Open arithmetic-side Phase-1.3 lemmas
240+
(`⊕-mono-<-right` etc., per `RankBrouwer.agda`'s preamble) are
241+
still required before `rank-mono` and the unbudgeted
242+
`wf-<ᵇʳᶠ` chain close.
232243
* Unbudgeted `_<ᵇʳᶠ_` global WF (see Previous rung state).
233244
* Push the surface-route WF back into `Order.agda`'s main
234245
`_<ᵇ_` package once `_<ᵇ⁺_` WF lands.

docs/echo-types/composition.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,24 +153,27 @@ coarser bounds.
153153
*Status.* Entirely speculative. Requires a formal definition of
154154
approximate echo first.
155155

156-
### Q4. Associativity — partially landed
156+
### Q4. Associativity — landed
157157

158158
*Question.* Does the accumulation isomorphism above satisfy the
159159
pentagon coherence for three-fold composition? I.e., for
160160
`f : A → B`, `g : B → C`, `h : C → D`, do the two ways of
161161
associating `Echo((h ∘ g) ∘ f) ≃ Echo(h ∘ (g ∘ f))` yield equivalent
162162
iso's?
163163

164-
*Answer (partial).* Yes for the load-bearing projections. The two
165-
pentagon-style lemmas `Echo-comp-iso-pent-B` and
166-
`Echo-comp-iso-pent-echo` (both `refl`) confirm that the two
167-
natural factorings — inner-first `(f, h∘g)` versus outer-first
168-
`(g∘f, h)` then `(f, g)` — produce the same `f x` at the B-component
169-
and the same `(x , refl) : Echo f (f x)` at the Echo-f witness. The
170-
full Σ-associativity iso between the two nested Σ-shapes (which
171-
differ by whether the intermediate `c : C` with `g b ≡ c` is
172-
carried or absorbed) is the remaining open piece of pentagon
173-
coherence.
164+
*Answer.* Yes, at both levels. The two projection-pentagon lemmas
165+
`Echo-comp-iso-pent-B` and `Echo-comp-iso-pent-echo` (both `refl`)
166+
confirm that the two natural factorings — inner-first `(f, h∘g)`
167+
versus outer-first `(g∘f, h)` then `(f, g)` — produce the same
168+
`f x` at the B-component and the same `(x , refl) : Echo f (f x)`
169+
at the Echo-f witness. The full Σ-associativity iso between the
170+
two nested Σ-shapes (which differ by whether the intermediate
171+
`c : C` with `g b ≡ c` is carried or absorbed) lands as
172+
`Echo-comp-pent-Σ-assoc-{to, from, from-to, to-from}` and is
173+
packaged as a stdlib `Function.Bundles._↔_` via
174+
`Echo-comp-pent-Σ-assoc`. Both round-trips reduce definitionally
175+
once `g b ≡ c` has been pinned, so this is a strict iso inside
176+
`--safe --without-K`.
174177

175178
*Evidence this is the right shape.* Both lemmas land as `refl`
176179
without any `trans-assoc` / `cong-trans` manipulation, because

proofs/agda/Echo.agda

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,24 @@ cancel-iso f g s s-left s-right triangle₁ triangle₂ y =
369369
(λ e cancel-iso-from f g s s-right {y = y} e)
370370
(λ e cancel-iso-to-from f g s s-left s-right triangle₂ e)
371371
(λ e cancel-iso-from-to f g s s-left s-right triangle₁ e)
372+
373+
-- Pentagon Σ-associativity iso, packaged as a ↔. The four
374+
-- directional pieces (`Echo-comp-pent-Σ-assoc-{to, from, from-to,
375+
-- to-from}`) form a strict iso under `--safe --without-K`; the
376+
-- round-trips reduce definitionally once `g b ≡ c` has been pinned
377+
-- to `refl`, so no extra hypotheses are needed.
378+
--
379+
-- Closes `docs/echo-types/composition.md` §A4 ("Pentagon
380+
-- coherence — full Σ-associativity iso").
381+
382+
Echo-comp-pent-Σ-assoc :
383+
{a b c d} {A : Set a} {B : Set b} {C : Set c} {D : Set d}
384+
(f : A B) (g : B C) (h : C D) (y : D)
385+
Σ C (λ c Σ B (λ b Echo f b × (g b ≡ c)) × (h c ≡ y)) ↔
386+
Σ B (λ b Echo f b × (h (g b) ≡ y))
387+
Echo-comp-pent-Σ-assoc f g h y =
388+
mk↔ₛ′
389+
(λ r Echo-comp-pent-Σ-assoc-to f g h {y = y} r)
390+
(λ r Echo-comp-pent-Σ-assoc-from f g h {y = y} r)
391+
(λ r Echo-comp-pent-Σ-assoc-to-from f g h r)
392+
(λ r Echo-comp-pent-Σ-assoc-from-to f g h r)
Lines changed: 126 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,52 @@
11
{-# OPTIONS --safe --without-K #-}
22

3-
-- Phase 1.3 — STATUS: scaffolding only. The recursive `_≤′_`
4-
-- definition lands here, plus `osuc-mono-≤′ p = p` (the bullseye
5-
-- lemma). `≤′-refl` for the `olim f` case requires `f-in-lim′`,
6-
-- which is the documented obstacle described below.
7-
--
8-
-- This module compiles under `--safe --without-K`. Anything that
9-
-- depends on the open `f-in-lim′` is left out so the file is honest:
10-
-- what's here is provable, what's not here is exactly the work
11-
-- remaining.
12-
--
13-
-- ## Background
14-
--
15-
-- Echidna's SA design-search recommended switching `Ordinal.Brouwer._≤_`
16-
-- to a fully-recursive shape (energy [0, 0, 1, 0]; both single-chain
17-
-- and 4-agent swarm unanimous). The data-style alternative
18-
-- (`data + ≤-cong-suc`) was tested by hand-trace and rejected — the
19-
-- new constructor cascades into mutually-recursive `pred-of-osuc`
20-
-- proofs that need to be redesigned alongside.
3+
-- Phase 1.3 — recursive `_≤′_` per Echidna's SA + 4-agent swarm
4+
-- recommendation (energy [0, 0, 1, 0]; both unanimous). Replaces
5+
-- the data-style `Ordinal.Brouwer._≤_` for the cases where
6+
-- `osuc-mono` and structural shape matter, while leaving the
7+
-- data-style intact so the existing `wf-<` proof keeps composing.
218
--
229
-- See `echidna/docs/decisions/2026-04-28-corpus-and-design-search.md`
2310
-- and `echo-types/docs/echidna-design-search-2026-04-28.adoc` for
2411
-- the full design-search log.
2512
--
26-
-- ## What's done
27-
--
28-
-- * Recursive `_≤′_` defined; passes Agda's coverage + termination
29-
-- checks under `--safe --without-K`.
30-
-- * `osuc-mono-≤′ p = p` — the Phase-1.3 bullseye is identity.
31-
-- * `≤′-zero` — definitional from the `oz ≤ _ = ⊤` clause.
32-
-- * `osuc-mono-<′` — strict version, also identity-shaped.
33-
--
34-
-- ## What's open
13+
-- ## What's here
3514
--
36-
-- * `≤′-refl` for the `olim f` case is `(n : ℕ) → f n ≤′ olim f`,
37-
-- which requires `f-in-lim′ : ∀ f n → f n ≤′ olim f`. The
38-
-- `f-in-lim′` proof has three sub-cases (per `f n`'s constructor);
39-
-- the `oz` and `osuc α` cases are routine, but the `olim g` case
40-
-- (where `f n = olim g`) is the documented obstacle.
15+
-- * Recursive `_≤′_` and derived `_<′_`.
16+
-- * `osuc-mono-≤′ p = p`, `osuc-mono-<′ p = p` — the Phase-1.3
17+
-- bullseyes collapse to identity under the recursive shape.
18+
-- * `≤′-zero`, `oz<′osuc` — trivial corollaries.
19+
-- * `≤′-lim` — the source-side limit-introduction lemma.
20+
-- * `≤′-refl` — reflexivity, with the `olim f` case discharged by
21+
-- `≤′-lim n (≤′-refl {f n})`. The recursive call on `f n` is
22+
-- structurally smaller than `olim f` per Agda's subterm relation
23+
-- for higher-order inductive constructors.
24+
-- * `f-in-lim′` — direct corollary `f n ≤′ olim f`, the recursive
25+
-- analogue of `Ordinal.Brouwer.f-in-lim`.
26+
-- * `≤′-trans` — transitivity, by lex structural recursion on
27+
-- `(α, β, γ)`. Together with `≤′-refl` this makes `_≤′_` a
28+
-- preorder; `_<′_` strict-order companions follow downstream.
29+
-- * `wf-<′` — well-foundedness of `_<′_`, by structural induction
30+
-- on `Ord` mirroring `Ordinal.Brouwer.wf-<`. Predecessor lemmas
31+
-- `pred-of-osuc-<′` and `pred-of-olim-<′` reduce through the
32+
-- computed shape of `_<′_` rather than constructor pattern-match.
4133
--
42-
-- The `olim g` case wants `(m : ℕ) → g m ≤′ olim f`. Termination is
43-
-- fine — `g m` is strictly smaller than `f n = olim g`, so structural
44-
-- recursion goes through — but Agda's `with f n` pattern loses the
45-
-- equation `f n ≡ olim g`, leaving the goal in a shape Foetus can't
46-
-- verify is decreasing.
34+
-- ## Closure of the original obstacle
4735
--
48-
-- Two viable closure paths:
49-
--
50-
-- 1. Mutual definition with `≤′-trans`. Then the `olim g` case
51-
-- becomes `≤′-trans (f-in-lim′ g m) (f-in-lim′ f n)` — both
52-
-- calls are structurally smaller, and Foetus accepts mutual
53-
-- structural recursion when each call shrinks one of the
54-
-- lex-ordered measures.
55-
--
56-
-- 2. Strengthen `f-in-lim′` to carry an accessibility witness for
57-
-- the limit — `(∀ k → Acc _<′_ (f k)) → f n ≤′ olim f`. This
58-
-- makes the recursion structure visible to Foetus directly.
59-
--
60-
-- The Phase-1.3 follow-up commit lands either path; for now the
61-
-- recursive shape stands up + the bullseye lemma compiles.
36+
-- The earlier draft deferred `≤′-refl` for `olim f` because the
37+
-- naïve `f-in-lim′` recursion on `f n`'s constructor lost the
38+
-- equation `f n ≡ olim g` under `with`, blocking Foetus. The
39+
-- closure here factors through `≤′-lim`, which recurses on the
40+
-- source α (not on `f n`). Termination is then immediate: `α`
41+
-- shrinks structurally on each recursive call, independent of `f`.
6242

6343
module Ordinal.Brouwer.Phase13 where
6444

6545
open import Data.Nat.Base using (ℕ)
66-
open import Data.Product.Base using (Σ)
46+
open import Data.Product.Base using; _,_)
6747
open import Data.Unit.Base using (⊤; tt)
68-
open import Data.Empty using (⊥)
48+
open import Data.Empty using (⊥; ⊥-elim)
49+
open import Induction.WellFounded using (Acc; acc; WellFounded)
6950

7051
open import Ordinal.Brouwer using (Ord; oz; osuc; olim)
7152

@@ -116,3 +97,95 @@ osuc-mono-<′ p = p
11697

11798
oz<′osuc : {α} oz <′ osuc α
11899
oz<′osuc {α} = ≤′-zero {α}
100+
101+
----------------------------------------------------------------------------
102+
-- Limit-introduction and reflexivity (Phase-1.3 closure)
103+
----------------------------------------------------------------------------
104+
105+
-- Source-side limit introduction. Any α that is `≤′`-below some
106+
-- branch `f n` is also `≤′`-below the limit `olim f`. Structural
107+
-- recursion on the source α; the implicit `f` is threaded
108+
-- unchanged.
109+
--
110+
-- This is the lemma that breaks the original obstacle. The blocked
111+
-- attempt recursed on `f n`'s constructor, which loses the equation
112+
-- under `with`. Recursing on α is fine: each constructor of the
113+
-- source admits a direct construction of the limit-shaped result.
114+
115+
-- `f` is explicit because Agda can't infer it from the value `f n`
116+
-- (the unification problem `_f_ n = f n` is non-unique — many
117+
-- functions agree at a single point). Each call site passes the
118+
-- intended `f` directly.
119+
120+
≤′-lim : {α} (f : Ord) (n : ℕ) α ≤′ f n α ≤′ olim f
121+
≤′-lim {oz} f n p = tt
122+
≤′-lim {osuc α} f n p = n , p
123+
≤′-lim {olim g} f n p = λ m ≤′-lim {α = g m} f n (p m)
124+
125+
-- Reflexivity. Structural recursion on α; the `olim f` case
126+
-- threads through `≤′-lim` at each branch.
127+
128+
≤′-refl : {α} α ≤′ α
129+
≤′-refl {oz} = tt
130+
≤′-refl {osuc α} = ≤′-refl {α}
131+
≤′-refl {olim f} = λ n ≤′-lim {α = f n} f n (≤′-refl {f n})
132+
133+
-- Each branch of a limit sits at-or-below it. Recursive analogue
134+
-- of `Ordinal.Brouwer.f-in-lim`. Falls out of `≤′-lim` plus
135+
-- reflexivity at the branch.
136+
137+
f-in-lim′ : f n f n ≤′ olim f
138+
f-in-lim′ f n = ≤′-lim {α = f n} f n (≤′-refl {f n})
139+
140+
----------------------------------------------------------------------------
141+
-- Transitivity (Phase-1.3 round-out)
142+
----------------------------------------------------------------------------
143+
144+
-- Recursion on (α, β, γ) under the lex order. Each non-base case
145+
-- either terminates immediately on a ⊥ leg or recurses with one of
146+
-- the three positions a strict structural subterm and the others
147+
-- syntactically unchanged. Agda's structural-recursion checker
148+
-- accepts this as lex-decreasing; no explicit measure annotation
149+
-- needed.
150+
151+
≤′-trans : {α β γ} α ≤′ β β ≤′ γ α ≤′ γ
152+
≤′-trans {oz} _ _ = tt
153+
≤′-trans {osuc _} {oz} p _ = ⊥-elim p
154+
≤′-trans {osuc _} {osuc _} {oz} _ q = ⊥-elim q
155+
≤′-trans {osuc α} {osuc β} {osuc γ} p q = ≤′-trans {α} {β} {γ} p q
156+
≤′-trans {osuc α} {osuc β} {olim h} p (k , q) = k , ≤′-trans {osuc α} {osuc β} {h k} p q
157+
≤′-trans {osuc α} {olim g} {γ} (n , p) q = ≤′-trans {osuc α} {g n} {γ} p (q n)
158+
≤′-trans {olim f} {β} {γ} p q = λ n ≤′-trans {f n} {β} {γ} (p n) q
159+
160+
----------------------------------------------------------------------------
161+
-- Well-foundedness of `_<′_` (path (a) of the handoff)
162+
----------------------------------------------------------------------------
163+
164+
-- The data-style `wf-<` proof recurses on the three constructors of
165+
-- `_≤_`. Here `_≤′_` is recursive — there are no constructors to
166+
-- pattern-match on — so the predecessor lemmas reduce predecessors
167+
-- through the computed shape of `_<′_`:
168+
--
169+
-- β <′ osuc α ≡ osuc β ≤′ osuc α ≡ β ≤′ α
170+
-- β <′ olim f ≡ Σ ℕ (λ n → β <′ f n)
171+
-- β <′ oz ≡ ⊥
172+
--
173+
-- so the `osuc` case is "lift hypothetical predecessors of β through
174+
-- ≤′-trans to predecessors of α", and the `olim` case is the same
175+
-- branch-selection move as the data-style `pred-of-olim`.
176+
177+
pred-of-osuc-<′ : {α} Acc _<′_ α {β} β <′ osuc α Acc _<′_ β
178+
pred-of-osuc-<′ {α} (acc rsα) {β} p =
179+
acc (λ {γ} q rsα (≤′-trans {osuc γ} {β} {α} q p))
180+
181+
pred-of-olim-<′ : {f} ( n Acc _<′_ (f n)) {β} β <′ olim f Acc _<′_ β
182+
pred-of-olim-<′ wfs (n , q) with wfs n
183+
... | acc rs = rs q
184+
185+
-- Top-level WF: structural induction on `Ord`. Mirrors `wf-<`'s
186+
-- shape; differs only in the predecessor lemmas above.
187+
188+
wf-<′ : WellFounded _<′_
189+
wf-<′ oz = acc (λ {β} ())
190+
wf-<′ (osuc α) = acc (pred-of-osuc-<′ (wf-<′ α))
191+
wf-<′ (olim f) = acc (pred-of-olim-<′ (λ n wf-<′ (f n)))

proofs/agda/Smoke.agda

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ open import Echo using
3030
; Echo-comp-pent-Σ-assoc-to-from
3131
; Echo-comp-iso
3232
; cancel-iso
33+
; Echo-comp-pent-Σ-assoc
3334
)
3435
open import EchoCharacteristic using (collapse; echo-true; echo-false; echo-true≢echo-false)
3536
open import EchoResidue using (EchoR; collapse-to-residue; strict-weakening-collapse; no-section-collapse-to-residue)
@@ -266,14 +267,23 @@ open import Ordinal.Brouwer.Arithmetic using
266267

267268
-- Phase 1.3 (2026-04-28) — recursive `_≤′_` per Echidna SA + swarm
268269
-- recommendation. Bullseye lemma `osuc-mono-≤′ p = p` is identity.
269-
-- Limit case of `≤′-refl` deferred (see module preamble).
270+
-- Limit case of `≤′-refl` discharged via `≤′-lim` (2026-04-30).
271+
-- WF for the recursive order landed 2026-05-01: `wf-<′` mirrors
272+
-- `wf-<` with predecessor lemmas reducing through computed shapes.
270273
open import Ordinal.Brouwer.Phase13 using
271274
( _≤′_
272275
; _<′_
273276
; osuc-mono-≤′
274277
; osuc-mono-<′
275278
; ≤′-zero
276279
; oz<′osuc
280+
; ≤′-lim
281+
; ≤′-refl
282+
; f-in-lim′
283+
; ≤′-trans
284+
; pred-of-osuc-<′
285+
; pred-of-olim-<′
286+
; wf-<′
277287
)
278288

279289
-- Recommended rank function for unbudgeted `wf-<ᵇʳᶠ_` per Echidna's

0 commit comments

Comments
 (0)