Skip to content
Design14 min readUpdated 27 Oct 2026

Appendix C. The bounded models and the corpus script

Both models are explicit-state, breadth-first explorations, so every counterexample reported is a shortest one. They are written as guarded commands. The artefact anc/rg_models.py implements them directly, and running python3 anc/rg_models.py prints Table 9.

Ownership handover#

The state holds the authority’s term t and owner w; each owner’s view 𝑣𝑖𝑒𝑤(o) (its term if it believes it owns, else 0); a send counter 𝑠𝑒𝑛𝑡(o); a multiset 𝑛𝑒𝑡 of in-flight writes (o,t′,k); and the set 𝑎𝑐𝑐 of accepted writes, each recorded with the term and owner at the moment of acceptance. 𝖲𝖾𝗇𝖽(o):𝑣𝑖𝑒𝑤(o)>0∧𝑠𝑒𝑛𝑡(o)<S→𝑛𝑒𝑡+=(o,𝑣𝑖𝑒𝑤(o),𝑠𝑒𝑛𝑡(o)),𝑠𝑒𝑛𝑡(o)+=1𝖧𝖺𝗇𝖽𝗈𝗏𝖾𝗋:h<H→t+=1,w:=𝑛𝑒𝑥𝑡(w),𝑣𝑖𝑒𝑤(w):=t,h+=1𝖣𝖾𝗅𝗂𝗏𝖾𝗋(m):m=(o,t′,k)∈𝑛𝑒𝑡→𝑛𝑒𝑡−=m;𝐢𝐟 ¬𝑓𝑒𝑛𝑐𝑒𝑑∨t′=t 𝐭𝐡𝐞𝐧 𝑎𝑐𝑐+=(o,t′,t,w) The invariant is ∀(o,t′,τ,w′)∈𝑎𝑐𝑐:t′=τ∧o=w′. The old owner is never told of the handover, which models a process that keeps running after it has lost ownership.

Effect identity#

The state holds an attempt counter, multisets of in-flight requests and replies, the number of times the effect was applied, a deduplication table, the client’s verdict (𝖯𝖤𝖭𝖣𝖨𝖭𝖦, 𝖠𝖯𝖯𝖫𝖨𝖤𝖣, 𝖭𝖮𝖳_𝖠𝖯𝖯𝖫𝖨𝖤𝖣 or 𝖴𝖭𝖪𝖭𝖮𝖶𝖭) and a duplication budget. 𝖲𝖾𝗇𝖽:𝖯𝖤𝖭𝖣𝖨𝖭𝖦∧a≤R∧(a=0∨𝑟𝑒𝑞=∅)→𝑟𝑒𝑞+=e,a+=1𝖲𝖾𝗋𝗏𝖾(e):e∈𝑟𝑒𝑞→𝑟𝑒𝑞−=e,𝑟𝑒𝑝+=𝗈𝗄;𝐮𝐧𝐥𝐞𝐬𝐬 𝑑𝑒𝑑𝑢𝑝∧e∈𝑡𝑎𝑏𝑙𝑒:𝑎𝑝𝑝𝑙𝑖𝑒𝑑+=1 𝐚𝐧𝐝, 𝐢𝐟 𝑑𝑒𝑑𝑢𝑝,𝑡𝑎𝑏𝑙𝑒+=e𝖣𝗋𝗈𝗉,𝖣𝗎𝗉:lose any in-flight message; duplicate a request while the budget lasts𝖱𝖾𝗉𝗅𝗒:𝗈𝗄∈𝑟𝑒𝑝∧𝖯𝖤𝖭𝖣𝖨𝖭𝖦→𝖠𝖯𝖯𝖫𝖨𝖤𝖣𝖦𝗂𝗏𝖾𝖴𝗉:a>R∧𝑟𝑒𝑞=𝑟𝑒𝑝=∅∧𝖯𝖤𝖭𝖣𝖨𝖭𝖦→𝖭𝖮𝖳_𝖠𝖯𝖯𝖫𝖨𝖤𝖣 or 𝖴𝖭𝖪𝖭𝖮𝖶𝖭 The invariant is 𝑎𝑝𝑝𝑙𝑖𝑒𝑑≤1∧¬(𝖭𝖮𝖳_𝖠𝖯𝖯𝖫𝖨𝖤𝖣∧𝑎𝑝𝑝𝑙𝑖𝑒𝑑>0).

