The Authority kernel models a single authoritative server that accepts or rejects client requests through a versioned protocol. It proves that the server state always satisfies the domain invariant — independent of client correctness. Clients may apply actions optimistically, but the server evolves only through verified transitions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/metareflection/dafny-replay/llms.txt
Use this file to discover all available pages before exploring further.
ServerState
Protocol operations
Dispatch
Dispatch is the core protocol operation. It accepts or rejects a client request based on version freshness and domain validity:
Stale version
The client’s version does not match the server’s. The server rejects with
Failure(Stale) and returns its current version. The client must call Sync to refresh before retrying.Invalid action
The version matches but
TryStep returns Invalid(msg). The server rejects with Failure(InvalidAction(msg)). State is unchanged.Sync
Sync is a read-only snapshot of the current server state:
Sync after a stale rejection to get the latest version and model, then rebase their pending actions.
Response types
Domain obligations
To use the Authority kernel, a concrete domain must prove two lemmas:A1 — Initial state satisfies the invariant
A1 — Initial state satisfies the invariant
D.Init(). This lemma seeds the proof.A2 — Successful transitions preserve the invariant
A2 — Successful transitions preserve the invariant
TryStep results need to preserve Inv. Failed results leave the state unchanged, so no proof is needed for those paths.Kernel theorems
These properties are proved once in the generic kernel assuming A1 and A2:AK1 — Server invariant is preserved across all protocol interactions
AK1 — Server invariant is preserved across all protocol interactions
The main preservation lemma proves that The proof branches on all three paths in
Dispatch keeps SInv no matter what the client sends:Dispatch. Stale and invalid cases leave state unchanged; the valid case invokes TryStepOkPreservesInv.Stated at the trace level: for any protocol trace involving arbitrary client behavior, the authoritative server state always satisfies Inv.AK2 — Rejected requests leave server state unchanged
AK2 — Rejected requests leave server state unchanged
Both
Failure(Stale) and Failure(InvalidAction(...)) return the original s unchanged. This is structural — it follows directly from the Dispatch definition.Initialization
InitServerSatisfiesSInv lemma is proved immediately from A1.
Relationship to Multi-Collaboration
The Authority kernel is intentionally minimal. It models a single authoritative state and a simple versioned protocol. It does not handle:- clients that submit actions based on stale versions without first resyncing,
- rebasing or candidate fallback for concurrent edits,
- offline clients and their pending queues.
Server-side safety is independent of client correctness. Even if a client sends arbitrary or malformed requests, the server state never violates the domain invariant.
Integration boundary (trusted)
- Networking, authentication, and authorization
- Database persistence and concurrency beyond the modeled protocol
- JavaScript/edge function wiring
- End-to-end liveness
Related pages
Replay kernel
The local undo/redo kernel that the Authority kernel extends conceptually.
Multi-Collaboration kernel
Generalizes Authority with rebasing, offline support, and minimal rejection.
Domain obligations guide
How to write A1 and A2 for your concrete domain.
Counter authority app
Minimal working example of the Authority kernel with a counter domain.