Skip to content

Commit e0f67cb

Browse files
hyperpolymathclaude
andcommitted
agda(Brouwer/Buchholz): Phase 1.3 + unbudgeted-WF scaffolding per Echidna SA recommendation
Two new modules landing the structural part of Echidna's design-search recommendations. Both compile clean under `--safe --without-K`; pinned in `Smoke.agda`; wired into `All.agda`. ## Ordinal.Brouwer.Phase13 Stands up the recursive `_≤′_` Echidna's SA picked unanimously over data-style alternatives (energy [0, 0, 1, 0]). Five clauses: oz ≤′ _ = ⊤ osuc α ≤′ oz = ⊥ osuc α ≤′ osuc β = α ≤′ β osuc α ≤′ olim f = Σ ℕ (λ n → osuc α ≤′ f n) olim f ≤′ β = (n : ℕ) → f n ≤′ β Phase-1.3 bullseye `osuc-mono-≤′ p = p` lands as identity — what was a non-trivial induction in the data-`_≤_` shape collapses to a single character of proof under the recursive shape. Strict version `osuc-mono-<′` ditto. `≤′-zero` and `oz<′osuc` follow definitionally. Open: `≤′-refl` for the `olim f` case is `(n : ℕ) → f n ≤′ olim f`, which requires `f-in-lim′`. The `f n = olim g` sub-case of `f-in-lim′` is the documented obstacle — termination is fine (`g m ≺ f n`) but Agda's `with f n` pattern loses the equation. Two viable closure paths (mutual with `≤′-trans`, or accessibility- strengthened lemma) noted in the module preamble. Left explicit rather than buried so the next session picks up cleanly. ## Ordinal.Buchholz.RankBrouwer The `rank : BT → Ord` shape Echidna's SA + 4-agent swarm both unanimously recommended (energy [3, 0, 1] over a 27-candidate design space): rank bzero = oz rank (bOmega ν) = ω-rank ν rank (bplus x y) = rank x ⊕ rank y rank (bpsi ν α) = psi-rank ν (rank α) Compiles cleanly using only existing primitives from `Ordinal.Brouwer.Arithmetic`. The transport theorem `rank-mono : x <ᵇʳᶠ y → rank x < rank y` is deferred to a follow-up commit because its three constructor cases (`<ᵇʳᶠ-core`, `<ᵇʳᶠ-ψα`, `<ᵇʳᶠ-+2`) all depend on lemmas not yet landed: * `<ᵇʳᶠ-core` ⟹ Phase-2.2 `rank-mono-<ᵇ` (separate proof) * `<ᵇʳᶠ-ψα` ⟹ Phase-1.3 `⊕-mono-<-right` * `<ᵇʳᶠ-+2` ⟹ Phase-1.3 `⊕-mono-<-right` Closing chain (once those land): wf-<ᵇʳᶠ : WellFounded _<ᵇʳᶠ_ wf-<ᵇʳᶠ = Subrelation.wellFounded rank-mono (InverseImage.wellFounded rank wf-<) ## Verification `agda proofs/agda/All.agda` exits 0 under `--safe --without-K`. No postulates introduced. `Smoke.agda` pins six new headline names: `_≤′_`, `_<′_`, `osuc-mono-≤′`, `osuc-mono-<′`, `≤′-zero`, `oz<′osuc`, plus the `rank` function. ## Provenance The recursive `_≤′_` shape and rank function were both produced by echidna's `design search` and `design swarm` strategies; full design-search log in: echidna/docs/decisions/2026-04-28-corpus-and-design-search.md echo-types/docs/echidna-design-search-2026-04-28.adoc Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent facd2e7 commit e0f67cb

4 files changed

Lines changed: 216 additions & 0 deletions

File tree

proofs/agda/All.agda

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ open import Ordinal.PsiSimple
3737
open import Ordinal.OmegaMarkers
3838
open import Ordinal.Brouwer
3939
open import Ordinal.Brouwer.Arithmetic
40+
open import Ordinal.Brouwer.Phase13
4041
open import Ordinal.Buchholz.Syntax
4142
open import Ordinal.Buchholz.Closure
4243
open import Ordinal.Buchholz.Order
44+
open import Ordinal.Buchholz.OrderExtended
4345
open import Ordinal.Buchholz.Psi
4446
open import Ordinal.Buchholz.Examples
4547
open import Ordinal.Buchholz.WellFormed
@@ -53,6 +55,7 @@ open import Ordinal.Buchholz.VeblenComparisonModel
5355
open import Ordinal.Buchholz.ExtendedOrder
5456
open import Ordinal.Buchholz.LiftedExtendedOrder
5557
open import Ordinal.Buchholz.IteratedExtendedOrder
58+
open import Ordinal.Buchholz.RankBrouwer
5659
open import Ordinal.Buchholz.RecursiveSurfaceOrder
5760
open import Ordinal.Buchholz.RecursiveSurfaceBudget
5861
open import Ordinal.Buchholz.SurfaceOrder
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
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.
21+
--
22+
-- See `echidna/docs/decisions/2026-04-28-corpus-and-design-search.md`
23+
-- and `echo-types/docs/echidna-design-search-2026-04-28.adoc` for
24+
-- the full design-search log.
25+
--
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
35+
--
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.
41+
--
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.
47+
--
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.
62+
63+
module Ordinal.Brouwer.Phase13 where
64+
65+
open import Data.Nat.Base using (ℕ)
66+
open import Data.Product.Base using (Σ)
67+
open import Data.Unit.Base using (⊤; tt)
68+
open import Data.Empty using (⊥)
69+
70+
open import Ordinal.Brouwer using (Ord; oz; osuc; olim)
71+
72+
----------------------------------------------------------------------------
73+
-- Recursive `_≤′_` per the Echidna SA recommendation
74+
----------------------------------------------------------------------------
75+
76+
infix 4 _≤′_
77+
78+
_≤′_ : Ord Ord Set
79+
oz ≤′ _ =
80+
osuc α ≤′ oz =
81+
osuc α ≤′ osuc β = α ≤′ β
82+
osuc α ≤′ olim f = Σ ℕ (λ n osuc α ≤′ f n)
83+
olim f ≤′ β = (n : ℕ) f n ≤′ β
84+
85+
----------------------------------------------------------------------------
86+
-- Phase-1.3 bullseye: osuc-mono-≤′ is identity
87+
----------------------------------------------------------------------------
88+
89+
-- Under the recursive definition, `osuc α ≤′ osuc β` reduces
90+
-- definitionally to `α ≤′ β`. No structural recursion on the proof,
91+
-- no case split on α or β. This is the entire point of the
92+
-- redesign — what was a non-trivial induction in the data-`_≤_`
93+
-- shape collapses to identity.
94+
95+
osuc-mono-≤′ : {α β} α ≤′ β osuc α ≤′ osuc β
96+
osuc-mono-≤′ p = p
97+
98+
-- Strict version follows immediately. α <′ β is `osuc α ≤′ β`.
99+
100+
infix 4 _<′_
101+
102+
_<′_ : Ord Ord Set
103+
α <′ β = osuc α ≤′ β
104+
105+
osuc-mono-<′ : {α β} α <′ β osuc α <′ osuc β
106+
osuc-mono-<′ p = p
107+
108+
----------------------------------------------------------------------------
109+
-- Trivial corollaries (all definitional)
110+
----------------------------------------------------------------------------
111+
112+
≤′-zero : {α} oz ≤′ α
113+
≤′-zero = tt
114+
115+
-- `oz <′ α` for α nonzero. Since `oz <′ α = osuc oz ≤′ α`, we case on α.
116+
117+
oz<′osuc : {α} oz <′ osuc α
118+
oz<′osuc {α} = ≤′-zero {α}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- Rank function `rank : BT → Ord` for the Phase-2 transport route to
4+
-- unbudgeted `WellFounded _<ᵇʳᶠ_`. Echidna's design-search +
5+
-- 4-agent swarm both unanimously recommended this shape (energy
6+
-- [3, 0, 1]: three downstream blockers, zero capability gaps,
7+
-- minimal structural cost).
8+
--
9+
-- See `echidna/docs/decisions/2026-04-28-corpus-and-design-search.md`
10+
-- and `echo-types/docs/echidna-design-search-2026-04-28.adoc` for
11+
-- the SA + swarm output, including the 5 next-best alternatives all
12+
-- of which scored strictly worse.
13+
--
14+
-- ## What's here
15+
--
16+
-- * `rank : BT → Ord` — the recommended shape, structural recursion
17+
-- on BT.
18+
--
19+
-- ## What's deferred
20+
--
21+
-- The transport theorem `rank-mono : ∀ {x y} → x <ᵇʳᶠ y → rank x <
22+
-- rank y` requires three downstream lemmas, all of which are open:
23+
--
24+
-- * `<ᵇʳᶠ-core x<ᵇy` ⟹ Phase-2.2 `rank-mono-<ᵇ`
25+
-- * `<ᵇʳᶠ-ψα α<ᵇʳᶠβ` ⟹ Phase-1.3 `⊕-mono-<-right`
26+
-- * `<ᵇʳᶠ-+2 y<ᵇʳᶠz` ⟹ Phase-1.3 `⊕-mono-<-right`
27+
--
28+
-- Once those land, the closing chain is:
29+
--
30+
-- wf-<ᵇʳᶠ : WellFounded _<ᵇʳᶠ_
31+
-- wf-<ᵇʳᶠ = Subrelation.wellFounded rank-mono
32+
-- (InverseImage.wellFounded rank wf-<)
33+
34+
module Ordinal.Buchholz.RankBrouwer where
35+
36+
open import Ordinal.Brouwer using (Ord; oz)
37+
open import Ordinal.Brouwer.Arithmetic using (_⊕_; ω-rank; psi-rank)
38+
open import Ordinal.Buchholz.Syntax using (BT; bzero; bOmega; bplus; bpsi)
39+
40+
----------------------------------------------------------------------------
41+
-- The recommended rank function
42+
----------------------------------------------------------------------------
43+
44+
-- `rank` interprets each Buchholz term as a Brouwer ordinal. The
45+
-- shape was selected by SA over a 27-candidate design space (3 ×
46+
-- 3 × 3 = bplus × bpsi × bOmega knobs):
47+
--
48+
-- * `bzero ↦ oz` — fixed (no nontrivial choice).
49+
-- * `bOmega ν ↦ ω-rank ν` — wins over `osuc (ω-rank ν)` by
50+
-- structural cost.
51+
-- * `bplus x y ↦ rank x ⊕ rank y`
52+
-- — wins over `osuc (rank x ⊕ rank y)`
53+
-- because the outer `osuc` is dead
54+
-- weight for `<ᵇʳᶠ-+2`'s right-
55+
-- monotonicity argument.
56+
-- * `bpsi ν α ↦ psi-rank ν (rank α)`
57+
-- — wins over `ω-rank ν ⊕ rank α` and
58+
-- `osuc (ω-rank ν) ⊕ rank α` by
59+
-- carrying the strictness witness
60+
-- (the `osuc` baked into psi-rank).
61+
62+
rank : BT Ord
63+
rank bzero = oz
64+
rank (bOmega ν) = ω-rank ν
65+
rank (bplus x y) = rank x ⊕ rank y
66+
rank (bpsi ν α) = psi-rank ν (rank α)

