3030-- on `Ord` mirroring `Ordinal.Brouwer.wf-<`. Predecessor lemmas
3131-- `pred-of-osuc-<′` and `pred-of-olim-<′` reduce through the
3232-- computed shape of `_<′_` rather than constructor pattern-match.
33+ -- * `≤′-self-osuc` — every ordinal is below its successor: x ≤′ osuc x.
34+ -- * `≤′-weaken-osuc` — weakening: x ≤′ y → x ≤′ osuc y.
35+ -- * `⊕-left-≤-sum` — left addend ≤ sum: α ≤′ α ⊕ γ.
36+ -- * `⊕-mono-≤-right` — `_⊕_` is monotone on the right w.r.t. `≤′`.
37+ -- * `⊕-mono-<-right` — `_⊕_` is strictly monotone on the right
38+ -- w.r.t. `<′`. Closes the `<ᵇʳᶠ-ψα` and `<ᵇʳᶠ-+2` cases of
39+ -- `rank-mono` in `Ordinal.Buchholz.RankBrouwer` (issue #34).
3340--
3441-- ## Closure of the original obstacle
3542--
@@ -49,6 +56,7 @@ open import Data.Empty using (⊥; ⊥-elim)
4956open import Induction.WellFounded using (Acc; acc; WellFounded)
5057
5158open import Ordinal.Brouwer using (Ord; oz; osuc; olim)
59+ open import Ordinal.Brouwer.Arithmetic using (_⊕_)
5260
5361----------------------------------------------------------------------------
5462-- Recursive `_≤′_` per the Echidna SA recommendation
@@ -189,3 +197,69 @@ wf-<′ : WellFounded _<′_
189197wf-<′ oz = acc (λ {β} ())
190198wf-<′ (osuc α) = acc (pred-of-osuc-<′ (wf-<′ α))
191199wf-<′ (olim f) = acc (pred-of-olim-<′ (λ n → wf-<′ (f n)))
200+
201+ ----------------------------------------------------------------------------
202+ -- x ≤′ osuc x (every ordinal is strictly below its successor)
203+ ----------------------------------------------------------------------------
204+
205+ -- Structural recursion on x. The `olim f` case uses f-in-lim′ to
206+ -- route through the branch: f n ≤′ osuc (f n) ≤′ osuc (olim f).
207+ -- The last step holds because `osuc (f n) ≤′ osuc (olim f)` reduces
208+ -- definitionally to `f n ≤′ olim f`, which is f-in-lim′.
209+
210+ ≤′-self-osuc : ∀ x → x ≤′ osuc x
211+ ≤′-self-osuc oz = tt
212+ ≤′-self-osuc (osuc x) = ≤′-self-osuc x
213+ ≤′-self-osuc (olim f) = λ n →
214+ ≤′-trans {f n} {osuc (f n)} {osuc (olim f)}
215+ (≤′-self-osuc (f n))
216+ (f-in-lim′ f n)
217+
218+ -- Weakening: x ≤′ y → x ≤′ osuc y. One-liner via transitivity and
219+ -- ≤′-self-osuc; no case analysis needed.
220+
221+ ≤′-weaken-osuc : ∀ {x y} → x ≤′ y → x ≤′ osuc y
222+ ≤′-weaken-osuc {x} {y} p = ≤′-trans {x} {y} {osuc y} p (≤′-self-osuc y)
223+
224+ ----------------------------------------------------------------------------
225+ -- α ≤′ α ⊕ γ (left addend is always ≤ the sum)
226+ ----------------------------------------------------------------------------
227+
228+ -- Structural recursion on γ. Right-recursive `_⊕_` is essential:
229+ -- each case of γ reduces `α ⊕ γ` to a form whose `_≤′_` target is
230+ -- immediately dischargeable.
231+
232+ ⊕-left-≤-sum : ∀ {α} γ → α ≤′ α ⊕ γ
233+ ⊕-left-≤-sum {α} oz = ≤′-refl {α}
234+ ⊕-left-≤-sum {α} (osuc γ') = ≤′-weaken-osuc {α} {α ⊕ γ'} (⊕-left-≤-sum {α} γ')
235+ ⊕-left-≤-sum {α} (olim g) =
236+ ≤′-trans {α} {α ⊕ g 0 } {α ⊕ olim g}
237+ (⊕-left-≤-sum {α} (g 0 ))
238+ (f-in-lim′ (λ n → α ⊕ g n) 0 )
239+
240+ ----------------------------------------------------------------------------
241+ -- Right monotonicity of `_⊕_` (issue #34 fix)
242+ ----------------------------------------------------------------------------
243+
244+ -- `⊕-mono-<-right` and `⊕-mono-≤-right` are mutually recursive.
245+ -- Both induct primarily on γ (for <) or β (for ≤), with the other
246+ -- position decreasing in cross-calls. Agda's termination checker
247+ -- accepts the lex pair (β, γ) as the measure.
248+ --
249+ -- Right-recursive `_⊕_` is the enabling change: each constructor of
250+ -- γ in `⊕-mono-<-right` matches exactly one clause of `_≤′_`'s
251+ -- second-argument computation, giving a direct proof path.
252+
253+ mutual
254+
255+ ⊕-mono-<-right : ∀ {α β γ} → β <′ γ → α ⊕ β <′ α ⊕ γ
256+ ⊕-mono-<-right {_} {_} {oz} ()
257+ ⊕-mono-<-right {α} {β} {osuc γ'} p = ⊕-mono-≤-right {α} {β} {γ'} p
258+ ⊕-mono-<-right {α} {β} {olim g} (n , p) = n , ⊕-mono-<-right {α} {β} {g n} p
259+
260+ ⊕-mono-≤-right : ∀ {α β γ} → β ≤′ γ → α ⊕ β ≤′ α ⊕ γ
261+ ⊕-mono-≤-right {α} {oz} {γ} _ = ⊕-left-≤-sum {α} γ
262+ ⊕-mono-≤-right {_} {osuc _} {oz} ()
263+ ⊕-mono-≤-right {α} {osuc β'} {osuc γ'} p = ⊕-mono-≤-right {α} {β'} {γ'} p
264+ ⊕-mono-≤-right {α} {osuc β'} {olim g} (n , p) = n , ⊕-mono-<-right {α} {β'} {g n} p
265+ ⊕-mono-≤-right {α} {olim f} {γ} p = λ n → ⊕-mono-≤-right {α} {f n} {γ} (p n)
0 commit comments