Subterm enumeration and containment for syntactic objects #
[MCB25] §1.1–1.2. The containment / subterm theory of the
SO carrier, mirroring the legacy Basic.lean theory on
FreeCommMagma (LIToken ⊕ Nat). Imports only the carrier skeleton (no Merge algebra).
Contents #
SO.immediatelyContains— membership in the root children (viaNonplanar.rootChildren).SO.subtrees/SO.Acc— subterm enumeration (incl. root) and MCB's accessible termsAcc(T)(Def 1.2.2, root excluded).SO.contains/isTermOf/containsOrEq— dominance and its reflexive/term-of variants.- subtree ↔ containment bridges, and tree-relative c-command (
cCommandsIn).
Immediate containment (via Nonplanar.rootChildren) #
x immediately contains y: y is one of x's root daughters
([MCB25] §1.1; Definition 13 of the legacy theory).
Equations
- x.immediatelyContains y = (↑y ∈ (↑x).rootChildren)
Instances For
Subterm enumeration #
Nonplanar.rootChildren is single-level, so deep enumeration is built fresh at the
planar level and lifted. The result is a multiset of nonplanar subtrees; its
PermEquiv-invariance lets it descend to the quotient.
All subtrees of a planar tree (incl. the root), as nonplanar trees.
Equations
- Minimalist.subtreesNPlanar (RoseTree.node a cs) = RootedTree.Nonplanar.mk (RoseTree.node a cs) ::ₘ Minimalist.subtreesNPlanarList cs
Instances For
Auxiliary: union of subtree-multisets across a child list.
Equations
Instances For
subtreesNPlanar is PermEquiv-invariant, so it descends to Nonplanar.
All subtrees of a nonplanar tree (incl. the root).
Instances For
subtreesN on a bare binary node: the node plus the subtrees of each child.
Membership in subtreesN of a leaf.
Membership in subtreesN of a bare binary node.
Every nonplanar tree is among its own subtrees.
Subtrees of a syntactic object are themselves syntactic objects.
All subtrees of a syntactic object (incl. the root), as syntactic objects
([MCB25] §1.2; the legacy SyntacticObject.subtrees).
Equations
- s.subtrees = Multiset.pmap (fun (m : RootedTree.Nonplanar Minimalist.SOLabel) (h : Minimalist.IsSO m) => ⟨m, h⟩) (Minimalist.subtreesN ↑s) ⋯
Instances For
The root is among its own subtrees.
Cardinality (MCB's vertex/accessible-term counts, Def 1.2.2 eq. 1.2.5) #
subtreesN has one element per vertex: its cardinality is the node count.
Auxiliary list version.
Accessible terms Acc(T) (Def 1.2.2) #
MCB counting identity (eq. 1.2.5, one-component case): #Acc(T) = #V(T) − 1.
Containment / dominance #
Weight of a bare binary node is one more than the sum of its daughters'.
Containment (dominance) is the transitive closure of immediate containment
([MCB25] §1.1; the legacy contains).
- imm (x y : SO) : x.immediatelyContains y → x.contains y
- trans (x y z : SO) : x.immediatelyContains z → z.contains y → x.contains y
Instances For
Immediate containment strictly decreases weight.
Subtree ↔ containment bridge #
A subtree of x is either x itself or properly contained in x.
Equations
- Minimalist.instDecidableContains x y = decidable_of_iff (y ∈ x.subtrees ∧ y ≠ x) ⋯
Term-of and reflexive containment #
Equations
Equations
x and y are sisters in root: distinct co-daughters of some subtree.
Equations
- root.areSistersIn x y = ∃ z ∈ root.subtrees, z.immediatelyContains x ∧ z.immediatelyContains y ∧ x ≠ y
Instances For
Equations
- Minimalist.instDecidableAreSistersIn root x y = Multiset.decidableExistsMultiset
x c-commands y in root: x has a sister (in root) that
contains-or-equals y.
Equations
- root.cCommandsIn x y = ∃ z ∈ root.subtrees, root.areSistersIn x z ∧ z.containsOrEq y
Instances For
Equations
- Minimalist.instDecidableCCommandsIn root x y = Multiset.decidableExistsMultiset
x asymmetrically c-commands y in root.
Equations
- root.asymCCommandsIn x y = (root.cCommandsIn x y ∧ ¬root.cCommandsIn y x)
Instances For
Equations
decide demonstrations #
The containment / c-command decision procedures reduce on concrete trees built
via Nonplanar.mk ∘ RoseTree.node (not the noncomputable SO.node), confirming the
"state result trees directly" discipline carries through to the relational layer.