The universal property of the syntactic-object carrier #
Leaf data valued in a commutative magma with zero extends to a morphism of magmas
out of SyntacticObject (lift, the FreeMagma.lift analogue), and two such
morphisms agreeing on the leaves are equal (hom_ext). The zero absorbs the
off-carrier arities, so one total algebra (mergeAlgebra) drives the fold, the
quotient descent, and the subtype restriction once and for all: consumers supply a
lexical-leaf value and a trace value, and inherit Perm-invariance from
mul_comm via List.Perm.congr_arity₂ — no bespoke step induction.
Main declarations #
Minimalist.SyntacticObject.mergeAlgebra: the node algebra induced by a magma-with-zero — lexical leaf ↦ℓ, trace leaf ↦τ, bare binary node ↦*, other arities ↦0.Minimalist.SyntacticObject.liftN: its evaluation on the nonplanar carrier.Minimalist.SyntacticObject.liftFun,Minimalist.SyntacticObject.lift: the induced map on syntactic objects, unbundled (computable) and as→ₙ*.
Main results #
Minimalist.SyntacticObject.hom_ext: morphisms of magmas out ofSyntacticObjectagreeing on lexical and trace leaves are equal.Minimalist.SyntacticObject.liftN_node: the nonplanar magma law.
The node algebra of a magma-with-zero: lexical leaf ↦ ℓ, trace leaf ↦ τ,
bare binary node ↦ *, off-carrier arities ↦ 0.
Equations
- Minimalist.SyntacticObject.mergeAlgebra ℓ τ (Sum.inl tok) x✝ = ℓ tok
- Minimalist.SyntacticObject.mergeAlgebra ℓ τ (Sum.inr PUnit.unit) [] = τ
- Minimalist.SyntacticObject.mergeAlgebra ℓ τ (Sum.inr PUnit.unit) [x_2, y] = x_2 * y
- Minimalist.SyntacticObject.mergeAlgebra ℓ τ (Sum.inr PUnit.unit) x✝ = 0
Instances For
mergeAlgebra is invariant under permutation of the daughter values: only the
binary shape is order-sensitive, and there mul_comm applies.
The induced algebra on the nonplanar carrier: the catamorphism descends by
mergeAlgebra_perm.
Equations
Instances For
The nonplanar magma law: Merge multiplies values.
The induced map on syntactic objects, unbundled — computable, decide-friendly.
Equations
Instances For
The universal property, existence half (cf. FreeMagma.lift): leaf data
extends to a morphism of magmas out of the carrier.
Equations
- Minimalist.SyntacticObject.lift ℓ τ = { toFun := Minimalist.SyntacticObject.liftFun ℓ τ, map_mul' := ⋯ }
Instances For
The universal property, uniqueness half: morphisms agreeing on the leaves are equal.