Skip to content

Commit a6d83c2

Browse files
hyperpolymathclaude
andcommitted
agda: Brouwer ordinal arithmetic (Option B Phase 1.2)
Lands `proofs/agda/Ordinal/Brouwer/Arithmetic.agda` with the Phase 1.2 definitions: * `_⊕_` — left-recursive naive ordinal sum on `Ord`. Not Hessenberg; designed to be the cheapest sum that admits right-monotonicity (the only direction Phase 2.2 needs). Left-unit `oz ⊕ β = β` is definitional. * `nat-to-ord : ℕ → Ord` — standard successor-stack encoding. * `ω-rank : OmegaIndex → Ord` — rank of an Ω-marker. `fin n ↦ osuc^(n+1) oz`, `ω ↦ olim nat-to-ord`. * `psi-rank : OmegaIndex → Ord → Ord = osuc (ω-rank ν ⊕ α)`. The outer `osuc` dominates `ω-rank ν` regardless of α; the `⊕ α` tail carries the ψ-argument's rank through for later right-mono descent. Monotonicity proofs are scheduled for Phase 1.3. Probing here surfaced a design question for the `_≤_` axiomatisation in `Ordinal.Brouwer`: the data-constructor version makes `osuc-mono-≤` non-trivial in the `≤-lim` case. Phase 1.3 will resolve via either a `≤-lim-below` constructor or a recursive `_≤_` definition. The choice is documented in `docs/buchholz-plan.adoc` for the next session. Pinned in `Smoke.agda`; imported from `All.agda`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 54bc5ae commit a6d83c2

4 files changed

Lines changed: 132 additions & 4 deletions

File tree

docs/buchholz-plan.adoc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,25 @@ The work is layered into phases:
276276
`wf-< : WellFounded _<_` proved directly by structural induction
277277
on `Ord`. This module is `_<ᵇ_`-independent and establishes the
278278
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 α).
279+
* Phase 1.2 (DONE 2026-04-24, `proofs/agda/Ordinal/Brouwer/Arithmetic.agda`):
280+
ordinal arithmetic *definitions*. Lands `_⊕_` (left-recursive
281+
naive sum; not Hessenberg — right-monotonicity is enough for our
282+
rank needs), `nat-to-ord`, `ω-rank : OmegaIndex → Ord`, and
283+
`psi-rank : OmegaIndex → Ord → Ord = osuc (ω-rank ν ⊕ α)`. All
284+
non-trivial monotonicity proofs are deferred to Phase 1.3 —
285+
probing Phase 1.2 surfaced a design question about `_≤_`'s
286+
axiomatisation (data-constructors vs recursive definition) that
287+
Phase 1.3 will resolve when it attempts `osuc-mono-≤` and
288+
`⊕-mono-≤-right`.
283289
* Phase 1.3 (PLANNED): monotonicity lemmas for each operation in
284290
Phase 1.2. Needed for propagating `<ᵇ`-descent into `<Ord`-descent.
291+
Likely includes a small `Ordinal.Brouwer` refactor: the current
292+
`data _≤_` with `≤-refl` / `≤-suc` / `≤-lim` constructors makes
293+
`osuc-mono-≤ : x ≤ y → osuc x ≤ osuc y` non-trivial in the
294+
`≤-lim` case (the premise `x ≤ f n` does not lift to
295+
`osuc x ≤ f n`). Candidate fixes: add a `≤-lim-below` constructor
296+
for `(∀ n → f n ≤ β) → olim f ≤ β`, or switch `_≤_` to a
297+
recursive definition where `osuc-mono-≤` is the identity.
285298
* Phase 2.1 (PLANNED): `rank : BT → Ord` interpretation.
286299
* Phase 2.2 (PLANNED): `rank-mono : _<ᵇ_ ⇒ (_<_ on rank)`
287300
constructor-by-constructor.