The corpus script#

The command

python3 anc/rg_catalog_eval.py anc/corpus out.json

reads the 140 definition graphs. anc/corpus is a snapshot of the corpus as published on 7 October 2026 at https://reaktor.build/docs/theory/ (no longer published). The script maps relation kinds, port profiles and node kinds to Σstd with the tables of Appendix B, normalises roles and applies the checks of Section 20.1. It writes a summary and up to twelve examples per finding. The mapping tables are part of the script, so the result is reproducible and every judgment can be contested line by line.

C.1 TLA+ templates checked with TLC#

Five protocols that the design relies on are written as TLA+ modules in anc/. Each is a template that the kernel would instantiate for a family or a release (Equation 1):

Each module has a safe configuration and one configuration per design rule it tests, with that rule removed. TLC 2.19, from the TLA+ tools 1.7.4, checks all sixteen configurations, and make tlc reruns them. Table 34 gives the results. Every safe configuration holds over its whole bounded state space, and every unsafe one fails with a short counterexample. The first two modules reach the same verdicts and counterexamples as the Python models of Table 9, and the effect-identity module has the same 87 states. The templates are hand-written today; generating them from the graph is the Q2 2027 work of Table 30.

Table 34. TLC results. States counts the distinct states of a complete search. A search that finds a violation stops there, so only the length of the counterexample is given: Steps is the depth of a complete search, or the number of actions in the counterexample, which TLC’s breadth-first search makes a shortest one.
Module Configuration Invariant Result States Steps
EffectIdentity deduplication, timeout read as UNKNOWN AtMostOnce, NoFalseNegative holds 87 11
no deduplication AtMostOnce violated 4
timeout read as NOT_APPLIED NoFalseNegative violated 8
OwnershipHandover the store fences by epoch OnlyCurrentOwnerWrites holds 326 11
no fencing OnlyCurrentOwnerWrites violated 3
sender checks its lease, no fencing OnlyCurrentOwnerWrites violated 3
RegionRelease fence and drain NoWriteFromRetired, NoLostCallWrite holds 3,858 17
no fence NoWriteFromRetired violated 6
no drain NoLostCallWrite violated 4
OutboxChannel atomic outbox, deduplication AtMostOnce, NoLostEffect holds 130 11
effect and outbox written separately NoLostEffect violated 1
no deduplication AtMostOnce violated 5
GraphWatch starting cursor checked, epoch in the cursor, merging by addition Truthful holds 2,676 25
starting cursor not checked Truthful violated 6
cursor without the epoch Truthful violated 11
merging keeps the latest delta Truthful violated 5

Effect identity#

Listing 25 transcribes the effect-identity model of Table 9. The variables are the client’s attempt count, the requests and replies in flight (all copies of one effect), the number of times the effect was applied, whether the server has recorded the effect identity, the client’s verdict, and the duplication budget. Without deduplication, TLC finds send, serve, retry, serve. When a timeout is read as “not applied”, it finds a run that serves the request, loses the reply and both retries, and gives up with a false verdict.

---------------------------- MODULE EffectIdentity ----------------------------
EXTENDS Naturals

CONSTANTS MaxRetries, MaxDups, Dedup, TimeoutMeansUnknown

VARIABLES attempts, req, rep, applied, seen, verdict, dups

vars == <<attempts, req, rep, applied, seen, verdict, dups>>

Init ==
    /\ attempts = 0
    /\ req = 0
    /\ rep = 0
    /\ applied = 0
    /\ seen = FALSE
    /\ verdict = "PENDING"
    /\ dups = 0

Send ==
    /\ verdict = "PENDING"
    /\ attempts <= MaxRetries
    /\ (attempts = 0 \/ req = 0)
    /\ req' = req + 1
    /\ attempts' = attempts + 1
    /\ UNCHANGED <<rep, applied, seen, verdict, dups>>

Serve ==
    /\ req > 0
    /\ req' = req - 1
    /\ rep' = rep + 1
    /\ IF Dedup /\ seen
          THEN UNCHANGED <<applied, seen>>
          ELSE (applied' = applied + 1 /\ seen' = TRUE)
    /\ UNCHANGED <<attempts, verdict, dups>>

