summaryrefslogtreecommitdiff
path: root/sec/encoding.ltx
diff options
context:
space:
mode:
authorChloe Brown <chloe.brown.00@outlook.com>2025-05-02 17:56:52 +0100
committerChloe Brown <chloe.brown.00@outlook.com>2025-05-02 17:56:52 +0100
commitec7805f38d79b7f38034f08d37968fa6496db2d0 (patch)
treeafcd9f7364a7942066bfc5d3031fbe6405634d6c /sec/encoding.ltx
parentc08f9eb38654f81f0fc8ae49013896544aaffec2 (diff)
Justify why only `length` and `index`.
Diffstat (limited to 'sec/encoding.ltx')
-rw-r--r--sec/encoding.ltx18
1 files changed, 13 insertions, 5 deletions
diff --git a/sec/encoding.ltx b/sec/encoding.ltx
index 43acd65..5dbe00f 100644
--- a/sec/encoding.ltx
+++ b/sec/encoding.ltx
@@ -308,11 +308,19 @@ non-empty list. We retreive the head by calling the index function
with index zero. The tail is one shorter that the initial list, and
the index function is shifted by one too.
-\TODO{
- \begin{itemize}
- \item explain why a list is a pair of length and index function
- \end{itemize}
-}
+We have shown that \(\mathsf{length}\) and \(\mathsf{index}\) are
+sufficient to produce an eliminator encoding for lists. We cannot add
+\(\mathsf{nil}\), \(\mathsf{cons}\) nor \(\mathsf{snoc}\) to the set
+of eliminators, as these all construct lists. Similarly pattern
+matching ``constructs'' the tail of a non-empty list. The only other
+operator we could possibly add as an eliminator is
+\(\mathsf{max}\). There are two main reasons we have not done
+this. Firstly, \(\mathsf{max}\) is only defined on lists of naturals,
+so we would end up with a non-uniform representation of
+lists. Secondly, the maximum is only computed for a small number of
+lists. In our running examples we compute the maximum only twice,
+whereas we use lists thoughout. Carrying redundant data around for an
+infrequent operation is inefficient and would complicate the encoding.
After phase three, our example for \systemtinline{balanced} beta
reduces to the following: