Documentation

Linglib.Syntax.Minimalist.SyntacticObject.Subterm

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 #

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
    @[simp]
    theorem Minimalist.SO.immediatelyContains_node (l r y : SO) :
    (l.node r).immediatelyContains y y = l y = r

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

        Equations
        Instances For

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

          @[simp]
          theorem Minimalist.mem_subtreesN_node {m a b : RootedTree.Nonplanar SOLabel} :
          m subtreesN (RootedTree.Nonplanar.node (Sum.inr ()) {a, b}) m = RootedTree.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.

          SO.subtrees / SO.Acc #

          Subtrees of a syntactic object are themselves syntactic objects.

          def Minimalist.SO.subtrees (s : SO) :
          Multiset SO

          All subtrees of a syntactic object (incl. the root), as syntactic objects ([MCB25] §1.2; the legacy SyntacticObject.subtrees).

          Equations
          Instances For
            @[simp]
            theorem Minimalist.SO.mem_subtrees {x s : SO} :
            x s.subtrees x subtreesN s

            The root is among its own subtrees.

            @[simp]
            theorem Minimalist.SO.mem_subtrees_node {x l r : SO} :
            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.

            theorem Minimalist.SO.subtrees_subset_of_mem {w s : SO} (h : w s.subtrees) :

            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.

            theorem Minimalist.SO.subtrees_card (s : SO) :
            s.subtrees.card = (↑s).numNodes

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

            def Minimalist.SO.Acc (s : SO) :
            Multiset SO

            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
              theorem Minimalist.SO.Acc_card (s : SO) :
              s.Acc.card = (↑s).numNodes - 1

              MCB counting identity (eq. 1.2.5, one-component case): #Acc(T) = #V(T) − 1.

              @[simp]
              theorem Minimalist.SO.Acc_lexLeaf (tok : LIToken) :
              (lexLeaf tok).Acc = 0

              Containment / dominance #

              Weight of a bare binary node is one more than the sum of its daughters'.

              inductive Minimalist.SO.contains :
              SOSOProp

              Containment (dominance) is the transitive closure of immediate containment ([MCB25] §1.1; the legacy contains).

              Instances For
                theorem Minimalist.SO.contains_trans {x y z : SO} (hxy : x.contains y) (hyz : y.contains z) :

                Immediate containment strictly decreases weight.

                theorem Minimalist.SO.contains_lt_weight {x y : SO} (h : x.contains y) :
                (↑y).numNodes < (↑x).numNodes

                Containment strictly decreases weight; hence it is irreflexive.

                Subtree ↔ containment bridge #

                theorem Minimalist.SO.mem_subtrees_iff_eq_or_contains {x y : SO} :
                y x.subtrees y = x x.contains y

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

                theorem Minimalist.SO.contains_iff_mem_subtrees_and_ne {x y : SO} :
                x.contains y y x.subtrees y 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.

                @[implicit_reducible]
                instance Minimalist.instDecidableContains (x y : SO) :
                Decidable (x.contains y)
                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
                    theorem Minimalist.SO.containsOrEq_trans {x y z : SO} (hxy : x.containsOrEq y) (hyz : y.containsOrEq z) :

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

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

                    Equations
                    Instances For
                      @[implicit_reducible]
                      instance Minimalist.instDecidableAreSistersIn (root x y : SO) :
                      Decidable (root.areSistersIn x y)
                      Equations

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

                      Equations
                      Instances For
                        @[implicit_reducible]
                        instance Minimalist.instDecidableCCommandsIn (root x y : SO) :
                        Decidable (root.cCommandsIn x y)
                        Equations

                        x asymmetrically c-commands y in root.

                        Equations
                        Instances For
                          @[implicit_reducible]
                          instance Minimalist.instDecidableAsymCCommandsIn (root x y : SO) :
                          Decidable (root.asymCCommandsIn x y)
                          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.