Various.Dedekind
Martin Escardo, 20th December 2021 Some thoughts about Dedekind reals. A Dedekind real in constructive type theory is defined as a triple (L , U , p) where L and U are data, namely given sets of rational numbers, and p is property of (L , U). But actually, given a lower Dedekind section L, there is at most one pair (U , p) such that (L , U , p) is a Dedekind real. Hence the Dedekind data (U , p) is property of the lower real L rather than data. A more precise statement of this phenomenon is given below. We generalize the rationals to any type with a proposition-valued, irreflexive relation _<_, simply to avoid having to define the rational numbers, but also because we could replace the rationals by e.g. the dyadic rationals, or indeed by any dense countable subset. But also it is interesting than nothing other than a proposition-valued irreflexive relation is needed for the above discussion. We also discuss a version of the Dedekind reals proposed by Troelstra. To show that it agrees with the usual one, we further assume that _<_ is dense, upper open, and satisfies p โ q โ p โฎ q โ p < q (which the type of rationals does). We also discuss what happens when we assume the principle of excluded middle. Here we adopt HoTT/UF as our type-theoretic foundation, which, in particular, is well-suited to discuss the distinction between data and property. The univalence axiom is not used anywhere here, but we mention it in some discussions.{-# OPTIONS --safe --without-K --lossy-unification #-} open import MLTT.Spartan open import Naturals.Order hiding (<-โค-trans) open import Notation.CanonicalMap open import Notation.Order open import TypeTopology.CompactTypes open import UF.Base open import UF.Embeddings open import UF.Equiv open import UF.FunExt open import UF.Powerset open import UF.PropTrunc open import UF.Sets open import UF.Sets-Properties open import UF.Size open import UF.SubtypeClassifier open import UF.Subsingletons open import UF.Subsingletons-FunExt module Various.Dedekind (pt : propositional-truncations-exist) (fe : Fun-Ext) (pe : Prop-Ext) {๐ค : Universe} (โ : ๐ค ฬ ) (_<-โ-โ_ : โ โ โ โ ๐ค ฬ ) (<-โ-โ-is-prop-valued : (p q : โ) โ is-prop (p <-โ-โ q)) (<-โ-โ-irrefl : (q : โ) โ ยฌ (q <-โ-โ q)) where open PropositionalTruncation pt open inhabited-subsets pt instance strict-order-โ : Strict-Order โ โ _<_ {{strict-order-โ}} = _<-โ-โ_ ๐คโบ = ๐ค โบLower-real conditions:is-lower : ๐ โ โ ๐ค ฬ is-lower L = (q : โ) โ q โ L โ (p : โ) โ p < q โ p โ L is-upper-open : ๐ โ โ ๐ค ฬ is-upper-open L = (p : โ) โ p โ L โ โ p' ๊ โ , ((p < p') ร p' โ L) is-lower-real : ๐ โ โ ๐ค ฬ is-lower-real L = is-inhabited L ร is-lower L ร is-upper-open LUpper-real conditions:is-upper : ๐ โ โ ๐ค ฬ is-upper U = (p : โ) โ p โ U โ (q : โ) โ p < q โ q โ U is-lower-open : ๐ โ โ ๐ค ฬ is-lower-open U = (q : โ) โ q โ U โ โ q' ๊ โ , ((q' < q) ร q' โ U) is-upper-real : ๐ โ โ ๐ค ฬ is-upper-real U = is-inhabited U ร is-upper U ร is-lower-open UThe conditions are property:being-lower-is-prop : (L : ๐ โ) โ is-prop (is-lower L) being-lower-is-prop L = ฮ โ-is-prop fe (ฮป _ _ _ _ โ โ-is-prop L _) being-upper-open-is-prop : (L : ๐ โ) โ is-prop (is-upper-open L) being-upper-open-is-prop L = ฮ โ-is-prop fe (ฮป _ _ โ โ-is-prop) being-lower-real-is-prop : (L : ๐ โ) โ is-prop (is-lower-real L) being-lower-real-is-prop L = รโ-is-prop (being-inhabited-is-prop L) (being-lower-is-prop L) (being-upper-open-is-prop L) being-upper-is-prop : (L : ๐ โ) โ is-prop (is-upper L) being-upper-is-prop L = ฮ โ-is-prop fe (ฮป _ _ _ _ โ โ-is-prop L _) being-lower-open-is-prop : (L : ๐ โ) โ is-prop (is-lower-open L) being-lower-open-is-prop L = ฮ โ-is-prop fe (ฮป _ _ โ โ-is-prop) being-upper-real-is-prop : (L : ๐ โ) โ is-prop (is-upper-real L) being-upper-real-is-prop L = รโ-is-prop (being-inhabited-is-prop L) (being-upper-is-prop L) (being-lower-open-is-prop L)The sets of lower and upper reals:โแดธ : ๐คโบ ฬ โแดธ = ฮฃ L ๊ ๐ โ , is-lower-real L โแต : ๐คโบ ฬ โแต = ฮฃ U ๊ ๐ โ , is-upper-real U โแดธ-is-set : is-set โแดธ โแดธ-is-set = subsets-of-sets-are-sets (๐ โ) is-lower-real (powersets-are-sets'' fe fe pe) (ฮป {l} โ being-lower-real-is-prop l) โแต-is-set : is-set โแต โแต-is-set = subsets-of-sets-are-sets (๐ โ) is-upper-real (powersets-are-sets'' fe fe pe) (ฮป {l} โ being-upper-real-is-prop l) โแดธ-to-๐โ : โแดธ โ ๐ โ โแดธ-to-๐โ = prโ โแต-to-๐โ : โแต โ ๐ โ โแต-to-๐โ = prโ instance canonical-map-โแดธ-to-๐โ : Canonical-Map โแดธ (๐ โ) ฮน {{canonical-map-โแดธ-to-๐โ}} = โแดธ-to-๐โ canonical-map-โแต-to-๐โ : Canonical-Map โแต (๐ โ) ฮน {{canonical-map-โแต-to-๐โ}} = โแต-to-๐โ โแดธ-to-๐โ-is-embedding : is-embedding (canonical-map โแดธ (๐ โ)) โแดธ-to-๐โ-is-embedding = prโ-is-embedding being-lower-real-is-prop โแต-to-๐โ-is-embedding : is-embedding (canonical-map โแต (๐ โ)) โแต-to-๐โ-is-embedding = prโ-is-embedding being-upper-real-is-propNext we define the set of Dedekind reals as a subset of the lower reals, after some preparation.are-ordered : ๐ โ โ ๐ โ โ ๐ค ฬ are-ordered L U = (p q : โ) โ p โ L โ q โ U โ p < q are-located : ๐ โ โ ๐ โ โ ๐ค ฬ are-located L U = (p q : โ) โ p < q โ p โ L โจ q โ U being-ordered-is-prop : (L U : ๐ โ) โ is-prop (are-ordered L U) being-ordered-is-prop _ _ = ฮ โ-is-prop fe (ฮป _ _ _ _ โ <-โ-โ-is-prop-valued _ _) being-located-is-prop : (L U : ๐ โ) โ is-prop (are-located L U) being-located-is-prop _ _ = ฮ โ-is-prop fe (ฮป _ _ _ โ โจ-is-prop) order-lemma : (L U L' U' : ๐ โ) โ is-lower-open U' โ are-located L U โ are-ordered L' U' โ L โ L' โ U' โ U order-lemma L U L' U' U'-lower-open LU-located LU'-ordered L-contained-in-L' q q-in-U' = ฮณ where I : โ q' ๊ โ , (q' < q) ร q' โ U' I = U'-lower-open q q-in-U' II : (ฮฃ q' ๊ โ , (q' < q) ร q' โ U') โ q โ U II (q' , l , i) = VI where III : q' โ L โจ q โ U III = LU-located q' q l IV : q' โ L IV j = <-โ-โ-irrefl q' b where a : q' โ L' a = L-contained-in-L' q' j b : q' < q' b = LU'-ordered q' q' a i V : (q' โ L) + (q โ U) โ q โ U V (inl j) = ๐-elim (IV j) V (inr k) = k VI : q โ U VI = โฅโฅ-rec (โ-is-prop U q) V III ฮณ : q โ U ฮณ = โฅโฅ-rec (โ-is-prop U q) II I order-lemma-converse : (L U L' U' : ๐ โ) โ is-upper-open L โ are-located L' U' โ are-ordered L U โ U' โ U โ L โ L' order-lemma-converse L U L' U' L-upper-open LU'-located LU-ordered U'-contained-in-U q q-in-L = ฮณ where I : โ q' ๊ โ , (q < q') ร q' โ L I = L-upper-open q q-in-L II : (ฮฃ q' ๊ โ , (q < q') ร q' โ L) โ q โ L' II (q' , l , i) = VI where III : q โ L' โจ q' โ U' III = LU'-located q q' l IV : q' โ U' IV j = <-โ-โ-irrefl q' b where a : q' โ U a = U'-contained-in-U q' j b : q' < q' b = LU-ordered q' q' i a V : (q โ L') + (q' โ U') โ q โ L' V (inl j) = j V (inr k) = ๐-elim (IV k) VI : q โ L' VI = โฅโฅ-rec (โ-is-prop L' q) V III ฮณ : q โ L' ฮณ = โฅโฅ-rec (โ-is-prop L' q) II IThe following definition is of an auxiliary character:_is-an-upper-section-of_ : ๐ โ โ ๐ โ โ ๐ค ฬ U is-an-upper-section-of L = is-lower-open U ร are-ordered L U ร are-located L U any-two-upper-sections-are-equal : (L U U' : ๐ โ) โ U is-an-upper-section-of L โ U' is-an-upper-section-of L โ U ๏ผ U' any-two-upper-sections-are-equal L U U' (a , b , c) (u , v , w) = ฮณ where i : U โ U' i = order-lemma L U' L U a w b (โ-refl' L) j : U โ U' j = order-lemma L U L U' u c v (โ-refl' L) ฮณ : U ๏ผ U' ฮณ = subset-extensionality'' pe fe fe i jThe following is the version of the definition we are interested in:_is-upper-section-of_ : โแต โ โแดธ โ ๐ค ฬ (U , _) is-upper-section-of (L , _) = are-ordered L U ร are-located L U being-upper-section-is-prop : (x : โแดธ) (y : โแต) โ is-prop (y is-upper-section-of x) being-upper-section-is-prop (L , _) (U , _) = ร-is-prop (being-ordered-is-prop L U) (being-located-is-prop L U)We use the above auxiliary definition and lemma to establish the following:at-most-one-upper-section : (l : โแดธ) (uโ uโ : โแต) โ uโ is-upper-section-of l โ uโ is-upper-section-of l โ uโ ๏ผ uโ at-most-one-upper-section (L , _) uโ@(Uโ , _ , _ , Uโ-is-lower-open) uโ@(Uโ , _ , _ , Uโ-is-lower-open) (luโ-ordered , luโ-located) (luโ-ordered , luโ-located) = ฮณ where ฮณ : uโ ๏ผ uโ ฮณ = to-subtype-๏ผ being-upper-real-is-prop (any-two-upper-sections-are-equal L Uโ Uโ (Uโ-is-lower-open , luโ-ordered , luโ-located) (Uโ-is-lower-open , luโ-ordered , luโ-located))The Dedekind condition for a lower real:is-dedekind : โแดธ โ ๐คโบ ฬ is-dedekind l = ฮฃ u ๊ โแต , (u is-upper-section-of l) being-dedekind-is-prop : (l : โแดธ) โ is-prop (is-dedekind l) being-dedekind-is-prop l (uโ , pโ) (uโ , pโ) = to-subtype-๏ผ (being-upper-section-is-prop l) (at-most-one-upper-section l uโ uโ pโ pโ)We define the Dedekind reals as a subset of the lower reals:โ : ๐คโบ ฬ โ = ฮฃ l ๊ โแดธ , is-dedekind lThe forgetful map of the reals into the lower reals is an embedding and hence โ is a set:โ-to-โแดธ : โ โ โแดธ โ-to-โแดธ = prโ โ-to-โแดธ-is-embedding : is-embedding โ-to-โแดธ โ-to-โแดธ-is-embedding = prโ-is-embedding being-dedekind-is-prop โ-is-set : is-set โ โ-is-set = subsets-of-sets-are-sets โแดธ is-dedekind โแดธ-is-set (ฮป {l} โ being-dedekind-is-prop l) instance canonical-map-โ-to-โแดธ : Canonical-Map โ โแดธ ฮน {{canonical-map-โ-to-โแดธ}} = โ-to-โแดธNB. This won't be a *topological* embedding in topological models. Because โ and โแดธ are sets, in the sense of HoTT/UF, the embedding condition merely says that the map is left-cancellable. We unpack and reorder the definition to emphasize that it amounts to the usual one:is-dedekind-section : ๐ โ ร ๐ โ โ ๐ค ฬ is-dedekind-section (L , U) = is-inhabited L ร is-lower L ร is-upper-open L ร is-inhabited U ร is-upper U ร is-lower-open U ร are-ordered L U ร are-located L U NBโ : โ โ (ฮฃ (L , R) ๊ ๐ โ ร ๐ โ , is-dedekind-section (L , R)) NBโ = qinveq (ฮป ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) โ ((L , U) , Li , Ll , Lo , Ui , Uu , Uo , o , l)) ((ฮป ((L , U) , Li , Ll , Lo , Ui , Uu , Uo , o , l) โ ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l)) , (ฮป _ โ refl) , (ฮป _ โ refl))The following shows that there is some redundancy in the definition of Dedekind real:ordered-located-gives-lower : (L U : ๐ โ) โ are-ordered L U โ are-located L U โ is-lower L ordered-located-gives-lower L U LU-ordered LU-located = ฮณ where ฮณ : is-lower L ฮณ q l p m = โฅโฅ-rec (โ-is-prop L p) b a where a : p โ L โจ q โ U a = LU-located p q m b : (p โ L) + (q โ U) โ p โ L b (inl u) = u b (inr v) = ๐-elim (<-โ-โ-irrefl q (LU-ordered q q l v)) ordered-located-gives-upper : (L U : ๐ โ) โ are-ordered L U โ are-located L U โ is-upper U ordered-located-gives-upper L U LU-ordered LU-located = ฮณ where ฮณ : is-upper U ฮณ q l p m = โฅโฅ-rec (โ-is-prop U p) b a where a : q โ L โจ p โ U a = LU-located q p m b : (q โ L) + (p โ U) โ p โ U b (inl u) = ๐-elim (<-โ-โ-irrefl q (LU-ordered q q u l)) b (inr v) = v NBโ : โ โ (ฮฃ (L , U) ๊ ๐ โ ร ๐ โ , is-inhabited L ร is-upper-open L ร is-inhabited U ร is-lower-open U ร are-ordered L U ร are-located L U) NBโ = qinveq (ฮป ((L , Li , _ , Lo) , (U , Ui , _ , Uo) , o , l) โ ((L , U) , Li , Lo , Ui , Uo , o , l)) ((ฮป ((L , U) , Li , Lo , Ui , Uo , o , l) โ ((L , Li , ordered-located-gives-lower L U o l , Lo) , (U , Ui , ordered-located-gives-upper L U o l , Uo) , o , l)) , (ฮป ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) โ to-subtype-๏ผ being-dedekind-is-prop (to-subtype-๏ผ being-lower-real-is-prop refl)) , (ฮป ((L , U) , Li , Lo , Ui , Uo , o , l) โ to-subtype-๏ผ (ฮป (L , U) โ รโ-is-prop (being-inhabited-is-prop L) (being-upper-open-is-prop L) (being-inhabited-is-prop U) (being-lower-open-is-prop U) (being-ordered-is-prop L U) (being-located-is-prop L U)) refl))Sometimes a disjointness condition rather than the order condition is used in the definition of Dedekind reals.disjoint-criterion : (L U : ๐ โ) โ are-ordered L U โ are-disjoint L U disjoint-criterion L U o p (p-in-L , p-in-U) = <-โ-โ-irrefl p (o p p p-in-L p-in-U)From now on we assume the properties of โ and its order alluded above, and a few more:module โ-assumptions (โ-density : (p r : โ) โ p < r โ ฮฃ q ๊ โ , (p < q) ร (q < r)) (โ-transitivity : (p q r : โ) โ p < q โ q < r โ p < r) (โ-order-criterion : (p q : โ) โ q โฎ p โ p โ q โ p < q) (โ-cotransitivity : (p q r : โ) โ p < r โ (p < q) โจ (q < r)) (โ-tightness : (p q : โ) โ q โฎ p โ p โฎ q โ p ๏ผ q) (โ-is-lower-open : (q : โ) โ โ p ๊ โ , (p < q)) (โ-is-upper-open : (p : โ) โ โ q ๊ โ , (p < q)) (๐ ยฝ ๐ : โ) (๐-is-less-than-ยฝ : ๐ < ยฝ) (ยฝ-is-less-than-๐ : ยฝ < ๐) where ๐-is-less-than-๐ : ๐ < ๐ ๐-is-less-than-๐ = โ-transitivity ๐ ยฝ ๐ ๐-is-less-than-ยฝ ยฝ-is-less-than-๐ instance order-โ-โ : Order โ โ _โค_ {{order-โ-โ}} p q = (r : โ) โ r < p โ r < q โ-โค-antisym : (p q : โ) โ p โค q โ q โค p โ p ๏ผ q โ-โค-antisym p q i j = โ-tightness p q (ฮป โ โ <-โ-โ-irrefl q (i q โ)) (ฮป โ โ <-โ-โ-irrefl p (j p โ)) <-or-๏ผ-gives-โค-on-โ : (p q : โ) โ (p < q) + (p ๏ผ q) โ p โค q <-or-๏ผ-gives-โค-on-โ p q (inl โ) r m = โ-transitivity r p q m โ <-or-๏ผ-gives-โค-on-โ p q (inr refl) r โ = โ โ-trichotomy = (p q : โ) โ (p < q) + (p ๏ผ q) + (p > q) โค-on-โ-gives-๏ผ-or-< : โ-trichotomy โ (p q : โ) โ p โค q โ (p < q) + (p ๏ผ q) โค-on-โ-gives-๏ผ-or-< ฯ p q โ = ฮณ (ฯ p q) where I : q โฎ p I m = <-โ-โ-irrefl q (โ q m) ฮณ : (p < q) + (p ๏ผ q) + (p > q) โ (p < q) + (p ๏ผ q) ฮณ (inl i) = inl i ฮณ (inr (inl e)) = inr e ฮณ (inr (inr j)) = ๐-elim (I j) ordered-criterion : (L U : ๐ โ) โ is-lower L โ are-disjoint L U โ are-ordered L U ordered-criterion L U L-lower LU-disjoint p q p-in-L q-in-U = ฮณ where I : p โ U I p-in-U = LU-disjoint p (p-in-L , p-in-U) II : p โ q II refl = I q-in-U III : q โฎ p III โ = LU-disjoint q (L-lower p p-in-L q โ , q-in-U) ฮณ : p < q ฮณ = โ-order-criterion p q III IIThe following alternative definition of the Dedekind reals is often found in the literature:NBโ : โ โ (ฮฃ (L , U) ๊ ๐ โ ร ๐ โ , is-inhabited L ร is-lower L ร is-upper-open L ร is-inhabited U ร is-upper U ร is-lower-open U ร are-disjoint L U ร are-located L U) NBโ = qinveq (ฮป ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) โ ((L , U) , Li , Ll , Lo , Ui , Uu , Uo , disjoint-criterion L U o , l)) ((ฮป ((L , U) , Li , Ll , Lo , Ui , Uu , Uo , d , l) โ ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , ordered-criterion L U Ll d , l)) , (ฮป ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) โ to-subtype-๏ผ being-dedekind-is-prop (to-subtype-๏ผ being-lower-real-is-prop refl)) , (ฮป ((L , U) , Li , Lo , Ui , Uo , o , l) โ to-subtype-๏ผ (ฮป (L , U) โ รโ-is-prop (being-inhabited-is-prop L) (being-lower-is-prop L) (being-upper-open-is-prop L) (being-inhabited-is-prop U) (being-upper-is-prop U) (being-lower-open-is-prop U) (being-disjoint-is-prop fe L U) (being-located-is-prop L U)) refl))We now consider an alternative definition of the Dedekind reals offered by Troelstra.is-bounded-above : ๐ โ โ ๐ค ฬ is-bounded-above L = โ s ๊ โ , s โ L is-located : ๐ โ โ ๐ค ฬ is-located L = ((r s : โ) โ r < s โ r โ L โจ s โ L) is-troelstra : โแดธ โ ๐ค ฬ is-troelstra (L , _) = is-bounded-above L ร is-located L being-bounded-above-is-prop : (L : ๐ โ) โ is-prop (is-bounded-above L) being-bounded-above-is-prop L = โ-is-prop being-troelstra-located-is-prop : (L : ๐ โ) โ is-prop (is-located L) being-troelstra-located-is-prop L = ฮ โ-is-prop fe (ฮป _ _ _ โ โจ-is-prop) being-troelstra-is-prop : (l : โแดธ) โ is-prop (is-troelstra l) being-troelstra-is-prop (L , _) = ร-is-prop (being-bounded-above-is-prop L) (being-troelstra-located-is-prop L)The Dedekind and Troelstra conditions are equivalent:dedekind-gives-troelstra : (l : โแดธ) โ is-dedekind l โ is-troelstra l dedekind-gives-troelstra l@(L , _ , _ , _) ((U , U-inhabited , _ , _) , LU-ordered , LU-located) = ฮณ where bounded : (โ s ๊ โ , s โ L) bounded = โฅโฅ-functor f U-inhabited where f : (ฮฃ q ๊ โ , q โ U) โ ฮฃ q ๊ โ , q โ L f (q , q-in-U) = q , (ฮป q-in-L โ <-โ-โ-irrefl q (c q-in-L)) where c : q โ L โ q < q c q-in-L = LU-ordered q q q-in-L q-in-U located : (r s : โ) โ r < s โ r โ L โจ s โ L located r s โ = โฅโฅ-functor f (LU-located r s โ) where f : (r โ L) + (s โ U) โ (r โ L) + (s โ L) f (inl r-in-L) = inl r-in-L f (inr r-in-L) = inr (ฮป s-in-L โ <-โ-โ-irrefl s (d s-in-L)) where d : s โ L โ s < s d s-in-L = LU-ordered s s s-in-L r-in-L ฮณ : is-troelstra l ฮณ = bounded , locatedA lower Dedekind real may or may not have an upper section. If it does, it is given by the following candidate.candidate-upper-section : ๐ โ โ ๐ โ candidate-upper-section L = ฮป q โ (โ p ๊ โ , (p < q) ร (p โ L)) , โ-is-prop candidate-upper-section-is-lower-open : (L : ๐ โ) โ is-lower-open (candidate-upper-section L) candidate-upper-section-is-lower-open L q q-in-U = ฮณ where f : (ฮฃ p ๊ โ , (p < q) ร (p โ L)) โ โ p' ๊ โ , (p' < q) ร (โ p ๊ โ , (p < p') ร (p โ L)) f (p , i , p-not-in-L) = g (โ-density p q i) where g : (ฮฃ p' ๊ โ , (p < p') ร (p' < q)) โ โ p' ๊ โ , (p' < q) ร (โ p ๊ โ , (p < p') ร (p โ L)) g (p' , j , k) = โฃ p' , k , โฃ p , j , p-not-in-L โฃ โฃ ฮณ : โ q' ๊ โ , ((q' < q) ร (q' โ candidate-upper-section L)) ฮณ = โฅโฅ-rec โ-is-prop f q-in-U candidate-upper-section-is-ordered : (L : ๐ โ) โ is-lower L โ is-located L โ are-ordered L (candidate-upper-section L) candidate-upper-section-is-ordered L L-lower located p q p-in-L q-in-U = ฮณ where f : (ฮฃ r ๊ โ , (r < q) ร (r โ L)) โ p < q f (r , i , r-not-in-L) = โฅโฅ-rec (<-โ-โ-is-prop-valued p q) g (located r q i) where g : (r โ L) + (q โ L) โ p < q g (inl r-in-L) = ๐-elim (r-not-in-L r-in-L) g (inr q-not-in-L) = โ-order-criterion p q II I where I : p โ q I refl = q-not-in-L p-in-L II : q โฎ p II โ = q-not-in-L (L-lower p p-in-L q โ) ฮณ : p < q ฮณ = โฅโฅ-rec (<-โ-โ-is-prop-valued p q) f q-in-U candidate-upper-section-is-located : (L : ๐ โ) โ is-located L โ are-located L (candidate-upper-section L) candidate-upper-section-is-located L located p q โ = โฅโฅ-rec โจ-is-prop II I where I : โ p' ๊ โ , (p < p') ร (p' < q) I = โฃ โ-density p q โ โฃ II : (ฮฃ p' ๊ โ , (p < p') ร (p' < q)) โ p โ L โจ q โ candidate-upper-section L II (p' , i , j) = โฅโฅ-rec โจ-is-prop IV III where III : p โ L โจ p' โ L III = located p p' i IV : (p โ L) + (p' โ L) โ p โ L โจ q โ candidate-upper-section L IV (inl p-in-L) = โฃ inl p-in-L โฃ IV (inr p'-not-in-L) = โฃ inr โฃ (p' , j , p'-not-in-L) โฃ โฃ candidate-upper-section-is-inhabited : (L : ๐ โ) โ is-bounded-above L โ is-inhabited (candidate-upper-section L) candidate-upper-section-is-inhabited L bounded = ฮณ where f : (ฮฃ s ๊ โ , s โ L) โ is-inhabited (candidate-upper-section L) f (s , ฮฝ) = โฅโฅ-functor g (โ-is-upper-open s) where g : (ฮฃ p ๊ โ , s < p) โ ฮฃ p ๊ โ , p โ candidate-upper-section L g (p , i) = p , โฃ s , i , ฮฝ โฃ ฮณ : is-inhabited (candidate-upper-section L) ฮณ = โฅโฅ-rec (being-inhabited-is-prop (candidate-upper-section L)) f bounded candidate-upper-section-is-upper : (L : ๐ โ) โ is-lower L โ is-located L โ is-upper (candidate-upper-section L) candidate-upper-section-is-upper L lower located p p-in-U q โ = ฮณ where ฮณ : โ q' ๊ โ , (q' < q) ร (q' โ L) ฮณ = โฃ p , โ , (ฮป p-in-L โ <-โ-โ-irrefl p (candidate-upper-section-is-ordered L lower located p p p-in-L p-in-U)) โฃThe candidate upper section is the unique candidate in the following sense:unique-candidate : (L U : ๐ โ) โ is-dedekind-section (L , U) โ U ๏ผ candidate-upper-section L unique-candidate L U (Li , Ll , Lo , Ui , Uu , Uo , ordered , located) = ฮณ where l : โแดธ l = (L , Li , Ll , Lo) u : โแต u = (U , Ui , Uu , Uo) I : is-dedekind l I = u , ordered , located II : is-located L II = prโ (dedekind-gives-troelstra l I) III : (candidate-upper-section L) is-an-upper-section-of L III = candidate-upper-section-is-lower-open L , candidate-upper-section-is-ordered L Ll II , candidate-upper-section-is-located L II ฮณ : U ๏ผ candidate-upper-section L ฮณ = any-two-upper-sections-are-equal L U (candidate-upper-section L) (Uo , ordered , located) IIIAnd, as promised, the Troelstra condition implies the Dedekind condition:troelstra-gives-dedekind : (l : โแดธ) โ is-troelstra l โ is-dedekind l troelstra-gives-dedekind l@(L , L-inhabited , L-lower , L-upper-open) (bounded , located) = ฮณ where ฮณ : is-dedekind l ฮณ = ((candidate-upper-section L , (candidate-upper-section-is-inhabited L bounded , candidate-upper-section-is-upper L L-lower located , candidate-upper-section-is-lower-open L)) , candidate-upper-section-is-ordered L L-lower located , candidate-upper-section-is-located L located)The set of Troelstra reals, again as a subset of the lower reals:โแต : ๐คโบ ฬ โแต = ฮฃ l ๊ โแดธ , is-troelstra lQuestion. Can we prove that โ = โแต with propositional and functional extensionality, without univalence? The problem is that the Dedekind condition and the troelstra condition have different universe levels, and hence propositional extensionality is not applicable to show that they are equal, as their equality doesn't even type check. Would universe lifting help? I haven't thought about this.dedekind-agrees-with-troelstra : โ โ โแต dedekind-agrees-with-troelstra = ฮณ where f : โ โ โแต f (l , h) = l , dedekind-gives-troelstra l h g : โแต โ โ g (l , k) = l , troelstra-gives-dedekind l k ฮณ : โ โ โแต ฮณ = qinveq f (g , (ฮป (l , h) โ to-subtype-๏ผ being-dedekind-is-prop refl) , (ฮป (l , k) โ to-subtype-๏ผ being-troelstra-is-prop refl))We now consider consequences of excluded middle. Notice that if A is a proposition, then so is A + ยฌ A, and thus A + ยฌ A is equivalent to A โจ ยฌ A.LEM = (A : ๐ค ฬ ) โ is-prop A โ A + ยฌ A LEM-gives-locatedness : LEM โ ((L , _) : โแดธ) โ is-located L LEM-gives-locatedness lem l@(L , L-inhabited , L-lower , L-upper-open) r s โ = ฮณ ฮด where ฮด : (s โ L) + (s โ L) ฮด = lem (s โ L) (โ-is-prop L s) ฮณ : type-of ฮด โ (r โ L) โจ (s โ L) ฮณ (inl s-in-L) = โฃ inl (L-lower s s-in-L r โ) โฃ ฮณ (inr s-not-in-L) = โฃ inr s-not-in-L โฃThe bounded lower reals:โแดฎแดธ : ๐คโบ ฬ โแดฎแดธ = ฮฃ (L , _) ๊ โแดธ , is-bounded-above LThe boundedness condition only excludes a point at infinity in the lower reals:infty : ๐ โ infty = ฮป _ โ โค infty-is-lower-real : is-lower-real infty infty-is-lower-real = โฃ ๐ , โ โฃ , (ฮป _ _ _ _ โ โ) , (ฮป p โ โ โฅโฅ-rec โ-is-prop (ฮป (q , i) โ โฃ q , i , โ โฃ) (โ-is-upper-open p)) infty-is-not-bounded-above : ยฌ is-bounded-above infty infty-is-not-bounded-above bounded = โฅโฅ-rec ๐-is-prop (ฮป (q , q-not-in-infty) โ q-not-in-infty โ) boundedIn connection with a discussion above, notice that we don't need univalence for the following, which says that the Troelstra reals agree with the bounded lower reals if we assume excluded middle:โแต-and-โแดฎแดธ-agree-under-LEM : LEM โ โแต ๏ผ โแดฎแดธ โแต-and-โแดฎแดธ-agree-under-LEM lem = ap ฮฃ ฮณ where ฮด : is-troelstra โผ ฮป (L , _) โ is-bounded-above L ฮด l@(L , _) = pe (being-troelstra-is-prop l) (being-bounded-above-is-prop L) prโ (ฮป ฮฒ โ ฮฒ , LEM-gives-locatedness lem l) ฮณ : is-troelstra ๏ผ (ฮป (L , _) โ is-bounded-above L) ฮณ = dfunext fe ฮดTherefore, under excluded middle, the Dedekind reals agree with the bounded lower reals:โ-and-โแดฎแดธ-agree-under-LEM : LEM โ โ โ โแดฎแดธ โ-and-โแดฎแดธ-agree-under-LEM lem = transport (โ โ_) (โแต-and-โแดฎแดธ-agree-under-LEM lem) (dedekind-agrees-with-troelstra)It follows that bounded lower reals are Dedekind under excluded middle.LEM-gives-all-bounded-lower-reals-are-dedekind : LEM โ ((l , _) : โแดฎแดธ) โ is-dedekind l LEM-gives-all-bounded-lower-reals-are-dedekind lem (l , bounded) = ฮณ where ฮณ : is-dedekind l ฮณ = troelstra-gives-dedekind l (bounded , LEM-gives-locatedness lem l)And the converse also holds. We use a method of proof suggested independently by Steve Vickers and Toby Bartels.all-bounded-lower-reals-are-dedekind-gives-LEM : (((l , _) : โแดฎแดธ) โ is-dedekind l) โ LEM all-bounded-lower-reals-are-dedekind-gives-LEM ฮฑ A A-is-prop = ฮณ where L : ๐ โ L p = ((p < ๐) โจ (A ร (p < ๐))) , โจ-is-prop L-inhabited : is-inhabited L L-inhabited = โฅโฅ-functor h (โ-is-lower-open ๐) where h : (ฮฃ p ๊ โ , p < ๐) โ ฮฃ p ๊ โ , p โ L h (p , โ) = p , โฃ inl โ โฃ L-lower : is-lower L L-lower p p-in-L p' j = โฅโฅ-functor h p-in-L where h : (p < ๐) + (A ร (p < ๐)) โ (p' < ๐) + (A ร (p' < ๐)) h (inl โ) = inl (โ-transitivity p' p ๐ j โ) h (inr (a , โ)) = inr (a , โ-transitivity p' p ๐ j โ) L-upper-open : is-upper-open L L-upper-open p p-in-L = โฅโฅ-rec โ-is-prop h p-in-L where h : (p < ๐) + (A ร (p < ๐)) โ โ p' ๊ โ , (p < p') ร (p' โ L) h (inl โ) = k (โ-density p ๐ โ) where k : (ฮฃ p' ๊ โ , (p < p') ร (p' < ๐)) โ โ p' ๊ โ , (p < p') ร (p' โ L) k (p' , i , j) = โฃ p' , i , โฃ inl j โฃ โฃ h (inr (a , โ)) = k (โ-density p ๐ โ) where k : (ฮฃ p' ๊ โ , (p < p') ร (p' < ๐)) โ โ p' ๊ โ , (p < p') ร p' โ L k (p' , i , j) = โฃ p' , i , โฃ inr (a , j) โฃ โฃ l : โแดธ l = (L , L-inhabited , L-lower , L-upper-open) l-dedekind-gives-A-decidable : is-dedekind l โ A + ยฌ A l-dedekind-gives-A-decidable ((U , _ , _) , LU-ordered , LU-located) = ฮด where ฮด : A + ยฌ A ฮด = โฅโฅ-rec (decidability-of-prop-is-prop fe A-is-prop) h (LU-located ๐ ยฝ ๐-is-less-than-ยฝ) where h : (๐ โ L) + (ยฝ โ U) โ A + ยฌ A h (inl ๐-in-L) = inl (โฅโฅ-rec A-is-prop k ๐-in-L) where k : (๐ < ๐) + (A ร (๐ < ๐)) โ A k (inl โ) = ๐-elim (<-โ-โ-irrefl ๐ โ) k (inr (a , _)) = a h (inr ยฝ-in-U) = inr ฮฝ where ฮฝ : ยฌ A ฮฝ a = disjoint-criterion L U LU-ordered ยฝ (ยฝ-in-L , ยฝ-in-U) where ยฝ-in-L : ยฝ โ L ยฝ-in-L = โฃ inr (a , ยฝ-is-less-than-๐) โฃ L-bounded-above : is-bounded-above L L-bounded-above = โฃ ๐ , (ฮป ๐-in-L โ โฅโฅ-rec ๐-is-prop h ๐-in-L) โฃ where h : ยฌ((๐ < ๐) + (A ร (๐ < ๐))) h (inl โ) = <-โ-โ-irrefl ๐ (โ-transitivity ๐ ๐ ๐ ๐-is-less-than-๐ โ) h (inr (_ , โ)) = <-โ-โ-irrefl ๐ โ b : โแดฎแดธ b = (l , L-bounded-above) ฮณ : A + ยฌ A ฮณ = l-dedekind-gives-A-decidable (ฮฑ b)The canonical embedding of the rationals into the reals:โ-to-โแดธ : โ โ โแดธ โ-to-โแดธ q = (ฮป p โ (p < q) , <-โ-โ-is-prop-valued p q) , โ-is-lower-open q , (ฮป p i r j โ โ-transitivity r p q j i) , (ฮป p i โ โฃ โ-density p q i โฃ) โ-to-โแต : โ โ โแต โ-to-โแต q = (ฮป p โ (q < p) , <-โ-โ-is-prop-valued q p) , โ-is-upper-open q , (ฮป p i r j โ โ-transitivity q p r i j) , (ฮป p i โ โฃ(ฮป (r , j , k) โ r , k , j) (โ-density q p i)โฃ) โ-to-โแต-is-upper-section-of-โ-to-โแดธ : (q : โ) โ (โ-to-โแต q) is-upper-section-of (โ-to-โแดธ q) โ-to-โแต-is-upper-section-of-โ-to-โแดธ q = (ฮป p โ โ-transitivity p q) , (ฮป p โ โ-cotransitivity p q) โ-to-โแดธ-is-dedekind : (q : โ) โ is-dedekind (โ-to-โแดธ q) โ-to-โแดธ-is-dedekind q = โ-to-โแต q , โ-to-โแต-is-upper-section-of-โ-to-โแดธ q โ-to-โ : โ โ โ โ-to-โ q = โ-to-โแดธ q , โ-to-โแดธ-is-dedekind q โ-to-โแดธ-is-embedding : is-embedding โ-to-โแดธ โ-to-โแดธ-is-embedding l (p , a) (q , b) = ฮณ where I = โ-to-โแดธ p ๏ผโจ a โฉ l ๏ผโจ b โปยน โฉ โ-to-โแดธ q โ II : (ฮป r โ (r < p) , _) ๏ผ (ฮป r โ (r < q) , _) II = ap prโ I III : (ฮป r โ r < p) ๏ผ (ฮป r โ r < q) III = ap (ฮป f r โ prโ (f r)) II A : (r : โ) โ r < p โ r < q A r = idtofun (r < p) (r < q) (happly III r) B : (r : โ) โ r < q โ r < p B r = idtofun (r < q) (r < p) (happly (III โปยน) r) V : p ๏ผ q V = โ-โค-antisym p q A B ฮณ : (p , a) ๏ผ (q , b) ฮณ = to-subtype-๏ผ (ฮป _ โ โแดธ-is-set) V instance canonical-map-โ-to-โ : Canonical-Map โ โ ฮน {{canonical-map-โ-to-โ}} = โ-to-โ โ-to-โ-is-embedding : is-embedding (canonical-map โ โ) โ-to-โ-is-embedding = factor-is-embedding โ-to-โ โ-to-โแดธ โ-to-โแดธ-is-embedding โ-to-โแดธ-is-embedding where notice-that : โ-to-โแดธ โ โ-to-โ ๏ผ โ-to-โแดธ notice-that = refl is-rational : โ โ ๐คโบ ฬ is-rational x = ฮฃ q ๊ โ , ฮน q ๏ผ x being-rational-is-prop : (x : โ) โ is-prop (is-rational x) being-rational-is-prop = โ-to-โ-is-embeddingWe could also define instance canonical-map-โ-to-โแดธ : Canonical-Map โ โแดธ ฮน {{canonical-map-โ-to-โแดธ}} = โ-to-โแดธ canonical-map-โ-to-โแต : Canonical-Map โ โแต ฮน {{canonical-map-โ-to-โแต}} = โ-to-โแต but this would give us trouble with unsolved constraints. We now consider order and apartness on real numbers.lowercut : โ โ ๐ โ lowercut ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = L uppercut : โ โ ๐ โ uppercut ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = U instance strict-order-โ-โ : Strict-Order โ โ _<_ {{strict-order-โ-โ}} p x = p โ lowercut x strict-order-โ-โ : Strict-Order โ โ _<_ {{strict-order-โ-โ}} x q = q โ uppercut x strict-order-โ-โ : Strict-Order โ โ _<_ {{strict-order-โ-โ}} x y = โ q ๊ โ , (x < q) ร (q < y) <-โ-โ-is-prop-valued : (p : โ) (x : โ) โ is-prop (p < x) <-โ-โ-is-prop-valued p x = โ-is-prop (lowercut x) p <-โ-โ-is-prop-valued : (x : โ) (q : โ) โ is-prop (x < q) <-โ-โ-is-prop-valued x q = โ-is-prop (uppercut x) q <-โ-โ-is-prop-valued : (x y : โ) โ is-prop (x < y) <-โ-โ-is-prop-valued x y = โ-is-propWe now name all the remaining projections out of โ. We first give their types and then define them, for the sake of clarity.lowercut-is-inhabited : (x : โ) โ โ p ๊ โ , p < x uppercut-is-inhabited : (x : โ) โ โ q ๊ โ , x < q lowercut-is-lower : (x : โ) (q : โ) โ q < x โ (p : โ) โ p < q โ p < x uppercut-is-upper : (x : โ) (p : โ) โ x < p โ (q : โ) โ p < q โ x < q lowercut-is-upper-open : (x : โ) (p : โ) โ p < x โ โ q ๊ โ , (p < q) ร (q < x) uppercut-is-lower-open : (x : โ) (q : โ) โ x < q โ โ p ๊ โ , (p < q) ร (x < p) cuts-are-ordered : (x : โ) (p q : โ) โ p < x โ x < q โ p < q cuts-are-located : (x : โ) (p q : โ) โ p < q โ (p < x) โจ (x < q) cuts-are-disjoint : (x : โ) (p : โ) โ p < x โ x โฎ p lowercut-is-bounded : (x : โ) โ โ p ๊ โ , p โฎ x lowercut-is-located : (x : โ) (p q : โ) โ p < q โ (p < x) โจ (q โฎ x) lowercut-is-inhabited ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Li uppercut-is-inhabited ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Ui lowercut-is-lower ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Ll uppercut-is-upper ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Uu lowercut-is-upper-open ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Lo uppercut-is-lower-open ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = Uo cuts-are-ordered ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = o cuts-are-located ((L , Li , Ll , Lo) , (U , Ui , Uu , Uo) , o , l) = l cuts-are-disjoint x p l m = disjoint-criterion (lowercut x) (uppercut x) (cuts-are-ordered x) p (l , m) lowercut-is-bounded (l , ฮด) = prโ (dedekind-gives-troelstra l ฮด) lowercut-is-located (l , ฮด) = prโ (dedekind-gives-troelstra l ฮด)The lower and upper cut projections are left-cancellable (and hence embeddings, as the types under consideration are all sets).lowercut-lc : (x y : โ) โ lowercut x ๏ผ lowercut y โ x ๏ผ y lowercut-lc x y e = to-subtype-๏ผ being-dedekind-is-prop (to-subtype-๏ผ being-lower-real-is-prop e) uppercut-lc : (x y : โ) โ uppercut x ๏ผ uppercut y โ x ๏ผ y uppercut-lc x y p = lowercut-lc x y III where I : lowercut x โ lowercut y I = order-lemma-converse (lowercut x) (uppercut x) (lowercut y) (uppercut y) (lowercut-is-upper-open x) (cuts-are-located y) (cuts-are-ordered x) (transport (_โ uppercut x) p (โ-refl (uppercut x))) II : lowercut x โ lowercut y II = order-lemma-converse (lowercut y) (uppercut y) (lowercut x) (uppercut x) (lowercut-is-upper-open y) (cuts-are-located x) (cuts-are-ordered y) (transport (uppercut x โ_) p (โ-refl (uppercut x))) III : lowercut x ๏ผ lowercut y III = subset-extensionality'' pe fe fe I IIWe now develop the basic properties of the _<_ order.<-irrefl : (x : โ) โ x โฎ x <-irrefl x โ = ฮณ where ฮด : ยฌ (ฮฃ q ๊ โ , ((x < q) ร (q < x))) ฮด (q , a , b) = cuts-are-disjoint x q b a ฮณ : ๐ ฮณ = โฅโฅ-rec ๐-is-prop ฮด โ <-โ-โ-trans : (x y z : โ) โ x < y โ y < z โ x < z <-โ-โ-trans x y z i j = โฅโฅ-functorโ f i j where f : (ฮฃ p ๊ โ , (x < p) ร (p < y)) โ (ฮฃ q ๊ โ , (y < q) ร (q < z)) โ ฮฃ r ๊ โ , (x < r) ร (r < z) f (p , i , j) (q , k , l) = p , i , v where u : p < q u = cuts-are-ordered y p q j k v : p < z v = lowercut-is-lower z q l p u <-cotrans-โ : (p q : โ) โ p < q โ (z : โ) โ (p < z) โจ (z < q) <-cotrans-โ p q โ z = cuts-are-located z p q โ <-cotrans : (x y : โ) โ x < y โ (z : โ) โ (x < z) โจ (z < y) <-cotrans x y โ z = V where I : (ฮฃ q ๊ โ , ((x < q) ร (q < y))) โ (x < z) โจ (z < y) I (q , a , b) = โฅโฅ-rec โจ-is-prop III II where II : โ p ๊ โ , (p < q) ร (x < p) II = uppercut-is-lower-open x q a III : (ฮฃ p ๊ โ , (p < q) ร (x < p)) โ (x < z) โจ (z < y) III (p , c , d) = โฅโฅ-functor IV (<-cotrans-โ p q c z) where IV : (p < z) + (z < q) โ (x < z) + (z < y) IV (inl โ) = inl โฃ p , d , โ โฃ IV (inr โ) = inr โฃ q , โ , b โฃ V : (x < z) โจ (z < y) V = โฅโฅ-rec โจ-is-prop I โThere are a number of equivalent ways to define the _โค_ order on โ. We give four for now, and three more later._โคโ_ _โคโ_ _โคโ_ _โคโ_ : โ โ โ โ ๐ค ฬ x โคโ y = (p : โ) โ p < x โ p < y x โคโ y = (q : โ) โ y < q โ x < q x โคโ y = y โฎ x x โคโ y = (p q : โ) โ p < x โ y < q โ p < qDefinition (3) has the advantage that it is applicable when x is a lower real and y is an upper real. See the interval domain below. But we adopted the first definition for reals before we realized that. It doesn't matter much, because we can switch between all the definitions in the case of the Dedekind reals.โคโ-is-prop-valued : (x y : โ) โ is-prop (x โคโ y) โคโ-is-prop-valued : (x y : โ) โ is-prop (x โคโ y) โคโ-is-prop-valued : (x y : โ) โ is-prop (x โคโ y) โคโ-is-prop-valued : (x y : โ) โ is-prop (x โคโ y) โคโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป _ _ โ <-โ-โ-is-prop-valued _ y) โคโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป _ _ โ <-โ-โ-is-prop-valued x _) โคโ-is-prop-valued x y = negations-are-props fe โคโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป _ _ _ _ โ <-โ-โ-is-prop-valued _ _) instance order-โ-โ : Order โ โ _โค_ {{order-โ-โ}} = _โคโ_ โค-gives-โคโ : (x y : โ) โ x โค y โ x โคโ y โค-gives-โคโ x y โ = order-lemma (lowercut x) (uppercut x) (lowercut y) (uppercut y) (uppercut-is-lower-open y) (cuts-are-located x) (cuts-are-ordered y) โ โคโ-gives-โค : (x y : โ) โ x โคโ y โ x โค y โคโ-gives-โค x y โ = order-lemma-converse (lowercut x) (uppercut x) (lowercut y) (uppercut y) (lowercut-is-upper-open x) (cuts-are-located y) (cuts-are-ordered x) โ โคโ-gives-โค : (x y : โ) โ x โคโ y โ x โค y โคโ-gives-โค x y ฮฝ q โ = VI where I : (p : โ) โ p < x โ y โฎ p I p m l = ฮฝ โฃ p , l , m โฃ II : โ p ๊ โ , (q < p) ร (p < x) II = lowercut-is-upper-open x q โ III : (ฮฃ p ๊ โ , (q < p) ร (p < x)) โ q < y III (p , i , j) = โฅโฅ-rec (<-โ-โ-is-prop-valued q y) V IV where IV : (q < y) โจ (y < p) IV = <-cotrans-โ q p i y V : (q < y) + (y < p) โ q < y V (inl k) = k V (inr l) = ๐-elim (I p j l) VI : q < y VI = โฅโฅ-rec (<-โ-โ-is-prop-valued q y) III II โค-gives-โคโ : (x y : โ) โ x โค y โ x โคโ y โค-gives-โคโ x y โ i = II where I : ยฌ (ฮฃ p ๊ โ , (y < p) ร (p < x)) I (p , j , k) = cuts-are-disjoint y p (โ p k) j II : ๐ II = โฅโฅ-rec ๐-is-prop I i โคโ-gives-โค : (x y : โ) โ x โคโ y โ x โค y โคโ-gives-โค x y l = III where I : ยฌ (ฮฃ p ๊ โ , (y < p) ร (p < x)) I (p , i , j) = <-โ-โ-irrefl p (l p p j i) II : y โฎ x II m = โฅโฅ-rec ๐-is-prop I m III : x โค y III = โคโ-gives-โค x y II โค-gives-โคโ : (x y : โ) โ x โค y โ x โคโ y โค-gives-โคโ x y l p q i j = II where I : p < y I = l p i II : p < q II = cuts-are-ordered y p q I j โค-โ-refl : (x : โ) โ x โค x โค-โ-refl x q โ = โ โค-โ-โ-trans : (x y z : โ) โ x โค y โ y โค z โ x โค z โค-โ-โ-trans x y z l m p i = m p (l p i) โค-โ-โ-antisym : (x y : โ) โ x โค y โ y โค x โ x ๏ผ y โค-โ-โ-antisym x y l m = lowercut-lc x y ฮณ where ฮณ : lowercut x ๏ผ lowercut y ฮณ = subset-extensionality'' pe fe fe l mThe type โ is large, in the sense that it lives in ๐คโบ rather than ๐ค, but it is locally small, in the sense that each identity type x ๏ผ y with x,y:โ, which also lives in ๐คโบ, has copy in the universe ๐ค, namely the type (x โค y) ร (y โค x).โ-is-locally-small : is-locally-small โ โ-is-locally-small x y = ฮณ where f : (x โค y) ร (y โค x) โ x ๏ผ y f = uncurry (โค-โ-โ-antisym x y) g : x ๏ผ y โ (x โค y) ร (y โค x) g refl = โค-โ-refl x , โค-โ-refl x e : ((x โค y) ร (y โค x)) โ (x ๏ผ y) e = qinveq f (g , (ฮป a โ ร-is-prop (โคโ-is-prop-valued x y) (โคโ-is-prop-valued y x) (g (f a)) a) , (ฮป b โ โ-is-set (f (g b)) b)) ฮณ : (x ๏ผ y) is ๐ค small ฮณ = ((x โค y) ร (y โค x)) , eRelationship between the orders of โ and โ:โ-to-โ-preserves-< : (p q : โ) โ p < q โ ฮน p < ฮน q โ-to-โ-preserves-< p q l = โฃ โ-density p q l โฃ โ-to-โ-reflects-< : (p q : โ) โ ฮน p < ฮน q โ p < q โ-to-โ-reflects-< p q = โฅโฅ-rec (<-โ-โ-is-prop-valued p q) (ฮป (r , i , j) โ โ-transitivity p r q i j) โค-on-โ-agrees-with-โค-on-โ : (p q : โ) โ (p โค q) ๏ผ (ฮน p โค ฮน q) โค-on-โ-agrees-with-โค-on-โ p q = refl โค-on-โ-is-prop-valued : (p q : โ) โ is-prop (ฮน p โค ฮน q) โค-on-โ-is-prop-valued p q = โคโ-is-prop-valued (ฮน p) (ฮน q) โ-to-โ-preserves-โค : (p q : โ) โ p โค q โ ฮน p โค ฮน q โ-to-โ-preserves-โค p q = id โ-to-โ-reflects-โค : (p q : โ) โ ฮน p โค ฮน q โ p โค q โ-to-โ-reflects-โค p q = id โ-to-โ-left : (p : โ) (x : โ) โ p < x โ ฮน p < x โ-to-โ-left p x = lowercut-is-upper-open x p โ-to-โ-left-converse : (p : โ) (x : โ) โ ฮน p < x โ p < x โ-to-โ-left-converse p x = โฅโฅ-rec (<-โ-โ-is-prop-valued p x) (ฮป (q , m , o) โ lowercut-is-lower x q o p m) โ-to-โ-right : (x : โ) (q : โ) โ x < q โ x < ฮน q โ-to-โ-right x q l = โฅโฅ-functor (ฮป (p , m , o) โ p , o , m) (uppercut-is-lower-open x q l) โ-to-โ-right-converse : (x : โ) (q : โ) โ x < ฮน q โ x < q โ-to-โ-right-converse x q = โฅโฅ-rec (<-โ-โ-is-prop-valued x q) (ฮป (p , m , o) โ uppercut-is-upper x p m q o)The promised three more ways to define _โค_ on โ:_โคโโ_ _โคโโ_ _โคโโ_ : โ โ โ โ ๐คโบ ฬ x โคโโ y = (z : โ) โ z < x โ z < y x โคโโ y = (z : โ) โ y < z โ x < z x โคโโ y = (z t : โ) โ z < x โ y < t โ z < t โคโโ-is-prop-valued : (x y : โ) โ is-prop (x โคโโ y) โคโโ-is-prop-valued : (x y : โ) โ is-prop (x โคโโ y) โคโโ-is-prop-valued : (x y : โ) โ is-prop (x โคโโ y) โคโโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป z _ โ <-โ-โ-is-prop-valued z y) โคโโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป z _ โ <-โ-โ-is-prop-valued x z) โคโโ-is-prop-valued x y = ฮ โ-is-prop fe (ฮป z t _ _ โ <-โ-โ-is-prop-valued z t) โคโ-gives-โคโโ : (x y : โ) โ x โคโ y โ x โคโโ y โคโ-gives-โคโโ x y l z = โฅโฅ-functor f where f : (ฮฃ p ๊ โ , (z < p) ร (p < x)) โ (ฮฃ p ๊ โ , (z < p) ร (p < y)) f (p , u , v) = p , u , l p v โคโโ-gives-โคโ : (x y : โ) โ x โคโโ y โ x โคโ y โคโโ-gives-โคโ x y l p m = II where I : ฮน p < y I = l (ฮน p) (โ-to-โ-left p x m) II : p < y II = โ-to-โ-left-converse p y I โคโ-gives-โคโโ : (x y : โ) โ x โคโ y โ x โคโโ y โคโ-gives-โคโโ x y l z = โฅโฅ-functor f where f : (ฮฃ p ๊ โ , (y < p) ร (p < z)) โ (ฮฃ p ๊ โ , (x < p) ร (p < z)) f (p , u , v) = p , l p u , v โคโโ-gives-โคโ : (x y : โ) โ x โคโโ y โ x โคโ y โคโโ-gives-โคโ x y l p m = II where I : x < ฮน p I = l (ฮน p) (โ-to-โ-right y p m) II : x < p II = โ-to-โ-right-converse x p I โคโโ-gives-โคโ : (x y : โ) โ x โคโโ y โ x โคโ y โคโโ-gives-โคโ x y l p q m o = โ-to-โ-reflects-< p q ฮณ where ฮณ : ฮน p < ฮน q ฮณ = l (ฮน p) (ฮน q) (โ-to-โ-left p x m) (โ-to-โ-right y q o) โคโ-gives-โคโโ : (x y : โ) โ x โคโ y โ x โคโโ y โคโ-gives-โคโโ x y l z t m o = โฅโฅ-functorโ f m o where f : (ฮฃ p ๊ โ , (z < p) ร (p < x)) โ (ฮฃ q ๊ โ , (y < q) ร (q < t)) โ (ฮฃ p ๊ โ , (z < p) ร (p < t)) f (p , i , j) (q , u , v) = p , i , II where I : p < q I = l p q j u II : p < t II = lowercut-is-lower t q v p IRelationship between _<_ and _โค_ on โ:<-gives-โค' : (x y : โ) โ x < y โ x โค y <-gives-โค' x y l = โคโโ-gives-โคโ x y f where f : (z : โ) โ z < x โ z < y f z m = <-โ-โ-trans z x y m l <-โค-trans : (x y z : โ) โ x < y โ y โค z โ x < z <-โค-trans x y z l m = โคโ-gives-โคโโ y z m x l โค-<-โ-โ-trans : (x y z : โ) โ x โค y โ y < z โ x < z โค-<-โ-โ-trans x y z l m = โคโ-gives-โคโโ x y (โค-gives-โคโ x y l) z mApartness of real numbers and its basic properties:_โฏ_ : โ โ โ โ ๐ค ฬ x โฏ y = (x < y) + (y < x) โฏ-is-prop-valued : (x y : โ) โ is-prop (x โฏ y) โฏ-is-prop-valued x y = sum-of-contradictory-props (<-โ-โ-is-prop-valued x y) (<-โ-โ-is-prop-valued y x) (ฮป i j โ <-irrefl x (<-โ-โ-trans x y x i j)) โฏ-irrefl : (x : โ) โ ยฌ (x โฏ x) โฏ-irrefl x (inl โ) = <-irrefl x โ โฏ-irrefl x (inr โ) = <-irrefl x โ โฏ-gives-โ : (x y : โ) โ x โฏ y โ x โ y โฏ-gives-โ x x s refl = โฏ-irrefl x s โฏ-sym : (x y : โ) โ x โฏ y โ y โฏ x โฏ-sym x y (inl โ) = inr โ โฏ-sym x y (inr โ) = inl โ โฏ-cotrans : (x y : โ) โ x โฏ y โ (z : โ) โ (x โฏ z) โจ (y โฏ z) โฏ-cotrans x y (inl โ) z = โฅโฅ-functor (cases (ฮป (โ : x < z) โ inl (inl โ)) (ฮป (โ : z < y) โ inr (inr โ))) (<-cotrans x y โ z) โฏ-cotrans x y (inr โ) z = โฅโฅ-functor (cases (ฮป (โ : y < z) โ inr (inl โ)) (ฮป (โ : z < x) โ inl (inr โ))) (<-cotrans y x โ z) โฏ-is-tight : (x y : โ) โ ยฌ (x โฏ y) โ x ๏ผ y โฏ-is-tight x y ฮฝ = โค-โ-โ-antisym x y III IV where I : x โฎ y I โ = ฮฝ (inl โ) II : y โฎ x II โ = ฮฝ (inr โ) III : x โค y III = โคโ-gives-โค x y II IV : y โค x IV = โคโ-gives-โค y x I โ-is-ยฌยฌ-separated : (x y : โ) โ ยฌยฌ (x ๏ผ y) โ x ๏ผ y โ-is-ยฌยฌ-separated x y ฯ = โฏ-is-tight x y (c ฯ) where c : ยฌยฌ (x ๏ผ y) โ ยฌ (x โฏ y) c = contrapositive (โฏ-gives-โ x y) strict-โ-order-criterion : (x y : โ) โ x โค y โ x โฏ y โ x < y strict-โ-order-criterion x y โ (inl m) = m strict-โ-order-criterion x y โ (inr m) = ๐-elim (โค-gives-โคโ x y โ m) is-irrational : โ โ ๐คโบ ฬ is-irrational x = ยฌ (ฮฃ q ๊ โ , ฮน q ๏ผ x) is-strongly-irrational : โ โ ๐ค ฬ is-strongly-irrational x = (q : โ) โ ฮน q โฏ x being-irrational-is-prop : (x : โ) โ is-prop (is-irrational x) being-irrational-is-prop x = negations-are-props fe being-strongly-irrational-is-prop : (x : โ) โ is-prop (is-strongly-irrational x) being-strongly-irrational-is-prop x = ฮ -is-prop fe (ฮป q โ โฏ-is-prop-valued (ฮน q) x)We now consider the existence of least upper bounds of bounded families x : ๐ผ โ โ with ๐ผ inhabited. A sufficient condition, given by Bishop (using his version of Cauchy reals, rather than our version of Dedekind reals, which is what we are working with here), is that (p q : โ) โ p < q โ (โ i ๊ ๐ผ , p < x i) โจ (ฮ i ๊ ๐ผ , x i < q). We observe that the weaker condition (p q : โ) โ p < q โ (โ i ๊ ๐ผ , p < x i) โจ ยฌ(โ i ๊ ๐ผ , q < x i) suffices (see below for the formal fact that it is indeed weaker). If we define (p < x) = (โ i ๊ ๐ผ , p < x i), then this weaker sufficient condition reads (p q : โ) โ p < q โ (p < x) โจ (q โฎ x) so that we see that it is analogous to Troelstra's locatedness condition discussed above. In the following, we write x โค y to mean that the real number y is an upper bound of the family x.module _ {๐ผ : ๐ค ฬ } where private F = ๐ผ โ โ instance order-F-โ : Order F โ _โค_ {{order-F-โ}} x y = (i : ๐ผ) โ x i โค y โค-F-โ-is-prop-valued : (x : F) (y : โ) โ is-prop (x โค y) โค-F-โ-is-prop-valued x y = ฮ -is-prop fe (ฮป i โ โคโ-is-prop-valued (x i) y) _has-lub_ : F โ โ โ ๐คโบ ฬ x has-lub y = (x โค y) ร ((z : โ) โ x โค z โ y โค z) _has-a-lub : F โ ๐คโบ ฬ x has-a-lub = ฮฃ y ๊ โ , (x has-lub y) having-lub-is-prop : (x : F) (y : โ) โ is-prop (x has-lub y) having-lub-is-prop x y = ร-is-prop (โค-F-โ-is-prop-valued x y) (ฮ โ-is-prop fe (ฮป z _ โ โคโ-is-prop-valued y z)) having-a-lub-is-prop : (x : F) โ is-prop (x has-a-lub) having-a-lub-is-prop x (y , a , b) (y' , a' , b') = ฮณ where I : y ๏ผ y' I = โค-โ-โ-antisym y y' (b y' a') (b' y a) ฮณ : (y , a , b) ๏ผ (y' , a' , b') ฮณ = to-subtype-๏ผ (having-lub-is-prop x) I instance strict-order-โ-F : Strict-Order โ F _<_ {{strict-order-โ-F}} p x = โ i ๊ ๐ผ , p < x i strict-order-โ-F-is-prop : (p : โ) (x : F) โ is-prop (p < x) strict-order-โ-F-is-prop p x = โ-is-prop strict-order-โ-F-observation : (p : โ) (x : F) โ (p โฎ x) โ (x โค ฮน p) strict-order-โ-F-observation p x = f , g where f : p โฎ x โ x โค ฮน p f ฮฝ i = I where I : (q : โ) โ q < x i โ q < p I q l = โ-order-criterion q p II III where II : p โฎ q II m = ฮฝ โฃ i , lowercut-is-lower (x i) q l p m โฃ III : q โ p III refl = ฮฝ โฃ i , l โฃ g : x โค ฮน p โ p โฎ x g l = โฅโฅ-rec ๐-is-prop I where I : ยฌ (ฮฃ i ๊ ๐ผ , p < x i) I (i , m) = <-โ-โ-irrefl p (l i p m) is-upper-bounded : F โ ๐คโบ ฬ is-upper-bounded x = โ y ๊ โ , (x โค y) is-located-family : F โ ๐ค ฬ is-located-family x = (p q : โ) โ p < q โ (p < x) โจ (q โฎ x) lub-sufficient-conditions : F โ ๐คโบ ฬ lub-sufficient-conditions x = โฅ ๐ผ โฅ ร is-upper-bounded x ร is-located-family x lub : (x : F) โ lub-sufficient-conditions x โ x has-a-lub lub x (๐ผ-inhabited , x-bounded , x-located) = y , a , b where L : ๐ โ L p = (p < x) , strict-order-โ-F-is-prop p x L-inhabited : โ p ๊ โ , p < x L-inhabited = โฅโฅ-rec โ-is-prop I ๐ผ-inhabited where I : ๐ผ โ โ p ๊ โ , โ i ๊ ๐ผ , p < x i I i = III II where II : ฮฃ i ๊ ๐ผ , โ p ๊ โ , p < x i II = i , lowercut-is-inhabited (x i) III : type-of II โ โ p ๊ โ , โ i ๊ ๐ผ , p < x i III (i , s) = โฅโฅ-functor IV s where IV : (ฮฃ p ๊ โ , p < x i) โ ฮฃ p ๊ โ , โ i ๊ ๐ผ , p < x i IV (p , l) = p , โฃ i , l โฃ L-lower : (q : โ) โ q < x โ (p : โ) โ p < q โ p < x L-lower q l p m = โฅโฅ-functor (ฮป (i , k) โ i , lowercut-is-lower (x i) q k p m) l L-upper-open : (p : โ) โ p < x โ โ p' ๊ โ , ((p < p') ร (p' < x)) L-upper-open p = โฅโฅ-rec โ-is-prop f where f : (ฮฃ i ๊ ๐ผ , p < x i) โ โ p' ๊ โ , ((p < p') ร (p' < x)) f (i , l) = โฅโฅ-functor g (lowercut-is-upper-open (x i) p l) where g : (ฮฃ p' ๊ โ , (p < p') ร (p' < x i)) โ (ฮฃ p' ๊ โ , (p < p') ร (p' < x)) g (p' , m , o) = p' , m , โฃ i , o โฃ yแดธ : โแดธ yแดธ = (L , L-inhabited , L-lower , L-upper-open) L-bounded-above : โ q ๊ โ , q โฎ x L-bounded-above = โฅโฅ-rec โ-is-prop I x-bounded where I : (ฮฃ ฮฒ ๊ โ , x โค ฮฒ) โ โ q ๊ โ , q โฎ x I (ฮฒ , l) = โฅโฅ-functor II (uppercut-is-inhabited ฮฒ) where II : (ฮฃ q ๊ โ , ฮฒ < q) โ ฮฃ q ๊ โ , q โฎ x II (q , m) = q , โฅโฅ-rec ๐-is-prop III where III : ยฌ (ฮฃ i ๊ ๐ผ , q < x i) III (i , o) = <-โ-โ-irrefl q (cuts-are-ordered ฮฒ q q (l i q o) m) L-located : (p q : โ) โ p < q โ (p < x) โจ (q โฎ x) L-located = x-located ฯ : is-troelstra yแดธ ฯ = L-bounded-above , L-located y : โ y = (yแดธ , troelstra-gives-dedekind yแดธ ฯ) a : x โค y a i p l = โฃ i , l โฃ b : (z : โ) โ x โค z โ y โค z b z l p = โฅโฅ-rec (<-โ-โ-is-prop-valued p z) f where f : (ฮฃ i ๊ ๐ผ , p < x i) โ p < z f (i , m) = l i p m instance strict-order-F-โ : Strict-Order F โ _<_ {{strict-order-F-โ}} x q = (i : ๐ผ) โ x i < q <-F-โ-is-prop-valued : (q : โ) (x : F) โ is-prop (x < q) <-F-โ-is-prop-valued q x = ฮ -is-prop fe (ฮป i โ <-โ-โ-is-prop-valued (x i) q) is-bishop-located : F โ ๐ค ฬ is-bishop-located x = (p q : โ) โ p < q โ (p < x) โจ (x < q) bishop-located-families-are-located : (x : F) โ is-bishop-located x โ is-located-family x bishop-located-families-are-located x located p q l = IV where I : x < q โ q โฎ x I m = โฅโฅ-rec ๐-is-prop II where II : ยฌ (ฮฃ i ๊ ๐ผ , q < x i) II (i , o) = <-โ-โ-irrefl q (cuts-are-ordered (x i) q q o (m i)) III : (p < x) + (x < q) โ (p < x) + (q โฎ x) III (inl l) = inl l III (inr m) = inr (I m) IV : (p < x) โจ (q โฎ x) IV = โฅโฅ-functor III (located p q l)The partial reals, or interval domain, arise from dropping the locatedness condition from the Dedekind reals.instance strict-order-โ-โแดธ : Strict-Order โ โแดธ _<_ {{strict-order-โ-โแดธ}} p (L , _) = p โ L strict-order-โแต-โ : Strict-Order โแต โ _<_ {{strict-order-โแต-โ}} (U , _) p = p โ U instance order-โแดธ-โแต : Order โแดธ โแต _โค_ {{order-โแดธ-โแต}} x y = (p q : โ) โ p < x โ y < q โ p < q ๐ก : ๐คโบ ฬ ๐ก = ฮฃ (x , y) ๊ โแดธ ร โแต , (x โค y) ๐ก-is-set : is-set ๐ก ๐ก-is-set = subsets-of-sets-are-sets (โแดธ ร โแต) (ฮป (x , y) โ x โค y) (ร-is-set โแดธ-is-set โแต-is-set) (ฮ โ-is-prop fe (ฮป _ _ _ _ โ <-โ-โ-is-prop-valued _ _)) NBโ : ๐ก โ (ฮฃ (L , U) ๊ ๐ โ ร ๐ โ , (is-inhabited L ร is-lower L ร is-upper-open L) ร (is-inhabited U ร is-upper U ร is-lower-open U) ร are-ordered L U) NBโ = qinveq (ฮป (((L , Li , Ll , Lo) , (U , Ui , Uu , Uo)) , o) โ (L , U) , (Li , Ll , Lo) , ((Ui , Uu , Uo) , o)) ((ฮป ((L , U) , (Li , Ll , Lo) , ((Ui , Uu , Uo) , o)) โ (((L , Li , Ll , Lo) , (U , Ui , Uu , Uo)) , o)) , (ฮป _ โ refl) , (ฮป _ โ refl)) โ-to-๐ก : โ โ ๐ก โ-to-๐ก (x , y , o , _) = (x , y) , o instance canonical-map-โ-to-๐ก : Canonical-Map โ ๐ก ฮน {{canonical-map-โ-to-๐ก}} = โ-to-๐ก order-โแดธ-โแดธ : Order โแดธ โแดธ _โค_ {{order-โแดธ-โแดธ}} x y = (p : โ) โ p < x โ p < y order-โแต-โแต : Order โแต โแต _โค_ {{order-โแต-โแต}} x y = (p : โ) โ y < p โ x < p square-order-๐ก-๐ก : Square-Order ๐ก ๐ก _โ_ {{square-order-๐ก-๐ก}} ((x , y) , _) ((x' , y') , _) = (x โค x') ร (y' โค y) โ-to-๐ก-is-embedding : is-embedding (canonical-map โ ๐ก) โ-to-๐ก-is-embedding ((x , y) , o) ((x , y , o , l) , refl) ((x , y , o , m) , refl) = ฮณ where ฮด : l ๏ผ m ฮด = being-located-is-prop (ฮน x) (ฮน y) l m ฮณ : ((x , y , o , l) , refl) ๏ผ ((x , y , o , m) , refl) ฮณ = ap (ฮป - โ (x , y , o , -) , refl) ฮดNotice that this is reverse inclusion of intervals: wider intervals are lower in the square order. If we drop the inhabitation conditions, the endpoints can be ยฑโ:๐กโ = (ฮฃ (L , U) ๊ ๐ โ ร ๐ โ , (is-lower L ร is-upper-open L) ร (is-upper U ร is-lower-open U) ร are-ordered L U)Added 9 January 2026 by Tom de Jong. Note that an alternative formulation of the axioms is given by the following.roundness : (x : ๐ โ ร ๐ โ) โ ๐ค ฬ roundness (L , U) = ((p : โ) โ p โ L โ (โ r ๊ โ , (p < r) ร (r โ L))) ร ((q : โ) โ q โ U โ (โ s ๊ โ , (s < q) ร (s โ U))) roundness-equivalence : ((L , U) : ๐ โ ร ๐ โ) โ is-lower L ร is-upper-open L ร is-upper U ร is-lower-open U โ roundness (L , U) roundness-equivalence (L , U) = I , II where I : is-lower L ร is-upper-open L ร is-upper U ร is-lower-open U โ roundness (L , U) I (L-low , L-uo , U-up , U-lo) = (ฮป p โ L-uo p , โฅโฅ-rec (โ-is-prop L p) (ฮป (r , l , r-in-L) โ L-low r r-in-L p l)) , (ฮป q โ U-lo q , โฅโฅ-rec (โ-is-prop U q) (ฮป (s , l , s-in-U) โ U-up s s-in-U q l)) II : roundness (L , U) โ is-lower L ร is-upper-open L ร is-upper U ร is-lower-open U II (ฯโ , ฯโ) = (ฮป q q-in-L p l โ rl-implication (ฯโ p) โฃ q , l , q-in-L โฃ) , (ฮป p โ lr-implication (ฯโ p)) , (ฮป p p-in-U q l โ rl-implication (ฯโ q) โฃ p , l , p-in-U โฃ) , (ฮป q โ lr-implication (ฯโ q))End of addition.๐ก-to-๐กโ : ๐ก โ ๐กโ ๐ก-to-๐กโ (((L , _ , Ll , Lo) , (U , _ , Uu , Uo)) , o) = (L , U) , (Ll , Lo) , (Uu , Uo) , o โฅ๐กโ : ๐กโ โฅ๐กโ = (โ , โ ) , ((ฮป _ ()) , (ฮป _ ())) , ((ฮป _ ()) , (ฮป _ ())) , (ฮป p q ()) instance canonical-map-๐ก-to-๐กโ : Canonical-Map ๐ก ๐กโ ฮน {{canonical-map-๐ก-to-๐กโ}} = ๐ก-to-๐กโ ๐ก-to-๐กโ-is-embedding : is-embedding (canonical-map ๐ก ๐กโ) ๐ก-to-๐กโ-is-embedding ((L , U) , (Ll , Lo) , (Uu , Uo) , o) ((((L , i , Ll , Lo) , U , k , Uu , Uo) , o) , refl) ((((L , j , Ll , Lo) , U , l , Uu , Uo) , o) , refl) = (((L , i , Ll , Lo) , U , k , Uu , Uo) , o) , refl ๏ผโจ I โฉ (((L , j , Ll , Lo) , U , l , Uu , Uo) , o) , refl โ where I = apโ (ฮป i k โ (((L , i , Ll , Lo) , U , k , Uu , Uo) , o) , refl) (being-inhabited-is-prop L i j) (being-inhabited-is-prop U k l) ๐กโ-is-set : is-set ๐กโ ๐กโ-is-set = subsets-of-sets-are-sets (๐ โ ร ๐ โ) _ (ร-is-set (๐-is-set' fe pe) (๐-is-set' fe pe)) (ฮป {(L , U)} โ รโ-is-prop (ร-is-prop (being-lower-is-prop L) (being-upper-open-is-prop L)) (ร-is-prop (being-upper-is-prop U) (being-lower-open-is-prop U)) (being-ordered-is-prop L U))TODO. Show that ๐กโ is isomorphic, as a dcpo, to the ideal completion of the dyadic intervals. The notion of a locator for a real number was studied by my former PhD student Auke Booij in his PhD thesis. Auke Booij. Extensional constructive real analysis via locators Mathematical Structures in Computer Science, Volume 31, Issue 1, January 2021, pp. 64 - 88 https://doi.org/10.1017/S0960129520000171 https://arxiv.org/abs/1805.06781locator : โ โ ๐ค ฬ locator x = (p q : โ) โ p < q โ (p < x) + (x < q)We also consider the following notion of locator for families:bishop-locator : {๐ผ : ๐ค ฬ } โ (๐ผ โ โ) โ ๐ค ฬ bishop-locator {๐ผ} x = (p q : โ) โ p < q โ (ฮฃ i ๊ ๐ผ , p < x i) + (ฮ i ๊ ๐ผ , x i < q) pointwise-locator-gives-bishop-locator : (๐ผ : ๐ค ฬ ) (x : ๐ผ โ โ) โ is-compactโ ๐ผ โ ((i : ๐ผ) โ locator (x i)) โ bishop-locator x pointwise-locator-gives-bishop-locator ๐ผ x ฮบ โ p q l = ฮณ where ฮณ : (ฮฃ i ๊ ๐ผ , p < x i) + (ฮ i ๊ ๐ผ , x i < q) ฮณ = compact-gives-ฮฃ+ฮ ๐ผ (ฮป i โ p < x i) (ฮป i โ x i < q) (compactโ-types-are-compact ฮบ) (ฮป i โ โ i p q l) lub-with-locators : (๐ผ : ๐ค ฬ ) (x : ๐ผ โ โ) โ is-compactโ ๐ผ โ is-upper-bounded x โ ((i : ๐ผ) โ locator (x i)) โ ฮฃ y ๊ โ , (x has-lub y) ร locator y lub-with-locators ๐ผ x ฮบ ฮฒ โ = ฮณ where h : โฅ ๐ผ โฅ h = โฃ compactโ-types-are-pointed ฮบ โฃ I : bishop-locator x I = pointwise-locator-gives-bishop-locator ๐ผ x ฮบ โ II : (p q : โ) โ p < q โ ((ฮฃ i ๊ ๐ผ , p < x i) + (ฮ i ๊ ๐ผ , x i < q)) โ (p < x) โจ (x < q) II p q l (inl (i , m)) = โฃ inl โฃ i , m โฃ โฃ II p q l (inr ฯ) = โฃ inr ฯ โฃ III : is-bishop-located x III p q l = II p q l (I p q l) IV : x has-a-lub IV = lub x (h , ฮฒ , bishop-located-families-are-located x III) y : โ y = prโ IV V : x has-lub y V = prโ IV VI : (p q : โ) โ p < q โ (p < y) + (y < q) VI p q l = ฮด (โ-density p q l) where ฮด : (ฮฃ q' ๊ โ , (p < q') ร (q' < q)) โ (p < y) + (y < q) ฮด (q' , i , j) = VII (I p q' i) where VII : ((ฮฃ i ๊ ๐ผ , p < x i) + (ฮ i ๊ ๐ผ , x i < q')) โ (p < y) + (y < q) VII (inl (o , m)) = inl โฃ o , m โฃ VII (inr ฯ) = inr IX where VIII : q' โฎ y VIII = โฅโฅ-rec ๐-is-prop (ฮป (i , o) โ <-โ-โ-irrefl q' (cuts-are-ordered (x i) q' q' o (ฯ i))) IX : โ q' ๊ โ , (q' < q) ร q' โฎ y IX = โฃ q' , j , VIII โฃ ฮณ : ฮฃ y ๊ โ , (x has-lub y) ร locator y ฮณ = (y , V , VI)Limits of sequences, but using the topological, rather than metric, structure of the reals.โฆ _,_โฆ : โ โ โ โ (โ โ ฮฉ ๐ค) โฆ p , q โฆ = ฮป x โ ((p < x) ร (x < q)) , ร-is-prop (<-โ-โ-is-prop-valued p x) (<-โ-โ-is-prop-valued x q) _has-limit_ : (โ โ โ) โ โ โ ๐ค ฬ x has-limit xโ = (p q : โ) โ xโ โ โฆ p , q โฆ โ โ n ๊ โ , ((k : โ) โ k โฅ n โ x k โ โฆ p , q โฆ) open import CoNaturals.Type is-continuous-โโ-โ : (โโ โ โ) โ ๐ค ฬ is-continuous-โโ-โ x = (๐ : โโ) (p q : โ) โ x ๐ โ โฆ p , q โฆ โ โ ๐ ๊ โโ , (๐ โบ ๐) ร ((๐พ : โโ) โ ๐พ โฝ ๐ โ x ๐พ โ โฆ p , q โฆ)TODO. Some (overlapping) problems:Problemโ = (x : โ โ โ) (xโ : โ) โ x has-limit xโ โ ฮฃ xฬ ๊ (โโ โ โ) , ((n : โ) โ xฬ (ฮน n) ๏ผ x n) ร (xฬ โ ๏ผ xโ) Problemโ = (x : โ โ โ) (xโ : โ) โ ((n : โ) โ locator (x n)) โ locator xโ โ x has-limit xโ โ ฮฃ xฬ ๊ (โโ โ โ) , ((n : โ) โ xฬ (ฮน n) ๏ผ x n) ร (xฬ โ ๏ผ xโ) ร ((๐ : โโ) โ locator (xฬ ๐)) Problemโ = (x : โโ โ โ) โ (x โ ฮน) has-limit (x โ) โ ((n : โ) โ locator (x (ฮน n))) โ locator (x โ) Problemโ = ฮฃ A ๊ (โ โ ฮฉ ๐ค) , (ฮฃ x ๊ โ , x โ A) โ โโ Problemโ = ฮฃ A ๊ (โ โ ฮฉ ๐ค) , ((ฮฃ x ๊ โ , x โ A) โ โโ) ร ((x : โ) โ x โ A โ locator x) Problemโ = (A : โ โ ฮฉ ๐ค) โ ((ฮฃ x ๊ โ , x โ A) โ โโ) โ (x : โ) โ x โ A โ locator xShould some of the above โ be ฮฃ and/or vice-versa? Added 22 August 2023. The lower reals have arbitrary sups if we remove the inhabitation condition, so that we get a point -โ, in addition to a point โ which is already present (this is well known). TODO. Maybe remove the the inhabitation condition from the lower reals. It doesn't really belong there.