Lably
Skip to content

Algebraic semantics (computer science)

  • 3 min read
  • 2 chapters

Related on Lably

Through Computer science, Algebra and Reason

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 S of data types, known as sorts, together with a family Σ of sets, each set containing operation symbols (or simply symbols) that relate the sorts. We use Σs1s2...sn,s to denote the set of operation symbols relating the sorts s1,s2,...,sn∈S to the sort s∈S.

For example, for the signature of integer stacks, we define two sorts, namely, int and stack, and the following family of operation symbols:

ΣΛ,stack={new}Σintstack,stack={push}Σstack,stack={pop}Σstack,int={depth,top}

where Λ denotes the empty string.

Set-theoretic interpretation of signature

An algebra A interprets the sorts and operation symbols as sets and functions. Each sort s is interpreted as a set As, which is called the carrier of A of sort s, and each symbol σ in Σs1s2...sn,s is mapped to a function σA:As1×As2×...×Asn, which is called an operation of A.

With respect to the signature of integer stacks, we interpret the sort int as the set Z of integers, and interpret the sort stack as the set Stack of integer stacks. We further interpret the family of operation symbols as the following functions:

new:→Stackpush:Z×Stack→Stackpop:Stack→Stackdepth:Stack→Ztop:Stack→Z

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication