Simplicial Stochastic Grammars of Molecules and the Compositional Semantics of Their Derivations
Chemistry has a syntax, the ways atoms may be joined, and a semantics, what a molecule so joined does. This paper measures how much of each a generative grammar holds when its letters are as small as they can be. A molecule is written one atom at a time, each atom the apex of a simplex of dimension one, two or three glued along a face of what is already there; a ring is a fan of triangles on edges that are no bonds. This is a normal form of hyperedge replacement at bounded rank, and of a tree decomposition of width three. The grammar is stated in full as a grammar of hyperedge replacement whose nonterminals are faces with a count of the cones they carry, and whose richer levels of context are application conditions; its derivations in the order of growth correspond one to one to words, and valence can be carried exactly in its nonterminals. A canonical derivation makes each molecule one word, two words being equal exactly when their constitutions are isomorphic; the alphabet is small (57 letters on MOSES, where a grammar whose letters are whole rings needs thousands of rules); and the molecules left out are counted exactly: 22 of 133,885 in QM9, 2 of 249,455 in ZINC250k and 4 of 1,936,962 in MOSES. On words a stochastic grammar is read at nested levels of context and judged in bits on molecules held out. A context-free grammar needs 82.1 bits for a molecule of MOSES; knowing the letter that opened a face, 58.1; knowing also the length of the ring a closure would make and the valence left, 47.5; knowing also how many atoms the molecule has so far, 42.9, which is 1.7 times the 25.6 bits reported for a chemical language model of 32 million parameters (Balaji et al., 2025). Every molecule drawn from the grammar conditioned on valence is valid; the grammars of local context draw molecules of the wrong sizes, and the number of atoms so far brings the body of the law of sizes to the collection's, though not its tail. For semantics, eight properties of QM9 are read as sums over the parts of a derivation, rung by rung. Among molecules made of the very same atoms and bonds, the productions of the derivation together with the productions they came from tell 0.84 of the differences in atomisation energy and 0.47 of those in the HOMO–LUMO gap: how a molecule is put together carries meaning that its parts do not, more for energies than for frontier orbitals. How far a derivation can decide meaning is bounded by the equivalence the grammar quotients by. In QM9 the 87 pairs of molecules that share a whole canonical word agree to the archive's last digit; in ZINC250k every one of the 1,644 groups that share a word is a group of stereoisomers, mirror images among them, which a grammar of constitutions cannot tell apart. Three variants are stated formally: letters that carry the orientation of the simplex they complete; nonterminals that are orbits of faces under the symmetries of the molecule so far, so that the choice between two enantiotopic faces is a recorded step; and letters that carry the rigid motion placing their apex. The first is built: its oriented words separate the 249,453 configurations of ZINC250k exactly, every pair of stereoisomers among them, and a sign held out costs 0.995 bits. An operator-algebraic formulation of the growth and other alphabets are discussed.
Authors
- Wanhong HUANG
Publication Details
- Journal
- Knowledge Commons Works (Michigan State University)
- Published
- 2026-12-03
- DOI
- https://doi.org/10.17613/1xwqj-2sn49
- Primary Topic
- semigroups and automata theory
- Type
- article
- Field-Weighted Citation Impact
- 0.00