quotient types #10
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rhi/quox#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
idk. i don't see why they'd need univalence, so
qits, maybeto quotient types$$
\begin{aligned}
s, t, p, A, B, C, R &::=
\cdots \mid A⇂R \mid |s| \mid \mathsf{qeq} ; p
& \text{terms} \
\mathfrak{B} &::=
\cdots \mid |x| ⇒ s; : y, y', z ⇒ p
& \text{case bodies}
\end{aligned}
A⇂R
isA : ★
quotiented byR : A → A → ★
|s|
is the projection ofs : A
intoA⇂R
caseπ e return x ⇒ C of { |x| ⇒ s; y, y', z ⇒ p }
appliess
to the contents ofe : A⇂R
, ifp
witnesses that the relation is preservedqeq
lifts a proof of a relation to an equality over the quotient$$
\frac{
\begin{gathered}
Ψ \mid Γ ⊢₀ A ⇐ ★_ℓ \qquad
Ψ \mid Γ ⊢₀ R ⇐ A → A → ★_ℓ
\end{gathered}
}{
Ψ \mid Γ ⊢₀ A⇂R ⇐ ★_ℓ
} \text{[form]}
$$
\frac{
Ψ \mid Γ ⊢ σ \cdot s ⇐ A \rhd Σ
}{
Ψ \mid Γ ⊢ σ \cdot |s| ⇐ A⇂R \rhd Σ
} \text{[intro]}
$$
\frac{
\begin{gathered}
Ψ \mid Γ ⊢₀ s ⇐ A \qquad
Ψ \mid Γ ⊢₀ t ⇐ A \qquad
Ψ \mid Γ ⊢₀ p ⇐ R ; s ; t
\end{gathered}
}{
Ψ \mid Γ ⊢₀ \mathsf{qeq} ; p ⇐ |s| ≡ |t| : A⇂R
} \text{[ax]}
$$
\frac{
\begin{gathered}
Ψ \mid Γ ⊢ σ \cdot e ⇒ A⇂R \rhd Σ_e \qquad
Ψ \mid Γ, x : A⇂R ⊢₀ C ⇐ ★ \
Ψ \mid Γ, x : A ⊢ σ \cdot s ⇐ C[(|x| ∷ A⇂R)/x] \rhd Σ_s, ρ_x \qquad
ρ_x ≼ πσ \
Ψ \mid Γ, y : A, y' : A, z : R ; y ; y' ⊢₀
p ⇐ \mathsf{Eq} ; (i ⇒ C[\mathsf{qeq} ; z ; @i/x]) ; s[y/x] ; s[y'/x]
\end{gathered}
}{
Ψ \mid Γ ⊢ σ \cdot
\mathsf{case}_π ; e ;
\mathsf{return} ; x ⇒ C ; \mathsf{of} ;
{ |x| ⇒ s; : y, y', z ⇒ p }
⇒ C[e/x] \rhd Σ_e + πΣ_s
} \text{[elim]}
$$
\frac{}{
\mathsf{case}_π ; |t| ∷ A ⇂ R ;
\mathsf{return} ; x ⇒ C ; \mathsf{of} ;
{ |x| ⇒ s; : y, y', z ⇒ p } ⇝ s[(t ∷ A)/x]
} [β]