Go backward to 3.3 Language Constructs
Go up to 3 Basic Specifications

3.4 Example

The following example illustrates a complete basic specification:

free types
Nat ::= 0 | sort Pos;
Pos ::= suc(pre:Nat)
op
pre : Nat ->? Nat
axioms
 
¬ def pre(0);
forall n:Nat · pre(suc(n)) = n
 
pred
even__ : Nat
var
n:Nat
·
even 0
·
even suc(n) <=> ¬ even n
Notice that the second line above declares suc : Nat -> Pos and pre : Pos -> Nat. The subsequent declaration of pre : Nat ->? Nat allows terms where pre is applied to an argument that is of sort Nat but not of sort Pos--such terms can be perfectly meaningful, e.g., pre(pre(suc(suc(0)))).

Further examples may be found in later sections, and in the appendices of the CASL Summary [4].


CoFI Document: CASL/GuidedTour -- Version: 1 -- July 1999.
Comments to pdmosses@brics.dk

Go backward to 3.3 Language Constructs
Go up to 3 Basic Specifications