Algebraic formulation
Introduction / Definition
An abstract data type can be specified by its values, operations, and laws. Algebraic formulation focuses on what operations mean rather than how they are stored. The same specification may have several implementations. This approach is useful for proving that implementations satisfy a common interface.
Syntax / Structure / Formula
ADT = (Values, Operations, Laws)
Detailed Explanation
List operations and equations describing their expected behavior. For a stack, push adds an item and pop removes the most recent item. Laws such as pop(push(S,x))=(S,x) describe required behavior.
Example
Example: top(push(S,x)) = x.
Output / Result
The law holds for any valid stack S and item x.
Important Points / Notes
- Behavior is separated from representation.
- Equations act as correctness rules.
Mini Practice Question
Write one law for a queue.