Documentation

Linglib.Syntax.Minimalist.SyntacticObject.Build

Construction DSL and accessors for syntactic objects #

[MCB25] §1.1. The computable construction layer and the read-back accessors for the SyntacticObject carrier, completing P2's API parity with the legacy FreeCommMagma (LIToken ⊕ Nat) surface. Imports only the carrier skeleton.

Construction discipline #

The Merge operator (SyntacticObject.node/SyntacticObject.merge) is noncomputable (the smart Nonplanar.node round-trips through Quotient.out). So concrete syntactic objects — the ones studies decide over — are built planar-first and quotiented once: SyntacticObject.ofPlanar (SyntacticObject.nodeP (SyntacticObject.leafP tok₁) (SyntacticObject.leafP tok₂)). SyntacticObject.node_mk (skeleton) relates such a build to SyntacticObject.node, so theorems stated over node/* still apply.

Index-free traces #

A trace is a bare Sum.inr () leaf with no index (MCB Def 1.2.1: chain identity is workspace-level), so there is exactly one trace leaf — SyntacticObject.isTrace is just · = SyntacticObject.traceLeaf.

Computable planar construction DSL #

@[reducible, inline]

Planar builder: a lexical leaf.

Equations
Instances For
    @[reducible, inline]

    Planar builder: the bare trace leaf.

    Equations
    Instances For
      @[reducible, inline]

      Planar builder: a bare binary node.

      Equations
      Instances For
        def Minimalist.SyntacticObject.ofPlanar (p : RoseTree SOLabel) (h : isSOPlanar p = true := by first | rfl | decide) :

        Build a syntactic object from a planar tree, discharging well-formedness by decide (concrete trees) — the computable entry point for decide-based studies.

        Equations
        Instances For
          @[instance_reducible]

          Default syntactic object: the bare trace leaf. Lets structures with an SyntacticObject field be Inhabited/deriving Repr-free of bespoke witnesses.

          Equations

          Merge as multiplication #

          @[instance_reducible]

          * is (External) Merge: the bare binary node. Noncomputable — build concrete trees with the planar DSL above, not *.

          Equations

          The canonical Merge operators (carrier primitives) #

          SyntacticObject.merge / SyntacticObject.intMerge are the carrier-level Merge operators ([MCB25] Lemma 1.4.1 / Prop 1.4.2): they need only the bare binary node, so they live here. Their coproduct identity on the workspace Hopf algebra (SyntacticObject.merge_toForest / SyntacticObject.intMerge_toForest) lives in Workspace.lean, which imports the Merge algebra; this file stays algebra-free so decide-based consumers (e.g. the externalization replay in SyntacticObject/Derivation.lean) keep the computable DecidableEq (Nonplanar …) (#792) in scope.

          External Merge on the carrier ([MCB25] Lemma 1.4.1): the bare binary node SyntacticObject.node is External Merge (for distinct workspace items) and the re-merge stage of Internal Merge. Noncomputable; build concrete results with the planar DSL + decide.

          Equations
          Instances For
            @[simp]
            theorem Minimalist.SyntacticObject.merge_val (S S' : SyntacticObject) :
            (S.merge S') = RoseTree.Nonplanar.node (Sum.inr ()) {S, S'}

            Internal Merge on the carrier ([MCB25] Prop 1.4.2): re-Merge the mover with the deletion remainder remainder = T/mover (the M_{T/β, β} order: remainder left, mover right). IM is not a new structural primitive — it is SyntacticObject.merge of the remainder and the mover. The mover ↔ trace correspondence (the chain) is read at the workspace level (Workspace.chainMultiplicity), not from an index.

            Equations
            Instances For
              @[simp]
              theorem Minimalist.SyntacticObject.intMerge_val (mover remainder : SyntacticObject) :
              (mover.intMerge remainder) = RoseTree.Nonplanar.node (Sum.inr ()) {remainder, mover}

              Lexical-leaf construction (the legacy mkLeaf API) #

              A lexical leaf from a category and selectional stack.

              Equations
              Instances For
                def Minimalist.SyntacticObject.mkLeafPhon (cat : Cat) (sel : SelStack) (phon : String) (id : ) :

                A lexical leaf with a phonological form.

                Equations
                Instances For

                  Accessors #

                  The lexical token at the root, if the root is a lexical leaf.

                  Equations
                  • s.getLIToken = match (↑s).rootValue with | Sum.inl tok => some tok | Sum.inr PUnit.unit => none
                  Instances For

                    A trace is the unique bare trace leaf (chain identity is workspace-level).

                    Equations
                    Instances For

                      Leaf count (number of leaves + traces).

                      Equations
                      Instances For

                        Is s a leaf (lexical or trace)? A leaf has a single vertex; a bare binary node has ≥ 2 leaves.

                        Equations
                        Instances For

                          Is s a (bare binary) internal node? The complement of SyntacticObject.isLeaf.

                          Equations
                          Instances For
                            @[instance_reducible]

                            A lightweight Repr so structures with an SyntacticObject field can deriving Repr. The full tree is a Nonplanar quotient (no faithful structural readout without Quot.out); for debugging surface order use SyntacticObject.linearize.

                            Equations
                            • One or more equations did not get rendered due to their size.

                            Internal-node count = leaf count − 1 (full binary tree).

                            Equations
                            Instances For

                              decide demonstrations #