From 9abd703efd92904a20ea16da34b88fb06f807e79 Mon Sep 17 00:00:00 2001
From: Filip Stedronsky <p@regnarg.cz>
Date: Wed, 8 Sep 2021 08:05:57 +0200
Subject: [PATCH] Succinct: tree shapes + picture

---
 fs-succinct/Makefile        |  3 ++-
 fs-succinct/succinct.tex    | 15 ++++++++++++++-
 fs-succinct/tree_shapes.asy | 18 ++++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 fs-succinct/tree_shapes.asy

diff --git a/fs-succinct/Makefile b/fs-succinct/Makefile
index cbece95..12eb933 100644
--- a/fs-succinct/Makefile
+++ b/fs-succinct/Makefile
@@ -1,5 +1,5 @@
 TOP=..
-PICS=sole sole_boxes sole_hilevel mixer composition mixer_chain mixer_tree
+PICS=sole sole_boxes sole_hilevel mixer composition mixer_chain mixer_tree tree_shapes
 
 
 include ../Makerules
@@ -9,3 +9,4 @@ sole_boxes.pdf:: succinct_common.asy
 sole_hilevel.pdf:: succinct_common.asy
 mixer_chain.pdf:: succinct_common.asy
 mixer_tree.pdf:: succinct_common.asy
+tree_shapes.pdf:: succinct_common.asy
diff --git a/fs-succinct/succinct.tex b/fs-succinct/succinct.tex
index 58bcc52..1b566a8 100644
--- a/fs-succinct/succinct.tex
+++ b/fs-succinct/succinct.tex
@@ -398,7 +398,7 @@ parent (thus most vertices receive two carry inputs but it is trivial to
 combine them into one). This is depicted in fig. \figref{mixer_tree}. Now we
 need $Y\cdot Z \cdot C \le 2^M$.
 
-\figure[mixer_tree]{mixer_tree.pdf}{}{Mixer tree for string encoding}
+\figure[mixer_tree]{mixer_tree.pdf}{}{A single mixer vertex and the organization of those into a tree}
 
 Then you can create a linear order on the vertices (e.g. by layers
 bottom-to-top), split the input string into blocks and feed the blocks through
@@ -409,8 +409,21 @@ Note that this scheme still has all the nice properties, for example it is local
 decodable. To decode a vertex's input, you only need the output of that vertex and
 its parent.
 
+But how does a tree help us determine individual mixer parameters more easily?
+The parameters of a mixer in a vertex are uniquely determined by the shape of the
+subtree under that vertex. This is easily seen by induction: all leaves have the
+same parameters (as they have dummy carry-in alphabets of size 1) and the parameters
+of any vertex are determined by the parameters of its children.
+
 We will use the same tree shape as for binary heaps: all the levels are full, except
 for possibly the last and in the last level all the vertices in one contiguous segement
 starting at the very left.
 
+Now let us consider a level at height $h$ (from the bottom). There are at most three
+subtree types at that level: full subtrees of height $h$, full subtrees of height $h-1$
+and one irregular subtree in the middle (unless the whole tree is full; then there would
+be only one kind of subtree). See fig. \figref{tree_shapes}.
+
+\figure[tree_shapes]{tree_shapes.pdf}{}{Tree and subtree shapes}
+
 \endchapter
diff --git a/fs-succinct/tree_shapes.asy b/fs-succinct/tree_shapes.asy
new file mode 100644
index 0000000..d53ba17
--- /dev/null
+++ b/fs-succinct/tree_shapes.asy
@@ -0,0 +1,18 @@
+import succinct_common;
+
+
+draw((-3,-2) -- (3,-2), 0.3*white);
+draw((-3.2,-4)--(-3.2,-2), Arrows);
+label((-3.2, -3), "$h$", W);
+draw((3.2,-3.5)--(3.2,-2), Arrows);
+label((3.2, -2.75), "$h-1$", E);
+
+void subtree(path p) {
+    filldraw(p, 0.5*white);
+}
+
+subtree((-1.75, -4)--(-0.75,-4)--(-1.25,-2)--cycle);
+subtree((-0.5, -4)--(0,-4)--(0,-3.5)--(0.5,-3.5)--(0,-2)--cycle);
+subtree((1.75, -3.5)--(0.75,-3.5)--(1.25,-2)--cycle);
+
+draw((-3, -4) -- (0,-4) -- (0,-3.5) -- (3,-3.5) -- (0, 0) -- cycle, halfthick);
-- 
GitLab