Semantics refers to the
meaning or
behavior. An algebraic specification provides
both the meaning and behavior of the
object in question.
Equational axioms The semantics of an algebraic specifications is defined by
axioms in the form of
conditional equations. of a specification refers to its mathematical meaning. The mathematical semantics of an algebraic specification is the
class of all algebras that satisfy the specification. In particular, the classic approach by Goguen et al. of a specification means how to interpret it as a sequence of computational steps. We define a
ground term as an
algebraic expression without
variables. The operational semantics of an algebraic specification refers to how ground terms can be transformed using the given equational axioms as left-to-right
rewrite rules, until such terms reach their
normal forms, where no more rewriting is possible. Consider the axioms for integer stacks. Let "\Rrightarrow" denote "rewrites to". ::\begin{align} & {\rm top} ({\rm pop} ({\rm pop} ({\rm push} (1,~{\rm push} (2,~{\rm push} (3,~{\rm pop} ({\rm new}))))))) & \\ \Rrightarrow ~ & {\rm top} ({\rm pop} ({\rm pop} ({\rm push} (1,~{\rm push} (2,~{\rm push} (3,~{\rm new})))))) & ({\rm by~Axiom~} A4) \\ \Rrightarrow ~ & {\rm top} ({\rm pop} ({\rm push} (2,~{\rm push} (3,~{\rm new})))) & ({\rm by~Axiom~} A1) \\ \Rrightarrow ~ & {\rm top} ({\rm push} (3,~{\rm new})) & ({\rm by~Axiom~} A1) \\ \Rrightarrow ~ & 3 & ({\rm by~Axiom~} A3) \\ \end{align}
Canonical property An algebraic specification is said to be
confluent (also known as
Church-Rosser) if the rewriting of any ground term leads to the same normal form. It is said to be
terminating if the rewriting of any ground term will lead to a normal form after a finite number of steps. The algebraic specification is said to be
canonical (also known as
convergent) if it is both confluent and terminating. In other words, it is canonical if the rewriting of any ground term leads to a unique normal form after a finite number of steps. Given any canonical algebraic specification, the mathematical semantics
agrees with the operational semantics. As a result, canonical algebraic specifications have been widely applied to address program correctness issues. For example, numerous researchers have applied such specifications to the
testing of
observational equivalence of
objects in
object-oriented programming. See Chen and Tse as a
secondary source that provides a historical review of prominent research from 1981 to 2013. == See also ==