PrismDevRelOpen the app
Examples: Axiom policy

Overview

Example apps

Decision tables

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

Policy decisions

Open policyNamespace authorizationAxiom policyGNAF claim wordingEmporous admissionPortal publication

State machines

MCP task lifecycleContainer lifecycleAtlas walk controlsVault escrow lifecycleRelease lifecycleOrganization lifecycle

// example · Policy decisions

Axiom policy

Decide if a declaration uses only the axioms its source allows. Then lexlean verify publishes nothing that rests on more.

Inspired by UOR-Foundation/LexLean. The LexLean compiler and verifier, which holds every declaration to its exact kernel-observed axiom set.

Pattern: Policy decision, OASIS XACML 3.0 policy decision point. To write one of your own, follow How to build a policy decision app.

What the Axiom policy app does1. Request: audit, row, policy, outside, unseen 2. 6 rules: the first that applies decides 3. Answer: permit, deny, not-applicable, indeterminate 4. Proved: 6 theorems, 55 tests01Requestaudit, row,policy, outside,unseen026 rulesthe first thatapplies decides03Answerpermit, deny,not-applicable,indeterminate04Proved6 theorems, 55testsWhat the Axiom policy app does1. Request: audit, row, policy, outside, unseen 2. 6 rules: the first that applies decides 3. Answer: permit, deny, not-applicable, indeterminate 4. Proved: 6 theorems, 55 tests01Requestaudit, row, policy, outside,unseen026 rulesthe first that applies decides03Answerpermit, deny, not-applicable,indeterminate04Proved6 theorems, 55 tests
What the Axiom policy app does. A request goes in, the rules decide, and the Lean kernel has already proved what the rules promise.
The data in this figure
StepWhat happens
1. Requestaudit, row, policy, outside, unseen
2. 6 rulesthe first that applies decides
3. Answerpermit, deny, not-applicable, indeterminate
4. Proved6 theorems, 55 tests
Fingerprint
b675c1b6267a588e693a3c5506eb3d67875c7b089ae6b7c8708f232be046a0a6
Acceptance vectors
55
Claims
9

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 449 lines
{
  "schema": "prism/prompt/1",
  "pattern": "policyDecision",
  "goal": "Decide if a declaration uses only the axioms its source allows. Then lexlean verify publishes nothing that rests on more.",
  "repository": "UOR-Foundation/LexLean",
  "app": {
    "name": "lexlean-axiom-policy",
    "title": "Axiom policy",
    "purpose": "Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list.",
    "limits": [
      "It does not run the audit: the observed set is read from the Lean axiom audit members of stage 9 and 10.",
      "It does not judge a model declaration's generated family, whose union LexLean compares with the model's declared set separately."
    ],
    "fields": [
      {
        "name": "audit",
        "kind": "choice",
        "values": [
          "listed",
          "unlisted",
          "failed",
          "unparsed"
        ],
        "means": "the audit of the declaration: listed in the output, absent from it, its member exited nonzero, or its output refused by the parser"
      },
      {
        "name": "row",
        "kind": "choice",
        "values": [
          "source",
          "core"
        ],
        "means": "a source declaration of a document, or a row of the document's core calculus"
      },
      {
        "name": "policy",
        "kind": "choice",
        "values": [
          "none",
          "allow",
          "exact"
        ],
        "means": "the declared AxiomPolicy: noaxioms, allowaxioms or exactaxioms"
      },
      {
        "name": "outside",
        "kind": "number",
        "min": 0,
        "max": 64,
        "means": "observed axioms not in the declared list (for noaxioms, every observed axiom)"
      },
      {
        "name": "unseen",
        "kind": "number",
        "min": 0,
        "max": 64,
        "means": "declared axioms the audit did not observe"
      }
    ],
    "outcomes": [
      "permit",
      "deny",
      "not-applicable",
      "indeterminate"
    ],
    "meanings": {
      "permit": "XACML 3.0 Permit: the observed set satisfies the policy and the declaration row records result ok",
      "deny": "XACML 3.0 Deny: the observed set violates the policy and verify fails with LLV7005",
      "not-applicable": "XACML 3.0 NotApplicable: no observation applies, so the policy is not enforced on this row",
      "indeterminate": "XACML 3.0 Indeterminate: the audit could not be evaluated, so verify fails before any policy is judged"
    },
    "rules": [
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "failed"
          }
        ],
        "then": "indeterminate",
        "why": "crates/lexlean/src/verify/mod.rs: an audit member that exits nonzero fails with LLV7004"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unparsed"
          }
        ],
        "then": "indeterminate",
        "why": "verify/mod.rs: output that axiom::parse_audit_output refuses fails with LLV7004, missing or malformed audit output"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          },
          {
            "field": "row",
            "op": "is",
            "value": "core"
          }
        ],
        "then": "not-applicable",
        "why": "verify/mod.rs stage 11: a core declaration absent from the observed map is skipped (continue)"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          }
        ],
        "then": "indeterminate",
        "why": "verify/mod.rs: the audit family must observe every declaration, or verify fails as an internal error"
      },
      {
        "when": [
          {
            "field": "outside",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "deny",
        "why": "ir/declaration.rs AxiomPolicy::permits: none needs an empty set, allow a subset, exact an equal one"
      },
      {
        "when": [
          {
            "field": "policy",
            "op": "is",
            "value": "exact"
          },
          {
            "field": "unseen",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "deny",
        "why": "AxiomPolicy::permits Exact: the sorted, deduplicated observed set must equal the declared list"
      }
    ],
    "otherwise": "permit",
    "otherwiseWhy": "AxiomPolicy::permits: every observed axiom is declared, and an exact policy saw every declared one",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "outside",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "permit",
        "why": "an axiom the source did not declare is never published"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "policy",
            "op": "is",
            "value": "exact"
          },
          {
            "field": "unseen",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "permit",
        "why": "an exact policy is equality, not a subset (SPEC section 15.9)"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "failed"
          }
        ],
        "then": "permit",
        "why": "a failed audit proves nothing about the declaration"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unparsed"
          }
        ],
        "then": "permit",
        "why": "output the parser refuses proves nothing about the declaration"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          },
          {
            "field": "row",
            "op": "is",
            "value": "source"
          }
        ],
        "then": "permit",
        "why": "a source declaration the audit missed is never taken as axiom free"
      },
      {
        "kind": "always",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "listed"
          },
          {
            "field": "outside",
            "op": "=",
            "value": 0
          },
          {
            "field": "unseen",
            "op": "=",
            "value": 0
          }
        ],
        "then": "permit",
        "why": "an observed set equal to the declared list satisfies all three policies"
      }
    ],
    "examples": [
      {
        "request": "listed source exact 0 0",
        "response": "permit"
      },
      {
        "request": "listed source exact 0 1",
        "response": "deny"
      },
      {
        "request": "listed source allow 0 2",
        "response": "permit"
      },
      {
        "request": "listed source none 1 0",
        "response": "deny"
      },
      {
        "request": "listed core allow 1 0",
        "response": "deny"
      },
      {
        "request": "unlisted core exact 0 0",
        "response": "not-applicable"
      },
      {
        "request": "unlisted source exact 0 0",
        "response": "indeterminate"
      },
      {
        "request": "failed source none 0 0",
        "response": "indeterminate"
      },
      {
        "request": "unparsed core exact 0 0",
        "response": "indeterminate"
      },
      {
        "request": "listed source exact 65 0",
        "response": "invalid"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "Model author",
      "text": "Pins each declaration's axioms with noaxioms, allowaxioms or exactaxioms and needs verify to hold the kernel to exactly that.",
      "concerns": [
        "Correct answers",
        "Proved guarantees"
      ]
    },
    {
      "name": "Release reviewer",
      "text": "Reads the declaration rows of a verify before a release and needs no row to say ok unless its audit was read and satisfied.",
      "concerns": [
        "No unaudited permit",
        "Integrity of the published app"
      ]
    }
  ],
  "concerns": [
    {
      "name": "No unaudited permit",
      "text": "A declaration whose audit failed, was refused or missed it is never permitted.",
      "model": "security"
    }
  ],
  "components": [
    {
      "name": "Lean axiom audit",
      "text": "The audit modules lexlean verify runs under the pinned Lean, whose output lists the axioms each declaration depends on.",
      "kind": "cliAdapter"
    },
    {
      "name": "lexlean verify",
      "text": "The LexLean verifier whose stage 11 enforces each declaration's policy and writes the declaration rows.",
      "kind": "cliAdapter"
    }
  ],
  "threats": [
    {
      "name": "Classical axiom slipped in",
      "text": "A declaration pinned noaxioms or an exact set starts depending on Classical.choice through a lemma it uses, and is still reported ok.",
      "stride": "elevationOfPrivilege",
      "asset": "source",
      "likelihood": "medium",
      "impact": "critical",
      "control": {
        "name": "Observed set outside the policy is denied",
        "text": "Any observed axiom outside the declared list is a deny, proved for every request.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv001Holds"
          },
          {
            "kind": "review",
            "reference": "LexLean crates/lexlean/src/ir/declaration.rs AxiomPolicy::permits"
          }
        ]
      }
    },
    {
      "name": "Silent audit taken as clean",
      "text": "An audit member crashes or prints nothing for a declaration, and an empty observed set is read as no axioms.",
      "stride": "repudiation",
      "asset": "answer",
      "likelihood": "low",
      "impact": "major",
      "control": {
        "name": "No permit without an audit",
        "text": "A failed, refused or missing audit of a source declaration is indeterminate, never permit.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv003Holds"
          },
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv005Holds"
          },
          {
            "kind": "gate",
            "reference": "LexLean crates/conformance/src/cases/verification.rs"
          }
        ]
      }
    },
    {
      "name": "Core row left unenforced",
      "text": "A core-calculus row absent from the audit is skipped, so a policy on it is never enforced.",
      "stride": "tampering",
      "asset": "source",
      "likelihood": "low",
      "impact": "minor",
      "accepted": "verify/mod.rs skips a core row the audit does not name by design: only the declarations the audit family observes carry an observed set, and the not-applicable answer says so."
    }
  ],
  "quality": [
    {
      "characteristic": "Security",
      "subcharacteristic": "Integrity",
      "requirement": "Only satisfied policies are permitted",
      "text": "No request with an undeclared observed axiom, or an exact policy missing one, is permitted.",
      "measure": "Violating permits",
      "measureText": "Acceptance vectors permitted while outside or, under exact, unseen is at least 1.",
      "threshold": 0
    },
    {
      "characteristic": "Functional suitability",
      "subcharacteristic": "Functional correctness",
      "requirement": "Every decision matches verify",
      "text": "Each vector answers the decision stage 11 of lexlean verify reaches.",
      "measure": "Vectors that disagree",
      "measureText": "Acceptance vectors whose replayed answer differs from the expected decision.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "Model author",
      "steps": [
        "otherwise",
        "REQ-005",
        "REQ-006",
        "INV-002"
      ]
    },
    {
      "stakeholder": "Release reviewer",
      "steps": [
        "REQ-001",
        "REQ-004",
        "REQ-003",
        "INV-005",
        "refuse"
      ]
    }
  ],
  "axioms": {
    "inv002Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv003Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv004Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv005Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ]
  },
  "license": "MIT OR Apache-2.0"
}

What the app claims

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

What the app claims 9 items
  • LA-01 The app never answers permit when outside is at least 1
  • LA-02 The app never answers permit when policy is exact and unseen is at least 1
  • LA-03 The app never answers permit when audit is failed
  • LA-04 The app never answers permit when audit is unparsed
  • LA-05 The app never answers permit when audit is unlisted and row is source
  • LA-06 The app always answers permit when audit is listed and outside equals 0 and unseen equals 0
  • LA-07 The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
  • LA-08 The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
  • LA-09 Every compliance obligation is numbered in order and names its evidence

Pattern

Policy decision: OASIS XACML 3.0 policy decision point. The answer is one XACML 3.0 decision: permit, deny, not-applicable, indeterminate. A policy that applies gives permit or deny. If none applies, the answer is not-applicable. If the request cannot be judged, it is indeterminate.

PatternStandardAnswers
Policy decisionOASIS XACML 3.0 policy decision pointpermit, deny, not-applicable, indeterminate
Rules for each answerpermit: 0 rules; deny: 2 rules; not-applicable: 1 rules; indeterminate: 3 rulespermit0 + defaultdeny2not-applicable1indeterminate3
Rules for each answer. Each bar counts the rules that give one answer. When no rule matches, the answer is permit.
The data in this figure
rules
permit0
deny2
not-applicable1
indeterminate3

Behavior

A request is audit, row, policy, outside, unseen, separated by spaces. The first rule that matches decides. If none matches, the answer is permit. A request over 136 bytes, or in any other form, is answered invalid.

RuleWhenAnswerWhy
REQ-001audit is failedindeterminatecrates/lexlean/src/verify/mod.rs: an audit member that exits nonzero fails with LLV7004
REQ-002audit is unparsedindeterminateverify/mod.rs: output that axiom::parse_audit_output refuses fails with LLV7004, missing or malformed audit output
REQ-003audit is unlisted and row is corenot-applicableverify/mod.rs stage 11: a core declaration absent from the observed map is skipped (continue)
REQ-004audit is unlistedindeterminateverify/mod.rs: the audit family must observe every declaration, or verify fails as an internal error
REQ-005outside is at least 1denyir/declaration.rs AxiomPolicy::permits: none needs an empty set, allow a subset, exact an equal one
REQ-006policy is exact and unseen is at least 1denyAxiomPolicy::permits Exact: the sorted, deduplicated observed set must equal the declared list
otherwiseno rule matchespermitAxiomPolicy::permits: every observed axiom is declared, and an exact policy saw every declared one

Properties Lean proves

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

Properties Lean proves 6 rows
PropertyStatementTheoremWhy
INV-001It never answers permit when outside is at least 1.LexleanAxiomPolicyProofs::inv001Holdsan axiom the source did not declare is never published
INV-002It never answers permit when policy is exact and unseen is at least 1.LexleanAxiomPolicyProofs::inv002Holdsan exact policy is equality, not a subset (SPEC section 15.9)
INV-003It never answers permit when audit is failed.LexleanAxiomPolicyProofs::inv003Holdsa failed audit proves nothing about the declaration
INV-004It never answers permit when audit is unparsed.LexleanAxiomPolicyProofs::inv004Holdsoutput the parser refuses proves nothing about the declaration
INV-005It never answers permit when audit is unlisted and row is source.LexleanAxiomPolicyProofs::inv005Holdsa source declaration the audit missed is never taken as axiom free
INV-006It always answers permit when audit is listed and outside equals 0 and unseen equals 0.LexleanAxiomPolicyProofs::inv006Holdsan observed set equal to the declared list satisfies all three policies

