Trace-aware size counting on Nonplanar (α ⊕ β) #
The MCB size measures specialized to the contraction-quotient carrier
Nonplanar (α ⊕ β), where Sum.inl vertices carry original lexical
decorations and Sum.inr vertices are trace-marker placeholders left by
the Δ^c coproduct (a trace leaf is node (Sum.inr b) [], the encoding of
Coproduct.Trace.traceLeaf). A trace leaf is a vertex but not an
accessible term: it is excluded from Acc, so the trace-aware counts
subtract it off the generic carrier measures.
The key consequence is the failure of the clean trace-free identity
σ = #V: for a contraction quotient σᶜ ≠ #V (MCB p. 66 caveat), because
a trace leaf inflates #V without contributing an accessible term.
Main definitions #
Nonplanar.traceLeafCount— number ofSum.inr-labeled leaves.Nonplanar.accCountC— trace-excluding accessible-term countα − #traceLeaves.Nonplanar.leafCountSO0— complexity grading#Lon lexical leaves only.Forest.alphaC/Forest.sigmaC— the trace-aware workspace measures.
traceLeafCount — counting trace-marker leaves #
A trace marker is a Sum.inr-labeled vertex (always a leaf in practice).
A fold over RoseTree (α ⊕ β): at a node, sum the children's counts, adding
1 only for a bare Sum.inr-leaf.
The number of Sum.inr-labeled leaves (trace markers) in a tree.
Equations
- RoseTree.traceLeafCount = RoseTree.fold fun (v : α ⊕ β) (ns : List ℕ) => match v, ns with | Sum.inr val, [] => 1 | x, ns => ns.sum
Instances For
On a non-leaf node, traceLeafCount is the sum of the children's counts,
regardless of the root label's Sum-side. Clears the empty/nonempty split.
On a Sum.inl root the count is just the children's total (the lexical
root is never itself a trace leaf), for any child list.
Trace-leaf-count invariance under PermEquiv #
traceDepthSum — depth-weighted trace-marker count (Minimal Search depth) #
The Minimal Search depth d_v of MCB §1.5.2 (book p. 59): the sum over
trace-marker leaves of their distance from the root. Descending into the
children adds 1 per trace leaf below them (+ (cs.map traceLeafCount).sum),
so a trace leaf at depth d is counted d times, contributing d. A bare
trace leaf at the root contributes 0.
The recurrence couples to traceLeafCount at each level, so a single fold
does not express it; it is structural recursion with a child-list companion.
For a Δ^c cut, the quotient (trunk) places a trace leaf at each cut site at
exactly the cut depth (Coproduct.Trace.traceLeaf), so
traceDepthSum(quotient) reads off the total extraction depth Σ d_{v_i}
of MCB rule 1 directly — no enumeration tagging required.
Sum of root-distances of the Sum.inr-labeled (trace-marker) leaves.
Equations
- (RoseTree.node value cs).traceDepthSum = RoseTree.traceDepthSumList cs + (List.map RoseTree.traceLeafCount cs).sum
Instances For
Auxiliary: trace-depth across a list of children, measured in the
children's own frame (the parent adds the +1-per-level offset).
Equations
- RoseTree.traceDepthSumList [] = 0
- RoseTree.traceDepthSumList (t :: ts) = t.traceDepthSum + RoseTree.traceDepthSumList ts
Instances For
The per-child contribution traceDepthSum c + traceLeafCount c summed:
combines the two child statistics into one map.
Trace-depth invariance under PermEquiv #
The children's trace leaves are bounded by the node's: a Sum.inr root
can only add a trace leaf (the empty-trace-leaf case), never remove one.
A lexical root puts every trace marker at depth ≥ 1: for a
Sum.inl-rooted tree, the depth-weighted trace count dominates the plain
trace count. Underlies the Minimal-Search positivity Cut.depthC_pos.
The number of Sum.inr-labeled (trace-marker) leaves of a nonplanar
tree, lifted from RoseTree.traceLeafCount.
Instances For
The Minimal Search depth d_v of MCB §1.5: the sum of root-distances
of the trace-marker leaves, lifted from RoseTree.traceDepthSum. For a Δ^c
cut, traceDepthSum of the quotient is the total extraction depth.
Instances For
Trace-depth of a node decomposes over children: each child c
contributes its own trace-depth plus one per trace leaf it carries
(the +1 for the extra level between the node and c).
The trace-excluding accessible-term count αᶜ(T) = α(T) − #traceLeaves(T):
a trace leaf is a vertex but not an accessible term (MCB p. 66). Truncated
subtraction handles the all-trace edge case (e.g. T = traceLeaf b, where
α = 0 and #traceLeaves = 1).
Equations
- t.accCountC = t.accCount - t.traceLeafCount
Instances For
Trace leaves of a lexical-rooted node: the root contributes none, so the count is the children's total.
External Merge adds two accessible terms in the trace-aware count: the two
children's roots become accessible (MCB Lemma 1.6.3, eq. 1.6.5). Needs each
child to have a lexical vertex (traceLeafCount < numNodes), automatic for a
real syntactic object.
The complexity grading #L restricted to lexical leaves:
#L_{SO₀}(T) = #L(T) − #traceLeaves(T). The trace-exclusion follows the
UNVERIFIED-default reading of MCB Remark 1.2.2 (leaves labeled by SO₀);
whether a trace leaf counts in #L is not settled in the book.
Equations
- t.leafCountSO0 = t.numLeaves - t.traceLeafCount
Instances For
Trace-aware workspace (forest) measures #
Trace-excluding accessible terms across a workspace, αᶜ(F) = Σ αᶜ(Tᵢ).
Equations
- RootedTree.Forest.alphaC F = (Multiset.map RootedTree.Nonplanar.accCountC F).sum
Instances For
Trace-aware workspace size σᶜ(F) = b₀(F) + αᶜ(F). Unlike the generic
σ, this is not the vertex count for contraction quotients
(σᶜ ≠ #V, MCB p. 66): a trace leaf is a vertex but not an accessible
term, so it raises #V without raising σᶜ.
Equations
Instances For
The σᶜ ≠ #V caveat, concretely #
A lexical root over a single trace leaf: #V = 2 (root + trace leaf) but the
trace leaf contributes no accessible term, so αᶜ = 0 and σᶜ = 1.