| 1 |
Introduction |
| 2 |
============ |
| 3 |
|
| 4 |
This manual introduces the language CafeOBJ. Is is a reference manual |
| 5 |
with the aim to document the current status of the language, and not |
| 6 |
targeting at an exhaustive presentation of the mathematical and logical |
| 7 |
background. Still, the next section will give a short summary of the |
| 8 |
underlying formal approach and carry references for those in search |
| 9 |
for details. |
| 10 |
|
| 11 |
The manual is structured into three parts. The first one being this |
| 12 |
introduction, the second one being the presentation of basic concepts |
| 13 |
of CafeOBJ by providing a simple protocol which will get specified |
| 14 |
and verified. Although the second part tries to give a view onto the |
| 15 |
core features and their usage, it should not be considered a course in |
| 16 |
CafeOBJ, and cannot replace a proper introduction to the language. |
| 17 |
The CafeOBJ distribution also includes a _user manual_. This user |
| 18 |
manual is slightly outdated with respect to the current status of the |
| 19 |
language, but is targeting those without and prior knowledge of |
| 20 |
CafeOBJ. |
| 21 |
|
| 22 |
Finally, the last part consists of explanations of all current |
| 23 |
language elements in alphabetic order. This includes several higher |
| 24 |
level concepts, as well as heavy cross-referencing. |
| 25 |
|
| 26 |
While we hope that this manual and the introductory part helps |
| 27 |
beginners to start programming in CafeOBJ, the main target are those |
| 28 |
who already have acquired a certain level of fluency, but are in need |
| 29 |
for a reference of the language. |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
Background of CafeOBJ |
| 34 |
---------------------- |
| 35 |
CafeOBJ is an algebraic specification and verification |
| 36 |
language. Although it can be employed for all kind of programming |
| 37 |
(since it is Turing complete), the main target are algebraic |
| 38 |
specification of software systems. This includes programs, protocols, |
| 39 |
and all kind of interaction specifications. In addition to being a |
| 40 |
specification language, it is also a _verification_ language, that is, |
| 41 |
a specification given in CafeOBJ can be verified within the same |
| 42 |
language environment. |
| 43 |
|
| 44 |
_Specification_ here means that we are trying to describe the inner |
| 45 |
workings of a software system in a mathematical way, while |
| 46 |
_verification_ means that we give a mathematical proof of certain |
| 47 |
properties. A specification is a text, usually of |
| 48 |
formal syntax. It denotes an algebraic system constructed out of |
| 49 |
sorts (or data types) and sorted (or typed) operators. The system |
| 50 |
is characterize by the axioms in the specification. An axiom was |
| 51 |
traditionally a plain equation (``essentially algebraic''), but is now |
| 52 |
construed much more broadly. For example, CafeOBJ accommodates |
| 53 |
conditional equations, directed transitions, and (limited) use of |
| 54 |
disequality. |
| 55 |
|
| 56 |
CafeOBJ is based on three extensions to the basic many-sorted |
| 57 |
equational logic: |
| 58 |
|
| 59 |
Order-sorted logic |
| 60 |
: In addition to having different sorts (similar to types in other |
| 61 |
programming languages), these sorts can be ordered, or in other |
| 62 |
words, one sort can be a subset of another sort: Take for |
| 63 |
example the number stack: CafeOBJ allows for the provision of |
| 64 |
natural numbers, which are part of the rational numbers, which are |
| 65 |
part of the real numbers. This concept allows for operator |
| 66 |
inheritance and overloading. |
| 67 |
Behavioral logic |
| 68 |
: Algebraic modeling is often based on constructors, i.e., all terms |
| 69 |
under discussion are built up from given operations, and equality |
| 70 |
can be decided via an equational theory. While being very |
| 71 |
successful, it is often necessary to model infinite objects (like |
| 72 |
data streams), which cannot be achieved in this way. CafeOBJ |
| 73 |
includes _behavioral logic_ and the respective _hidden sorts_ as |
| 74 |
methodology to model infinite objects which identity is defined via |
| 75 |
behavior instead of the equational theory. |
| 76 |
Rewriting logic |
| 77 |
: Aim of a algebraic specification and verification is to give a |
| 78 |
formal proof of correctness. CafeOBJ contains order-sorted term |
| 79 |
rewriting as operational semantics, which allows for _execution of |
| 80 |
proof scores_, CafeOBJ code which forms a proof of the required |
| 81 |
properties. |
| 82 |
|
| 83 |
There is a wide range of literature on all of these subjects for the |
| 84 |
interested reader in search for theoretical background. We refer the |
| 85 |
reader to \cite{DBLP:conf/birthday/2014futatsugi} as a starting point. |