PrismDevRelOpen the app
Examples: MCP task lifecycle

Overview

Example apps

Decision tables

Rule 30 cellStrike dieWise deferralCurrent supportHeader workPlant attunementCapability routePublish gateProposal admissionCompression admissionQuorum commitAddress admissionDataflow policyDraft admissionCoded matmul admissionUTQC row honestyCalculator protocolRequantization clampJCS NFC admissionTwo-seed barDocs sync

Policy decisions

Open policyNamespace authorizationAxiom policyGNAF claim wordingEmporous admissionPortal publication

State machines

MCP task lifecycleContainer lifecycleAtlas walk controlsVault escrow lifecycleRelease lifecycleOrganization lifecycle

// example · State machines

MCP task lifecycle

Find an MCP task's next state, so a client that polls, updates or cancels it always sees the state the protocol would write.

Inspired by UOR-Foundation/MCP. The Model Context Protocol 2026-07-28 server core in LexLean, with its tasks-extension state machine.

Pattern: State machine, OMG UML 2.5.1 behavioral state machine. To write one of your own, follow How to build a state machine app.

The MCP task lifecycle state machine5 nodes and 13 links. working REQ-007 input-required; working otherwise working; working 2 rules completed; working 2 rules failed; working REQ-006 cancelled; input-required 2 rules input-required; input-required REQ-013 working; input-required REQ-011 completed; input-required REQ-012 failed; input-required REQ-006 cancelled; completed REQ-001 completed; failed REQ-002 failed; cancelled REQ-003 cancelled.workingstartinput-requiredcompletedendfailedendcancelledendREQ-007otherwise2 rules2 rulesREQ-0062 rulesREQ-013REQ-011REQ-012REQ-006REQ-001REQ-002REQ-003The MCP task lifecycle state machine5 nodes and 13 links. working REQ-007 input-required; working otherwise working; working 2 rules completed; working 2 rules failed; working REQ-006 cancelled; input-required 2 rules input-required; input-required REQ-013 working; input-required REQ-011 completed; input-required REQ-012 failed; input-required REQ-006 cancelled; completed REQ-001 completed; failed REQ-002 failed; cancelled REQ-003 cancelled.workinginput-requiredcompletedfailedcancelled
The MCP task lifecycle state machine. Each box is a state and each arrow a step a rule can take. A run starts at working and stops at completed or failed or cancelled. Dashed arrows go back to an earlier state.
The data in this figure
FromLinkTo
workingREQ-007input-required
workingotherwiseworking
working2 rulescompleted
working2 rulesfailed
workingREQ-006cancelled
input-required2 rulesinput-required
input-requiredREQ-013working
input-requiredREQ-011completed
input-requiredREQ-012failed
input-requiredREQ-006cancelled
completedREQ-001completed
failedREQ-002failed
cancelledREQ-003cancelled
Fingerprint
00ce88fdafb529dc1c82235c10eed269fdf603522d110588aae65f582aa14606
Acceptance vectors
65
Claims
12

