open import 1Lab.HLevel.Retracts open import 1Lab.HLevel.Universe open import 1Lab.Path.Groupoid open import 1Lab.Type.Sigma open import 1Lab.Univalence open import 1Lab.Type.Pi open import 1Lab.HLevel open import 1Lab.Equiv open import 1Lab.Path open import 1Lab.Type module 1Lab.Equiv.Embedding where
Embeddingsπ
One of the most important observations leading to the development of categorical set theory is that injective maps into a set correspond to maps from into a universe of propositions, normally denoted . Classically, this object is , but there are other settings in which this idea makes sense (elementary topoi) where the subobject classifier is not a coproduct .
To develop this correspondence, we note that, if a map is injective and its codomain is a [set], then all the fibres
of are propositions.
injective : (A β B) β Type _ injective f = β {x y} β f x β‘ f y β x β‘ y injective-between-setsβhas-prop-fibres : is-set B β (f : A β B) β injective f β β x β is-prop (fibre f x) injective-between-setsβhas-prop-fibres bset f inj x (f*x , p) (f*xβ² , q) = Ξ£-prop-path (Ξ» x β bset _ _) (inj (p β sym q))
In fact, this condition is not only necessary, it is also sufficient. Thus, we conclude that, for maps between sets, these notions are equivalent, and we could take either as the definition of βsubset inclusion.β
has-prop-fibresβinjective : (f : A β B) β (β x β is-prop (fibre f x)) β injective f has-prop-fibresβinjective _ prop p = ap fst (prop _ (_ , p) (_ , refl)) between-sets-injectiveβhas-prop-fibres : is-set A β is-set B β (f : A β B) β injective f β (β x β is-prop (fibre f x)) between-sets-injectiveβhas-prop-fibres aset bset f = prop-ext (Ξ» p q i x β aset _ _ (p x) (q x) i) (Ξ -is-hlevel 1 Ξ» _ β is-prop-is-prop) (injective-between-setsβhas-prop-fibres bset f) (has-prop-fibresβinjective f)
However, for more general types, like the circle, this fails: A function can have propositional fibres in at most one way, but a function can be injective in more than one. Consider the following two witnesses of injectivity for the identity map of the circle, i.e., two functions .
module _ where private open import 1Lab.HIT.S1 circle-id : SΒΉ β SΒΉ circle-id p = p
The first is the boring option: it just gives back the same path, unchanged. The second is more interesting: By doing circle induction, we can consider the cases separately, and in the case where , we add an extra twist onto the path:
circle-id-injβ circle-id-injβ : injective circle-id circle-id-injβ p = p circle-id-injβ {x} = SΒΉ-elim {P = Ξ» y β x β‘ y β x β‘ y} (_β loop) (funext-dep Ξ» p β to-pathp (subst-path-right _ _ β lemma p)) _ where lemma : β {x} {p1 p2 : x β‘ base} β PathP (Ξ» i β x β‘ loop i) p1 p2 β (p1 β loop) β loop β‘ p2 β loop lemma path = ap (_β loop) (from-pathp path)
These functions are not the same! When given refl, circle-id-injβ will give refl (because itβs boring), but the exciting function will give loop. And that ainβt refl.
circle-id-injββ injβ : circle-id-injβ β‘ circle-id-injβ β β₯ circle-id-injββ injβ p = reflβ loop (happly p refl β β-id-l _)
Since we want βis a subtype inclusionβ to be a property β that is, we really want to not care about how a function is a subtype inclusion, only that it is, we define embeddings as those functions which have propositional fibres:
is-embedding : (A β B) β Type _ is-embedding f = β x β is-prop (fibre f x) _βͺ_ : Type β β Type ββ β Type _ A βͺ B = Ξ£[ f β (A β B) ] is-embedding f
Univalence β specifically, the existence of classifying objects for maps with -fibres β tells us that the embeddings into correspond to the families of propositional types over .
subtype-classifier : β {β} {B : Type β} β (Ξ£[ A β Type β ] (A βͺ B)) β (B β Ξ£[ T β Type β ] (is-prop T)) subtype-classifier {β} = Map-classifier {β = β} is-prop
A canonical source of embedding, then, are the first projections from total spaces of propositional families. This is because, as Fibre-equiv tells us, the fibre of over is equivalent to βthe space of possible second coordinates,β i.e., . Since was assumed to be a prop., then so are the fibres of fst.
Subset-proj-embedding : β {B : A β Type β} β (β x β is-prop (B x)) β is-embedding {A = Ξ£ B} fst Subset-proj-embedding {B = B} Bprop x = is-hlevelβ 1 (Fibre-equiv B x eβ»ΒΉ) (Bprop _)!β
embeddingβmonic : β {β ββ² ββ²β²} {A : Type β} {B : Type ββ²} {f : A β B} β is-embedding f β β {C : Type ββ²β²} (g h : C β A) β f β g β‘ f β h β g β‘ h embeddingβmonic {f = f} emb g h p = funext Ξ» x β ap fst (emb _ (g x , refl) (h x , happly (sym p) x)) monic-between-setsβis-embedding : β {β ββ² ββ²β²} {A : Type β} {B : Type ββ²} {f : A β B} β is-set B β (β {C : Set ββ²β²} (g h : β£ C β£ β A) β f β g β‘ f β h β g β‘ h) β is-embedding f monic-between-setsβis-embedding {f = f} bset monic = injective-between-setsβhas-prop-fibres bset _ Ξ» {x} {y} p β happly (monic {C = Lift _ β€ , Ξ» _ _ _ _ i j β lift tt} (Ξ» _ β x) (Ξ» _ β y) (funext (Ξ» _ β p))) _
β