Skip to content

Instantly share code, notes, and snippets.

@ncfavier
Last active October 19, 2026 08:45
Show Gist options
  • Select an option

  • Save ncfavier/eee79f3554c310ebc2eb2ed8e57d6ed4 to your computer and use it in GitHub Desktop.

Select an option

Save ncfavier/eee79f3554c310ebc2eb2ed8e57d6ed4 to your computer and use it in GitHub Desktop.
Erased quotients imply erased function extensionality (for functions into sets)
{-# OPTIONS --safe --cubical-compatible --erasure --erased-quotients --no-import-sorts #-}
open import Agda.Primitive renaming (Set to Type)
open import Agda.Builtin.Equality
open import Agda.Builtin.Erased.Quotient
cong : ∀ {ℓa ℓb} {A : Type ℓa} {B : Type ℓb} {x y} (f : A → B) → x ≡ y → f x ≡ f y
cong f refl = refl
_∙_ : ∀ {ℓ} {A : Type ℓ} {x y z : A} → x ≡ y → y ≡ z → x ≡ z
refl ∙ p = p
subst-const
: ∀ {ℓa ℓb} {A : Type ℓa} {B : Type ℓb} {b : B} {x y : A} {p : x ≡ y}
→ subst (λ _ → B) p b ≡ b
subst-const {p = refl} = refl
module _
{ℓa ℓb}
(A : Type ℓa)
(B : A → Type ℓb)
(B-set : ∀ a → Is-set (B a))
where
Q : Type _
Q = ((a : A) → B a) / λ f g → ∀ x → f x ≡ g x
_$_ : Q → (a : A) → B a
q $ a = qrec
(λ _ → B a)
(λ f → f a)
(λ h → subst-const ∙ h a)
(λ _ → B-set a)
q
@0 funext : ∀ {f g} → (∀ x → f x ≡ g x) → f ≡ g
funext h = cong _$_ (resp h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment