Skip to content

Commit 54bc5ae

Browse files
hyperpolymathclaude
andcommitted
agda: Brouwer ordinals + direct WF (Option B Phase 1.1)
Starts the long-term rank-based WF programme for the enlarged Buchholz order per `docs/buchholz-plan.adoc` Option B. Lands `proofs/agda/Ordinal/Brouwer.agda`: * `data Ord = oz | osuc Ord | olim (ℕ → Ord)` — standard Brouwer ordinal notations. * `_≤_` with three generators (refl, successor-right, limit-branch selection) and `_<_ = osuc α ≤ β`. * Basic calculus: `≤-zero`, `≤-trans`, `≤-osuc`, `<-trans`, `<-suc-self`, `f-in-lim`. * `wf-< : WellFounded _<_` — proved directly by structural induction on `Ord`; no mutual with `_<ᵇ_`. This independence is the whole point of the phase. * `<-irrefl` as corollary via `wf⇒asym wf-<`. * Small worked witnesses (`oz<one`, `one<two`, `oz<two`, `one<ω`). Phase 1.2+ will add Hessenberg addition, Veblen collapse, and a `rank : BT → Ord` with monotonicity, eventually letting us derive `wf-<ᵇ` for the enlarged order via `Subrelation` + `InverseImage` and retire ~12 wrapper/surface modules. Pinned in top-level `Smoke.agda`; imported from `All.agda`. Buchholz plan updated with the full phased programme. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8b9f8c0 commit 54bc5ae

4 files changed

Lines changed: 227 additions & 0 deletions

File tree

docs/buchholz-plan.adoc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,37 @@ Internalisation investigation (2026-04-24):
262262
(`SurfaceOrder`) as before. The blocker is documented here rather
263263
than rediscovered.
264264

265+
Option B programme (rank-based direct WF, 2026-04-24 onwards).
266+
After analysing the three unblock routes, Option B (build an
267+
independently well-founded rank target + transport WF via
268+
`Subrelation` + `InverseImage`) was chosen as the long-term path.
269+
It retires ~12 wrapper / surface / iterated-order modules that
270+
exist only to compensate for the missing direct internalisation.
271+
The work is layered into phases:
272+
273+
* Phase 1.1 (DONE 2026-04-24, `proofs/agda/Ordinal/Brouwer.agda`):
274+
Brouwer-style ordinal notation `data Ord = oz | osuc | olim`
275+
with `_≤_`, `_<_ = osuc α ≤ β`, transitivity, and
276+
`wf-< : WellFounded _<_` proved directly by structural induction
277+
on `Ord`. This module is `_<ᵇ_`-independent and establishes the
278+
rank target. Pinned in `Smoke.agda`.
279+
* Phase 1.2 (PLANNED): ordinal arithmetic — Hessenberg (natural)
280+
addition, ω-exponentiation, Veblen collapse functions. Used to
281+
construct ranks for `bplus α β` (Hessenberg of ranks) and
282+
`bpsi μ α` (Veblen-at-μ of rank α).
283+
* Phase 1.3 (PLANNED): monotonicity lemmas for each operation in
284+
Phase 1.2. Needed for propagating `<ᵇ`-descent into `<Ord`-descent.
285+
* Phase 2.1 (PLANNED): `rank : BT → Ord` interpretation.
286+
* Phase 2.2 (PLANNED): `rank-mono : _<ᵇ_ ⇒ (_<_ on rank)`
287+
constructor-by-constructor.
288+
* Phase 3 (PLANNED): add `<ᵇ-ψα` + `<ᵇ-+2` to `_<ᵇ_`, extend
289+
`rank-mono` with the two new cases, replace `wf-<ᵇ` in
290+
`WellFounded.agda` with `Subrelation.wellFounded rank-mono
291+
(InverseImage.wellFounded rank wf-<)`. At that point `<ᵇ-irrefl`
292+
becomes a corollary of `wf⇒asym wf-<ᵇ`.
293+
* Phase 4 (PLANNED): retire the wrapper / surface / iterated-order
294+
modules that become redundant.
295+
265296
Risk-gated bridge currently admitted:
266297

267298
* The original top-marker bridges remain as named specialised lemmas

