2.3. Well-Typedness
A MailboxActors.WellTypedState bundles five structural invariants:
-
Messages typed — every in-transit message has a payload whose engine type index matches the target engine's type.
-
Mailbox exists — every processing engine has a paired mailbox engine whose type index matches and whose mode is
mail. -
Fresh IDs — the
nextIdcounter exceeds every existingengineId, guaranteeing address freshness. -
Message targets valid — all messages in transit target addresses created before the current
nextId. -
Nodes exist — for every engine, the corresponding node is present.
The companion predicate MailboxActors.MailboxIsolation states that
all messages in transit target mailbox engines (not processing engines).
This is a separate invariant because it is preserved by the semantics and
required by type preservation, but it is not part of the well-typedness
definition itself.
The theorem MailboxActors.spawnPairing restates the mailbox_exists
field as a standalone result for clarity: every processing engine has a
paired mailbox engine with matching type index in mail mode.