DropRequest ==
    /\ req > 0
    /\ req' = req - 1
    /\ UNCHANGED <<attempts, rep, applied, seen, verdict, dups>>

DropReply ==
    /\ rep > 0
    /\ rep' = rep - 1
    /\ UNCHANGED <<attempts, req, applied, seen, verdict, dups>>

Duplicate ==
    /\ req > 0
    /\ dups < MaxDups
    /\ req' = req + 1
    /\ dups' = dups + 1
    /\ UNCHANGED <<attempts, rep, applied, seen, verdict>>

Reply ==
    /\ rep > 0
    /\ verdict = "PENDING"
    /\ rep' = rep - 1
    /\ verdict' = "APPLIED"
    /\ UNCHANGED <<attempts, req, applied, seen, dups>>

GiveUp ==
    /\ verdict = "PENDING"
    /\ attempts > MaxRetries
    /\ req = 0
    /\ rep = 0
    /\ verdict' = IF TimeoutMeansUnknown THEN "UNKNOWN" ELSE "NOT_APPLIED"
    /\ UNCHANGED <<attempts, req, rep, applied, seen, dups>>

Next == Send \/ Serve \/ DropRequest \/ DropReply \/ Duplicate \/ Reply \/ GiveUp

Spec == Init /\ [][Next]_vars

AtMostOnce == applied <= 1

NoFalseNegative == ~(verdict = "NOT_APPLIED" /\ applied > 0)

Safety == AtMostOnce /\ NoFalseNegative
=============================================================================

Listing 25.

The Session call with effect identity, in TLA+.

Ownership handover#

Listing 26 is the handover model of Table 9: the authority’s term and owner, each owner’s view of its own term, writes in flight, and the writes the store accepted, each with the term and owner at the moment of acceptance. The old owner is never told of a handover. Without fencing, TLC finds: the owner sends a write, ownership passes, and the delayed write is accepted. The same three steps defeat a sender that checks its lease before every write, because the check happens before the delay. Only the store, which sees the write when it commits, can refuse it. This is why atomic(store) checks epochs inside the store’s transaction.

-------------------------- MODULE OwnershipHandover --------------------------
EXTENDS Naturals

CONSTANTS Owners, First, MaxSends, MaxHandovers, Fenced, SenderChecks

VARIABLES term, owner, view, sent, net, accepted, handovers

vars == <<term, owner, view, sent, net, accepted, handovers>>

Init ==
    /\ term = 1
    /\ owner = First
    /\ view = [o \in Owners |-> IF o = First THEN 1 ELSE 0]
    /\ sent = [o \in Owners |-> 0]
    /\ net = {}
    /\ accepted = {}
    /\ handovers = 0

Send(o) ==
    /\ view[o] > 0
    /\ sent[o] < MaxSends
    /\ SenderChecks => view[o] = term
    /\ net' = net \cup {[from |-> o, epoch |-> view[o], seq |-> sent[o]]}
    /\ sent' = [sent EXCEPT ![o] = @ + 1]
    /\ UNCHANGED <<term, owner, view, accepted, handovers>>

Handover ==
    /\ handovers < MaxHandovers
    /\ LET heir == CHOOSE p \in Owners : p # owner
       IN /\ owner' = heir
          /\ term' = term + 1
          /\ view' = [view EXCEPT ![heir] = term + 1]
    /\ handovers' = handovers + 1
    /\ UNCHANGED <<sent, net, accepted>>

Deliver(m) ==
    /\ net' = net \ {m}
    /\ IF Fenced => m.epoch = term
          THEN accepted' = accepted \cup
                 {[from |-> m.from, epoch |-> m.epoch, term |-> term, owner |-> owner]}
          ELSE UNCHANGED accepted
    /\ UNCHANGED <<term, owner, view, sent, handovers>>

Next ==
    \/ \E o \in Owners : Send(o)
    \/ Handover
    \/ \E m \in net : Deliver(m)

Spec == Init /\ [][Next]_vars

OnlyCurrentOwnerWrites ==
    \A a \in accepted : a.epoch = a.term /\ a.from = a.owner
=============================================================================

Listing 26.

Ownership handover with fencing at the store, in TLA+.

Outbox and channel#

