Midnight.Passport.Semantics

Attaches semantics to the architecture diagram via the standard free category + interpretation functors recipe:

The diagram below is the image of architectureᶜ under the syntax functor (architectureˢ); it is rendered straight from that term — compiled to Graphviz DOT and laid out by dot — so it cannot drift from the definitions on this page.

Midnight Passport architecture: components wired by channels
Midnight Passport architecture — the wiring diagram architectureˢ denotes.

1. Object generators: the architecture's channels

The objects of C_arch are freely generated by the channel names, enumerated as ArchChan: an object is a wire list over ArchChan, and the tensor is concatenation (Var/_⊗₀_/unit are the same sugar FMTerm provides over String).

2. Morphism generators: exactly the boxes of architecture

The morphism generators are the architecture's components — one ArchBox constructor per box, indexed by its domain and codomain object-terms. Restricting the generators to exactly these boxes is what makes C_arch the free category of the architecture (rather than of arbitrary named morphisms).

3. architecture, rebuilt in C_arch

The architecture itself is a single morphism CHAIN → User in C_arch: the blockchain enters at the bottom boundary (it is the environment's wire, read by accountCustody), and three layers of boxes are composed left-to-right, the CHAIN wire threading through the first.

4. Syntax functor C_arch → FMTerm

The object part is Φ = map chanName; the morphism part is synBox, sending each box to the correspondingly-named gen. Since the two categories have different object generators (ArchChan vs String), the functor syn transports the object indices through chanName — the map-++ rewrites discharge that chanName distributes over the tensor. architectureˢ is the image of architectureᶜ; it is the term the diagram above is rendered from.

 
 
 
 

5. Semantics interpretation: generators → Machine

The semantics is given as generator data: a Channel per channel and a Machine per box. A ChannelModel fixes the objects (and lifts them to the functor's object map ⟦_⟧₀); a MachineModel fixes the machines and reads them off as the morphism map ⟦_⟧₁ : ArchBox → Machine. Together they are the data of a symmetric monoidal functor C_arch → Machine.