Algebraic Specification
   HOME

TheInfoList



OR:

Algebraic specification is a
software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
technique for formally specifying system behavior. It was a very active subject of computer science research around 1980.


Overview

Algebraic specification seeks to systematically develop more efficient programs by: # formally defining types of data, 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. The set of available constructor functions is implied by the specification's
signature A signature (; from la, signare, "to sign") is a handwritten (and often stylized) depiction of someone's name, nickname, or even a simple "X" or other mark that a person writes on documents as a proof of identity and intent. The writer of a ...
. Additionally, a specification can contain ''equations'' defining equivalences between the objects constructed by these functions. Whether the underlying representation is identical for different but equivalent constructions is implementation-dependent. # Additional functions: Functions that operate on the data types, and are defined in terms of the constructor functions.


Examples

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, such as
XOR Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , ...
and
AND or AND may refer to: Logic, grammar, and computing * Conjunction (grammar), connecting two words, phrases, or clauses * Logical conjunction in mathematical logic, notated as "∧", "⋅", "&", or simple juxtaposition * Bitwise AND, a boolea ...
, 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 ''true'' could be defined to yield the value ''not'' ''false'', and an equation (\text \; \text \; x) = x should be added. The algebraic specification therefore describes all possible states of the data element, and all possible transitions between states. For a more complicated example, the
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s can be specified (among many other ways, and choosing one of the many formalisms) with two constructors 1 : Z (_ - _) : Z × Z -> Z and three equations: (1 - (1 - p)) = p ((1 - (n - p)) - 1) = (p - n) ((p1 - n1) - (n2 - p2)) = (p1 - (n1 - (p2 - n2))) It is easy to verify that the equations are valid, given the usual interpretation of the binary "minus" function. (The variable names have been choosen to hint at positive and negative contributions to the value.) With a little effort, it can be shown that, applied left to right, they also constitute a
confluent In geography, a confluence (also: ''conflux'') occurs where two or more flowing bodies of water join to form a single channel. A confluence can occur in several configurations: at the point where a tributary joins a larger river (main stem); o ...
and terminating rewriting system, mapping any constructed term to an unambiguous normal form representing the respective integer: ... (((1 - 1) - 1) - 1) ((1 - 1) - 1) (1 - 1) 1 (1 - ((1 - 1) - 1)) (1 - (((1 - 1) - 1) - 1)) ... Therefore, any implementation conforming to this specification will behave like the integers, or possibly a restricted range of them, like the usual integer types found in most programming languages.


See also

*
Common Algebraic Specification Language The Common Algebraic Specification Language (CASL) is a general-purpose specification language based on first-order logic with induction. Partial functions and subsorting are also supported. Overview CASL has been designed by CoFI, the Common F ...
*
Formal specification In computer science, formal specifications are mathematically based techniques whose purpose are to help with the implementation of systems and software. They are used to describe a system, to analyze its behavior, and to aid in its design by verif ...
* OBJ


Notes

Formal methods {{compsci-stub