Composition of decision trees #
bind replaces each output leaf by a continuation. substitute replaces each query by a
Boolean-valued decision tree and continues according to its answer. These are executable tree
constructions, with exact evaluation and per-input cost laws. The input variables of different
subroutines may overlap, and repeated queries are charged each time; substitution does not cache
their answers.
The structural cost of substitution is bounded by the outer tree's weighted depth, charging each query the inner tree's structural cost. This is generally sharper than multiplying by the most expensive query. Minimizing over trees gives the usual deterministic composition upper bound. The disjoint-block corollary allows a different finite coordinate type for every block, including empty blocks. No multiplicative lower bound is asserted.
Main definitions #
Cslib.DecisionTree.bind: replace output leaves by continuations.Cslib.DecisionTree.substitute: replace queries by Boolean-valued subroutines.
Main results #
Cslib.DecisionTree.eval_substitute: query substitution computes function composition.Cslib.DecisionTree.weightedCost_substitute: exact input-dependent composition cost.Cslib.DecisionTree.weightedDepth_substitute_le: composition with heterogeneous query costs.Cslib.DecisionTree.complexity_substitute_le: a weighted bound using any outer decision tree.Cslib.DecisionTree.complexity_substitute_le_mul: the uniform shared-input composition bound.Cslib.DecisionTree.complexity_blockCompose_le_mul: the disjoint-block composition bound.
Replace each leaf labelled b by the continuation k b.
Instances For
Replacing each leaf by itself preserves the tree.
Successive leaf substitutions associate.
Evaluate the first tree, then its selected continuation on the same input.
Leaf substitution adds exactly the costs of the two executed computations.
A uniform bound on continuation costs adds to the first tree's structural cost.
A uniform bound on continuation depths adds to the first tree's depth.
Replace a query of i by the Boolean subroutine s i, then follow its answer.
Every occurrence is replaced independently; answers are not memoized.
Instances For
Replacing queries by single-query trees is ordinary query relabelling.
Query substitution distributes over leaf substitution.
Nested query substitutions associate, so subroutines may be compiled in stages.
Query substitution evaluates the outer tree on the answers supplied by the inner trees.
Composing trees that compute the supplied functions computes their function composition.
Exact cost of substitution: charge each outer query the cost of its subroutine on the current input. Overlapping variables and repeated queries are both permitted.
Exact query count after substitution, with the executed inner query counts as weights.
Bound each inner computation by its weighted structural depth and add these bounds along the outer tree. An inner tree's most expensive leaf need not select the most expensive continuation, so this is an inequality.
Substitution depth is bounded by charging each outer query the depth of its subroutine.
Any outer decision tree gives a composition bound weighted by the optimal inner depths. The inner functions may all read the same input variables.
If each inner function has complexity at most d, composition has complexity at most
the outer complexity times d. No disjointness of the inner inputs is required.
A weighted bound for composition on disjoint, possibly differently sized finite blocks.
Uniform-cost composition on disjoint finite blocks; empty blocks and constant functions are included. The construction proves an upper bound only.