Skip to content

Commit 211564b

Browse files
committed
Merge branch 'wf-1-core-wellfounded' into main
2 parents 4238ded + 4c58d51 commit 211564b

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- WF-1 skeleton: prove accessibility by term constructor, with
4+
-- predecessor/inversion lemmas separated from the top-level theorem.
5+
6+
module Ordinal.Buchholz.WellFounded where
7+
8+
open import Data.Empty using (⊥; ⊥-elim)
9+
open import Data.Nat.Base using (ℕ; _<_)
10+
open import Data.Nat.Induction as NatInd using (<-wellFounded)
11+
open import Relation.Nullary using (¬_)
12+
open import Induction.WellFounded using (Acc; acc; WellFounded; wf⇒asym)
13+
14+
open import Ordinal.OmegaMarkers using
15+
( OmegaIndex
16+
; fin
17+
; ω
18+
; _<Ω_
19+
; fin<fin
20+
; fin<ω
21+
)
22+
open import Ordinal.Buchholz.Syntax using (BT; bzero; bOmega; bplus; bpsi)
23+
open import Ordinal.Buchholz.Order using
24+
( _<ᵇ_
25+
; <ᵇ-0-Ω
26+
; <ᵇ-0-+
27+
; <ᵇ-0-ψ
28+
; <ᵇ-ΩΩ
29+
; <ᵇ-Ωψ
30+
; <ᵇ-ψΩ
31+
; <ᵇ-+1
32+
)
33+
34+
<ᵇ-inv-bzero : {x} x <ᵇ bzero
35+
<ᵇ-inv-bzero ()
36+
37+
<ᵇ-pred-bzero : {x} x <ᵇ bzero Acc _<ᵇ_ x
38+
<ᵇ-pred-bzero x<0 = ⊥-elim (<ᵇ-inv-bzero x<0)
39+
40+
<Ω-acc-fin : (n : ℕ) Acc _<Ω_ (fin n)
41+
<Ω-acc-fin n = fromNat (NatInd.<-wellFounded n)
42+
where
43+
fromNat : {m} Acc _<_ m Acc _<Ω_ (fin m)
44+
fromNat (acc rs) = acc λ where
45+
(fin<fin k<m) fromNat (rs k<m)
46+
47+
<Ω-wf : WellFounded _<Ω_
48+
<Ω-wf (fin n) = <Ω-acc-fin n
49+
<Ω-wf ω = acc λ where
50+
(fin<ω {m}) <Ω-acc-fin m
51+
52+
<ᵇ-acc-bzero : Acc _<ᵇ_ bzero
53+
<ᵇ-acc-bzero = acc <ᵇ-pred-bzero
54+
55+
mutual
56+
57+
<ᵇ-pred-bOmega-fromΩ : {μ x} Acc _<Ω_ μ x <ᵇ bOmega μ Acc _<ᵇ_ x
58+
<ᵇ-pred-bOmega-fromΩ _ <ᵇ-0-Ω = <ᵇ-acc-bzero
59+
<ᵇ-pred-bOmega-fromΩ (acc rsμ) (<ᵇ-ΩΩ κ<μ) = <ᵇ-acc-bOmega-fromΩ (rsμ κ<μ)
60+
61+
<ᵇ-acc-bOmega-fromΩ : {μ} Acc _<Ω_ μ Acc _<ᵇ_ (bOmega μ)
62+
<ᵇ-acc-bOmega-fromΩ aμ = acc (<ᵇ-pred-bOmega-fromΩ aμ)
63+
64+
mutual
65+
66+
<ᵇ-pred-bplus-from : {α β x} Acc _<ᵇ_ α x <ᵇ bplus α β Acc _<ᵇ_ x
67+
<ᵇ-pred-bplus-from _ <ᵇ-0-+ = <ᵇ-acc-bzero
68+
<ᵇ-pred-bplus-from (acc rsα) (<ᵇ-+1 {x₂ = x₂} x₁<α) = <ᵇ-acc-bplus-from (rsα x₁<α) x₂
69+
70+
<ᵇ-acc-bplus-from : {α} Acc _<ᵇ_ α : BT) Acc _<ᵇ_ (bplus α β)
71+
<ᵇ-acc-bplus-from aα β = acc (<ᵇ-pred-bplus-from aα)
72+
73+
mutual
74+
75+
<ᵇ-pred-bpsi-fromΩ : {μ α x} Acc _<Ω_ μ x <ᵇ bpsi μ α Acc _<ᵇ_ x
76+
<ᵇ-pred-bpsi-fromΩ _ <ᵇ-0-ψ = <ᵇ-acc-bzero
77+
<ᵇ-pred-bpsi-fromΩ (acc rsμ) (<ᵇ-Ωψ κ<μ) = <ᵇ-acc-bOmega-fromΩ (rsμ κ<μ)
78+
<ᵇ-pred-bpsi-fromΩ (acc rsμ) (<ᵇ-ψΩ {α = β} κ<μ) = <ᵇ-acc-bpsi-fromΩ (rsμ κ<μ) β
79+
80+
<ᵇ-acc-bpsi-fromΩ : {μ} Acc _<Ω_ μ : BT) Acc _<ᵇ_ (bpsi μ α)
81+
<ᵇ-acc-bpsi-fromΩ aμ α = acc (<ᵇ-pred-bpsi-fromΩ aμ)
82+
83+
mutual
84+
85+
<ᵇ-acc-bOmega :: OmegaIndex) Acc _<ᵇ_ (bOmega μ)
86+
<ᵇ-acc-bOmega μ = <ᵇ-acc-bOmega-fromΩ (<Ω-wf μ)
87+
88+
<ᵇ-acc-bplus : (α β : BT) Acc _<ᵇ_ (bplus α β)
89+
<ᵇ-acc-bplus α β = <ᵇ-acc-bplus-from (wf-<ᵇ α) β
90+
91+
<ᵇ-acc-bpsi :: OmegaIndex) (α : BT) Acc _<ᵇ_ (bpsi μ α)
92+
<ᵇ-acc-bpsi μ α = <ᵇ-acc-bpsi-fromΩ (<Ω-wf μ) α
93+
94+
wf-<ᵇ : WellFounded _<ᵇ_
95+
wf-<ᵇ bzero = <ᵇ-acc-bzero
96+
wf-<ᵇ (bOmega μ) = <ᵇ-acc-bOmega μ
97+
wf-<ᵇ (bplus α β) = <ᵇ-acc-bplus α β
98+
wf-<ᵇ (bpsi μ α) = <ᵇ-acc-bpsi μ α
99+
100+
<ᵇ-irreflexive : {x} ¬ (x <ᵇ x)
101+
<ᵇ-irreflexive {x} x<x = wf⇒asym wf-<ᵇ x<x x<x

0 commit comments

Comments
 (0)