CafeOBJ language
Successor to OBJ adding hidden sorts, behavioural specification and rewriting logic under one institution-based semantics. Its distinguishing practice is the proof score: a proof is CafeOBJ source, executed by reduction, so specification and verification share one tool.
Overview
CafeOBJ is an algebraic specification and verification language, a direct successor to OBJ developed under Kokichi Futatsugi's direction at JAIST. It keeps OBJ's mixfix syntax, order-sorted typing and parameterized modules, and adds hidden sorts and rewriting logic for behavioural and concurrent systems.
Code
mod! SIMPLE-NAT {
[Nat]
op 0 : -> Nat {constr}
op s_ : Nat -> Nat {constr}
op _+_ : Nat Nat -> Nat
vars N M : Nat
eq 0 + N = N .
eq s N + M = s(N + M) .
}
red s s 0 + s s s 0 . ***> s s s s s 0
mod! NATPAIR {
pr(NAT)
[Pair]
ops <_,_> : Nat Nat -> Pair {constr}
ops fst snd : Pair -> Nat
eq fst(< A:Nat , B:Nat >) = A .
eq snd(< A:Nat , B:Nat >) = B .
}
red fst(< 3 , 4 >) . ***> 3
mod! PAIR(X :: TRIV, Y :: TRIV) {
[Pair]
op <_,_> : Elt.X Elt.Y -> Pair {constr}
op fst : Pair -> Elt.X
eq fst(< A:Elt.X , B:Elt.Y >) = A .
}
mod! NAT-STRING-PAIR {
pr(PAIR(NAT, STRING{sort Elt -> String}))
}
mod! COUNTER {
pr(SIMPLE-NAT)
*[Counter]*
bop init : -> Counter
bop inc : Counter -> Counter
bop value : Counter -> Nat
var C : Counter
beq value(init) = 0 .
beq value(inc(C)) = s(value(C)) .
}
open COUNTER .
red value(inc(inc(init))) . ***> s s 0
close
[Nat] is a visible sort
whose values are decided by equations, *[Counter]* is a hidden sort whose
identity is decided by observation through its bop operators. beq states
those observations behaviourally, and red drives the whole thing.Distinctive traits
- Institution-based semantics: each logic combination is a separate institution, giving one language several precisely defined paradigms at once.
- Hidden sorts and behavioural operators (
bop,beq,=*=) specify infinite objects by observation rather than by term equality. - Proof scores: case analysis
and induction are written as CafeOBJ source and discharged by
red, so the proof is checked by the same engine that runs the specification. mod!andmod*choose initial vs loose semantics for a module, making the model-theoretic reading part of the declaration.- Syntax is fully user-definable (
_+_,if_then_else_fi), andops ... {constr}marks which operators generate the data.
Status
Actively maintained: version 1.6.2 shipped in November 2024 under a BSD licence, with binaries for Windows, macOS and Linux built on SBCL and source at CafeOBJ/cafeobj. The interpreter is written in Common Lisp and ships with the CITP/PTcalc proof assistant.
History
The CafeOBJ project began in April 1997 as a Japanese government-funded consortium to build an industrial-strength OBJ environment; Futatsugi, an OBJ2 designer, led it at JAIST. The CafeOBJ Report (Diaconescu and Futatsugi) appeared in 1998, and the interpreter has been in continuous release since.
Sources & references
- Official sitecafeobj.org
- CafeOBJ Reference Manual v1.5.7 (Sawada, Futatsugi, Preining, 2018)cafeobj.org
- CafeOBJ User's Manual (Nakagawa, Sawada)cafeobj.org
- CafeOBJ Project Press Release, 22 April 1997 — UCSDcseweb.ucsd.edu
- CafeOBJ interpreter source (CafeOBJ/cafeobj)github.com
- CafeOBJ 1.6.2 release announcement (November 2024)cafeobj.org