Solution (source code)

= Solution

Expand the language by a constant $c_a$ for every element of the structure. Its <diagram of a structure> consists of all atomic and negated atomic sentences true in this expanded structure. Its <elementary diagram>, also called the complete diagram, consists of all <first-order sentences> true in the expansion.

For a model $M$ of the diagram, the map $a\mapsto c_a^M$ is injective because the diagram includes all required inequalities. It preserves functions and constants by the corresponding equations, and it preserves and reflects relations by the positive and negative atomic sentences. Thus it is a <structure embedding> onto a <substructure> of the reduct of $M$. Conversely, a structure containing an isomorphic copy of the original as a <substructure> can interpret the new constants at that copy and satisfy its diagram.

For the elementary diagram the same argument works for every formula, not just atomic ones. The map is therefore an <elementary embedding>. Conversely any <elementary embedding> gives an expansion satisfying the elementary diagram. These are characterizations up to the named copy; a model of either diagram may have additional unnamed elements.