Bridge from MIP-8 value trees to induced subtrees

induced_subtree.v proves the paper theorem over complete binary trees: nodes are root-to-node paths and a subtree is a predicate on those paths.
commitment.v uses a more compact executable tree. A value_tree contains only occupied pair leaves and binary merge nodes that are actually hashed. Unary stretches of the complete tree are collapsed because they do not produce hashes.
This file connects the two views. Given the original pair-position list used by build_value_tree, compact_value_tree_nodes expands the compact tree back into the complete-tree nodes that lie on paths to occupied pair leaves. The main theorems are stated directly with the paper-level minimal_connected_subtree predicate rather than introducing a second, compact-tree-specific minimality notion.


Occupied pair leaves as a paper bitmap

occupied_leaf_path depth pairs path means that path names an occupied pair leaf in the complete tree whose leaves are represented by pairs. The recursion follows the same bisection as build_value_tree: false selects the left half and true selects the right half.
Fixpoint occupied_leaf_path
    (depth : nat) (pairs : list (option pair_leaf)) (path : node) : Prop :=
  match depth with
  | O
      path = [] value, pairs = [Some value]
  | S depth'
      let width := subtree_width depth' in
      match path with
      | false :: rest
          occupied_leaf_path depth' (firstn width pairs) rest
      | true :: rest
          occupied_leaf_path depth' (skipn width pairs) rest
      | []False
      end
  end.

Definition pair_leaf_bitmap
    (depth : nat) (pairs : list (option pair_leaf)) : node Prop :=
  occupied_leaf_path depth pairs.

Expanding the compact value tree

compact_value_tree_nodes depth pairs tree is the complete-tree node predicate denoted by a compact value_tree built from pairs. Every recursive subtree includes its local root []. If only one child side is occupied, the compact tree has no unary constructor, so the original pairs list is used to decide whether to continue through the left or right branch.
Fixpoint compact_value_tree_nodes
    (depth : nat) (pairs : list (option pair_leaf)) (tree : value_tree)
    (path : node) : Prop :=
  match depth with
  | O
      path = [] value, pairs = [Some value]
  | S depth'
      let width := subtree_width depth' in
      let lhs_pairs := firstn width pairs in
      let rhs_pairs := skipn width pairs in
      match build_value_tree depth' lhs_pairs,
            build_value_tree depth' rhs_pairs,
            tree with
      | Some _, None, _
          path = []
           rest,
            path = false :: rest
            compact_value_tree_nodes depth' lhs_pairs tree rest
      | None, Some _, _
          path = []
           rest,
            path = true :: rest
            compact_value_tree_nodes depth' rhs_pairs tree rest
      | Some _, Some _, TreeNode lhs rhs
          path = []
          ( rest,
            path = false :: rest
            compact_value_tree_nodes depth' lhs_pairs lhs rest)
          ( rest,
            path = true :: rest
            compact_value_tree_nodes depth' rhs_pairs rhs rest)
      | _, _, _False
      end
  end.

Path lemmas

The bridge theorem

The compact tree is therefore not just a valid minimal subtree. Its complete-tree denotation is exactly the unique subtree satisfying the paper-level minimality specification.

This page has been generated by coqdoc