In BINARY-NAT it is possible to reduce the following terms.
Maude> red ((1 0) + (1 0)) * (1 1) . result Bits: 1 1 0 0 Maude> red ((1 0) > 1) and ((1 1) > (1 0)) . result Bool: true Maude> red (1).Bit * 0 . result Bit: 0 Maude> red (1 0) + (1 0) + (1 0) . result Bits: 1 1 0
But, parentheses, logical operators such as and, sort tests, and qualification operators are not a proper part of the module. These structures belong to the so-called extended signature of a module. That is, the process of grammar generation from the user-defined signature adds automatically more information than that strictly contained in the signature. From the user's viewpoint, the main structures added in the extended signature of a module are:
op (_).S : S -> S .
This helps in the disambiguation of ad-hoc overloaded constants and terms. For example, in the module BINARY-NAT, because of the presence of machine integers, the constants 0 and 1 and the operator _+_ are ad hoc overloaded (see Section 2.1.1). Thus, terms such as 0, 1 or 1 + 1 are ambiguous. We can eliminate this ambiguity by using sort disambiguation operators, that is, by qualifying the ambiguous terms with their sorts.
Maude> red (1).Bit . result Bit: 1 Maude> red (1 + 1).Bits . result Bits: 1 0 Maude> red 1 + (1).MachineInt . result NzMachineInt: 2
op (_) : S -> S .
These operators allow the use of parentheses without having to declare a parentheses operator for each sort.
Maude> red not (1 0 1 1) . result Bits: 0 1 0 0
Maude> red _>_(1 0, 1) . result Bool: true Maude> red _?_:_(1 > 1 0, 1, 0) . result Bit: 0
Maude> red (1 1) + (1 1) + (1 1) + (1 1) . result Bits: 1 1 0 0
Furthermore, if the associative operator is given in prefix notation, it can take not only two, but arbitrarily many more arguments.
Maude> red _+_(1 1, 1 1, 1 1, 1 1) . result Bits: 1 1 0 0
Note that this extension of the signature has allowed the specification of operators, variables, and equations such as the following ones in BINARY-NAT.
op _?_:_ : Bool Bits Bits -> Bits .
var L : Bool .
eq B S > C T
= if | normalize(B S) | > | normalize(C T) |
then true
else if | normalize(B S) | < | normalize(C T) |
then false
else (S > T)
fi
fi .