--- title: records date: 2024-06-02 tags: ['quox (language)'] ... n-ary products to replace pairs _and_ boxes, since the nested `case` expressions for nested pairs are actually really annoying. # syntax $$ \newcommand\CEQ{\operatorname{::=}} \begin{aligned} A, B, s, t &\CEQ \dotsb \mid ꞌ[Ξ”] \mid [𝔇] & \text{terms} \\ e, f &\operatorname{::=} \dotsb \mid e\mathordΒ·β„“ & \text{eliminations} \\ 𝔅 &\operatorname{::=} \dotsb \mid [ \overline{β„“=x} ] β‡’ s & \text{case bodies} \\[1em] β„“ &\operatorname{::=} x \mid n & \text{labels ($n ∈ β„•$)} \\[1em] Ξ” &\operatorname{::=} \overline{π· β„“=x : A} & \text{telescopes} \\ 𝔇 &\operatorname{::=} \overline{β„“=s} & \text{list of bindings} \\ Ο• &\operatorname{::=} \overline{x=e} & \text{substitutions} \\ \end{aligned} $$ - this __replaces__ the box syntax. pair syntax __still exists__ but expands to this. this means that $A \times B \times C$ and $A \times (B \times C)$ are no longer equivalent. i guess that's fine but it is a change. - overlined things are comma separated. - in $Ξ”$, $Ο€$ is optional and defaults to $1$ like everywhere else. - the pair syntax $(x_0, \dotsc, x_n) : (x_0 : A_0) \times \dotsb \times A_n$ is now an abbreviation for $ꞌ[0=x_0, \dotsc, n=x_n] : [0=x_0: A_0, \dotsc, n: A_n]$. - instead of $\operatorname{\mathsf{fst}} e$ and $\operatorname{\mathsf{snd}} e$, it's now $e\mathord.0$ and $e\mathord.1$ (and $e\mathord.2$, …). - "`'[0. 0 : A]`" looks bad. i know. - a telescope $Ξ”$ can be used as a context by ignoring the outer labels $β„“$. # typing ## telescope checking :::rulebox $$Ξ“ ⊒ Ξ”$$ ::: $$ \frac{}{Ξ“ ⊒ β€’} \qquad \frac{ Ξ“ ⊒ Ξ” \qquad Ξ“, Ξ” ⊒_0 A ⇐ β˜… }{ Ξ“ ⊒ Ξ”, π·ℓ = x : A } $$ ## binding list checking :::rulebox $$ Ξ“ ⊒ σ·𝔇 ⇐ Ξ” ⊳ Ξ£ $$ ::: $$ \frac{}{Ξ“ ⊒ σ·‒ ⇐ β€’ ⊳ 𝟎} $$ $$ \frac{ Ξ“ ⊒ σ·𝔇 ⇐ Ξ” ⊳ Ξ£_𝔇 \qquad Ξ“ ⊒ βŒŠΟƒΟ€βŒ‹ Β· s ⇐ A[𝔇:Ξ”] ⊳ Ξ£_s }{ Ξ“ ⊒ σ· (𝔇, β„“ = s) ⇐ (Ξ”, π·ℓ = x : A) ⊳ Ξ£_𝔇 + πΣ_s } $$ :::rulebox $$ 𝔇 : Ξ” = Ο• $$ ::: produce a substitution from a binding list and a telescope by distributing the type annotations $$ \begin{aligned} β€’ : β€’ &= β€’ \\ (𝔇, x = s) : (Ξ”, π·ℓ=x : A) &= (𝔇 : Ξ”), (x = s ∷ A) \end{aligned} $$