diff options
author | Chloe Brown <chloe.brown.00@outlook.com> | 2025-05-06 15:35:44 +0100 |
---|---|---|
committer | Chloe Brown <chloe.brown.00@outlook.com> | 2025-05-06 15:35:44 +0100 |
commit | 975ad15faf5286b2be7fff5acd1ed06f883e2100 (patch) | |
tree | c4c2c91b960833f21be4eb345d820db23823e81b /sec/encoding.ltx | |
parent | ec7805f38d79b7f38034f08d37968fa6496db2d0 (diff) |
State we encode sums as tagged unions.
Diffstat (limited to 'sec/encoding.ltx')
-rw-r--r-- | sec/encoding.ltx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sec/encoding.ltx b/sec/encoding.ltx index 5dbe00f..c7506db 100644 --- a/sec/encoding.ltx +++ b/sec/encoding.ltx @@ -361,9 +361,14 @@ let compose (depth, heap) = \subsection{Phase 4: Encoding Sums}% \label{subsec:sums} +In this phase we remove sums from the language by encoding them as +tagged C-style unions, following the work of \textcite{oleg}. We +encode the type \(\sum_i A_i\) by the pair \(\nat \times \bigsqcup_i A_i\), of +a tag indicating which case we are in, and a union which can contain +a value from any case. + \TODO{ \begin{itemize} - \item state that we encode sums as tagged C-style unions \item explain the operations and equations of unions \item justify why sums are tagged unions \item justify adding union types |