Architecture

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

StakeholderWho they areConcerns
Model authorPins each declaration's axioms with noaxioms, allowaxioms or exactaxioms and needs verify to hold the kernel to exactly that.Correct answers, Proved guarantees
Release reviewerReads the declaration rows of a verify before a release and needs no row to say ok unless its audit was read and satisfied.No unaudited permit, Integrity of the published app
VerifierAnyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer.Integrity of the published app, Refused malformed requests, Proved guarantees

Concerns

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

ConcernWhat it meansModel
Correct answersEvery well-formed request is answered by the first rule that matches it, or permit when none does, as the spec states.quality
Integrity of the published appWhat a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it.security
No unaudited permitA declaration whose audit failed, was refused or missed it is never permitted.security
Proved guaranteesEach of the 6 properties of the spec holds for every request, proved by the Lean kernel.quality
Refused malformed requestsA request that is not the 5 fields in order, or is longer than 136 bytes, is answered invalid and never guessed.security

Components

8 components and 11 edges between them.

ComponentKindWhat it is
Axiom policy guestserviceThe Core-Wasm guest built from the model: it answers one request of at most 136 bytes with one answer of at most 64.
Axiom policy pagestaticSiteThe page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors.
BrowserexternalSystemThe visitor's web browser, which loads the page and runs the Axiom policy guest.
GitHub PagesexternalSystemServes the page and the holo from the repository Pages workflow.
Lean axiom auditcliAdapterThe audit modules lexlean verify runs under the pinned Lean, whose output lists the axioms each declaration depends on.
lexlean verifycliAdapterThe LexLean verifier whose stage 11 enforces each declaration's policy and writes the declaration rows.
Prism buildcliAdapterprismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector.
Source repositoryexternalSystemThe repository that holds the prompt, the model and its gate.

Design views

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

ViewDiagramViewpoint
Deciding a Axiom policy requestopmObjectProcessModel author: Correct answers
Components of Axiom policyumlComponentRelease reviewer: Integrity of the published app
Answering a Axiom policy requestumlSequenceModel author: Correct answers
States of the Axiom policy guestumlStateMachineVerifier: Refused malformed requests

Features and journeys

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

Features and journeys 14 rows
FeatureCallsAccepted by
When audit is failed, the answer is indeterminate.LexleanAxiomPolicy::rule1, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When audit is unparsed, the answer is indeterminate.LexleanAxiomPolicy::rule2, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When audit is unlisted and row is core, the answer is not-applicable.LexleanAxiomPolicy::rule3, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When audit is unlisted, the answer is indeterminate.LexleanAxiomPolicy::rule4, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When outside is at least 1, the answer is deny.LexleanAxiomPolicy::rule5, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When policy is exact and unseen is at least 1, the answer is deny.LexleanAxiomPolicy::rule6, LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
When no rule matches, the answer is permit.LexleanAxiomPolicy::judgeLexleanAxiomPolicy::application
A request that is not audit, row, policy, outside, unseen in order, separated by single spaces, or is over 136 bytes, is answered invalid.LexleanAxiomPolicy::dispatch, LexleanAxiomPolicy::decodeField1LexleanAxiomPolicy::application
It never answers permit when outside is at least 1.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv001Holds
It never answers permit when policy is exact and unseen is at least 1.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv002Holds
It never answers permit when audit is failed.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv003Holds
It never answers permit when audit is unparsed.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv004Holds
It never answers permit when audit is unlisted and row is source.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv005Holds
It always answers permit when audit is listed and outside equals 0 and unseen equals 0.LexleanAxiomPolicy::judgeLexleanAxiomPolicyProofs::inv006Holds

Journeys

The ordered features each stakeholder takes.

StakeholderSteps
Model authorotherwise → REQ-005 → REQ-006 → INV-002
Release reviewerREQ-001 → REQ-004 → REQ-003 → INV-005 → refuse
Verifierrefuse → INV-001 → INV-002 → INV-003 → INV-004 → INV-005 → INV-006

Security and threat model

15 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 15 rows
ThreatSTRIDEAssetRiskAnswered by
Answer that breaks INV-001repudiationAnswermedium likelihood, critical impactProof of INV-001: proof LexleanAxiomPolicyProofs::inv001Holds
Answer that breaks INV-002repudiationAnswermedium likelihood, critical impactProof of INV-002: proof LexleanAxiomPolicyProofs::inv002Holds
Answer that breaks INV-003repudiationAnswermedium likelihood, critical impactProof of INV-003: proof LexleanAxiomPolicyProofs::inv003Holds
Answer that breaks INV-004repudiationAnswermedium likelihood, critical impactProof of INV-004: proof LexleanAxiomPolicyProofs::inv004Holds
Answer that breaks INV-005repudiationAnswermedium likelihood, critical impactProof of INV-005: proof LexleanAxiomPolicyProofs::inv005Holds
Answer that breaks INV-006repudiationAnswermedium likelihood, critical impactProof of INV-006: proof LexleanAxiomPolicyProofs::inv006Holds
Classical axiom slipped inelevationOfPrivilegeModel sourcemedium likelihood, critical impactObserved set outside the policy is denied: proof LexleanAxiomPolicyProofs::inv001Holds; review LexLean crates/lexlean/src/ir/declaration.rs AxiomPolicy::permits
Core row left unenforcedtamperingModel sourcelow likelihood, minor impactaccepted: verify/mod.rs skips a core row the audit does not name by design: only the declarations the audit family observes carry an observed set, and the not-applicable answer says so.
Granted capabilityinformationDisclosureAnswerlow likelihood, major impactNo capability granted: gate prism-code check refuses an ungranted guest import
Malformed requesttamperingRequest byteshigh likelihood, major impactStrict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify
Oversized requestdenialOfServiceRequest bytesmedium likelihood, minor impactBounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify
Silent audit taken as cleanrepudiationAnswerlow likelihood, major impactNo permit without an audit: proof LexleanAxiomPolicyProofs::inv003Holds; proof LexleanAxiomPolicyProofs::inv005Holds; gate LexLean crates/conformance/src/cases/verification.rs
Substituted holospoofingPublished hololow likelihood, critical impactFingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page
Substituted hostspoofingPublished hololow likelihood, critical impactaccepted: A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt.
Tampered modeltamperingModel sourcelow likelihood, major impactRegenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json

Quality

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

Quality 8 rows
RequirementCharacteristicMeasureThreshold
Bounded allocation: The guest allocates at most 272 bytes for one request.Performance efficiency: Resource utilizationGuest allocation bytes272
Bounded request: A request over 136 bytes is refused before any field is read.Performance efficiency: Time behaviourRequest bytes read136
Every decision matches verify: Each vector answers the decision stage 11 of lexlean verify reaches.Functional suitability: Functional correctnessVectors that disagree0
Every property proved: All 6 properties are theorems the Lean kernel checks.Security: IntegrityUnproved properties0
Every request answered: Every request gets an answer: a rule, permit otherwise, or invalid.Functional suitability: Functional completenessUnanswered requests0
Every vector replays: All 55 acceptance vectors replay in the compiled guest, the shortest 0 bytes long.Reliability: FaultlessnessFailed vectors0
Examples answered as stated: Every one of the 10 examples of the spec is answered as it states.Functional suitability: Functional correctnessExample mismatches0
Only satisfied policies are permitted: No request with an undeclared observed axiom, or an exact policy missing one, is permitted.Security: IntegrityViolating permits0

Compliance

One obligation per standard, each naming its evidence.

StandardSubjectEvidence
ISO/IEC/IEEE 42010:2022Architecture descriptionArchitecture::architectureDescriptionHolds
ISO/PAS 19450:2015 and OMG UML 2.5.1Design viewsDesign::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates
ISO/IEC 25010:2023Product qualityQuality::qualityModelHolds
ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022Application security and riskSecurity::controlSet
OASIS XACML 3.0 policy decision pointPolicy decisionLexleanAxiomPolicy::judge, LexleanAxiomPolicy::encodeAnswer
OpenSpecRequirementsLexleanAxiomPolicy::application
SPDX MIT OR Apache-2.0LicensingLexleanAxiomPolicy::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 Axiom policy request
Viewpoint: Architecture::viewpointModelAuthorCorrectAnswers
Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile

componentAxiomPolicyGuest is an object.
componentAxiomPolicyGuest can be stateDeciding or stateIdle.
componentBrowser is an object.
processDecide is a process.
processEncodeAnswer is a process.
processJudge is a process.
processParseRequest is a process.
componentAxiomPolicyGuest 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::viewpointReleaseReviewerIntegrityOfThePublishedApp
title Components of Axiom policy
component "componentAxiomPolicyGuest" as c0
component "componentAxiomPolicyPage" as c1
component "componentBrowser" as c2
component "componentGitHubPages" as c3
component "componentLeanAxiomAudit" as c4
component "componentLexleanVerify" as c5
component "componentPrismBuild" as c6
component "componentSourceRepository" as c7
c0 --> c2 : edgeAxiomPolicyGuestToBrowser
c0 --> c4 : edgeAxiomPolicyGuestToLeanAxiomAudit
c0 --> c5 : edgeAxiomPolicyGuestToLexleanVerify
c1 --> c3 : edgeAxiomPolicyPageToGitHubPages
c2 --> c0 : edgeBrowserToAxiomPolicyGuest
c3 --> c2 : edgeGitHubPagesToBrowser
c4 --> c0 : edgeLeanAxiomAuditToAxiomPolicyGuest
c5 --> c0 : edgeLexleanVerifyToAxiomPolicyGuest
c6 --> c0 : edgePrismBuildToAxiomPolicyGuest
c6 --> c1 : edgePrismBuildToAxiomPolicyPage
c7 --> c6 : edgeSourceRepositoryToPrismBuild
@enduml
design/Design.viewUmlRequest.puml
@startuml
' UML 2.5.1 sequence diagram
' view: Design::viewUmlRequest
' viewpoint: Architecture::viewpointModelAuthorCorrectAnswers
title Answering a Axiom policy request
participant "componentBrowser" as p0
participant "componentAxiomPolicyGuest" 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 Axiom policy guest
state "stateAnsweredDeny" as s0
state "stateAnsweredIndeterminate" as s1
state "stateAnsweredNotApplicable" as s2
state "stateAnsweredPermit" as s3
state "stateDeciding" as s4
state "stateIdle" as s5
state "stateRefused" as s6
[*] --> s5
s5 --> s4 : processParseRequest
s5 --> s6 : processParseRequest
s4 --> s1 : processRule1
s4 --> s1 : processRule2
s4 --> s2 : processRule3
s4 --> s1 : processRule4
s4 --> s0 : processRule5
s4 --> s0 : processRule6
s4 --> s3 : processOtherwise
s3 --> s5 : processEncodeAnswer
s0 --> s5 : processEncodeAnswer
s2 --> s5 : processEncodeAnswer
s1 --> s5 : processEncodeAnswer
s6 --> s5 : 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 413 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: stakeholderModelAuthor,
  parameters: [],
  result: Foundation.Arch::Stakeholder,
  body: (record Foundation.Arch::Stakeholder {index := 0, name := "Model author", text := "Pins each declaration's axioms with noaxioms, allowaxioms or exactaxioms and needs verify to hold the kernel to exactly that."})
}

definition{
  name: stakeholderReleaseReviewer,
  parameters: [],
  result: Foundation.Arch::Stakeholder,
  body: (record Foundation.Arch::Stakeholder {index := 1, name := "Release reviewer", text := "Reads the declaration rows of a verify before a release and needs no row to say ok unless its audit was read and satisfied."})
}

definition{
  name: stakeholderVerifier,
  parameters: [],
  result: Foundation.Arch::Stakeholder,
  body: (record Foundation.Arch::Stakeholder {index := 2, name := "Verifier", text := "Anyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer."})
}

definition{
  name: concernCorrectAnswers,
  parameters: [],
  result: Foundation.Arch::Concern,
  body: (record Foundation.Arch::Concern {index := 0, name := "Correct answers", text := "Every well-formed request is answered by the first rule that matches it, or permit when none does, as the spec states."})
}

definition{
  name: concernIntegrityOfThePublishedApp,
  parameters: [],
  result: Foundation.Arch::Concern,
  body: (record Foundation.Arch::Concern {index := 1, name := "Integrity of the published app", text := "What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it."})
}

definition{
  name: concernNoUnauditedPermit,
  parameters: [],
  result: Foundation.Arch::Concern,
  body: (record Foundation.Arch::Concern {index := 2, name := "No unaudited permit", text := "A declaration whose audit failed, was refused or missed it is never permitted."})
}

definition{
  name: concernProvedGuarantees,
  parameters: [],
  result: Foundation.Arch::Concern,
  body: (record Foundation.Arch::Concern {index := 3, name := "Proved guarantees", text := "Each of the 6 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 5 fields in order, or is longer than 136 bytes, is answered invalid and never guessed."})
}

definition{
  name: componentAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 0, kind := (ctor Foundation.Arch::ComponentKind.service), name := "Axiom policy guest", text := "The Core-Wasm guest built from the model: it answers one request of at most 136 bytes with one answer of at most 64."})
}

definition{
  name: componentAxiomPolicyPage,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 1, kind := (ctor Foundation.Arch::ComponentKind.staticSite), name := "Axiom policy page", text := "The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors."})
}

definition{
  name: componentBrowser,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 2, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "Browser", text := "The visitor's web browser, which loads the page and runs the Axiom policy guest."})
}

definition{
  name: componentGitHubPages,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 3, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "GitHub Pages", text := "Serves the page and the holo from the repository Pages workflow."})
}

definition{
  name: componentLeanAxiomAudit,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 4, kind := (ctor Foundation.Arch::ComponentKind.cliAdapter), name := "Lean axiom audit", text := "The audit modules lexlean verify runs under the pinned Lean, whose output lists the axioms each declaration depends on."})
}

