
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























Computer Science DepartmentUniversity of Illinois at Urbana-Champaign
Subsignatures We have already seen an example of a signature extendinganother, namely
subsignature^ of
subsignature^ of a signature
′, and
-^ the constants and operations of
Constructor Subsignatures
constructor subsignature
for
free constructors
if we actually
have an equality
, constructor subsignature.
Constructor Subsignatures (VI) Note that a given subsort overloaded operator may be aconstructor, while another subsort overloaded version of thesame operator^ may not be. For example, the module fmod INTEGER issorts Zero Natural NzNatural Negative NzNegative Integer .subsorts Zero NzNatural < Natural < Integer .subsorts Zero NzNegative < Negative < Integer .op 0 : -> Zero [ctor] .op s_ : Natural -> NzNatural [ctor] .op s_ : Integer -> Integer .op p_ : Negative -> NzNegative [ctor] .op p_ : Integer -> Integer .var I : Integer .eq p s I = I .eq s p I = I .endfm defines a free^ constructor subsignature for the integers.
Equational Simplification Modulo Axioms In OBJ and Maude, we allow certain equations, namely associativity,^ commutativity
, and^ identity^ to be declared as attributes^ of operators by means of the
attribute declarations in modules and theories. Mathematically
, this means that our theory is of the form
explicitly given
in the
module, and with
implicitly declared
by
attributes such as
modulo^ the axioms
applies to the term
modulo^ associativity of
commutativity of
Examples of Equational Simplification Modulo
Lists modulo associativity, with membership. More patternsneed to be considered without the identity attribute. fmod LIST-A isprotecting NAT.
sort List.^ subsort Nat < List .op nil : -> List .op ; : List List -> List [assoc] .op in : Nat List -> Bool .var N : Nat. vars L L’ : List .eq nil ; L = L .eq L ; nil = L .eq N in N = true .eq N in N ; L = true .eq N in L ; N = true .eq N in L ; N ; L’ = true .eq N in L = false [owise]. endfm
reduce in LIST-A : 7 in 3 ; 4 ; 9 .result Bool: false==========================================reduce in LIST-A : 7 in 4 ; 3 ; 7 .result Bool: true
Examples of Equational Simplification Modulo
Multisets modulo associativity and commutativity. fmod MSET-AC isprotecting NAT .sort MSet .subsort Nat < MSet .op nil : -> MSet .op ; : MSet MSet -> MSet [assoc comm] .op in : Nat MSet -> Bool .var N : Nat.^ var S : MSet .eq N in N = true .eq N in N ; S = true .eq N in S = false [owise] .endfmreduce in MSET-AC : 7 in 3 ; 4 ; 9 .result Bool: false==========================================reduce in MSET-AC : 7 in 4 ; 3 ; 7 .result Bool: true
Equational Simplification Modulo
The above examples and
equational simplification modulo
admissible as equational simplification rules. Then, we candefine a binary relation on terms in
, andE/A
called one-step equational simplification modulo
means of our two previously defined relations
Another Example of Equational Simplification Modulo
The following Maude module defines sets of naturalnumbers by simplifying multisets of natural numbers modulo^ associativity and commutativity, using identity andidempotency equations. fmod NAT-SET is protecting NATURAL .sort NatSet .subsort Natural < NatSet .op empty : -> NatSet [ctor] .op _ _ : NatSet NatSet -> NatSet [ctor assoc comm]. *** set unionvar X : NatSet .eq empty X = X.
*** identity
eq X X = X.^
*** idempotency
endfm
16
Caveats on Equational Simplification Modulo
Equational simplification
modulo identity
is trickier. For example, the innocent-looking idempotency equation in fmod NAT-SET’ is protecting NAT .sort NatSet .subsort Natural < NatSet .op empty : -> NatSet [ctor] .op _ _ : NatSet NatSet -> NatSet [ctor assoc comm id: empty] .var X : NatSet .eq X X = X .endfm is nonterminating, since, denoting by
All Generalizes Modulo
Under reasonable assumptions on
equational simplification generalize in a natural way toequational simplification modulo
as the reflexive and transitive closure of
confluence^ and
termination^ are the same,
soundness,
and for confluent equations
completeness, of equational simplification modulo
All Generalizes Modulo
The concepts of
canonical term algebra
and of^ constructor subsignature^ also generalize, except that now canonicalforms are^ equivalence classes modulo
We call the constructors
if we in fact have,
For example, the constructors in
free
is^ not^ in canonical form.