I’m trying to define functions with more than one arguments over quotient types. Using currying, I can reduce the problem to defining functions over the pointwise product setoid:
module Foo where
open import Quotient
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P using (proof-irrelevance)
private
open import Relation.Binary.Product.Pointwise
open import Data.Product
_×-quot_ : ∀ {c ℓ} {S : Setoid c ℓ} → Quotient S → Quotient S → Quotient (S ×-setoid S)
_×-quot_ {S = S} = rec S (λ x → rec S (λ y → [ x , y ])
(λ {y} {y′} y≈y′ → [ refl , y≈y′ ]-cong))
(λ {x} {x′} x≈x′ → extensionality (elim _ _ (λ _ → [ x≈x′ , refl ]-cong)
(λ _ → proof-irrelevance _ _)))
where
open Setoid S
postulate extensionality : P.Extensionality _ _
My question is, is there a way to prove the soundness of ×-quot without postulating extensionality?
You were needing extensionality because the value of
Pparameter forrecyou have chosen was a function type. If you avoid that and use aQuotienttype asPinstead, you can do it:And another way of proving it, going through
_<$>_(which I did first and decided not to throw away):And another version of
_<$>_, now usingjoin:Here it becomes obvious that there is some sort of monad in there. What a nice discovery! 🙂