definition{
  name: componentLexleanVerify,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 5, kind := (ctor Foundation.Arch::ComponentKind.cliAdapter), name := "lexlean verify", text := "The LexLean verifier whose stage 11 enforces each declaration's policy and writes the declaration rows."})
}

definition{
  name: componentPrismBuild,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 6, kind := (ctor Foundation.Arch::ComponentKind.cliAdapter), name := "Prism build", text := "prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector."})
}

definition{
  name: componentSourceRepository,
  parameters: [],
  result: Foundation.Arch::Component,
  body: (record Foundation.Arch::Component {index := 7, kind := (ctor Foundation.Arch::ComponentKind.externalSystem), name := "Source repository", text := "The repository that holds the prompt, the model and its gate."})
}

definition{
  name: edgeAxiomPolicyGuestToBrowser,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 0, fromIndex := 0, toIndex := 2, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeAxiomPolicyGuestToLeanAxiomAudit,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 1, fromIndex := 0, toIndex := 4, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeAxiomPolicyGuestToLexleanVerify,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 2, fromIndex := 0, toIndex := 5, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeAxiomPolicyPageToGitHubPages,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 3, fromIndex := 1, toIndex := 3, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeBrowserToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 4, fromIndex := 2, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeGitHubPagesToBrowser,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 5, fromIndex := 3, toIndex := 2, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeLeanAxiomAuditToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 6, fromIndex := 4, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeLexleanVerifyToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 7, fromIndex := 5, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgePrismBuildToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 8, fromIndex := 6, toIndex := 0, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgePrismBuildToAxiomPolicyPage,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 9, fromIndex := 6, toIndex := 1, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: edgeSourceRepositoryToPrismBuild,
  parameters: [],
  result: Foundation.Arch::Edge,
  body: (record Foundation.Arch::Edge {index := 10, fromIndex := 7, toIndex := 6, kind := (ctor Foundation.Arch::EdgeKind.dataFlow)})
}

definition{
  name: viewpointModelAuthorCorrectAnswers,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 0, stakeholderIndex := 0, concernIndex := 0, modelKindIndex := 1})
}

definition{
  name: viewpointModelAuthorProvedGuarantees,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 1, stakeholderIndex := 0, concernIndex := 3, modelKindIndex := 1})
}

definition{
  name: viewpointReleaseReviewerIntegrityOfThePublishedApp,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 2, stakeholderIndex := 1, concernIndex := 1, modelKindIndex := 2})
}

definition{
  name: viewpointReleaseReviewerNoUnauditedPermit,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 3, stakeholderIndex := 1, concernIndex := 2, modelKindIndex := 2})
}

definition{
  name: viewpointVerifierIntegrityOfThePublishedApp,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 4, stakeholderIndex := 2, concernIndex := 1, modelKindIndex := 2})
}

definition{
  name: viewpointVerifierProvedGuarantees,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 5, stakeholderIndex := 2, concernIndex := 3, modelKindIndex := 1})
}

definition{
  name: viewpointVerifierRefusedMalformedRequests,
  parameters: [],
  result: Foundation.Arch::Viewpoint,
  body: (record Foundation.Arch::Viewpoint {index := 6, stakeholderIndex := 2, concernIndex := 4, modelKindIndex := 2})
}

definition{
  name: viewModelAuthorCorrectAnswers,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 0, viewpointIndex := 0, modelKindIndex := 1})
}

definition{
  name: viewModelAuthorProvedGuarantees,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 1, viewpointIndex := 1, modelKindIndex := 1})
}

definition{
  name: viewReleaseReviewerIntegrityOfThePublishedApp,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 2, viewpointIndex := 2, modelKindIndex := 2})
}

definition{
  name: viewReleaseReviewerNoUnauditedPermit,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 3, viewpointIndex := 3, modelKindIndex := 2})
}

definition{
  name: viewVerifierIntegrityOfThePublishedApp,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 4, viewpointIndex := 4, modelKindIndex := 2})
}

definition{
  name: viewVerifierProvedGuarantees,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 5, viewpointIndex := 5, modelKindIndex := 1})
}

definition{
  name: viewVerifierRefusedMalformedRequests,
  parameters: [],
  result: Foundation.Arch::View,
  body: (record Foundation.Arch::View {index := 6, viewpointIndex := 6, modelKindIndex := 2})
}

definition{
  name: componentRecords,
  parameters: [],
  result: (List Foundation.Arch::Component),
  body: (cons (componentAxiomPolicyGuest) (cons (componentAxiomPolicyPage) (cons (componentBrowser) (cons (componentGitHubPages) (cons (componentLeanAxiomAudit) (cons (componentLexleanVerify) (cons (componentPrismBuild) (cons (componentSourceRepository) (nil Foundation.Arch::Component)))))))))
}

definition{
  name: edgeRecords,
  parameters: [],
  result: (List Foundation.Arch::Edge),
  body: (cons (edgeAxiomPolicyGuestToBrowser) (cons (edgeAxiomPolicyGuestToLeanAxiomAudit) (cons (edgeAxiomPolicyGuestToLexleanVerify) (cons (edgeAxiomPolicyPageToGitHubPages) (cons (edgeBrowserToAxiomPolicyGuest) (cons (edgeGitHubPagesToBrowser) (cons (edgeLeanAxiomAuditToAxiomPolicyGuest) (cons (edgeLexleanVerifyToAxiomPolicyGuest) (cons (edgePrismBuildToAxiomPolicyGuest) (cons (edgePrismBuildToAxiomPolicyPage) (cons (edgeSourceRepositoryToPrismBuild) (nil Foundation.Arch::Edge))))))))))))
}

definition{
  name: viewpointRecords,
  parameters: [],
  result: (List Foundation.Arch::Viewpoint),
  body: (cons (viewpointModelAuthorCorrectAnswers) (cons (viewpointModelAuthorProvedGuarantees) (cons (viewpointReleaseReviewerIntegrityOfThePublishedApp) (cons (viewpointReleaseReviewerNoUnauditedPermit) (cons (viewpointVerifierIntegrityOfThePublishedApp) (cons (viewpointVerifierProvedGuarantees) (cons (viewpointVerifierRefusedMalformedRequests) (nil Foundation.Arch::Viewpoint))))))))
}

definition{
  name: viewRecords,
  parameters: [],
  result: (List Foundation.Arch::View),
  body: (cons (viewModelAuthorCorrectAnswers) (cons (viewModelAuthorProvedGuarantees) (cons (viewReleaseReviewerIntegrityOfThePublishedApp) (cons (viewReleaseReviewerNoUnauditedPermit) (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{LexleanAxiomPolicy}
\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 := "OASIS XACML 3.0 policy decision point", subject := "Policy decision", text := "Every well-formed request is answered with exactly one decision: permit, deny, not-applicable, indeterminate; a malformed one is invalid, never a decision.", evidence := (cons "LexleanAxiomPolicy::judge" (cons "LexleanAxiomPolicy::encodeAnswer" (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 "LexleanAxiomPolicy::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 "LexleanAxiomPolicy::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 598 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::componentAxiomPolicyGuest"})
}

definition{
  name: processParseRequest,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processJudge,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processEncodeAnswer,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

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::componentAxiomPolicyGuest"})
}

definition{
  name: processRule2,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processRule3,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processRule4,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processRule5,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processRule6,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: processOtherwise,
  parameters: [],
  result: Foundation.Arch::SystemProcess,
  body: (record Foundation.Arch::SystemProcess {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateIdle,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateDeciding,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateRefused,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateAnsweredPermit,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateAnsweredDeny,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateAnsweredNotApplicable,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: stateAnsweredIndeterminate,
  parameters: [],
  result: Foundation.Arch::SystemState,
  body: (record Foundation.Arch::SystemState {owner := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: viewOpmDecide,
  parameters: [],
  result: Foundation.Arch::DesignView,
  body: (record Foundation.Arch::DesignView {title := "Deciding a Axiom policy request", viewpoint := "Architecture::viewpointModelAuthorCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.opmObjectProcess)})
}

definition{
  name: viewUmlComponents,
  parameters: [],
  result: Foundation.Arch::DesignView,
  body: (record Foundation.Arch::DesignView {title := "Components of Axiom policy", viewpoint := "Architecture::viewpointReleaseReviewerIntegrityOfThePublishedApp", diagram := (ctor Foundation.Arch::DesignDiagram.umlComponent)})
}

definition{
  name: viewUmlRequest,
  parameters: [],
  result: Foundation.Arch::DesignView,
  body: (record Foundation.Arch::DesignView {title := "Answering a Axiom policy request", viewpoint := "Architecture::viewpointModelAuthorCorrectAnswers", diagram := (ctor Foundation.Arch::DesignDiagram.umlSequence)})
}

definition{
  name: viewUmlStates,
  parameters: [],
  result: Foundation.Arch::DesignView,
  body: (record Foundation.Arch::DesignView {title := "States of the Axiom policy 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::componentAxiomPolicyGuest"})
}

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::componentAxiomPolicyGuest", state := "Design::stateIdle"})
}

definition{
  name: opmGuestDeciding,
  parameters: [],
  result: Foundation.Arch::OpmState,
  body: (record Foundation.Arch::OpmState {view := "Design::viewOpmDecide", thing := "Architecture::componentAxiomPolicyGuest", 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::componentAxiomPolicyGuest", 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: umlAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentAxiomPolicyGuest"})
}

definition{
  name: umlAxiomPolicyPage,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentAxiomPolicyPage"})
}

definition{
  name: umlBrowser,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentBrowser"})
}

definition{
  name: umlGitHubPages,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentGitHubPages"})
}

definition{
  name: umlLeanAxiomAudit,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentLeanAxiomAudit"})
}

definition{
  name: umlLexleanVerify,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentLexleanVerify"})
}

definition{
  name: umlPrismBuild,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentPrismBuild"})
}

definition{
  name: umlSourceRepository,
  parameters: [],
  result: Foundation.Arch::UmlComponent,
  body: (record Foundation.Arch::UmlComponent {view := "Design::viewUmlComponents", component := "Architecture::componentSourceRepository"})
}

definition{
  name: umlAxiomPolicyGuestToBrowser,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeAxiomPolicyGuestToBrowser"})
}

definition{
  name: umlAxiomPolicyGuestToLeanAxiomAudit,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeAxiomPolicyGuestToLeanAxiomAudit"})
}

definition{
  name: umlAxiomPolicyGuestToLexleanVerify,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeAxiomPolicyGuestToLexleanVerify"})
}

definition{
  name: umlAxiomPolicyPageToGitHubPages,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeAxiomPolicyPageToGitHubPages"})
}

definition{
  name: umlBrowserToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeBrowserToAxiomPolicyGuest"})
}

definition{
  name: umlGitHubPagesToBrowser,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeGitHubPagesToBrowser"})
}

definition{
  name: umlLeanAxiomAuditToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeLeanAxiomAuditToAxiomPolicyGuest"})
}

definition{
  name: umlLexleanVerifyToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgeLexleanVerifyToAxiomPolicyGuest"})
}

definition{
  name: umlPrismBuildToAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToAxiomPolicyGuest"})
}

definition{
  name: umlPrismBuildToAxiomPolicyPage,
  parameters: [],
  result: Foundation.Arch::UmlConnector,
  body: (record Foundation.Arch::UmlConnector {view := "Design::viewUmlComponents", edge := "Architecture::edgePrismBuildToAxiomPolicyPage"})
}

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: seqAxiomPolicyGuest,
  parameters: [],
  result: Foundation.Arch::UmlLifeline,
  body: (record Foundation.Arch::UmlLifeline {view := "Design::viewUmlRequest", component := "Architecture::componentAxiomPolicyGuest", 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::componentAxiomPolicyGuest", 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::componentAxiomPolicyGuest", 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: stAnsweredPermit,
  parameters: [],
  result: Foundation.Arch::UmlState,
  body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredPermit", initial := false})
}

definition{
  name: stAnsweredDeny,
  parameters: [],
  result: Foundation.Arch::UmlState,
  body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredDeny", initial := false})
}

definition{
  name: stAnsweredNotApplicable,
  parameters: [],
  result: Foundation.Arch::UmlState,
  body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredNotApplicable", initial := false})
}

definition{
  name: stAnsweredIndeterminate,
  parameters: [],
  result: Foundation.Arch::UmlState,
  body: (record Foundation.Arch::UmlState {view := "Design::viewUmlStates", state := "Design::stateAnsweredIndeterminate", 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::stateAnsweredIndeterminate", 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::stateAnsweredIndeterminate", 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::stateAnsweredNotApplicable", trigger := "Design::processRule3"})
}

definition{
  name: trRule4,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 5, source := "Design::stateDeciding", target := "Design::stateAnsweredIndeterminate", trigger := "Design::processRule4"})
}

definition{
  name: trRule5,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 6, source := "Design::stateDeciding", target := "Design::stateAnsweredDeny", trigger := "Design::processRule5"})
}

definition{
  name: trRule6,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 7, source := "Design::stateDeciding", target := "Design::stateAnsweredDeny", trigger := "Design::processRule6"})
}

definition{
  name: trOtherwise,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 8, source := "Design::stateDeciding", target := "Design::stateAnsweredPermit", trigger := "Design::processOtherwise"})
}

definition{
  name: trResetPermit,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 9, source := "Design::stateAnsweredPermit", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}

definition{
  name: trResetDeny,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 10, source := "Design::stateAnsweredDeny", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}

definition{
  name: trResetNotApplicable,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 11, source := "Design::stateAnsweredNotApplicable", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}

definition{
  name: trResetIndeterminate,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 12, source := "Design::stateAnsweredIndeterminate", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}

definition{
  name: trResetRefused,
  parameters: [],
  result: Foundation.Arch::UmlTransition,
  body: (record Foundation.Arch::UmlTransition {view := "Design::viewUmlStates", order := 13, source := "Design::stateRefused", target := "Design::stateIdle", trigger := "Design::processEncodeAnswer"})
}
\end{semanticmodule}
\end{lexlean}
app/src/Features.lex.tex 172 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{LexleanAxiomPolicy}
\importmodule{Architecture}
\importmodule{Foundation.Arch}
\title{feature}
\begin{semanticmodule}
definition{
  name: acceptINV001,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv001Holds"
}

definition{
  name: acceptINV002,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv002Holds"
}

definition{
  name: acceptINV003,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv003Holds"
}

definition{
  name: acceptINV004,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv004Holds"
}

definition{
  name: acceptINV005,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv005Holds"
}

definition{
  name: acceptINV006,
  parameters: [],
  result: String,
  body: "LexleanAxiomPolicyProofs::inv006Holds"
}

definition{
  name: featureRule1,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When audit is failed, the answer is indeterminate.", calls := (cons "LexleanAxiomPolicy::rule1" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRule2,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When audit is unparsed, the answer is indeterminate.", calls := (cons "LexleanAxiomPolicy::rule2" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRule3,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When audit is unlisted and row is core, the answer is not-applicable.", calls := (cons "LexleanAxiomPolicy::rule3" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRule4,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When audit is unlisted, the answer is indeterminate.", calls := (cons "LexleanAxiomPolicy::rule4" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRule5,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When outside is at least 1, the answer is deny.", calls := (cons "LexleanAxiomPolicy::rule5" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRule6,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When policy is exact and unseen is at least 1, the answer is deny.", calls := (cons "LexleanAxiomPolicy::rule6" (cons "LexleanAxiomPolicy::judge" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureOtherwise,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "When no rule matches, the answer is permit.", calls := (cons "LexleanAxiomPolicy::judge" (nil String)), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureRefuseMalformed,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "A request that is not audit, row, policy, outside, unseen in order, separated by single spaces, or is over 136 bytes, is answered invalid.", calls := (cons "LexleanAxiomPolicy::dispatch" (cons "LexleanAxiomPolicy::decodeField1" (nil String))), acceptance := (cons "LexleanAxiomPolicy::application" (nil String))})
}

definition{
  name: featureINV001,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "It never answers permit when outside is at least 1.", calls := (cons "LexleanAxiomPolicy::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 permit when policy is exact and unseen is at least 1.", calls := (cons "LexleanAxiomPolicy::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 permit when audit is failed.", calls := (cons "LexleanAxiomPolicy::judge" (nil String)), acceptance := (cons "Features::acceptINV003" (nil String))})
}

definition{
  name: featureINV004,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "It never answers permit when audit is unparsed.", calls := (cons "LexleanAxiomPolicy::judge" (nil String)), acceptance := (cons "Features::acceptINV004" (nil String))})
}

definition{
  name: featureINV005,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "It never answers permit when audit is unlisted and row is source.", calls := (cons "LexleanAxiomPolicy::judge" (nil String)), acceptance := (cons "Features::acceptINV005" (nil String))})
}

definition{
  name: featureINV006,
  parameters: [],
  result: Foundation.Arch::Feature,
  body: (record Foundation.Arch::Feature {statement := "It always answers permit when audit is listed and outside equals 0 and unseen equals 0.", calls := (cons "LexleanAxiomPolicy::judge" (nil String)), acceptance := (cons "Features::acceptINV006" (nil String))})
}

definition{
  name: journeyModelAuthor,
  parameters: [],
  result: Foundation.Arch::Journey,
  body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderModelAuthor", steps := (cons "Features::featureOtherwise" (cons "Features::featureRule5" (cons "Features::featureRule6" (cons "Features::featureINV002" (nil String)))))})
}

definition{
  name: journeyReleaseReviewer,
  parameters: [],
  result: Foundation.Arch::Journey,
  body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderReleaseReviewer", steps := (cons "Features::featureRule1" (cons "Features::featureRule4" (cons "Features::featureRule3" (cons "Features::featureINV005" (cons "Features::featureRefuseMalformed" (nil String))))))})
}

definition{
  name: journeyVerifier,
  parameters: [],
  result: Foundation.Arch::Journey,
  body: (record Foundation.Arch::Journey {actor := "Architecture::stakeholderVerifier", steps := (cons "Features::featureRefuseMalformed" (cons "Features::featureINV001" (cons "Features::featureINV002" (cons "Features::featureINV003" (cons "Features::featureINV004" (cons "Features::featureINV005" (cons "Features::featureINV006" (nil String))))))))})
}
\end{semanticmodule}
\end{lexlean}
app/src/Quality.lex.tex 368 lines
\begin{lexlean}{Quality}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\useglossary{prism.qual@1.0.0}
\importmodule{Foundation.Qual}
\title{quality measure}
\begin{semanticmodule}
structure{
  name: Named,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: name, type: String}, {name: text, type: String}]
}

definition{
  name: characteristicFunctionalSuitability,
  parameters: [],
  result: Foundation.Qual::ProductQualityCharacteristic,
  body: (record Foundation.Qual::ProductQualityCharacteristic {index := 0})
}

definition{
  name: characteristicPerformanceEfficiency,
  parameters: [],
  result: Foundation.Qual::ProductQualityCharacteristic,
  body: (record Foundation.Qual::ProductQualityCharacteristic {index := 1})
}

definition{
  name: characteristicReliability,
  parameters: [],
  result: Foundation.Qual::ProductQualityCharacteristic,
  body: (record Foundation.Qual::ProductQualityCharacteristic {index := 2})
}

definition{
  name: characteristicSecurity,
  parameters: [],
  result: Foundation.Qual::ProductQualityCharacteristic,
  body: (record Foundation.Qual::ProductQualityCharacteristic {index := 3})
}

definition{
  name: subcharacteristicFaultlessness,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 0, characteristicIndex := 2})
}

definition{
  name: subcharacteristicFunctionalCompleteness,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 1, characteristicIndex := 0})
}