proofs/agda/All.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ open import Ordinal.Closure
3232
open import Ordinal.CNF
3333
open import Ordinal.PsiSimple
3434
open import Ordinal.OmegaMarkers
35+
open import Ordinal.Brouwer
3536
open import Ordinal.Buchholz.Syntax
3637
open import Ordinal.Buchholz.Closure
3738
open import Ordinal.Buchholz.Order

proofs/agda/Ordinal/Brouwer.agda

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- Phase 1.1 of the WF-track "Option B" programme in
4+
-- `docs/buchholz-plan.adoc`. Establishes a constructive
5+
-- Brouwer-style ordinal notation with a direct well-foundedness
6+
-- proof. This file does NOT depend on `Ordinal.Buchholz.Order`
7+
-- or any `<ᵇ` infrastructure — that independence is the whole
8+
-- point. Later phases (2+) will embed the Buchholz order into
9+
-- this rank target and derive `wf-<ᵇ` for the enlarged order via
10+
-- `Subrelation.wellFounded`.
11+
--
12+
-- Representation: zero, successor, ℕ-indexed supremum. This already
13+
-- exhausts countable ordinals below ω₁; for Buchholz rank up to
14+
-- ψ(Ω_ω) it is far more than we need.
15+
--
16+
-- The strict order `_<_` is defined as `osuc α ≤ β`. WF is proved by
17+
-- structural induction on `Ord` directly; the higher-order `olim`
18+
-- branch is accepted by Agda's structural recursion on subterms of
19+
-- the function-indexed inductive.
20+
21+
module Ordinal.Brouwer where
22+
23+
open import Data.Empty using (⊥; ⊥-elim)
24+
open import Data.Nat.Base using (ℕ; zero; suc)
25+
open import Induction.WellFounded using (Acc; acc; WellFounded; wf⇒asym)
26+
open import Relation.Nullary using (¬_)
27+
28+
----------------------------------------------------------------------------
29+
-- Ordinal notations
30+
----------------------------------------------------------------------------
31+
32+
data Ord : Set where
33+
oz : Ord
34+
osuc : Ord Ord
35+
olim : (ℕ Ord) Ord
36+
37+
----------------------------------------------------------------------------
38+
-- Strict and non-strict orders
39+
----------------------------------------------------------------------------
40+
41+
infix 4 _≤_ _<_
42+
43+
-- Reflexive closure. Three generators:
44+
-- * identity,
45+
-- * one-step successor on the right-hand side,
46+
-- * selecting a specific branch inside a limit on the right.
47+
48+
data _≤_ : Ord Ord Set where
49+
≤-refl : {α} α ≤ α
50+
≤-suc : {α β} α ≤ β α ≤ osuc β
51+
≤-lim : {α f} n α ≤ f n α ≤ olim f
52+
53+
-- Strict order: successor of α still fits at-or-below β.
54+
55+
_<_ : Ord Ord Set
56+
α < β = osuc α ≤ β
57+
58+
----------------------------------------------------------------------------
59+
-- Basic structural properties
60+
----------------------------------------------------------------------------
61+
62+
-- Zero is minimum. Structural on the right-hand side.
63+
64+
≤-zero : {α} oz ≤ α
65+
≤-zero {oz} = ≤-refl
66+
≤-zero {osuc α} = ≤-suc ≤-zero
67+
≤-zero {olim f} = ≤-lim 0 ≤-zero
68+
69+
-- Weakening into successor.
70+
71+
≤-step : {α β} α ≤ β α ≤ osuc β
72+
≤-step = ≤-suc
73+
74+
-- Each branch of a limit sits at-or-below it. Strict-below is not
75+
-- available in general — a constant sequence has `f n ≡ olim f` —
76+
-- but the ≤ witness is enough for rank bookkeeping.
77+
78+
f-in-lim : f n f n ≤ olim f
79+
f-in-lim f n = ≤-lim n ≤-refl
80+
81+
-- Successor strictly above its predecessor.
82+
83+
<-suc-self : {α} α < osuc α
84+
<-suc-self = ≤-refl
85+
86+
----------------------------------------------------------------------------
87+
-- Transitivity
88+
----------------------------------------------------------------------------
89+
90+
-- Transitivity of ≤ by induction on the right leg. `≤-refl` case
91+
-- returns the left leg unchanged; `≤-suc` / `≤-lim` cases propagate.
92+
93+
≤-trans : {α β γ} α ≤ β β ≤ γ α ≤ γ
94+
≤-trans p ≤-refl = p
95+
≤-trans p (≤-suc q) = ≤-suc (≤-trans p q)
96+
≤-trans p (≤-lim n q) = ≤-lim n (≤-trans p q)
97+
98+
-- β ≤ osuc β, the canonical one-step witness.
99+
100+
≤-osuc : {β} β ≤ osuc β
101+
≤-osuc = ≤-suc ≤-refl
102+
103+
-- Transitivity of <: osuc α ≤ β ≤ osuc β ≤ osuc β... ≤ γ.
104+
105+
<-trans : {α β γ} α < β β < γ α < γ
106+
<-trans {α} {β} p q = ≤-trans (≤-trans p ≤-osuc) q
107+
108+
----------------------------------------------------------------------------
109+
-- Well-foundedness
110+
----------------------------------------------------------------------------
111+
112+
-- Predecessor of osuc α is either α itself (≤-refl case) or a
113+
-- strictly smaller β with β < α (≤-suc case). Both yield Acc.
114+
115+
pred-of-osuc : {α} Acc _<_ α {β} β < osuc α Acc _<_ β
116+
pred-of-osuc (acc rsα) ≤-refl = acc rsα
117+
pred-of-osuc (acc rsα) (≤-suc q) = rsα q
118+
119+
-- Predecessor of olim f: must come via ≤-lim with a branch index `n`,
120+
-- giving β < f n. Inductive accessibility of f n gives Acc β.
121+
122+
pred-of-olim :
123+
{f} ( n Acc _<_ (f n))
124+
{β} β < olim f Acc _<_ β
125+
pred-of-olim wfs (≤-lim n q) with wfs n
126+
... | acc rs = rs q
127+
128+
-- Top-level WF: structural induction on Ord.
129+
130+
wf-< : WellFounded _<_
131+
wf-< oz = acc λ ()
132+
wf-< (osuc α) = acc (pred-of-osuc (wf-< α))
133+
wf-< (olim f) = acc (pred-of-olim (λ n wf-< (f n)))
134+
135+
----------------------------------------------------------------------------
136+
-- Derived corollaries
137+
----------------------------------------------------------------------------
138+
139+
-- Irreflexivity via wf⇒asym; no direct pattern match is needed.
140+
141+
<-irrefl : {α} ¬ (α < α)
142+
<-irrefl {α} p = wf⇒asym wf-< p p
143+
144+
-- Worked small witnesses.
145+
146+
one : Ord
147+
one = osuc oz
148+
149+
two : Ord
150+
two = osuc one
151+
152+
ω : Ord
153+
ω = olim nat-to-ord
154+
where
155+
nat-to-ord : Ord
156+
nat-to-ord zero = oz
157+
nat-to-ord (suc n) = osuc (nat-to-ord n)
158+
159+
oz<one : oz < one
160+
oz<one = <-suc-self
161+
162+
one<two : one < two
163+
one<two = <-suc-self
164+
165+
oz<two : oz < two
166+
oz<two = <-trans oz<one one<two
167+
168+
one<ω : one < ω
169+
one<ω = ≤-lim 2 ≤-refl

proofs/agda/Smoke.agda

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,32 @@ open import Ordinal.PsiSimple using
135135
; psi-least
136136
)
137137

138+
open import Ordinal.Brouwer using
139+
( Ord
140+
; oz
141+
; osuc
142+
; olim
143+
; _≤_
144+
; _<_
145+
; ≤-refl
146+
; ≤-suc
147+
; ≤-lim
148+
; ≤-zero
149+
; ≤-trans
150+
; ≤-osuc
151+
; f-in-lim
152+
; <-suc-self
153+
; <-trans
154+
; pred-of-osuc
155+
; pred-of-olim
156+
; wf-<
157+
; <-irrefl
158+
; oz<one
159+
; one<two
160+
; oz<two
161+
; one<ω
162+
)
163+
138164
open import Ordinal.OmegaMarkers using
139165
( OmegaIndex
140166
; fin

0 commit comments

Comments
 (0)