proofs/agda/All.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ open import Ordinal.CNF
3333
open import Ordinal.PsiSimple
3434
open import Ordinal.OmegaMarkers
3535
open import Ordinal.Brouwer
36+
open import Ordinal.Brouwer.Arithmetic
3637
open import Ordinal.Buchholz.Syntax
3738
open import Ordinal.Buchholz.Closure
3839
open import Ordinal.Buchholz.Order
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- Phase 1.2 of the Option B programme (see `docs/buchholz-plan.adoc`).
4+
--
5+
-- Ordinal arithmetic on Brouwer notations: *definitions* only.
6+
-- All non-trivial monotonicity proofs are scheduled for Phase 1.3,
7+
-- where they may drive a small redesign of `_≤_` in the base
8+
-- `Ordinal.Brouwer` module (the current data-type axiomatisation
9+
-- proves key lemmas like `osuc-mono-≤` only with some care, and
10+
-- the Phase 1.3 work will decide whether to add constructors or
11+
-- switch to a recursive `_≤_`).
12+
--
13+
-- Contents:
14+
--
15+
-- * `_⊕_` — left-recursive naive ordinal sum. Not Hessenberg; the
16+
-- full natural-sum definition (commutative + bi-monotonic) needs
17+
-- more machinery than pays off for the rank we actually need.
18+
-- This is the cheapest sum that still lets `psi-rank` propagate
19+
-- ordinal-argument descent via right-monotonicity, which is the
20+
-- only direction we need for Phase 2.2.
21+
-- * `nat-to-ord` — the standard successor-stack encoding of ℕ.
22+
-- * `ω-rank : OmegaIndex → Ord` — rank for Ω-markers. `fin n` maps
23+
-- to `osuc^(n+1) oz`, `ω` maps to the canonical Brouwer ω.
24+
-- * `psi-rank : OmegaIndex → Ord → Ord` — rank for ψ-terms, shape
25+
-- `osuc (ω-rank ν ⊕ α)`. The outer successor guarantees
26+
-- `ω-rank ν < psi-rank ν α` regardless of α; the `⊕ α` tail
27+
-- carries the ψ-argument's rank so that `<ᵇ-ψα α<β` descends
28+
-- via right-monotonicity of `⊕`.
29+
30+
module Ordinal.Brouwer.Arithmetic where
31+
32+
open import Data.Nat.Base using (ℕ; zero; suc)
33+
34+
open import Ordinal.OmegaMarkers using (OmegaIndex; fin; ω)
35+
open import Ordinal.Brouwer using (Ord; oz; osuc; olim)
36+
37+
----------------------------------------------------------------------------
38+
-- Naive ordinal sum
39+
----------------------------------------------------------------------------
40+
41+
-- Left-recursive: zero on the left is the unit definitionally,
42+
-- successor on the left lifts the successor past the sum, limit on
43+
-- the left distributes under the sum.
44+
45+
infixl 6 _⊕_
46+
47+
_⊕_ : Ord Ord Ord
48+
oz ⊕ β = β
49+
osuc α ⊕ β = osuc (α ⊕ β)
50+
olim f ⊕ β = olim (λ n f n ⊕ β)
51+
52+
----------------------------------------------------------------------------
53+
-- Rank target for Ω-indices
54+
----------------------------------------------------------------------------
55+
56+
-- Standard encoding of ℕ into Ord as a successor stack.
57+
58+
nat-to-ord : Ord
59+
nat-to-ord zero = oz
60+
nat-to-ord (suc n) = osuc (nat-to-ord n)
61+
62+
-- Rank of an Ω-marker. `fin n` goes to a successor stack of length
63+
-- `n + 1`; `ω` goes to the canonical Brouwer ω. The `+ 1` offset
64+
-- keeps `ω-rank (fin 0)` strictly above `oz = rank bzero` so the
65+
-- `<ᵇ-0-Ω` constructor descends into `<Ord` in Phase 2.2.
66+
67+
ω-rank : OmegaIndex Ord
68+
ω-rank (fin n) = nat-to-ord (suc n)
69+
ω-rank ω = olim nat-to-ord
70+
71+
----------------------------------------------------------------------------
72+
-- Rank target for ψ-terms
73+
----------------------------------------------------------------------------
74+
75+
-- `psi-rank ν α = osuc (ω-rank ν ⊕ α)`. The outer `osuc` is what
76+
-- `<ᵇ-0-ψ` / `<ᵇ-ψΩ≤` need (strict domination of bzero / Ω-rank);
77+
-- the `⊕ α` tail is what `<ᵇ-ψα` needs (right-monotonic descent on
78+
-- the ψ-argument).
79+
80+
psi-rank : OmegaIndex Ord Ord
81+
psi-rank ν α = osuc (ω-rank ν ⊕ α)
82+
83+
----------------------------------------------------------------------------
84+
-- Definitional sanity checks (no proofs, just unit tests via ≡)
85+
----------------------------------------------------------------------------
86+
87+
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
88+
open import Ordinal.Brouwer using (one; two)
89+
90+
-- The smallest Ω-rank is strictly above zero.
91+
92+
ω-rank-fin0 : ω-rank (fin 0) ≡ one
93+
ω-rank-fin0 = refl
94+
95+
ω-rank-fin1 : ω-rank (fin 1) ≡ two
96+
ω-rank-fin1 = refl
97+
98+
-- `psi-rank ν oz = osuc (ω-rank ν ⊕ oz)`. Since `⊕`'s right-identity
99+
-- is only up to `≤` (proved in Phase 1.3), we don't state `≡` here.
100+
101+
-- Left-unit of `⊕` is definitional.
102+
103+
⊕-oz-left : β oz ⊕ β ≡ β
104+
⊕-oz-left _ = refl

proofs/agda/Smoke.agda

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ open import Ordinal.Brouwer using
161161
; one<ω
162162
)
163163

164+
open import Ordinal.Brouwer.Arithmetic using
165+
( _⊕_
166+
; nat-to-ord
167+
; ω-rank
168+
; psi-rank
169+
; ⊕-oz-left
170+
; ω-rank-fin0
171+
; ω-rank-fin1
172+
)
173+
164174
open import Ordinal.OmegaMarkers using
165175
( OmegaIndex
166176
; fin

0 commit comments

Comments
 (0)