definition{
  name: subcharacteristicFunctionalCorrectness,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 2, characteristicIndex := 0})
}

definition{
  name: subcharacteristicIntegrity,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 3, characteristicIndex := 3})
}

definition{
  name: subcharacteristicResourceUtilization,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 4, characteristicIndex := 1})
}

definition{
  name: subcharacteristicTimeBehaviour,
  parameters: [],
  result: Foundation.Qual::QualitySubcharacteristic,
  body: (record Foundation.Qual::QualitySubcharacteristic {index := 5, characteristicIndex := 1})
}

definition{
  name: requirementBoundedAllocation,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 0, subcharacteristicIndex := 4})
}

definition{
  name: requirementBoundedRequest,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 1, subcharacteristicIndex := 5})
}

definition{
  name: requirementEveryDecisionMatchesVerify,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 2, subcharacteristicIndex := 2})
}

definition{
  name: requirementEveryPropertyProved,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 3, subcharacteristicIndex := 3})
}

definition{
  name: requirementEveryRequestAnswered,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 4, subcharacteristicIndex := 1})
}

definition{
  name: requirementEveryVectorReplays,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 5, subcharacteristicIndex := 0})
}

definition{
  name: requirementExamplesAnsweredAsStated,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 6, subcharacteristicIndex := 2})
}

definition{
  name: requirementOnlySatisfiedPoliciesArePermitted,
  parameters: [],
  result: Foundation.Qual::QualityRequirement,
  body: (record Foundation.Qual::QualityRequirement {index := 7, subcharacteristicIndex := 3})
}

definition{
  name: measureExampleMismatches,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 0, requirementIndex := 6, threshold := 0})
}

definition{
  name: measureFailedVectors,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 1, requirementIndex := 5, threshold := 0})
}

definition{
  name: measureGuestAllocationBytes,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 2, requirementIndex := 0, threshold := 272})
}

definition{
  name: measureRequestBytesRead,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 3, requirementIndex := 1, threshold := 136})
}

definition{
  name: measureUnansweredRequests,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 4, requirementIndex := 4, threshold := 0})
}

definition{
  name: measureUnprovedProperties,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 5, requirementIndex := 3, threshold := 0})
}

definition{
  name: measureVectorsThatDisagree,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 6, requirementIndex := 2, threshold := 0})
}

definition{
  name: measureViolatingPermits,
  parameters: [],
  result: Foundation.Qual::QualityMeasure,
  body: (record Foundation.Qual::QualityMeasure {index := 7, requirementIndex := 7, 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 Axiom policy."}) (cons (record Named {index := 1, name := "Performance efficiency", text := "Performance efficiency, as ISO/IEC 25010:2023 defines it, for Axiom policy."}) (cons (record Named {index := 2, name := "Reliability", text := "Reliability, as ISO/IEC 25010:2023 defines it, for Axiom policy."}) (cons (record Named {index := 3, name := "Security", text := "Security, as ISO/IEC 25010:2023 defines it, for Axiom policy."}) (nil Named)))))
}

definition{
  name: subcharacteristicNames,
  parameters: [],
  result: (List Named),
  body: (cons (record Named {index := 0, name := "Faultlessness", text := "Reliability: Faultlessness."}) (cons (record Named {index := 1, name := "Functional completeness", text := "Functional suitability: Functional completeness."}) (cons (record Named {index := 2, name := "Functional correctness", text := "Functional suitability: Functional correctness."}) (cons (record Named {index := 3, name := "Integrity", text := "Security: Integrity."}) (cons (record Named {index := 4, name := "Resource utilization", text := "Performance efficiency: Resource utilization."}) (cons (record Named {index := 5, name := "Time behaviour", text := "Performance efficiency: Time behaviour."}) (nil Named)))))))
}

definition{
  name: requirementNames,
  parameters: [],
  result: (List Named),
  body: (cons (record Named {index := 0, name := "Bounded allocation", text := "The guest allocates at most 272 bytes for one request."}) (cons (record Named {index := 1, name := "Bounded request", text := "A request over 136 bytes is refused before any field is read."}) (cons (record Named {index := 2, name := "Every decision matches verify", text := "Each vector answers the decision stage 11 of lexlean verify reaches."}) (cons (record Named {index := 3, name := "Every property proved", text := "All 6 properties are theorems the Lean kernel checks."}) (cons (record Named {index := 4, name := "Every request answered", text := "Every request gets an answer: a rule, permit otherwise, or invalid."}) (cons (record Named {index := 5, name := "Every vector replays", text := "All 55 acceptance vectors replay in the compiled guest, the shortest 0 bytes long."}) (cons (record Named {index := 6, name := "Examples answered as stated", text := "Every one of the 10 examples of the spec is answered as it states."}) (cons (record Named {index := 7, name := "Only satisfied policies are permitted", text := "No request with an undeclared observed axiom, or an exact policy missing one, is permitted."}) (nil Named)))))))))
}

definition{
  name: measureNames,
  parameters: [],
  result: (List Named),
  body: (cons (record Named {index := 0, name := "Example mismatches", text := "Examples the guest answers otherwise than they state."}) (cons (record Named {index := 1, name := "Failed vectors", text := "Acceptance vectors whose replay differs from the model."}) (cons (record Named {index := 2, name := "Guest allocation bytes", text := "Most bytes the guest allocates for one request."}) (cons (record Named {index := 3, name := "Request bytes read", text := "Longest request the guest decodes, in bytes."}) (cons (record Named {index := 4, name := "Unanswered requests", text := "Acceptance vectors the guest does not answer."}) (cons (record Named {index := 5, name := "Unproved properties", text := "Properties of the spec without a checked theorem."}) (cons (record Named {index := 6, name := "Vectors that disagree", text := "Acceptance vectors whose replayed answer differs from the expected decision."}) (cons (record Named {index := 7, name := "Violating permits", text := "Acceptance vectors permitted while outside or, under exact, unseen is at least 1."}) (nil Named)))))))))
}

definition{
  name: subcharacteristicRecords,
  parameters: [],
  result: (List Foundation.Qual::QualitySubcharacteristic),
  body: (cons (subcharacteristicFaultlessness) (cons (subcharacteristicFunctionalCompleteness) (cons (subcharacteristicFunctionalCorrectness) (cons (subcharacteristicIntegrity) (cons (subcharacteristicResourceUtilization) (cons (subcharacteristicTimeBehaviour) (nil Foundation.Qual::QualitySubcharacteristic)))))))
}

definition{
  name: requirementRecords,
  parameters: [],
  result: (List Foundation.Qual::QualityRequirement),
  body: (cons (requirementBoundedAllocation) (cons (requirementBoundedRequest) (cons (requirementEveryDecisionMatchesVerify) (cons (requirementEveryPropertyProved) (cons (requirementEveryRequestAnswered) (cons (requirementEveryVectorReplays) (cons (requirementExamplesAnsweredAsStated) (cons (requirementOnlySatisfiedPoliciesArePermitted) (nil Foundation.Qual::QualityRequirement)))))))))
}

definition{
  name: measureRecords,
  parameters: [],
  result: (List Foundation.Qual::QualityMeasure),
  body: (cons (measureExampleMismatches) (cons (measureFailedVectors) (cons (measureGuestAllocationBytes) (cons (measureRequestBytesRead) (cons (measureUnansweredRequests) (cons (measureUnprovedProperties) (cons (measureVectorsThatDisagree) (cons (measureViolatingPermits) (nil Foundation.Qual::QualityMeasure)))))))))
}

definition{
  name: namesNumbered,
  parameters: [position : Nat, names : (List Named)],
  result: Bool,
  body: (match names
    | List.nil => true
    | List.cons item rest => (((project item index) =? position) && (namesNumbered (position + 1) rest))),
  recursive_argument: names
}

definition{
  name: parentsKnown,
  parameters: [count : Nat, records : (List Foundation.Qual::QualitySubcharacteristic)],
  result: Bool,
  body: (match records
    | List.nil => true
    | List.cons item rest => (((project item characteristicIndex) <? count) && (parentsKnown count rest))),
  recursive_argument: records
}

definition{
  name: requirementsKnown,
  parameters: [count : Nat, records : (List Foundation.Qual::QualityRequirement)],
  result: Bool,
  body: (match records
    | List.nil => true
    | List.cons item rest => (((project item subcharacteristicIndex) <? count) && (requirementsKnown count rest))),
  recursive_argument: records
}

definition{
  name: measuresKnown,
  parameters: [count : Nat, records : (List Foundation.Qual::QualityMeasure)],
  result: Bool,
  body: (match records
    | List.nil => true
    | List.cons item rest => (((project item requirementIndex) <? count) && (measuresKnown count rest))),
  recursive_argument: records
}

definition{
  name: thresholdOf,
  parameters: [wanted : Nat, records : (List Foundation.Qual::QualityMeasure)],
  result: Nat,
  body: (match records
    | List.nil => 0
    | List.cons head rest => (if ((project head index) =? wanted) then (project head threshold) else (thresholdOf wanted rest))),
  recursive_argument: records
}

definition{
  name: qualityValid,
  parameters: [],
  result: Bool,
  body: ((namesNumbered 0 (characteristicNames)) && ((namesNumbered 0 (subcharacteristicNames)) && ((namesNumbered 0 (requirementNames)) && ((namesNumbered 0 (measureNames)) && ((parentsKnown 4 (subcharacteristicRecords)) && ((requirementsKnown 6 (requirementRecords)) && (measuresKnown 8 (measureRecords))))))))
}

theorem{
  name: qualityModelHolds,
  parameters: [],
  statement: ((qualityValid) = true),
  proof: decide{}
}

theorem{
  name: measureExampleMismatchesThreshold,
  parameters: [],
  statement: ((thresholdOf 0 (measureRecords)) = 0),
  proof: decide{}
}

theorem{
  name: measureFailedVectorsThreshold,
  parameters: [],
  statement: ((thresholdOf 1 (measureRecords)) = 0),
  proof: decide{}
}

theorem{
  name: measureGuestAllocationBytesThreshold,
  parameters: [],
  statement: ((thresholdOf 2 (measureRecords)) = 272),
  proof: decide{}
}

theorem{
  name: measureRequestBytesReadThreshold,
  parameters: [],
  statement: ((thresholdOf 3 (measureRecords)) = 136),
  proof: decide{}
}

theorem{
  name: measureUnansweredRequestsThreshold,
  parameters: [],
  statement: ((thresholdOf 4 (measureRecords)) = 0),
  proof: decide{}
}

theorem{
  name: measureUnprovedPropertiesThreshold,
  parameters: [],
  statement: ((thresholdOf 5 (measureRecords)) = 0),
  proof: decide{}
}

theorem{
  name: measureVectorsThatDisagreeThreshold,
  parameters: [],
  statement: ((thresholdOf 6 (measureRecords)) = 0),
  proof: decide{}
}

theorem{
  name: measureViolatingPermitsThreshold,
  parameters: [],
  statement: ((thresholdOf 7 (measureRecords)) = 0),
  proof: decide{}
}
\end{semanticmodule}
\end{lexlean}
app/src/Security.lex.tex 677 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 := 0})
}

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 := 1})
}

