\begin{code}
{-# OPTIONS --without-K #-}
module FirstProjectionInjective where
open import Equality
open import SetsAndFunctions
π₀-mono : {X : Set} → {Y : X → Set} → (∀{x : X} → ∀(y y' : Y x) → y ≡ y')
→ ∀(u v : Σ \(x : X) → Y x) → π₀ u ≡ π₀ v → u ≡ v
π₀-mono {X} {Y} f u v r =
lemma r (π₁ u) (π₁ v) (f (subst {X} {Y} r (π₁ u)) (π₁ v))
where
A : ∀(x x' : X) → x ≡ x' → Set
A x x' r = ∀(y : Y x) → ∀(y' : Y x') → subst r y ≡ y' → (x , y) ≡ (x' , y')
lemma : ∀{x x' : X} → ∀(r : x ≡ x') → A x x' r
lemma = J A (λ x x' y → cong (λ y → (x , y)))
\end{code}