Tom de Jong, 22 & 23 June 2024 We formalize what we've known for a long time: if the poset pictured below 0 1 2 3 ... \ \ / / \ \ / / β₯ is Ο-complete/directed complete, then Bishop's LPO holds. \begin{code} {-# OPTIONS --safe --without-K #-} open import MLTT.Spartan open import UF.FunExt open import UF.PropTrunc module DomainTheory.Taboos.ClassicalLiftingOfNaturalNumbers (pt : propositional-truncations-exist) (fe : Fun-Ext) where open PropositionalTruncation pt open import DomainTheory.Basics.Dcpo pt fe π€β open import CoNaturals.Type renaming (ββ-to-ββπ to Ξ΅) open import MLTT.Two-Properties open import MLTT.Plus-Properties open import Taboos.LPO \end{code} The poset is defined as follows. Notice that the set of natural numbers is ordered discretely. NB: In this file, and this file only, we denote this poset by ββ₯. In CoNaturals/Sharp this notation is reserved for the lifting of the natural numbers which constructively *does* yield a directed complete poset. Classically, the constructions are equivalent, as formalized in Lifting.Miscelanea-PropExt-FunExt. Indeed, this is the case *only* classically, as this file shows by deriving a constructive taboo from the assumption that ββ₯ is directed complete. \begin{code} ββ₯ : π€β Μ ββ₯ = π{π€β} + β _β_ : ββ₯ β ββ₯ β π€β Μ inl β β x = π inr n β x = inr n οΌ x \end{code} We now state the main results, postponing the proof. In fact, we show that just having upper bounds of Ο-chains (so not necessarily least ones) gives LPO. \begin{code} ββ₯-is-Ο-complete-gives-LPO : is-Ο-complete _β_ β LPO ββ₯-is-directed-complete-gives-LPO : is-directed-complete _β_ β LPO ββ₯-has-upperbounds-for-Ο-chains-gives-LPO : ((Ξ± : β β ββ₯) β is-Ο-chain _β_ Ξ± β (Ξ£ x κ ββ₯ , is-upperbound _β_ x Ξ±)) β LPO \end{code} We need a few preliminaries before giving the proof. \begin{code} inr-not-β-inl : {n : β} β Β¬ (inr n β inl β) inr-not-β-inl p = +disjoint (p β»ΒΉ) β-refl : (x : ββ₯) β x β x β-refl (inl β) = β β-refl (inr n) = refl β-refl-οΌ : {x y : ββ₯} β x οΌ y β x β y β-refl-οΌ refl = β-refl _ β-trans : (x y z : ββ₯) β x β y β y β z β x β z β-trans (inl β) y z p q = β β-trans (inr n) y z refl q = q \end{code} We now prove the main result. In TypeTopology, LPO states that is decidable whether a decreasing binary sequence u : ββ is finite or not. The equivalence with the traditional formulation is formalized in Taboos.LPO. We write Ξ΅ u n for evaluating the binary sequence u at index n. Given such u, we construct Ο : β β ββ₯ such that β’ Ο n = β₯ = inl β β Ξ΅ u n = β; β’ Ο n = inr m β m is the least integer β€ n such that Ξ΅ u m = β. We then show that Ο is an Ο-chain and that from an upper bound we can decide, via some case splitting, whether u is finite or not, i.e., whether u is always β or attains β somewhere. \begin{code} private module construction (u : ββ) where Ο : β β ββ₯ Ο n = π-equality-cases I II where I : Ξ΅ u n οΌ β β ββ₯ I p = inr (size (bounded-is-finite fe n u p)) II : Ξ΅ u n οΌ β β ββ₯ II _ = inl β module _ {n : β} (p : Ξ΅ u n οΌ β) where Ο-numeral : β Ο-numeral = size (bounded-is-finite fe n u p) Ο-eq : Ο n οΌ inr Ο-numeral Ο-eq = π-equality-casesβ p Ο-numeral-eq : β-to-ββ Ο-numeral οΌ u Ο-numeral-eq = size-property (bounded-is-finite fe n u p) Ο-otherwise : {n : β} β Ξ΅ u n οΌ β β Ο n οΌ inl β Ο-otherwise p = π-equality-casesβ p Ο-is-Ο-chain : (n : β) β Ο n β Ο (succ n) Ο-is-Ο-chain n = π-equality-cases I II where II : Ξ΅ u n οΌ β β Ο n β Ο (succ n) II p = transportβ»ΒΉ (_β Ο (succ n)) (Ο-otherwise p) β I : Ξ΅ u n οΌ β β Ο n β Ο (succ n) I p = β-refl-οΌ Iβ where q : Ξ΅ u (succ n) οΌ β q = stays-zero u p Iβ = Ο n οΌβ¨ Ο-eq p β© inr (Ο-numeral p) οΌβ¨ Iβ β© inr (Ο-numeral q) οΌβ¨ (Ο-eq q) β»ΒΉ β© Ο (succ n) β where Iβ = ap inr (β-to-ββ-lc (Ο-numeral-eq p β (Ο-numeral-eq q) β»ΒΉ)) inl-case : is-upperbound _β_ (inl β) Ο β is-decidable (is-finite' u) inl-case ub = inr I where I : Β¬ (is-finite' u) I (n , refl) = inr-not-β-inl II where p : Ξ΅ u n οΌ β p = β-to-ββ-diagonalβ n II : inr (Ο-numeral p) β inl β II = transport (_β inl β) (Ο-eq p) (ub n) inr-case : {m : β} β is-upperbound _β_ (inr m) Ο β is-decidable (is-finite' u) inr-case {m} ub = π-equality-cases I II where I : Ξ΅ u m οΌ β β is-decidable (is-finite' u) I p = inl (Ο-numeral p , ((Ο-numeral-eq p) β»ΒΉ)) II : Ξ΅ u m οΌ β β is-decidable (is-finite' u) II p = inr III where III : Β¬ is-finite' u III (n , refl) = diff (inr-lc eq) where q : Ξ΅ u n οΌ β q = β-to-ββ-diagonalβ n eq = inr n οΌβ¨ (ap inr (β-to-ββ-lc (Ο-numeral-eq q)))β»ΒΉ β© inr (Ο-numeral q) οΌβ¨ transport (_β inr m) (Ο-eq q) (ub n) β© inr m β diff : n β m diff e = zero-is-not-one (β οΌβ¨ (β-to-ββ-diagonalβ n) β»ΒΉ β© Ξ΅ u n οΌβ¨ ap (Ξ΅ u) e β© Ξ΅ u m οΌβ¨ p β© β β) \end{code} This completes the technical details and we are ready to give the proofs. \begin{code} ββ₯-has-upperbounds-for-Ο-chains-gives-LPO Ξ½ seq = equality-cases s (I s s-is-ub) (II s s-is-ub) where open construction seq module _ (s : ββ₯) (s-is-ub : is-upperbound _β_ s Ο) where I : (u : π) β s οΌ inl u β is-decidable (is-finite' seq) I β refl = inl-case s-is-ub II : (m : β) β s οΌ inr m β is-decidable (is-finite' seq) II m refl = inr-case s-is-ub s : ββ₯ s = prβ (Ξ½ Ο Ο-is-Ο-chain) s-is-ub : is-upperbound _β_ s Ο s-is-ub = prβ (Ξ½ Ο Ο-is-Ο-chain) ββ₯-is-Ο-complete-gives-LPO comp = ββ₯-has-upperbounds-for-Ο-chains-gives-LPO (Ξ» Ξ± c β the-sup _β_ (comp Ξ± c) , sup-is-upperbound _β_ (sup-property _β_ (comp Ξ± c))) ββ₯-is-directed-complete-gives-LPO comp = ββ₯-is-Ο-complete-gives-LPO (Ξ» Ξ± c β comp β Ξ± (Ο-chains-are-directed _β_ β-refl β-trans Ξ± c)) \end{code}