definition{
  name: assetRequestBytes,
  parameters: [],
  result: Foundation.Sec::Asset,
  body: (record Foundation.Sec::Asset {index := 3, componentIndex := 0})
}

definition{
  name: threatAnswerThatBreaksINV001,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 0})
}

definition{
  name: threatAnswerThatBreaksINV002,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 1})
}

definition{
  name: threatAnswerThatBreaksINV003,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 2})
}

definition{
  name: threatAnswerThatBreaksINV004,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 3})
}

definition{
  name: threatAnswerThatBreaksINV005,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 4})
}

definition{
  name: threatAnswerThatBreaksINV006,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 5})
}

definition{
  name: threatClassicalAxiomSlippedIn,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 6})
}

definition{
  name: threatCoreRowLeftUnenforced,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 7})
}

definition{
  name: threatGrantedCapability,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 8})
}

definition{
  name: threatMalformedRequest,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 9})
}

definition{
  name: threatOversizedRequest,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 10})
}

definition{
  name: threatSilentAuditTakenAsClean,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 11})
}

definition{
  name: threatSubstitutedHolo,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 12})
}

definition{
  name: threatSubstitutedHost,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 13})
}

definition{
  name: threatTamperedModel,
  parameters: [],
  result: Foundation.Sec::Threat,
  body: (record Foundation.Sec::Threat {index := 14})
}

definition{
  name: riskAnswerThatBreaksINV001,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 0, assetIndex := 0, threatIndex := 0, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskAnswerThatBreaksINV002,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 1, assetIndex := 0, threatIndex := 1, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskAnswerThatBreaksINV003,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 2, assetIndex := 0, threatIndex := 2, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskAnswerThatBreaksINV004,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 3, assetIndex := 0, threatIndex := 3, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskAnswerThatBreaksINV005,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 4, assetIndex := 0, threatIndex := 4, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskAnswerThatBreaksINV006,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 5, assetIndex := 0, threatIndex := 5, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskClassicalAxiomSlippedIn,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 6, assetIndex := 1, threatIndex := 6, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.critical)})
}

definition{
  name: riskCoreRowLeftUnenforced,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 7, assetIndex := 1, threatIndex := 7, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.minor)})
}

definition{
  name: riskGrantedCapability,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 8, assetIndex := 0, threatIndex := 8, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
}

definition{
  name: riskMalformedRequest,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 9, assetIndex := 3, threatIndex := 9, 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 := 10, assetIndex := 3, threatIndex := 10, likelihood := (ctor Foundation.Sec::Likelihood.medium), impact := (ctor Foundation.Sec::Impact.minor)})
}

definition{
  name: riskSilentAuditTakenAsClean,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 11, assetIndex := 0, threatIndex := 11, likelihood := (ctor Foundation.Sec::Likelihood.low), impact := (ctor Foundation.Sec::Impact.major)})
}

definition{
  name: riskSubstitutedHolo,
  parameters: [],
  result: Foundation.Sec::Risk,
  body: (record Foundation.Sec::Risk {index := 12, assetIndex := 2, threatIndex := 12, 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 := 13, assetIndex := 2, threatIndex := 13, 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 := 14, assetIndex := 1, threatIndex := 14, 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 := 10})
}

definition{
  name: controlFingerprintAndProvenance,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 1, riskIndex := 12})
}

definition{
  name: controlNoCapabilityGranted,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 2, riskIndex := 8})
}

definition{
  name: controlNoPermitWithoutAnAudit,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 3, riskIndex := 11})
}

definition{
  name: controlObservedSetOutsideThePolicyIsDenied,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 4, riskIndex := 6})
}

definition{
  name: controlProofOfINV001,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 5, riskIndex := 0})
}

definition{
  name: controlProofOfINV002,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 6, riskIndex := 1})
}

definition{
  name: controlProofOfINV003,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 7, riskIndex := 2})
}

definition{
  name: controlProofOfINV004,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 8, riskIndex := 3})
}

definition{
  name: controlProofOfINV005,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 9, riskIndex := 4})
}

definition{
  name: controlProofOfINV006,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 10, riskIndex := 5})
}

definition{
  name: controlRegeneratedFromThePrompt,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 11, riskIndex := 14})
}

definition{
  name: controlStrictDecoder,
  parameters: [],
  result: Foundation.Sec::ApplicationSecurityControl,
  body: (record Foundation.Sec::ApplicationSecurityControl {index := 12, riskIndex := 9})
}

definition{
  name: controlSet,
  parameters: [],
  result: Production.ThreatModel::ControlSet,
  body: (record Production.ThreatModel::ControlSet {title := "Axiom policy security controls", text := "Axiom policy answers one request with one answer in a Core-Wasm guest granted no capability. Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list.", 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 permit, deny, not-applicable, indeterminate, 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 136 of them."})
}

definition{
  name: modeledThreatAnswerThatBreaksINV001,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV001", name := "Answer that breaks INV-001", text := "The guest answers permit although outside is at least 1, which matters because an axiom the source did not declare is never published.", 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 permit although policy is exact and unseen is at least 1, which matters because an exact policy is equality, not a subset (SPEC section 15.9).", 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 permit although audit is failed, which matters because a failed audit proves nothing about the declaration.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}

definition{
  name: modeledThreatAnswerThatBreaksINV004,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV004", name := "Answer that breaks INV-004", text := "The guest answers permit although audit is unparsed, which matters because output the parser refuses proves nothing about the declaration.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}

definition{
  name: modeledThreatAnswerThatBreaksINV005,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV005", name := "Answer that breaks INV-005", text := "The guest answers permit although audit is unlisted and row is source, which matters because a source declaration the audit missed is never taken as axiom free.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}

definition{
  name: modeledThreatAnswerThatBreaksINV006,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatAnswerThatBreaksINV006", name := "Answer that breaks INV-006", text := "The guest answers permit not when audit is listed and outside equals 0 and unseen equals 0, which matters because an observed set equal to the declared list satisfies all three policies.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}

definition{
  name: modeledThreatClassicalAxiomSlippedIn,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatClassicalAxiomSlippedIn", name := "Classical axiom slipped in", text := "A declaration pinned noaxioms or an exact set starts depending on Classical.choice through a lemma it uses, and is still reported ok.", category := (ctor Production.ThreatModel::Stride.elevationOfPrivilege)})
}

definition{
  name: modeledThreatCoreRowLeftUnenforced,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatCoreRowLeftUnenforced", name := "Core row left unenforced", text := "A core-calculus row absent from the audit is skipped, so a policy on it is never enforced.", 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: 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 136 bytes makes the guest parse or allocate without bound.", category := (ctor Production.ThreatModel::Stride.denialOfService)})
}

definition{
  name: modeledThreatSilentAuditTakenAsClean,
  parameters: [],
  result: Production.ThreatModel::ModeledThreat,
  body: (record Production.ThreatModel::ModeledThreat {threat := "Security::threatSilentAuditTakenAsClean", name := "Silent audit taken as clean", text := "An audit member crashes or prints nothing for a declaration, and an empty observed set is read as no axioms.", category := (ctor Production.ThreatModel::Stride.repudiation)})
}

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 136 bytes before reading a field, and the guest allocates at most 272.", 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: 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: modeledControlNoPermitWithoutAnAudit,
  parameters: [],
  result: Production.ThreatModel::ModeledControl,
  body: (record Production.ThreatModel::ModeledControl {control := "Security::controlNoPermitWithoutAnAudit", name := "No permit without an audit", text := "A failed, refused or missing audit of a source declaration is indeterminate, never permit.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv003Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv005Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.gate), reference := "LexLean crates/conformance/src/cases/verification.rs"}) (nil Production.ThreatModel::Evidence))))})
}

definition{
  name: modeledControlObservedSetOutsideThePolicyIsDenied,
  parameters: [],
  result: Production.ThreatModel::ModeledControl,
  body: (record Production.ThreatModel::ModeledControl {control := "Security::controlObservedSetOutsideThePolicyIsDenied", name := "Observed set outside the policy is denied", text := "Any observed axiom outside the declared list is a deny, proved for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv001Holds"}) (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.review), reference := "LexLean crates/lexlean/src/ir/declaration.rs AxiomPolicy::permits"}) (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 permit when outside 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 := "LexleanAxiomPolicyProofs::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 permit when policy is exact and unseen 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 := "LexleanAxiomPolicyProofs::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 permit when audit is failed. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv003Holds"}) (nil Production.ThreatModel::Evidence))})
}

definition{
  name: modeledControlProofOfINV004,
  parameters: [],
  result: Production.ThreatModel::ModeledControl,
  body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV004", name := "Proof of INV-004", text := "It never answers permit when audit is unparsed. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv004Holds"}) (nil Production.ThreatModel::Evidence))})
}

definition{
  name: modeledControlProofOfINV005,
  parameters: [],
  result: Production.ThreatModel::ModeledControl,
  body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV005", name := "Proof of INV-005", text := "It never answers permit when audit is unlisted and row is source. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv005Holds"}) (nil Production.ThreatModel::Evidence))})
}