Verified by prismpm verify in the pinned SDK when this site was built.

    The prompt

    This is the whole input. Raw JSON · Open it in the builder · Download the app (.zip)

    The prompt 728 lines
    {
      "schema": "prism/prompt/1",
      "pattern": "stateMachine",
      "machine": {
        "state": "state",
        "initial": "working",
        "final": [
          "completed",
          "failed",
          "cancelled"
        ]
      },
      "goal": "Find an MCP task's next state, so a client that polls, updates or cancels it always sees the state the protocol would write.",
      "repository": "UOR-Foundation/MCP",
      "app": {
        "name": "mcp-task-lifecycle",
        "title": "MCP task lifecycle",
        "purpose": "Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered.",
        "limits": [
          "It does not create a task: a task starts working, as the seed of its tool's plan, when tools/call decides to answer a task.",
          "It does not expire a task: a task past its ttlMs is dropped from the host's table by the next request, outside this step.",
          "It does not check the host's clock or table; the host owes the core exactly the table it was given."
        ],
        "fields": [
          {
            "name": "state",
            "kind": "choice",
            "values": [
              "working",
              "input-required",
              "completed",
              "failed",
              "cancelled"
            ],
            "means": "the task's current status, as DetailedTask in src/Tasks.lex.tex"
          },
          {
            "name": "event",
            "kind": "choice",
            "values": [
              "settle",
              "answer",
              "cancel"
            ],
            "means": "the step: settle (tasks/get), answer (tasks/update with every given key) or cancel (tasks/cancel)"
          },
          {
            "name": "asks",
            "kind": "choice",
            "values": [
              "yes",
              "no"
            ],
            "means": "whether the task's plan still holds input requests to park on (parkedPlan empties them once it parks)"
          },
          {
            "name": "elapsed",
            "kind": "number",
            "min": 0,
            "means": "milliseconds since the task was created, now_ms less createdMs"
          },
          {
            "name": "deadline",
            "kind": "number",
            "min": 0,
            "means": "milliseconds after creation the plan's next step is due: parkAfterMs when it asks, finishAfterMs otherwise"
          },
          {
            "name": "outcome",
            "kind": "choice",
            "values": [
              "completes",
              "fails"
            ],
            "means": "how the plan concludes: PlanOutcome.completes with a result or PlanOutcome.fails with a JSON-RPC error"
          },
          {
            "name": "remaining",
            "kind": "number",
            "min": 0,
            "means": "input keys still unanswered after this answer"
          }
        ],
        "outcomes": [
          "working",
          "input-required",
          "completed",
          "failed",
          "cancelled"
        ],
        "meanings": {
          "working": "the task is running; tasks/get answers status working",
          "input-required": "the task waits for the client to answer its inputRequests through tasks/update",
          "completed": "terminal: the plan's result is the task's result",
          "failed": "terminal: the task carries the plan's JSON-RPC error",
          "cancelled": "terminal: the client cancelled the task before it finished"
        },
        "rules": [
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "completed"
              }
            ],
            "then": "completed",
            "why": "src/Tasks.lex.tex: settle, answer and cancel keep a completed entry (kept entry)"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "failed"
              }
            ],
            "then": "failed",
            "why": "src/Tasks.lex.tex: a failed task is terminal (isTerminal), and every step keeps it"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "cancelled"
              }
            ],
            "then": "cancelled",
            "why": "src/Tasks.lex.tex: a cancelled task is terminal, and every step keeps it"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "no"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.cancel settles first: work that finished before the cancel stays completed (TASKS.md, What a task does)"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "no"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.cancel settles first: work that failed before the cancel stays failed"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "cancelled",
            "why": "Tasks.cancelSettled: a working or input_required task becomes cancelled"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "yes"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "input-required",
            "why": "Tasks.settleWorking: a plan that parks moves to input_required once parkAfterMs has passed"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.settleWorking: with nothing to ask, the task concludes once finishAfterMs has passed (Tasks.due)"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.concluded: a plan that fails gives a failed task with its JSON-RPC error"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "asks",
                "op": "is",
                "value": "yes"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "input-required",
            "why": "Tasks.resume settles at once: a plan that still asks parks again"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.answerInput: the last key answered resumes the task, which settles at once and completes if due"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.answerInput: the last key answered resumes the task, which settles at once and fails if due"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              }
            ],
            "then": "working",
            "why": "Tasks.resume: with every key answered and nothing due, the task returns to working"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              }
            ],
            "then": "input-required",
            "why": "Tasks.settle keeps an input_required task, and answerInput keeps it while any key remains"
          }
        ],
        "otherwise": "working",
        "otherwiseWhy": "src/Tasks.lex.tex: a working task whose next step is not yet due, or that is answered, is kept as it is",
        "properties": [
          {
            "kind": "never",
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "working",
            "why": "TASKS.md: a cancel never leaves a task running"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "input-required",
            "why": "a cancel never leaves a task waiting for input"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": "<",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "completed",
            "why": "Tasks.due: no work concludes before finishAfterMs has passed"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": "<",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "failed",
            "why": "Tasks.due: no work fails before finishAfterMs has passed"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "remaining",
                "op": ">=",
                "value": 1
              }
            ],
            "then": "working",
            "why": "Tasks.answerInput: a task resumes only once every key is answered"
          },
          {
            "kind": "always",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              }
            ],
            "then": "input-required",
            "why": "Tasks.settle: settling a task that waits for input changes nothing"
          }
        ],
        "examples": [
          {
            "request": "working settle no 1500 1000 completes 0",
            "response": "completed"
          },
          {
            "request": "working settle yes 500 1000 completes 0",
            "response": "working"
          },
          {
            "request": "working settle yes 1000 1000 completes 0",
            "response": "input-required"
          },
          {
            "request": "working settle no 2000 1000 fails 0",
            "response": "failed"
          },
          {
            "request": "input-required answer no 2000 5000 completes 1",
            "response": "input-required"
          },
          {
            "request": "input-required answer no 2000 5000 completes 0",
            "response": "working"
          },
          {
            "request": "input-required answer no 6000 5000 fails 0",
            "response": "failed"
          },
          {
            "request": "working cancel no 2000 1000 completes 0",
            "response": "completed"
          },
          {
            "request": "working cancel yes 10 1000 completes 0",
            "response": "cancelled"
          },
          {
            "request": "completed cancel no 0 0 completes 0",
            "response": "completed"
          },
          {
            "request": "working settle",
            "response": "invalid"
          }
        ]
      },
      "stakeholders": [
        {
          "name": "MCP client author",
          "text": "Polls a task through tasks/get, answers it through tasks/update and cancels it through tasks/cancel, and needs every answer to be the state the protocol allows.",
          "concerns": [
            "Correct answers",
            "Proved guarantees"
          ]
        },
        {
          "name": "Host adapter author",
          "text": "Holds the task table between requests for the stateless core (PrismPM issue 216) and needs a finished task to stay finished whatever arrives next.",
          "concerns": [
            "Terminal tasks stay terminal",
            "Refused malformed requests"
          ]
        }
      ],
      "concerns": [
        {
          "name": "Terminal tasks stay terminal",
          "text": "A completed, failed or cancelled task is never moved again by settle, answer or cancel.",
          "model": "quality"
        }
      ],
      "components": [
        {
          "name": "MCP client",
          "text": "The client that declares io.modelcontextprotocol/tasks in its request _meta and calls tasks/get, tasks/update and tasks/cancel.",
          "kind": "externalSystem"
        },
        {
          "name": "Host adapter",
          "text": "PrismPM's adapter (issue 216): it sends now_ms, the fresh task id and the task table in every request frame and stores the table the core returns.",
          "kind": "service"
        },
        {
          "name": "MCP conformance suite",
          "text": "modelcontextprotocol/conformance at cf022cbb, whose tasks scenarios drive the conformance build.",
          "kind": "externalSystem"
        }
      ],
      "threats": [
        {
          "name": "Terminal task revived",
          "text": "A step moves a completed, failed or cancelled task back to working, so a client sees finished work run again.",
          "stride": "tampering",
          "asset": "answer",
          "likelihood": "low",
          "impact": "critical",
          "control": {
            "name": "Final states proved",
            "text": "The machine declares completed, failed and cancelled final; the builder checks every sampled step keeps them and Lean proves it for every request.",
            "evidence": [
              {
                "kind": "proof",
                "reference": "McpTaskLifecycleProofs::inv007Holds"
              },
              {
                "kind": "review",
                "reference": "MCP src/TaskLaws.lex.tex"
              }
            ]
          }
        },
        {
          "name": "Cancel hides finished work",
          "text": "A cancel that arrives after the work finished reports cancelled, and the client loses a result it was owed.",
          "stride": "repudiation",
          "asset": "answer",
          "likelihood": "medium",
          "impact": "major",
          "control": {
            "name": "Settle before cancel",
            "text": "tasks/cancel settles first, so work already due concludes and the cancel leaves it.",
            "evidence": [
              {
                "kind": "proof",
                "reference": "McpTaskLifecycleProofs::inv001Holds"
              },
              {
                "kind": "gate",
                "reference": "MCP crates/lifecycle-oracle/tests/tasks.rs TK-01 to TK-16"
              }
            ]
          }
        },
        {
          "name": "Host clock or table substituted",
          "text": "The host sends a clock that runs backward or a table other than the one it was given, so a task concludes early or reappears.",
          "stride": "tampering",
          "asset": "request",
          "likelihood": "low",
          "impact": "major",
          "accepted": "The core keeps no state by design; TASKS.md puts the clock and the table in the host's custody, and the host owes the core exactly what it was given."
        }
      ],
      "quality": [
        {
          "characteristic": "Functional suitability",
          "subcharacteristic": "Functional correctness",
          "requirement": "Every step matches the core",
          "text": "Each acceptance vector answers the state Tasks.settle, Tasks.answer or Tasks.cancel writes.",
          "measure": "Vectors that disagree",
          "measureText": "Acceptance vectors whose replayed answer differs from the expected next state.",
          "threshold": 0
        },
        {
          "characteristic": "Reliability",
          "subcharacteristic": "Faultlessness",
          "requirement": "No final state is left",
          "text": "No step takes a completed, failed or cancelled task to another state.",
          "measure": "Final states left",
          "measureText": "Sampled steps from a final state whose answer is another state.",
          "threshold": 0
        }
      ],
      "journeys": [
        {
          "stakeholder": "MCP client author",
          "steps": [
            "otherwise",
            "REQ-007",
            "REQ-013",
            "REQ-008",
            "INV-005"
          ]
        },
        {
          "stakeholder": "Host adapter author",
          "steps": [
            "REQ-001",
            "REQ-006",
            "INV-007",
            "refuse"
          ]
        }
      ],
      "axioms": {
        "inv001Holds": [
          "Classical.choice",
          "Quot.sound",
          "propext"
        ],
        "inv002Holds": [
          "Classical.choice",
          "Quot.sound",
          "propext"
        ]
      },
      "license": "MIT OR Apache-2.0"
    }

    What the app claims

    Each claim is a row in model/ids.toml, a scenario and a test, and a theorem the Lean kernel checks. The claims are quoted as the model states them.

    What the app claims 12 items
    • MT-01 The app never answers working when event is cancel
    • MT-02 The app never answers input-required when event is cancel
    • MT-03 The app never answers completed when state is working and elapsed is below deadline
    • MT-04 The app never answers failed when state is working and elapsed is below deadline
    • MT-05 The app never answers working when state is input-required and event is answer and remaining is at least 1
    • MT-06 The app always answers input-required when state is input-required and event is settle
    • MT-07 The app always answers completed when state is completed
    • MT-08 The app always answers failed when state is failed
    • MT-09 The app always answers cancelled when state is cancelled
    • MT-10 The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
    • MT-11 The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
    • MT-12 Every compliance obligation is numbered in order and names its evidence

    Pattern

    State machine: OMG UML 2.5.1 behavioral state machine. The answer is the next state, given the current state and an event. This is a UML state machine written as one pure function. The state travels in the request, so the app keeps nothing between requests. The builder proves what holds over every run.

    PatternStandardAnswers
    State machineOMG UML 2.5.1 behavioral state machineworking, input-required, completed, failed, cancelled
    Rules for each answerworking: 1 rules; input-required: 3 rules; completed: 4 rules; failed: 4 rules; cancelled: 2 rulesworking1 + defaultinput-required3completed4failed4cancelled2
    Rules for each answer. Each bar counts the rules that give one answer. When no rule matches, the answer is working.
    The data in this figure
    rules
    working1
    input-required3
    completed4
    failed4
    cancelled2

    Behavior

    A request is state, event, asks, elapsed, deadline, outcome, remaining, separated by spaces. The first rule that matches decides. If none matches, the answer is working. A request over 184 bytes, or in any other form, is answered invalid.

    Behavior 15 rows
    RuleWhenAnswerWhy
    REQ-001state is completedcompletedsrc/Tasks.lex.tex: settle, answer and cancel keep a completed entry (kept entry)
    REQ-002state is failedfailedsrc/Tasks.lex.tex: a failed task is terminal (isTerminal), and every step keeps it
    REQ-003state is cancelledcancelledsrc/Tasks.lex.tex: a cancelled task is terminal, and every step keeps it
    REQ-004event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completescompletedTasks.cancel settles first: work that finished before the cancel stays completed (TASKS.md, What a task does)
    REQ-005event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is failsfailedTasks.cancel settles first: work that failed before the cancel stays failed
    REQ-006event is cancelcancelledTasks.cancelSettled: a working or input_required task becomes cancelled
    REQ-007event is settle and state is working and asks is yes and elapsed is at least deadlineinput-requiredTasks.settleWorking: a plan that parks moves to input_required once parkAfterMs has passed
    REQ-008event is settle and state is working and elapsed is at least deadline and outcome is completescompletedTasks.settleWorking: with nothing to ask, the task concludes once finishAfterMs has passed (Tasks.due)
    REQ-009event is settle and state is working and elapsed is at least deadline and outcome is failsfailedTasks.concluded: a plan that fails gives a failed task with its JSON-RPC error
    REQ-010event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadlineinput-requiredTasks.resume settles at once: a plan that still asks parks again
    REQ-011event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completescompletedTasks.answerInput: the last key answered resumes the task, which settles at once and completes if due
    REQ-012event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is failsfailedTasks.answerInput: the last key answered resumes the task, which settles at once and fails if due
    REQ-013event is answer and state is input-required and remaining equals 0workingTasks.resume: with every key answered and nothing due, the task returns to working
    REQ-014state is input-requiredinput-requiredTasks.settle keeps an input_required task, and answerInput keeps it while any key remains
    otherwiseno rule matchesworkingsrc/Tasks.lex.tex: a working task whose next step is not yet due, or that is answered, is kept as it is

    State machine

    The state is state, and the answer is the next state. A run feeds each answer back in as the next state, starting from working (OMG UML 2.5.1, clause 14). All 1620 requests of the spec's sample were stepped to find the states a run can reach. The invariants are INV-007, INV-008, INV-009. Each holds for one step, so by induction it holds over every run.

    StateKindMeaning
    workinginitial, reachablethe task is running; tasks/get answers status working
    input-requiredreachablethe task waits for the client to answer its inputRequests through tasks/update
    completedfinal, reachableterminal: the plan's result is the task's result
    failedfinal, reachableterminal: the task carries the plan's JSON-RPC error
    cancelledfinal, reachableterminal: the client cancelled the task before it finished

    Transitions

    Every step a reachable state can take, and the rule that takes it.

    FromToBy
    workinginput-requiredREQ-007
    workingworkingotherwise
    workingcompletedREQ-004
    workingcompletedREQ-008
    workingfailedREQ-005
    workingfailedREQ-009
    workingcancelledREQ-006
    input-requiredinput-requiredREQ-010
    input-requiredinput-requiredREQ-014
    input-requiredworkingREQ-013
    input-requiredcompletedREQ-011
    input-requiredfailedREQ-012
    input-requiredcancelledREQ-006
    completedcompletedREQ-001
    failedfailedREQ-002
    cancelledcancelledREQ-003

    Properties Lean proves

    Each property is a theorem about the same definitions the app is built from. It is proved for every request, not only the tested ones.

    Properties Lean proves 9 rows
    PropertyStatementTheoremWhy
    INV-001It never answers working when event is cancel.McpTaskLifecycleProofs::inv001HoldsTASKS.md: a cancel never leaves a task running
    INV-002It never answers input-required when event is cancel.McpTaskLifecycleProofs::inv002Holdsa cancel never leaves a task waiting for input
    INV-003It never answers completed when state is working and elapsed is below deadline.McpTaskLifecycleProofs::inv003HoldsTasks.due: no work concludes before finishAfterMs has passed
    INV-004It never answers failed when state is working and elapsed is below deadline.McpTaskLifecycleProofs::inv004HoldsTasks.due: no work fails before finishAfterMs has passed
    INV-005It never answers working when state is input-required and event is answer and remaining is at least 1.McpTaskLifecycleProofs::inv005HoldsTasks.answerInput: a task resumes only once every key is answered
    INV-006It always answers input-required when state is input-required and event is settle.McpTaskLifecycleProofs::inv006HoldsTasks.settle: settling a task that waits for input changes nothing
    INV-007It always answers completed when state is completed.McpTaskLifecycleProofs::inv007Holdscompleted is a final state (UML 2.5.1 FinalState): a run that reaches it stays there
    INV-008It always answers failed when state is failed.McpTaskLifecycleProofs::inv008Holdsfailed is a final state (UML 2.5.1 FinalState): a run that reaches it stays there
    INV-009It always answers cancelled when state is cancelled.McpTaskLifecycleProofs::inv009Holdscancelled is a final state (UML 2.5.1 FinalState): a run that reaches it stays there

    Architecture

    Stakeholders and the concerns each one views the app through (ISO/IEC/IEEE 42010).

    StakeholderWho they areConcerns
    Host adapter authorHolds the task table between requests for the stateless core (PrismPM issue 216) and needs a finished task to stay finished whatever arrives next.Terminal tasks stay terminal, Refused malformed requests
    MCP client authorPolls a task through tasks/get, answers it through tasks/update and cancels it through tasks/cancel, and needs every answer to be the state the protocol allows.Correct answers, Proved guarantees
    VerifierAnyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer.Integrity of the published app, Refused malformed requests, Proved guarantees

    Concerns

    What the stakeholders care about, and the model each is viewed in.

    ConcernWhat it meansModel
    Correct answersEvery well-formed request is answered by the first rule that matches it, or working when none does, as the spec states.quality
    Integrity of the published appWhat a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it.security
    Proved guaranteesEach of the 9 properties of the spec holds for every request, proved by the Lean kernel.quality
    Refused malformed requestsA request that is not the 7 fields in order, or is longer than 184 bytes, is answered invalid and never guessed.security
    Terminal tasks stay terminalA completed, failed or cancelled task is never moved again by settle, answer or cancel.quality

    Components

    9 components and 13 edges between them.

    Components 9 rows
    ComponentKindWhat it is
    BrowserexternalSystemThe visitor's web browser, which loads the page and runs the MCP task lifecycle guest.
    GitHub PagesexternalSystemServes the page and the holo from the repository Pages workflow.
    Host adapterservicePrismPM's adapter (issue 216): it sends now_ms, the fresh task id and the task table in every request frame and stores the table the core returns.
    MCP clientexternalSystemThe client that declares io.modelcontextprotocol/tasks in its request _meta and calls tasks/get, tasks/update and tasks/cancel.
    MCP conformance suiteexternalSystemmodelcontextprotocol/conformance at cf022cbb, whose tasks scenarios drive the conformance build.
    MCP task lifecycle guestserviceThe Core-Wasm guest built from the model: it answers one request of at most 184 bytes with one answer of at most 64.
    MCP task lifecycle pagestaticSiteThe page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors.
    Prism buildcliAdapterprismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector.
    Source repositoryexternalSystemThe repository that holds the prompt, the model and its gate.

    Design views

    The SDK checks each view against the system model and draws it as OPL and PlantUML.

    ViewDiagramViewpoint
    Deciding a MCP task lifecycle requestopmObjectProcessMCP client author: Correct answers
    Components of MCP task lifecycleumlComponentVerifier: Integrity of the published app
    Answering a MCP task lifecycle requestumlSequenceMCP client author: Correct answers
    States of the MCP task lifecycle guestumlStateMachineHost adapter author: Refused malformed requests
    The MCP task lifecycle state machineumlStateMachineMCP client author: Correct answers

    Features and journeys

    25 features. Each names the definitions that do the work and the tests that accept it. Each stakeholder has one journey.

    Features and journeys 25 rows
    FeatureCallsAccepted by
    When state is completed, the answer is completed.McpTaskLifecycle::rule1, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When state is failed, the answer is failed.McpTaskLifecycle::rule2, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When state is cancelled, the answer is cancelled.McpTaskLifecycle::rule3, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completes, the answer is completed.McpTaskLifecycle::rule4, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is fails, the answer is failed.McpTaskLifecycle::rule5, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is cancel, the answer is cancelled.McpTaskLifecycle::rule6, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is settle and state is working and asks is yes and elapsed is at least deadline, the answer is input-required.McpTaskLifecycle::rule7, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is settle and state is working and elapsed is at least deadline and outcome is completes, the answer is completed.McpTaskLifecycle::rule8, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is settle and state is working and elapsed is at least deadline and outcome is fails, the answer is failed.McpTaskLifecycle::rule9, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadline, the answer is input-required.McpTaskLifecycle::rule10, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completes, the answer is completed.McpTaskLifecycle::rule11, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is fails, the answer is failed.McpTaskLifecycle::rule12, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When event is answer and state is input-required and remaining equals 0, the answer is working.McpTaskLifecycle::rule13, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When state is input-required, the answer is input-required.McpTaskLifecycle::rule14, McpTaskLifecycle::judgeMcpTaskLifecycle::application
    When no rule matches, the answer is working.McpTaskLifecycle::judgeMcpTaskLifecycle::application
    A request that is not state, event, asks, elapsed, deadline, outcome, remaining in order, separated by single spaces, or is over 184 bytes, is answered invalid.McpTaskLifecycle::dispatch, McpTaskLifecycle::decodeField1McpTaskLifecycle::application
    It never answers working when event is cancel.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv001Holds
    It never answers input-required when event is cancel.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv002Holds
    It never answers completed when state is working and elapsed is below deadline.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv003Holds
    It never answers failed when state is working and elapsed is below deadline.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv004Holds
    It never answers working when state is input-required and event is answer and remaining is at least 1.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv005Holds
    It always answers input-required when state is input-required and event is settle.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv006Holds
    It always answers completed when state is completed.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv007Holds
    It always answers failed when state is failed.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv008Holds
    It always answers cancelled when state is cancelled.McpTaskLifecycle::judgeMcpTaskLifecycleProofs::inv009Holds

    Journeys

    The ordered features each stakeholder takes.

    StakeholderSteps
    Host adapter authorREQ-001 → REQ-006 → INV-007 → refuse
    MCP client authorotherwise → REQ-007 → REQ-013 → REQ-008 → INV-005
    Verifierrefuse → INV-001 → INV-002 → INV-003 → INV-004 → INV-005 → INV-006 → INV-007 → INV-008 → INV-009

    Security and threat model

    18 threats against 4 assets. Each has a STRIDE category, and either a control with evidence or a risk that is accepted on purpose.

    Security and threat model 18 rows
    ThreatSTRIDEAssetRiskAnswered by
    Answer that breaks INV-001repudiationAnswermedium likelihood, critical impactProof of INV-001: proof McpTaskLifecycleProofs::inv001Holds
    Answer that breaks INV-002repudiationAnswermedium likelihood, critical impactProof of INV-002: proof McpTaskLifecycleProofs::inv002Holds
    Answer that breaks INV-003repudiationAnswermedium likelihood, critical impactProof of INV-003: proof McpTaskLifecycleProofs::inv003Holds
    Answer that breaks INV-004repudiationAnswermedium likelihood, critical impactProof of INV-004: proof McpTaskLifecycleProofs::inv004Holds
    Answer that breaks INV-005repudiationAnswermedium likelihood, critical impactProof of INV-005: proof McpTaskLifecycleProofs::inv005Holds
    Answer that breaks INV-006repudiationAnswermedium likelihood, critical impactProof of INV-006: proof McpTaskLifecycleProofs::inv006Holds
    Answer that breaks INV-007repudiationAnswermedium likelihood, critical impactProof of INV-007: proof McpTaskLifecycleProofs::inv007Holds
    Answer that breaks INV-008repudiationAnswermedium likelihood, critical impactProof of INV-008: proof McpTaskLifecycleProofs::inv008Holds
    Answer that breaks INV-009repudiationAnswermedium likelihood, critical impactProof of INV-009: proof McpTaskLifecycleProofs::inv009Holds
    Cancel hides finished workrepudiationAnswermedium likelihood, major impactSettle before cancel: proof McpTaskLifecycleProofs::inv001Holds; gate MCP crates/lifecycle-oracle/tests/tasks.rs TK-01 to TK-16
    Granted capabilityinformationDisclosureAnswerlow likelihood, major impactNo capability granted: gate prism-code check refuses an ungranted guest import
    Host clock or table substitutedtamperingRequest byteslow likelihood, major impactaccepted: The core keeps no state by design; TASKS.md puts the clock and the table in the host's custody, and the host owes the core exactly what it was given.
    Malformed requesttamperingRequest byteshigh likelihood, major impactStrict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify
    Oversized requestdenialOfServiceRequest bytesmedium likelihood, minor impactBounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify
    Substituted holospoofingPublished hololow likelihood, critical impactFingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page
    Substituted hostspoofingPublished hololow likelihood, critical impactaccepted: A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt.
    Tampered modeltamperingModel sourcelow likelihood, major impactRegenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json
    Terminal task revivedtamperingAnswerlow likelihood, critical impactFinal states proved: proof McpTaskLifecycleProofs::inv007Holds; review MCP src/TaskLaws.lex.tex

    Quality

    ISO/IEC 25010:2023 requirements. Each has a measure and a threshold that a theorem pins.

    Quality 8 rows
    RequirementCharacteristicMeasureThreshold
    Bounded allocation: The guest allocates at most 368 bytes for one request.Performance efficiency: Resource utilizationGuest allocation bytes368
    Bounded request: A request over 184 bytes is refused before any field is read.Performance efficiency: Time behaviourRequest bytes read184
    Every property proved: All 9 properties are theorems the Lean kernel checks.Security: IntegrityUnproved properties0
    Every request answered: Every request gets an answer: a rule, working otherwise, or invalid.Functional suitability: Functional completenessUnanswered requests0
    Every step matches the core: Each acceptance vector answers the state Tasks.settle, Tasks.answer or Tasks.cancel writes.Functional suitability: Functional correctnessVectors that disagree0
    Every vector replays: All 65 acceptance vectors replay in the compiled guest, the shortest 0 bytes long.Reliability: FaultlessnessFailed vectors0
    Examples answered as stated: Every one of the 11 examples of the spec is answered as it states.Functional suitability: Functional correctnessExample mismatches0
    No final state is left: No step takes a completed, failed or cancelled task to another state.Reliability: FaultlessnessFinal states left0

    Compliance

    One obligation per standard, each naming its evidence.

    StandardSubjectEvidence
    ISO/IEC/IEEE 42010:2022Architecture descriptionArchitecture::architectureDescriptionHolds
    ISO/PAS 19450:2015 and OMG UML 2.5.1Design viewsDesign::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates, Design::viewUmlMachine
    ISO/IEC 25010:2023Product qualityQuality::qualityModelHolds
    ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022Application security and riskSecurity::controlSet
    OMG UML 2.5.1 behavioral state machineState machineMcpTaskLifecycle::judge, McpTaskLifecycleProofs::inv007Holds, McpTaskLifecycleProofs::inv008Holds, McpTaskLifecycleProofs::inv009Holds
    OpenSpecRequirementsMcpTaskLifecycle::application
    SPDX MIT OR Apache-2.0LicensingMcpTaskLifecycle::application

    Rendered design views

    Written by the SDK from the design records when it verified the app.

    design/Design.viewOpmDecide.opl
    View: Design::viewOpmDecide
    Title: Deciding a MCP task lifecycle request
    Viewpoint: Architecture::viewpointMCPClientAuthorCorrectAnswers
    Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile
    
    componentBrowser is an object.
    componentMCPTaskLifecycleGuest is an object.
    componentMCPTaskLifecycleGuest can be stateDeciding or stateIdle.
    processDecide is a process.
    processEncodeAnswer is a process.
    processJudge is a process.
    processParseRequest is a process.
    componentMCPTaskLifecycleGuest handles processDecide.
    processParseRequest requires componentBrowser.
    processEncodeAnswer affects componentBrowser.
    processJudge invokes processEncodeAnswer.
    processParseRequest invokes processJudge.
    processDecide zooms into processParseRequest, processJudge, and processEncodeAnswer, in that sequence.
    
    design/Design.viewUmlComponents.puml
    @startuml
    ' UML 2.5.1 component diagram
    ' view: Design::viewUmlComponents
    ' viewpoint: Architecture::viewpointVerifierIntegrityOfThePublishedApp
    title Components of MCP task lifecycle
    component "componentBrowser" as c0
    component "componentGitHubPages" as c1
    component "componentHostAdapter" as c2
    component "componentMCPClient" as c3
    component "componentMCPConformanceSuite" as c4
    component "componentMCPTaskLifecycleGuest" as c5
    component "componentMCPTaskLifecyclePage" as c6
    component "componentPrismBuild" as c7
    component "componentSourceRepository" as c8
    c0 --> c5 : edgeBrowserToMCPTaskLifecycleGuest
    c1 --> c0 : edgeGitHubPagesToBrowser
    c2 --> c5 : edgeHostAdapterToMCPTaskLifecycleGuest
    c3 --> c5 : edgeMCPClientToMCPTaskLifecycleGuest
    c4 --> c5 : edgeMCPConformanceSuiteToMCPTaskLifecycleGuest
    c5 --> c0 : edgeMCPTaskLifecycleGuestToBrowser
    c5 --> c2 : edgeMCPTaskLifecycleGuestToHostAdapter
    c5 --> c3 : edgeMCPTaskLifecycleGuestToMCPClient
    c5 --> c4 : edgeMCPTaskLifecycleGuestToMCPConformanceSuite
    c6 --> c1 : edgeMCPTaskLifecyclePageToGitHubPages
    c7 --> c5 : edgePrismBuildToMCPTaskLifecycleGuest
    c7 --> c6 : edgePrismBuildToMCPTaskLifecyclePage
    c8 --> c7 : edgeSourceRepositoryToPrismBuild
    @enduml
    
    design/Design.viewUmlMachine.puml
    @startuml
    ' UML 2.5.1 state machine diagram
    ' view: Design::viewUmlMachine
    ' viewpoint: Architecture::viewpointMCPClientAuthorCorrectAnswers
    title The MCP task lifecycle state machine
    state "stateMachineCancelled" as s0
    state "stateMachineCompleted" as s1
    state "stateMachineFailed" as s2
    state "stateMachineInputRequired" as s3
    state "stateMachineWorking" as s4
    [*] --> s4
    s4 --> s3 : processRule7
    s4 --> s4 : processOtherwise
    s4 --> s1 : processRule4
    s4 --> s1 : processRule8
    s4 --> s2 : processRule5
    s4 --> s2 : processRule9
    s4 --> s0 : processRule6
    s3 --> s3 : processRule10
    s3 --> s3 : processRule14
    s3 --> s4 : processRule13
    s3 --> s1 : processRule11
    s3 --> s2 : processRule12
    s3 --> s0 : processRule6
    s1 --> s1 : processRule1
    s2 --> s2 : processRule2
    s0 --> s0 : processRule3
    @enduml
    
    design/Design.viewUmlRequest.puml
    @startuml
    ' UML 2.5.1 sequence diagram
    ' view: Design::viewUmlRequest
    ' viewpoint: Architecture::viewpointMCPClientAuthorCorrectAnswers
    title Answering a MCP task lifecycle request
    participant "componentBrowser" as p0
    participant "componentMCPTaskLifecycleGuest" as p1
    p0 -> p1 : processDecide
    p1 --> p0 : processDecide
    @enduml
    
    design/Design.viewUmlStates.puml
    @startuml
    ' UML 2.5.1 state machine diagram
    ' view: Design::viewUmlStates
    ' viewpoint: Architecture::viewpointHostAdapterAuthorRefusedMalformedRequests
    title States of the MCP task lifecycle guest
    state "stateAnsweredCancelled" as s0
    state "stateAnsweredCompleted" as s1
    state "stateAnsweredFailed" as s2
    state "stateAnsweredInputRequired" as s3
    state "stateAnsweredWorking" as s4
    state "stateDeciding" as s5
    state "stateIdle" as s6
    state "stateRefused" as s7
    [*] --> s6
    s6 --> s5 : processParseRequest
    s6 --> s7 : processParseRequest
    s5 --> s1 : processRule1
    s5 --> s2 : processRule2
    s5 --> s0 : processRule3
    s5 --> s1 : processRule4
    s5 --> s2 : processRule5
    s5 --> s0 : processRule6
    s5 --> s3 : processRule7
    s5 --> s1 : processRule8
    s5 --> s2 : processRule9
    s5 --> s3 : processRule10
    s5 --> s1 : processRule11
    s5 --> s2 : processRule12
    s5 --> s4 : processRule13
    s5 --> s3 : processRule14
    s5 --> s4 : processOtherwise
    s4 --> s6 : processEncodeAnswer
    s3 --> s6 : processEncodeAnswer
    s1 --> s6 : processEncodeAnswer
    s2 --> s6 : processEncodeAnswer
    s0 --> s6 : processEncodeAnswer
    s7 --> s6 : processEncodeAnswer
    @enduml
    

    Prism source

    Every file the builder wrote, laid out as a repository created from UOR-Foundation/template. The language packages and Foundation modules every app shares are in the download.

    app/src/Architecture.lex.tex 434 lines
    \begin{lexlean}{Architecture}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{Foundation.Arch}
    \title{architectural component}
    \begin{semanticmodule}
    definition{
      name: standardIso25010,
      parameters: [],
      result: Foundation.Arch::StandardReference,
      body: (record Foundation.Arch::StandardReference {standardIndex := 0, editionIndex := 0, standardId := "ISO-25010-2023", edition := "2023"})
    }
    
    definition{
      name: standardIso27005,
      parameters: [],
      result: Foundation.Arch::StandardReference,
      body: (record Foundation.Arch::StandardReference {standardIndex := 1, editionIndex := 0, standardId := "ISO-27005-2022", edition := "2022"})
    }
    
    definition{
      name: standardIso27034,
      parameters: [],
      result: Foundation.Arch::StandardReference,
      body: (record Foundation.Arch::StandardReference {standardIndex := 2, editionIndex := 0, standardId := "ISO-27034-1-2011", edition := "2011"})
    }
    
    definition{
      name: standardIso42010,
      parameters: [],
      result: Foundation.Arch::StandardReference,
      body: (record Foundation.Arch::StandardReference {standardIndex := 4, editionIndex := 0, standardId := "ISO-42010-2022", edition := "2022"})
    }
    
    definition{
      name: stakeholderHostAdapterAuthor,
      parameters: [],
      result: Foundation.Arch::Stakeholder,
      body: (record Foundation.Arch::Stakeholder {index := 0, name := "Host adapter author", text := "Holds the task table between requests for the stateless core (PrismPM issue 216) and needs a finished task to stay finished whatever arrives next."})
    }
    
    definition{
      name: stakeholderMCPClientAuthor,
      parameters: [],
      result: Foundation.Arch::Stakeholder,
      body: (record Foundation.Arch::Stakeholder {index := 1, name := "MCP client author", text := "Polls a task through tasks/get, answers it through tasks/update and cancels it through tasks/cancel, and needs every answer to be the state the protocol allows."})
    }
    
    definition{
      name: stakeholderVerifier,
      parameters: [],
      result: Foundation.Arch::Stakeholder,
      body: (record Foundation.Arch::Stakeholder {index := 2, name := "Verifier", text := "Anyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer."})
    }
    
    definition{
      name: concernCorrectAnswers,
      parameters: [],
      result: Foundation.Arch::Concern,
      body: (record Foundation.Arch::Concern {index := 0, name := "Correct answers", text := "Every well-formed request is answered by the first rule that matches it, or working when none does, as the spec states."})
    }
    
    definition{
      name: concernIntegrityOfThePublishedApp,
      parameters: [],
      result: Foundation.Arch::Concern,
      body: (record Foundation.Arch::Concern {index := 1, name := "Integrity of the published app", text := "What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it."})
    }
    
    definition{
      name: concernProvedGuarantees,
      parameters: [],
      result: Foundation.Arch::Concern,
      body: (record Foundation.Arch::Concern {index := 2, name := "Proved guarantees", text := "Each of the 9 properties of the spec holds for every request, proved by the Lean kernel."})
    }
    
    definition{
      name: concernRefusedMalformedRequests,
      parameters: [],
      result: Foundation.Arch::Concern,
      body: (record Foundation.Arch::Concern {index := 3, name := "Refused malformed requests", text := "A request that is not the 7 fields in order, or is longer than 184 bytes, is answered invalid and never guessed."})
    }
    
    definition{
      name: concernTerminalTasksStayTerminal,
      parameters: [],
      result: Foundation.Arch::Concern,
      body: (record Foundation.Arch::Concern {index := 4, name := "Terminal tasks stay terminal", text := "A completed, failed or cancelled task is never moved again by settle, answer or cancel."})
    }
    
    definition{
      name: componentBrowser,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 0, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "Browser", text := "The visitor's web browser, which loads the page and runs the MCP task lifecycle guest."})
    }
    
    definition{
      name: componentGitHubPages,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 1, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "GitHub Pages", text := "Serves the page and the holo from the repository Pages workflow."})
    }
    
    definition{
      name: componentHostAdapter,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 2, kind := (ctor Foundation.Arch::ComponentKind.service), name := "Host adapter", text := "PrismPM's adapter (issue 216): it sends now_ms, the fresh task id and the task table in every request frame and stores the table the core returns."})
    }
    
    definition{
      name: componentMCPClient,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 3, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "MCP client", text := "The client that declares io.modelcontextprotocol/tasks in its request _meta and calls tasks/get, tasks/update and tasks/cancel."})
    }
    
    definition{
      name: componentMCPConformanceSuite,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 4, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "MCP conformance suite", text := "modelcontextprotocol/conformance at cf022cbb, whose tasks scenarios drive the conformance build."})
    }
    
    definition{
      name: componentMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 5, kind := (ctor Foundation.Arch::ComponentKind.service), name := "MCP task lifecycle guest", text := "The Core-Wasm guest built from the model: it answers one request of at most 184 bytes with one answer of at most 64."})
    }
    
    definition{
      name: componentMCPTaskLifecyclePage,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 6, kind := (ctor Foundation.Arch::ComponentKind.staticSite), name := "MCP task lifecycle page", text := "The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors."})
    }
    
    definition{
      name: componentPrismBuild,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 7, kind := (ctor Foundation.Arch::ComponentKind.cliAdapter), name := "Prism build", text := "prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector."})
    }
    
    definition{
      name: componentSourceRepository,
      parameters: [],
      result: Foundation.Arch::Component,
      body: (record Foundation.Arch::Component {index := 8, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "Source repository", text := "The repository that holds the prompt, the model and its gate."})
    }
    
    definition{
      name: edgeBrowserToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 0, fromIndex := 0, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeGitHubPagesToBrowser,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 1, fromIndex := 1, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeHostAdapterToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 2, fromIndex := 2, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPClientToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 3, fromIndex := 3, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPConformanceSuiteToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 4, fromIndex := 4, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPTaskLifecycleGuestToBrowser,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 5, fromIndex := 5, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPTaskLifecycleGuestToHostAdapter,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 6, fromIndex := 5, toIndex := 2, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPTaskLifecycleGuestToMCPClient,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 7, fromIndex := 5, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPTaskLifecycleGuestToMCPConformanceSuite,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 8, fromIndex := 5, toIndex := 4, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeMCPTaskLifecyclePageToGitHubPages,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 9, fromIndex := 6, toIndex := 1, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgePrismBuildToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 10, fromIndex := 7, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgePrismBuildToMCPTaskLifecyclePage,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 11, fromIndex := 7, toIndex := 6, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: edgeSourceRepositoryToPrismBuild,
      parameters: [],
      result: Foundation.Arch::Edge,
      body: (record Foundation.Arch::Edge {index := 12, fromIndex := 8, toIndex := 7, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
    }
    
    definition{
      name: viewpointHostAdapterAuthorRefusedMalformedRequests,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 0, stakeholderIndex := 0, concernIndex := 3, modelKindIndex := 2})
    }
    
    definition{
      name: viewpointHostAdapterAuthorTerminalTasksStayTerminal,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 1, stakeholderIndex := 0, concernIndex := 4, modelKindIndex := 1})
    }
    
    definition{
      name: viewpointMCPClientAuthorCorrectAnswers,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 2, stakeholderIndex := 1, concernIndex := 0, modelKindIndex := 1})
    }
    
    definition{
      name: viewpointMCPClientAuthorProvedGuarantees,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 3, stakeholderIndex := 1, concernIndex := 2, modelKindIndex := 1})
    }
    
    definition{
      name: viewpointVerifierIntegrityOfThePublishedApp,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 4, stakeholderIndex := 2, concernIndex := 1, modelKindIndex := 2})
    }
    
    definition{
      name: viewpointVerifierProvedGuarantees,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 5, stakeholderIndex := 2, concernIndex := 2, modelKindIndex := 1})
    }
    
    definition{
      name: viewpointVerifierRefusedMalformedRequests,
      parameters: [],
      result: Foundation.Arch::Viewpoint,
      body: (record Foundation.Arch::Viewpoint {index := 6, stakeholderIndex := 2, concernIndex := 3, modelKindIndex := 2})
    }
    
    definition{
      name: viewHostAdapterAuthorRefusedMalformedRequests,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 0, viewpointIndex := 0, modelKindIndex := 2})
    }
    
    definition{
      name: viewHostAdapterAuthorTerminalTasksStayTerminal,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 1, viewpointIndex := 1, modelKindIndex := 1})
    }
    
    definition{
      name: viewMCPClientAuthorCorrectAnswers,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 2, viewpointIndex := 2, modelKindIndex := 1})
    }
    
    definition{
      name: viewMCPClientAuthorProvedGuarantees,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 3, viewpointIndex := 3, modelKindIndex := 1})
    }
    
    definition{
      name: viewVerifierIntegrityOfThePublishedApp,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 4, viewpointIndex := 4, modelKindIndex := 2})
    }
    
    definition{
      name: viewVerifierProvedGuarantees,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 5, viewpointIndex := 5, modelKindIndex := 1})
    }
    
    definition{
      name: viewVerifierRefusedMalformedRequests,
      parameters: [],
      result: Foundation.Arch::View,
      body: (record Foundation.Arch::View {index := 6, viewpointIndex := 6, modelKindIndex := 2})
    }
    
    definition{
      name: componentRecords,
      parameters: [],
      result: (List Foundation.Arch::Component),
      body: (cons (componentBrowser) (cons (componentGitHubPages) (cons (componentHostAdapter) (cons (componentMCPClient) (cons (componentMCPConformanceSuite) (cons (componentMCPTaskLifecycleGuest) (cons (componentMCPTaskLifecyclePage) (cons (componentPrismBuild) (cons (componentSourceRepository) (nil Foundation.Arch::Component))))))))))
    }
    
    definition{
      name: edgeRecords,
      parameters: [],
      result: (List Foundation.Arch::Edge),
      body: (cons (edgeBrowserToMCPTaskLifecycleGuest) (cons (edgeGitHubPagesToBrowser) (cons (edgeHostAdapterToMCPTaskLifecycleGuest) (cons (edgeMCPClientToMCPTaskLifecycleGuest) (cons (edgeMCPConformanceSuiteToMCPTaskLifecycleGuest) (cons (edgeMCPTaskLifecycleGuestToBrowser) (cons (edgeMCPTaskLifecycleGuestToHostAdapter) (cons (edgeMCPTaskLifecycleGuestToMCPClient) (cons (edgeMCPTaskLifecycleGuestToMCPConformanceSuite) (cons (edgeMCPTaskLifecyclePageToGitHubPages) (cons (edgePrismBuildToMCPTaskLifecycleGuest) (cons (edgePrismBuildToMCPTaskLifecyclePage) (cons (edgeSourceRepositoryToPrismBuild) (nil Foundation.Arch::Edge))))))))))))))
    }
    
    definition{
      name: viewpointRecords,
      parameters: [],
      result: (List Foundation.Arch::Viewpoint),
      body: (cons (viewpointHostAdapterAuthorRefusedMalformedRequests) (cons (viewpointHostAdapterAuthorTerminalTasksStayTerminal) (cons (viewpointMCPClientAuthorCorrectAnswers) (cons (viewpointMCPClientAuthorProvedGuarantees) (cons (viewpointVerifierIntegrityOfThePublishedApp) (cons (viewpointVerifierProvedGuarantees) (cons (viewpointVerifierRefusedMalformedRequests) (nil Foundation.Arch::Viewpoint))))))))
    }
    
    definition{
      name: viewRecords,
      parameters: [],
      result: (List Foundation.Arch::View),
      body: (cons (viewHostAdapterAuthorRefusedMalformedRequests) (cons (viewHostAdapterAuthorTerminalTasksStayTerminal) (cons (viewMCPClientAuthorCorrectAnswers) (cons (viewMCPClientAuthorProvedGuarantees) (cons (viewVerifierIntegrityOfThePublishedApp) (cons (viewVerifierProvedGuarantees) (cons (viewVerifierRefusedMalformedRequests) (nil Foundation.Arch::View))))))))
    }
    
    definition{
      name: edgesKnown,
      parameters: [count : Nat, records : (List Foundation.Arch::Edge)],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons edge rest => (((project edge fromIndex) <? count) && (((project edge toIndex) <? count) && (edgesKnown count rest)))),
      recursive_argument: records
    }
    
    definition{
      name: viewpointsKnown,
      parameters: [
        stakeholderCount : Nat,
        concernCount : Nat,
        records : (List Foundation.Arch::Viewpoint)
      ],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons viewpoint rest => (((project viewpoint stakeholderIndex) <? stakeholderCount) && (((project viewpoint concernIndex) <? concernCount) && (((project viewpoint modelKindIndex) <? 3) && (viewpointsKnown stakeholderCount concernCount rest))))),
      recursive_argument: records
    }
    
    definition{
      name: viewMatches,
      parameters: [view : Foundation.Arch::View, viewpoints : (List Foundation.Arch::Viewpoint)],
      result: Bool,
      body: (match viewpoints
        | List.nil => false
        | List.cons viewpoint rest => ((((project viewpoint index) =? (project view viewpointIndex)) && ((project viewpoint modelKindIndex) =? (project view modelKindIndex))) || (viewMatches view rest))),
      recursive_argument: viewpoints
    }
    
    definition{
      name: viewsConform,
      parameters: [
        viewpoints : (List Foundation.Arch::Viewpoint),
        records : (List Foundation.Arch::View)
      ],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons view rest => ((viewMatches view viewpoints) && (viewsConform viewpoints rest))),
      recursive_argument: records
    }
    
    definition{
      name: architectureValid,
      parameters: [],
      result: Bool,
      body: ((edgesKnown 9 (edgeRecords)) && ((viewpointsKnown 3 5 (viewpointRecords)) && (viewsConform (viewpointRecords) (viewRecords))))
    }
    
    theorem{
      name: architectureDescriptionHolds,
      parameters: [],
      statement: ((architectureValid) = true),
      proof: decide{}
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/Compliance.lex.tex 56 lines
    \begin{lexlean}{Compliance}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{Architecture}
    \importmodule{Design}
    \importmodule{Quality}
    \importmodule{Security}
    \importmodule{McpTaskLifecycle}
    \title{standards reference}
    \begin{semanticmodule}
    structure{
      name: Obligation,
      type_parameters: [],
      parameters: [],
      fields: [
        {name: index, type: Nat},
        {name: standard, type: String},
        {name: subject, type: String},
        {name: text, type: String},
        {name: evidence, type: (List String)}
      ]
    }
    
    definition{
      name: obligations,
      parameters: [],
      result: (List Obligation),
      body: (cons (record Obligation {index := 0, standard := "ISO/IEC/IEEE 42010:2022", subject := "Architecture description", text := "Stakeholders, concerns, viewpoints and views are declared and their references resolve.", evidence := (cons "Architecture::architectureDescriptionHolds" (nil String))}) (cons (record Obligation {index := 1, standard := "ISO/PAS 19450:2015 and OMG UML 2.5.1", subject := "Design views", text := "Every design view is checked by the SDK against the system model before it is rendered.", evidence := (cons "Design::viewOpmDecide" (cons "Design::viewUmlComponents" (cons "Design::viewUmlRequest" (cons "Design::viewUmlStates" (cons "Design::viewUmlMachine" (nil String))))))}) (cons (record Obligation {index := 2, standard := "ISO/IEC 25010:2023", subject := "Product quality", text := "Characteristics, subcharacteristics, requirements and measures are numbered and their parents resolve.", evidence := (cons "Quality::qualityModelHolds" (nil String))}) (cons (record Obligation {index := 3, standard := "ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022", subject := "Application security and risk", text := "Every threat has a STRIDE category and a mapped control with evidence, or an accepted risk with its rationale.", evidence := (cons "Security::controlSet" (nil String))}) (cons (record Obligation {index := 4, standard := "OMG UML 2.5.1 behavioral state machine", subject := "State machine", text := "The answer to a state and an event is the next state, one of working, input-required, completed, failed, cancelled; every run starts in working. The final states completed, failed, cancelled are never left.", evidence := (cons "McpTaskLifecycle::judge" (cons "McpTaskLifecycleProofs::inv007Holds" (cons "McpTaskLifecycleProofs::inv008Holds" (cons "McpTaskLifecycleProofs::inv009Holds" (nil String)))))}) (cons (record Obligation {index := 5, standard := "OpenSpec", subject := "Requirements", text := "Every rule and property of the spec is a requirement with a scenario in openspec/specs.", evidence := (cons "McpTaskLifecycle::application" (nil String))}) (cons (record Obligation {index := 6, standard := "SPDX MIT OR Apache-2.0", subject := "Licensing", text := "The application and its model are offered under MIT OR Apache-2.0.", evidence := (cons "McpTaskLifecycle::application" (nil String))}) (nil Obligation))))))))
    }
    
    definition{
      name: obligationsEvidenced,
      parameters: [position : Nat, items : (List Obligation)],
      result: Bool,
      body: (match items
        | List.nil => true
        | List.cons item rest => (((project item index) =? position) && (match{
          branches: [
            {body: false, binders: [], constructor: List.nil},
            {body: true, binders: [first, others], constructor: List.cons}
          ],
          scrutinee: (project item evidence)
        } && (obligationsEvidenced (position + 1) rest)))),
      recursive_argument: items
    }
    
    theorem{
      name: everyObligationEvidenced,
      parameters: [],
      statement: ((obligationsEvidenced 0 (obligations)) = true),
      proof: decide{}
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/Design.lex.tex 941 lines
    \begin{lexlean}{Design}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{Architecture}
    \importmodule{Foundation.Arch}
    \title{design view}
    \begin{semanticmodule}
    definition{
      name: processSendRequest,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentBrowser"})
    }
    
    definition{
      name: processDecide,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processParseRequest,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processJudge,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processEncodeAnswer,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processBuildAndVerify,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPrismBuild"})
    }
    
    definition{
      name: processRule1,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule2,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule3,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule4,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule5,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule6,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule7,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule8,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule9,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule10,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule11,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule12,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule13,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processRule14,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: processOtherwise,
      parameters: [],
      result: Foundation.Arch::SystemProcess,
      body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateIdle,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateDeciding,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateRefused,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateAnsweredWorking,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateAnsweredInputRequired,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateAnsweredCompleted,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateAnsweredFailed,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateAnsweredCancelled,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateMachineWorking,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateMachineInputRequired,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateMachineCompleted,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateMachineFailed,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: stateMachineCancelled,
      parameters: [],
      result: Foundation.Arch::SystemState,
      body: (record Foundation.Arch::SystemState {owner := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: viewOpmDecide,
      parameters: [],
      result: Foundation.Arch::DesignView,
      body: (record Foundation.Arch::DesignView {title := "Deciding a MCP task lifecycle request", viewpoint := "Architecture::viewpointMCPClientAuthorCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.opmObjectProcess)})
    }
    
    definition{
      name: viewUmlComponents,
      parameters: [],
      result: Foundation.Arch::DesignView,
      body: (record Foundation.Arch::DesignView {title := "Components of MCP task lifecycle", viewpoint := "Architecture::viewpointVerifierIntegrityOfThePublishedApp", diagram := (ctor Foundation.Arch::DesignDiagram.umlComponent)})
    }
    
    definition{
      name: viewUmlRequest,
      parameters: [],
      result: Foundation.Arch::DesignView,
      body: (record Foundation.Arch::DesignView {title := "Answering a MCP task lifecycle request", viewpoint := "Architecture::viewpointMCPClientAuthorCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.umlSequence)})
    }
    
    definition{
      name: viewUmlStates,
      parameters: [],
      result: Foundation.Arch::DesignView,
      body: (record Foundation.Arch::DesignView {title := "States of the MCP task lifecycle guest", viewpoint := "Architecture::viewpointHostAdapterAuthorRefusedMalformedRequests", diagram := (ctor Foundation.Arch::DesignDiagram.umlStateMachine)})
    }
    
    definition{
      name: viewUmlMachine,
      parameters: [],
      result: Foundation.Arch::DesignView,
      body: (record Foundation.Arch::DesignView {title := "The MCP task lifecycle state machine", viewpoint := "Architecture::viewpointMCPClientAuthorCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.umlStateMachine)})
    }
    
    definition{
      name: opmBrowser,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.object), subject := "Architecture::componentBrowser"})
    }
    
    definition{
      name: opmGuest,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.object), subject := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: opmDecide,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.process), subject := "Design::processDecide"})
    }
    
    definition{
      name: opmParseRequest,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.process), subject := "Design::processParseRequest"})
    }
    
    definition{
      name: opmJudge,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.process), subject := "Design::processJudge"})
    }
    
    definition{
      name: opmEncodeAnswer,
      parameters: [],
      result: Foundation.Arch::OpmThing,
      body: (record Foundation.Arch::OpmThing {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmThingKind.process), subject := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: opmGuestIdle,
      parameters: [],
      result: Foundation.Arch::OpmState,
      body: (record Foundation.Arch::OpmState {view := "Design::viewOpmDecide", thing := "Architecture::componentMCPTaskLifecycleGuest", state := "Design::stateIdle"})
    }
    
    definition{
      name: opmGuestDeciding,
      parameters: [],
      result: Foundation.Arch::OpmState,
      body: (record Foundation.Arch::OpmState {view := "Design::viewOpmDecide", thing := "Architecture::componentMCPTaskLifecycleGuest", state := "Design::stateDeciding"})
    }
    
    definition{
      name: opmGuestAgent,
      parameters: [],
      result: Foundation.Arch::OpmLink,
      body: (record Foundation.Arch::OpmLink {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmLinkKind.agent), source := "Architecture::componentMCPTaskLifecycleGuest", target := "Design::processDecide"})
    }
    
    definition{
      name: opmBrowserInstrument,
      parameters: [],
      result: Foundation.Arch::OpmLink,
      body: (record Foundation.Arch::OpmLink {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmLinkKind.instrument), source := "Architecture::componentBrowser", target := "Design::processParseRequest"})
    }
    
    definition{
      name: opmParseInvokesJudge,
      parameters: [],
      result: Foundation.Arch::OpmLink,
      body: (record Foundation.Arch::OpmLink {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmLinkKind.invocation), source := "Design::processParseRequest", target := "Design::processJudge"})
    }
    
    definition{
      name: opmJudgeInvokesEncode,
      parameters: [],
      result: Foundation.Arch::OpmLink,
      body: (record Foundation.Arch::OpmLink {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmLinkKind.invocation), source := "Design::processJudge", target := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: opmEncodeAffectsBrowser,
      parameters: [],
      result: Foundation.Arch::OpmLink,
      body: (record Foundation.Arch::OpmLink {view := "Design::viewOpmDecide", kind := (ctor Foundation.Arch::OpmLinkKind.effect), source := "Architecture::componentBrowser", target := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: opmZoomParseRequest,
      parameters: [],
      result: Foundation.Arch::OpmZoom,
      body: (record Foundation.Arch::OpmZoom {view := "Design::viewOpmDecide", process := "Design::processDecide", subprocess := "Design::processParseRequest", order := 0})
    }
    
    definition{
      name: opmZoomJudge,
      parameters: [],
      result: Foundation.Arch::OpmZoom,
      body: (record Foundation.Arch::OpmZoom {view := "Design::viewOpmDecide", process := "Design::processDecide", subprocess := "Design::processJudge", order := 1})
    }
    
    definition{
      name: opmZoomEncodeAnswer,
      parameters: [],
      result: Foundation.Arch::OpmZoom,
      body: (record Foundation.Arch::OpmZoom {view := "Design::viewOpmDecide", process := "Design::processDecide", subprocess := "Design::processEncodeAnswer", order := 2})
    }
    
    definition{
      name: umlBrowser,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentBrowser"})
    }
    
    definition{
      name: umlGitHubPages,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentGitHubPages"})
    }
    
    definition{
      name: umlHostAdapter,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentHostAdapter"})
    }
    
    definition{
      name: umlMCPClient,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentMCPClient"})
    }
    
    definition{
      name: umlMCPConformanceSuite,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentMCPConformanceSuite"})
    }
    
    definition{
      name: umlMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlMCPTaskLifecyclePage,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentMCPTaskLifecyclePage"})
    }
    
    definition{
      name: umlPrismBuild,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentPrismBuild"})
    }
    
    definition{
      name: umlSourceRepository,
      parameters: [],
      result: Foundation.Arch::UmlComponent,
      body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentSourceRepository"})
    }
    
    definition{
      name: umlBrowserToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeBrowserToMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlGitHubPagesToBrowser,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeGitHubPagesToBrowser"})
    }
    
    definition{
      name: umlHostAdapterToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeHostAdapterToMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlMCPClientToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPClientToMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlMCPConformanceSuiteToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPConformanceSuiteToMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlMCPTaskLifecycleGuestToBrowser,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPTaskLifecycleGuestToBrowser"})
    }
    
    definition{
      name: umlMCPTaskLifecycleGuestToHostAdapter,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPTaskLifecycleGuestToHostAdapter"})
    }
    
    definition{
      name: umlMCPTaskLifecycleGuestToMCPClient,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPTaskLifecycleGuestToMCPClient"})
    }
    
    definition{
      name: umlMCPTaskLifecycleGuestToMCPConformanceSuite,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPTaskLifecycleGuestToMCPConformanceSuite"})
    }
    
    definition{
      name: umlMCPTaskLifecyclePageToGitHubPages,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeMCPTaskLifecyclePageToGitHubPages"})
    }
    
    definition{
      name: umlPrismBuildToMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToMCPTaskLifecycleGuest"})
    }
    
    definition{
      name: umlPrismBuildToMCPTaskLifecyclePage,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToMCPTaskLifecyclePage"})
    }
    
    definition{
      name: umlSourceRepositoryToPrismBuild,
      parameters: [],
      result: Foundation.Arch::UmlConnector,
      body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeSourceRepositoryToPrismBuild"})
    }
    
    definition{
      name: seqBrowser,
      parameters: [],
      result: Foundation.Arch::UmlLifeline,
      body: (record Foundation.Arch::UmlLifeline {view := "Design::viewUmlRequest", component := "Architecture::componentBrowser", order := 0})
    }
    
    definition{
      name: seqMCPTaskLifecycleGuest,
      parameters: [],
      result: Foundation.Arch::UmlLifeline,
      body: (record Foundation.Arch::UmlLifeline {view := "Design::viewUmlRequest", component := "Architecture::componentMCPTaskLifecycleGuest", order := 1})
    }
    
    definition{
      name: seqRequest,
      parameters: [],
      result: Foundation.Arch::UmlMessage,
      body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlRequest", kind := (ctor Foundation.Arch::UmlMessageKind.synchronous), order := 0, source := "Architecture::componentBrowser", target := "Architecture::componentMCPTaskLifecycleGuest", process := "Design::processDecide"})
    }
    
    definition{
      name: seqReply,
      parameters: [],
      result: Foundation.Arch::UmlMessage,
      body: (record Foundation.Arch::UmlMessage {view := "Design::viewUmlRequest", kind := (ctor Foundation.Arch::UmlMessageKind.reply), order := 1, source := "Architecture::componentMCPTaskLifecycleGuest", target := "Architecture::componentBrowser", process := "Design::processDecide"})
    }
    
    definition{
      name: stIdle,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateIdle", initial := true})
    }
    
    definition{
      name: stDeciding,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateDeciding", initial := false})
    }
    
    definition{
      name: stRefused,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateRefused", initial := false})
    }
    
    definition{
      name: stAnsweredWorking,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredWorking", initial := false})
    }
    
    definition{
      name: stAnsweredInputRequired,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredInputRequired", initial := false})
    }
    
    definition{
      name: stAnsweredCompleted,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredCompleted", initial := false})
    }
    
    definition{
      name: stAnsweredFailed,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredFailed", initial := false})
    }
    
    definition{
      name: stAnsweredCancelled,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredCancelled", initial := false})
    }
    
    definition{
      name: stMachineWorking,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlMachine", state := "Design::stateMachineWorking", initial := true})
    }
    
    definition{
      name: stMachineInputRequired,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlMachine", state := "Design::stateMachineInputRequired", initial := false})
    }
    
    definition{
      name: stMachineCompleted,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlMachine", state := "Design::stateMachineCompleted", initial := false})
    }
    
    definition{
      name: stMachineFailed,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlMachine", state := "Design::stateMachineFailed", initial := false})
    }
    
    definition{
      name: stMachineCancelled,
      parameters: [],
      result: Foundation.Arch::UmlState,
      body: (record Foundation.Arch::UmlState {view := "Design::viewUmlMachine", state := "Design::stateMachineCancelled", initial := false})
    }
    
    definition{
      name: trAccept,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 0, source := "Design::stateIdle", target := "Design::stateDeciding", trigger := "Design::processParseRequest"})
    }
    
    definition{
      name: trRefuse,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 1, source := "Design::stateIdle", target := "Design::stateRefused", trigger := "Design::processParseRequest"})
    }
    
    definition{
      name: trRule1,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 2, source := "Design::stateDeciding", target := "Design::stateAnsweredCompleted", trigger := "Design::processRule1"})
    }
    
    definition{
      name: trRule2,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 3, source := "Design::stateDeciding", target := "Design::stateAnsweredFailed", trigger := "Design::processRule2"})
    }
    
    definition{
      name: trRule3,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 4, source := "Design::stateDeciding", target := "Design::stateAnsweredCancelled", trigger := "Design::processRule3"})
    }
    
    definition{
      name: trRule4,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 5, source := "Design::stateDeciding", target := "Design::stateAnsweredCompleted", trigger := "Design::processRule4"})
    }
    
    definition{
      name: trRule5,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 6, source := "Design::stateDeciding", target := "Design::stateAnsweredFailed", trigger := "Design::processRule5"})
    }
    
    definition{
      name: trRule6,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 7, source := "Design::stateDeciding", target := "Design::stateAnsweredCancelled", trigger := "Design::processRule6"})
    }
    
    definition{
      name: trRule7,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 8, source := "Design::stateDeciding", target := "Design::stateAnsweredInputRequired", trigger := "Design::processRule7"})
    }
    
    definition{
      name: trRule8,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 9, source := "Design::stateDeciding", target := "Design::stateAnsweredCompleted", trigger := "Design::processRule8"})
    }
    
    definition{
      name: trRule9,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 10, source := "Design::stateDeciding", target := "Design::stateAnsweredFailed", trigger := "Design::processRule9"})
    }
    
    definition{
      name: trRule10,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 11, source := "Design::stateDeciding", target := "Design::stateAnsweredInputRequired", trigger := "Design::processRule10"})
    }
    
    definition{
      name: trRule11,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 12, source := "Design::stateDeciding", target := "Design::stateAnsweredCompleted", trigger := "Design::processRule11"})
    }
    
    definition{
      name: trRule12,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 13, source := "Design::stateDeciding", target := "Design::stateAnsweredFailed", trigger := "Design::processRule12"})
    }
    
    definition{
      name: trRule13,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 14, source := "Design::stateDeciding", target := "Design::stateAnsweredWorking", trigger := "Design::processRule13"})
    }
    
    definition{
      name: trRule14,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 15, source := "Design::stateDeciding", target := "Design::stateAnsweredInputRequired", trigger := "Design::processRule14"})
    }
    
    definition{
      name: trOtherwise,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 16, source := "Design::stateDeciding", target := "Design::stateAnsweredWorking", trigger := "Design::processOtherwise"})
    }
    
    definition{
      name: trResetWorking,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 17, source := "Design::stateAnsweredWorking", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trResetInputRequired,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 18, source := "Design::stateAnsweredInputRequired", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trResetCompleted,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 19, source := "Design::stateAnsweredCompleted", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trResetFailed,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 20, source := "Design::stateAnsweredFailed", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trResetCancelled,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 21, source := "Design::stateAnsweredCancelled", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trResetRefused,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 22, source := "Design::stateRefused", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
    }
    
    definition{
      name: trMachineWorkingToInputRequiredByREQ007,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 0, source := "Design::stateMachineWorking", target := "Design::stateMachineInputRequired", trigger := "Design::processRule7"})
    }
    
    definition{
      name: trMachineWorkingToWorkingByOtherwise,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 1, source := "Design::stateMachineWorking", target := "Design::stateMachineWorking", trigger := "Design::processOtherwise"})
    }
    
    definition{
      name: trMachineWorkingToCompletedByREQ004,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 2, source := "Design::stateMachineWorking", target := "Design::stateMachineCompleted", trigger := "Design::processRule4"})
    }
    
    definition{
      name: trMachineWorkingToCompletedByREQ008,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 3, source := "Design::stateMachineWorking", target := "Design::stateMachineCompleted", trigger := "Design::processRule8"})
    }
    
    definition{
      name: trMachineWorkingToFailedByREQ005,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 4, source := "Design::stateMachineWorking", target := "Design::stateMachineFailed", trigger := "Design::processRule5"})
    }
    
    definition{
      name: trMachineWorkingToFailedByREQ009,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 5, source := "Design::stateMachineWorking", target := "Design::stateMachineFailed", trigger := "Design::processRule9"})
    }
    
    definition{
      name: trMachineWorkingToCancelledByREQ006,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 6, source := "Design::stateMachineWorking", target := "Design::stateMachineCancelled", trigger := "Design::processRule6"})
    }
    
    definition{
      name: trMachineInputRequiredToInputRequiredByREQ010,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 7, source := "Design::stateMachineInputRequired", target := "Design::stateMachineInputRequired", trigger := "Design::processRule10"})
    }
    
    definition{
      name: trMachineInputRequiredToInputRequiredByREQ014,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 8, source := "Design::stateMachineInputRequired", target := "Design::stateMachineInputRequired", trigger := "Design::processRule14"})
    }
    
    definition{
      name: trMachineInputRequiredToWorkingByREQ013,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 9, source := "Design::stateMachineInputRequired", target := "Design::stateMachineWorking", trigger := "Design::processRule13"})
    }
    
    definition{
      name: trMachineInputRequiredToCompletedByREQ011,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 10, source := "Design::stateMachineInputRequired", target := "Design::stateMachineCompleted", trigger := "Design::processRule11"})
    }
    
    definition{
      name: trMachineInputRequiredToFailedByREQ012,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 11, source := "Design::stateMachineInputRequired", target := "Design::stateMachineFailed", trigger := "Design::processRule12"})
    }
    
    definition{
      name: trMachineInputRequiredToCancelledByREQ006,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 12, source := "Design::stateMachineInputRequired", target := "Design::stateMachineCancelled", trigger := "Design::processRule6"})
    }
    
    definition{
      name: trMachineCompletedToCompletedByREQ001,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 13, source := "Design::stateMachineCompleted", target := "Design::stateMachineCompleted", trigger := "Design::processRule1"})
    }
    
    definition{
      name: trMachineFailedToFailedByREQ002,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 14, source := "Design::stateMachineFailed", target := "Design::stateMachineFailed", trigger := "Design::processRule2"})
    }
    
    definition{
      name: trMachineCancelledToCancelledByREQ003,
      parameters: [],
      result: Foundation.Arch::UmlTransition,
      body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlMachine", order := 15, source := "Design::stateMachineCancelled", target := "Design::stateMachineCancelled", trigger := "Design::processRule3"})
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/Features.lex.tex 270 lines
    \begin{lexlean}{Features}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{McpTaskLifecycle}
    \importmodule{Architecture}
    \importmodule{Foundation.Arch}
    \title{feature}
    \begin{semanticmodule}
    definition{
      name: acceptINV001,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv001Holds"
    }
    
    definition{
      name: acceptINV002,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv002Holds"
    }
    
    definition{
      name: acceptINV003,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv003Holds"
    }
    
    definition{
      name: acceptINV004,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv004Holds"
    }
    
    definition{
      name: acceptINV005,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv005Holds"
    }
    
    definition{
      name: acceptINV006,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv006Holds"
    }
    
    definition{
      name: acceptINV007,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv007Holds"
    }
    
    definition{
      name: acceptINV008,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv008Holds"
    }
    
    definition{
      name: acceptINV009,
      parameters: [],
      result: String,
      body: "McpTaskLifecycleProofs::inv009Holds"
    }
    
    definition{
      name: featureRule1,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When state is completed, the answer is completed.", calls := (cons "McpTaskLifecycle::rule1" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule2,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When state is failed, the answer is failed.", calls := (cons "McpTaskLifecycle::rule2" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule3,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When state is cancelled, the answer is cancelled.", calls := (cons "McpTaskLifecycle::rule3" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule4,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completes, the answer is completed.", calls := (cons "McpTaskLifecycle::rule4" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule5,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is fails, the answer is failed.", calls := (cons "McpTaskLifecycle::rule5" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule6,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is cancel, the answer is cancelled.", calls := (cons "McpTaskLifecycle::rule6" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule7,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is settle and state is working and asks is yes and elapsed is at least deadline, the answer is input-required.", calls := (cons "McpTaskLifecycle::rule7" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule8,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is settle and state is working and elapsed is at least deadline and outcome is completes, the answer is completed.", calls := (cons "McpTaskLifecycle::rule8" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule9,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is settle and state is working and elapsed is at least deadline and outcome is fails, the answer is failed.", calls := (cons "McpTaskLifecycle::rule9" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule10,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadline, the answer is input-required.", calls := (cons "McpTaskLifecycle::rule10" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule11,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completes, the answer is completed.", calls := (cons "McpTaskLifecycle::rule11" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule12,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is fails, the answer is failed.", calls := (cons "McpTaskLifecycle::rule12" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule13,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When event is answer and state is input-required and remaining equals 0, the answer is working.", calls := (cons "McpTaskLifecycle::rule13" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRule14,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When state is input-required, the answer is input-required.", calls := (cons "McpTaskLifecycle::rule14" (cons "McpTaskLifecycle::judge" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureOtherwise,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "When no rule matches, the answer is working.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureRefuseMalformed,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "A request that is not state, event, asks, elapsed, deadline, outcome, remaining in order, separated by single spaces, or is over 184 bytes, is answered invalid.", calls := (cons "McpTaskLifecycle::dispatch" (cons "McpTaskLifecycle::decodeField1" (nil String))), acceptance := (cons "McpTaskLifecycle::application" (nil String))})
    }
    
    definition{
      name: featureINV001,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It never answers working when event is cancel.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV001" (nil String))})
    }
    
    definition{
      name: featureINV002,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It never answers input-required when event is cancel.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV002" (nil String))})
    }
    
    definition{
      name: featureINV003,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It never answers completed when state is working and elapsed is below deadline.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV003" (nil String))})
    }
    
    definition{
      name: featureINV004,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It never answers failed when state is working and elapsed is below deadline.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV004" (nil String))})
    }
    
    definition{
      name: featureINV005,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It never answers working when state is input-required and event is answer and remaining is at least 1.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV005" (nil String))})
    }
    
    definition{
      name: featureINV006,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It always answers input-required when state is input-required and event is settle.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV006" (nil String))})
    }
    
    definition{
      name: featureINV007,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It always answers completed when state is completed.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV007" (nil String))})
    }
    
    definition{
      name: featureINV008,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It always answers failed when state is failed.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV008" (nil String))})
    }
    
    definition{
      name: featureINV009,
      parameters: [],
      result: Foundation.Arch::Feature,
      body: (record Foundation.Arch::Feature {statement := "It always answers cancelled when state is cancelled.", calls := (cons "McpTaskLifecycle::judge" (nil String)), acceptance := (cons "Features::acceptINV009" (nil String))})
    }
    
    definition{
      name: journeyHostAdapterAuthor,
      parameters: [],
      result: Foundation.Arch::Journey,
      body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderHostAdapterAuthor", steps := (cons "Features::featureRule1" (cons "Features::featureRule6" (cons "Features::featureINV007" (cons "Features::featureRefuseMalformed" (nil String)))))})
    }
    
    definition{
      name: journeyMCPClientAuthor,
      parameters: [],
      result: Foundation.Arch::Journey,
      body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderMCPClientAuthor", steps := (cons "Features::featureOtherwise" (cons "Features::featureRule7" (cons "Features::featureRule13" (cons "Features::featureRule8" (cons "Features::featureINV005" (nil String))))))})
    }
    
    definition{
      name: journeyVerifier,
      parameters: [],
      result: Foundation.Arch::Journey,
      body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderVerifier", steps := (cons "Features::featureRefuseMalformed" (cons "Features::featureINV001" (cons "Features::featureINV002" (cons "Features::featureINV003" (cons "Features::featureINV004" (cons "Features::featureINV005" (cons "Features::featureINV006" (cons "Features::featureINV007" (cons "Features::featureINV008" (cons "Features::featureINV009" (nil String)))))))))))})
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/Quality.lex.tex 368 lines
    \begin{lexlean}{Quality}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \useglossary{prism.qual@1.0.0}
    \importmodule{Foundation.Qual}
    \title{quality measure}
    \begin{semanticmodule}
    structure{
      name: Named,
      type_parameters: [],
      parameters: [],
      fields: [{name: index, type: Nat}, {name: name, type: String}, {name: text, type: String}]
    }
    
    definition{
      name: characteristicFunctionalSuitability,
      parameters: [],
      result: Foundation.Qual::ProductQualityCharacteristic,
      body: (record Foundation.Qual::ProductQualityCharacteristic {index := 0})
    }
    
    definition{
      name: characteristicPerformanceEfficiency,
      parameters: [],
      result: Foundation.Qual::ProductQualityCharacteristic,
      body: (record Foundation.Qual::ProductQualityCharacteristic {index := 1})
    }
    
    definition{
      name: characteristicReliability,
      parameters: [],
      result: Foundation.Qual::ProductQualityCharacteristic,
      body: (record Foundation.Qual::ProductQualityCharacteristic {index := 2})
    }
    
    definition{
      name: characteristicSecurity,
      parameters: [],
      result: Foundation.Qual::ProductQualityCharacteristic,
      body: (record Foundation.Qual::ProductQualityCharacteristic {index := 3})
    }
    
    definition{
      name: subcharacteristicFaultlessness,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 0, characteristicIndex := 2})
    }
    
    definition{
      name: subcharacteristicFunctionalCompleteness,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 1, characteristicIndex := 0})
    }
    
    definition{
      name: subcharacteristicFunctionalCorrectness,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 2, characteristicIndex := 0})
    }
    
    definition{
      name: subcharacteristicIntegrity,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 3, characteristicIndex := 3})
    }
    
    definition{
      name: subcharacteristicResourceUtilization,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 4, characteristicIndex := 1})
    }
    
    definition{
      name: subcharacteristicTimeBehaviour,
      parameters: [],
      result: Foundation.Qual::QualitySubcharacteristic,
      body: (record Foundation.Qual::QualitySubcharacteristic {index := 5, characteristicIndex := 1})
    }
    
    definition{
      name: requirementBoundedAllocation,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 0, subcharacteristicIndex := 4})
    }
    
    definition{
      name: requirementBoundedRequest,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 1, subcharacteristicIndex := 5})
    }
    
    definition{
      name: requirementEveryPropertyProved,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 2, subcharacteristicIndex := 3})
    }
    
    definition{
      name: requirementEveryRequestAnswered,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 3, subcharacteristicIndex := 1})
    }
    
    definition{
      name: requirementEveryStepMatchesTheCore,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 4, subcharacteristicIndex := 2})
    }
    
    definition{
      name: requirementEveryVectorReplays,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 5, subcharacteristicIndex := 0})
    }
    
    definition{
      name: requirementExamplesAnsweredAsStated,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 6, subcharacteristicIndex := 2})
    }
    
    definition{
      name: requirementNoFinalStateIsLeft,
      parameters: [],
      result: Foundation.Qual::QualityRequirement,
      body: (record Foundation.Qual::QualityRequirement {index := 7, subcharacteristicIndex := 0})
    }
    
    definition{
      name: measureExampleMismatches,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 0, requirementIndex := 6, threshold := 0})
    }
    
    definition{
      name: measureFailedVectors,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 1, requirementIndex := 5, threshold := 0})
    }
    
    definition{
      name: measureFinalStatesLeft,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 2, requirementIndex := 7, threshold := 0})
    }
    
    definition{
      name: measureGuestAllocationBytes,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 3, requirementIndex := 0, threshold := 368})
    }
    
    definition{
      name: measureRequestBytesRead,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 4, requirementIndex := 1, threshold := 184})
    }
    
    definition{
      name: measureUnansweredRequests,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 5, requirementIndex := 3, threshold := 0})
    }
    
    definition{
      name: measureUnprovedProperties,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 6, requirementIndex := 2, threshold := 0})
    }
    
    definition{
      name: measureVectorsThatDisagree,
      parameters: [],
      result: Foundation.Qual::QualityMeasure,
      body: (record Foundation.Qual::QualityMeasure {index := 7, requirementIndex := 4, threshold := 0})
    }
    
    definition{
      name: characteristicNames,
      parameters: [],
      result: (List Named),
      body: (cons (record Named {index := 0, name := "Functional suitability", text := "Functional suitability, as ISO/IEC 25010:2023 defines it, for MCP task lifecycle."}) (cons (record Named {index := 1, name := "Performance efficiency", text := "Performance efficiency, as ISO/IEC 25010:2023 defines it, for MCP task lifecycle."}) (cons (record Named {index := 2, name := "Reliability", text := "Reliability, as ISO/IEC 25010:2023 defines it, for MCP task lifecycle."}) (cons (record Named {index := 3, name := "Security", text := "Security, as ISO/IEC 25010:2023 defines it, for MCP task lifecycle."}) (nil Named)))))
    }
    
    definition{
      name: subcharacteristicNames,
      parameters: [],
      result: (List Named),
      body: (cons (record Named {index := 0, name := "Faultlessness", text := "Reliability: Faultlessness."}) (cons (record Named {index := 1, name := "Functional completeness", text := "Functional suitability: Functional completeness."}) (cons (record Named {index := 2, name := "Functional correctness", text := "Functional suitability: Functional correctness."}) (cons (record Named {index := 3, name := "Integrity", text := "Security: Integrity."}) (cons (record Named {index := 4, name := "Resource utilization", text := "Performance efficiency: Resource utilization."}) (cons (record Named {index := 5, name := "Time behaviour", text := "Performance efficiency: Time behaviour."}) (nil Named)))))))
    }
    
    definition{
      name: requirementNames,
      parameters: [],
      result: (List Named),
      body: (cons (record Named {index := 0, name := "Bounded allocation", text := "The guest allocates at most 368 bytes for one request."}) (cons (record Named {index := 1, name := "Bounded request", text := "A request over 184 bytes is refused before any field is read."}) (cons (record Named {index := 2, name := "Every property proved", text := "All 9 properties are theorems the Lean kernel checks."}) (cons (record Named {index := 3, name := "Every request answered", text := "Every request gets an answer: a rule, working otherwise, or invalid."}) (cons (record Named {index := 4, name := "Every step matches the core", text := "Each acceptance vector answers the state Tasks.settle, Tasks.answer or Tasks.cancel writes."}) (cons (record Named {index := 5, name := "Every vector replays", text := "All 65 acceptance vectors replay in the compiled guest, the shortest 0 bytes long."}) (cons (record Named {index := 6, name := "Examples answered as stated", text := "Every one of the 11 examples of the spec is answered as it states."}) (cons (record Named {index := 7, name := "No final state is left", text := "No step takes a completed, failed or cancelled task to another state."}) (nil Named)))))))))
    }
    
    definition{
      name: measureNames,
      parameters: [],
      result: (List Named),
      body: (cons (record Named {index := 0, name := "Example mismatches", text := "Examples the guest answers otherwise than they state."}) (cons (record Named {index := 1, name := "Failed vectors", text := "Acceptance vectors whose replay differs from the model."}) (cons (record Named {index := 2, name := "Final states left", text := "Sampled steps from a final state whose answer is another state."}) (cons (record Named {index := 3, name := "Guest allocation bytes", text := "Most bytes the guest allocates for one request."}) (cons (record Named {index := 4, name := "Request bytes read", text := "Longest request the guest decodes, in bytes."}) (cons (record Named {index := 5, name := "Unanswered requests", text := "Acceptance vectors the guest does not answer."}) (cons (record Named {index := 6, name := "Unproved properties", text := "Properties of the spec without a checked theorem."}) (cons (record Named {index := 7, name := "Vectors that disagree", text := "Acceptance vectors whose replayed answer differs from the expected next state."}) (nil Named)))))))))
    }
    
    definition{
      name: subcharacteristicRecords,
      parameters: [],
      result: (List Foundation.Qual::QualitySubcharacteristic),
      body: (cons (subcharacteristicFaultlessness) (cons (subcharacteristicFunctionalCompleteness) (cons (subcharacteristicFunctionalCorrectness) (cons (subcharacteristicIntegrity) (cons (subcharacteristicResourceUtilization) (cons (subcharacteristicTimeBehaviour) (nil Foundation.Qual::QualitySubcharacteristic)))))))
    }
    
    definition{
      name: requirementRecords,
      parameters: [],
      result: (List Foundation.Qual::QualityRequirement),
      body: (cons (requirementBoundedAllocation) (cons (requirementBoundedRequest) (cons (requirementEveryPropertyProved) (cons (requirementEveryRequestAnswered) (cons (requirementEveryStepMatchesTheCore) (cons (requirementEveryVectorReplays) (cons (requirementExamplesAnsweredAsStated) (cons (requirementNoFinalStateIsLeft) (nil Foundation.Qual::QualityRequirement)))))))))
    }
    
    definition{
      name: measureRecords,
      parameters: [],
      result: (List Foundation.Qual::QualityMeasure),
      body: (cons (measureExampleMismatches) (cons (measureFailedVectors) (cons (measureFinalStatesLeft) (cons (measureGuestAllocationBytes) (cons (measureRequestBytesRead) (cons (measureUnansweredRequests) (cons (measureUnprovedProperties) (cons (measureVectorsThatDisagree) (nil Foundation.Qual::QualityMeasure)))))))))
    }
    
    definition{
      name: namesNumbered,
      parameters: [position : Nat, names : (List Named)],
      result: Bool,
      body: (match names
        | List.nil => true
        | List.cons item rest => (((project item index) =? position) && (namesNumbered (position + 1) rest))),
      recursive_argument: names
    }
    
    definition{
      name: parentsKnown,
      parameters: [count : Nat, records : (List Foundation.Qual::QualitySubcharacteristic)],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons item rest => (((project item characteristicIndex) <? count) && (parentsKnown count rest))),
      recursive_argument: records
    }
    
    definition{
      name: requirementsKnown,
      parameters: [count : Nat, records : (List Foundation.Qual::QualityRequirement)],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons item rest => (((project item subcharacteristicIndex) <? count) && (requirementsKnown count rest))),
      recursive_argument: records
    }
    
    definition{
      name: measuresKnown,
      parameters: [count : Nat, records : (List Foundation.Qual::QualityMeasure)],
      result: Bool,
      body: (match records
        | List.nil => true
        | List.cons item rest => (((project item requirementIndex) <? count) && (measuresKnown count rest))),
      recursive_argument: records
    }
    
    definition{
      name: thresholdOf,
      parameters: [wanted : Nat, records : (List Foundation.Qual::QualityMeasure)],
      result: Nat,
      body: (match records
        | List.nil => 0
        | List.cons head rest => (if ((project head index) =? wanted) then (project head threshold) else (thresholdOf wanted rest))),
      recursive_argument: records
    }
    
    definition{
      name: qualityValid,
      parameters: [],
      result: Bool,
      body: ((namesNumbered 0 (characteristicNames)) && ((namesNumbered 0 (subcharacteristicNames)) && ((namesNumbered 0 (requirementNames)) && ((namesNumbered 0 (measureNames)) && ((parentsKnown 4 (subcharacteristicRecords)) && ((requirementsKnown 6 (requirementRecords)) && (measuresKnown 8 (measureRecords))))))))
    }
    
    theorem{
      name: qualityModelHolds,
      parameters: [],
      statement: ((qualityValid) = true),
      proof: decide{}
    }
    
    theorem{
      name: measureExampleMismatchesThreshold,
      parameters: [],
      statement: ((thresholdOf 0 (measureRecords)) = 0),
      proof: decide{}
    }
    
    theorem{
      name: measureFailedVectorsThreshold,
      parameters: [],
      statement: ((thresholdOf 1 (measureRecords)) = 0),
      proof: decide{}
    }
    
    theorem{
      name: measureFinalStatesLeftThreshold,
      parameters: [],
      statement: ((thresholdOf 2 (measureRecords)) = 0),
      proof: decide{}
    }
    
    theorem{
      name: measureGuestAllocationBytesThreshold,
      parameters: [],
      statement: ((thresholdOf 3 (measureRecords)) = 368),
      proof: decide{}
    }
    
    theorem{
      name: measureRequestBytesReadThreshold,
      parameters: [],
      statement: ((thresholdOf 4 (measureRecords)) = 184),
      proof: decide{}
    }
    
    theorem{
      name: measureUnansweredRequestsThreshold,
      parameters: [],
      statement: ((thresholdOf 5 (measureRecords)) = 0),
      proof: decide{}
    }
    
    theorem{
      name: measureUnprovedPropertiesThreshold,
      parameters: [],
      statement: ((thresholdOf 6 (measureRecords)) = 0),
      proof: decide{}
    }
    
    theorem{
      name: measureVectorsThatDisagreeThreshold,
      parameters: [],
      statement: ((thresholdOf 7 (measureRecords)) = 0),
      proof: decide{}
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/Security.lex.tex 803 lines
    \begin{lexlean}{Security}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \useglossary{prism.sec@1.0.0}
    \importmodule{Foundation.Sec}
    \importmodule{Production.ThreatModel}
    \importmodule{Architecture}
    \title{security threat}
    \begin{semanticmodule}
    definition{
      name: assetAnswer,
      parameters: [],
      result: Foundation.Sec::Asset,
      body: (record Foundation.Sec::Asset {index := 0, componentIndex := 5})
    }
    
    definition{
      name: assetModelSource,
      parameters: [],
      result: Foundation.Sec::Asset,
      body: (record Foundation.Sec::Asset {index := 1, componentIndex := 8})
    }
    
    definition{
      name: assetPublishedHolo,
      parameters: [],
      result: Foundation.Sec::Asset,
      body: (record Foundation.Sec::Asset {index := 2, componentIndex := 6})
    }
    
    definition{
      name: assetRequestBytes,
      parameters: [],
      result: Foundation.Sec::Asset,
      body: (record Foundation.Sec::Asset {index := 3, componentIndex := 5})
    }
    
    definition{
      name: threatAnswerThatBreaksINV001,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 0})
    }
    
    definition{
      name: threatAnswerThatBreaksINV002,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 1})
    }
    
    definition{
      name: threatAnswerThatBreaksINV003,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 2})
    }
    
    definition{
      name: threatAnswerThatBreaksINV004,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 3})
    }
    
    definition{
      name: threatAnswerThatBreaksINV005,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 4})
    }
    
    definition{
      name: threatAnswerThatBreaksINV006,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 5})
    }
    
    definition{
      name: threatAnswerThatBreaksINV007,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 6})
    }
    
    definition{
      name: threatAnswerThatBreaksINV008,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 7})
    }
    
    definition{
      name: threatAnswerThatBreaksINV009,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 8})
    }
    
    definition{
      name: threatCancelHidesFinishedWork,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 9})
    }
    
    definition{
      name: threatGrantedCapability,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 10})
    }
    
    definition{
      name: threatHostClockOrTableSubstituted,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 11})
    }
    
    definition{
      name: threatMalformedRequest,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 12})
    }
    
    definition{
      name: threatOversizedRequest,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 13})
    }
    
    definition{
      name: threatSubstitutedHolo,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 14})
    }
    
    definition{
      name: threatSubstitutedHost,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 15})
    }
    
    definition{
      name: threatTamperedModel,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 16})
    }
    
    definition{
      name: threatTerminalTaskRevived,
      parameters: [],
      result: Foundation.Sec::Threat,
      body: (record Foundation.Sec::Threat {index := 17})
    }
    
    definition{
      name: riskAnswerThatBreaksINV001,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 0, assetIndex := 0, threatIndex := 0, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV002,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 1, assetIndex := 0, threatIndex := 1, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV003,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 2, assetIndex := 0, threatIndex := 2, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV004,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 3, assetIndex := 0, threatIndex := 3, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV005,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 4, assetIndex := 0, threatIndex := 4, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV006,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 5, assetIndex := 0, threatIndex := 5, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV007,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 6, assetIndex := 0, threatIndex := 6, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV008,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 7, assetIndex := 0, threatIndex := 7, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskAnswerThatBreaksINV009,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 8, assetIndex := 0, threatIndex := 8, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskCancelHidesFinishedWork,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 9, assetIndex := 0, threatIndex := 9, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.major)})
    }
    
    definition{
      name: riskGrantedCapability,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 10, assetIndex := 0, threatIndex := 10, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
    }
    
    definition{
      name: riskHostClockOrTableSubstituted,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 11, assetIndex := 3, threatIndex := 11, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
    }
    
    definition{
      name: riskMalformedRequest,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 12, assetIndex := 3, threatIndex := 12, likelihood := (ctor Foundation.Sec::Likelihood.high), impact := (ctor Foundation.Sec::Impact.major)})
    }
    
    definition{
      name: riskOversizedRequest,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 13, assetIndex := 3, threatIndex := 13, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.minor)})
    }
    
    definition{
      name: riskSubstitutedHolo,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 14, assetIndex := 2, threatIndex := 14, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskSubstitutedHost,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 15, assetIndex := 2, threatIndex := 15, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: riskTamperedModel,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 16, assetIndex := 1, threatIndex := 16, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
    }
    
    definition{
      name: riskTerminalTaskRevived,
      parameters: [],
      result: Foundation.Sec::Risk,
      body: (record Foundation.Sec::Risk {index := 17, assetIndex := 0, threatIndex := 17, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.critical)})
    }
    
    definition{
      name: controlBoundedRequest,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 0, riskIndex := 13})
    }
    
    definition{
      name: controlFinalStatesProved,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 1, riskIndex := 17})
    }
    
    definition{
      name: controlFingerprintAndProvenance,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 2, riskIndex := 14})
    }
    
    definition{
      name: controlNoCapabilityGranted,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 3, riskIndex := 10})
    }
    
    definition{
      name: controlProofOfINV001,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 4, riskIndex := 0})
    }
    
    definition{
      name: controlProofOfINV002,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 5, riskIndex := 1})
    }
    
    definition{
      name: controlProofOfINV003,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 6, riskIndex := 2})
    }
    
    definition{
      name: controlProofOfINV004,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 7, riskIndex := 3})
    }
    
    definition{
      name: controlProofOfINV005,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 8, riskIndex := 4})
    }
    
    definition{
      name: controlProofOfINV006,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 9, riskIndex := 5})
    }
    
    definition{
      name: controlProofOfINV007,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 10, riskIndex := 6})
    }
    
    definition{
      name: controlProofOfINV008,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 11, riskIndex := 7})
    }
    
    definition{
      name: controlProofOfINV009,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 12, riskIndex := 8})
    }
    
    definition{
      name: controlRegeneratedFromThePrompt,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 13, riskIndex := 16})
    }
    
    definition{
      name: controlSettleBeforeCancel,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 14, riskIndex := 9})
    }
    
    definition{
      name: controlStrictDecoder,
      parameters: [],
      result: Foundation.Sec::ApplicationSecurityControl,
      body: (record Foundation.Sec::ApplicationSecurityControl {index := 15, riskIndex := 12})
    }
    
    definition{
      name: controlSet,
      parameters: [],
      result: Production.ThreatModel::ControlSet,
      body: (record Production.ThreatModel::ControlSet {title := "MCP task lifecycle security controls", text := "MCP task lifecycle answers one request with one answer in a Core-Wasm guest granted no capability. Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered.", version := "0.1.0", lastModified := "2026-11-12T18:44:38Z"})
    }
    
    definition{
      name: modeledAssetAnswer,
      parameters: [],
      result: Production.ThreatModel::ModeledAsset,
      body: (record Production.ThreatModel::ModeledAsset {asset := "Security::assetAnswer", name := "Answer", text := "The answer the guest returns: one of working, input-required, completed, failed, cancelled, or invalid."})
    }
    
    definition{
      name: modeledAssetModelSource,
      parameters: [],
      result: Production.ThreatModel::ModeledAsset,
      body: (record Production.ThreatModel::ModeledAsset {asset := "Security::assetModelSource", name := "Model source", text := "The prompt, the spec and the LexLean model in the repository, from which the holo is built."})
    }
    
    definition{
      name: modeledAssetPublishedHolo,
      parameters: [],
      result: Production.ThreatModel::ModeledAsset,
      body: (record Production.ThreatModel::ModeledAsset {asset := "Security::assetPublishedHolo", name := "Published holo", text := "The holo and page the Pages workflow publishes, with its fingerprint and signed provenance."})
    }
    
    definition{
      name: modeledAssetRequestBytes,
      parameters: [],
      result: Production.ThreatModel::ModeledAsset,
      body: (record Production.ThreatModel::ModeledAsset {asset := "Security::assetRequestBytes", name := "Request bytes", text := "The bytes a caller sends, at most 184 of them."})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV001,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV001", name := "Answer that breaks INV-001", text := "The guest answers working although event is cancel, which matters because TASKS.md: a cancel never leaves a task running.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV002,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV002", name := "Answer that breaks INV-002", text := "The guest answers input-required although event is cancel, which matters because a cancel never leaves a task waiting for input.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV003,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV003", name := "Answer that breaks INV-003", text := "The guest answers completed although state is working and elapsed is below deadline, which matters because Tasks.due: no work concludes before finishAfterMs has passed.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV004,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV004", name := "Answer that breaks INV-004", text := "The guest answers failed although state is working and elapsed is below deadline, which matters because Tasks.due: no work fails before finishAfterMs has passed.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV005,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV005", name := "Answer that breaks INV-005", text := "The guest answers working although state is input-required and event is answer and remaining is at least 1, which matters because Tasks.answerInput: a task resumes only once every key is answered.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV006,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV006", name := "Answer that breaks INV-006", text := "The guest answers input-required not when state is input-required and event is settle, which matters because Tasks.settle: settling a task that waits for input changes nothing.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV007,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV007", name := "Answer that breaks INV-007", text := "The guest answers completed not when state is completed, which matters because completed is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV008,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV008", name := "Answer that breaks INV-008", text := "The guest answers failed not when state is failed, which matters because failed is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatAnswerThatBreaksINV009,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV009", name := "Answer that breaks INV-009", text := "The guest answers cancelled not when state is cancelled, which matters because cancelled is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatCancelHidesFinishedWork,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatCancelHidesFinishedWork", name := "Cancel hides finished work", text := "A cancel that arrives after the work finished reports cancelled, and the client loses a result it was owed.", category := (ctor Production.ThreatModel::Stride.repudiation)})
    }
    
    definition{
      name: modeledThreatGrantedCapability,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatGrantedCapability", name := "Granted capability", text := "The guest reads, stores or sends data beyond the request it answers.", category := (ctor Production.ThreatModel::Stride.informationDisclosure)})
    }
    
    definition{
      name: modeledThreatHostClockOrTableSubstituted,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatHostClockOrTableSubstituted", name := "Host clock or table substituted", text := "The host sends a clock that runs backward or a table other than the one it was given, so a task concludes early or reappears.", category := (ctor Production.ThreatModel::Stride.tampering)})
    }
    
    definition{
      name: modeledThreatMalformedRequest,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatMalformedRequest", name := "Malformed request", text := "A request with a missing, extra, unknown or badly written field is answered as if it were well formed.", category := (ctor Production.ThreatModel::Stride.tampering)})
    }
    
    definition{
      name: modeledThreatOversizedRequest,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatOversizedRequest", name := "Oversized request", text := "A request longer than 184 bytes makes the guest parse or allocate without bound.", category := (ctor Production.ThreatModel::Stride.denialOfService)})
    }
    
    definition{
      name: modeledThreatSubstitutedHolo,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatSubstitutedHolo", name := "Substituted holo", text := "A holo other than the one the build verified is served under the app address.", category := (ctor Production.ThreatModel::Stride.spoofing)})
    }
    
    definition{
      name: modeledThreatSubstitutedHost,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatSubstitutedHost", name := "Substituted host", text := "Something other than the repository Pages workflow serves pages under its address.", category := (ctor Production.ThreatModel::Stride.spoofing)})
    }
    
    definition{
      name: modeledThreatTamperedModel,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatTamperedModel", name := "Tampered model", text := "The model the holo is built from differs from the reviewed prompt and spec.", category := (ctor Production.ThreatModel::Stride.tampering)})
    }
    
    definition{
      name: modeledThreatTerminalTaskRevived,
      parameters: [],
      result: Production.ThreatModel::ModeledThreat,
      body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatTerminalTaskRevived", name := "Terminal task revived", text := "A step moves a completed, failed or cancelled task back to working, so a client sees finished work run again.", category := (ctor Production.ThreatModel::Stride.tampering)})
    }
    
    definition{
      name: modeledControlBoundedRequest,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlBoundedRequest", name := "Bounded request", text := "dispatch answers invalid for a request over 184 bytes before reading a field, and the guest allocates at most 368.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlFinalStatesProved,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlFinalStatesProved", name := "Final states proved", text := "The machine declares completed, failed and cancelled final; the builder checks every sampled step keeps them and Lean proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv007Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.review), reference := "MCP src/TaskLaws.lex.tex"}) (nil Production.ThreatModel::Evidence)))})
    }
    
    definition{
      name: modeledControlFingerprintAndProvenance,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlFingerprintAndProvenance", name := "Fingerprint and provenance", text := "The page verifies the holo digests before it runs, and the build signs its provenance as the repository workflow.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "actions/attest-build-provenance in the pages workflow"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "prism-code check of the holo identities in the page"}) (nil Production.ThreatModel::Evidence)))})
    }
    
    definition{
      name: modeledControlNoCapabilityGranted,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlNoCapabilityGranted", name := "No capability granted", text := "prism.toml grants the holo nothing and the model declares capabilitiesEmpty, so a guest import of any host capability is refused.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "prism-code check refuses an ungranted guest import"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV001,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV001", name := "Proof of INV-001", text := "It never answers working when event is cancel. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv001Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV002,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV002", name := "Proof of INV-002", text := "It never answers input-required when event is cancel. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv002Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV003,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV003", name := "Proof of INV-003", text := "It never answers completed when state is working and elapsed is below deadline. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv003Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV004,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV004", name := "Proof of INV-004", text := "It never answers failed when state is working and elapsed is below deadline. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv004Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV005,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV005", name := "Proof of INV-005", text := "It never answers working when state is input-required and event is answer and remaining is at least 1. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv005Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV006,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV006", name := "Proof of INV-006", text := "It always answers input-required when state is input-required and event is settle. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv006Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV007,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV007", name := "Proof of INV-007", text := "It always answers completed when state is completed. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv007Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV008,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV008", name := "Proof of INV-008", text := "It always answers failed when state is failed. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv008Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlProofOfINV009,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV009", name := "Proof of INV-009", text := "It always answers cancelled when state is cancelled. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv009Holds"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: modeledControlRegeneratedFromThePrompt,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlRegeneratedFromThePrompt", name := "Regenerated from the prompt", text := "The model is written from the prompt by the builder, and the build checks every theorem and replays every vector in the pinned SDK.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "prismpm verify in the SDK image prismpm.lock pins"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.review), reference := "app/prompt.json"}) (nil Production.ThreatModel::Evidence)))})
    }
    
    definition{
      name: modeledControlSettleBeforeCancel,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlSettleBeforeCancel", name := "Settle before cancel", text := "tasks/cancel settles first, so work already due concludes and the cancel leaves it.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "McpTaskLifecycleProofs::inv001Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "MCP crates/lifecycle-oracle/tests/tasks.rs TK-01 to TK-16"}) (nil Production.ThreatModel::Evidence)))})
    }
    
    definition{
      name: modeledControlStrictDecoder,
      parameters: [],
      result: Production.ThreatModel::ModeledControl,
      body: (record Production.ThreatModel::ModeledControl {control := "Security::controlStrictDecoder", name := "Strict decoder", text := "Every field is decoded exactly: choices from their list, numbers as plain decimal digits within their bounds, single spaces between fields; anything else is invalid.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify"}) (nil Production.ThreatModel::Evidence))})
    }
    
    definition{
      name: mappingOversizedRequest,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatOversizedRequest", controls := (cons "Security::controlBoundedRequest" (nil String))})
    }
    
    definition{
      name: mappingTerminalTaskRevived,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatTerminalTaskRevived", controls := (cons "Security::controlFinalStatesProved" (nil String))})
    }
    
    definition{
      name: mappingSubstitutedHolo,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatSubstitutedHolo", controls := (cons "Security::controlFingerprintAndProvenance" (nil String))})
    }
    
    definition{
      name: mappingGrantedCapability,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatGrantedCapability", controls := (cons "Security::controlNoCapabilityGranted" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV001,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV001", controls := (cons "Security::controlProofOfINV001" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV002,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV002", controls := (cons "Security::controlProofOfINV002" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV003,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV003", controls := (cons "Security::controlProofOfINV003" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV004,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV004", controls := (cons "Security::controlProofOfINV004" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV005,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV005", controls := (cons "Security::controlProofOfINV005" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV006,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV006", controls := (cons "Security::controlProofOfINV006" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV007,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV007", controls := (cons "Security::controlProofOfINV007" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV008,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV008", controls := (cons "Security::controlProofOfINV008" (nil String))})
    }
    
    definition{
      name: mappingAnswerThatBreaksINV009,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV009", controls := (cons "Security::controlProofOfINV009" (nil String))})
    }
    
    definition{
      name: mappingTamperedModel,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatTamperedModel", controls := (cons "Security::controlRegeneratedFromThePrompt" (nil String))})
    }
    
    definition{
      name: mappingCancelHidesFinishedWork,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatCancelHidesFinishedWork", controls := (cons "Security::controlSettleBeforeCancel" (nil String))})
    }
    
    definition{
      name: mappingMalformedRequest,
      parameters: [],
      result: Production.ThreatModel::ThreatMapping,
      body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatMalformedRequest", controls := (cons "Security::controlStrictDecoder" (nil String))})
    }
    
    definition{
      name: acceptedHostClockOrTableSubstituted,
      parameters: [],
      result: Production.ThreatModel::AcceptedRisk,
      body: (record Production.ThreatModel::AcceptedRisk {threat := "Security::threatHostClockOrTableSubstituted", rationale := "The core keeps no state by design; TASKS.md puts the clock and the table in the host's custody, and the host owes the core exactly what it was given."})
    }
    
    definition{
      name: acceptedSubstitutedHost,
      parameters: [],
      result: Production.ThreatModel::AcceptedRisk,
      body: (record Production.ThreatModel::AcceptedRisk {threat := "Security::threatSubstitutedHost", rationale := "A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt."})
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/McpTaskLifecycle.lex.tex 414 lines
    \begin{lexlean}{McpTaskLifecycle}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{Foundation.Bytes}
    \importmodule{Foundation.View.Text.V1.Model}
    \title{Text application model}
    \begin{semanticmodule}
    definition{name: stateWorking, parameters: [], result: Nat, body: 0}
    
    definition{name: stateInputRequired, parameters: [], result: Nat, body: 1}
    
    definition{name: stateCompleted, parameters: [], result: Nat, body: 2}
    
    definition{name: stateFailed, parameters: [], result: Nat, body: 3}
    
    definition{name: stateCancelled, parameters: [], result: Nat, body: 4}
    
    definition{name: eventSettle, parameters: [], result: Nat, body: 0}
    
    definition{name: eventAnswer, parameters: [], result: Nat, body: 1}
    
    definition{name: eventCancel, parameters: [], result: Nat, body: 2}
    
    definition{name: asksYes, parameters: [], result: Nat, body: 0}
    
    definition{name: asksNo, parameters: [], result: Nat, body: 1}
    
    definition{name: outcomeCompletes, parameters: [], result: Nat, body: 0}
    
    definition{name: outcomeFails, parameters: [], result: Nat, body: 1}
    
    definition{name: answerWorking, parameters: [], result: Nat, body: 0}
    
    definition{name: answerInputRequired, parameters: [], result: Nat, body: 1}
    
    definition{name: answerCompleted, parameters: [], result: Nat, body: 2}
    
    definition{name: answerFailed, parameters: [], result: Nat, body: 3}
    
    definition{name: answerCancelled, parameters: [], result: Nat, body: 4}
    
    structure{
      name: Request,
      type_parameters: [],
      parameters: [],
      fields: [
        {name: state, type: Nat},
        {name: event, type: Nat},
        {name: asks, type: Nat},
        {name: elapsed, type: Nat},
        {name: deadline, type: Nat},
        {name: outcome, type: Nat},
        {name: remaining, type: Nat}
      ]
    }
    
    definition{
      name: byteAt,
      parameters: [s : Bytes, i : Nat],
      result: (Option Nat),
      body: (match (prim index s i : (Option UInt8))
        | Option.none => (ctor Option.none [Nat])
        | Option.some b => (ctor Option.some [Nat] (prim to_nat b : Nat))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: digitsValue,
      parameters: [s : Bytes, i : Nat, acc : Nat, fuel : Nat],
      result: (Option Nat),
      body: (match fuel
        | Nat.zero => (ctor Option.some [Nat] acc)
        | Nat.succ rest => (match (byteAt s i)
          | Option.none => (ctor Option.none [Nat])
          | Option.some d => (if ((d <? 48) || (57 <? d)) then (ctor Option.none [Nat]) else (digitsValue s (i + 1) ((prim multiply acc 10 : Nat) + (prim subtract d 48 : Nat)) rest)))),
      axioms: [Quot.sound, propext],
      recursive_argument: fuel
    }
    
    definition{
      name: parseDigits,
      parameters: [s : Bytes],
      result: (Option Nat),
      body: (if ((Foundation.Bytes::byteLength s) =? 0) then (ctor Option.none [Nat]) else (if (18 <? (Foundation.Bytes::byteLength s)) then (ctor Option.none [Nat]) else (match (byteAt s 0)
        | Option.none => (ctor Option.none [Nat])
        | Option.some lead => (if ((lead =? 48) && (1 <? (Foundation.Bytes::byteLength s))) then (ctor Option.none [Nat]) else (digitsValue s 0 0 (Foundation.Bytes::byteLength s)))))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: parseNumber,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (parseDigits value),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: parseState,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (if (prim equal value 0x776f726b696e67 : Bool) then (ctor Option.some [Nat] (stateWorking)) else (if (prim equal value 0x696e7075742d7265717569726564 : Bool) then (ctor Option.some [Nat] (stateInputRequired)) else (if (prim equal value 0x636f6d706c65746564 : Bool) then (ctor Option.some [Nat] (stateCompleted)) else (if (prim equal value 0x6661696c6564 : Bool) then (ctor Option.some [Nat] (stateFailed)) else (if (prim equal value 0x63616e63656c6c6564 : Bool) then (ctor Option.some [Nat] (stateCancelled)) else (ctor Option.none [Nat]))))))
    }
    
    definition{
      name: parseEvent,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (if (prim equal value 0x736574746c65 : Bool) then (ctor Option.some [Nat] (eventSettle)) else (if (prim equal value 0x616e73776572 : Bool) then (ctor Option.some [Nat] (eventAnswer)) else (if (prim equal value 0x63616e63656c : Bool) then (ctor Option.some [Nat] (eventCancel)) else (ctor Option.none [Nat]))))
    }
    
    definition{
      name: parseAsks,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (if (prim equal value 0x796573 : Bool) then (ctor Option.some [Nat] (asksYes)) else (if (prim equal value 0x6e6f : Bool) then (ctor Option.some [Nat] (asksNo)) else (ctor Option.none [Nat])))
    }
    
    definition{
      name: parseElapsed,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (match (parseNumber value)
        | Option.none => (ctor Option.none [Nat])
        | Option.some parsed => (ctor Option.some [Nat] parsed)),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: parseDeadline,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (match (parseNumber value)
        | Option.none => (ctor Option.none [Nat])
        | Option.some parsed => (ctor Option.some [Nat] parsed)),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: parseOutcome,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (if (prim equal value 0x636f6d706c65746573 : Bool) then (ctor Option.some [Nat] (outcomeCompletes)) else (if (prim equal value 0x6661696c73 : Bool) then (ctor Option.some [Nat] (outcomeFails)) else (ctor Option.none [Nat])))
    }
    
    definition{
      name: parseRemaining,
      parameters: [value : Bytes],
      result: (Option Nat),
      body: (match (parseNumber value)
        | Option.none => (ctor Option.none [Nat])
        | Option.some parsed => (ctor Option.some [Nat] parsed)),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: sliceOf,
      parameters: [s : Bytes, start : Nat, count : Nat],
      result: Bytes,
      body: (match (prim slice s start count : (Option Bytes))
        | Option.none => 0x
        | Option.some part => part)
    }
    
    definition{
      name: fieldEnd,
      parameters: [s : Bytes, i : Nat, fuel : Nat],
      result: Nat,
      body: (match fuel
        | Nat.zero => i
        | Nat.succ rest => (match (byteAt s i)
          | Option.none => i
          | Option.some d => (if (d =? 32) then i else (fieldEnd s (i + 1) rest)))),
      axioms: [Quot.sound, propext],
      recursive_argument: fuel
    }
    
    definition{
      name: decodeField7,
      parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat, v4 : Nat, v5 : Nat, v6 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseRemaining (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v7 => (if (e =? (Foundation.Bytes::byteLength s)) then (ctor Option.some [Request] (record Request {state := v1, event := v2, asks := v3, elapsed := v4, deadline := v5, outcome := v6, remaining := v7})) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField6,
      parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat, v4 : Nat, v5 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseOutcome (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v6 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField7 s (e + 1) v1 v2 v3 v4 v5 v6) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField5,
      parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat, v4 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseDeadline (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v5 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField6 s (e + 1) v1 v2 v3 v4 v5) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField4,
      parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseElapsed (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v4 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField5 s (e + 1) v1 v2 v3 v4) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField3,
      parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseAsks (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v3 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField4 s (e + 1) v1 v2 v3) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField2,
      parameters: [s : Bytes, start : Nat, v1 : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseEvent (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v2 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField3 s (e + 1) v1 v2) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: decodeField1,
      parameters: [s : Bytes, start : Nat],
      result: (Option Request),
      body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseState (sliceOf s start (prim subtract e start : Nat)))
        | Option.none => (ctor Option.none [Request])
        | Option.some v1 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField2 s (e + 1) v1) else (ctor Option.none [Request])))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: rule1,
      parameters: [request : Request],
      result: Bool,
      body: ((project request state) =? (stateCompleted))
    }
    
    definition{
      name: rule2,
      parameters: [request : Request],
      result: Bool,
      body: ((project request state) =? (stateFailed))
    }
    
    definition{
      name: rule3,
      parameters: [request : Request],
      result: Bool,
      body: ((project request state) =? (stateCancelled))
    }
    
    definition{
      name: rule4,
      parameters: [request : Request],
      result: Bool,
      body: ((((((project request event) =? (eventCancel)) && ((project request state) =? (stateWorking))) && ((project request asks) =? (asksNo))) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeCompletes)))
    }
    
    definition{
      name: rule5,
      parameters: [request : Request],
      result: Bool,
      body: ((((((project request event) =? (eventCancel)) && ((project request state) =? (stateWorking))) && ((project request asks) =? (asksNo))) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeFails)))
    }
    
    definition{
      name: rule6,
      parameters: [request : Request],
      result: Bool,
      body: ((project request event) =? (eventCancel))
    }
    
    definition{
      name: rule7,
      parameters: [request : Request],
      result: Bool,
      body: (((((project request event) =? (eventSettle)) && ((project request state) =? (stateWorking))) && ((project request asks) =? (asksYes))) && ((project request deadline) <=? (project request elapsed)))
    }
    
    definition{
      name: rule8,
      parameters: [request : Request],
      result: Bool,
      body: (((((project request event) =? (eventSettle)) && ((project request state) =? (stateWorking))) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeCompletes)))
    }
    
    definition{
      name: rule9,
      parameters: [request : Request],
      result: Bool,
      body: (((((project request event) =? (eventSettle)) && ((project request state) =? (stateWorking))) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeFails)))
    }
    
    definition{
      name: rule10,
      parameters: [request : Request],
      result: Bool,
      body: ((((((project request event) =? (eventAnswer)) && ((project request state) =? (stateInputRequired))) && ((project request remaining) =? 0)) && ((project request asks) =? (asksYes))) && ((project request deadline) <=? (project request elapsed)))
    }
    
    definition{
      name: rule11,
      parameters: [request : Request],
      result: Bool,
      body: ((((((project request event) =? (eventAnswer)) && ((project request state) =? (stateInputRequired))) && ((project request remaining) =? 0)) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeCompletes)))
    }
    
    definition{
      name: rule12,
      parameters: [request : Request],
      result: Bool,
      body: ((((((project request event) =? (eventAnswer)) && ((project request state) =? (stateInputRequired))) && ((project request remaining) =? 0)) && ((project request deadline) <=? (project request elapsed))) && ((project request outcome) =? (outcomeFails)))
    }
    
    definition{
      name: rule13,
      parameters: [request : Request],
      result: Bool,
      body: ((((project request event) =? (eventAnswer)) && ((project request state) =? (stateInputRequired))) && ((project request remaining) =? 0))
    }
    
    definition{
      name: rule14,
      parameters: [request : Request],
      result: Bool,
      body: ((project request state) =? (stateInputRequired))
    }
    
    definition{
      name: stepWorking,
      parameters: [request : Request],
      result: Nat,
      body: (if (rule4 request) then (answerCompleted) else (if (rule5 request) then (answerFailed) else (if (rule6 request) then (answerCancelled) else (if (rule7 request) then (answerInputRequired) else (if (rule8 request) then (answerCompleted) else (if (rule9 request) then (answerFailed) else (answerWorking)))))))
    }
    
    definition{
      name: stepInputRequired,
      parameters: [request : Request],
      result: Nat,
      body: (if (rule6 request) then (answerCancelled) else (if (rule10 request) then (answerInputRequired) else (if (rule11 request) then (answerCompleted) else (if (rule12 request) then (answerFailed) else (if (rule13 request) then (answerWorking) else (if (rule14 request) then (answerInputRequired) else (answerWorking)))))))
    }
    
    definition{
      name: stepCompleted,
      parameters: [request : Request],
      result: Nat,
      body: (if (rule1 request) then (answerCompleted) else (if (rule6 request) then (answerCancelled) else (answerWorking)))
    }
    
    definition{
      name: stepFailed,
      parameters: [request : Request],
      result: Nat,
      body: (if (rule2 request) then (answerFailed) else (if (rule6 request) then (answerCancelled) else (answerWorking)))
    }
    
    definition{
      name: stepCancelled,
      parameters: [request : Request],
      result: Nat,
      body: (if (rule3 request) then (answerCancelled) else (if (rule6 request) then (answerCancelled) else (answerWorking)))
    }
    
    definition{
      name: judge,
      parameters: [request : Request],
      result: Nat,
      body: (if ((project request state) =? (stateWorking)) then (stepWorking request) else (if ((project request state) =? (stateInputRequired)) then (stepInputRequired request) else (if ((project request state) =? (stateCompleted)) then (stepCompleted request) else (if ((project request state) =? (stateFailed)) then (stepFailed request) else (if ((project request state) =? (stateCancelled)) then (stepCancelled request) else (if (rule6 request) then (answerCancelled) else (answerWorking)))))))
    }
    
    definition{
      name: encodeAnswer,
      parameters: [code : Nat],
      result: Bytes,
      body: (if (code =? (answerWorking)) then 0x776f726b696e67 else (if (code =? (answerInputRequired)) then 0x696e7075742d7265717569726564 else (if (code =? (answerCompleted)) then 0x636f6d706c65746564 else (if (code =? (answerFailed)) then 0x6661696c6564 else (if (code =? (answerCancelled)) then 0x63616e63656c6c6564 else 0x696e76616c6964)))))
    }
    
    definition{
      name: dispatch,
      parameters: [value : Bytes],
      result: Bytes,
      body: (if (184 <? (Foundation.Bytes::byteLength value)) then 0x696e76616c6964 else (match (decodeField1 value 0)
        | Option.none => 0x696e76616c6964
        | Option.some request => (encodeAnswer (judge request)))),
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: application,
      parameters: [],
      result: Foundation.View.Text.V1.Model::TextApplication,
      body: (record Foundation.View.Text.V1.Model::TextApplication {profile := "prismpm/text-application/1", name := "MCP task lifecycle", cargoName := "prism-mcp-task-lifecycle", cargoVersion := "0.1.0", cargoDescription := "Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys rema", cargoRepository := "https://github.com/UOR-Foundation/PrismPM", cargoHomepage := "https://github.com/UOR-Foundation/PrismPM", libraryRoots := (cons "PrismMcpTaskLifecycle.McpTaskLifecycle.dispatch" (nil String)), acceptanceVectors := (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f2031353030203130303020636f6d706c657465732030, response := 0x636f6d706c65746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320353030203130303020636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732031303030203130303020636f6d706c657465732030, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f20323030302031303030206661696c732030, response := 0x6661696c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x696e7075742d726571756972656420616e73776572206e6f2032303030203530303020636f6d706c657465732031, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x696e7075742d726571756972656420616e73776572206e6f2032303030203530303020636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x696e7075742d726571756972656420616e73776572206e6f20363030302035303030206661696c732030, response := 0x6661696c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e672063616e63656c206e6f2032303030203130303020636f6d706c657465732030, response := 0x636f6d706c65746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e672063616e63656c20796573203130203130303020636f6d706c657465732030, response := 0x63616e63656c6c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x636f6d706c657465642063616e63656c206e6f2030203020636f6d706c657465732030, response := 0x636f6d706c65746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c657465732030, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c657465732031, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320302030206661696c732030, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320302030206661696c732031, response := 0x696e7075742d7265717569726564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203120636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203120636f6d706c657465732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320302031206661696c732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320302031206661696c732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f2030203020636f6d706c657465732030, response := 0x636f6d706c65746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f2030203020636f6d706c657465732031, response := 0x636f6d706c65746564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f20302030206661696c732030, response := 0x6661696c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f20302030206661696c732031, response := 0x6661696c6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f2030203120636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f2030203120636f6d706c657465732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f20302031206661696c732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65206e6f20302031206661696c732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e73776572207965732030203020636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e73776572207965732030203020636f6d706c657465732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e737765722079657320302030206661696c732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e737765722079657320302030206661696c732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e73776572207965732030203120636f6d706c657465732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e73776572207965732030203120636f6d706c657465732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e737765722079657320302031206661696c732030, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720616e737765722079657320302031206661696c732031, response := 0x776f726b696e67}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0xff, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c65746573, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c6574657320302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e672020736574746c6520207965732020302020302020636f6d706c65746573202030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6b6e6f776e20736574746c65207965732030203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720756e6b6e6f776e207965732030203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520756e6b6e6f776e2030203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520796573203037203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520796573202d31203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520796573202b31203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732031303030303030303030303030303030303030203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c652079657320d9a1203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732078203020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520796573203020303720636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030202d3120636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030202b3120636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203130303030303030303030303030303030303020636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c6520796573203020d9a120636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030207820636f6d706c657465732030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020756e6b6e6f776e2030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c65746573203037, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c65746573202d31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c65746573202b31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c657465732031303030303030303030303030303030303030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c6574657320d9a1, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x776f726b696e6720736574746c65207965732030203020636f6d706c657465732078, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (nil Foundation.View.Text.V1.Model::AcceptanceVector)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))), entryRoot := "PrismMcpTaskLifecycle.McpTaskLifecycle.dispatch", coreContract := "hologram:guest/core-wasm@1", requestMaximum := (184 : UInt32), responseMaximum := (64 : UInt32), guestAllocationMaximum := (368 : UInt32), capabilitiesEmpty := true, fatArchive := true, primaryLayer := (0 : UInt8), viewLayer := (1 : UInt8), view := (record Foundation.View.Text.V1.Model::TextView {title := "MCP task lifecycle", heading := "MCP task lifecycle", inputLabel := "Request: state event asks elapsed deadline outcome remaining", submitLabel := "Decide", outputLabel := "Answer", inputError := "Invalid request", responseError := "Invalid response"})})
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/src/McpTaskLifecycleProofs.lex.tex 513 lines
    \begin{lexlean}{McpTaskLifecycleProofs}
    \useglossary{lexlean.std.bool@1.2.0}
    \useglossary{lexlean.std.nat@1.2.0}
    \useglossary{prism.arch@1.0.0}
    \importmodule{McpTaskLifecycle}
    \title{Text application model}
    \begin{semanticmodule}
    definition{
      name: breaksInv001,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request event) =? (McpTaskLifecycle::eventCancel))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerWorking)))
    }
    
    theorem{
      name: inv001Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv001 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv001
        ]
      },
      axioms: [Classical.choice, Quot.sound, propext]
    }
    
    definition{
      name: breaksInv002,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request event) =? (McpTaskLifecycle::eventCancel))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerInputRequired)))
    }
    
    theorem{
      name: inv002Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv002 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv002
        ]
      },
      axioms: [Classical.choice, Quot.sound, propext]
    }
    
    definition{
      name: breaksInv003,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateWorking))) && ((project request elapsed) <? (project request deadline))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCompleted)))
    }
    
    theorem{
      name: inv003Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv003 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv003
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv004,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateWorking))) && ((project request elapsed) <? (project request deadline))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerFailed)))
    }
    
    theorem{
      name: inv004Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv004 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv004
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv005,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateInputRequired))) && ((project request event) =? (McpTaskLifecycle::eventAnswer))) && (1 <=? (project request remaining))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerWorking)))
    }
    
    theorem{
      name: inv005Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv005 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv005
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv006,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateInputRequired))) && ((project request event) =? (McpTaskLifecycle::eventSettle))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerInputRequired))))
    }
    
    theorem{
      name: inv006Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv006 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv006
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv007,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateCompleted))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCompleted))))
    }
    
    theorem{
      name: inv007Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv007 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv007
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv008,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateFailed))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerFailed))))
    }
    
    theorem{
      name: inv008Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv008 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv008
        ]
      },
      axioms: [Quot.sound, propext]
    }
    
    definition{
      name: breaksInv009,
      parameters: [request : McpTaskLifecycle::Request],
      result: Bool,
      body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateCancelled))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCancelled))))
    }
    
    theorem{
      name: inv009Holds,
      parameters: [request : McpTaskLifecycle::Request],
      statement: ((breaksInv009 request) = false),
      proof: linear_arithmetic{
        definitions: [
          McpTaskLifecycle::answerCancelled,
          McpTaskLifecycle::answerCompleted,
          McpTaskLifecycle::answerFailed,
          McpTaskLifecycle::answerInputRequired,
          McpTaskLifecycle::answerWorking,
          McpTaskLifecycle::asksNo,
          McpTaskLifecycle::asksYes,
          McpTaskLifecycle::eventAnswer,
          McpTaskLifecycle::eventCancel,
          McpTaskLifecycle::eventSettle,
          McpTaskLifecycle::judge,
          McpTaskLifecycle::outcomeCompletes,
          McpTaskLifecycle::outcomeFails,
          McpTaskLifecycle::rule1,
          McpTaskLifecycle::rule10,
          McpTaskLifecycle::rule11,
          McpTaskLifecycle::rule12,
          McpTaskLifecycle::rule13,
          McpTaskLifecycle::rule14,
          McpTaskLifecycle::rule2,
          McpTaskLifecycle::rule3,
          McpTaskLifecycle::rule4,
          McpTaskLifecycle::rule5,
          McpTaskLifecycle::rule6,
          McpTaskLifecycle::rule7,
          McpTaskLifecycle::rule8,
          McpTaskLifecycle::rule9,
          McpTaskLifecycle::stateCancelled,
          McpTaskLifecycle::stateCompleted,
          McpTaskLifecycle::stateFailed,
          McpTaskLifecycle::stateInputRequired,
          McpTaskLifecycle::stateWorking,
          McpTaskLifecycle::stepCancelled,
          McpTaskLifecycle::stepCompleted,
          McpTaskLifecycle::stepFailed,
          McpTaskLifecycle::stepInputRequired,
          McpTaskLifecycle::stepWorking,
          breaksInv009
        ]
      },
      axioms: [Quot.sound, propext]
    }
    \end{semanticmodule}
    \end{lexlean}
    
    app/lexlean.toml 43 lines
    spec = "lexlean/project/1"
    name = "prism-mcp-task-lifecycle"
    language = "1.2"
    module_prefix = "PrismMcpTaskLifecycle"
    source_roots = ["src"]
    entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/McpTaskLifecycle.lex.tex", "src/McpTaskLifecycleProofs.lex.tex", "src/Quality.lex.tex", "src/Security.lex.tex"]
    build_root = ".lexlean"
    lockfile = "lexlean.lock"
    lean_workspace = "."
    lean_toolchain = "leanprover/lean4:v4.32.1"
    
    [[lexicon_source]]
    package = "lexlean.std.nat"
    kind = "builtin"
    
    [[lexicon_source]]
    package = "prism.arch"
    kind = "path"
    path = "language/prism.arch"
    
    [[lexicon_source]]
    package = "prism.qual"
    kind = "path"
    path = "language/prism.qual"
    
    [[lexicon_source]]
    package = "prism.sec"
    kind = "path"
    path = "language/prism.sec"
    
    [limits]
    max_file_bytes = 4194304
    max_total_source_bytes = 67108864
    max_primitive_atoms = 2000000
    max_token_lattice_edges = 4000000
    max_parse_states = 4000000
    max_ir_nodes = 2000000
    max_scope_depth = 1024
    max_import_depth = 128
    max_diagnostics = 256
    max_child_output_bytes = 16777216
    child_timeout_ms = 300000
    
    app/prompt.json 729 lines
    {
      "schema": "prism/prompt/1",
      "pattern": "stateMachine",
      "machine": {
        "state": "state",
        "initial": "working",
        "final": [
          "completed",
          "failed",
          "cancelled"
        ]
      },
      "goal": "Find an MCP task's next state, so a client that polls, updates or cancels it always sees the state the protocol would write.",
      "repository": "UOR-Foundation/MCP",
      "app": {
        "name": "mcp-task-lifecycle",
        "title": "MCP task lifecycle",
        "purpose": "Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered.",
        "limits": [
          "It does not create a task: a task starts working, as the seed of its tool's plan, when tools/call decides to answer a task.",
          "It does not expire a task: a task past its ttlMs is dropped from the host's table by the next request, outside this step.",
          "It does not check the host's clock or table; the host owes the core exactly the table it was given."
        ],
        "fields": [
          {
            "name": "state",
            "kind": "choice",
            "values": [
              "working",
              "input-required",
              "completed",
              "failed",
              "cancelled"
            ],
            "means": "the task's current status, as DetailedTask in src/Tasks.lex.tex"
          },
          {
            "name": "event",
            "kind": "choice",
            "values": [
              "settle",
              "answer",
              "cancel"
            ],
            "means": "the step: settle (tasks/get), answer (tasks/update with every given key) or cancel (tasks/cancel)"
          },
          {
            "name": "asks",
            "kind": "choice",
            "values": [
              "yes",
              "no"
            ],
            "means": "whether the task's plan still holds input requests to park on (parkedPlan empties them once it parks)"
          },
          {
            "name": "elapsed",
            "kind": "number",
            "min": 0,
            "means": "milliseconds since the task was created, now_ms less createdMs"
          },
          {
            "name": "deadline",
            "kind": "number",
            "min": 0,
            "means": "milliseconds after creation the plan's next step is due: parkAfterMs when it asks, finishAfterMs otherwise"
          },
          {
            "name": "outcome",
            "kind": "choice",
            "values": [
              "completes",
              "fails"
            ],
            "means": "how the plan concludes: PlanOutcome.completes with a result or PlanOutcome.fails with a JSON-RPC error"
          },
          {
            "name": "remaining",
            "kind": "number",
            "min": 0,
            "means": "input keys still unanswered after this answer"
          }
        ],
        "outcomes": [
          "working",
          "input-required",
          "completed",
          "failed",
          "cancelled"
        ],
        "meanings": {
          "working": "the task is running; tasks/get answers status working",
          "input-required": "the task waits for the client to answer its inputRequests through tasks/update",
          "completed": "terminal: the plan's result is the task's result",
          "failed": "terminal: the task carries the plan's JSON-RPC error",
          "cancelled": "terminal: the client cancelled the task before it finished"
        },
        "rules": [
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "completed"
              }
            ],
            "then": "completed",
            "why": "src/Tasks.lex.tex: settle, answer and cancel keep a completed entry (kept entry)"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "failed"
              }
            ],
            "then": "failed",
            "why": "src/Tasks.lex.tex: a failed task is terminal (isTerminal), and every step keeps it"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "cancelled"
              }
            ],
            "then": "cancelled",
            "why": "src/Tasks.lex.tex: a cancelled task is terminal, and every step keeps it"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "no"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.cancel settles first: work that finished before the cancel stays completed (TASKS.md, What a task does)"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "no"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.cancel settles first: work that failed before the cancel stays failed"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "cancelled",
            "why": "Tasks.cancelSettled: a working or input_required task becomes cancelled"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "asks",
                "op": "is",
                "value": "yes"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "input-required",
            "why": "Tasks.settleWorking: a plan that parks moves to input_required once parkAfterMs has passed"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.settleWorking: with nothing to ask, the task concludes once finishAfterMs has passed (Tasks.due)"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              },
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.concluded: a plan that fails gives a failed task with its JSON-RPC error"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "asks",
                "op": "is",
                "value": "yes"
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "input-required",
            "why": "Tasks.resume settles at once: a plan that still asks parks again"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "completes"
              }
            ],
            "then": "completed",
            "why": "Tasks.answerInput: the last key answered resumes the task, which settles at once and completes if due"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              },
              {
                "field": "elapsed",
                "op": ">=",
                "value": {
                  "field": "deadline"
                }
              },
              {
                "field": "outcome",
                "op": "is",
                "value": "fails"
              }
            ],
            "then": "failed",
            "why": "Tasks.answerInput: the last key answered resumes the task, which settles at once and fails if due"
          },
          {
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "remaining",
                "op": "=",
                "value": 0
              }
            ],
            "then": "working",
            "why": "Tasks.resume: with every key answered and nothing due, the task returns to working"
          },
          {
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              }
            ],
            "then": "input-required",
            "why": "Tasks.settle keeps an input_required task, and answerInput keeps it while any key remains"
          }
        ],
        "otherwise": "working",
        "otherwiseWhy": "src/Tasks.lex.tex: a working task whose next step is not yet due, or that is answered, is kept as it is",
        "properties": [
          {
            "kind": "never",
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "working",
            "why": "TASKS.md: a cancel never leaves a task running"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "event",
                "op": "is",
                "value": "cancel"
              }
            ],
            "then": "input-required",
            "why": "a cancel never leaves a task waiting for input"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": "<",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "completed",
            "why": "Tasks.due: no work concludes before finishAfterMs has passed"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "working"
              },
              {
                "field": "elapsed",
                "op": "<",
                "value": {
                  "field": "deadline"
                }
              }
            ],
            "then": "failed",
            "why": "Tasks.due: no work fails before finishAfterMs has passed"
          },
          {
            "kind": "never",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "event",
                "op": "is",
                "value": "answer"
              },
              {
                "field": "remaining",
                "op": ">=",
                "value": 1
              }
            ],
            "then": "working",
            "why": "Tasks.answerInput: a task resumes only once every key is answered"
          },
          {
            "kind": "always",
            "when": [
              {
                "field": "state",
                "op": "is",
                "value": "input-required"
              },
              {
                "field": "event",
                "op": "is",
                "value": "settle"
              }
            ],
            "then": "input-required",
            "why": "Tasks.settle: settling a task that waits for input changes nothing"
          }
        ],
        "examples": [
          {
            "request": "working settle no 1500 1000 completes 0",
            "response": "completed"
          },
          {
            "request": "working settle yes 500 1000 completes 0",
            "response": "working"
          },
          {
            "request": "working settle yes 1000 1000 completes 0",
            "response": "input-required"
          },
          {
            "request": "working settle no 2000 1000 fails 0",
            "response": "failed"
          },
          {
            "request": "input-required answer no 2000 5000 completes 1",
            "response": "input-required"
          },
          {
            "request": "input-required answer no 2000 5000 completes 0",
            "response": "working"
          },
          {
            "request": "input-required answer no 6000 5000 fails 0",
            "response": "failed"
          },
          {
            "request": "working cancel no 2000 1000 completes 0",
            "response": "completed"
          },
          {
            "request": "working cancel yes 10 1000 completes 0",
            "response": "cancelled"
          },
          {
            "request": "completed cancel no 0 0 completes 0",
            "response": "completed"
          },
          {
            "request": "working settle",
            "response": "invalid"
          }
        ]
      },
      "stakeholders": [
        {
          "name": "MCP client author",
          "text": "Polls a task through tasks/get, answers it through tasks/update and cancels it through tasks/cancel, and needs every answer to be the state the protocol allows.",
          "concerns": [
            "Correct answers",
            "Proved guarantees"
          ]
        },
        {
          "name": "Host adapter author",
          "text": "Holds the task table between requests for the stateless core (PrismPM issue 216) and needs a finished task to stay finished whatever arrives next.",
          "concerns": [
            "Terminal tasks stay terminal",
            "Refused malformed requests"
          ]
        }
      ],
      "concerns": [
        {
          "name": "Terminal tasks stay terminal",
          "text": "A completed, failed or cancelled task is never moved again by settle, answer or cancel.",
          "model": "quality"
        }
      ],
      "components": [
        {
          "name": "MCP client",
          "text": "The client that declares io.modelcontextprotocol/tasks in its request _meta and calls tasks/get, tasks/update and tasks/cancel.",
          "kind": "externalSystem"
        },
        {
          "name": "Host adapter",
          "text": "PrismPM's adapter (issue 216): it sends now_ms, the fresh task id and the task table in every request frame and stores the table the core returns.",
          "kind": "service"
        },
        {
          "name": "MCP conformance suite",
          "text": "modelcontextprotocol/conformance at cf022cbb, whose tasks scenarios drive the conformance build.",
          "kind": "externalSystem"
        }
      ],
      "threats": [
        {
          "name": "Terminal task revived",
          "text": "A step moves a completed, failed or cancelled task back to working, so a client sees finished work run again.",
          "stride": "tampering",
          "asset": "answer",
          "likelihood": "low",
          "impact": "critical",
          "control": {
            "name": "Final states proved",
            "text": "The machine declares completed, failed and cancelled final; the builder checks every sampled step keeps them and Lean proves it for every request.",
            "evidence": [
              {
                "kind": "proof",
                "reference": "McpTaskLifecycleProofs::inv007Holds"
              },
              {
                "kind": "review",
                "reference": "MCP src/TaskLaws.lex.tex"
              }
            ]
          }
        },
        {
          "name": "Cancel hides finished work",
          "text": "A cancel that arrives after the work finished reports cancelled, and the client loses a result it was owed.",
          "stride": "repudiation",
          "asset": "answer",
          "likelihood": "medium",
          "impact": "major",
          "control": {
            "name": "Settle before cancel",
            "text": "tasks/cancel settles first, so work already due concludes and the cancel leaves it.",
            "evidence": [
              {
                "kind": "proof",
                "reference": "McpTaskLifecycleProofs::inv001Holds"
              },
              {
                "kind": "gate",
                "reference": "MCP crates/lifecycle-oracle/tests/tasks.rs TK-01 to TK-16"
              }
            ]
          }
        },
        {
          "name": "Host clock or table substituted",
          "text": "The host sends a clock that runs backward or a table other than the one it was given, so a task concludes early or reappears.",
          "stride": "tampering",
          "asset": "request",
          "likelihood": "low",
          "impact": "major",
          "accepted": "The core keeps no state by design; TASKS.md puts the clock and the table in the host's custody, and the host owes the core exactly what it was given."
        }
      ],
      "quality": [
        {
          "characteristic": "Functional suitability",
          "subcharacteristic": "Functional correctness",
          "requirement": "Every step matches the core",
          "text": "Each acceptance vector answers the state Tasks.settle, Tasks.answer or Tasks.cancel writes.",
          "measure": "Vectors that disagree",
          "measureText": "Acceptance vectors whose replayed answer differs from the expected next state.",
          "threshold": 0
        },
        {
          "characteristic": "Reliability",
          "subcharacteristic": "Faultlessness",
          "requirement": "No final state is left",
          "text": "No step takes a completed, failed or cancelled task to another state.",
          "measure": "Final states left",
          "measureText": "Sampled steps from a final state whose answer is another state.",
          "threshold": 0
        }
      ],
      "journeys": [
        {
          "stakeholder": "MCP client author",
          "steps": [
            "otherwise",
            "REQ-007",
            "REQ-013",
            "REQ-008",
            "INV-005"
          ]
        },
        {
          "stakeholder": "Host adapter author",
          "steps": [
            "REQ-001",
            "REQ-006",
            "INV-007",
            "refuse"
          ]
        }
      ],
      "axioms": {
        "inv001Holds": [
          "Classical.choice",
          "Quot.sound",
          "propext"
        ],
        "inv002Holds": [
          "Classical.choice",
          "Quot.sound",
          "propext"
        ]
      },
      "license": "MIT OR Apache-2.0"
    }
    
    model/ids.toml 95 lines
    # model/ids.toml --- the conformance ID register.
    #
    # Every ID this repository claims, in one place, so that nothing is referenced
    # without being defined. `CONFORMANCE.md` is generated from this file. A test
    # whose name ends in an ID not listed here fails `check-model`, and an ID listed
    # here with no scenario and no test fails it too (CM-02).
    #
    # `level` is the honesty level (R2):
    #   some-true  a fact reproduced from an authority; not established here
    #   build      constructed here and validated against its oracle
    #   open       measured and reported, never asserted
    #
    # Every row here has a scenario in `features/suites/` and a test whose name ends
    # in the ID, lowercased with underscores (R3, CM-02). There is no "pending"
    # state: a capability that is not built does not get a row, and every row in this
    # file is built.
    #
    # The first row is the template's own Prism application in `app/` (TC-01).
    # A capability starts with a row here; `just new-capability` writes the row,
    # its scenario and its failing test in the order `AGENTS.md` sets out.
    
    spec = "template/1"
    
    [[id]]
    id = "MT-01"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app never answers working when event is cancel"
    
    [[id]]
    id = "MT-02"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app never answers input-required when event is cancel"
    
    [[id]]
    id = "MT-03"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app never answers completed when state is working and elapsed is below deadline"
    
    [[id]]
    id = "MT-04"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app never answers failed when state is working and elapsed is below deadline"
    
    [[id]]
    id = "MT-05"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app never answers working when state is input-required and event is answer and remaining is at least 1"
    
    [[id]]
    id = "MT-06"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app always answers input-required when state is input-required and event is settle"
    
    [[id]]
    id = "MT-07"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app always answers completed when state is completed"
    
    [[id]]
    id = "MT-08"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app always answers failed when state is failed"
    
    [[id]]
    id = "MT-09"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The app always answers cancelled when state is cancelled"
    
    [[id]]
    id = "MT-10"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references"
    
    [[id]]
    id = "MT-11"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared"
    
    [[id]]
    id = "MT-12"
    level = "build"
    suite = "mcp_task_lifecycle"
    statement = "Every compliance obligation is numbered in order and names its evidence"
    
    features/suites/mcp_task_lifecycle.feature 74 lines
    Feature: mcp_task_lifecycle
    
      This repository's Prism application, in app/, generated by prism-code from its
      spec: Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered.
    
      @MT-01 @build
      Scenario: The app never answers working when event is cancel
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv001Holds during prismpm verify
        Then no request meets breaksInv001
    
      @MT-02 @build
      Scenario: The app never answers input-required when event is cancel
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv002Holds during prismpm verify
        Then no request meets breaksInv002
    
      @MT-03 @build
      Scenario: The app never answers completed when state is working and elapsed is below deadline
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv003Holds during prismpm verify
        Then no request meets breaksInv003
    
      @MT-04 @build
      Scenario: The app never answers failed when state is working and elapsed is below deadline
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv004Holds during prismpm verify
        Then no request meets breaksInv004
    
      @MT-05 @build
      Scenario: The app never answers working when state is input-required and event is answer and remaining is at least 1
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv005Holds during prismpm verify
        Then no request meets breaksInv005
    
      @MT-06 @build
      Scenario: The app always answers input-required when state is input-required and event is settle
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv006Holds during prismpm verify
        Then no request meets breaksInv006
    
      @MT-07 @build
      Scenario: The app always answers completed when state is completed
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv007Holds during prismpm verify
        Then no request meets breaksInv007
    
      @MT-08 @build
      Scenario: The app always answers failed when state is failed
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv008Holds during prismpm verify
        Then no request meets breaksInv008
    
      @MT-09 @build
      Scenario: The app always answers cancelled when state is cancelled
        Given the model in app/src/McpTaskLifecycle.lex.tex
        When the Lean kernel checks inv009Holds during prismpm verify
        Then no request meets breaksInv009
      @MT-10 @build
      Scenario: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
        Given the model in app/src/Architecture.lex.tex
        When the Lean kernel checks architectureDescriptionHolds during prismpm verify
        Then the architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
      @MT-11 @build
      Scenario: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
        Given the model in app/src/Quality.lex.tex
        When the Lean kernel checks qualityModelHolds during prismpm verify
        Then the ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
      @MT-12 @build
      Scenario: Every compliance obligation is numbered in order and names its evidence
        Given the model in app/src/Compliance.lex.tex
        When the Lean kernel checks everyObligationEvidenced during prismpm verify
        Then every compliance obligation is numbered in order and names its evidence
    
    crates/conformance/tests/mcp_task_lifecycle.rs 182 lines
    //! The `mcp_task_lifecycle` suite: one test per scenario in `features/suites/mcp_task_lifecycle.feature`.
    //!
    //! Written by the Prism-DevRel builder from the app's prompt. The theorems are
    //! checked by the Lean kernel when `just vv` runs `prismpm verify` on `app/`.
    //! What these tests hold fixed is what each theorem is about, so a weakened
    //! statement that still verifies fails the gate.
    
    use std::path::PathBuf;
    
    fn root() -> PathBuf {
        PathBuf::from(env!("CARGO_MANIFEST_DIR"))
            .ancestors()
            .nth(2)
            .expect("crates/conformance is two below the root")
            .to_path_buf()
    }
    
    /// The body of the top-level declaration named `name`, up to its closing brace.
    fn declaration<'a>(model: &'a str, name: &str) -> &'a str {
        let start = model
            .find(&format!("\n  name: {name},\n"))
            .unwrap_or_else(|| panic!("{name} is not declared"));
        let end = model[start..]
            .find("\n}\n")
            .unwrap_or_else(|| panic!("{name} is not closed"));
        &model[start..start + end]
    }
    
    fn module(path: &str) -> String {
        std::fs::read_to_string(root().join(path)).expect("the module")
    }
    
    /// The condition no request may meet, and the theorem that says none does.
    fn pinned(breaks: &str, condition: &str, theorem: &str) {
        let model = module("app/src/McpTaskLifecycleProofs.lex.tex");
        let found = declaration(&model, breaks);
        assert!(
            found.contains(condition),
            "the condition of {breaks} changed:\n{found}"
        );
        let holds = declaration(&model, theorem);
        let statement = format!("statement: (({breaks} request) = false),");
        assert!(
            holds.contains(&statement),
            "{theorem} must state that no request meets {breaks}:\n{holds}"
        );
    }
    
    /// A facet theorem: proved by `decide`, about exactly this predicate.
    fn holds(path: &str, theorem: &str, statement: &str) {
        let model = module(path);
        let found = declaration(&model, theorem);
        assert!(
            found.contains(&format!("statement: {statement},")),
            "{theorem} must state {statement}:\n{found}"
        );
        assert!(
            found.contains("proof: decide{}"),
            "{theorem} is proved by decide"
        );
    }
    
    /// `MT-01`: The app never answers working when event is cancel
    #[test]
    fn mcp_task_lifecycle_mt_01() {
        pinned(
            "breaksInv001",
            "body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request event) =? (McpTaskLifecycle::eventCancel))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerWorking)))",
            "inv001Holds",
        );
    }
    
    /// `MT-02`: The app never answers input-required when event is cancel
    #[test]
    fn mcp_task_lifecycle_mt_02() {
        pinned(
            "breaksInv002",
            "body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request event) =? (McpTaskLifecycle::eventCancel))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerInputRequired)))",
            "inv002Holds",
        );
    }
    
    /// `MT-03`: The app never answers completed when state is working and elapsed is below deadline
    #[test]
    fn mcp_task_lifecycle_mt_03() {
        pinned(
            "breaksInv003",
            "body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateWorking))) && ((project request elapsed) <? (project request deadline))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCompleted)))",
            "inv003Holds",
        );
    }
    
    /// `MT-04`: The app never answers failed when state is working and elapsed is below deadline
    #[test]
    fn mcp_task_lifecycle_mt_04() {
        pinned(
            "breaksInv004",
            "body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateWorking))) && ((project request elapsed) <? (project request deadline))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerFailed)))",
            "inv004Holds",
        );
    }
    
    /// `MT-05`: The app never answers working when state is input-required and event is answer and remaining is at least 1
    #[test]
    fn mcp_task_lifecycle_mt_05() {
        pinned(
            "breaksInv005",
            "body: (((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateInputRequired))) && ((project request event) =? (McpTaskLifecycle::eventAnswer))) && (1 <=? (project request remaining))) && ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerWorking)))",
            "inv005Holds",
        );
    }
    
    /// `MT-06`: The app always answers input-required when state is input-required and event is settle
    #[test]
    fn mcp_task_lifecycle_mt_06() {
        pinned(
            "breaksInv006",
            "body: ((((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateInputRequired))) && ((project request event) =? (McpTaskLifecycle::eventSettle))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerInputRequired))))",
            "inv006Holds",
        );
    }
    
    /// `MT-07`: The app always answers completed when state is completed
    #[test]
    fn mcp_task_lifecycle_mt_07() {
        pinned(
            "breaksInv007",
            "body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateCompleted))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCompleted))))",
            "inv007Holds",
        );
    }
    
    /// `MT-08`: The app always answers failed when state is failed
    #[test]
    fn mcp_task_lifecycle_mt_08() {
        pinned(
            "breaksInv008",
            "body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateFailed))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerFailed))))",
            "inv008Holds",
        );
    }
    
    /// `MT-09`: The app always answers cancelled when state is cancelled
    #[test]
    fn mcp_task_lifecycle_mt_09() {
        pinned(
            "breaksInv009",
            "body: (((((((project request state) <? 5) && ((project request event) <? 3)) && ((project request asks) <? 2)) && ((project request outcome) <? 2)) && ((project request state) =? (McpTaskLifecycle::stateCancelled))) && (not ((McpTaskLifecycle::judge request) =? (McpTaskLifecycle::answerCancelled))))",
            "inv009Holds",
        );
    }
    
    /// `MT-10`: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
    #[test]
    fn mcp_task_lifecycle_mt_10() {
        holds(
            "app/src/Architecture.lex.tex",
            "architectureDescriptionHolds",
            "((architectureValid) = true)",
        );
    }
    
    /// `MT-11`: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
    #[test]
    fn mcp_task_lifecycle_mt_11() {
        holds(
            "app/src/Quality.lex.tex",
            "qualityModelHolds",
            "((qualityValid) = true)",
        );
    }
    
    /// `MT-12`: Every compliance obligation is numbered in order and names its evidence
    #[test]
    fn mcp_task_lifecycle_mt_12() {
        holds(
            "app/src/Compliance.lex.tex",
            "everyObligationEvidenced",
            "((obligationsEvidenced 0 (obligations)) = true)",
        );
    }
    
    site/app.json 170 lines
    {
      "name": "MCP task lifecycle",
      "shortName": "MCP",
      "live": "https://uor-foundation.github.io/MCP/",
      "purpose": "Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered. Send state, event, asks, elapsed, deadline, outcome or remaining, separated by spaces; it answers working, input-required, completed, failed or cancelled, and invalid request for anything else.",
      "inputLabel": "Request: state event asks elapsed deadline outcome remaining",
      "placeholder": "working settle no 1500 1000 completes 0",
      "submitLabel": "Decide",
      "outputLabel": "Answer",
      "answers": {
        "positive": [
          "working"
        ],
        "negative": [
          "input-required",
          "completed",
          "failed",
          "cancelled"
        ],
        "refusal": "invalid request"
      },
      "promise": {
        "headline": "Says conformant exactly when every policy file matches its lock.",
        "detail": "Each of the six universal policy files is compared with the digest the lock records, and any file that drifted is named."
      },
      "claim": "MT-01: the app never answers working when event is cancel. MT-02: the app never answers input-required when event is cancel. MT-03: the app never answers completed when state is working and elapsed is below deadline. MT-04: the app never answers failed when state is working and elapsed is below deadline. MT-05: the app never answers working when state is input-required and event is answer and remaining is at least 1. MT-06: the app always answers input-required when state is input-required and event is settle. MT-07: the app always answers completed when state is completed. MT-08: the app always answers failed when state is failed. MT-09: the app always answers cancelled when state is cancelled.",
      "proposition": {
        "name": "judge",
        "text": "judge request :=\n  state is completed → completed\n  state is failed → failed\n  state is cancelled → cancelled\n  event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completes → completed\n  event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is fails → failed\n  event is cancel → cancelled\n  event is settle and state is working and asks is yes and elapsed is at least deadline → input-required\n  event is settle and state is working and elapsed is at least deadline and outcome is completes → completed\n  event is settle and state is working and elapsed is at least deadline and outcome is fails → failed\n  event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadline → input-required\n  event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completes → completed\n  event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is fails → failed\n  event is answer and state is input-required and remaining equals 0 → working\n  state is input-required → input-required\n  otherwise → working",
        "plain": "Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered."
      },
      "theorems": [
        {
          "name": "inv001Holds",
          "statement": "no request meets breaksInv001: the app never answers working when event is cancel",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv002Holds",
          "statement": "no request meets breaksInv002: the app never answers input-required when event is cancel",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv003Holds",
          "statement": "no request meets breaksInv003: the app never answers completed when state is working and elapsed is below deadline",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv004Holds",
          "statement": "no request meets breaksInv004: the app never answers failed when state is working and elapsed is below deadline",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv005Holds",
          "statement": "no request meets breaksInv005: the app never answers working when state is input-required and event is answer and remaining is at least 1",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv006Holds",
          "statement": "no request meets breaksInv006: the app always answers input-required when state is input-required and event is settle",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv007Holds",
          "statement": "no request meets breaksInv007: the app always answers completed when state is completed",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv008Holds",
          "statement": "no request meets breaksInv008: the app always answers failed when state is failed",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        },
        {
          "name": "inv009Holds",
          "statement": "no request meets breaksInv009: the app always answers cancelled when state is cancelled",
          "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
          "where": "app/src/McpTaskLifecycleProofs.lex.tex"
        }
      ],
      "pinned": [
        {
          "name": "mcp_task_lifecycle_mt_01",
          "what": "MT-01's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_02",
          "what": "MT-02's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_03",
          "what": "MT-03's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_04",
          "what": "MT-04's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_05",
          "what": "MT-05's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_06",
          "what": "MT-06's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_07",
          "what": "MT-07's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_08",
          "what": "MT-08's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        },
        {
          "name": "mcp_task_lifecycle_mt_09",
          "what": "MT-09's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
          "where": "crates/conformance/tests/mcp_task_lifecycle.rs"
        }
      ],
      "trusted": [
        {
          "name": "SDK image",
          "value": "the digest prismpm.lock pins; see the bootstrap workflow's log"
        },
        {
          "name": "Lean toolchain",
          "value": "leanprover/lean4:v4.32.1"
        },
        {
          "name": "LexLean compiler semantics",
          "value": "5262e5b4c8b5668ae7066ad686757a6bb7f80c941d515fb9d586894fbc7de69a"
        },
        {
          "name": "prism-code runtime, vendored",
          "value": "0.2.0, see try/vendor/prism-code/VENDOR.md"
        },
        {
          "name": "Your browser",
          "value": "runs the WebAssembly guest and this page"
        }
      ],
      "attestations": {
        "proof": {
          "id": "not recorded: the proof ran in the SDK image, not on the UOR MCP server",
          "url": "https://github.com/UOR-Foundation/MCP/actions/workflows/bootstrap.yml"
        },
        "build": {
          "id": "printed by prismpm verify in every pages run",
          "url": "https://github.com/UOR-Foundation/MCP/actions/workflows/pages.yml"
        }
      },
      "repository": "https://github.com/UOR-Foundation/MCP",
      "report": "https://github.com/UOR-Foundation/MCP/blob/main/TEMPLATE-VERIFICATION.md"
    }
    
    openspec/specs/mcp-task-lifecycle/spec.md 357 lines
    # mcp-task-lifecycle Specification
    
    <!-- Generated by Prism from prism/spec.json. Change the app through your agent with /prism, not by editing this file. -->
    
    ## Purpose
    
    MCP task lifecycle: Give the next state of an io.modelcontextprotocol/tasks task from its current state, the step applied to it (settle, answer or cancel), what its plan still asks, the clock and how many input keys remain unanswered.
    
    ## Requirements
    
    ### Requirement: Never working when event is cancel
    
    The app SHALL NOT answer `working` when event is cancel, because TASKS.md: a cancel never leaves a task running.
    
    Verified: to be proved by Lean for every request (INV-001, theorem `inv001Holds`).
    
    #### Scenario: INV-001 holds
    
    - **WHEN** the request is `working cancel no 2000 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL NOT be `working`
    - **AND** the app answers `completed`, decided by REQ-004
    
    ### Requirement: Never input-required when event is cancel
    
    The app SHALL NOT answer `input-required` when event is cancel, because a cancel never leaves a task waiting for input.
    
    Verified: to be proved by Lean for every request (INV-002, theorem `inv002Holds`).
    
    #### Scenario: INV-002 holds
    
    - **WHEN** the request is `working cancel no 2000 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL NOT be `input-required`
    - **AND** the app answers `completed`, decided by REQ-004
    
    ### Requirement: Never completed when state is working and elapsed is below deadline
    
    The app SHALL NOT answer `completed` when state is working and elapsed is below deadline, because Tasks.due: no work concludes before finishAfterMs has passed.
    
    Verified: to be proved by Lean for every request (INV-003, theorem `inv003Holds`).
    
    #### Scenario: INV-003 holds
    
    - **WHEN** the request is `working settle yes 500 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL NOT be `completed`
    - **AND** the app answers `working`, decided by the fallback
    
    ### Requirement: Never failed when state is working and elapsed is below deadline
    
    The app SHALL NOT answer `failed` when state is working and elapsed is below deadline, because Tasks.due: no work fails before finishAfterMs has passed.
    
    Verified: to be proved by Lean for every request (INV-004, theorem `inv004Holds`).
    
    #### Scenario: INV-004 holds
    
    - **WHEN** the request is `working settle yes 500 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL NOT be `failed`
    - **AND** the app answers `working`, decided by the fallback
    
    ### Requirement: Never working when state is input-required and event is answer and remaining is at least 1
    
    The app SHALL NOT answer `working` when state is input-required and event is answer and remaining is at least 1, because Tasks.answerInput: a task resumes only once every key is answered.
    
    Verified: to be proved by Lean for every request (INV-005, theorem `inv005Holds`).
    
    #### Scenario: INV-005 holds
    
    - **WHEN** the request is `input-required answer no 2000 5000 completes 1` (an acceptance example)
    - **THEN** the answer SHALL NOT be `working`
    - **AND** the app answers `input-required`, decided by REQ-014
    
    ### Requirement: Always input-required when state is input-required and event is settle
    
    The app SHALL answer `input-required` when state is input-required and event is settle, because Tasks.settle: settling a task that waits for input changes nothing.
    
    Verified: to be proved by Lean for every request (INV-006, theorem `inv006Holds`).
    
    #### Scenario: INV-006 holds
    
    - **WHEN** the request is `input-required settle yes 0 0 completes 0`
    - **THEN** the answer SHALL be `input-required`
    - **AND** the app answers `input-required`, decided by REQ-014
    
    ### Requirement: Always completed when state is completed
    
    The app SHALL answer `completed` when state is completed, because completed is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.
    
    Verified: to be proved by Lean for every request (INV-007, theorem `inv007Holds`).
    
    #### Scenario: INV-007 holds
    
    - **WHEN** the request is `completed cancel no 0 0 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `completed`
    - **AND** the app answers `completed`, decided by REQ-001
    
    ### Requirement: Always failed when state is failed
    
    The app SHALL answer `failed` when state is failed, because failed is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.
    
    Verified: to be proved by Lean for every request (INV-008, theorem `inv008Holds`).
    
    #### Scenario: INV-008 holds
    
    - **WHEN** the request is `failed settle yes 0 0 completes 0`
    - **THEN** the answer SHALL be `failed`
    - **AND** the app answers `failed`, decided by REQ-002
    
    ### Requirement: Always cancelled when state is cancelled
    
    The app SHALL answer `cancelled` when state is cancelled, because cancelled is a final state (UML 2.5.1 FinalState): a run that reaches it stays there.
    
    Verified: to be proved by Lean for every request (INV-009, theorem `inv009Holds`).
    
    #### Scenario: INV-009 holds
    
    - **WHEN** the request is `cancelled settle yes 0 0 completes 0`
    - **THEN** the answer SHALL be `cancelled`
    - **AND** the app answers `cancelled`, decided by REQ-003
    
    ### Requirement: REQ-001 completed when state is completed
    
    The app SHALL answer `completed` when state is completed, because src/Tasks.lex.tex: settle, answer and cancel keep a completed entry (kept entry).
    
    Verified: tested by the acceptance vectors (`rule1`).
    
    #### Scenario: REQ-001 decides
    
    - **WHEN** the request is `completed cancel no 0 0 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `completed`, decided by REQ-001
    
    ### Requirement: REQ-002 failed when state is failed
    
    The app SHALL answer `failed` when state is failed and no earlier rule matches, because src/Tasks.lex.tex: a failed task is terminal (isTerminal), and every step keeps it.
    
    Verified: tested by the acceptance vectors (`rule2`).
    
    #### Scenario: REQ-002 decides
    
    - **WHEN** the request is `failed settle yes 0 0 completes 0`
    - **THEN** the answer SHALL be `failed`, decided by REQ-002
    
    ### Requirement: REQ-003 cancelled when state is cancelled
    
    The app SHALL answer `cancelled` when state is cancelled and no earlier rule matches, because src/Tasks.lex.tex: a cancelled task is terminal, and every step keeps it.
    
    Verified: tested by the acceptance vectors (`rule3`).
    
    #### Scenario: REQ-003 decides
    
    - **WHEN** the request is `cancelled settle yes 0 0 completes 0`
    - **THEN** the answer SHALL be `cancelled`, decided by REQ-003
    
    ### Requirement: REQ-004 completed when event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completes
    
    The app SHALL answer `completed` when event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is completes and no earlier rule matches, because Tasks.cancel settles first: work that finished before the cancel stays completed (TASKS.md, What a task does).
    
    Verified: tested by the acceptance vectors (`rule4`).
    
    #### Scenario: REQ-004 decides
    
    - **WHEN** the request is `working cancel no 2000 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `completed`, decided by REQ-004
    
    ### Requirement: REQ-005 failed when event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is fails
    
    The app SHALL answer `failed` when event is cancel and state is working and asks is no and elapsed is at least deadline and outcome is fails and no earlier rule matches, because Tasks.cancel settles first: work that failed before the cancel stays failed.
    
    Verified: tested by the acceptance vectors (`rule5`).
    
    #### Scenario: REQ-005 decides
    
    - **WHEN** the request is `working cancel no 0 0 fails 0`
    - **THEN** the answer SHALL be `failed`, decided by REQ-005
    
    ### Requirement: REQ-006 cancelled when event is cancel
    
    The app SHALL answer `cancelled` when event is cancel and no earlier rule matches, because Tasks.cancelSettled: a working or input_required task becomes cancelled.
    
    Verified: tested by the acceptance vectors (`rule6`).
    
    #### Scenario: REQ-006 decides
    
    - **WHEN** the request is `working cancel yes 10 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `cancelled`, decided by REQ-006
    
    ### Requirement: REQ-007 input-required when event is settle and state is working and asks is yes and elapsed is at least deadline
    
    The app SHALL answer `input-required` when event is settle and state is working and asks is yes and elapsed is at least deadline and no earlier rule matches, because Tasks.settleWorking: a plan that parks moves to input_required once parkAfterMs has passed.
    
    Verified: tested by the acceptance vectors (`rule7`).
    
    #### Scenario: REQ-007 decides
    
    - **WHEN** the request is `working settle yes 1000 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `input-required`, decided by REQ-007
    
    ### Requirement: REQ-008 completed when event is settle and state is working and elapsed is at least deadline and outcome is completes
    
    The app SHALL answer `completed` when event is settle and state is working and elapsed is at least deadline and outcome is completes and no earlier rule matches, because Tasks.settleWorking: with nothing to ask, the task concludes once finishAfterMs has passed (Tasks.due).
    
    Verified: tested by the acceptance vectors (`rule8`).
    
    #### Scenario: REQ-008 decides
    
    - **WHEN** the request is `working settle no 1500 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `completed`, decided by REQ-008
    
    ### Requirement: REQ-009 failed when event is settle and state is working and elapsed is at least deadline and outcome is fails
    
    The app SHALL answer `failed` when event is settle and state is working and elapsed is at least deadline and outcome is fails and no earlier rule matches, because Tasks.concluded: a plan that fails gives a failed task with its JSON-RPC error.
    
    Verified: tested by the acceptance vectors (`rule9`).
    
    #### Scenario: REQ-009 decides
    
    - **WHEN** the request is `working settle no 2000 1000 fails 0` (an acceptance example)
    - **THEN** the answer SHALL be `failed`, decided by REQ-009
    
    ### Requirement: REQ-010 input-required when event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadline
    
    The app SHALL answer `input-required` when event is answer and state is input-required and remaining equals 0 and asks is yes and elapsed is at least deadline and no earlier rule matches, because Tasks.resume settles at once: a plan that still asks parks again.
    
    Verified: tested by the acceptance vectors (`rule10`).
    
    #### Scenario: REQ-010 decides
    
    - **WHEN** the request is `input-required answer yes 0 0 completes 0`
    - **THEN** the answer SHALL be `input-required`, decided by REQ-010
    
    ### Requirement: REQ-011 completed when event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completes
    
    The app SHALL answer `completed` when event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is completes and no earlier rule matches, because Tasks.answerInput: the last key answered resumes the task, which settles at once and completes if due.
    
    Verified: tested by the acceptance vectors (`rule11`).
    
    #### Scenario: REQ-011 decides
    
    - **WHEN** the request is `input-required answer no 0 0 completes 0`
    - **THEN** the answer SHALL be `completed`, decided by REQ-011
    
    ### Requirement: REQ-012 failed when event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is fails
    
    The app SHALL answer `failed` when event is answer and state is input-required and remaining equals 0 and elapsed is at least deadline and outcome is fails and no earlier rule matches, because Tasks.answerInput: the last key answered resumes the task, which settles at once and fails if due.
    
    Verified: tested by the acceptance vectors (`rule12`).
    
    #### Scenario: REQ-012 decides
    
    - **WHEN** the request is `input-required answer no 6000 5000 fails 0` (an acceptance example)
    - **THEN** the answer SHALL be `failed`, decided by REQ-012
    
    ### Requirement: REQ-013 working when event is answer and state is input-required and remaining equals 0
    
    The app SHALL answer `working` when event is answer and state is input-required and remaining equals 0 and no earlier rule matches, because Tasks.resume: with every key answered and nothing due, the task returns to working.
    
    Verified: tested by the acceptance vectors (`rule13`).
    
    #### Scenario: REQ-013 decides
    
    - **WHEN** the request is `input-required answer no 2000 5000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `working`, decided by REQ-013
    
    ### Requirement: REQ-014 input-required when state is input-required
    
    The app SHALL answer `input-required` when state is input-required and no earlier rule matches, because Tasks.settle keeps an input_required task, and answerInput keeps it while any key remains.
    
    Verified: tested by the acceptance vectors (`rule14`).
    
    #### Scenario: REQ-014 decides
    
    - **WHEN** the request is `input-required answer no 2000 5000 completes 1` (an acceptance example)
    - **THEN** the answer SHALL be `input-required`, decided by REQ-014
    
    ### Requirement: Otherwise working
    
    The app SHALL answer `working` when no rule matches, because src/Tasks.lex.tex: a working task whose next step is not yet due, or that is answered, is kept as it is.
    
    Verified: tested by the acceptance vectors.
    
    #### Scenario: No rule matches
    
    - **WHEN** the request is `working settle yes 500 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `working`
    
    ### Requirement: The first matching rule decides
    
    The app SHALL try REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-006, REQ-007, REQ-008, REQ-009, REQ-010, REQ-011, REQ-012, REQ-013, REQ-014 in that order, and the first rule that matches SHALL decide.
    
    Verified: tested by the acceptance vectors.
    
    #### Scenario: Two rules match
    
    - **WHEN** the request is `working settle yes 1000 1000 completes 0` (an acceptance example)
    - **THEN** the answer SHALL be `input-required`, decided by REQ-007, the earlier rule
    
    ### Requirement: Request and answers
    
    The app SHALL read one request as one line of 7 fields separated by single spaces, in this order, and SHALL answer exactly one of `working`, `input-required`, `completed`, `failed`, `cancelled`, or `invalid` for anything else.
    
    | Field | Accepts | Means |
    | --- | --- | --- |
    | `state` | `working`, `input-required`, `completed`, `failed`, `cancelled` | the task's current status, as DetailedTask in src/Tasks.lex.tex |
    | `event` | `settle`, `answer`, `cancel` | the step: settle (tasks/get), answer (tasks/update with every given key) or cancel (tasks/cancel) |
    | `asks` | `yes`, `no` | whether the task's plan still holds input requests to park on (parkedPlan empties them once it parks) |
    | `elapsed` | whole number from 0 | milliseconds since the task was created, now_ms less createdMs |
    | `deadline` | whole number from 0 | milliseconds after creation the plan's next step is due: parkAfterMs when it asks, finishAfterMs otherwise |
    | `outcome` | `completes`, `fails` | how the plan concludes: PlanOutcome.completes with a result or PlanOutcome.fails with a JSON-RPC error |
    | `remaining` | whole number from 0 | input keys still unanswered after this answer |
    
    | Answer | Means |
    | --- | --- |
    | `working` | the task is running; tasks/get answers status working |
    | `input-required` | the task waits for the client to answer its inputRequests through tasks/update |
    | `completed` | terminal: the plan's result is the task's result |
    | `failed` | terminal: the task carries the plan's JSON-RPC error |
    | `cancelled` | terminal: the client cancelled the task before it finished |
    | `invalid` | the request is malformed |
    
    Verified: reading a request is tested, not proved.
    
    #### Scenario: A malformed request is invalid
    
    - **WHEN** the request is not 7 fields in this order
    - **THEN** the answer SHALL be `invalid`
    
    ## Out of scope
    
    - It does not create a task: a task starts working, as the seed of its tool's plan, when tools/call decides to answer a task.
    - It does not expire a task: a task past its ttlMs is dropped from the host's table by the next request, outside this step.
    - It does not check the host's clock or table; the host owes the core exactly the table it was given.
    
    ## Examples
    
    - `working settle no 1500 1000 completes 0` gives `completed`
    - `working settle yes 500 1000 completes 0` gives `working`
    - `working settle yes 1000 1000 completes 0` gives `input-required`
    - `working settle no 2000 1000 fails 0` gives `failed`
    - `input-required answer no 2000 5000 completes 1` gives `input-required`
    - `input-required answer no 2000 5000 completes 0` gives `working`
    - `input-required answer no 6000 5000 fails 0` gives `failed`
    - `working cancel no 2000 1000 completes 0` gives `completed`
    - `working cancel yes 10 1000 completes 0` gives `cancelled`
    - `completed cancel no 0 0 completes 0` gives `completed`
    - `working settle` gives `invalid`
    
    ## What is proved and what is tested
    
    Lean proves each property marked proved above, for every request that decodes, with no exceptions and no sampling. The proof is about `judge`, the function the WebAssembly guest runs, because both come from the same model.
    
    The parsing of requests is tested, not proved: the acceptance vectors in the app replay through the built guest, including malformed and oversized requests.
    
    Nothing here says the rules are the right rules. That is the part only you can judge.
    
    ## Files
    
    - `prism/spec.json` is this spec as data.
    - `src/McpTaskLifecycle.lex.tex` is the LexLean model generated from it. It is the single source of the app.
    

    how-to guideBuildexampleMarkdown

    Words on this page 8
    record
    One entry in a facet: a component, a threat, a measure or a journey step, with the place in the source it came from.
    LexLean
    The language Prism models are written in. It reads like LaTeX and compiles to Lean 4.
    Lean kernel
    The small checker at the heart of the Lean prover. It accepts a proof only if every step follows the rules.
    theorem
    A statement about the model that the Lean kernel has checked, so it holds for every input, not only the ones tested.
    SDK
    Software development kit. Here, the PrismPM container image that builds, checks and verifies Prism models.
    stakeholder
    A person or group with an interest in the system, as ISO/IEC/IEEE 42010 defines it.
    MCP
    Model Context Protocol: an open protocol through which AI agents call tools such as the Prism builder.
    state machine
    A model of something that is always in one state and moves between states on events, as in UML 2.5.1.