In computer science, algebraic semantics is a form of axiomatic semantics based on algebraic laws for describing and reasoning about program specifications in a formal manner.
Syntax.
The syntax of an algebraic specification is formulated in two steps: (1) defining a formal signature of data types and operation symbols, and (2) interpreting the signature through sets and functions.
Definition of a signature.
The signature of an algebraic specification defines its formal syntax. The word "signature" is used like the concept of "key signature" in musical notation.
A signature consists of a set formula_1 of data types, known as sorts, together with a family formula_2 of sets, each set containing operation symbols (or simply symbols) that relate the sorts.
We use formula_3 to denote the set of operation symbols relating the sorts formula_4 to the sort formula_5.
For example, for the signature of integer stacks, we define two sorts, namely, formula_6 and formula_7, and the following family of operation symbols:
formula_8
where formula_9 denotes the empty string.
Set-theoretic interpretation of signature.
An algebra formula_10 interprets the sorts and operation symbols as sets and functions.
Each sort formula_11 is interpreted as a set formula_12, which is called the carrier of formula_10 of sort formula_11, and each symbol formula_15 in formula_3 is mapped to a function formula_17, which is called an operation of formula_10.
With respect to the signature of integer stacks, we interpret the sort formula_6 as the set formula_20 of integers, and interpret the sort formula_7 as the set formula_22 of integer stacks. We further interpret the family of operation symbols as the following functions:
formula_23
Semantics.
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.
With respect to the signature of integer stacks, we have the following axioms:
For any formula_24 and formula_25,
formula_26
where "formula_27" indicates "not found".
Mathematical semantics.
The mathematical semantics (also known as denotational semantics) 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. takes the initial algebra (unique up to isomorphism) as the "most representative" model of the algebraic specification.
Operational semantics.
The operational semantics 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 "formula_28" denote "rewrites to".
formula_29
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.
References.
 ;templatestyles src="Reflist/styles.css" / ;