The isomorphism #
Map SO to FreeMagma: leaf ↦, node ↦ mul
Equations
Instances For
Map FreeMagma to SO: of ↦ leaf, mul ↦ node
Equations
Instances For
SyntacticObject ≃ FreeMagma LIToken — the core bridge
Equations
- One or more equations did not get rendered due to their size.
Instances For
Mul instance: Merge is the magma operation #
Equations
Merge is literally FreeMagma multiplication under the isomorphism (definitional)
Magma homomorphism #
toFreeMagma as a magma homomorphism
Equations
- Minimalism.toFreeMagmaMulHom = { toFun := Minimalism.toFreeMagma, map_mul' := Minimalism.toFreeMagmaMulHom._proof_1 }
Instances For
fromFreeMagma as a magma homomorphism
Equations
- Minimalism.fromFreeMagmaMulHom = { toFun := Minimalism.fromFreeMagma, map_mul' := Minimalism.fromFreeMagmaMulHom._proof_1 }
Instances For
Universal property #
SyntacticObject satisfies the same universal property as FreeMagma:
any function LIToken → M (where M is a magma) extends uniquely to a
magma homomorphism SyntacticObject →ₙ* M.
Universal property: lift a function LIToken → M to a magma hom SO →ₙ* M
Equations
Instances For
Containment ↔ proper subterm #
Connect contains (Containment.lean) with subterm structure in the free magma.
An SO is a proper subterm of another iff it appears strictly within it
- left (a b : SyntacticObject) : properSubterm a (a.node b)
- right (a b : SyntacticObject) : properSubterm b (a.node b)
- trans_left (x a b : SyntacticObject) : properSubterm x a → properSubterm x (a.node b)
- trans_right (x a b : SyntacticObject) : properSubterm x b → properSubterm x (a.node b)
Instances For
Immediate containment implies proper subterm
Containment implies proper subterm
Proper subterm implies containment
Containment = proper subterm (the key bridge theorem)
toFreeMagma is injective
nodeCount is preserved by the isomorphism
Bridge to FreeMagma.length #
FreeMagma.length counts leaves (1 for .of, sum for .mul), matching
SyntacticObject.leafCount exactly under the isomorphism. This gives
access to mathlib's FreeMagma.length_pos for free.
SO.leafCount = FreeMagma.length under the isomorphism
leafCount is always positive — derived from mathlib's FreeMagma.length_pos