Engine

8.5. The fast check and the reasons🔗

The engine checks an invariant on the events of a batch instead of the whole store; the reference append and the append that names its reason agree with the yes/no append.

🔗def
Spec.Inv.fastCheck (world : World) (store es : List Event) : Spec.Inv → Bool
Spec.Inv.fastCheck (world : World) (store es : List Event) : Spec.Inv → Bool

What the engine checks when events es of one entity are appended to that entity's events store: only what they can change. One key: the histories of the appended keys. Grouped: the groups the appended keys were in before or are in after (every group whose count changes is one of them); a group whose count drops to 0 no longer exists. Equal to the full check if the invariant held on store (Invariants.lean, Inv.the_fast_check_agrees_with_the_full_check).

🔗def
Spec.rejectionByRules (rules : List (String × Rule)) (store : List Event) (e : Event) : Option Reason
Spec.rejectionByRules (rules : List (String × Rule)) (store : List Event) (e : Event) : Option Reason

The first rule that rejects e appended to store: preconditions first, then invariants, each in the order of rules.

🔗def
Spec.SameKeyHistories (s t : List Event) : Prop
Spec.SameKeyHistories (s t : List Event) : Prop

Two stores are equivalent if every key of every entity has the same history: they differ only in how events of different keys interleave.