All languages

OBJ languagedormant

Family of algebraic specification languages on order-sorted equational logic: programs are equational theories, computation is rewriting. OBJ pioneered parameterized programming and influenced Ada, ML and C++ modules; Maude and CafeOBJ continue the line.

Overview

OBJ is a family of algebraic specification languages built on order-sorted equational logic, designed by Joseph Goguen at UCSD from 1976. An OBJ program is an equational theory and every computation is a proof, which makes the language executable and amenable to mechanised verification.

Code

obj NAT is
  sort Nat .
  op 0 : -> Nat .
  op s_ : Nat -> Nat .
  op _+_ : Nat Nat -> Nat [assoc comm] .
  vars M N : Nat .
  eq M + 0 = M .
  eq M + s N = s(M + N) .
endo

red (s s 0) + (s 0) .        ***> s s s 0
obj … endo declares sorts, mixfix operators and equations; a view discharges a parameter theory, so LIST[NAT-TRIV] is instantiation by proof obligation; red and openr turn those same equations into a rewriting engine. There is no control flow anywhere: computation is equational deduction.

Distinctive traits

  • Order-sorted subsorting is a partial order on sorts, so multiple inheritance, overloading and coercions need no special rules.
  • Equations are the only control structure: a reduction is a proof, so theorem proving and execution are the same act.
  • Parameterized programming debuted here: modules take theories as parameters, views discharge them; Ada, Standard ML and C++ module systems followed.
  • User-definable mixfix syntax makes if_then_else_fi and _+_ ordinary operators with declared precedence.
  • Rewriting modulo associativity, commutativity and identity is built in, so sets and lists need no hand-written normalisation.

Status

OBJ3 is the canonical implementation: it runs under Common Lisp and was re-released as 2.06 (2000) under a BSD-like licence by KindSoftware, and is no longer under active development. Maude and CafeOBJ continue the design.

History

The first implementation of initial algebra semantics by term rewriting appeared in OBJ in the mid-1970s; the characteristic syntax appeared in Goguen's 1977 paper. OBJ2 (1985) added Clear-style parameterized modules, and OBJ3 (1988) rebuilt the operational semantics on order-sorted rewriting. BOBJ, CafeOBJ and Maude followed, enriching the logic.

Sources & references