Skip to content

Commit 52b774c

Browse files
committed
WF-1: restore main's Order.agda and re-target WellFounded.agda
Repairs two issues from the PR-16 merge resolution: 1. Smoke.agda stale: the merged Order.agda used PR-16's renamed constructors (<ᵇ-0Ω, <ᵇ-Ω+, <ᵇ-Ωψ, <ᵇ-ψν without the side condition, etc.) while Smoke.agda still pinned main's original seven names. Compile broke at Smoke.agda's import clause. 2. WellFounded.agda orphan: the new module was never imported from All.agda, so its headline `wf-<ᵇ` and `<ᵇ-irreflexive` lived as dead code. Plus a design concern: PR-16's rewritten order relaxed `<ᵇ-Ω+` / `<ᵇ-Ωψ` to unconditional, dropped `<ᵇ-ΩΩ` entirely, and restricted `<ᵇ-ψν` to same-α. The rank function in the PR's WellFounded.agda was carefully shaped around those weakenings. The resulting relation is well-founded but not a plausible Buchholz comparison: `bOmega Omegaω <ᵇ bplus bzero bzero` becomes provable despite ω being vastly bigger than 0 ordinally. Resolution: * proofs/agda/Ordinal/Buchholz/Order.agda Restored from origin/main (7 constructors with the Ω-index side conditions; `<ᵇ-irrefl`, `<ᵇ-trans`, named strict witnesses). * proofs/agda/Ordinal/Buchholz/WellFounded.agda Rewritten against the restored order. Proof structure: 1. `<Ω-wf`: well-foundedness of _<Ω_ via ℕ's <-wellFounded, lifted through the fin embedding, plus a separate ω step. 2. `wf-<ᵇ`: structural induction on BT. bOmega and bpsi use well-founded recursion on their Ω-index (via <Ω-wf). bplus uses mutual recursion with wf-<ᵇ on the first summand. 3. `<ᵇ-irreflexive`: derived from wf-<ᵇ via `wf⇒asym`. Sits alongside the direct-pattern `<ᵇ-irrefl` in Order.agda. * proofs/agda/All.agda Wires in Ordinal.Buchholz.WellFounded (was missing). * proofs/agda/Smoke.agda Pins `<Ω-wf`, `wf-<ᵇ`, `<ᵇ-irreflexive` from the new module. Order.agda pins stay as-is (Order.agda is restored verbatim). Verified: `agda proofs/agda/All.agda` and `agda proofs/agda/Smoke.agda` both exit 0 under --safe --without-K. No postulates introduced. The rank-embedding machinery from PR-16 is dropped in favour of direct structural accessibility, which fits the restored order's conditional constructors naturally. https://claude.ai/code/session_01JRLz84fAaWvRBKyXuc4tyK
1 parent e237bff commit 52b774c

4 files changed

Lines changed: 249 additions & 91 deletions

File tree

