Documentation

Linglib.Syntax.Minimalist.SyntacticObject.Subterm

Subterm enumeration and containment for syntactic objects #

[MCB25] §1.1–1.2. The containment / subterm theory of the SyntacticObject carrier, mirroring the legacy Basic.lean theory on FreeCommMagma (LIToken ⊕ Nat). Imports only the carrier skeleton (no Merge algebra).

Contents #

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
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 Perm-invariance lets it descend to the quotient.

    All subtrees of a planar tree (incl. the root), as nonplanar trees.

    Equations
    Instances For

      Auxiliary: union of subtree-multisets across a child list.

      Equations
      Instances For

        subtreesNPlanar is Perm-invariant, so it descends to Nonplanar. At a node the root mk-image is fixed by mk_eq_mk_iff and the child-list sum by the PermList companion.

        The child-list subtree sum is PermList-invariant: it is a multiset sum, and the List.Perm-style case split matches heads by the mutual subtreesNPlanar_perm and reorders by add_left_comm.

        All subtrees of a nonplanar tree (incl. the root).

        Equations
        Instances For
          theorem Minimalist.subtreesN_node (a b : RoseTree.Nonplanar SOLabel) :
          subtreesN (RoseTree.Nonplanar.node (Sum.inr ()) {a, b}) = RoseTree.Nonplanar.node (Sum.inr ()) {a, b} ::ₘ (subtreesN a + subtreesN b)

          subtreesN on a bare binary node: the node plus the subtrees of each child.

          @[simp]
          theorem Minimalist.mem_subtreesN_node {m a b : RoseTree.Nonplanar SOLabel} :
          m subtreesN (RoseTree.Nonplanar.node (Sum.inr ()) {a, b}) m = RoseTree.Nonplanar.node (Sum.inr ()) {a, b} m subtreesN a m subtreesN b

          Membership in subtreesN of a bare binary node.

          Every nonplanar tree is among its own subtrees.

          SyntacticObject.subtrees / SyntacticObject.Acc #

          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
          Instances For
            @[simp]

            The root is among its own subtrees.

            @[simp]
            theorem Minimalist.SyntacticObject.mem_subtrees_node {x l r : SyntacticObject} :
            x (l.node r).subtrees x = l.node r x l.subtrees x r.subtrees

            Subtree membership at a bare binary node: the node itself, or a subtree of a daughter.

            subtrees is downward-closed along the subtree relation: every subtree of a subtree of s is a subtree of s.

            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.

            subtrees enumerates the vertices ([MCB25] Def 1.2.2: subtrees = Acc'(T), so its size is #V(T), the MCB workspace-size primitive).

            Accessible terms Acc(T) (Def 1.2.2) #

            MCB's accessible-terms operator Acc(T) ([MCB25] Def 1.2.2, eq. 1.2.2): the subtrees at all non-root vertices (leaves included — the counting identity eq. 1.2.5 #V = b₀ + #Acc forces this). Defined as subtrees − {self} (Acc'(T) = {T} ∪ Acc(T), eq. 1.2.3).

            Equations
            Instances For

              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).

              Instances For

                Immediate containment strictly decreases weight.

                Containment strictly decreases weight; hence it is irreflexive.

                Subtree ↔ containment bridge #

                A subtree of x is either x itself or properly contained in x.

                Containment ↔ proper subtree membership. Gives a decision procedure for contains without well-founded recursion: y is properly contained in x iff it is a subtree distinct from x.

                @[instance_reducible]
                Equations

                Term-of and reflexive containment #

                x is a term of y: x = y or y contains x.

                Equations
                Instances For

                  Reflexive containment.

                  Equations
                  Instances For

                    RoseTree-relative c-command ([Rei76]) #

                    x and y are sisters in root: distinct co-daughters of some subtree.

                    Equations
                    Instances For
                      @[instance_reducible]
                      Equations

                      x c-commands y in root: x has a sister (in root) that contains-or-equals y.

                      Equations
                      Instances For
                        @[instance_reducible]
                        Equations

                        x asymmetrically c-commands y in root.

                        Equations
                        Instances For

                          decide demonstrations #

                          The containment / c-command decision procedures reduce on concrete trees built via Nonplanar.mk ∘ RoseTree.node (not the noncomputable SyntacticObject.node), confirming the "state result trees directly" discipline carries through to the relational layer.