definition{
  name: modeledControlProofOfINV006,
  parameters: [],
  result: Production.ThreatModel::ModeledControl,
  body: (record Production.ThreatModel::ModeledControl {control := "Security::controlProofOfINV006", name := "Proof of INV-006", text := "It always answers permit when audit is listed and outside equals 0 and unseen equals 0. The Lean kernel proves it for every request.", evidence := (cons (record Production.ThreatModel::Evidence {kind := (ctor Production.ThreatModel::EvidenceKind.proof), reference := "LexleanAxiomPolicyProofs::inv006Holds"}) (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: mappingGrantedCapability,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatGrantedCapability", controls := (cons "Security::controlNoCapabilityGranted" (nil String))})
}

definition{
  name: mappingSilentAuditTakenAsClean,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatSilentAuditTakenAsClean", controls := (cons "Security::controlNoPermitWithoutAnAudit" (nil String))})
}

definition{
  name: mappingClassicalAxiomSlippedIn,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatClassicalAxiomSlippedIn", controls := (cons "Security::controlObservedSetOutsideThePolicyIsDenied" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV001,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV001", controls := (cons "Security::controlProofOfINV001" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV002,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV002", controls := (cons "Security::controlProofOfINV002" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV003,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV003", controls := (cons "Security::controlProofOfINV003" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV004,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV004", controls := (cons "Security::controlProofOfINV004" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV005,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV005", controls := (cons "Security::controlProofOfINV005" (nil String))})
}

definition{
  name: mappingAnswerThatBreaksINV006,
  parameters: [],
  result: Production.ThreatModel::ThreatMapping,
  body: (record Production.ThreatModel::ThreatMapping {threat := "Security::threatAnswerThatBreaksINV006", controls := (cons "Security::controlProofOfINV006" (nil String))})
}

definition{
  name: 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: acceptedCoreRowLeftUnenforced,
  parameters: [],
  result: Production.ThreatModel::AcceptedRisk,
  body: (record Production.ThreatModel::AcceptedRisk {threat := "Security::threatCoreRowLeftUnenforced", rationale := "verify/mod.rs skips a core row the audit does not name by design: only the declarations the audit family observes carry an observed set, and the not-applicable answer says so."})
}

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/LexleanAxiomPolicy.lex.tex 276 lines
\begin{lexlean}{LexleanAxiomPolicy}
\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: auditListed, parameters: [], result: Nat, body: 0}

definition{name: auditUnlisted, parameters: [], result: Nat, body: 1}

definition{name: auditFailed, parameters: [], result: Nat, body: 2}

definition{name: auditUnparsed, parameters: [], result: Nat, body: 3}

definition{name: rowSource, parameters: [], result: Nat, body: 0}

definition{name: rowCore, parameters: [], result: Nat, body: 1}

definition{name: policyNone, parameters: [], result: Nat, body: 0}

definition{name: policyAllow, parameters: [], result: Nat, body: 1}

definition{name: policyExact, parameters: [], result: Nat, body: 2}

definition{name: answerPermit, parameters: [], result: Nat, body: 0}

definition{name: answerDeny, parameters: [], result: Nat, body: 1}

definition{name: answerNotApplicable, parameters: [], result: Nat, body: 2}

definition{name: answerIndeterminate, parameters: [], result: Nat, body: 3}

structure{
  name: Request,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: audit, type: Nat},
    {name: row, type: Nat},
    {name: policy, type: Nat},
    {name: outside, type: Nat},
    {name: unseen, 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: parseAudit,
  parameters: [value : Bytes],
  result: (Option Nat),
  body: (if (prim equal value 0x6c6973746564 : Bool) then (ctor Option.some [Nat] (auditListed)) else (if (prim equal value 0x756e6c6973746564 : Bool) then (ctor Option.some [Nat] (auditUnlisted)) else (if (prim equal value 0x6661696c6564 : Bool) then (ctor Option.some [Nat] (auditFailed)) else (if (prim equal value 0x756e706172736564 : Bool) then (ctor Option.some [Nat] (auditUnparsed)) else (ctor Option.none [Nat])))))
}

definition{
  name: parseRow,
  parameters: [value : Bytes],
  result: (Option Nat),
  body: (if (prim equal value 0x736f75726365 : Bool) then (ctor Option.some [Nat] (rowSource)) else (if (prim equal value 0x636f7265 : Bool) then (ctor Option.some [Nat] (rowCore)) else (ctor Option.none [Nat])))
}

definition{
  name: parsePolicy,
  parameters: [value : Bytes],
  result: (Option Nat),
  body: (if (prim equal value 0x6e6f6e65 : Bool) then (ctor Option.some [Nat] (policyNone)) else (if (prim equal value 0x616c6c6f77 : Bool) then (ctor Option.some [Nat] (policyAllow)) else (if (prim equal value 0x6578616374 : Bool) then (ctor Option.some [Nat] (policyExact)) else (ctor Option.none [Nat]))))
}

definition{
  name: parseOutside,
  parameters: [value : Bytes],
  result: (Option Nat),
  body: (match (parseNumber value)
    | Option.none => (ctor Option.none [Nat])
    | Option.some parsed => (if (64 <? parsed) then (ctor Option.none [Nat]) else (ctor Option.some [Nat] parsed))),
  axioms: [Quot.sound, propext]
}

definition{
  name: parseUnseen,
  parameters: [value : Bytes],
  result: (Option Nat),
  body: (match (parseNumber value)
    | Option.none => (ctor Option.none [Nat])
    | Option.some parsed => (if (64 <? 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: decodeField5,
  parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat, v4 : Nat],
  result: (Option Request),
  body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseUnseen (sliceOf s start (prim subtract e start : Nat)))
    | Option.none => (ctor Option.none [Request])
    | Option.some v5 => (if (e =? (Foundation.Bytes::byteLength s)) then (ctor Option.some [Request] (record Request {audit := v1, row := v2, policy := v3, outside := v4, unseen := v5})) else (ctor Option.none [Request])))),
  axioms: [Quot.sound, propext]
}

definition{
  name: decodeField4,
  parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat, v3 : Nat],
  result: (Option Request),
  body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseOutside (sliceOf s start (prim subtract e start : Nat)))
    | Option.none => (ctor Option.none [Request])
    | Option.some v4 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField5 s (e + 1) v1 v2 v3 v4) else (ctor Option.none [Request])))),
  axioms: [Quot.sound, propext]
}

definition{
  name: decodeField3,
  parameters: [s : Bytes, start : Nat, v1 : Nat, v2 : Nat],
  result: (Option Request),
  body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parsePolicy (sliceOf s start (prim subtract e start : Nat)))
    | Option.none => (ctor Option.none [Request])
    | Option.some v3 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField4 s (e + 1) v1 v2 v3) else (ctor Option.none [Request])))),
  axioms: [Quot.sound, propext]
}

definition{
  name: decodeField2,
  parameters: [s : Bytes, start : Nat, v1 : Nat],
  result: (Option Request),
  body: (let e : Nat := (fieldEnd s start (Foundation.Bytes::byteLength s)); (match (parseRow (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 (parseAudit (sliceOf s start (prim subtract e start : Nat)))
    | Option.none => (ctor Option.none [Request])
    | Option.some v1 => (if (e <? (Foundation.Bytes::byteLength s)) then (decodeField2 s (e + 1) v1) else (ctor Option.none [Request])))),
  axioms: [Quot.sound, propext]
}

definition{
  name: rule1,
  parameters: [request : Request],
  result: Bool,
  body: ((project request audit) =? (auditFailed))
}

definition{
  name: rule2,
  parameters: [request : Request],
  result: Bool,
  body: ((project request audit) =? (auditUnparsed))
}

definition{
  name: rule3,
  parameters: [request : Request],
  result: Bool,
  body: (((project request audit) =? (auditUnlisted)) && ((project request row) =? (rowCore)))
}

definition{
  name: rule4,
  parameters: [request : Request],
  result: Bool,
  body: ((project request audit) =? (auditUnlisted))
}

definition{
  name: rule5,
  parameters: [request : Request],
  result: Bool,
  body: (1 <=? (project request outside))
}

definition{
  name: rule6,
  parameters: [request : Request],
  result: Bool,
  body: (((project request policy) =? (policyExact)) && (1 <=? (project request unseen)))
}

definition{
  name: judge,
  parameters: [request : Request],
  result: Nat,
  body: (if (rule1 request) then (answerIndeterminate) else (if (rule2 request) then (answerIndeterminate) else (if (rule3 request) then (answerNotApplicable) else (if (rule4 request) then (answerIndeterminate) else (if (rule5 request) then (answerDeny) else (if (rule6 request) then (answerDeny) else (answerPermit)))))))
}

definition{
  name: encodeAnswer,
  parameters: [code : Nat],
  result: Bytes,
  body: (if (code =? (answerPermit)) then 0x7065726d6974 else (if (code =? (answerDeny)) then 0x64656e79 else (if (code =? (answerNotApplicable)) then 0x6e6f742d6170706c696361626c65 else (if (code =? (answerIndeterminate)) then 0x696e64657465726d696e617465 else 0x696e76616c6964))))
}

definition{
  name: dispatch,
  parameters: [value : Bytes],
  result: Bytes,
  body: (if (136 <? (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 := "Axiom policy", cargoName := "prism-lexlean-axiom-policy", cargoVersion := "0.1.0", cargoDescription := "Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the decl", cargoRepository := "https://github.com/UOR-Foundation/PrismPM", cargoHomepage := "https://github.com/UOR-Foundation/PrismPM", libraryRoots := (cons "PrismLexleanAxiomPolicy.LexleanAxiomPolicy.dispatch" (nil String)), acceptanceVectors := (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520657861637420302030, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520657861637420302031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520616c6c6f7720302032, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520312030, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f726520616c6c6f7720312030, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420636f726520657861637420302030, response := 0x6e6f742d6170706c696361626c65}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f7572636520657861637420302030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6661696c656420736f75726365206e6f6e6520302030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e70617273656420636f726520657861637420302030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f757263652065786163742036352030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520302030, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520302031, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520312031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520657861637420312030, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520657861637420312031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f7265206e6f6e6520302030, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f7265206e6f6e6520302031, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f7265206e6f6e6520312030, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f7265206e6f6e6520312031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f726520657861637420302030, response := 0x7065726d6974}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f726520657861637420302031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f726520657861637420312030, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420636f726520657861637420312031, response := 0x64656e79}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f75726365206e6f6e6520302030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f75726365206e6f6e6520302031, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f75726365206e6f6e6520312030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f75726365206e6f6e6520312031, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f7572636520657861637420302031, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f7572636520657861637420312030, response := 0x696e64657465726d696e617465}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6c697374656420736f7572636520657861637420312031, response := 0x696e64657465726d696e617465}) (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 := 0x6c697374656420736f75726365206e6f6e652030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e65203020302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c69737465642020736f7572636520206e6f6e65202030202030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x756e6b6e6f776e20736f75726365206e6f6e6520302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420756e6b6e6f776e206e6f6e6520302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f7572636520756e6b6e6f776e20302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652030372030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e65202d312030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e65202b312030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520313030303030303030303030303030303030302030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520d9a12030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520782030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652036352030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652030203037, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652030202d31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652030202b31, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520302031303030303030303030303030303030303030, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e65203020d9a1, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e6520302078, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x6c697374656420736f75726365206e6f6e652030203635, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (cons (record Foundation.View.Text.V1.Model::AcceptanceVector {request := 0x7878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878, response := 0x696e76616c6964}) (nil Foundation.View.Text.V1.Model::AcceptanceVector)))))))))))))))))))))))))))))))))))))))))))))))))))))))), entryRoot := "PrismLexleanAxiomPolicy.LexleanAxiomPolicy.dispatch", coreContract := "hologram:guest/core-wasm@1", requestMaximum := (136 : UInt32), responseMaximum := (64 : UInt32), guestAllocationMaximum := (272 : UInt32), capabilitiesEmpty := true, fatArchive := true, primaryLayer := (0 : UInt8), viewLayer := (1 : UInt8), view := (record Foundation.View.Text.V1.Model::TextView {title := "Axiom policy", heading := "Axiom policy", inputLabel := "Request: audit row policy outside unseen", submitLabel := "Decide", outputLabel := "Answer", inputError := "Invalid request", responseError := "Invalid response"})})
}
\end{semanticmodule}
\end{lexlean}
app/src/LexleanAxiomPolicyProofs.lex.tex 243 lines
\begin{lexlean}{LexleanAxiomPolicyProofs}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\importmodule{LexleanAxiomPolicy}
\title{Text application model}
\begin{semanticmodule}
definition{
  name: breaksInv001,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && (1 <=? (project request outside))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))
}

theorem{
  name: inv001Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv001 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv001
    ]
  },
  axioms: [Quot.sound, propext]
}

definition{
  name: breaksInv002,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: (((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request policy) =? (LexleanAxiomPolicy::policyExact))) && (1 <=? (project request unseen))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))
}

theorem{
  name: inv002Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv002 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv002
    ]
  },
  axioms: [Classical.choice, Quot.sound, propext]
}

definition{
  name: breaksInv003,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditFailed))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))
}

theorem{
  name: inv003Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv003 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv003
    ]
  },
  axioms: [Classical.choice, Quot.sound, propext]
}

definition{
  name: breaksInv004,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditUnparsed))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))
}

theorem{
  name: inv004Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv004 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv004
    ]
  },
  axioms: [Classical.choice, Quot.sound, propext]
}

definition{
  name: breaksInv005,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: (((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditUnlisted))) && ((project request row) =? (LexleanAxiomPolicy::rowSource))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))
}

theorem{
  name: inv005Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv005 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv005
    ]
  },
  axioms: [Classical.choice, Quot.sound, propext]
}

definition{
  name: breaksInv006,
  parameters: [request : LexleanAxiomPolicy::Request],
  result: Bool,
  body: ((((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditListed))) && ((project request outside) =? 0)) && ((project request unseen) =? 0)) && (not ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit))))
}

