Martin Escardo, July 2025. π-injecting maps and π-injective types. The motivation for this discussion is two-fold: (1) Injective types don't have any non-trivial decidable properties in general. (2) In particular, totally separated types, which have plenty of decidable properties by definition, fail badly to be injective in general. Can the totally separated types always be the injective types with respect to *some* class of maps? We consider π-injecting maps as a candidate for that. But, for the moment, they are not necessarily the answer, although we can show that injective types over π-injecting maps are totally separared. \begin{code} {-# OPTIONS --safe --without-K --lossy-unification #-} open import UF.FunExt module gist.2-injective-types (fe : FunExt) where open import MLTT.Plus-Properties open import MLTT.Spartan open import TypeTopology.TotallySeparated open import UF.Base open import UF.DiscreteAndSeparated open import UF.Equiv open import UF.Embeddings open import UF.PropTrunc open import UF.Retracts open import UF.Subsingletons open import UF.Subsingletons-FunExt private fe' : Fun-Ext fe' {π€} {π₯} = fe π€ π₯ \end{code} The double-dualization monad with base π, incompletely defined. \begin{code} K : π€ Μ β π€ Μ K X = (X β π) β π K-functor : {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β K X β K Y K-functor f Ο v = Ο (v β f) Ξ·α΄· : {X : π€ Μ } β X β K X Ξ·α΄· x u = u x ΞΌα΄· : {X : π€ Μ } β K (K X) β K X ΞΌα΄· F u = F (Ξ» Ο β Ο u) extα΄· : {X : π€ Μ } {Y : π₯ Μ } β (X β K Y) β K X β K Y extα΄· f Ο v = Ο (Ξ» x β f x v) strengthα΄· : {X : π€ Μ } {Y : π₯ Μ } β X Γ K Y β K (X Γ Y) strengthα΄· (x , Ξ³) w = Ξ³ (Ξ» y β w (x , y)) \end{code} (We probably defined above more than what we need for now, but we may need it in the future to answer some of the questions below.) \begin{code} _is-injective-over_ : (D : π£ Μ ) {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β π€ β π₯ β π£ Μ D is-injective-over j = (f : domain j β D) β Ξ£ f' κ (codomain j β D) , f' β j βΌ f \end{code} If D is injective over j, we also say that j is D-injecting. We name the two projections. \begin{code} module _ {D : π¦ Μ } {X : π€ Μ } {Y : π₯ Μ } (j : X β Y) (i : D is-injective-over j) (f : X β D) where extension : (Y β D) extension = prβ (i f) extension-extends : extension β j βΌ f extension-extends = prβ (i f) \end{code} The D-injecting maps form a wild category. \begin{code} injective-over-id : (D : π£ Μ ) {X : π€ Μ } β D is-injective-over (ππ X) injective-over-id D f = f , βΌ-refl injective-over-β : (D : π£ Μ ) {X : π€ Μ } {Y : π₯ Μ } {Z : π¦ Μ } {j : X β Y} {k : Y β Z} β D is-injective-over j β D is-injective-over k β D is-injective-over (k β j) injective-over-β D {X} {Y} {Z} {j} {k} ji ki f = f'' , f''-extends-f where f' : Y β D f' = extension j ji f f'-extends-f : f' β j βΌ f f'-extends-f = extension-extends j ji f f'' : Z β D f'' = extension k ki f' f''-extends-f' : f'' β k βΌ f' f''-extends-f' = extension-extends k ki f' f''-extends-f : f'' β (k β j) βΌ f f''-extends-f x = f'' (k (j x)) οΌβ¨ f''-extends-f' (j x) β© f' (j x) οΌβ¨ f'-extends-f x β© f x β \end{code} The natural instinct in the following is to assume that D is pointed, but, more generally, we can assume that D is pointed if Y is pointed, that is, we have some given function Y β D. Also, it is enough to assume that j is left-cancellable, rather than an embedding. \begin{code} module _ (D : π£ Μ ) {X : π€ Μ } {Y : π₯ Μ } where lc-map-with-decidable-fibers-is-universally-injecting : (j : X β Y) β left-cancellable j β each-fiber-of j is-decidable β (Y β D) β D is-injective-over j lc-map-with-decidable-fibers-is-universally-injecting j j-lc Ξ΄ g f = f' , f'-extends-f where h : (y : Y) β is-decidable (fiber j y) β D h y (inl (x , e)) = f x h y (inr Ξ½) = g y f' : Y β D f' y = h y (Ξ΄ y) H : (x : X) (d : is-decidable (fiber j (j x))) β h (j x) d οΌ f x H x (inl (x' , e)) = ap f (j-lc e) H x (inr Ξ½) = π-elim (Ξ½ (x , refl)) f'-extends-f : f' β j βΌ f f'-extends-f x = H x (Ξ΄ (j x)) inl-is-injective-over : (Y β D) β D is-injective-over (inl {π€} {π₯} {X} {Y}) inl-is-injective-over g f = cases f g , βΌ-refl inr-is-injective-over : (X β D) β D is-injective-over (inr {π€} {π₯} {X} {Y}) inr-is-injective-over g f = cases g f , βΌ-refl \end{code} In this file we are mostly interesting in the case D = π. We don't require π-injecting maps to be embeddings (but see the discussion below). \begin{code} is-π-injecting : {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β π€ β π₯ Μ is-π-injecting j = π is-injective-over j \end{code} In topological terms, the above means that every clopen of X can be extended to a clopen of Y along j. We say that a type is π-injective if it is injective over π-injecting maps. \begin{code} π-injective : π¦ Μ β (π€ π₯ : Universe) β π¦ β (π€ β π₯)βΊ Μ π-injective {π¦} D π€ π₯ = {X : π€ Μ } {Y : π₯ Μ } (j : X β Y) β is-π-injecting j β D is-injective-over j \end{code} By construction, the type π is π-injective. \begin{code} π-is-π-injective : π-injective π π€ π₯ π-is-π-injective j = id \end{code} The π-injective types are closed under products and retracts. \begin{code} π-injectives-closed-under-Ξ : {I : π£ Μ } {D : I β π¦ Μ } β ((i : I) β π-injective (D i) π€ π₯) β π-injective (Ξ D) π€ π₯ π-injectives-closed-under-Ξ {π£} {π¦} {I} {D} D-π-inj j j-π-injecting f = (Ξ» y i β extension j (D-π-inj i j j-π-injecting) (Ξ» x β f x i) y) , (Ξ» x β dfunext fe' (Ξ» i β extension-extends j (D-π-inj i j j-π-injecting) (Ξ» x β f x i) x)) retract-of-π-injective : (D' : π£' Μ ) (D : π£ Μ ) β π-injective D π€ π₯ β retract D' of D β π-injective D' π€ π₯ retract-of-π-injective D' D i (r , s , rs) {X} {Y} j e f = Ο a where a : Ξ£ f' κ (Y β D) , f' β j βΌ s β f a = i j e (s β f) Ο : (Ξ£ f' κ (Y β D) , f' β j βΌ s β f) β Ξ£ f'' κ (Y β D') , f'' β j βΌ f Ο (f' , h) = r β f' , (Ξ» x β ap r (h x) β rs (f x)) \end{code} TODO. Formulate the above in more generality with the same proof. The free algebras of the π-based double dualization monad are π-injective. \begin{code} first-dual-is-π-injective : {X : π£ Μ } β π-injective (X β π) π€ π₯ first-dual-is-π-injective = π-injectives-closed-under-Ξ (Ξ» i β π-is-π-injective) K-is-π-injective : {X : π£ Μ } β π-injective (K X) π€ π₯ K-is-π-injective = first-dual-is-π-injective \end{code} So, for example, the Cantor type (β β π) is π-injective, and hence so is ββ, because it is a retract of the Cantor type). The unit of the monad is π-injecting. \begin{code} Ξ·α΄·-is-π-injecting : {X : π€ Μ } β is-π-injecting (Ξ·α΄· {π€} {X}) Ξ·α΄·-is-π-injecting f = (Ξ» Ο β Ο f) , βΌ-refl \end{code} Hence every π-injective type is a retract of a free algebra. \begin{code} π-injectives-are-K-retracts : {D : π€ Μ } β π-injective D π€ π€ β retract D of K D π-injectives-are-K-retracts D-π-inj = extension Ξ·α΄· (D-π-inj Ξ·α΄· Ξ·α΄·-is-π-injecting) id , Ξ·α΄· , extension-extends Ξ·α΄· (D-π-inj Ξ·α΄· Ξ·α΄·-is-π-injecting) id \end{code} And therefore the π-injective types are all totally separated, because the type π is totally separated, and the totally separated types are closed under products and retracts. \begin{code} K-is-totally-separated : {X : π€ Μ } β is-totally-separated (K X) K-is-totally-separated = Ξ -is-totally-separated fe' (Ξ» _ β π-is-totally-separated) π-injectives-are-totally-separated : {D : π€ Μ } β π-injective D π€ π€ β is-totally-separated D π-injectives-are-totally-separated D-π-inj = retract-of-totally-separated (π-injectives-are-K-retracts D-π-inj) K-is-totally-separated \end{code} The above shows that a π-injecting map doesn't need to be an embedding. Indeed, we have seen that the map Ξ·α΄· : X β K X is always π-injecting, but we also know that it is an embedding if and only if X is totally separated. \begin{code} _ : {X : π€ Μ } β is-embedding (Ξ·α΄· {π€} {X}) β is-totally-separated X _ = totally-separatedβ-gives-totally-separated fe' , totally-separated-gives-totally-separatedβ fe' \end{code} The extension requirement is property, even though the choice of extension is data. \begin{code} module _ {D : π€ Μ } {X : π€ Μ } {Y : π€ Μ } (i : π-injective D π€ π€) (j : X β Y) (k : is-π-injecting j) (f : X β D) where extension-extends-is-prop : is-prop (extension j (i j k) f β j βΌ f) extension-extends-is-prop = Ξ -is-prop fe' (Ξ» x β totally-separated-types-are-sets fe' D (π-injectives-are-totally-separated i)) \end{code} As discussed above, we didn't require 2-injecting maps to be embeddings. We now show, in a number of steps, that we could have required them to be embeddings without loss of generality. \begin{code} module _ {X : π€ Μ } {Y : π₯ Μ } (j : X β Y) (ji : is-π-injecting j) where π-injecting-map-with-totally-separated-domain-is-lc : is-totally-separated X β left-cancellable j π-injecting-map-with-totally-separated-domain-is-lc ts {x} {x'} e = ts I where I : (p : X β π) β p x οΌ p x' I p = e' where p' : Y β π p' = prβ (ji p) p'-extends-p : p' β j βΌ p p'-extends-p = prβ (ji p) e' = p x οΌβ¨ (p'-extends-p x)β»ΒΉ β© p' (j x) οΌβ¨ ap p' e β© p' (j x') οΌβ¨ p'-extends-p x' β© p x' β π-injecting-map-of-totally-separated-types-is-embedding : is-totally-separated X β is-totally-separated Y β is-embedding j π-injecting-map-of-totally-separated-types-is-embedding X-ts Y-ts = lc-maps-into-sets-are-embeddings j (π-injecting-map-with-totally-separated-domain-is-lc X-ts) (totally-separated-types-are-sets fe' Y Y-ts) \end{code} We now need to assume that propositional truncations exist, to be able to construct the totally separated reflection of a type. \begin{code} module _ (pt : propositional-truncations-exist) where open PropositionalTruncation pt open totally-separated-reflection fe pt \end{code} The unit of the totally separated reflection is π-injecting. \begin{code} Ξ·α΅-is-π-injecting : {X : π€ Μ } β is-π-injecting (Ξ·α΅ {π€} {X}) Ξ·α΅-is-π-injecting {π€} {X} f = extα΅ π-is-totally-separated f , ext-Ξ·α΅ π-is-totally-separated f \end{code} The reflection of any π-injecting map is again π-injecting, and also always an embedding. \begin{code} module _ {X : π€ Μ } {Y : π₯ Μ } (j : X β Y) (ji : is-π-injecting j) where π-is-π-injecting : is-π-injecting (π-functor j) π-is-π-injecting q = q' , q'-extends-q where p : X β π p = q β Ξ·α΅ p' : Y β π p' = extension j ji p p'-extends-p : p' β j βΌ p p'-extends-p = extension-extends j ji p q' : π Y β π q' = extα΅ π-is-totally-separated p' q'-extends-q : q' β π-functor j βΌ q q'-extends-q = Ξ·α΅-induction (Ξ» t β q' (π-functor j t) οΌ q t) (Ξ» t β π-is-set) (Ξ» x β q' (π-functor j (Ξ·α΅ x)) οΌβ¨ refl β© extα΅ _ p' (extα΅ _ (Ξ·α΅ β j) (Ξ·α΅ x)) οΌβ¨ I x β© extα΅ _ p' (Ξ·α΅ (j x)) οΌβ¨ II x β© p' (j x) οΌβ¨ p'-extends-p x β© p x οΌβ¨ refl β© q (Ξ·α΅ x) β) where I = Ξ» x β ap (extα΅ _ p') (ext-Ξ·α΅ _ (Ξ·α΅ β j) x) II = Ξ» x β ext-Ξ·α΅ _ p' (j x) π-is-embedding : is-embedding (π-functor j) π-is-embedding = π-injecting-map-of-totally-separated-types-is-embedding (π-functor j) π-is-π-injecting π-is-totally-separated π-is-totally-separated \end{code} TODO. The above proof probably doesn't need induction. The reflection laws should suffice. The formulation of the following doesn't use propositional truncations, but its construction does, indirectly. The following are equivalent for any type D. 1. D is injective over π-injecting maps. 2. D is totally separated and injective over π-injecting embeddings of totally separated types. \begin{code} is-injective-over-π-injecting-embeddings-of-ts-types : π£ Μ β (π€ π₯ : Universe) β (π€ β π₯)βΊ β π£ Μ is-injective-over-π-injecting-embeddings-of-ts-types D π€ π₯ = {X : π€ Μ } {Y : π₯ Μ } (j : X β Y) β is-π-injecting j β is-embedding j β is-totally-separated X β is-totally-separated Y β D is-injective-over j characterization-of-π-injectivity : (D : π€ Μ ) β π-injective D π€ π€ β (is-totally-separated D Γ is-injective-over-π-injecting-embeddings-of-ts-types D π€ π€) characterization-of-π-injectivity {π€} D = (Ξ» D-π-inj β π-injectives-are-totally-separated D-π-inj , (Ξ» j ji _ _ _ β D-π-inj j ji)) , I where I : is-totally-separated D Γ is-injective-over-π-injecting-embeddings-of-ts-types D π€ π€ β π-injective D π€ π€ I (D-ts , D-inj) {X} {Y} j ji f = f' , f'-extends-f where g : π X β D g = extα΅ D-ts f II : D is-injective-over (π-functor j) II = D-inj (π-functor j) (π-is-π-injecting j ji) (π-is-embedding j ji) π-is-totally-separated π-is-totally-separated g' : π Y β D g' = extension (π-functor j) II g g'-extends-g : g' β π-functor j βΌ g g'-extends-g = extension-extends (π-functor j) II g f' : Y β D f' = g' β Ξ·α΅ f'-extends-f : f' β j βΌ f f'-extends-f x = f' (j x) οΌβ¨ refl β© g' (Ξ·α΅ (j x)) οΌβ¨ ap g' ((π-natural j x)β»ΒΉ) β© g' (π-functor j (Ξ·α΅ x)) οΌβ¨ g'-extends-g (Ξ·α΅ x) β© g (Ξ·α΅ x) οΌβ¨ refl β© extα΅ D-ts f (Ξ·α΅ x) οΌβ¨ ext-Ξ·α΅ D-ts f x β© f x β \end{code} TODO. (1) Can we generalize the universes in `π-injectives-are-totally-separated` and (hence much of) the above? (2) Can we show that every totally separated type is π-injective? I can't even show, at the time of writing, that β, a totally separated type, is π-injective. (3) Can we show that the totally separated types are precisely the algebras of the π-based double dualization monad? (4) Now let's go back to (algebraic) injectivity with respect to all embeddings. Say that a map j : X β Y is injecting if all algebraically injective types with respect to embeddings are injective with respect to j. Question. Can we show that j is necessarily an embedding? Perhaps an embedding is precisely the same thing as an Ξ©-injecting map. We now show that if all functions πα΄Ί β π are uniformly continuous, then β is π-injective. \begin{code} open import MLTT.Two-Properties open import Naturals.Order open import Naturals.Properties open import Notation.Order open import TypeTopology.Cantor open notions-of-continuity π π-is-discrete β-is-π-injective-if-all-functions-πα΄Ίβπ-are-uc : ((f : πα΄Ί β π) β is-uniformly-continuous f) β π-injective β π€ π₯ β-is-π-injective-if-all-functions-πα΄Ίβπ-are-uc {π€} {π₯} brouwer = β-is-π-injective where I : (n : β) β (succ n) is-a-modulus-of-uc-of (Ξ·α΄· n) I 0 Ξ± Ξ² (e , _ ) = e I (succ n) Ξ± Ξ² (_ , es) = I n (tail Ξ±) (tail Ξ²) es II : (n k : β) β k is-a-modulus-of-uc-of (Ξ·α΄· n) β Β¬ (k β€ n) II n k is-mod l = impossible where have-is-mod : (Ξ± Ξ² : πα΄Ί) β Ξ± οΌβ¦ k β§ Ξ² β Ξ± n οΌ Ξ² n have-is-mod = is-mod have-l : k β€ n have-l = l Ξ³ : β β πα΄Ί Ξ³ 0 = π Ξ³ (succ k) = cons β (Ξ³ k) Ξ³-propertyβ : (n k : β) β k β€ n β π οΌβ¦ k β§ (Ξ³ k) Ξ³-propertyβ n 0 l = β Ξ³-propertyβ n (succ k) l = refl , Ξ³-propertyβ n k (β€-trans k (succ k) n (β€-succ k) l) Ξ³-propertyβ : (n k : β) β k β€ n β β β Ξ³ k n Ξ³-propertyβ n 0 l e = zero-is-not-one e Ξ³-propertyβ (succ n) (succ k) l e = Ξ³-propertyβ n k l e impossible : π impossible = Ξ³-propertyβ n k l (is-mod π (Ξ³ k) (Ξ³-propertyβ n k l)) III : (n k : β) β k is-a-modulus-of-uc-of (Ξ·α΄· n) β succ n β€ k III n k is-mod = not-less-bigger-or-equal (succ n) k (II n k is-mod) UC : π€β Μ UC = Ξ£ f κ (πα΄Ί β π) , is-uniformly-continuous f s : β β UC s n = Ξ·α΄· n , succ n , I n , III n r : UC β β r (_ , m , _) = pred m rs : r β s βΌ id rs n = refl β-retract-of-UC : retract β of UC β-retract-of-UC = r , s , rs IV : UC β (πα΄Ί β π) IV = prβ , prβ-is-equiv (πα΄Ί β π) is-uniformly-continuous (Ξ» f β pointed-props-are-singletons (brouwer f) (being-uniformly-continuous-is-prop fe' f)) β-retract-of-πα΄Ίβπ : retract β of (πα΄Ί β π) β-retract-of-πα΄Ίβπ = retracts-compose (β-gives-β IV) β-retract-of-UC β-is-π-injective : π-injective β π€ π₯ β-is-π-injective = retract-of-π-injective β (πα΄Ί β π) K-is-π-injective β-retract-of-πα΄Ίβπ \end{code} Originally I tried to prove that UC is π-injective, to avoid the Brouwerian assumption, but I didn't succeed, and I doubt this can be done. TODO. In the topological topos, we in fact have that β β (πα΄Ί β π), and, indeed, this can be proved from our Brouwerian assumption. Question. Can β be proved to be π-injective unconditionally? Or does the π-injectivity of β give a cotaboo such as the above Brouwerian assumption? Notice also that a map X β β can be seen as a partition of X by countably many clopens. Hence asking β to be π-injective amounts to saying that from the ability to extend clopens along j : X β Y, we should be able to extend countable clopen partitions to countable clopen partitions along j.