The translation is defined by using a straightforward mapping between CASL boolean expressions and ELAN ones, and a mapping between CASL formulas and ELAN ones. Moreover CASL predicates are viewed as ELAN functions with bool (an ELAN built-in sort) as codomains.
Definition. Given a many-sorted first-order signature Sigma, Sigma' denotes the many-sorted first-order signature defined as follows:The mapping trB: CBE(Sigma,X) -> EBE(Sigma',X) is defined recursively as follows:
- SigmaS' = SigmaS
- SigmaF' = SigmaF U { p: s1 ×...×sn -> bool }p : s1 ×...×sn e SigmaP
- SigmaP'=Ø
The mapping trF: CF(Sigma,X) -> EF(Sigma',X) is defined as follows:
- trB(false) := false
- trB(true) := true
- trB(p(t1,...,tn)) := p(t1,...,tn)
- trB(t1=t2) := t1 = t2
- trB(not b) := not b
- trB(b1 /\ b2) : = b1 and b2
- trB(b1 \/ b2) : = b1 or b2
- trB(b1 <=> b2) : = b1 = b2
The ELAN translation of a CASL equational specification (Sigma,V,CF) is the ELAN equational specification (Sigma',V,trF(CF)).
- trF(f(t1,...,tn) = t if b) := f(t1,...,tn) -> t if trB(b)
- trF(p(t1,...,tn) <=> b' if b) := p(t1,...,tn) -> trB(b') if trB(b)
From now on, the ELAN translation of a CASL equational specification is assumed to be confluent and terminating.
Example.
(Example 3.1.2 continued)
This ELAN translation of the CASL equational basic specification
GT_pred_basic is as follows.
module GT_pred_basic
sort Integ ;
end
operators global
plus(@,@): (Integ Integ) Integ ;
s(@): (Integ) Integ ;
zero: Integ ;
@ > @ : (Integ Integ) bool ;
end
rules for bool
x : Integ ;
y : Integ
global
[] plus(zero,y) => y end
[] plus(s(x),y) => s(plus(x,y)) end
[] s(x) > s(y) => x > y end
[] s(x) > zero => true end
[] zero > s(x) => false end
[] zero > zero => false end
end
end // of module