theorem{
  name: inv006Holds,
  parameters: [request : LexleanAxiomPolicy::Request],
  statement: ((breaksInv006 request) = false),
  proof: linear_arithmetic{
    definitions: [
      LexleanAxiomPolicy::answerDeny,
      LexleanAxiomPolicy::answerIndeterminate,
      LexleanAxiomPolicy::answerNotApplicable,
      LexleanAxiomPolicy::answerPermit,
      LexleanAxiomPolicy::auditFailed,
      LexleanAxiomPolicy::auditListed,
      LexleanAxiomPolicy::auditUnlisted,
      LexleanAxiomPolicy::auditUnparsed,
      LexleanAxiomPolicy::judge,
      LexleanAxiomPolicy::policyAllow,
      LexleanAxiomPolicy::policyExact,
      LexleanAxiomPolicy::policyNone,
      LexleanAxiomPolicy::rowCore,
      LexleanAxiomPolicy::rowSource,
      LexleanAxiomPolicy::rule1,
      LexleanAxiomPolicy::rule2,
      LexleanAxiomPolicy::rule3,
      LexleanAxiomPolicy::rule4,
      LexleanAxiomPolicy::rule5,
      LexleanAxiomPolicy::rule6,
      breaksInv006
    ]
  },
  axioms: [Quot.sound, propext]
}
\end{semanticmodule}
\end{lexlean}
app/lexlean.toml 43 lines
spec = "lexlean/project/1"
name = "prism-lexlean-axiom-policy"
language = "1.2"
module_prefix = "PrismLexleanAxiomPolicy"
source_roots = ["src"]
entrypoints = ["src/Architecture.lex.tex", "src/Compliance.lex.tex", "src/Design.lex.tex", "src/Features.lex.tex", "src/LexleanAxiomPolicy.lex.tex", "src/LexleanAxiomPolicyProofs.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 450 lines
{
  "schema": "prism/prompt/1",
  "pattern": "policyDecision",
  "goal": "Decide if a declaration uses only the axioms its source allows. Then lexlean verify publishes nothing that rests on more.",
  "repository": "UOR-Foundation/LexLean",
  "app": {
    "name": "lexlean-axiom-policy",
    "title": "Axiom policy",
    "purpose": "Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list.",
    "limits": [
      "It does not run the audit: the observed set is read from the Lean axiom audit members of stage 9 and 10.",
      "It does not judge a model declaration's generated family, whose union LexLean compares with the model's declared set separately."
    ],
    "fields": [
      {
        "name": "audit",
        "kind": "choice",
        "values": [
          "listed",
          "unlisted",
          "failed",
          "unparsed"
        ],
        "means": "the audit of the declaration: listed in the output, absent from it, its member exited nonzero, or its output refused by the parser"
      },
      {
        "name": "row",
        "kind": "choice",
        "values": [
          "source",
          "core"
        ],
        "means": "a source declaration of a document, or a row of the document's core calculus"
      },
      {
        "name": "policy",
        "kind": "choice",
        "values": [
          "none",
          "allow",
          "exact"
        ],
        "means": "the declared AxiomPolicy: noaxioms, allowaxioms or exactaxioms"
      },
      {
        "name": "outside",
        "kind": "number",
        "min": 0,
        "max": 64,
        "means": "observed axioms not in the declared list (for noaxioms, every observed axiom)"
      },
      {
        "name": "unseen",
        "kind": "number",
        "min": 0,
        "max": 64,
        "means": "declared axioms the audit did not observe"
      }
    ],
    "outcomes": [
      "permit",
      "deny",
      "not-applicable",
      "indeterminate"
    ],
    "meanings": {
      "permit": "XACML 3.0 Permit: the observed set satisfies the policy and the declaration row records result ok",
      "deny": "XACML 3.0 Deny: the observed set violates the policy and verify fails with LLV7005",
      "not-applicable": "XACML 3.0 NotApplicable: no observation applies, so the policy is not enforced on this row",
      "indeterminate": "XACML 3.0 Indeterminate: the audit could not be evaluated, so verify fails before any policy is judged"
    },
    "rules": [
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "failed"
          }
        ],
        "then": "indeterminate",
        "why": "crates/lexlean/src/verify/mod.rs: an audit member that exits nonzero fails with LLV7004"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unparsed"
          }
        ],
        "then": "indeterminate",
        "why": "verify/mod.rs: output that axiom::parse_audit_output refuses fails with LLV7004, missing or malformed audit output"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          },
          {
            "field": "row",
            "op": "is",
            "value": "core"
          }
        ],
        "then": "not-applicable",
        "why": "verify/mod.rs stage 11: a core declaration absent from the observed map is skipped (continue)"
      },
      {
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          }
        ],
        "then": "indeterminate",
        "why": "verify/mod.rs: the audit family must observe every declaration, or verify fails as an internal error"
      },
      {
        "when": [
          {
            "field": "outside",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "deny",
        "why": "ir/declaration.rs AxiomPolicy::permits: none needs an empty set, allow a subset, exact an equal one"
      },
      {
        "when": [
          {
            "field": "policy",
            "op": "is",
            "value": "exact"
          },
          {
            "field": "unseen",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "deny",
        "why": "AxiomPolicy::permits Exact: the sorted, deduplicated observed set must equal the declared list"
      }
    ],
    "otherwise": "permit",
    "otherwiseWhy": "AxiomPolicy::permits: every observed axiom is declared, and an exact policy saw every declared one",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "outside",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "permit",
        "why": "an axiom the source did not declare is never published"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "policy",
            "op": "is",
            "value": "exact"
          },
          {
            "field": "unseen",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "permit",
        "why": "an exact policy is equality, not a subset (SPEC section 15.9)"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "failed"
          }
        ],
        "then": "permit",
        "why": "a failed audit proves nothing about the declaration"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unparsed"
          }
        ],
        "then": "permit",
        "why": "output the parser refuses proves nothing about the declaration"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "unlisted"
          },
          {
            "field": "row",
            "op": "is",
            "value": "source"
          }
        ],
        "then": "permit",
        "why": "a source declaration the audit missed is never taken as axiom free"
      },
      {
        "kind": "always",
        "when": [
          {
            "field": "audit",
            "op": "is",
            "value": "listed"
          },
          {
            "field": "outside",
            "op": "=",
            "value": 0
          },
          {
            "field": "unseen",
            "op": "=",
            "value": 0
          }
        ],
        "then": "permit",
        "why": "an observed set equal to the declared list satisfies all three policies"
      }
    ],
    "examples": [
      {
        "request": "listed source exact 0 0",
        "response": "permit"
      },
      {
        "request": "listed source exact 0 1",
        "response": "deny"
      },
      {
        "request": "listed source allow 0 2",
        "response": "permit"
      },
      {
        "request": "listed source none 1 0",
        "response": "deny"
      },
      {
        "request": "listed core allow 1 0",
        "response": "deny"
      },
      {
        "request": "unlisted core exact 0 0",
        "response": "not-applicable"
      },
      {
        "request": "unlisted source exact 0 0",
        "response": "indeterminate"
      },
      {
        "request": "failed source none 0 0",
        "response": "indeterminate"
      },
      {
        "request": "unparsed core exact 0 0",
        "response": "indeterminate"
      },
      {
        "request": "listed source exact 65 0",
        "response": "invalid"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "Model author",
      "text": "Pins each declaration's axioms with noaxioms, allowaxioms or exactaxioms and needs verify to hold the kernel to exactly that.",
      "concerns": [
        "Correct answers",
        "Proved guarantees"
      ]
    },
    {
      "name": "Release reviewer",
      "text": "Reads the declaration rows of a verify before a release and needs no row to say ok unless its audit was read and satisfied.",
      "concerns": [
        "No unaudited permit",
        "Integrity of the published app"
      ]
    }
  ],
  "concerns": [
    {
      "name": "No unaudited permit",
      "text": "A declaration whose audit failed, was refused or missed it is never permitted.",
      "model": "security"
    }
  ],
  "components": [
    {
      "name": "Lean axiom audit",
      "text": "The audit modules lexlean verify runs under the pinned Lean, whose output lists the axioms each declaration depends on.",
      "kind": "cliAdapter"
    },
    {
      "name": "lexlean verify",
      "text": "The LexLean verifier whose stage 11 enforces each declaration's policy and writes the declaration rows.",
      "kind": "cliAdapter"
    }
  ],
  "threats": [
    {
      "name": "Classical axiom slipped in",
      "text": "A declaration pinned noaxioms or an exact set starts depending on Classical.choice through a lemma it uses, and is still reported ok.",
      "stride": "elevationOfPrivilege",
      "asset": "source",
      "likelihood": "medium",
      "impact": "critical",
      "control": {
        "name": "Observed set outside the policy is denied",
        "text": "Any observed axiom outside the declared list is a deny, proved for every request.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv001Holds"
          },
          {
            "kind": "review",
            "reference": "LexLean crates/lexlean/src/ir/declaration.rs AxiomPolicy::permits"
          }
        ]
      }
    },
    {
      "name": "Silent audit taken as clean",
      "text": "An audit member crashes or prints nothing for a declaration, and an empty observed set is read as no axioms.",
      "stride": "repudiation",
      "asset": "answer",
      "likelihood": "low",
      "impact": "major",
      "control": {
        "name": "No permit without an audit",
        "text": "A failed, refused or missing audit of a source declaration is indeterminate, never permit.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv003Holds"
          },
          {
            "kind": "proof",
            "reference": "LexleanAxiomPolicyProofs::inv005Holds"
          },
          {
            "kind": "gate",
            "reference": "LexLean crates/conformance/src/cases/verification.rs"
          }
        ]
      }
    },
    {
      "name": "Core row left unenforced",
      "text": "A core-calculus row absent from the audit is skipped, so a policy on it is never enforced.",
      "stride": "tampering",
      "asset": "source",
      "likelihood": "low",
      "impact": "minor",
      "accepted": "verify/mod.rs skips a core row the audit does not name by design: only the declarations the audit family observes carry an observed set, and the not-applicable answer says so."
    }
  ],
  "quality": [
    {
      "characteristic": "Security",
      "subcharacteristic": "Integrity",
      "requirement": "Only satisfied policies are permitted",
      "text": "No request with an undeclared observed axiom, or an exact policy missing one, is permitted.",
      "measure": "Violating permits",
      "measureText": "Acceptance vectors permitted while outside or, under exact, unseen is at least 1.",
      "threshold": 0
    },
    {
      "characteristic": "Functional suitability",
      "subcharacteristic": "Functional correctness",
      "requirement": "Every decision matches verify",
      "text": "Each vector answers the decision stage 11 of lexlean verify reaches.",
      "measure": "Vectors that disagree",
      "measureText": "Acceptance vectors whose replayed answer differs from the expected decision.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "Model author",
      "steps": [
        "otherwise",
        "REQ-005",
        "REQ-006",
        "INV-002"
      ]
    },
    {
      "stakeholder": "Release reviewer",
      "steps": [
        "REQ-001",
        "REQ-004",
        "REQ-003",
        "INV-005",
        "refuse"
      ]
    }
  ],
  "axioms": {
    "inv002Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv003Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv004Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ],
    "inv005Holds": [
      "Classical.choice",
      "Quot.sound",
      "propext"
    ]
  },
  "license": "MIT OR Apache-2.0"
}
model/ids.toml 77 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 = "LA-01"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app never answers permit when outside is at least 1"

[[id]]
id = "LA-02"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app never answers permit when policy is exact and unseen is at least 1"

[[id]]
id = "LA-03"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app never answers permit when audit is failed"

[[id]]
id = "LA-04"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app never answers permit when audit is unparsed"

[[id]]
id = "LA-05"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app never answers permit when audit is unlisted and row is source"

[[id]]
id = "LA-06"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The app always answers permit when audit is listed and outside equals 0 and unseen equals 0"

[[id]]
id = "LA-07"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references"

[[id]]
id = "LA-08"
level = "build"
suite = "lexlean_axiom_policy"
statement = "The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared"

[[id]]
id = "LA-09"
level = "build"
suite = "lexlean_axiom_policy"
statement = "Every compliance obligation is numbered in order and names its evidence"
features/suites/lexlean_axiom_policy.feature 56 lines
Feature: lexlean_axiom_policy

  This repository's Prism application, in app/, generated by prism-code from its
  spec: Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list.

  @LA-01 @build
  Scenario: The app never answers permit when outside is at least 1
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv001Holds during prismpm verify
    Then no request meets breaksInv001

  @LA-02 @build
  Scenario: The app never answers permit when policy is exact and unseen is at least 1
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv002Holds during prismpm verify
    Then no request meets breaksInv002

  @LA-03 @build
  Scenario: The app never answers permit when audit is failed
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv003Holds during prismpm verify
    Then no request meets breaksInv003

  @LA-04 @build
  Scenario: The app never answers permit when audit is unparsed
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv004Holds during prismpm verify
    Then no request meets breaksInv004

  @LA-05 @build
  Scenario: The app never answers permit when audit is unlisted and row is source
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv005Holds during prismpm verify
    Then no request meets breaksInv005

  @LA-06 @build
  Scenario: The app always answers permit when audit is listed and outside equals 0 and unseen equals 0
    Given the model in app/src/LexleanAxiomPolicy.lex.tex
    When the Lean kernel checks inv006Holds during prismpm verify
    Then no request meets breaksInv006
  @LA-07 @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
  @LA-08 @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
  @LA-09 @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/lexlean_axiom_policy.rs 152 lines
//! The `lexlean_axiom_policy` suite: one test per scenario in `features/suites/lexlean_axiom_policy.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/LexleanAxiomPolicyProofs.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"
    );
}

/// `LA-01`: The app never answers permit when outside is at least 1
#[test]
fn lexlean_axiom_policy_la_01() {
    pinned(
        "breaksInv001",
        "body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && (1 <=? (project request outside))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))",
        "inv001Holds",
    );
}

/// `LA-02`: The app never answers permit when policy is exact and unseen is at least 1
#[test]
fn lexlean_axiom_policy_la_02() {
    pinned(
        "breaksInv002",
        "body: (((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request policy) =? (LexleanAxiomPolicy::policyExact))) && (1 <=? (project request unseen))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))",
        "inv002Holds",
    );
}

/// `LA-03`: The app never answers permit when audit is failed
#[test]
fn lexlean_axiom_policy_la_03() {
    pinned(
        "breaksInv003",
        "body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditFailed))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))",
        "inv003Holds",
    );
}

/// `LA-04`: The app never answers permit when audit is unparsed
#[test]
fn lexlean_axiom_policy_la_04() {
    pinned(
        "breaksInv004",
        "body: ((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditUnparsed))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))",
        "inv004Holds",
    );
}

/// `LA-05`: The app never answers permit when audit is unlisted and row is source
#[test]
fn lexlean_axiom_policy_la_05() {
    pinned(
        "breaksInv005",
        "body: (((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditUnlisted))) && ((project request row) =? (LexleanAxiomPolicy::rowSource))) && ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit)))",
        "inv005Holds",
    );
}

/// `LA-06`: The app always answers permit when audit is listed and outside equals 0 and unseen equals 0
#[test]
fn lexlean_axiom_policy_la_06() {
    pinned(
        "breaksInv006",
        "body: ((((((((((project request audit) <? 4) && ((project request row) <? 2)) && ((project request policy) <? 3)) && ((project request outside) <=? 64)) && ((project request unseen) <=? 64)) && ((project request audit) =? (LexleanAxiomPolicy::auditListed))) && ((project request outside) =? 0)) && ((project request unseen) =? 0)) && (not ((LexleanAxiomPolicy::judge request) =? (LexleanAxiomPolicy::answerPermit))))",
        "inv006Holds",
    );
}

/// `LA-07`: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
#[test]
fn lexlean_axiom_policy_la_07() {
    holds(
        "app/src/Architecture.lex.tex",
        "architectureDescriptionHolds",
        "((architectureValid) = true)",
    );
}

/// `LA-08`: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
#[test]
fn lexlean_axiom_policy_la_08() {
    holds(
        "app/src/Quality.lex.tex",
        "qualityModelHolds",
        "((qualityValid) = true)",
    );
}

