]>
Book Contents Previous Section 9.48 LyndonWord Next Section 9.50 MakeFunction Book Index

## 9.49 Magma

Initialisations

x:Symbol :='x

x

Type: Symbol
y:Symbol :='y

y

Type: Symbol
z:Symbol :='z

z

Type: Symbol
word := OrderedFreeMonoid(Symbol)

OrderedFreeMonoidSymbol

Type: Domain
tree := Magma(Symbol)

MagmaSymbol

Type: Domain

Let's make some trees

a:tree := x*x

[x,x]

Type: Magma Symbol
b:tree := y*y

[y,y]

Type: Magma Symbol
c:tree := a*b

[[x,x],[y,y]]

Type: Magma Symbol

Query the trees

left c

[x,x]

Type: Magma Symbol
right c

[y,y]

Type: Magma Symbol
length c

4

Type: PositiveInteger

Coerce to the monoid

c::word

x 2 y 2

Type: OrderedFreeMonoid Symbol

Check ordering

a < b

true

Type: Boolean
a < c

true

Type: Boolean
b < c

true

Type: Boolean

Navigate the tree

first c

x

Type: Symbol
rest c

[x,[y,y]]

Type: Magma Symbol
rest rest c

[y,y]

Type: Magma Symbol

Check ordering

ax:tree := a*x

[[x,x],x]

Type: Magma Symbol
xa:tree := x*a

[x,[x,x]]

Type: Magma Symbol
xa < ax

true

Type: Boolean
lexico(xa,ax)

false

Type: Boolean
Book Contents Previous Section 9.48 LyndonWord Next Section 9.50 MakeFunction Book Index