preludes / workflow-laws.lisp
workflow-laws
Workflow and evidence safety laws. Finite workflow domains, initial states, transitions, and safety laws for bounded fixed-point exploration.
Bootstrap it with compiler.lisp, separately from the ontology stack. Bounded exploration checks finite models only.
From the source
Purpose: Finite workflow and evidence safety law declarations for bounded fixed-point verification (RFC 0028 Stage 1). Requires: compiler.lisp; bootstrap separately from the ontology stack. Used by: the Forma bounded workflow explorer (browser-safe).
Forms 5
Keywords this prelude adds. Each is a form descriptor: its slots, their types, and the IR it produces.
(domain name values)workflow-laws.lisp:38
Declares a finite value domain (enum or finite list of ground values) over which transition parameters range during bounded exploration.
| Slot | Type |
|---|---|
| name | Symbol |
| values | Syntax |
Produces WorkflowDomainIR
Example
(workflow-model Minimal
(domain Revision ["v1" "v2"])
(initial {:revision "v1"})
(transition advance
:guard (= state.revision "v1")
:update (assoc state :revision "v2"))
(law valid-revision
:holds (or (= state.revision "v1") (= state.revision "v2"))))(initial expr)workflow-laws.lisp:54
Declares an initial finite state expression for bounded reachable-state exploration. Multiple initial forms define multiple starting states.
| Slot | Type |
|---|---|
| expr | Syntax |
Produces WorkflowInitialIR
Example
(workflow-model Minimal
(domain Revision ["v1" "v2"])
(initial {:revision "v1"})
(transition advance
:guard (= state.revision "v1")
:update (assoc state :revision "v2"))
(law valid-revision
:holds (or (= state.revision "v1") (= state.revision "v2"))))(transition name {:keys [params guard update]})workflow-laws.lisp:70
Declares a named workflow transition with optional finite parameter bindings, a pure decidable :guard predicate, and a pure :update state expression.
| Slot | Type |
|---|---|
| name | Symbol |
| params | (Option Syntax) |
| guard | (Option Syntax) |
| update | Syntax |
Produces WorkflowTransitionIR
Example
(workflow-model Minimal
(domain Worker ["w1" "w2"])
(initial {:active "none"})
(transition claim
:params {:worker Worker}
:guard (= state.active "none")
:update (assoc state :active worker))
(law known-worker
:holds (or (= state.active "none") (= state.active "w1") (= state.active "w2"))))(law name {:keys [when holds description]})workflow-laws.lisp:90
Declares a safety invariant over reachable workflow states. When :when is supplied, :holds is checked whenever :when is true, and a law whose :when premise never holds in any reachable state is reported as vacuous.
| Slot | Type |
|---|---|
| name | Symbol |
| when | (Option Syntax) |
| holds | Syntax |
| description | (Option String) |
Produces WorkflowLawIR
Example
(workflow-model Minimal
(initial {:released false :authorized false})
(transition authorize
:guard (not state.authorized)
:update (assoc state :authorized true))
(transition release
:guard state.authorized
:update (assoc state :released true))
(law release-requires-auth
:description "Every release must be authorized."
:when state.released
:holds state.authorized))(workflow-model name {:keys [assumptions]} item ...)workflow-laws.lisp:114
Groups finite domains, initial states, transitions, and safety laws into a bounded verification model for fixed-point reachable-state exploration.
| Slot | Type |
|---|---|
| name | (Declares WorkflowModelDecl) |
| assumptions | (Option (List String)) |
| item | (List workflow-item) |
Produces WorkflowModelIR
Example
(workflow-model Minimal
:assumptions ["Finite two-revision model; no unbounded clock."]
(domain Revision ["v1" "v2"])
(initial {:revision "v1"})
(transition advance
:guard (= state.revision "v1")
:update (assoc state :revision "v2"))
(law valid-revision
:holds (or (= state.revision "v1") (= state.revision "v2"))))Types 6
Payload contracts and IR shapes, shown as authored.
WorkflowDomainIRworkflow-laws.lisp:9
(type WorkflowDomainIR
{:kind "WorkflowDomain" :name Symbol :values RuntimeExpr})WorkflowInitialIRworkflow-laws.lisp:12
(type WorkflowInitialIR
{:kind "WorkflowInitial" :expr RuntimeExpr})WorkflowTransitionIRworkflow-laws.lisp:15
(type WorkflowTransitionIR
{:kind "WorkflowTransition"
:name Symbol
:params (Option RuntimeExpr)
:guard (Option RuntimeExpr)
:update RuntimeExpr})WorkflowLawIRworkflow-laws.lisp:22
(type WorkflowLawIR
{:kind "WorkflowLaw"
:name Symbol
:when (Option RuntimeExpr)
:holds RuntimeExpr
:description (Option String)})workflow-itemworkflow-laws.lisp:29
(type workflow-item
(Union WorkflowDomainIR WorkflowInitialIR WorkflowTransitionIR WorkflowLawIR))WorkflowModelIRworkflow-laws.lisp:32
(type WorkflowModelIR
{:kind "WorkflowModel"
:name Symbol
:assumptions (Option (List String))
:items (List workflow-item)})