/// `LA-09`: Every compliance obligation is numbered in order and names its evidence
#[test]
fn lexlean_axiom_policy_la_09() {
    holds(
        "app/src/Compliance.lex.tex",
        "everyObligationEvidenced",
        "((obligationsEvidenced 0 (obligations)) = true)",
    );
}
site/app.json 136 lines
{
  "name": "Axiom policy",
  "shortName": "Axiom",
  "live": "https://uor-foundation.github.io/LexLean/",
  "purpose": "Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list. Send audit, row, policy, outside or unseen, separated by spaces; it answers permit, deny, not-applicable or indeterminate, and invalid request for anything else.",
  "inputLabel": "Request: audit row policy outside unseen",
  "placeholder": "listed source exact 0 0",
  "submitLabel": "Decide",
  "outputLabel": "Answer",
  "answers": {
    "positive": [
      "permit"
    ],
    "negative": [
      "deny",
      "not-applicable",
      "indeterminate"
    ],
    "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": "LA-01: the app never answers permit when outside is at least 1. LA-02: the app never answers permit when policy is exact and unseen is at least 1. LA-03: the app never answers permit when audit is failed. LA-04: the app never answers permit when audit is unparsed. LA-05: the app never answers permit when audit is unlisted and row is source. LA-06: the app always answers permit when audit is listed and outside equals 0 and unseen equals 0.",
  "proposition": {
    "name": "judge",
    "text": "judge request :=\n  audit is failed → indeterminate\n  audit is unparsed → indeterminate\n  audit is unlisted and row is core → not-applicable\n  audit is unlisted → indeterminate\n  outside is at least 1 → deny\n  policy is exact and unseen is at least 1 → deny\n  otherwise → permit",
    "plain": "Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list."
  },
  "theorems": [
    {
      "name": "inv001Holds",
      "statement": "no request meets breaksInv001: the app never answers permit when outside 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/LexleanAxiomPolicyProofs.lex.tex"
    },
    {
      "name": "inv002Holds",
      "statement": "no request meets breaksInv002: the app never answers permit when policy is exact and unseen 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/LexleanAxiomPolicyProofs.lex.tex"
    },
    {
      "name": "inv003Holds",
      "statement": "no request meets breaksInv003: the app never answers permit when audit is failed",
      "how": "Proved by linear arithmetic, checked by the Lean kernel on the UOR MCP server and again by prismpm verify in CI",
      "where": "app/src/LexleanAxiomPolicyProofs.lex.tex"
    },
    {
      "name": "inv004Holds",
      "statement": "no request meets breaksInv004: the app never answers permit when audit is unparsed",
      "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/LexleanAxiomPolicyProofs.lex.tex"
    },
    {
      "name": "inv005Holds",
      "statement": "no request meets breaksInv005: the app never answers permit when audit is unlisted and row is source",
      "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/LexleanAxiomPolicyProofs.lex.tex"
    },
    {
      "name": "inv006Holds",
      "statement": "no request meets breaksInv006: the app always answers permit when audit is listed and outside equals 0 and unseen equals 0",
      "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/LexleanAxiomPolicyProofs.lex.tex"
    }
  ],
  "pinned": [
    {
      "name": "lexlean_axiom_policy_la_01",
      "what": "LA-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/lexlean_axiom_policy.rs"
    },
    {
      "name": "lexlean_axiom_policy_la_02",
      "what": "LA-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/lexlean_axiom_policy.rs"
    },
    {
      "name": "lexlean_axiom_policy_la_03",
      "what": "LA-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/lexlean_axiom_policy.rs"
    },
    {
      "name": "lexlean_axiom_policy_la_04",
      "what": "LA-04's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
      "where": "crates/conformance/tests/lexlean_axiom_policy.rs"
    },
    {
      "name": "lexlean_axiom_policy_la_05",
      "what": "LA-05's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
      "where": "crates/conformance/tests/lexlean_axiom_policy.rs"
    },
    {
      "name": "lexlean_axiom_policy_la_06",
      "what": "LA-06's condition and the theorem that no request meets it. A string-matching test, not a theorem: a planted defect fails it.",
      "where": "crates/conformance/tests/lexlean_axiom_policy.rs"
    }
  ],
  "trusted": [
    {
      "name": "SDK image",
      "value": "the digest prismpm.lock pins; see the bootstrap workflow's log"
    },
    {
      "name": "Lean toolchain",
      "value": "leanprover/lean4:v4.32.1"
    },
    {
      "name": "LexLean compiler semantics",
      "value": "5262e5b4c8b5668ae7066ad686757a6bb7f80c941d515fb9d586894fbc7de69a"
    },
    {
      "name": "prism-code runtime, vendored",
      "value": "0.2.0, see try/vendor/prism-code/VENDOR.md"
    },
    {
      "name": "Your browser",
      "value": "runs the WebAssembly guest and this page"
    }
  ],
  "attestations": {
    "proof": {
      "id": "not recorded: the proof ran in the SDK image, not on the UOR MCP server",
      "url": "https://github.com/UOR-Foundation/LexLean/actions/workflows/bootstrap.yml"
    },
    "build": {
      "id": "printed by prismpm verify in every pages run",
      "url": "https://github.com/UOR-Foundation/LexLean/actions/workflows/pages.yml"
    }
  },
  "repository": "https://github.com/UOR-Foundation/LexLean",
  "report": "https://github.com/UOR-Foundation/LexLean/blob/main/TEMPLATE-VERIFICATION.md"
}
openspec/specs/lexlean-axiom-policy/spec.md 228 lines
# lexlean-axiom-policy Specification

<!-- Generated by Prism from prism/spec.json. Change the app through your agent with /prism, not by editing this file. -->

## Purpose

Axiom policy: Decide, for one declaration at stage 11 of lexlean verify, whether its axiom audit permits it, denies it with LLV7005, does not apply to it, or cannot be decided, from the audit result, where the declaration lives, its policy kind and how its observed set differs from the declared list.

## Requirements

### Requirement: Never permit when outside is at least 1

The app SHALL NOT answer `permit` when outside is at least 1, because an axiom the source did not declare is never published.

Verified: to be proved by Lean for every request (INV-001, theorem `inv001Holds`).

#### Scenario: INV-001 holds

- **WHEN** the request is `listed source none 1 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `permit`
- **AND** the app answers `deny`, decided by REQ-005

### Requirement: Never permit when policy is exact and unseen is at least 1

The app SHALL NOT answer `permit` when policy is exact and unseen is at least 1, because an exact policy is equality, not a subset (SPEC section 15.9).

Verified: to be proved by Lean for every request (INV-002, theorem `inv002Holds`).

#### Scenario: INV-002 holds

- **WHEN** the request is `listed source exact 0 1` (an acceptance example)
- **THEN** the answer SHALL NOT be `permit`
- **AND** the app answers `deny`, decided by REQ-006

### Requirement: Never permit when audit is failed

The app SHALL NOT answer `permit` when audit is failed, because a failed audit proves nothing about the declaration.

Verified: to be proved by Lean for every request (INV-003, theorem `inv003Holds`).

#### Scenario: INV-003 holds

- **WHEN** the request is `failed source none 0 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `permit`
- **AND** the app answers `indeterminate`, decided by REQ-001

### Requirement: Never permit when audit is unparsed

The app SHALL NOT answer `permit` when audit is unparsed, because output the parser refuses proves nothing about the declaration.

Verified: to be proved by Lean for every request (INV-004, theorem `inv004Holds`).

#### Scenario: INV-004 holds

- **WHEN** the request is `unparsed core exact 0 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `permit`
- **AND** the app answers `indeterminate`, decided by REQ-002

### Requirement: Never permit when audit is unlisted and row is source

The app SHALL NOT answer `permit` when audit is unlisted and row is source, because a source declaration the audit missed is never taken as axiom free.

Verified: to be proved by Lean for every request (INV-005, theorem `inv005Holds`).

#### Scenario: INV-005 holds

- **WHEN** the request is `unlisted source exact 0 0` (an acceptance example)
- **THEN** the answer SHALL NOT be `permit`
- **AND** the app answers `indeterminate`, decided by REQ-004

### Requirement: Always permit when audit is listed and outside equals 0 and unseen equals 0

The app SHALL answer `permit` when audit is listed and outside equals 0 and unseen equals 0, because an observed set equal to the declared list satisfies all three policies.

Verified: to be proved by Lean for every request (INV-006, theorem `inv006Holds`).

#### Scenario: INV-006 holds

- **WHEN** the request is `listed source exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `permit`
- **AND** the app answers `permit`, decided by the fallback

### Requirement: REQ-001 indeterminate when audit is failed

The app SHALL answer `indeterminate` when audit is failed, because crates/lexlean/src/verify/mod.rs: an audit member that exits nonzero fails with LLV7004.

Verified: tested by the acceptance vectors (`rule1`).

#### Scenario: REQ-001 decides

- **WHEN** the request is `failed source none 0 0` (an acceptance example)
- **THEN** the answer SHALL be `indeterminate`, decided by REQ-001

### Requirement: REQ-002 indeterminate when audit is unparsed

The app SHALL answer `indeterminate` when audit is unparsed and no earlier rule matches, because verify/mod.rs: output that axiom::parse_audit_output refuses fails with LLV7004, missing or malformed audit output.

Verified: tested by the acceptance vectors (`rule2`).

#### Scenario: REQ-002 decides

- **WHEN** the request is `unparsed core exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `indeterminate`, decided by REQ-002

### Requirement: REQ-003 not-applicable when audit is unlisted and row is core

The app SHALL answer `not-applicable` when audit is unlisted and row is core and no earlier rule matches, because verify/mod.rs stage 11: a core declaration absent from the observed map is skipped (continue).

Verified: tested by the acceptance vectors (`rule3`).

#### Scenario: REQ-003 decides

- **WHEN** the request is `unlisted core exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `not-applicable`, decided by REQ-003

### Requirement: REQ-004 indeterminate when audit is unlisted

The app SHALL answer `indeterminate` when audit is unlisted and no earlier rule matches, because verify/mod.rs: the audit family must observe every declaration, or verify fails as an internal error.

Verified: tested by the acceptance vectors (`rule4`).

#### Scenario: REQ-004 decides

- **WHEN** the request is `unlisted source exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `indeterminate`, decided by REQ-004

### Requirement: REQ-005 deny when outside is at least 1

The app SHALL answer `deny` when outside is at least 1 and no earlier rule matches, because ir/declaration.rs AxiomPolicy::permits: none needs an empty set, allow a subset, exact an equal one.

Verified: tested by the acceptance vectors (`rule5`).

#### Scenario: REQ-005 decides

- **WHEN** the request is `listed source none 1 0` (an acceptance example)
- **THEN** the answer SHALL be `deny`, decided by REQ-005

### Requirement: REQ-006 deny when policy is exact and unseen is at least 1

The app SHALL answer `deny` when policy is exact and unseen is at least 1 and no earlier rule matches, because AxiomPolicy::permits Exact: the sorted, deduplicated observed set must equal the declared list.

Verified: tested by the acceptance vectors (`rule6`).

#### Scenario: REQ-006 decides

- **WHEN** the request is `listed source exact 0 1` (an acceptance example)
- **THEN** the answer SHALL be `deny`, decided by REQ-006

### Requirement: Otherwise permit

The app SHALL answer `permit` when no rule matches, because AxiomPolicy::permits: every observed axiom is declared, and an exact policy saw every declared one.

Verified: tested by the acceptance vectors.

#### Scenario: No rule matches

- **WHEN** the request is `listed source exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `permit`

### Requirement: The first matching rule decides

The app SHALL try REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-006 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 `unlisted core exact 0 0` (an acceptance example)
- **THEN** the answer SHALL be `not-applicable`, decided by REQ-003, the earlier rule

### Requirement: Request and answers

The app SHALL read one request as one line of 5 fields separated by single spaces, in this order, and SHALL answer exactly one of `permit`, `deny`, `not-applicable`, `indeterminate`, or `invalid` for anything else.

| Field | Accepts | Means |
| --- | --- | --- |
| `audit` | `listed`, `unlisted`, `failed`, `unparsed` | the audit of the declaration: listed in the output, absent from it, its member exited nonzero, or its output refused by the parser |
| `row` | `source`, `core` | a source declaration of a document, or a row of the document's core calculus |
| `policy` | `none`, `allow`, `exact` | the declared AxiomPolicy: noaxioms, allowaxioms or exactaxioms |
| `outside` | whole number from 0 up to 64 | observed axioms not in the declared list (for noaxioms, every observed axiom) |
| `unseen` | whole number from 0 up to 64 | declared axioms the audit did not observe |

| Answer | Means |
| --- | --- |
| `permit` | XACML 3.0 Permit: the observed set satisfies the policy and the declaration row records result ok |
| `deny` | XACML 3.0 Deny: the observed set violates the policy and verify fails with LLV7005 |
| `not-applicable` | XACML 3.0 NotApplicable: no observation applies, so the policy is not enforced on this row |
| `indeterminate` | XACML 3.0 Indeterminate: the audit could not be evaluated, so verify fails before any policy is judged |
| `invalid` | the request is malformed |

Verified: reading a request is tested, not proved.

#### Scenario: A malformed request is invalid

- **WHEN** the request is not 5 fields in this order
- **THEN** the answer SHALL be `invalid`

## Out of scope

- It does not run the audit: the observed set is read from the Lean axiom audit members of stage 9 and 10.
- It does not judge a model declaration's generated family, whose union LexLean compares with the model's declared set separately.

## Examples

- `listed source exact 0 0` gives `permit`
- `listed source exact 0 1` gives `deny`
- `listed source allow 0 2` gives `permit`
- `listed source none 1 0` gives `deny`
- `listed core allow 1 0` gives `deny`
- `unlisted core exact 0 0` gives `not-applicable`
- `unlisted source exact 0 0` gives `indeterminate`
- `failed source none 0 0` gives `indeterminate`
- `unparsed core exact 0 0` gives `indeterminate`
- `listed source exact 65 0` gives `invalid`

## What is proved and what is tested

Lean proves each property marked proved above, for every request that decodes, with no exceptions and no sampling. The proof is about `judge`, the function the WebAssembly guest runs, because both come from the same model.

The parsing of requests is tested, not proved: the acceptance vectors in the app replay through the built guest, including malformed and oversized requests.

Nothing here says the rules are the right rules. That is the part only you can judge.

## Files

- `prism/spec.json` is this spec as data.
- `src/LexleanAxiomPolicy.lex.tex` is the LexLean model generated from it. It is the single source of the app.

how-to guideBuildexampleMarkdown

Words on this page 7
record
One entry in a facet: a component, a threat, a measure or a journey step, with the place in the source it came from.
LexLean
The language Prism models are written in. It reads like LaTeX and compiles to Lean 4.
Lean kernel
The small checker at the heart of the Lean prover. It accepts a proof only if every step follows the rules.
theorem
A statement about the model that the Lean kernel has checked, so it holds for every input, not only the ones tested.
SDK
Software development kit. Here, the PrismPM container image that builds, checks and verifies Prism models.
stakeholder
A person or group with an interest in the system, as ISO/IEC/IEEE 42010 defines it.
XACML
OASIS eXtensible Access Control Markup Language 3.0: a policy decides permit, deny, not applicable or indeterminate.