proofs/agda/All.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ open import Ordinal.OmegaMarkers
3535
open import Ordinal.Buchholz.Syntax
3636
open import Ordinal.Buchholz.Closure
3737
open import Ordinal.Buchholz.Order
38+
open import Ordinal.Buchholz.WellFounded
3839
open import Ordinal.Buchholz.Psi
3940
open import Ordinal.Buchholz.Examples
4041
open import Ordinal.Buchholz.WellFormed
Lines changed: 133 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,146 @@
11
{-# OPTIONS --safe --without-K #-}
22

3-
-- WF-1 core order for Buchholz terms.
3+
-- Stage WF-0 of the Buchholz well-foundedness workstream
4+
-- (docs/buchholz-plan.adoc, follow-up to E5–E7).
45
--
5-
-- This keeps the seven constructors that do not use the blocked
6-
-- shared-binder cases `<ᵇ-ψα` and `<ᵇ-+2`.
6+
-- Defines the binary strict order `_<ᵇ_` on Buchholz terms (BT) and
7+
-- establishes irreflexivity and transitivity across the cases that
8+
-- the term heads naturally determine. Totality is *not* proved here
9+
-- and neither is well-foundedness; those are WF-1 and WF-2.
10+
--
11+
-- Scope of this module. The 7 constructors below cover the head
12+
-- pairs marked ✓ in the matrix, with the lex-on-left-summand case
13+
-- for bplus and the lex-on-Ω-index case for bpsi:
14+
--
15+
-- head of x \ head of y │ bzero │ bOmega │ bplus │ bpsi
16+
-- ──────────────────────┼───────┼────────┼───────┼──────
17+
-- bzero │ – │ ✓ │ ✓ │ ✓
18+
-- bOmega │ │ ✓ │ │ ✓ (when μ <Ω ν)
19+
-- bplus │ │ │ ✓ │
20+
-- bpsi │ │ │ │ ✓ (when μ <Ω ν)
21+
--
22+
-- Open cases (no constructor yet; must be discharged in follow-ups
23+
-- before `<ᵇ`-totality and well-foundedness can land):
24+
--
25+
-- * bOmega vs bplus (either direction) — requires a comparison
26+
-- between atomic heads and additive normal forms.
27+
-- * bpsi vs bplus (either direction) — same reason, mediated by
28+
-- the leading bpsi summand of a bplus in CNF.
29+
-- * bpsi vs bOmega with ν ≤Ω μ — the admissibility condition makes
30+
-- bpsi ν α ≤ᵇ bOmega μ when μ exceeds ν; the exact form is part
31+
-- of the Buchholz 1986 comparison and is deferred.
32+
-- * Two same-binder sub-cases whose natural shapes run into Agda
33+
-- 2.6.3's `--without-K` restriction on reflexive-equation
34+
-- elimination and are deferred pending a K-free reformulation:
35+
-- - bpsi ν α <ᵇ bpsi ν β with α <ᵇ β (same Ω-index ν).
36+
-- - bplus x y₂ <ᵇ bplus x z₂ with y₂ <ᵇ z₂ (same left summand).
37+
-- In both cases the constructor shares a binder between the two
38+
-- sides of `<ᵇ`, which `<ᵇ-irrefl`'s pattern unification cannot
39+
-- reduce. A rank-embedding or heterogeneous-equality formulation
40+
-- is the next follow-up on top of WF-0.
741

842
module Ordinal.Buchholz.Order where
943

10-
open import Data.Nat.Base using (ℕ; _<_)
44+
open import Data.Empty using ()
1145

12-
open import Ordinal.OmegaMarkers using (OmegaIndex; fin)
46+
open import Ordinal.OmegaMarkers using (OmegaIndex; _<Ω_; <Ω-irrefl; <Ω-trans)
1347
open import Ordinal.Buchholz.Syntax using (BT; bzero; bOmega; bplus; bpsi)
1448

15-
data _<Ω_ : OmegaIndex OmegaIndex Set where
16-
<Ω-fin : {m n : ℕ} m < n fin m <Ω fin n
49+
data _<ᵇ_ : BT BT Set where
50+
-- bzero is minimum against every non-bzero head.
51+
<ᵇ-0-Ω : {μ} bzero <ᵇ bOmega μ
52+
<ᵇ-0-+ : {x y} bzero <ᵇ bplus x y
53+
<ᵇ-0-ψ : {ν α} bzero <ᵇ bpsi ν α
1754

18-
infix 4 _<Ω_
55+
-- bOmega ordering by Ω-index.
56+
<ᵇ-ΩΩ : {μ ν} μ <Ω ν bOmega μ <ᵇ bOmega ν
1957

20-
data _<ᵇ_ : BT BT Set where
21-
<ᵇ-0Ω : {μ} bzero <ᵇ bOmega μ
22-
<ᵇ-0+ : {α β} bzero <ᵇ bplus α β
23-
<ᵇ-0ψ : {μ α} bzero <ᵇ bpsi μ α
24-
<ᵇ-Ω+ : {κ α β} bOmega κ <ᵇ bplus α β
25-
<ᵇ-Ωψ : {κ μ α} bOmega κ <ᵇ bpsi μ α
26-
<ᵇ-+1 : {α β γ} α <ᵇ β bplus α γ <ᵇ bplus β γ
27-
<ᵇ-ψν : {μ ν α} μ <Ω ν bpsi μ α <ᵇ bpsi ν α
58+
-- Ω_μ < ψ_ν(α) whenever μ <Ω ν. This is the admissibility side:
59+
-- ψ-terms at higher index dominate Ω-markers at lower index. The
60+
-- reverse direction (bpsi ν α <ᵇ bOmega μ with ν ≤Ω μ) is deferred.
61+
<ᵇ-Ωψ : {μ ν α} μ <Ω ν bOmega μ <ᵇ bpsi ν α
62+
63+
-- bpsi comparison by Ω-index only. The same-index sub-case (lex on
64+
-- the ψ-argument) is deferred pending a K-free formulation.
65+
<ᵇ-ψΩ : {μ ν α β} μ <Ω ν bpsi μ α <ᵇ bpsi ν β
66+
67+
-- bplus comparison by the left summand. The same-left sub-case
68+
-- (compare right summands when lefts agree) is deferred for the
69+
-- same `--without-K` reason as `<ᵇ-ψα` above: its natural shape
70+
-- `bplus x y₂ <ᵇ bplus x z₂` shares the binder `x` on both sides.
71+
<ᵇ-+1 : {x₁ x₂ y₁ y₂} x₁ <ᵇ y₁ bplus x₁ x₂ <ᵇ bplus y₁ y₂
2872

2973
infix 4 _<ᵇ_
74+
75+
----------------------------------------------------------------------------
76+
-- Irreflexivity
77+
----------------------------------------------------------------------------
78+
79+
-- Every constructor of `_<ᵇ_` with equal LHS and RHS reduces to a
80+
-- witness of irreflexivity at a strictly smaller structure (either
81+
-- `_<Ω_` or `_<ᵇ_` on a subterm). Explicit binds on the `{x}` ensure
82+
-- the K-free unifier does not get stuck on reflexive equations at the
83+
-- shared Ω-index of `<ᵇ-ψα`.
84+
85+
<ᵇ-irrefl : {x} x <ᵇ x
86+
<ᵇ-irrefl (<ᵇ-ΩΩ μ<μ) = <Ω-irrefl μ<μ
87+
<ᵇ-irrefl (<ᵇ-ψΩ μ<μ) = <Ω-irrefl μ<μ
88+
<ᵇ-irrefl (<ᵇ-+1 x<x) = <ᵇ-irrefl x<x
89+
90+
----------------------------------------------------------------------------
91+
-- Transitivity
92+
----------------------------------------------------------------------------
93+
94+
-- Case analysis on the two ordering derivations, recursing on
95+
-- `_<Ω_` or `_<ᵇ_` subterms as needed. Covers every pair of
96+
-- constructors whose middle term has a compatible head; pairs with
97+
-- incompatible middle heads are absurd by construction (no
98+
-- constructor witnesses them).
99+
100+
<ᵇ-trans : {x y z} x <ᵇ y y <ᵇ z x <ᵇ z
101+
-- Left leg: <ᵇ-0-Ω (x = bzero, y = bOmega _)
102+
<ᵇ-trans <ᵇ-0-Ω (<ᵇ-ΩΩ _) = <ᵇ-0-Ω
103+
<ᵇ-trans <ᵇ-0-Ω (<ᵇ-Ωψ _) = <ᵇ-0-ψ
104+
-- Left leg: <ᵇ-0-+ (x = bzero, y = bplus _ _)
105+
<ᵇ-trans <ᵇ-0-+ (<ᵇ-+1 _) = <ᵇ-0-+
106+
-- Left leg: <ᵇ-0-ψ (x = bzero, y = bpsi _ _)
107+
<ᵇ-trans <ᵇ-0-ψ (<ᵇ-ψΩ _) = <ᵇ-0-ψ
108+
-- Left leg: <ᵇ-ΩΩ (x = bOmega _, y = bOmega _)
109+
<ᵇ-trans (<ᵇ-ΩΩ p) (<ᵇ-ΩΩ q) = <ᵇ-ΩΩ (<Ω-trans p q)
110+
<ᵇ-trans (<ᵇ-ΩΩ p) (<ᵇ-Ωψ q) = <ᵇ-Ωψ (<Ω-trans p q)
111+
-- Left leg: <ᵇ-Ωψ (x = bOmega _, y = bpsi _ _)
112+
<ᵇ-trans (<ᵇ-Ωψ p) (<ᵇ-ψΩ q) = <ᵇ-Ωψ (<Ω-trans p q)
113+
-- Left leg: <ᵇ-ψΩ (x = bpsi _ _, y = bpsi _ _)
114+
<ᵇ-trans (<ᵇ-ψΩ p) (<ᵇ-ψΩ q) = <ᵇ-ψΩ (<Ω-trans p q)
115+
-- Left leg: <ᵇ-+1 (x = bplus _ _, y = bplus _ _)
116+
<ᵇ-trans (<ᵇ-+1 p) (<ᵇ-+1 q) = <ᵇ-+1 (<ᵇ-trans p q)
117+
118+
----------------------------------------------------------------------------
119+
-- Strict-below-ψ examples, for downstream ordering checks
120+
----------------------------------------------------------------------------
121+
122+
-- These use the pinned `Omega*` constants from OmegaMarkers to keep
123+
-- the Buchholz example terms in a strict chain: bzero <ᵇ Ω₀ <ᵇ Ω₁
124+
-- <ᵇ Ω_ω <ᵇ ψ_ω(bzero). The last strict inequality uses the cross-
125+
-- constructor <ᵇ-Ωψ since ω <Ω ω is absent (ω is top).
126+
127+
open import Ordinal.OmegaMarkers using
128+
( Omega0
129+
; Omega1
130+
; Omegaω
131+
; Omega0<Omega1
132+
; Omega0<Omegaω
133+
; Omega1<Omegaω
134+
)
135+
136+
bzero<Ω0 : bzero <ᵇ bOmega Omega0
137+
bzero<Ω0 = <ᵇ-0-Ω
138+
139+
Ω0<Ω1 : bOmega Omega0 <ᵇ bOmega Omega1
140+
Ω0<Ω1 = <ᵇ-ΩΩ Omega0<Omega1
141+
142+
Ω1<Ωω : bOmega Omega1 <ᵇ bOmega Omegaω
143+
Ω1<Ωω = <ᵇ-ΩΩ Omega1<Omegaω
144+
145+
Ω0<ψ1-zero : bOmega Omega0 <ᵇ bpsi Omega1 bzero
146+
Ω0<ψ1-zero = <ᵇ-Ωψ Omega0<Omega1
Lines changed: 109 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,142 @@
11
{-# OPTIONS --safe --without-K #-}
22

3-
-- WF-1 skeleton: prove accessibility by term constructor, with
4-
-- predecessor inversion lemmas separated out. Recursive predecessor
5-
-- bridges are discharged through a small rank-to-ℕ subrelation proof.
3+
-- WF-1: well-foundedness of the binary strict order `_<ᵇ_` on
4+
-- Buchholz terms (from Ordinal.Buchholz.Order).
5+
--
6+
-- Proof by structural induction on the BT term, using:
7+
-- * `<Ω-wf` for the bOmega and bpsi cases (their predecessors
8+
-- decrease only along the Ω-index);
9+
-- * recursion on the inductive BT structure for the bplus case
10+
-- (whose only internal predecessor `<ᵇ-+1` decreases along the
11+
-- first summand).
12+
--
13+
-- Irreflexivity follows from well-foundedness via `wf⇒asym`. This
14+
-- cross-checks `<ᵇ-irrefl` (pattern-matched directly in Order.agda)
15+
-- and derives a matching `<ᵇ-irreflexive` via the wf channel.
616

717
module Ordinal.Buchholz.WellFounded where
818

919
open import Data.Empty using (⊥; ⊥-elim)
1020
open import Data.Nat.Base using (ℕ; _<_; z≤n; s≤s; zero; suc)
1121
open import Data.Nat.Induction as NatInd using (<-wellFounded)
12-
open import Function.Base using (_on_)
22+
open import Induction.WellFounded using
23+
( Acc
24+
; acc
25+
; WellFounded
26+
; wf⇒asym
27+
)
1328
open import Relation.Nullary using (¬_)
14-
open import Induction.WellFounded as WF using (Acc; acc; WellFounded; wf⇒asym)
1529

16-
open import Ordinal.OmegaMarkers using (OmegaIndex; fin; ω)
30+
open import Ordinal.OmegaMarkers using
31+
( OmegaIndex
32+
; fin
33+
; ω
34+
; _<Ω_
35+
; fin<fin
36+
; fin<ω
37+
)
1738
open import Ordinal.Buchholz.Syntax using (BT; bzero; bOmega; bplus; bpsi)
1839
open import Ordinal.Buchholz.Order using
19-
( _<Ω_
20-
; _<ᵇ_
21-
; <Ω-fin
22-
; <ᵇ-0Ω
23-
; <ᵇ-0+
24-
; <ᵇ-0ψ
25-
; <ᵇ-Ω+
40+
( _<ᵇ_
41+
; <ᵇ-0-Ω
42+
; <ᵇ-0-+
43+
; <ᵇ-0-ψ
44+
; <ᵇ-ΩΩ
2645
; <ᵇ-Ωψ
46+
; <ᵇ-ψΩ
2747
; <ᵇ-+1
28-
; <ᵇ-ψν
2948
)
3049

31-
<ᵇ-inv-bzero : {x} x <ᵇ bzero
32-
<ᵇ-inv-bzero ()
33-
34-
<ᵇ-pred-bzero : {x} x <ᵇ bzero Acc _<ᵇ_ x
35-
<ᵇ-pred-bzero x<0 = ⊥-elim (<ᵇ-inv-bzero x<0)
36-
37-
rankΩ : OmegaIndex
38-
rankΩ (fin n) = n
39-
rankΩ ω = zero
40-
41-
rankBT : BT
42-
rankBT bzero = zero
43-
rankBT (bOmega μ) = suc zero
44-
rankBT (bplus α β) = suc (suc (rankBT α))
45-
rankBT (bpsi μ α) = suc (suc (suc (rankΩ μ)))
50+
----------------------------------------------------------------------------
51+
-- Step 1: well-foundedness of `_<Ω_`
52+
----------------------------------------------------------------------------
4653

47-
<Ω⇒<rankΩ : {μ ν} μ <Ω ν rankΩ μ < rankΩ ν
48-
<Ω⇒<rankΩ (<Ω-fin m<n) = m<n
54+
-- Every finite marker `fin n` is accessible by lifting accessibility
55+
-- of `n` in ℕ's `_<_`. The limit marker `ω` is accessible because its
56+
-- only strict predecessors are finite markers, each covered by the
57+
-- finite case.
4958

50-
<ᵇ⇒<rankBT : {x y} x <ᵇ y rankBT x < rankBT y
51-
<ᵇ⇒<rankBT <ᵇ-0Ω = s≤s z≤n
52-
<ᵇ⇒<rankBT <ᵇ-0+ = s≤s z≤n
53-
<ᵇ⇒<rankBT <ᵇ-0ψ = s≤s z≤n
54-
<ᵇ⇒<rankBT <ᵇ-Ω+ = s≤s (s≤s z≤n)
55-
<ᵇ⇒<rankBT <ᵇ-Ωψ = s≤s (s≤s z≤n)
56-
<ᵇ⇒<rankBT (<ᵇ-+1 α<β) = s≤s (s≤s (<ᵇ⇒<rankBT α<β))
57-
<ᵇ⇒<rankBT (<ᵇ-ψν μ<ν) = s≤s (s≤s (s≤s (<Ω⇒<rankΩ μ<ν)))
58-
59-
wf-rankBT : WellFounded (_<_ on rankBT)
60-
wf-rankBT x = rank-accessible (NatInd.<-wellFounded (rankBT x))
59+
<Ω-wf-fin : n Acc _<Ω_ (fin n)
60+
<Ω-wf-fin n = aux (<-wellFounded n)
6161
where
62-
rank-accessible : {t} Acc _<_ (rankBT t) Acc (_<_ on rankBT) t
63-
rank-accessible (acc rs) = acc λ t<x rank-accessible (rs t<x)
64-
65-
wf-<ᵇ-rank : WellFounded _<ᵇ_
66-
wf-<ᵇ-rank = WF.Subrelation.wellFounded <ᵇ⇒<rankBT wf-rankBT
62+
aux : {k} Acc _<_ k Acc _<Ω_ (fin k)
63+
aux {k} (acc rs) = acc step
64+
where
65+
step : {y} y <Ω fin k Acc _<Ω_ y
66+
step (fin<fin m<k) = aux (rs m<k)
67+
68+
<Ω-wf-ω : Acc _<Ω_ ω
69+
<Ω-wf-ω = acc step
70+
where
71+
step : {y} y <Ω ω Acc _<Ω_ y
72+
step (fin<ω {m = m}) = <Ω-wf-fin m
6773

68-
<ᵇ-rec-+1 : {α β γ} α <ᵇ β Acc _<ᵇ_ (bplus α γ)
74+
<Ω-wf : WellFounded _<Ω_
75+
<Ω-wf (fin n) = <Ω-wf-fin n
76+
<Ω-wf ω = <Ω-wf-ω
6977

70-
<ᵇ-rec-ψν : {μ ν α} μ <Ω ν Acc _<ᵇ_ (bpsi μ α)
78+
----------------------------------------------------------------------------
79+
-- Step 2: well-foundedness of `_<ᵇ_` by structural induction on BT
80+
----------------------------------------------------------------------------
7181

82+
-- bzero is accessible: it has no predecessors (no `_<ᵇ_` constructor
83+
-- has bzero on the right-hand side).
7284
<ᵇ-acc-bzero : Acc _<ᵇ_ bzero
73-
<ᵇ-acc-bzero = acc <ᵇ-pred-bzero
74-
75-
<ᵇ-pred-bOmega : {μ x} x <ᵇ bOmega μ Acc _<ᵇ_ x
76-
<ᵇ-pred-bOmega <ᵇ-0Ω = <ᵇ-acc-bzero
77-
78-
<ᵇ-acc-bOmega :: OmegaIndex) Acc _<ᵇ_ (bOmega μ)
79-
<ᵇ-acc-bOmega μ = acc <ᵇ-pred-bOmega
80-
81-
<ᵇ-pred-bplus : {α β x} x <ᵇ bplus α β Acc _<ᵇ_ x
82-
<ᵇ-pred-bplus <ᵇ-0+ = <ᵇ-acc-bzero
83-
<ᵇ-pred-bplus (<ᵇ-Ω+ {κ = κ}) = <ᵇ-acc-bOmega κ
84-
<ᵇ-pred-bplus (<ᵇ-+1 α<β) = <ᵇ-rec-+1 α<β
85-
86-
<ᵇ-pred-bpsi : {μ α x} x <ᵇ bpsi μ α Acc _<ᵇ_ x
87-
<ᵇ-pred-bpsi <ᵇ-0ψ = <ᵇ-acc-bzero
88-
<ᵇ-pred-bpsi (<ᵇ-Ωψ {κ = κ}) = <ᵇ-acc-bOmega κ
89-
<ᵇ-pred-bpsi (<ᵇ-ψν μ<ν) = <ᵇ-rec-ψν μ<ν
90-
91-
<ᵇ-acc-bplus : (α β : BT) Acc _<ᵇ_ (bplus α β)
92-
<ᵇ-acc-bplus α β = acc <ᵇ-pred-bplus
93-
94-
<ᵇ-acc-bpsi :: OmegaIndex) (α : BT) Acc _<ᵇ_ (bpsi μ α)
95-
<ᵇ-acc-bpsi μ α = acc <ᵇ-pred-bpsi
85+
<ᵇ-acc-bzero = acc step
86+
where
87+
step : {y} y <ᵇ bzero Acc _<ᵇ_ y
88+
step ()
9689

97-
<ᵇ-rec-+1 {α = α} {γ = γ} _ = wf-<ᵇ-rank (bplus α γ)
90+
-- bOmega μ is accessible by well-founded recursion on μ in `_<Ω_`.
91+
<ᵇ-acc-bOmega : μ Acc _<ᵇ_ (bOmega μ)
92+
<ᵇ-acc-bOmega μ = go (<Ω-wf μ)
93+
where
94+
go : {ν} Acc _<Ω_ ν Acc _<ᵇ_ (bOmega ν)
95+
go (acc rs) = acc step
96+
where
97+
step : {y} y <ᵇ bOmega _ Acc _<ᵇ_ y
98+
step <ᵇ-0-Ω = <ᵇ-acc-bzero
99+
step (<ᵇ-ΩΩ μ'<ν) = go (rs μ'<ν)
100+
101+
-- bpsi ν α is accessible by well-founded recursion on ν in `_<Ω_`.
102+
-- Predecessors: bzero, bOmega μ' with μ' <Ω ν, and bpsi μ' β with
103+
-- μ' <Ω ν for any β.
104+
<ᵇ-acc-bpsi : ν α Acc _<ᵇ_ (bpsi ν α)
105+
<ᵇ-acc-bpsi ν α = go (<Ω-wf ν) α
106+
where
107+
go : {ν'} Acc _<Ω_ ν' α Acc _<ᵇ_ (bpsi ν' α)
108+
go (acc rs) α = acc step
109+
where
110+
step : {y} y <ᵇ bpsi _ α Acc _<ᵇ_ y
111+
step <ᵇ-0-ψ = <ᵇ-acc-bzero
112+
step (<ᵇ-Ωψ {μ = μ'} _) = <ᵇ-acc-bOmega μ'
113+
step (<ᵇ-ψΩ μ'<ν) = go (rs μ'<ν) _
98114

99-
<ᵇ-rec-ψν {μ = μ} {α = α} _ = wf-<ᵇ-rank (bpsi μ α)
115+
-- bplus α β is accessible by outer well-founded recursion on α.
116+
<ᵇ-acc-bplus : α β Acc _<ᵇ_ (bplus α β)
100117

101118
wf-<ᵇ : WellFounded _<ᵇ_
102119
wf-<ᵇ bzero = <ᵇ-acc-bzero
103120
wf-<ᵇ (bOmega μ) = <ᵇ-acc-bOmega μ
104121
wf-<ᵇ (bplus α β) = <ᵇ-acc-bplus α β
105-
wf-<ᵇ (bpsi μ α) = <ᵇ-acc-bpsi μ α
122+
wf-<ᵇ (bpsi ν α) = <ᵇ-acc-bpsi ν α
106123

124+
<ᵇ-acc-bplus α β = go (wf-<ᵇ α) β
125+
where
126+
go : {α'} Acc _<ᵇ_ α' β' Acc _<ᵇ_ (bplus α' β')
127+
go (acc rs) β' = acc step
128+
where
129+
step : {y} y <ᵇ bplus _ β' Acc _<ᵇ_ y
130+
step <ᵇ-0-+ = <ᵇ-acc-bzero
131+
step (<ᵇ-+1 α₁<α') = go (rs α₁<α') _
132+
133+
----------------------------------------------------------------------------
134+
-- Step 3: irreflexivity as a corollary of well-foundedness
135+
----------------------------------------------------------------------------
136+
137+
-- Derived via `wf⇒asym`: a well-founded relation is asymmetric, hence
138+
-- cannot hold between an element and itself. This duplicates the
139+
-- direct pattern-matched `<ᵇ-irrefl` in Order.agda; keeping both
140+
-- makes `wf-<ᵇ` load-bearing and exercises the standard WF API.
107141
<ᵇ-irreflexive : {x} ¬ (x <ᵇ x)
108142
<ᵇ-irreflexive {x} x<x = wf⇒asym wf-<ᵇ x<x x<x

0 commit comments

Comments
 (0)