Listing 27 follows one producer, a relay and a consumer. The relay publishes each outbox record at least once and the broker may redeliver it. The consumer records each effect identity together with the effect it applies. NoLostEffect says that once nothing is pending, every committed effect has been applied once. Writing the effect and the outbox record in separate transactions loses an effect after a single step: the effect commits, and the record is never written. Without deduplication, one redelivery applies an effect twice.

---------------------------- MODULE OutboxChannel ----------------------------
EXTENDS Naturals

CONSTANTS Effects, MaxExtra, Atomic, Dedup

VARIABLES committed, outbox, channel, applied, seen, extra

vars == <<committed, outbox, channel, applied, seen, extra>>

Init ==
    /\ committed = {}
    /\ outbox = {}
    /\ channel = [e \in Effects |-> 0]
    /\ applied = [e \in Effects |-> 0]
    /\ seen = {}
    /\ extra = 0

Commit(e) ==
    /\ e \notin committed
    /\ committed' = committed \cup {e}
    /\ outbox' = outbox \cup {e}
    /\ UNCHANGED <<channel, applied, seen, extra>>

CommitWithoutOutbox(e) ==
    /\ ~Atomic
    /\ e \notin committed
    /\ committed' = committed \cup {e}
    /\ UNCHANGED <<outbox, channel, applied, seen, extra>>

Relay(e) ==
    /\ e \in outbox
    /\ channel' = [channel EXCEPT ![e] = @ + 1]
    /\ outbox' = outbox \ {e}
    /\ UNCHANGED <<committed, applied, seen, extra>>

RelayAgain(e) ==
    /\ e \in outbox
    /\ extra < MaxExtra
    /\ channel' = [channel EXCEPT ![e] = @ + 1]
    /\ extra' = extra + 1
    /\ UNCHANGED <<committed, outbox, applied, seen>>

Redeliver(e) ==
    /\ channel[e] > 0
    /\ extra < MaxExtra
    /\ channel' = [channel EXCEPT ![e] = @ + 1]
    /\ extra' = extra + 1
    /\ UNCHANGED <<committed, outbox, applied, seen>>

Consume(e) ==
    /\ channel[e] > 0
    /\ channel' = [channel EXCEPT ![e] = @ - 1]
    /\ IF Dedup /\ e \in seen
          THEN UNCHANGED <<applied, seen>>
          ELSE /\ applied' = [applied EXCEPT ![e] = @ + 1]
               /\ seen' = seen \cup {e}
    /\ UNCHANGED <<committed, outbox, extra>>

Next ==
    \E e \in Effects :
        \/ Commit(e) \/ CommitWithoutOutbox(e)
        \/ Relay(e) \/ RelayAgain(e) \/ Redeliver(e)
        \/ Consume(e)

Spec == Init /\ [][Next]_vars

Quiescent == outbox = {} /\ \A e \in Effects : channel[e] = 0

AtMostOnce == \A e \in Effects : applied[e] <= 1

NoLostEffect == Quiescent => \A e \in committed : applied[e] = 1
=============================================================================

Listing 27.

A Channel fed by a transactional outbox, in TLA+.

Watching a view#

Listing 28 models one subscription of Section 12.4. The producer commits, sends single deltas or one merged delta while it has credit, and may drop deltas when it has none. The connection can be lost, and the producer can restart under a new epoch with an empty log. The subscriber applies a delta only if it starts at the subscriber’s cursor, and otherwise asks for a reset. On reconnection the producer resumes from the subscriber’s cursor or sends a reset. Truthful says that the subscriber’s copy is the producer’s state at some cursor of one epoch. Three configurations each remove one rule. Without the check of the starting cursor, TLC finds: two commits, a drop, a credit, a send, and a delivery that leaves a hole. Without the epoch in the cursor, the subscriber resumes after a restart at a position of the new epoch and mixes the two. When a merged delta keeps only the latest change, the first change is lost.

------------------------------ MODULE GraphWatch ------------------------------
EXTENDS Naturals, Sequences

CONSTANTS MaxCommits, MaxEpoch, MaxCredit, MaxDisconnects,
          Contiguous, EpochInCursor, ConflateBySum

VARIABLES epoch, head, sent, credit, net, connected, disconnects,
          cep, ccur, cstate, stale

link == <<net, connected, disconnects>>
client == <<cep, ccur, cstate, stale>>
vars == <<epoch, head, sent, credit, link, client>>

