diff options
author | Chloe Brown <chloe.brown.00@outlook.com> | 2025-04-30 15:05:03 +0100 |
---|---|---|
committer | Chloe Brown <chloe.brown.00@outlook.com> | 2025-04-30 15:05:03 +0100 |
commit | 618f806c07e56ca9dd381e3842b84a1eaacba45c (patch) | |
tree | 565fb1e04067da5b0b5da92c59df649bb8f12b90 /sec/encoding.ltx | |
parent | 4677bd1af681e992b560b1061837c50f826c8bf7 (diff) |
Justify adding the `match` operator.
Diffstat (limited to 'sec/encoding.ltx')
-rw-r--r-- | sec/encoding.ltx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sec/encoding.ltx b/sec/encoding.ltx index 6e3f362..34f3ae0 100644 --- a/sec/encoding.ltx +++ b/sec/encoding.ltx @@ -194,11 +194,13 @@ because all System~T types are inhabited. Regardless, one could prove that our encoding never calls \(\mathsf{index}\) with an out-of-bounds index. -\TODO{ - \begin{itemize} - \item justify the head operator - \end{itemize} -} +The final operator we add at this phase is \(\mathsf{match}\) on +lists. We can derive this operation using \(\mathsf{length}\) and +\(\mathsf{index}\). We can use these two operators along with +primitive recursion to define a fold over lists. With a fold, we can +implement pattern matching analagously to \unroll{}. We keep it as an +operator as our encoding of lists in the next phase will make this +more efficient. We now return to our examples. After some beta reduction we recover the following value for \systemtinline{balanced}: |