Semantics encoding
Introduction
An semantics encoding is a "translation" between formal languages -- typically programming languages or description languages.
An encoding of a formal language A in a formal language B is a mapping of all terms of language A into language B. If there is a 'satisfactory' encoding of A in B, B is considered at least as powerful (or at least as 'expressive') as A.
Classifications of encodings
This informal notion of translation is not sufficient to help determine expressivity of languages, as it permits trivial encodings such as mapping all elements of A to the same element of B. Therefore, it is necessary to determine the definition of a "good enough" encoding.
This notion varies with the application. Commonly, an encoding can be judged on the following properties:
- preservation of compositions
- for every n-ary operator of A, there is an n-ary operator of B such that
- preservation of observations (soundness)
- for every observable behaviour of terms of A, there is a behaviour of terms of B such that for any term with behaviour , has behaviour .
- preservation of observations (completeness)
- for every observable behaviour of terms of A, there is a behaviour of terms of B such that for any term with behaviour , has behaviour .
- preservation of equivalences (soundness)
- assuming the existence a notion of equivalence on A (typically, equality structural congruence or structural equivalence) and a notion of equivalence on B, if two terms and are equivalent in A, then and are equivalent in B.
- preservation of equivalences (completeness)
- assuming the existence a notion of equivalence on A (typically, equality, structural congruence or structural equivalence) and a notion of equivalence on B, if two terms and are equivalent in B, then and are equivalent in A.
- preservation of termination (soundness)
- assuming a notion of reduction/rewriting, for any term , if all reductions of converge, then all reductions of converge.
- preservatio of termination (completeness)
- assuming a notion of reduction/rewriting, for any term , if all reductions of converge, then all reductions of converge.
Domain-specific properties
Under some circumstances, other properties can be important.
For instance, in process algebras, encodings are often expected to preserve distribution:
- preservation of distribution
- if a term is the composition of two agents then must be
the composition of two agents