Algebraic specification
Encyclopedia
Algebraic specification, is a software engineering technique for formally specifying
system behavior. Algebraic specification seeks to systematically develop more efficient programs by:
An algebraic specification achieves these goals by defining one or more data types, and specifying a collection of functions that operate on those data types. These functions can be divided into two classes:
One possible algebraic specification may provide two constructor functions for the data-element: a true constructor and a false constructor. Thus, a boolean data element could be declared, constructed, and initialized to a value. In this scenario, all other connective elements
, such as XOR and AND
, would be additional functions. Thus, a data element could be instantiated with either "true" or "false" value, and additional functions could be used to perform any operation on the data element.
Alternatively, the entire system of boolean data types could be specified using a different set of constructor functions: a false constructor and a not
constructor. In that case, an additional function could be defined to yield the value "true."
The algebraic specification therefore describes all possible states of the data element, and all possible transitions between states.
Formal specification
In computer science, a formal specification is a mathematical description of software or hardware that may be used to develop an implementation. It describes what the system should do, not how the system should do it...
system behavior. Algebraic specification seeks to systematically develop more efficient programs by:
- formally defining types of dataData typeIn computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...
, and mathematical operations on those data types - abstracting implementation details, such as the size of representations (in memory) and the efficiency of obtaining outcome of computations
- formalizing the computations and operations on data types
- allowing for automation by formally restricting operations to this limited set of behaviors and data types.
An algebraic specification achieves these goals by defining one or more data types, and specifying a collection of functions that operate on those data types. These functions can be divided into two classes:
- constructor functions: functions that create or initialize the data elements, or construct complex elements from simpler ones
- additional functionsMethod (computer programming)In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...
: functions that operate on the data types, and are defined in terms of the constructor functions.
Example
Consider a formal algebraic specification for the boolean data type.One possible algebraic specification may provide two constructor functions for the data-element: a true constructor and a false constructor. Thus, a boolean data element could be declared, constructed, and initialized to a value. In this scenario, all other connective elements
Boolean algebra
In abstract algebra, a Boolean algebra or Boolean lattice is a complemented distributive lattice. This type of algebraic structure captures essential properties of both set operations and logic operations. A Boolean algebra can be seen as a generalization of a power set algebra or a field of sets...
, such as XOR and AND
Logical conjunction
In logic and mathematics, a two-place logical operator and, also known as logical conjunction, results in true if both of its operands are true, otherwise the value of false....
, would be additional functions. Thus, a data element could be instantiated with either "true" or "false" value, and additional functions could be used to perform any operation on the data element.
Alternatively, the entire system of boolean data types could be specified using a different set of constructor functions: a false constructor and a not
Negation
In logic and mathematics, negation, also called logical complement, is an operation on propositions, truth values, or semantic values more generally. Intuitively, the negation of a proposition is true when that proposition is false, and vice versa. In classical logic negation is normally identified...
constructor. In that case, an additional function could be defined to yield the value "true."
The algebraic specification therefore describes all possible states of the data element, and all possible transitions between states.
See also
- Common Algebraic Specification LanguageCommon Algebraic Specification LanguageThe Common Algebraic Specification Language is a general-purpose specification languagebased on first-order logic with induction. Partial functionsand subsorting are also supported....
- Donald Sannella
- Formal specificationFormal specificationIn computer science, a formal specification is a mathematical description of software or hardware that may be used to develop an implementation. It describes what the system should do, not how the system should do it...