Prefix(ep, n) == {<<ep, j>> : j \in 1..n}

Delta(from, to, adds) ==
    [kind |-> "delta", ep |-> epoch, from |-> from, to |-> to, adds |-> adds]

Reset ==
    [kind |-> "reset", ep |-> epoch, from |-> 0, to |-> head, adds |-> Prefix(epoch, head)]

Init ==
    /\ epoch = 0 /\ head = 0 /\ sent = 0 /\ credit = 0
    /\ net = <<>> /\ connected = TRUE /\ disconnects = 0
    /\ cep = 0 /\ ccur = 0 /\ cstate = {} /\ stale = FALSE

Commit ==
    /\ head < MaxCommits
    /\ head' = head + 1
    /\ UNCHANGED <<epoch, sent, credit, link, client>>

Grant ==
    /\ connected /\ credit < MaxCredit
    /\ credit' = credit + 1
    /\ UNCHANGED <<epoch, head, sent, link, client>>

Send ==
    /\ connected /\ credit > 0 /\ sent < head
    /\ net' = Append(net, Delta(sent, sent + 1, {<<epoch, sent + 1>>}))
    /\ sent' = sent + 1
    /\ credit' = credit - 1
    /\ UNCHANGED <<epoch, head, connected, disconnects, client>>

SendMerged ==
    /\ connected /\ credit > 0 /\ sent + 1 < head
    /\ net' = Append(net, Delta(sent, head,
                IF ConflateBySum THEN {<<epoch, j>> : j \in (sent + 1)..head}
                                 ELSE {<<epoch, head>>}))
    /\ sent' = head
    /\ credit' = credit - 1
    /\ UNCHANGED <<epoch, head, connected, disconnects, client>>

Drop ==
    /\ connected /\ credit = 0 /\ sent < head
    /\ sent' = sent + 1
    /\ UNCHANGED <<epoch, head, credit, link, client>>

Accepts(m) ==
    /\ ~stale
    /\ Contiguous => m.from = ccur
    /\ EpochInCursor => m.ep = cep

Receive ==
    /\ net # <<>>
    /\ net' = Tail(net)
    /\ LET m == Head(net) IN
         IF m.kind = "reset" \/ Accepts(m)
            THEN /\ cstate' = IF m.kind = "reset" THEN m.adds ELSE cstate \cup m.adds
                 /\ ccur' = m.to
                 /\ cep' = m.ep
                 /\ stale' = FALSE
            ELSE /\ stale' = TRUE
                 /\ UNCHANGED <<cep, ccur, cstate>>
    /\ UNCHANGED <<epoch, head, sent, credit, connected, disconnects>>

Resync ==
    /\ connected /\ stale
    /\ \A i \in 1..Len(net) : net[i].kind # "reset"
    /\ net' = Append(net, Reset)
    /\ sent' = head
    /\ UNCHANGED <<epoch, head, credit, connected, disconnects, client>>

Disconnect ==
    /\ connected /\ disconnects < MaxDisconnects
    /\ connected' = FALSE /\ net' = <<>> /\ credit' = 0
    /\ disconnects' = disconnects + 1
    /\ UNCHANGED <<epoch, head, sent, client>>

Restart ==
    /\ epoch < MaxEpoch
    /\ epoch' = epoch + 1 /\ head' = 0 /\ sent' = 0 /\ credit' = 0
    /\ net' = <<>> /\ connected' = FALSE
    /\ UNCHANGED <<disconnects, client>>

Resume ==
    /\ ~connected
    /\ connected' = TRUE
    /\ IF ~stale /\ (EpochInCursor => cep = epoch) /\ ccur <= head
          THEN /\ sent' = ccur
               /\ net' = <<>>
          ELSE /\ sent' = head
               /\ net' = <<Reset>>
    /\ UNCHANGED <<epoch, head, credit, disconnects, client>>

Next ==
    \/ Commit \/ Grant \/ Send \/ SendMerged \/ Drop \/ Receive
    \/ Resync \/ Disconnect \/ Restart \/ Resume

Spec == Init /\ [][Next]_vars

Truthful == \E ep \in 0..MaxEpoch : cstate = Prefix(ep, ccur)
=============================================================================

Listing 28.

A watch of RGP, in TLA+.