proofs/agda/Smoke.agda

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,24 @@ open import Ordinal.Brouwer.Arithmetic using
254254
; ω-rank-fin1
255255
)
256256

257+
-- Phase 1.3 (2026-04-28) — recursive `_≤′_` per Echidna SA + swarm
258+
-- recommendation. Bullseye lemma `osuc-mono-≤′ p = p` is identity.
259+
-- Limit case of `≤′-refl` deferred (see module preamble).
260+
open import Ordinal.Brouwer.Phase13 using
261+
( _≤′_
262+
; _<′_
263+
; osuc-mono-≤′
264+
; osuc-mono-<′
265+
; ≤′-zero
266+
; oz<′osuc
267+
)
268+
269+
-- Recommended rank function for unbudgeted `wf-<ᵇʳᶠ_` per Echidna's
270+
-- design search; transport theorem deferred until Phase 1.3 lemmas land.
271+
open import Ordinal.Buchholz.RankBrouwer using
272+
( rank
273+
)
274+
257275
open import Ordinal.OmegaMarkers using
258276
( OmegaIndex
259277
; fin
@@ -307,6 +325,17 @@ open import Ordinal.Buchholz.Closure using
307325
; cν-psi-decompose
308326
)
309327

328+
open import Ordinal.Buchholz.OrderExtended using
329+
( _<ᵇ⁺_
330+
; <ᵇ⁺-base
331+
; <ᵇ⁺-ψα
332+
; <ᵇ⁺-+2
333+
; <ᵇ⁺-irrefl
334+
; <ᵇ⁺-trans
335+
; <ᵇ⁺-ψα-refl
336+
; <ᵇ⁺-+2-refl
337+
)
338+
310339
open import Ordinal.Buchholz.Order using
311340
( _<ᵇ_
312341
; <ᵇ-0-Ω

0 commit comments

Comments
 (0)