Construction DSL and accessors for syntactic objects #
[MCB25] §1.1. The computable construction layer and the
read-back accessors for the SO carrier, completing P2's API parity with the legacy
FreeCommMagma (LIToken ⊕ Nat) surface. Imports only the carrier skeleton.
Construction discipline #
The Merge operator (SO.node/SO.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:
SO.ofPlanar (SO.nodeP (SO.leafP tok₁) (SO.leafP tok₂)). SO.node_mk (skeleton)
relates such a build to SO.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 — SO.isTrace is just
· = SO.traceLeaf.
Computable planar construction DSL #
Planar builder: a lexical leaf.
Equations
- Minimalist.SO.leafP tok = RoseTree.node (Sum.inl tok) []
Instances For
Planar builder: the bare trace leaf.
Equations
- Minimalist.SO.traceP = RoseTree.node (Sum.inr ()) []
Instances For
Planar builder: a bare binary node.
Equations
- Minimalist.SO.nodeP l r = RoseTree.node (Sum.inr ()) [l, r]
Instances For
Build a syntactic object from a planar tree, discharging well-formedness by
decide (concrete trees) — the computable entry point for decide-based studies.
Equations
- Minimalist.SO.ofPlanar p h = ⟨RootedTree.Nonplanar.mk p, h⟩
Instances For
Default syntactic object: the bare trace leaf. Lets structures with an SO
field be Inhabited/deriving Repr-free of bespoke witnesses.
Equations
- Minimalist.instInhabitedSO = { default := Minimalist.SO.traceLeaf }
Merge as multiplication #
* is (External) Merge: the bare binary node. Noncomputable — build concrete
trees with the planar DSL above, not *.
Equations
- Minimalist.instMulSO = { mul := Minimalist.SO.node }
The canonical Merge operators (carrier primitives) #
SO.merge / SO.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 (SO.merge_toForest / SO.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 SO.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.
Instances For
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 SO.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.
Instances For
A lexical leaf from a category and selectional stack.
Equations
- Minimalist.SO.mkLeaf cat sel id = Minimalist.SO.lexLeaf { item := Minimalist.LexicalItem.simple cat sel, id := id }
Instances For
A lexical leaf with a phonological form.
Equations
- Minimalist.SO.mkLeafPhon cat sel phon id = Minimalist.SO.lexLeaf { item := Minimalist.LexicalItem.simple cat sel phon, id := id }
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
- s.isTrace = (s = Minimalist.SO.traceLeaf)
Instances For
Leaf count (number of leaves + traces).
Instances For
Is s a leaf (lexical or trace)? A leaf has a single vertex; a bare binary node
has ≥ 2 leaves.
Instances For
A lightweight Repr so structures with an SO field can deriving Repr. The full
tree is a Nonplanar quotient (no faithful structural readout without Quot.out);
for debugging surface order use SO.linearize.
Equations
- One or more equations did not get rendered due to their size.
Internal-node count = leaf count − 1 (full binary tree).