Examples: Plant attunement
Overview
Example appsDecision 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// example · Decision tables
Plant attunement
Decide if a player's gesture in Verdant Resonance reaches the plant they face. The garden then answers the same walk the same way.
Inspired by afflom/verdant-resonance (live). A first-person garden of acoustic biomes and plants that answer the player.
Pattern: Decision table, OMG DMN 1.5, hit policy FIRST. To write one of your own, follow How to build a decision table app.
The data in this figure
| Step | What happens |
|---|---|
| 1. Request | angle, distance, cooldown |
| 2. 3 rules | the first that matches wins |
| 3. Answer | attuned, dormant, distant |
| 4. Proved | 3 theorems, 42 tests |
- Fingerprint
4a96ebe34311084cb81a5ab93c58ebaa990913efa57589c97954f749c39a1abe- Acceptance vectors
- 42
- Claims
- 6
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 268 lines
{
"schema": "prism/prompt/1",
"goal": "Decide if a player's gesture in Verdant Resonance reaches the plant they face. The garden then answers the same walk the same way.",
"pattern": "decisionTable",
"repository": "afflom/verdant-resonance",
"app": {
"name": "garden-attunement",
"title": "Plant attunement",
"purpose": "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.",
"fields": [
{
"name": "angle",
"kind": "number",
"min": 0,
"means": "degrees between the player's gaze and the plant",
"max": 180
},
{
"name": "distance",
"kind": "number",
"min": 0,
"means": "how far the plant is, in metres",
"max": 100
},
{
"name": "cooldown",
"kind": "number",
"min": 0,
"means": "milliseconds of the attune refractory period left",
"max": 1100
}
],
"outcomes": [
"attuned",
"dormant",
"distant"
],
"meanings": {
"attuned": "the plant attunes and sings",
"dormant": "the gesture is ignored during its refractory pause, the plant rests",
"distant": "the plant is outside the forward gaze cone and is not activated"
},
"rules": [
{
"when": [
{
"field": "distance",
"op": ">",
"value": 22
}
],
"then": "distant",
"why": "prism/src/Foundation/Humane/V1/Model.lex.tex evaluateGazeTargetInForwardCone: distMeters <= 22, maxInteractiveRangeMeters 22"
},
{
"when": [
{
"field": "angle",
"op": ">",
"value": 62
}
],
"then": "distant",
"why": "Humane Model.lex.tex: forwardFovHalfAngleDeg 62; GardenCanvas.tsx never activates elements behind the player"
},
{
"when": [
{
"field": "cooldown",
"op": ">=",
"value": 1
}
],
"then": "dormant",
"why": "Humane Model.lex.tex GestureHoldAndCooldownPolicy attuneRefractoryMs 1100: GardenCanvas.tsx ignores attune while it cools down"
}
],
"otherwise": "attuned",
"otherwiseWhy": "in the forward gaze cone and rested: the focal plant attunes",
"properties": [
{
"kind": "never",
"when": [
{
"field": "distance",
"op": ">",
"value": 22
}
],
"then": "attuned",
"why": "no plant answers a player out of reach"
},
{
"kind": "never",
"when": [
{
"field": "angle",
"op": ">",
"value": 62
}
],
"then": "attuned",
"why": "behindPlayerActivationsCount is 0: nothing behind the player activates"
},
{
"kind": "never",
"when": [
{
"field": "cooldown",
"op": ">=",
"value": 1
}
],
"then": "attuned",
"why": "mindful pacing: a repeated gesture never attunes during its refractory pause"
}
],
"examples": [
{
"request": "10 8 0",
"response": "attuned"
},
{
"request": "62 22 0",
"response": "attuned"
},
{
"request": "180 5 0",
"response": "distant"
},
{
"request": "0 23 0",
"response": "distant"
},
{
"request": "30 4 1100",
"response": "dormant"
},
{
"request": "30 4 1",
"response": "dormant"
}
]
},
"stakeholders": [
{
"name": "Player",
"text": "Wanders the garden and needs each plant to answer the same way to the same walk.",
"concerns": [
"Correct answers"
]
},
{
"name": "Sound designer",
"text": "Places plants and tunes the humane pacing and needs plants outside the gaze cone, or a rushed gesture, to stay silent.",
"concerns": [
"Proved guarantees",
"Calm interaction"
]
}
],
"concerns": [
{
"name": "Calm interaction",
"text": "Gestures follow the Humane design standard: focal gaze-cone selection and refractory pauses, with no activation behind the player.",
"model": "quality"
}
],
"components": [
{
"name": "Garden client",
"text": "The browser game, src/components/GardenCanvas.tsx, which finds the focal plant and sends the gesture.",
"kind": "staticSite"
},
{
"name": "Soundscape engine",
"text": "src/game/soundscapeEngine.ts, the Web Audio voices an attuned plant plays.",
"kind": "service"
}
],
"threats": [
{
"name": "Key-repeat flood",
"text": "Operating-system key repeat fires attune many times a second, so plants chatter.",
"stride": "denialOfService",
"asset": "request",
"likelihood": "medium",
"impact": "minor",
"control": {
"name": "Refractory pause",
"text": "Attune is ignored for 1100 ms after a gesture, proved for every request, and OS key repeat is suppressed.",
"evidence": [
{
"kind": "proof",
"reference": "GardenAttunementProofs::inv003Holds"
},
{
"kind": "review",
"reference": "prism/src/Foundation/Humane/V1/Model.lex.tex GestureHoldAndCooldownPolicy"
}
]
}
},
{
"name": "Activation behind the player",
"text": "A plant behind the player attunes, breaking the focal gaze law.",
"stride": "elevationOfPrivilege",
"asset": "answer",
"likelihood": "low",
"impact": "minor",
"control": {
"name": "Gaze cone proved",
"text": "Beyond 62 degrees nothing attunes, proved for every request.",
"evidence": [
{
"kind": "proof",
"reference": "GardenAttunementProofs::inv002Holds"
},
{
"kind": "review",
"reference": "src/game/prismModel.test.ts focalGazeSelection"
}
]
}
},
{
"name": "Client range drift",
"text": "The client finds focal plants up to 32 m away while the model allows 22 m, so the page and the model disagree.",
"stride": "tampering",
"asset": "source",
"likelihood": "medium",
"impact": "minor",
"accepted": "The app follows the LexLean model, 22 m; src/game/prismModel.ts findNearestPlant uses 32 m, a drift for the repository to reconcile."
}
],
"quality": [
{
"characteristic": "Safety",
"subcharacteristic": "Operational constraint",
"requirement": "No activation behind the player",
"text": "An attune gesture never activates a plant outside the forward gaze cone.",
"measure": "Behind-player activations",
"measureText": "Requests with an angle over 62 degrees answered attuned, behindPlayerActivationsCount in the model.",
"threshold": 0
}
],
"journeys": [
{
"stakeholder": "Player",
"steps": [
"REQ-001",
"REQ-002",
"REQ-003",
"otherwise"
]
},
{
"stakeholder": "Sound designer",
"steps": [
"INV-001",
"INV-002",
"INV-003"
]
}
],
"license": "MIT OR Apache-2.0",
"axioms": {}
}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.
GA-01The app never answers attuned when distance is above 22GA-02The app never answers attuned when angle is above 62GA-03The app never answers attuned when cooldown is at least 1GA-04The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it referencesGA-05The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declaredGA-06Every compliance obligation is numbered in order and names its evidence
Pattern
Decision table: OMG DMN 1.5, hit policy FIRST. The rules are tried in order, and the first one that matches gives the answer. If none matches, the default answer applies. This is a DMN decision table with the FIRST hit policy.
| Pattern | Standard | Answers |
|---|---|---|
| Decision table | OMG DMN 1.5, hit policy FIRST | attuned, dormant, distant |
Behavior
A request is angle, distance, cooldown, separated by spaces. The first rule that matches decides. If none matches, the answer is attuned. A request over 88 bytes, or in any other form, is answered invalid.
| Rule | When | Answer | Why |
|---|---|---|---|
| REQ-001 | distance is above 22 | distant | prism/src/Foundation/Humane/V1/Model.lex.tex evaluateGazeTargetInForwardCone: distMeters <= 22, maxInteractiveRangeMeters 22 |
| REQ-002 | angle is above 62 | distant | Humane Model.lex.tex: forwardFovHalfAngleDeg 62; GardenCanvas.tsx never activates elements behind the player |
| REQ-003 | cooldown is at least 1 | dormant | Humane Model.lex.tex GestureHoldAndCooldownPolicy attuneRefractoryMs 1100: GardenCanvas.tsx ignores attune while it cools down |
| otherwise | no rule matches | attuned | in the forward gaze cone and rested: the focal plant attunes |
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.
| Property | Statement | Theorem | Why |
|---|---|---|---|
| INV-001 | It never answers attuned when distance is above 22. | GardenAttunementProofs::inv001Holds | no plant answers a player out of reach |
| INV-002 | It never answers attuned when angle is above 62. | GardenAttunementProofs::inv002Holds | behindPlayerActivationsCount is 0: nothing behind the player activates |
| INV-003 | It never answers attuned when cooldown is at least 1. | GardenAttunementProofs::inv003Holds | mindful pacing: a repeated gesture never attunes during its refractory pause |
Architecture
Stakeholders and the concerns each one views the app through (ISO/IEC/IEEE 42010).
| Stakeholder | Who they are | Concerns |
|---|---|---|
| Player | Wanders the garden and needs each plant to answer the same way to the same walk. | Correct answers |
| Sound designer | Places plants and tunes the humane pacing and needs plants outside the gaze cone, or a rushed gesture, to stay silent. | Proved guarantees, Calm interaction |
| Verifier | Anyone 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.
| Concern | What it means | Model |
|---|---|---|
| Calm interaction | Gestures follow the Humane design standard: focal gaze-cone selection and refractory pauses, with no activation behind the player. | quality |
| Correct answers | Every well-formed request is answered by the first rule that matches it, or attuned when none does, as the spec states. | quality |
| Integrity of the published app | What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it. | security |
| Proved guarantees | Each of the 3 properties of the spec holds for every request, proved by the Lean kernel. | quality |
| Refused malformed requests | A request that is not the 3 fields in order, or is longer than 88 bytes, is answered invalid and never guessed. | security |
Components
8 components and 11 edges between them.
| Component | Kind | What it is |
|---|---|---|
| Browser | externalSystem | The visitor's web browser, which loads the page and runs the Plant attunement guest. |
| Garden client | staticSite | The browser game, src/components/GardenCanvas.tsx, which finds the focal plant and sends the gesture. |
| GitHub Pages | externalSystem | Serves the page and the holo from the repository Pages workflow. |
| Plant attunement guest | service | The Core-Wasm guest built from the model: it answers one request of at most 88 bytes with one answer of at most 64. |
| Plant attunement page | staticSite | The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors. |
| Prism build | cliAdapter | prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector. |
| Soundscape engine | service | src/game/soundscapeEngine.ts, the Web Audio voices an attuned plant plays. |
| Source repository | externalSystem | The 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.
| View | Diagram | Viewpoint |
|---|---|---|
| Deciding a Plant attunement request | opmObjectProcess | Player: Correct answers |
| Components of Plant attunement | umlComponent | Verifier: Integrity of the published app |
| Answering a Plant attunement request | umlSequence | Player: Correct answers |
| States of the Plant attunement guest | umlStateMachine | Verifier: Refused malformed requests |
Features and journeys
8 features. Each names the definitions that do the work and the tests that accept it. Each stakeholder has one journey.
Features and journeys 8 rows
| Feature | Calls | Accepted by |
|---|---|---|
| When distance is above 22, the answer is distant. | GardenAttunement::rule1, GardenAttunement::judge | GardenAttunement::application |
| When angle is above 62, the answer is distant. | GardenAttunement::rule2, GardenAttunement::judge | GardenAttunement::application |
| When cooldown is at least 1, the answer is dormant. | GardenAttunement::rule3, GardenAttunement::judge | GardenAttunement::application |
| When no rule matches, the answer is attuned. | GardenAttunement::judge | GardenAttunement::application |
| A request that is not angle, distance, cooldown in order, separated by single spaces, or is over 88 bytes, is answered invalid. | GardenAttunement::dispatch, GardenAttunement::decodeField1 | GardenAttunement::application |
| It never answers attuned when distance is above 22. | GardenAttunement::judge | GardenAttunementProofs::inv001Holds |
| It never answers attuned when angle is above 62. | GardenAttunement::judge | GardenAttunementProofs::inv002Holds |
| It never answers attuned when cooldown is at least 1. | GardenAttunement::judge | GardenAttunementProofs::inv003Holds |
Journeys
The ordered features each stakeholder takes.
| Stakeholder | Steps |
|---|---|
| Player | REQ-001 → REQ-002 → REQ-003 → otherwise |
| Sound designer | INV-001 → INV-002 → INV-003 |
| Verifier | refuse → INV-001 → INV-002 → INV-003 |
Security and threat model
12 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 12 rows
| Threat | STRIDE | Asset | Risk | Answered by |
|---|---|---|---|---|
| Activation behind the player | elevationOfPrivilege | Answer | low likelihood, minor impact | Gaze cone proved: proof GardenAttunementProofs::inv002Holds; review src/game/prismModel.test.ts focalGazeSelection |
| Answer that breaks INV-001 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-001: proof GardenAttunementProofs::inv001Holds |
| Answer that breaks INV-002 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-002: proof GardenAttunementProofs::inv002Holds |
| Answer that breaks INV-003 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-003: proof GardenAttunementProofs::inv003Holds |
| Client range drift | tampering | Model source | medium likelihood, minor impact | accepted: The app follows the LexLean model, 22 m; src/game/prismModel.ts findNearestPlant uses 32 m, a drift for the repository to reconcile. |
| Granted capability | informationDisclosure | Answer | low likelihood, major impact | No capability granted: gate prism-code check refuses an ungranted guest import |
| Key-repeat flood | denialOfService | Request bytes | medium likelihood, minor impact | Refractory pause: proof GardenAttunementProofs::inv003Holds; review prism/src/Foundation/Humane/V1/Model.lex.tex GestureHoldAndCooldownPolicy |
| Malformed request | tampering | Request bytes | high likelihood, major impact | Strict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify |
| Oversized request | denialOfService | Request bytes | medium likelihood, minor impact | Bounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify |
| Substituted holo | spoofing | Published holo | low likelihood, critical impact | Fingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page |
| Substituted host | spoofing | Published holo | low likelihood, critical impact | accepted: 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 model | tampering | Model source | low likelihood, major impact | Regenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json |
Quality
ISO/IEC 25010:2023 requirements. Each has a measure and a threshold that a theorem pins.
Quality 7 rows
| Requirement | Characteristic | Measure | Threshold |
|---|---|---|---|
| Bounded allocation: The guest allocates at most 176 bytes for one request. | Performance efficiency: Resource utilization | Guest allocation bytes | 176 |
| Bounded request: A request over 88 bytes is refused before any field is read. | Performance efficiency: Time behaviour | Request bytes read | 88 |
| Every property proved: All 3 properties are theorems the Lean kernel checks. | Security: Integrity | Unproved properties | 0 |
| Every request answered: Every request gets an answer: a rule, attuned otherwise, or invalid. | Functional suitability: Functional completeness | Unanswered requests | 0 |
| Every vector replays: All 42 acceptance vectors replay in the compiled guest, the shortest 0 bytes long. | Reliability: Faultlessness | Failed vectors | 0 |
| Examples answered as stated: Every one of the 6 examples of the spec is answered as it states. | Functional suitability: Functional correctness | Example mismatches | 0 |
| No activation behind the player: An attune gesture never activates a plant outside the forward gaze cone. | Safety: Operational constraint | Behind-player activations | 0 |
Compliance
One obligation per standard, each naming its evidence.
| Standard | Subject | Evidence |
|---|---|---|
| ISO/IEC/IEEE 42010:2022 | Architecture description | Architecture::architectureDescriptionHolds |
| ISO/PAS 19450:2015 and OMG UML 2.5.1 | Design views | Design::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates |
| ISO/IEC 25010:2023 | Product quality | Quality::qualityModelHolds |
| ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022 | Application security and risk | Security::controlSet |
| OMG DMN 1.5, hit policy FIRST | Decision table | GardenAttunement::judge |
| OpenSpec | Requirements | GardenAttunement::application |
| SPDX MIT OR Apache-2.0 | Licensing | GardenAttunement::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 Plant attunement request
Viewpoint: Architecture::viewpointPlayerCorrectAnswers
Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile
componentBrowser is an object.
componentPlantAttunementGuest is an object.
componentPlantAttunementGuest can be stateDeciding or stateIdle.
processDecide is a process.
processEncodeAnswer is a process.
processJudge is a process.
processParseRequest is a process.
componentPlantAttunementGuest 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 Plant attunement
component "componentBrowser" as c0
component "componentGardenClient" as c1
component "componentGitHubPages" as c2
component "componentPlantAttunementGuest" as c3
component "componentPlantAttunementPage" as c4
component "componentPrismBuild" as c5
component "componentSoundscapeEngine" as c6
component "componentSourceRepository" as c7
c0 --> c3 : edgeBrowserToPlantAttunementGuest
c1 --> c3 : edgeGardenClientToPlantAttunementGuest
c2 --> c0 : edgeGitHubPagesToBrowser
c3 --> c0 : edgePlantAttunementGuestToBrowser
c3 --> c1 : edgePlantAttunementGuestToGardenClient
c3 --> c6 : edgePlantAttunementGuestToSoundscapeEngine
c4 --> c2 : edgePlantAttunementPageToGitHubPages
c5 --> c3 : edgePrismBuildToPlantAttunementGuest
c5 --> c4 : edgePrismBuildToPlantAttunementPage
c6 --> c3 : edgeSoundscapeEngineToPlantAttunementGuest
c7 --> c5 : edgeSourceRepositoryToPrismBuild
@enduml
design/Design.viewUmlRequest.puml
@startuml
' UML 2.5.1 sequence diagram
' view: Design::viewUmlRequest
' viewpoint: Architecture::viewpointPlayerCorrectAnswers
title Answering a Plant attunement request
participant "componentBrowser" as p0
participant "componentPlantAttunementGuest" 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::viewpointVerifierRefusedMalformedRequests
title States of the Plant attunement guest
state "stateAnsweredAttuned" as s0
state "stateAnsweredDistant" as s1
state "stateAnsweredDormant" as s2
state "stateDeciding" as s3
state "stateIdle" as s4
state "stateRefused" as s5
[*] --> s4
s4 --> s3 : processParseRequest
s4 --> s5 : processParseRequest
s3 --> s1 : processRule1
s3 --> s1 : processRule2
s3 --> s2 : processRule3
s3 --> s0 : processOtherwise
s0 --> s4 : processEncodeAnswer
s2 --> s4 : processEncodeAnswer
s1 --> s4 : processEncodeAnswer
s5 --> s4 : 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 399 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: stakeholderPlayer,
parameters: [],
result: Foundation.Arch::Stakeholder,
body: (record Foundation.Arch::Stakeholder {index := 0, name := "Player", text := "Wanders the garden and needs each plant to answer the same way to the same walk."})
}
definition{
name: stakeholderSoundDesigner,
parameters: [],
result: Foundation.Arch::Stakeholder,
body: (record Foundation.Arch::Stakeholder {index := 1, name := "Sound designer", text := "Places plants and tunes the humane pacing and needs plants outside the gaze cone, or a rushed gesture, to stay silent."})
}
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: concernCalmInteraction,
parameters: [],
result: Foundation.Arch::Concern,
body: (record Foundation.Arch::Concern {index := 0, name := "Calm interaction", text := "Gestures follow the Humane design standard: focal gaze-cone selection and refractory pauses, with no activation behind the player."})
}
definition{
name: concernCorrectAnswers,
parameters: [],
result: Foundation.Arch::Concern,
body: (record Foundation.Arch::Concern {index := 1, name := "Correct answers", text := "Every well-formed request is answered by the first rule that matches it, or attuned when none does, as the spec states."})
}
definition{
name: concernIntegrityOfThePublishedApp,
parameters: [],
result: Foundation.Arch::Concern,
body: (record Foundation.Arch::Concern {index := 2, 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 := 3, name := "Proved guarantees", text := "Each of the 3 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 := 4, name := "Refused malformed requests", text := "A request that is not the 3 fields in order, or is longer than 88 bytes, is answered invalid and never guessed."})
}
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 Plant attunement guest."})
}
definition{
name: componentGardenClient,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 1, kind := (ctor Foundation.Arch::ComponentKind.staticSite), name := "Garden client", text := "The browser game, src/components/GardenCanvas.tsx, which finds the focal plant and sends the gesture."})
}
definition{
name: componentGitHubPages,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 2, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "GitHub Pages", text := "Serves the page and the holo from the repository Pages workflow."})
}
definition{
name: componentPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 3, kind := (ctor Foundation.Arch::ComponentKind.service), name := "Plant attunement guest", text := "The Core-Wasm guest built from the model: it answers one request of at most 88 bytes with one answer of at most 64."})
}
definition{
name: componentPlantAttunementPage,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 4, kind := (ctor Foundation.Arch::ComponentKind.staticSite), name := "Plant attunement 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 := 5, 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: componentSoundscapeEngine,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 6, kind := (ctor Foundation.Arch::ComponentKind.service), name := "Soundscape engine", text := "src/game/soundscapeEngine.ts, the Web Audio voices an attuned plant plays."})
}
definition{
name: componentSourceRepository,
parameters: [],
result: Foundation.Arch::Component,
body: (record Foundation.Arch::Component {index := 7, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "Source repository", text := "The repository that holds the prompt, the model and its gate."})
}
definition{
name: edgeBrowserToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 0, fromIndex := 0, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgeGardenClientToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 1, fromIndex := 1, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgeGitHubPagesToBrowser,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 2, fromIndex := 2, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePlantAttunementGuestToBrowser,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 3, fromIndex := 3, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePlantAttunementGuestToGardenClient,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 4, fromIndex := 3, toIndex := 1, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePlantAttunementGuestToSoundscapeEngine,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 5, fromIndex := 3, toIndex := 6, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePlantAttunementPageToGitHubPages,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 6, fromIndex := 4, toIndex := 2, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePrismBuildToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 7, fromIndex := 5, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgePrismBuildToPlantAttunementPage,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 8, fromIndex := 5, toIndex := 4, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgeSoundscapeEngineToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 9, fromIndex := 6, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: edgeSourceRepositoryToPrismBuild,
parameters: [],
result: Foundation.Arch::Edge,
body: (record Foundation.Arch::Edge {index := 10, fromIndex := 7, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}
definition{
name: viewpointPlayerCorrectAnswers,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 0, stakeholderIndex := 0, concernIndex := 1, modelKindIndex := 1})
}
definition{
name: viewpointSoundDesignerCalmInteraction,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 1, stakeholderIndex := 1, concernIndex := 0, modelKindIndex := 1})
}
definition{
name: viewpointSoundDesignerProvedGuarantees,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 2, stakeholderIndex := 1, concernIndex := 3, modelKindIndex := 1})
}
definition{
name: viewpointVerifierIntegrityOfThePublishedApp,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 3, stakeholderIndex := 2, concernIndex := 2, modelKindIndex := 2})
}
definition{
name: viewpointVerifierProvedGuarantees,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 4, stakeholderIndex := 2, concernIndex := 3, modelKindIndex := 1})
}
definition{
name: viewpointVerifierRefusedMalformedRequests,
parameters: [],
result: Foundation.Arch::Viewpoint,
body: (record Foundation.Arch::Viewpoint {index := 5, stakeholderIndex := 2, concernIndex := 4, modelKindIndex := 2})
}
definition{
name: viewPlayerCorrectAnswers,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 0, viewpointIndex := 0, modelKindIndex := 1})
}
definition{
name: viewSoundDesignerCalmInteraction,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 1, viewpointIndex := 1, modelKindIndex := 1})
}
definition{
name: viewSoundDesignerProvedGuarantees,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 2, viewpointIndex := 2, modelKindIndex := 1})
}
definition{
name: viewVerifierIntegrityOfThePublishedApp,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 3, viewpointIndex := 3, modelKindIndex := 2})
}
definition{
name: viewVerifierProvedGuarantees,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 4, viewpointIndex := 4, modelKindIndex := 1})
}
definition{
name: viewVerifierRefusedMalformedRequests,
parameters: [],
result: Foundation.Arch::View,
body: (record Foundation.Arch::View {index := 5, viewpointIndex := 5, modelKindIndex := 2})
}
definition{
name: componentRecords,
parameters: [],
result: (List Foundation.Arch::Component),
body: (cons (componentBrowser) (cons (componentGardenClient) (cons (componentGitHubPages) (cons (componentPlantAttunementGuest) (cons (componentPlantAttunementPage) (cons (componentPrismBuild) (cons (componentSoundscapeEngine) (cons (componentSourceRepository) (nil Foundation.Arch::Component)))))))))
}
definition{
name: edgeRecords,
parameters: [],
result: (List Foundation.Arch::Edge),
body: (cons (edgeBrowserToPlantAttunementGuest) (cons (edgeGardenClientToPlantAttunementGuest) (cons (edgeGitHubPagesToBrowser) (cons (edgePlantAttunementGuestToBrowser) (cons (edgePlantAttunementGuestToGardenClient) (cons (edgePlantAttunementGuestToSoundscapeEngine) (cons (edgePlantAttunementPageToGitHubPages) (cons (edgePrismBuildToPlantAttunementGuest) (cons (edgePrismBuildToPlantAttunementPage) (cons (edgeSoundscapeEngineToPlantAttunementGuest) (cons (edgeSourceRepositoryToPrismBuild) (nil Foundation.Arch::Edge))))))))))))
}
definition{
name: viewpointRecords,
parameters: [],
result: (List Foundation.Arch::Viewpoint),
body: (cons (viewpointPlayerCorrectAnswers) (cons (viewpointSoundDesignerCalmInteraction) (cons (viewpointSoundDesignerProvedGuarantees) (cons (viewpointVerifierIntegrityOfThePublishedApp) (cons (viewpointVerifierProvedGuarantees) (cons (viewpointVerifierRefusedMalformedRequests) (nil Foundation.Arch::Viewpoint)))))))
}
definition{
name: viewRecords,
parameters: [],
result: (List Foundation.Arch::View),
body: (cons (viewPlayerCorrectAnswers) (cons (viewSoundDesignerCalmInteraction) (cons (viewSoundDesignerProvedGuarantees) (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 8 (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{GardenAttunement}
\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" (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 DMN 1.5, hit policy FIRST", subject := "Decision table", text := "The 3 rules are tried in order and the first that matches gives the answer; otherwise attuned.", evidence := (cons "GardenAttunement::judge" (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 "GardenAttunement::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 "GardenAttunement::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 535 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::componentPlantAttunementGuest"})
}
definition{
name: processParseRequest,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: processJudge,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: processEncodeAnswer,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
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::componentPlantAttunementGuest"})
}
definition{
name: processRule2,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: processRule3,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: processOtherwise,
parameters: [],
result: Foundation.Arch::SystemProcess,
body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateIdle,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateDeciding,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateRefused,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateAnsweredAttuned,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateAnsweredDormant,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: stateAnsweredDistant,
parameters: [],
result: Foundation.Arch::SystemState,
body: (record Foundation.Arch::SystemState {owner := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: viewOpmDecide,
parameters: [],
result: Foundation.Arch::DesignView,
body: (record Foundation.Arch::DesignView {title := "Deciding a Plant attunement request", viewpoint := "Architecture::viewpointPlayerCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.opmObjectProcess)})
}
definition{
name: viewUmlComponents,
parameters: [],
result: Foundation.Arch::DesignView,
body: (record Foundation.Arch::DesignView {title := "Components of Plant attunement", 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 Plant attunement request", viewpoint := "Architecture::viewpointPlayerCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.umlSequence)})
}
definition{
name: viewUmlStates,
parameters: [],
result: Foundation.Arch::DesignView,
body: (record Foundation.Arch::DesignView {title := "States of the Plant attunement guest", viewpoint := "Architecture::viewpointVerifierRefusedMalformedRequests", 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::componentPlantAttunementGuest"})
}
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::componentPlantAttunementGuest", state := "Design::stateIdle"})
}
definition{
name: opmGuestDeciding,
parameters: [],
result: Foundation.Arch::OpmState,
body: (record Foundation.Arch::OpmState {view := "Design::viewOpmDecide", thing := "Architecture::componentPlantAttunementGuest", 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::componentPlantAttunementGuest", 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: umlGardenClient,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentGardenClient"})
}
definition{
name: umlGitHubPages,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentGitHubPages"})
}
definition{
name: umlPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentPlantAttunementGuest"})
}
definition{
name: umlPlantAttunementPage,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentPlantAttunementPage"})
}
definition{
name: umlPrismBuild,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentPrismBuild"})
}
definition{
name: umlSoundscapeEngine,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentSoundscapeEngine"})
}
definition{
name: umlSourceRepository,
parameters: [],
result: Foundation.Arch::UmlComponent,
body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentSourceRepository"})
}
definition{
name: umlBrowserToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeBrowserToPlantAttunementGuest"})
}
definition{
name: umlGardenClientToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeGardenClientToPlantAttunementGuest"})
}
definition{
name: umlGitHubPagesToBrowser,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeGitHubPagesToBrowser"})
}
definition{
name: umlPlantAttunementGuestToBrowser,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePlantAttunementGuestToBrowser"})
}
definition{
name: umlPlantAttunementGuestToGardenClient,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePlantAttunementGuestToGardenClient"})
}
definition{
name: umlPlantAttunementGuestToSoundscapeEngine,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePlantAttunementGuestToSoundscapeEngine"})
}
definition{
name: umlPlantAttunementPageToGitHubPages,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePlantAttunementPageToGitHubPages"})
}
definition{
name: umlPrismBuildToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToPlantAttunementGuest"})
}
definition{
name: umlPrismBuildToPlantAttunementPage,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToPlantAttunementPage"})
}
definition{
name: umlSoundscapeEngineToPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlConnector,
body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeSoundscapeEngineToPlantAttunementGuest"})
}
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: seqPlantAttunementGuest,
parameters: [],
result: Foundation.Arch::UmlLifeline,
body: (record Foundation.Arch::UmlLifeline {view := "Design::viewUmlRequest", component := "Architecture::componentPlantAttunementGuest", 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::componentPlantAttunementGuest", 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::componentPlantAttunementGuest", 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: stAnsweredAttuned,
parameters: [],
result: Foundation.Arch::UmlState,
body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredAttuned", initial := false})
}
definition{
name: stAnsweredDormant,
parameters: [],
result: Foundation.Arch::UmlState,
body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredDormant", initial := false})
}
definition{
name: stAnsweredDistant,
parameters: [],
result: Foundation.Arch::UmlState,
body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredDistant", 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::stateAnsweredDistant", 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::stateAnsweredDistant", 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::stateAnsweredDormant", trigger := "Design::processRule3"})
}
definition{
name: trOtherwise,
parameters: [],
result: Foundation.Arch::UmlTransition,
body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 5, source := "Design::stateDeciding", target := "Design::stateAnsweredAttuned", trigger := "Design::processOtherwise"})
}
definition{
name: trResetAttuned,
parameters: [],
result: Foundation.Arch::UmlTransition,
body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 6, source := "Design::stateAnsweredAttuned", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}
definition{
name: trResetDormant,
parameters: [],
result: Foundation.Arch::UmlTransition,
body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 7, source := "Design::stateAnsweredDormant", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}
definition{
name: trResetDistant,
parameters: [],
result: Foundation.Arch::UmlTransition,
body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 8, source := "Design::stateAnsweredDistant", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}
definition{
name: trResetRefused,
parameters: [],
result: Foundation.Arch::UmlTransition,
body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 9, source := "Design::stateRefused", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}
\end{semanticmodule}
\end{lexlean}
app/src/Features.lex.tex 109 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{GardenAttunement}
\importmodule{Architecture}
\importmodule{Foundation.Arch}
\title{feature}
\begin{semanticmodule}
definition{
name: acceptINV001,
parameters: [],
result: String,
body: "GardenAttunementProofs::inv001Holds"
}
definition{
name: acceptINV002,
parameters: [],
result: String,
body: "GardenAttunementProofs::inv002Holds"
}
definition{
name: acceptINV003,
parameters: [],
result: String,
body: "GardenAttunementProofs::inv003Holds"
}
definition{
name: featureRule1,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "When distance is above 22, the answer is distant.", calls := (cons "GardenAttunement::rule1" (cons "GardenAttunement::judge" (nil String))), acceptance := (cons "GardenAttunement::application" (nil String))})
}
definition{
name: featureRule2,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "When angle is above 62, the answer is distant.", calls := (cons "GardenAttunement::rule2" (cons "GardenAttunement::judge" (nil String))), acceptance := (cons "GardenAttunement::application" (nil String))})
}
definition{
name: featureRule3,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "When cooldown is at least 1, the answer is dormant.", calls := (cons "GardenAttunement::rule3" (cons "GardenAttunement::judge" (nil String))), acceptance := (cons "GardenAttunement::application" (nil String))})
}
definition{
name: featureOtherwise,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "When no rule matches, the answer is attuned.", calls := (cons "GardenAttunement::judge" (nil String)), acceptance := (cons "GardenAttunement::application" (nil String))})
}
definition{
name: featureRefuseMalformed,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "A request that is not angle, distance, cooldown in order, separated by single spaces, or is over 88 bytes, is answered invalid.", calls := (cons "GardenAttunement::dispatch" (cons "GardenAttunement::decodeField1" (nil String))), acceptance := (cons "GardenAttunement::application" (nil String))})
}
definition{
name: featureINV001,
parameters: [],
result: Foundation.Arch::Feature,
body: (record Foundation.Arch::Feature {statement := "It never answers attuned when distance is above 22.", calls := (cons "GardenAttunement::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 attuned when angle is above 62.", calls := (cons "GardenAttunement::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 attuned when cooldown is at least 1.", calls := (cons "GardenAttunement::judge" (nil String)), acceptance := (cons "Features::acceptINV003" (nil String))})
}
definition{
name: journeyPlayer,
parameters: [],
result: Foundation.Arch::Journey,
body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderPlayer", steps := (cons "Features::featureRule1" (cons "Features::featureRule2" (cons "Features::featureRule3" (cons "Features::featureOtherwise" (nil String)))))})
}
definition{
name: journeySoundDesigner,
parameters: [],
result: Foundation.Arch::Journey,
body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderSoundDesigner", steps := (cons "Features::featureINV001" (cons "Features::featureINV002" (cons "Features::featureINV003" (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" (nil String)))))})
}
\end{semanticmodule}
\end{lexlean}
app/src/Quality.lex.tex 361 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: characteristicSafety,
parameters: [],
result: Foundation.Qual::ProductQualityCharacteristic,
body: (record Foundation.Qual::ProductQualityCharacteristic {index := 3})
}
definition{
name: characteristicSecurity,
parameters: [],
result: Foundation.Qual::ProductQualityCharacteristic,
body: (record Foundation.Qual::ProductQualityCharacteristic {index := 4})
}
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 := 4})
}
definition{
name: subcharacteristicOperationalConstraint,
parameters: [],
result: Foundation.Qual::QualitySubcharacteristic,
body: (record Foundation.Qual::QualitySubcharacteristic {index := 4, characteristicIndex := 3})
}
definition{
name: subcharacteristicResourceUtilization,
parameters: [],
result: Foundation.Qual::QualitySubcharacteristic,
body: (record Foundation.Qual::QualitySubcharacteristic {index := 5, characteristicIndex := 1})
}
definition{
name: subcharacteristicTimeBehaviour,
parameters: [],
result: Foundation.Qual::QualitySubcharacteristic,
body: (record Foundation.Qual::QualitySubcharacteristic {index := 6, characteristicIndex := 1})
}
definition{
name: requirementBoundedAllocation,
parameters: [],
result: Foundation.Qual::QualityRequirement,
body: (record Foundation.Qual::QualityRequirement {index := 0, subcharacteristicIndex := 5})
}
definition{
name: requirementBoundedRequest,
parameters: [],
result: Foundation.Qual::QualityRequirement,
body: (record Foundation.Qual::QualityRequirement {index := 1, subcharacteristicIndex := 6})
}
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: requirementEveryVectorReplays,
parameters: [],
result: Foundation.Qual::QualityRequirement,
body: (record Foundation.Qual::QualityRequirement {index := 4, subcharacteristicIndex := 0})
}
definition{
name: requirementExamplesAnsweredAsStated,
parameters: [],
result: Foundation.Qual::QualityRequirement,
body: (record Foundation.Qual::QualityRequirement {index := 5, subcharacteristicIndex := 2})
}
definition{
name: requirementNoActivationBehindThePlayer,
parameters: [],
result: Foundation.Qual::QualityRequirement,
body: (record Foundation.Qual::QualityRequirement {index := 6, subcharacteristicIndex := 4})
}
definition{
name: measureBehindPlayerActivations,
parameters: [],
result: Foundation.Qual::QualityMeasure,
body: (record Foundation.Qual::QualityMeasure {index := 0, requirementIndex := 6, threshold := 0})
}
definition{
name: measureExampleMismatches,
parameters: [],
result: Foundation.Qual::QualityMeasure,
body: (record Foundation.Qual::QualityMeasure {index := 1, requirementIndex := 5, threshold := 0})
}
definition{
name: measureFailedVectors,
parameters: [],
result: Foundation.Qual::QualityMeasure,
body: (record Foundation.Qual::QualityMeasure {index := 2, requirementIndex := 4, threshold := 0})
}
definition{
name: measureGuestAllocationBytes,
parameters: [],
result: Foundation.Qual::QualityMeasure,
body: (record Foundation.Qual::QualityMeasure {index := 3, requirementIndex := 0, threshold := 176})
}
definition{
name: measureRequestBytesRead,
parameters: [],
result: Foundation.Qual::QualityMeasure,
body: (record Foundation.Qual::QualityMeasure {index := 4, requirementIndex := 1, threshold := 88})
}
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: 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 Plant attunement."}) (cons (record Named {index := 1, name := "Performance efficiency", text := "Performance efficiency, as ISO/IEC 25010:2023 defines it, for Plant attunement."}) (cons (record Named {index := 2, name := "Reliability", text := "Reliability, as ISO/IEC 25010:2023 defines it, for Plant attunement."}) (cons (record Named {index := 3, name := "Safety", text := "Safety, as ISO/IEC 25010:2023 defines it, for Plant attunement."}) (cons (record Named {index := 4, name := "Security", text := "Security, as ISO/IEC 25010:2023 defines it, for Plant attunement."}) (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 := "Operational constraint", text := "Safety: Operational constraint."}) (cons (record Named {index := 5, name := "Resource utilization", text := "Performance efficiency: Resource utilization."}) (cons (record Named {index := 6, 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 176 bytes for one request."}) (cons (record Named {index := 1, name := "Bounded request", text := "A request over 88 bytes is refused before any field is read."}) (cons (record Named {index := 2, name := "Every property proved", text := "All 3 properties are theorems the Lean kernel checks."}) (cons (record Named {index := 3, name := "Every request answered", text := "Every request gets an answer: a rule, attuned otherwise, or invalid."}) (cons (record Named {index := 4, name := "Every vector replays", text := "All 42 acceptance vectors replay in the compiled guest, the shortest 0 bytes long."}) (cons (record Named {index := 5, name := "Examples answered as stated", text := "Every one of the 6 examples of the spec is answered as it states."}) (cons (record Named {index := 6, name := "No activation behind the player", text := "An attune gesture never activates a plant outside the forward gaze cone."}) (nil Named))))))))
}
definition{
name: measureNames,
parameters: [],
result: (List Named),
body: (cons (record Named {index := 0, name := "Behind-player activations", text := "Requests with an angle over 62 degrees answered attuned, behindPlayerActivationsCount in the model."}) (cons (record Named {index := 1, name := "Example mismatches", text := "Examples the guest answers otherwise than they state."}) (cons (record Named {index := 2, name := "Failed vectors", text := "Acceptance vectors whose replay differs from the model."}) (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."}) (nil Named))))))))
}
definition{
name: subcharacteristicRecords,
parameters: [],
result: (List Foundation.Qual::QualitySubcharacteristic),
body: (cons (subcharacteristicFaultlessness) (cons (subcharacteristicFunctionalCompleteness) (cons (subcharacteristicFunctionalCorrectness) (cons (subcharacteristicIntegrity) (cons (subcharacteristicOperationalConstraint) (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 (requirementEveryVectorReplays) (cons (requirementExamplesAnsweredAsStated) (cons (requirementNoActivationBehindThePlayer) (nil Foundation.Qual::QualityRequirement))))))))
}
definition{
name: measureRecords,
parameters: [],
result: (List Foundation.Qual::QualityMeasure),
body: (cons (measureBehindPlayerActivations) (cons (measureExampleMismatches) (cons (measureFailedVectors) (cons (measureGuestAllocationBytes) (cons (measureRequestBytesRead) (cons (measureUnansweredRequests) (cons (measureUnprovedProperties) (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 5 (subcharacteristicRecords)) && ((requirementsKnown 7 (requirementRecords)) && (measuresKnown 7 (measureRecords))))))))
}
theorem{
name: qualityModelHolds,
parameters: [],
statement: ((qualityValid) = true),
proof: decide{}
}
theorem{
name: measureBehindPlayerActivationsThreshold,
parameters: [],
statement: ((thresholdOf 0 (measureRecords)) = 0),
proof: decide{}
}
theorem{
name: measureExampleMismatchesThreshold,
parameters: [],
statement: ((thresholdOf 1 (measureRecords)) = 0),
proof: decide{}
}
theorem{
name: measureFailedVectorsThreshold,
parameters: [],
statement: ((thresholdOf 2 (measureRecords)) = 0),
proof: decide{}
}
theorem{
name: measureGuestAllocationBytesThreshold,
parameters: [],
statement: ((thresholdOf 3 (measureRecords)) = 176),
proof: decide{}
}
theorem{
name: measureRequestBytesReadThreshold,
parameters: [],
statement: ((thresholdOf 4 (measureRecords)) = 88),
proof: decide{}
}
theorem{
name: measureUnansweredRequestsThreshold,
parameters: [],
statement: ((thresholdOf 5 (measureRecords)) = 0),
proof: decide{}
}
theorem{
name: measureUnprovedPropertiesThreshold,
parameters: [],
statement: ((thresholdOf 6 (measureRecords)) = 0),
proof: decide{}
}
\end{semanticmodule}
\end{lexlean}
app/src/Security.lex.tex 551 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 := 3})
}
definition{
name: assetModelSource,
parameters: [],
result: Foundation.Sec::Asset,
body: (record Foundation.Sec::Asset {index := 1, componentIndex := 7})
}
definition{
name: assetPublishedHolo,
parameters: [],
result: Foundation.Sec::Asset,
body: (record Foundation.Sec::Asset {index := 2, componentIndex := 4})
}
definition{
name: assetRequestBytes,
parameters: [],
result: Foundation.Sec::Asset,
body: (record Foundation.Sec::Asset {index := 3, componentIndex := 3})
}
definition{
name: threatActivationBehindThePlayer,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 0})
}
definition{
name: threatAnswerThatBreaksINV001,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 1})
}
definition{
name: threatAnswerThatBreaksINV002,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 2})
}
definition{
name: threatAnswerThatBreaksINV003,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 3})
}
definition{
name: threatClientRangeDrift,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 4})
}
definition{
name: threatGrantedCapability,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 5})
}
definition{
name: threatKeyRepeatFlood,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 6})
}
definition{
name: threatMalformedRequest,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 7})
}
definition{
name: threatOversizedRequest,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 8})
}
definition{
name: threatSubstitutedHolo,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 9})
}
definition{
name: threatSubstitutedHost,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 10})
}
definition{
name: threatTamperedModel,
parameters: [],
result: Foundation.Sec::Threat,
body: (record Foundation.Sec::Threat {index := 11})
}
definition{
name: riskActivationBehindThePlayer,
parameters: [],
result: Foundation.Sec::Risk,
body: (record Foundation.Sec::Risk {index := 0, assetIndex := 0, threatIndex := 0, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.minor)})
}
definition{
name: riskAnswerThatBreaksINV001,
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: riskAnswerThatBreaksINV002,
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: riskAnswerThatBreaksINV003,
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: riskClientRangeDrift,
parameters: [],
result: Foundation.Sec::Risk,
body: (record Foundation.Sec::Risk {index := 4, assetIndex := 1, threatIndex := 4, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.minor)})
}
definition{
name: riskGrantedCapability,
parameters: [],
result: Foundation.Sec::Risk,
body: (record Foundation.Sec::Risk {index := 5, assetIndex := 0, threatIndex := 5, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
}
definition{
name: riskKeyRepeatFlood,
parameters: [],
result: Foundation.Sec::Risk,
body: (record Foundation.Sec::Risk {index := 6, assetIndex := 3, threatIndex := 6, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.minor)})
}
definition{
name: riskMalformedRequest,
parameters: [],
result: Foundation.Sec::Risk,
body: (record Foundation.Sec::Risk {index := 7, assetIndex := 3, threatIndex := 7, 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 := 8, assetIndex := 3, threatIndex := 8, 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 := 9, assetIndex := 2, threatIndex := 9, 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 := 10, assetIndex := 2, threatIndex := 10, 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 := 11, assetIndex := 1, threatIndex := 11, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
}
definition{
name: controlBoundedRequest,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 0, riskIndex := 8})
}
definition{
name: controlFingerprintAndProvenance,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 1, riskIndex := 9})
}
definition{
name: controlGazeConeProved,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 2, riskIndex := 0})
}
definition{
name: controlNoCapabilityGranted,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 3, riskIndex := 5})
}
definition{
name: controlProofOfINV001,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 4, riskIndex := 1})
}
definition{
name: controlProofOfINV002,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 5, riskIndex := 2})
}
definition{
name: controlProofOfINV003,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 6, riskIndex := 3})
}
definition{
name: controlRefractoryPause,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 7, riskIndex := 6})
}
definition{
name: controlRegeneratedFromThePrompt,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 8, riskIndex := 11})
}
definition{
name: controlStrictDecoder,
parameters: [],
result: Foundation.Sec::ApplicationSecurityControl,
body: (record Foundation.Sec::ApplicationSecurityControl {index := 9, riskIndex := 7})
}
definition{
name: controlSet,
parameters: [],
result: Production.ThreatModel::ControlSet,
body: (record Production.ThreatModel::ControlSet {title := "Plant attunement security controls", text := "Plant attunement answers one request with one answer in a Core-Wasm guest granted no capability. Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.", 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 attuned, dormant, distant, 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 88 of them."})
}
definition{
name: modeledThreatActivationBehindThePlayer,
parameters: [],
result: Production.ThreatModel::ModeledThreat,
body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatActivationBehindThePlayer", name := "Activation behind the player", text := "A plant behind the player attunes, breaking the focal gaze law.", category := (ctor Production.ThreatModel::Stride.elevationOfPrivilege)})
}
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 attuned although distance is above 22, which matters because no plant answers a player out of reach.", 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 attuned although angle is above 62, which matters because behindPlayerActivationsCount is 0: nothing behind the player activates.", 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 attuned although cooldown is at least 1, which matters because mindful pacing: a repeated gesture never attunes during its refractory pause.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}
definition{
name: modeledThreatClientRangeDrift,
parameters: [],
result: Production.ThreatModel::ModeledThreat,
body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatClientRangeDrift", name := "Client range drift", text := "The client finds focal plants up to 32 m away while the model allows 22 m, so the page and the model disagree.", category := (ctor Production.ThreatModel::Stride.tampering)})
}
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: modeledThreatKeyRepeatFlood,
parameters: [],
result: Production.ThreatModel::ModeledThreat,
body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatKeyRepeatFlood", name := "Key-repeat flood", text := "Operating-system key repeat fires attune many times a second, so plants chatter.", category := (ctor Production.ThreatModel::Stride.denialOfService)})
}
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 88 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: 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 88 bytes before reading a field, and the guest allocates at most 176.", 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: 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: modeledControlGazeConeProved,
parameters: [],
result: Production.ThreatModel::ModeledControl,
body: (record Production.ThreatModel::ModeledControl {control := "Security::controlGazeConeProved", name := "Gaze cone proved", text := "Beyond 62 degrees nothing attunes, proved for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "GardenAttunementProofs::inv002Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.review), reference := "src/game/prismModel.test.ts focalGazeSelection"}) (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 attuned when distance is above 22. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "GardenAttunementProofs::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 attuned when angle is above 62. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "GardenAttunementProofs::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 attuned when cooldown 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 := "GardenAttunementProofs::inv003Holds"}) (nil Production.ThreatModel::Evidence))})
}
definition{
name: modeledControlRefractoryPause,
parameters: [],
result: Production.ThreatModel::ModeledControl,
body: (record Production.ThreatModel::ModeledControl {control := "Security::controlRefractoryPause", name := "Refractory pause", text := "Attune is ignored for 1100 ms after a gesture, proved for every request, and OS key repeat is suppressed.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "GardenAttunementProofs::inv003Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.review), reference := "prism/src/Foundation/Humane/V1/Model.lex.tex GestureHoldAndCooldownPolicy"}) (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: 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: mappingSubstitutedHolo,
parameters: [],
result: Production.ThreatModel::ThreatMapping,
body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatSubstitutedHolo", controls := (cons "Security::controlFingerprintAndProvenance" (nil String))})
}
definition{
name: mappingActivationBehindThePlayer,
parameters: [],
result: Production.ThreatModel::ThreatMapping,
body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatActivationBehindThePlayer", controls := (cons "Security::controlGazeConeProved" (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: mappingKeyRepeatFlood,
parameters: [],
result: Production.ThreatModel::ThreatMapping,
body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatKeyRepeatFlood", controls := (cons "Security::controlRefractoryPause" (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: mappingMalformedRequest,
parameters: [],
result: Production.ThreatModel::ThreatMapping,
body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatMalformedRequest", controls := (cons "Security::controlStrictDecoder" (nil String))})
}
definition{
name: acceptedClientRangeDrift,
parameters: [],
result: Production.ThreatModel::AcceptedRisk,
body: (record Production.ThreatModel::AcceptedRisk {threat := "Security::threatClientRangeDrift", rationale := "The app follows the LexLean model, 22 m; src/game/prismModel.ts findNearestPlant uses 32 m, a drift for the repository to reconcile."})
}
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/GardenAttunement.lex.tex 198 lines
\begin{lexlean}{GardenAttunement}
\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: answerAttuned, parameters: [], result: Nat, body: 0}
definition{name: answerDormant, parameters: [], result: Nat, body: 1}
definition{name: answerDistant, parameters: [], result: Nat, body: 2}
structure{
name: Request,
type_parameters: [],
parameters: [],
fields: [{name: angle, type: Nat}, {name: distance, type: Nat}, {name: cooldown, 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: parseAngle,
parameters: [value : Bytes],
result: (Option Nat),
body: (match (parseNumber value)
| Option.none => (ctor Option.none [Nat])
| Option.some parsed => (if (180 <? parsed) then (ctor Option.none [Nat]) else (ctor Option.some [Nat] parsed))),
axioms: [Quot.sound, propext]
}
definition{
name: parseDistance,
parameters: [value : Bytes],
result: (Option Nat),
body: (match (parseNumber value)
| Option.none => (ctor Option.none [Nat])
| Option.some parsed => (if (100 <? parsed) then (ctor Option.none [Nat]) else (ctor Option.some [Nat] parsed))),
axioms: [Quot.sound, propext]
}
definition{
name: parseCooldown,
parameters: [value : Bytes],
result: (Option Nat),
body: (match (parseNumber value)
| Option.none => (ctor Option.none [Nat])
| Option.some parsed => (if (1100 <? parsed) then (ctor Option.none [Nat]) else (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: 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 (parseCooldown (sliceOf s start (prim subtract e start : Nat)))
| Option.none => (ctor Option.none [Request])
| Option.some v3 => (if (e =? (Foundation.Bytes::byteLength s)) then (ctor Option.some [Request] (record Request {angle := v1, distance := v2, cooldown := 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 (parseDistance (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 (parseAngle (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: (22 <? (project request distance))
}
definition{
name: rule2,
parameters: [request : Request],
result: Bool,
body: (62 <? (project request angle))
}
definition{
name: rule3,
parameters: [request : Request],
result: Bool,
body: (1 <=? (project request cooldown))
}
definition{
name: judge,
parameters: [request : Request],
result: Nat,
body: (if (rule1 request) then (answerDistant) else (if (rule2 request) then (answerDistant) else (if (rule3 request) then (answerDormant) else (answerAttuned))))
}
definition{
name: encodeAnswer,
parameters: [code : Nat],
result: Bytes,
body: (if (code =? (answerAttuned)) then 0x617474756e6564 else (if (code =? (answerDormant)) then 0x646f726d616e74 else (if (code =? (answerDistant)) then 0x64697374616e74 else 0x696e76616c6964)))
}
definition{
name: dispatch,
parameters: [value : Bytes],
result: Bytes,
body: (if (88 <? (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 := "Plant attunement", cargoName := "prism-garden-attunement", cargoVersion := "0.1.0", cargoDescription := "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune ", cargoRepository := "https://github.com/UOR-Foundation/PrismPM", cargoHomepage := "https://github.com/UOR-Foundation/PrismPM", libraryRoots := (cons "PrismGardenAttunement.GardenAttunement.dispatch" (nil String)), acceptanceVectors := (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x313020382030, response := 0x617474756e6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x36322032322030, response := 0x617474756e6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x31383020352030, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302032332030, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x333020342031313030, response := 0x646f726d616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x333020342031, response := 0x646f726d616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020302030, response := 0x617474756e6564}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020302031, response := 0x646f726d616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302032332031, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x363320302030, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x363320302031, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x36332032332030, response := 0x64697374616e74}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x36332032332031, response := 0x64697374616e74}) (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 := 0x302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30203020302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30202030202030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x303720302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x2d3120302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x2b3120302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3130303030303030303030303030303030303020302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0xd9a120302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7820302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x31383120302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302030372030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30202d312030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30202b312030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020313030303030303030303030303030303030302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020d9a12030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020782030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30203130312030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302030203037, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302030202d31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x302030202b31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020302031303030303030303030303030303030303030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x30203020d9a1, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020302078, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x3020302031313031, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (nil Foundation.View.Text.V1.Model::AcceptanceVector))))))))))))))))))))))))))))))))))))))))))), entryRoot := "PrismGardenAttunement.GardenAttunement.dispatch", coreContract := "hologram:guest/core-wasm@1", requestMaximum := (88 : UInt32), responseMaximum := (64 : UInt32), guestAllocationMaximum := (176 : UInt32), capabilitiesEmpty := true, fatArchive := true, primaryLayer := (0 : UInt8), viewLayer := (1 : UInt8), view := (record Foundation.View.Text.V1.Model::TextView {title := "Plant attunement", heading := "Plant attunement", inputLabel := "Request: angle distance cooldown", submitLabel := "Decide", outputLabel := "Answer", inputError := "Invalid request", responseError := "Invalid response"})})
}
\end{semanticmodule}
\end{lexlean}
app/src/GardenAttunementProofs.lex.tex 87 lines
\begin{lexlean}{GardenAttunementProofs}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\importmodule{GardenAttunement}
\title{Text application model}
\begin{semanticmodule}
definition{
name: breaksInv001,
parameters: [request : GardenAttunement::Request],
result: Bool,
body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (22 <? (project request distance))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))
}
theorem{
name: inv001Holds,
parameters: [request : GardenAttunement::Request],
statement: ((breaksInv001 request) = false),
proof: linear_arithmetic{
definitions: [
GardenAttunement::answerAttuned,
GardenAttunement::answerDistant,
GardenAttunement::answerDormant,
GardenAttunement::judge,
GardenAttunement::rule1,
GardenAttunement::rule2,
GardenAttunement::rule3,
breaksInv001
]
},
axioms: [Quot.sound, propext]
}
definition{
name: breaksInv002,
parameters: [request : GardenAttunement::Request],
result: Bool,
body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (62 <? (project request angle))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))
}
theorem{
name: inv002Holds,
parameters: [request : GardenAttunement::Request],
statement: ((breaksInv002 request) = false),
proof: linear_arithmetic{
definitions: [
GardenAttunement::answerAttuned,
GardenAttunement::answerDistant,
GardenAttunement::answerDormant,
GardenAttunement::judge,
GardenAttunement::rule1,
GardenAttunement::rule2,
GardenAttunement::rule3,
breaksInv002
]
},
axioms: [Quot.sound, propext]
}
definition{
name: breaksInv003,
parameters: [request : GardenAttunement::Request],
result: Bool,
body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (1 <=? (project request cooldown))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))
}
theorem{
name: inv003Holds,
parameters: [request : GardenAttunement::Request],
statement: ((breaksInv003 request) = false),
proof: linear_arithmetic{
definitions: [
GardenAttunement::answerAttuned,
GardenAttunement::answerDistant,
GardenAttunement::answerDormant,
GardenAttunement::judge,
GardenAttunement::rule1,
GardenAttunement::rule2,
GardenAttunement::rule3,
breaksInv003
]
},
axioms: [Quot.sound, propext]
}
\end{semanticmodule}
\end{lexlean}
app/lexlean.toml 43 lines
spec = "lexlean/project/1"
name = "prism-garden-attunement"
language = "1.2"
module_prefix = "PrismGardenAttunement"
source_roots = ["src"]
entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/GardenAttunement.lex.tex", "src/GardenAttunementProofs.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 269 lines
{
"schema": "prism/prompt/1",
"goal": "Decide if a player's gesture in Verdant Resonance reaches the plant they face. The garden then answers the same walk the same way.",
"pattern": "decisionTable",
"repository": "afflom/verdant-resonance",
"app": {
"name": "garden-attunement",
"title": "Plant attunement",
"purpose": "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.",
"fields": [
{
"name": "angle",
"kind": "number",
"min": 0,
"means": "degrees between the player's gaze and the plant",
"max": 180
},
{
"name": "distance",
"kind": "number",
"min": 0,
"means": "how far the plant is, in metres",
"max": 100
},
{
"name": "cooldown",
"kind": "number",
"min": 0,
"means": "milliseconds of the attune refractory period left",
"max": 1100
}
],
"outcomes": [
"attuned",
"dormant",
"distant"
],
"meanings": {
"attuned": "the plant attunes and sings",
"dormant": "the gesture is ignored during its refractory pause, the plant rests",
"distant": "the plant is outside the forward gaze cone and is not activated"
},
"rules": [
{
"when": [
{
"field": "distance",
"op": ">",
"value": 22
}
],
"then": "distant",
"why": "prism/src/Foundation/Humane/V1/Model.lex.tex evaluateGazeTargetInForwardCone: distMeters <= 22, maxInteractiveRangeMeters 22"
},
{
"when": [
{
"field": "angle",
"op": ">",
"value": 62
}
],
"then": "distant",
"why": "Humane Model.lex.tex: forwardFovHalfAngleDeg 62; GardenCanvas.tsx never activates elements behind the player"
},
{
"when": [
{
"field": "cooldown",
"op": ">=",
"value": 1
}
],
"then": "dormant",
"why": "Humane Model.lex.tex GestureHoldAndCooldownPolicy attuneRefractoryMs 1100: GardenCanvas.tsx ignores attune while it cools down"
}
],
"otherwise": "attuned",
"otherwiseWhy": "in the forward gaze cone and rested: the focal plant attunes",
"properties": [
{
"kind": "never",
"when": [
{
"field": "distance",
"op": ">",
"value": 22
}
],
"then": "attuned",
"why": "no plant answers a player out of reach"
},
{
"kind": "never",
"when": [
{
"field": "angle",
"op": ">",
"value": 62
}
],
"then": "attuned",
"why": "behindPlayerActivationsCount is 0: nothing behind the player activates"
},
{
"kind": "never",
"when": [
{
"field": "cooldown",
"op": ">=",
"value": 1
}
],
"then": "attuned",
"why": "mindful pacing: a repeated gesture never attunes during its refractory pause"
}
],
"examples": [
{
"request": "10 8 0",
"response": "attuned"
},
{
"request": "62 22 0",
"response": "attuned"
},
{
"request": "180 5 0",
"response": "distant"
},
{
"request": "0 23 0",
"response": "distant"
},
{
"request": "30 4 1100",
"response": "dormant"
},
{
"request": "30 4 1",
"response": "dormant"
}
]
},
"stakeholders": [
{
"name": "Player",
"text": "Wanders the garden and needs each plant to answer the same way to the same walk.",
"concerns": [
"Correct answers"
]
},
{
"name": "Sound designer",
"text": "Places plants and tunes the humane pacing and needs plants outside the gaze cone, or a rushed gesture, to stay silent.",
"concerns": [
"Proved guarantees",
"Calm interaction"
]
}
],
"concerns": [
{
"name": "Calm interaction",
"text": "Gestures follow the Humane design standard: focal gaze-cone selection and refractory pauses, with no activation behind the player.",
"model": "quality"
}
],
"components": [
{
"name": "Garden client",
"text": "The browser game, src/components/GardenCanvas.tsx, which finds the focal plant and sends the gesture.",
"kind": "staticSite"
},
{
"name": "Soundscape engine",
"text": "src/game/soundscapeEngine.ts, the Web Audio voices an attuned plant plays.",
"kind": "service"
}
],
"threats": [
{
"name": "Key-repeat flood",
"text": "Operating-system key repeat fires attune many times a second, so plants chatter.",
"stride": "denialOfService",
"asset": "request",
"likelihood": "medium",
"impact": "minor",
"control": {
"name": "Refractory pause",
"text": "Attune is ignored for 1100 ms after a gesture, proved for every request, and OS key repeat is suppressed.",
"evidence": [
{
"kind": "proof",
"reference": "GardenAttunementProofs::inv003Holds"
},
{
"kind": "review",
"reference": "prism/src/Foundation/Humane/V1/Model.lex.tex GestureHoldAndCooldownPolicy"
}
]
}
},
{
"name": "Activation behind the player",
"text": "A plant behind the player attunes, breaking the focal gaze law.",
"stride": "elevationOfPrivilege",
"asset": "answer",
"likelihood": "low",
"impact": "minor",
"control": {
"name": "Gaze cone proved",
"text": "Beyond 62 degrees nothing attunes, proved for every request.",
"evidence": [
{
"kind": "proof",
"reference": "GardenAttunementProofs::inv002Holds"
},
{
"kind": "review",
"reference": "src/game/prismModel.test.ts focalGazeSelection"
}
]
}
},
{
"name": "Client range drift",
"text": "The client finds focal plants up to 32 m away while the model allows 22 m, so the page and the model disagree.",
"stride": "tampering",
"asset": "source",
"likelihood": "medium",
"impact": "minor",
"accepted": "The app follows the LexLean model, 22 m; src/game/prismModel.ts findNearestPlant uses 32 m, a drift for the repository to reconcile."
}
],
"quality": [
{
"characteristic": "Safety",
"subcharacteristic": "Operational constraint",
"requirement": "No activation behind the player",
"text": "An attune gesture never activates a plant outside the forward gaze cone.",
"measure": "Behind-player activations",
"measureText": "Requests with an angle over 62 degrees answered attuned, behindPlayerActivationsCount in the model.",
"threshold": 0
}
],
"journeys": [
{
"stakeholder": "Player",
"steps": [
"REQ-001",
"REQ-002",
"REQ-003",
"otherwise"
]
},
{
"stakeholder": "Sound designer",
"steps": [
"INV-001",
"INV-002",
"INV-003"
]
}
],
"license": "MIT OR Apache-2.0",
"axioms": {}
}
model/ids.toml 59 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 = "GA-01"
level = "build"
suite = "garden_attunement"
statement = "The app never answers attuned when distance is above 22"
[[id]]
id = "GA-02"
level = "build"
suite = "garden_attunement"
statement = "The app never answers attuned when angle is above 62"
[[id]]
id = "GA-03"
level = "build"
suite = "garden_attunement"
statement = "The app never answers attuned when cooldown is at least 1"
[[id]]
id = "GA-04"
level = "build"
suite = "garden_attunement"
statement = "The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references"
[[id]]
id = "GA-05"
level = "build"
suite = "garden_attunement"
statement = "The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared"
[[id]]
id = "GA-06"
level = "build"
suite = "garden_attunement"
statement = "Every compliance obligation is numbered in order and names its evidence"
features/suites/garden_attunement.feature 38 lines
Feature: garden_attunement
This repository's Prism application, in app/, generated by prism-code from its
spec: Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.
@GA-01 @build
Scenario: The app never answers attuned when distance is above 22
Given the model in app/src/GardenAttunement.lex.tex
When the Lean kernel checks inv001Holds during prismpm verify
Then no request meets breaksInv001
@GA-02 @build
Scenario: The app never answers attuned when angle is above 62
Given the model in app/src/GardenAttunement.lex.tex
When the Lean kernel checks inv002Holds during prismpm verify
Then no request meets breaksInv002
@GA-03 @build
Scenario: The app never answers attuned when cooldown is at least 1
Given the model in app/src/GardenAttunement.lex.tex
When the Lean kernel checks inv003Holds during prismpm verify
Then no request meets breaksInv003
@GA-04 @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
@GA-05 @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
@GA-06 @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/garden_attunement.rs 122 lines
//! The `garden_attunement` suite: one test per scenario in `features/suites/garden_attunement.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/GardenAttunementProofs.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"
);
}
/// `GA-01`: The app never answers attuned when distance is above 22
#[test]
fn garden_attunement_ga_01() {
pinned(
"breaksInv001",
"body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (22 <? (project request distance))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))",
"inv001Holds",
);
}
/// `GA-02`: The app never answers attuned when angle is above 62
#[test]
fn garden_attunement_ga_02() {
pinned(
"breaksInv002",
"body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (62 <? (project request angle))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))",
"inv002Holds",
);
}
/// `GA-03`: The app never answers attuned when cooldown is at least 1
#[test]
fn garden_attunement_ga_03() {
pinned(
"breaksInv003",
"body: ((((((project request angle) <=? 180) && ((project request distance) <=? 100)) && ((project request cooldown) <=? 1100)) && (1 <=? (project request cooldown))) && ((GardenAttunement::judge request) =? (GardenAttunement::answerAttuned)))",
"inv003Holds",
);
}
/// `GA-04`: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
#[test]
fn garden_attunement_ga_04() {
holds(
"app/src/Architecture.lex.tex",
"architectureDescriptionHolds",
"((architectureValid) = true)",
);
}
/// `GA-05`: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
#[test]
fn garden_attunement_ga_05() {
holds(
"app/src/Quality.lex.tex",
"qualityModelHolds",
"((qualityValid) = true)",
);
}
/// `GA-06`: Every compliance obligation is numbered in order and names its evidence
#[test]
fn garden_attunement_ga_06() {
holds(
"app/src/Compliance.lex.tex",
"everyObligationEvidenced",
"((obligationsEvidenced 0 (obligations)) = true)",
);
}
site/app.json 102 lines
{
"name": "Plant attunement",
"shortName": "Plant",
"live": "https://afflom.github.io/verdant-resonance/",
"purpose": "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left. Send angle, distance or cooldown, separated by spaces; it answers attuned, dormant or distant, and invalid request for anything else.",
"inputLabel": "Request: angle distance cooldown",
"placeholder": "10 8 0",
"submitLabel": "Decide",
"outputLabel": "Answer",
"answers": {
"positive": [
"attuned"
],
"negative": [
"dormant",
"distant"
],
"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": "GA-01: the app never answers attuned when distance is above 22. GA-02: the app never answers attuned when angle is above 62. GA-03: the app never answers attuned when cooldown is at least 1.",
"proposition": {
"name": "judge",
"text": "judge request :=\n distance is above 22 → distant\n angle is above 62 → distant\n cooldown is at least 1 → dormant\n otherwise → attuned",
"plain": "Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left."
},
"theorems": [
{
"name": "inv001Holds",
"statement": "no request meets breaksInv001: the app never answers attuned when distance is above 22",
"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/GardenAttunementProofs.lex.tex"
},
{
"name": "inv002Holds",
"statement": "no request meets breaksInv002: the app never answers attuned when angle is above 62",
"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/GardenAttunementProofs.lex.tex"
},
{
"name": "inv003Holds",
"statement": "no request meets breaksInv003: the app never answers attuned when cooldown 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/GardenAttunementProofs.lex.tex"
}
],
"pinned": [
{
"name": "garden_attunement_ga_01",
"what": "GA-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/garden_attunement.rs"
},
{
"name": "garden_attunement_ga_02",
"what": "GA-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/garden_attunement.rs"
},
{
"name": "garden_attunement_ga_03",
"what": "GA-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/garden_attunement.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/afflom/verdant-resonance/actions/workflows/bootstrap.yml"
},
"build": {
"id": "printed by prismpm verify in every pages run",
"url": "https://github.com/afflom/verdant-resonance/actions/workflows/pages.yml"
}
},
"repository": "https://github.com/afflom/verdant-resonance",
"report": "https://github.com/afflom/verdant-resonance/blob/main/TEMPLATE-VERIFICATION.md"
}
openspec/specs/garden-attunement/spec.md 147 lines
# garden-attunement Specification
<!-- Generated by Prism from prism/spec.json. Change the app through your agent with /prism, not by editing this file. -->
## Purpose
Plant attunement: Decide whether an attune gesture attunes the focal plant, is ignored while the gesture rests, or misses a plant outside the forward gaze cone, from the angle to the plant, its distance and the attune cooldown left.
## Requirements
### Requirement: Never attuned when distance is above 22
The app SHALL NOT answer `attuned` when distance is above 22, because no plant answers a player out of reach.
Verified: to be proved by Lean for every request (INV-001, theorem `inv001Holds`).
#### Scenario: INV-001 holds
- **WHEN** the request is `0 23 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `attuned`
- **AND** the app answers `distant`, decided by REQ-001
### Requirement: Never attuned when angle is above 62
The app SHALL NOT answer `attuned` when angle is above 62, because behindPlayerActivationsCount is 0: nothing behind the player activates.
Verified: to be proved by Lean for every request (INV-002, theorem `inv002Holds`).
#### Scenario: INV-002 holds
- **WHEN** the request is `180 5 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `attuned`
- **AND** the app answers `distant`, decided by REQ-002
### Requirement: Never attuned when cooldown is at least 1
The app SHALL NOT answer `attuned` when cooldown is at least 1, because mindful pacing: a repeated gesture never attunes during its refractory pause.
Verified: to be proved by Lean for every request (INV-003, theorem `inv003Holds`).
#### Scenario: INV-003 holds
- **WHEN** the request is `30 4 1100` (an acceptance example)
- **THEN** the answer SHALL NOT be `attuned`
- **AND** the app answers `dormant`, decided by REQ-003
### Requirement: REQ-001 distant when distance is above 22
The app SHALL answer `distant` when distance is above 22, because prism/src/Foundation/Humane/V1/Model.lex.tex evaluateGazeTargetInForwardCone: distMeters <= 22, maxInteractiveRangeMeters 22.
Verified: tested by the acceptance vectors (`rule1`).
#### Scenario: REQ-001 decides
- **WHEN** the request is `0 23 0` (an acceptance example)
- **THEN** the answer SHALL be `distant`, decided by REQ-001
### Requirement: REQ-002 distant when angle is above 62
The app SHALL answer `distant` when angle is above 62 and no earlier rule matches, because Humane Model.lex.tex: forwardFovHalfAngleDeg 62; GardenCanvas.tsx never activates elements behind the player.
Verified: tested by the acceptance vectors (`rule2`).
#### Scenario: REQ-002 decides
- **WHEN** the request is `180 5 0` (an acceptance example)
- **THEN** the answer SHALL be `distant`, decided by REQ-002
### Requirement: REQ-003 dormant when cooldown is at least 1
The app SHALL answer `dormant` when cooldown is at least 1 and no earlier rule matches, because Humane Model.lex.tex GestureHoldAndCooldownPolicy attuneRefractoryMs 1100: GardenCanvas.tsx ignores attune while it cools down.
Verified: tested by the acceptance vectors (`rule3`).
#### Scenario: REQ-003 decides
- **WHEN** the request is `30 4 1100` (an acceptance example)
- **THEN** the answer SHALL be `dormant`, decided by REQ-003
### Requirement: Otherwise attuned
The app SHALL answer `attuned` when no rule matches, because in the forward gaze cone and rested: the focal plant attunes.
Verified: tested by the acceptance vectors.
#### Scenario: No rule matches
- **WHEN** the request is `10 8 0` (an acceptance example)
- **THEN** the answer SHALL be `attuned`
### Requirement: The first matching rule decides
The app SHALL try REQ-001, REQ-002, REQ-003 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 `0 23 1`
- **THEN** the answer SHALL be `distant`, decided by REQ-001, the earlier rule
### Requirement: Request and answers
The app SHALL read one request as one line of 3 fields separated by single spaces, in this order, and SHALL answer exactly one of `attuned`, `dormant`, `distant`, or `invalid` for anything else.
| Field | Accepts | Means |
| --- | --- | --- |
| `angle` | whole number from 0 up to 180 | degrees between the player's gaze and the plant |
| `distance` | whole number from 0 up to 100 | how far the plant is, in metres |
| `cooldown` | whole number from 0 up to 1100 | milliseconds of the attune refractory period left |
| Answer | Means |
| --- | --- |
| `attuned` | the plant attunes and sings |
| `dormant` | the gesture is ignored during its refractory pause, the plant rests |
| `distant` | the plant is outside the forward gaze cone and is not activated |
| `invalid` | the request is malformed |
Verified: reading a request is tested, not proved.
#### Scenario: A malformed request is invalid
- **WHEN** the request is not 3 fields in this order
- **THEN** the answer SHALL be `invalid`
## Examples
- `10 8 0` gives `attuned`
- `62 22 0` gives `attuned`
- `180 5 0` gives `distant`
- `0 23 0` gives `distant`
- `30 4 1100` gives `dormant`
- `30 4 1` gives `dormant`
## 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/GardenAttunement.lex.tex` is the LexLean model generated from it. It is the single source of the app.
Words on this page 6
- 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.
- 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.
- decision table
- A table of rules, as in OMG DMN 1.5: each row says which inputs lead to which outcome.