inductive types (W) #20
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rhi/quox#20
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?
btw here's ionchy's notes on w: https://ionathan.ch/2022/04/03/notes-on-w-types
inlining #24 ("the function part of a w value probably needs to be ω") here to reduce clutter
a binary tree is something like (in hypothetical future quox with implicits and
λcase
)but that's no good! we want
node: 1.(l r : Tree A) → Tree A
! the structure uses each subterm once, and the eliminator visits each once!!!i have no idea what to do about this though.
𝕎to inductive types (W)it's like. the normal case rules are
$$
\frac{
\begin{gathered}
Ψ \mid Γ ⊢ σ · e ⇒ A \rhd Θ' \qquad
Ψ \mid Γ, x:A ⊢₀ C ⇐ ★ \
\overline{Ψ \mid Γ ⊢ σ · s_i ⇐ C[(a_i∷A)/x] \rhd Θ_i}^i \qquad
\textcolor{red}{Θ := {\textstyle \sup_i Θ_i}}
\end{gathered}
}{
Ψ \mid Γ ⊢ σ ·
\mathsf{case}π ; e ; \mathsf{return} ; x ⇒ C ;
\mathsf{of} ; { \overline{a_i ⇒ s_i}^i } ⇒ C[e/x] \rhd Θ'+Θ
}
but in the function in a W node it's
$$
\frac{
\begin{gathered}
Ψ \mid Γ ⊢ σ · e ⇒ A \rhd Θ' \qquad
Ψ \mid Γ, x:A ⊢₀ C ⇐ ★ \
\overline{Ψ \mid Γ ⊢ σ · s_i ⇐ C[(a_i∷A)/x] \rhd Θ_i}^i \qquad
\textcolor{red}{Θ := {\textstyle \sum_i Θ_i}}
\end{gathered}
}{
Ψ \mid Γ ⊢ σ ·
\mathsf{case}π ; e ; \mathsf{return} ; x ⇒ C ;
\mathsf{of} ; { \overline{a_i ⇒ s_i}^i } ⇒ C[e/x] \rhd Θ'+Θ
}
but also, presumably, only in certain top-level-ish positions???
maybe this can be a quantity that is treated specially on the head of a
case
expression