module 1Lab.Function.Surjection where
Surjections🔗
A function is a surjection if, for each , we have : that is, all of its fibres are inhabited. Using the notation for mere existence, we may write this as
which is evidently the familiar notion of surjection.
: (A → B) → Type _
is-surjective = ∀ b → ∥ fibre f b ∥ is-surjective f
To abbreviate talking about surjections, we will use the notation , pronounced “ covers ”.
_↠_ : Type ℓ → Type ℓ' → Type (ℓ ⊔ ℓ')
= Σ[ f ∈ (A → B) ] is-surjective f A ↠ B
The notion of surjection is intimately connected with that of quotient, and in particular with the elimination principle into propositions. We think of a surjection as expressing that can be “glued together” by introducing paths between the elements of . Since any family of propositions respects these new paths, we can prove a property of by showing it for the “generators” coming from :
is-surjective→elim-prop: (f : A ↠ B)
→ ∀ {ℓ} (P : B → Type ℓ)
→ (∀ x → is-prop (P x))
→ (∀ a → P (f .fst a))
→ ∀ x → P x
(f , surj) P pprop pfa x =
is-surjective→elim-prop (pprop _) (λ (x , p) → subst P p (pfa x)) (surj x) ∥-∥-rec
When the type is a set, we can actually take this analogy all the way to its conclusion: Given any cover , we can produce an equivalence between and the quotient of under the congruence induced by . See surjections are quotient maps.
Closure properties🔗
The class of surjections contains the identity — and thus every equivalence — and is closed under composition.
∘-is-surjective: {f : B → C} {g : A → B}
→ is-surjective f
→ is-surjective g
→ is-surjective (f ∘ g)
{f = f} fs gs x = do
∘-is-surjective (f*x , p) ← fs x
(g*fx , q) ← gs f*x
(g*fx , ap f q ∙ p)
pure
: is-surjective {A = A} id
id-is-surjective = inc (x , refl)
id-is-surjective x
: {f : A → B} → is-equiv f → is-surjective f
is-equiv→is-surjective = inc (eqv .is-eqv x .centre) is-equiv→is-surjective eqv x
Relationship with equivalences🔗
We have defined equivalences to be the maps with contractible fibres; and surjections to be the maps with inhabited fibres. It follows that a surjection is an equivalence precisely if its fibres are also propositions; in other words, if it is an embedding.
embedding-surjective→is-equiv: {f : A → B}
→ is-embedding f
→ is-surjective f
→ is-equiv f
.is-eqv x = ∥-∥-proj! do
embedding-surjective→is-equiv f-emb f-surj
pt ← f-surj x(f-emb x) pt pure $ is-prop∙→is-contr