PrismDevRelOpen the app
Reference: Prism source

Learn

The facets of a Prism app

Build

Prompt referencePrism source

// reference · Build

Prism source

The shared files every app is built on, and where each one comes from.

Every app the builder writes carries these 62 files, unchanged, beside its own model. They are the Foundation and Production modules that type its facets, and the LexLean language packages whose words name them. Each is a byte-for-byte copy of a file of UOR-Foundation/template or UOR-Foundation/PrismPM at a pinned commit. Its SHA-256 is recorded in builder/assets/provenance.json. The prism-code modules at the end write the behavior, and are copied byte for byte too.

What every app carriesLexLean modules: 6 files; Language packages: 3 files; Language entries: 52 files; prism-code modules: 5 filesLexLean modules6Language packages3Language entries52prism-code modules5
What every app carries. The files the builder copies into every app, by kind. None of them changes from app to app.
The data in this figure
files
LexLean modules6
Language packages3
Language entries52
prism-code modules5

LexLean modules

LexLean modules 6 rows
ModuleDeclaresImportsFrom
Foundation.Arch22 structures, 7 inductives, 2 classes, 2 instances, 10 definitions, 1 theoremlexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.arch@1.0.0UOR-Foundation/PrismPM@3db7f3e6
Foundation.Bytes2 inductives, 1 structure, 5 definitionslexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.arch@1.0.0UOR-Foundation/template@e79e0dcd
Foundation.Qual4 structures, 8 definitionslexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.qual@1.0.0UOR-Foundation/PrismPM@3db7f3e6
Foundation.Sec2 inductives, 5 structures, 6 definitionslexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.sec@1.0.0UOR-Foundation/PrismPM@3db7f3e6
Foundation.View.Text.V1.Model3 structures, 1 definitionlexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.arch@1.0.0UOR-Foundation/template@e79e0dcd
Production.ThreatModel2 inductives, 8 structures, 8 definitions, 5 theoremsFoundation.Sec, lexlean.std.bool@1.2.0, lexlean.std.nat@1.2.0, prism.arch@1.0.0, prism.sec@1.0.0UOR-Foundation/PrismPM@3db7f3e6

Foundation.Arch

app/src/Foundation/Arch.lex.tex, 410 lines, from UOR-Foundation/PrismPM@3db7f3e6.

Foundation.Arch 44 rows
DeclarationKindWord
Foundation.Arch::StandardReferencestructurestandards reference
Foundation.Arch::ComponentKindinductivearchitectural component kind
Foundation.Arch::EdgeKindinductivearchitectural edge kind
Foundation.Arch::ModelKindinductivearchitecture model kind
Foundation.Arch::Componentstructurearchitectural component
Foundation.Arch::Edgestructurearchitectural edge
Foundation.Arch::Stakeholderstructurestakeholder
Foundation.Arch::Concernstructurearchitectural concern
Foundation.Arch::Viewpointstructurearchitecture viewpoint
Foundation.Arch::Viewstructurearchitecture view
Foundation.Arch::ViewpointClassclassarchitecture viewpoint class
Foundation.Arch::ViewClassclassarchitecture view class
Foundation.Arch::canonicalViewpointinstance
Foundation.Arch::canonicalViewinstance
Foundation.Arch::componentGatewaydefinition
Foundation.Arch::componentAuthdefinition
Foundation.Arch::edgeIngressdefinition
Foundation.Arch::edgeReturnCycledefinition
Foundation.Arch::stakeholderOperatordefinition
Foundation.Arch::concernSecuritydefinition
Foundation.Arch::standardArchitectureDescriptiondefinition
Foundation.Arch::modelKindComponentsdefinition
Foundation.Arch::viewpointOperationsdefinition
Foundation.Arch::viewPrimarydefinition
Foundation.Arch::DesignDiagraminductivedesign diagram
Foundation.Arch::OpmThingKindinductiveOPM thing kind
Foundation.Arch::OpmLinkKindinductiveOPM link kind
Foundation.Arch::UmlMessageKindinductiveUML message kind
Foundation.Arch::SystemProcessstructuresystem process
Foundation.Arch::SystemStatestructuresystem state
Foundation.Arch::DesignViewstructuredesign view
Foundation.Arch::OpmThingstructureOPM thing
Foundation.Arch::OpmStatestructureOPM state
Foundation.Arch::OpmLinkstructureOPM link
Foundation.Arch::OpmZoomstructureOPM zoom
Foundation.Arch::UmlComponentstructureUML component
Foundation.Arch::UmlConnectorstructureUML connector
Foundation.Arch::UmlLifelinestructureUML lifeline
Foundation.Arch::UmlMessagestructureUML message
Foundation.Arch::UmlStatestructureUML state
Foundation.Arch::UmlTransitionstructureUML transition
Foundation.Arch::Featurestructurefeature
Foundation.Arch::Journeystructurejourney
Foundation.Arch::componentIdentityUniquetheorem
Source
\begin{lexlean}{Foundation.Arch}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\title{Boolean}
\begin{semanticmodule}
structure{
  name: StandardReference,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: standardIndex, type: Nat},
    {name: editionIndex, type: Nat},
    {name: standardId, type: String},
    {name: edition, type: String}
  ]
}

inductive{
  name: ComponentKind,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: service, fields: []},
    {name: database, fields: []},
    {name: externalSystem, fields: []},
    {name: cliAdapter, fields: []},
    {name: staticSite, fields: []},
    {name: releaseBinary, fields: []}
  ]
}

inductive{
  name: EdgeKind,
  type_parameters: [],
  parameters: [],
  constructors: [{name: dataFlow, fields: []}, {name: controlFlow, fields: []}]
}

inductive{
  name: ModelKind,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: componentModel, fields: []},
    {name: securityModel, fields: []},
    {name: qualityModel, fields: []}
  ]
}

structure{
  name: Component,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: kind, type: ComponentKind},
    {name: name, type: String},
    {name: text, type: String}
  ]
}

structure{
  name: Edge,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: fromIndex, type: Nat},
    {name: toIndex, type: Nat},
    {name: kind, type: EdgeKind}
  ]
}

structure{
  name: Stakeholder,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: name, type: String}, {name: text, type: String}]
}

structure{
  name: Concern,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: name, type: String}, {name: text, type: String}]
}

structure{
  name: Viewpoint,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: stakeholderIndex, type: Nat},
    {name: concernIndex, type: Nat},
    {name: modelKindIndex, type: Nat}
  ]
}

structure{
  name: View,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: viewpointIndex, type: Nat},
    {name: modelKindIndex, type: Nat}
  ]
}

class{
  name: ViewpointClass,
  type_parameters: [],
  parameters: [],
  fields: [{name: selectedModelKind, type: Nat}]
}

class{
  name: ViewClass,
  type_parameters: [],
  parameters: [],
  fields: [{name: selectedViewpoint, type: Nat}]
}

instance{
  name: canonicalViewpoint,
  fields: [{field: selectedModelKind, value: 0}],
  arguments: [],
  class: ViewpointClass,
  priority: 1000
}

instance{
  name: canonicalView,
  fields: [{field: selectedViewpoint, value: 0}],
  arguments: [],
  class: ViewClass,
  priority: 1000
}

definition{
  name: componentGateway,
  parameters: [],
  result: Component,
  body: (record Component {index := 1, kind := (ctor ComponentKind.service), name := "gateway", text := "Accepts external requests and forwards them to the authentication store."})
}

definition{
  name: componentAuth,
  parameters: [],
  result: Component,
  body: (record Component {index := 0, kind := (ctor ComponentKind.database), name := "auth", text := "Holds credentials and answers lookups from the gateway."})
}

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

definition{
  name: edgeReturnCycle,
  parameters: [],
  result: Edge,
  body: (record Edge {index := 1, fromIndex := 1, toIndex := 0, kind := (ctor EdgeKind.controlFlow)})
}

definition{
  name: stakeholderOperator,
  parameters: [],
  result: Stakeholder,
  body: (record Stakeholder {index := 0, name := "operator", text := "Runs the system in production and answers for its availability."})
}

definition{
  name: concernSecurity,
  parameters: [],
  result: Concern,
  body: (record Concern {index := 0, name := "security", text := "Credentials and requests must not be disclosed or altered in transit or at rest."})
}

definition{
  name: standardArchitectureDescription,
  parameters: [],
  result: StandardReference,
  body: (record StandardReference {standardIndex := 4, editionIndex := 0, standardId := "ISO-42010-2022", edition := "2022"})
}

definition{
  name: modelKindComponents,
  parameters: [],
  result: ModelKind,
  body: (ctor ModelKind.componentModel)
}

definition{
  name: viewpointOperations,
  parameters: [],
  result: Viewpoint,
  body: (record Viewpoint {index := 0, stakeholderIndex := 0, concernIndex := 0, modelKindIndex := 0})
}

definition{
  name: viewPrimary,
  parameters: [],
  result: View,
  body: (record View {index := 0, viewpointIndex := 0, modelKindIndex := 0})
}

inductive{
  name: DesignDiagram,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: opmObjectProcess, fields: []},
    {name: umlComponent, fields: []},
    {name: umlSequence, fields: []},
    {name: umlStateMachine, fields: []}
  ]
}

inductive{
  name: OpmThingKind,
  type_parameters: [],
  parameters: [],
  constructors: [{name: object, fields: []}, {name: process, fields: []}]
}

inductive{
  name: OpmLinkKind,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: agent, fields: []},
    {name: instrument, fields: []},
    {name: consumption, fields: []},
    {name: result, fields: []},
    {name: effect, fields: []},
    {name: invocation, fields: []},
    {name: aggregation, fields: []},
    {name: exhibition, fields: []},
    {name: generalization, fields: []},
    {name: classification, fields: []}
  ]
}

inductive{
  name: UmlMessageKind,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: synchronous, fields: []},
    {name: asynchronous, fields: []},
    {name: reply, fields: []}
  ]
}

structure{
  name: SystemProcess,
  type_parameters: [],
  parameters: [],
  fields: [{name: owner, type: String}]
}

structure{
  name: SystemState,
  type_parameters: [],
  parameters: [],
  fields: [{name: owner, type: String}]
}

structure{
  name: DesignView,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: title, type: String},
    {name: viewpoint, type: String},
    {name: diagram, type: DesignDiagram}
  ]
}

structure{
  name: OpmThing,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: view, type: String},
    {name: kind, type: OpmThingKind},
    {name: subject, type: String}
  ]
}

structure{
  name: OpmState,
  type_parameters: [],
  parameters: [],
  fields: [{name: view, type: String}, {name: thing, type: String}, {name: state, type: String}]
}

structure{
  name: OpmLink,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: view, type: String},
    {name: kind, type: OpmLinkKind},
    {name: source, type: String},
    {name: target, type: String}
  ]
}

structure{
  name: OpmZoom,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: view, type: String},
    {name: process, type: String},
    {name: subprocess, type: String},
    {name: order, type: Nat}
  ]
}

structure{
  name: UmlComponent,
  type_parameters: [],
  parameters: [],
  fields: [{name: view, type: String}, {name: component, type: String}]
}

structure{
  name: UmlConnector,
  type_parameters: [],
  parameters: [],
  fields: [{name: view, type: String}, {name: edge, type: String}]
}

structure{
  name: UmlLifeline,
  type_parameters: [],
  parameters: [],
  fields: [{name: view, type: String}, {name: component, type: String}, {name: order, type: Nat}]
}

structure{
  name: UmlMessage,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: view, type: String},
    {name: kind, type: UmlMessageKind},
    {name: order, type: Nat},
    {name: source, type: String},
    {name: target, type: String},
    {name: process, type: String}
  ]
}

structure{
  name: UmlState,
  type_parameters: [],
  parameters: [],
  fields: [{name: view, type: String}, {name: state, type: String}, {name: initial, type: Bool}]
}

structure{
  name: UmlTransition,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: view, type: String},
    {name: order, type: Nat},
    {name: source, type: String},
    {name: target, type: String},
    {name: trigger, type: String}
  ]
}

structure{
  name: Feature,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: statement, type: String},
    {name: calls, type: (List String)},
    {name: acceptance, type: (List String)}
  ]
}

structure{
  name: Journey,
  type_parameters: [],
  parameters: [],
  fields: [{name: actor, type: String}, {name: steps, type: (List String)}]
}

theorem{
  name: componentIdentityUnique,
  parameters: [value : Component],
  statement: (value = value),
  proof: reflexivity{}
}

theorem{name: cyclesPermitted, parameters: [], statement: (true = true), proof: reflexivity{}}
\end{semanticmodule}
\end{lexlean}

Foundation.Bytes

app/src/Foundation/Bytes.lex.tex, 69 lines, from UOR-Foundation/template@e79e0dcd.

DeclarationKindWord
Foundation.Bytes::ByteOrderinductive
Foundation.Bytes::BufferErrorinductive
Foundation.Bytes::BoundedBufferstructureBounded byte buffer
Foundation.Bytes::appendBytesdefinition
Foundation.Bytes::byteLengthdefinition
Foundation.Bytes::byteAtdefinition
Foundation.Bytes::sliceBytesdefinition
Foundation.Bytes::compareBytesdefinition
Source
\begin{lexlean}{Foundation.Bytes}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\title{Bounded byte buffer}
\begin{semanticmodule}
inductive{
  name: ByteOrder,
  type_parameters: [],
  parameters: [],
  constructors: [{name: LittleEndian, fields: []}, {name: BigEndian, fields: []}]
}

inductive{
  name: BufferError,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: OutOfBounds, fields: []},
    {name: LengthOverflow, fields: []},
    {name: NonCanonical, fields: []}
  ]
}

structure{
  name: BoundedBuffer,
  type_parameters: [],
  parameters: [],
  fields: [{name: bytes, type: Bytes}, {name: maximum, type: UInt64}]
}

definition{
  name: appendBytes,
  parameters: [left : Bytes, right : Bytes],
  result: Bytes,
  body: (prim append left right : Bytes)
}

definition{
  name: byteLength,
  parameters: [value : Bytes],
  result: Nat,
  body: (prim length value : Nat)
}

definition{
  name: byteAt,
  parameters: [value : Bytes, offset : Nat],
  result: (Option UInt8),
  body: (prim index value offset : (Option UInt8))
}

definition{
  name: sliceBytes,
  parameters: [value : Bytes, start : Nat, count : Nat],
  result: (Option Bytes),
  body: (prim slice value start count : (Option Bytes))
}

definition{
  name: compareBytes,
  parameters: [left : Bytes, right : Bytes],
  result: Ordering,
  body: (prim compare_bytes left right : Ordering),
  axioms: [propext]
}
\end{semanticmodule}
\end{lexlean}

Foundation.Qual

app/src/Foundation/Qual.lex.tex, 98 lines, from UOR-Foundation/PrismPM@3db7f3e6.

DeclarationKindWord
Foundation.Qual::ProductQualityCharacteristicstructurequality characteristic
Foundation.Qual::QualitySubcharacteristicstructurequality subcharacteristic
Foundation.Qual::QualityRequirementstructurequality requirement
Foundation.Qual::QualityMeasurestructurequality measure
Foundation.Qual::characteristicInteractionCapabilitydefinition
Foundation.Qual::characteristicMaintainabilitydefinition
Foundation.Qual::subcharacteristicInclusivitydefinition
Foundation.Qual::subcharacteristicModularitydefinition
Foundation.Qual::requirementModuleBoundariesdefinition
Foundation.Qual::requirementWcag1411ForcedColorsNonTextContrastdefinition
Foundation.Qual::requirementWcag413StatusMessagesdefinition
Foundation.Qual::measureDependencyCountdefinition
Source
\begin{lexlean}{Foundation.Qual}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.qual@1.0.0}
\title{Boolean}
\begin{semanticmodule}
structure{
  name: ProductQualityCharacteristic,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}]
}

structure{
  name: QualitySubcharacteristic,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: characteristicIndex, type: Nat}]
}

structure{
  name: QualityRequirement,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: subcharacteristicIndex, type: Nat}]
}

structure{
  name: QualityMeasure,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: requirementIndex, type: Nat},
    {name: threshold, type: Nat}
  ]
}

definition{
  name: characteristicInteractionCapability,
  parameters: [],
  result: ProductQualityCharacteristic,
  body: (record ProductQualityCharacteristic {index := 0})
}

definition{
  name: characteristicMaintainability,
  parameters: [],
  result: ProductQualityCharacteristic,
  body: (record ProductQualityCharacteristic {index := 1})
}

definition{
  name: subcharacteristicInclusivity,
  parameters: [],
  result: QualitySubcharacteristic,
  body: (record QualitySubcharacteristic {index := 0, characteristicIndex := 0})
}

definition{
  name: subcharacteristicModularity,
  parameters: [],
  result: QualitySubcharacteristic,
  body: (record QualitySubcharacteristic {index := 1, characteristicIndex := 1})
}

definition{
  name: requirementModuleBoundaries,
  parameters: [],
  result: QualityRequirement,
  body: (record QualityRequirement {index := 0, subcharacteristicIndex := 1})
}

definition{
  name: requirementWcag1411ForcedColorsNonTextContrast,
  parameters: [],
  result: QualityRequirement,
  body: (record QualityRequirement {index := 1, subcharacteristicIndex := 0})
}

definition{
  name: requirementWcag413StatusMessages,
  parameters: [],
  result: QualityRequirement,
  body: (record QualityRequirement {index := 2, subcharacteristicIndex := 0})
}

definition{
  name: measureDependencyCount,
  parameters: [],
  result: QualityMeasure,
  body: (record QualityMeasure {index := 0, requirementIndex := 0, threshold := 10})
}

theorem{name: qualityChainConsistent, parameters: [], statement: (0 = 0), proof: reflexivity{}}
\end{semanticmodule}
\end{lexlean}

Foundation.Sec

app/src/Foundation/Sec.lex.tex, 109 lines, from UOR-Foundation/PrismPM@3db7f3e6.

DeclarationKindWord
Foundation.Sec::Likelihoodinductivesecurity likelihood
Foundation.Sec::Impactinductivesecurity impact
Foundation.Sec::Assetstructuresecurity asset
Foundation.Sec::Riskstructuresecurity risk
Foundation.Sec::ApplicationSecurityControlstructuresecurity control
Foundation.Sec::SecurityActivitystructuresecurity activity
Foundation.Sec::VerificationMeasurementstructuresecurity verification measurement
Foundation.Sec::assetCredentialsdefinition
Foundation.Sec::threatUnauthorizedAccessdefinition
Foundation.Sec::riskUnauthorizedAccessdefinition
Foundation.Sec::controlMutualTlsdefinition
Foundation.Sec::activityRotateCredentialsdefinition
Foundation.Sec::measurementMutualTlsdefinition
Source
\begin{lexlean}{Foundation.Sec}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.sec@1.0.0}
\title{Boolean}
\begin{semanticmodule}
inductive{
  name: Likelihood,
  type_parameters: [],
  parameters: [],
  constructors: [{name: low, fields: []}, {name: medium, fields: []}, {name: high, fields: []}]
}

inductive{
  name: Impact,
  type_parameters: [],
  parameters: [],
  constructors: [{name: minor, fields: []}, {name: major, fields: []}, {name: critical, fields: []}]
}

structure{
  name: Asset,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: componentIndex, type: Nat}]
}

structure{name: Threat, type_parameters: [], parameters: [], fields: [{name: index, type: Nat}]}

structure{
  name: Risk,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: index, type: Nat},
    {name: assetIndex, type: Nat},
    {name: threatIndex, type: Nat},
    {name: likelihood, type: Likelihood},
    {name: impact, type: Impact}
  ]
}

structure{
  name: ApplicationSecurityControl,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: riskIndex, type: Nat}]
}

structure{
  name: SecurityActivity,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: controlIndex, type: Nat}]
}

structure{
  name: VerificationMeasurement,
  type_parameters: [],
  parameters: [],
  fields: [{name: index, type: Nat}, {name: controlIndex, type: Nat}, {name: passed, type: Bool}]
}

definition{
  name: assetCredentials,
  parameters: [],
  result: Asset,
  body: (record Asset {index := 0, componentIndex := 1})
}

definition{
  name: threatUnauthorizedAccess,
  parameters: [],
  result: Threat,
  body: (record Threat {index := 0})
}

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

definition{
  name: controlMutualTls,
  parameters: [],
  result: ApplicationSecurityControl,
  body: (record ApplicationSecurityControl {index := 0, riskIndex := 0})
}

definition{
  name: activityRotateCredentials,
  parameters: [],
  result: SecurityActivity,
  body: (record SecurityActivity {index := 0, controlIndex := 0})
}

definition{
  name: measurementMutualTls,
  parameters: [],
  result: VerificationMeasurement,
  body: (record VerificationMeasurement {index := 0, controlIndex := 0, passed := true})
}

theorem{name: riskChainConsistent, parameters: [], statement: (true = true), proof: reflexivity{}}
\end{semanticmodule}
\end{lexlean}

Foundation.View.Text.V1.Model

app/src/Foundation/View/Text/V1/Model.lex.tex, 64 lines, from UOR-Foundation/template@e79e0dcd.

DeclarationKindWord
Foundation.View.Text.V1.Model::TextViewstructure
Foundation.View.Text.V1.Model::AcceptanceVectorstructure
Foundation.View.Text.V1.Model::TextApplicationstructureText application model
Foundation.View.Text.V1.Model::textApplicationProfiledefinition
Source
\begin{lexlean}{Foundation.View.Text.V1.Model}
\useglossary{lexlean.std.bool@1.2.0}
\useglossary{lexlean.std.nat@1.2.0}
\useglossary{prism.arch@1.0.0}
\title{Text application model}
\begin{semanticmodule}
structure{
  name: TextView,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: title, type: String},
    {name: heading, type: String},
    {name: inputLabel, type: String},
    {name: submitLabel, type: String},
    {name: outputLabel, type: String},
    {name: inputError, type: String},
    {name: responseError, type: String}
  ]
}

structure{
  name: AcceptanceVector,
  type_parameters: [],
  parameters: [],
  fields: [{name: request, type: Bytes}, {name: response, type: Bytes}]
}

structure{
  name: TextApplication,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: profile, type: String},
    {name: name, type: String},
    {name: cargoName, type: String},
    {name: cargoVersion, type: String},
    {name: cargoDescription, type: String},
    {name: cargoRepository, type: String},
    {name: cargoHomepage, type: String},
    {name: libraryRoots, type: (List String)},
    {name: acceptanceVectors, type: (List AcceptanceVector)},
    {name: entryRoot, type: String},
    {name: coreContract, type: String},
    {name: requestMaximum, type: UInt32},
    {name: responseMaximum, type: UInt32},
    {name: guestAllocationMaximum, type: UInt32},
    {name: capabilitiesEmpty, type: Bool},
    {name: fatArchive, type: Bool},
    {name: primaryLayer, type: UInt8},
    {name: viewLayer, type: UInt8},
    {name: view, type: TextView}
  ]
}

definition{
  name: textApplicationProfile,
  parameters: [],
  result: String,
  body: "prismpm/text-application/1"
}
\end{semanticmodule}
\end{lexlean}

Production.ThreatModel

app/src/Production/ThreatModel.lex.tex, 213 lines, from UOR-Foundation/PrismPM@3db7f3e6.

Production.ThreatModel 23 rows
DeclarationKindWord
Production.ThreatModel::Strideinductive
Production.ThreatModel::EvidenceKindinductive
Production.ThreatModel::Evidencestructure
Production.ThreatModel::ControlSetstructure
Production.ThreatModel::ModeledAssetstructure
Production.ThreatModel::ModeledThreatstructure
Production.ThreatModel::ModeledControlstructure
Production.ThreatModel::ThreatMappingstructure
Production.ThreatModel::AcceptedRiskstructure
Production.ThreatModel::NormalizedThreatModelstructure
Production.ThreatModel::threatListLengthdefinition
Production.ThreatModel::threatAllPositivedefinition
Production.ThreatModel::validateThreatsAnswereddefinition
Production.ThreatModel::validateThreatCategoriesdefinition
Production.ThreatModel::validateControlEvidencedefinition
Production.ThreatModel::validateNormalizedThreatModeldefinition
Production.ThreatModel::normalizedThreatModelValiddefinition
Production.ThreatModel::normalizedThreatModel_sound_completetheorem
Production.ThreatModel::threatModelVectordefinition
Production.ThreatModel::threatModelVectorAcceptedtheorem
Production.ThreatModel::unmappedThreatRefusedtheorem
Production.ThreatModel::controlWithoutEvidenceRefusedtheorem
Production.ThreatModel::threatWithoutCategoryRefusedtheorem
Source
\begin{lexlean}{Production.ThreatModel}
\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}
\title{Boolean}
\begin{semanticmodule}
inductive{
  name: Stride,
  type_parameters: [],
  parameters: [],
  constructors: [
    {name: spoofing, fields: []},
    {name: tampering, fields: []},
    {name: repudiation, fields: []},
    {name: informationDisclosure, fields: []},
    {name: denialOfService, fields: []},
    {name: elevationOfPrivilege, fields: []}
  ]
}

inductive{
  name: EvidenceKind,
  type_parameters: [],
  parameters: [],
  constructors: [{name: gate, fields: []}, {name: proof, fields: []}, {name: review, fields: []}]
}

structure{
  name: Evidence,
  type_parameters: [],
  parameters: [],
  fields: [{name: kind, type: EvidenceKind}, {name: reference, type: String}]
}

structure{
  name: ControlSet,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: title, type: String},
    {name: text, type: String},
    {name: version, type: String},
    {name: lastModified, type: String}
  ]
}

structure{
  name: ModeledAsset,
  type_parameters: [],
  parameters: [],
  fields: [{name: asset, type: String}, {name: name, type: String}, {name: text, type: String}]
}

structure{
  name: ModeledThreat,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: threat, type: String},
    {name: name, type: String},
    {name: text, type: String},
    {name: category, type: Stride}
  ]
}

structure{
  name: ModeledControl,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: control, type: String},
    {name: name, type: String},
    {name: text, type: String},
    {name: evidence, type: (List Evidence)}
  ]
}

structure{
  name: ThreatMapping,
  type_parameters: [],
  parameters: [],
  fields: [{name: threat, type: String}, {name: controls, type: (List String)}]
}

structure{
  name: AcceptedRisk,
  type_parameters: [],
  parameters: [],
  fields: [{name: threat, type: String}, {name: rationale, type: String}]
}

structure{
  name: NormalizedThreatModel,
  type_parameters: [],
  parameters: [],
  fields: [
    {name: threatCount, type: Nat},
    {name: categoryCounts, type: (List Nat)},
    {name: mitigationCounts, type: (List Nat)},
    {name: acceptanceCounts, type: (List Nat)},
    {name: evidenceCounts, type: (List Nat)}
  ]
}

definition{
  name: threatListLength,
  parameters: [values : (List Nat)],
  result: Nat,
  body: (match values | List.nil => 0 | List.cons value rest => ((threatListLength rest) + 1)),
  recursive_argument: values
}

definition{
  name: threatAllPositive,
  parameters: [values : (List Nat)],
  result: Bool,
  body: (match values
    | List.nil => true
    | List.cons value rest => ((0 <? value) && (threatAllPositive rest))),
  recursive_argument: values
}

definition{
  name: validateThreatsAnswered,
  parameters: [mitigations : (List Nat), acceptances : (List Nat)],
  result: Bool,
  body: (match mitigations
    | List.nil => true
    | List.cons mitigation rest => (match acceptances
      | List.nil => ((0 <? mitigation) && (validateThreatsAnswered rest acceptances))
      | List.cons acceptance others => (((0 <? mitigation) || (0 <? acceptance)) && (validateThreatsAnswered rest others)))),
  recursive_argument: mitigations
}

definition{
  name: validateThreatCategories,
  parameters: [categoryCounts : (List Nat)],
  result: Bool,
  body: (threatAllPositive categoryCounts)
}

definition{
  name: validateControlEvidence,
  parameters: [evidenceCounts : (List Nat)],
  result: Bool,
  body: (threatAllPositive evidenceCounts)
}

definition{
  name: validateNormalizedThreatModel,
  parameters: [model : NormalizedThreatModel],
  result: Bool,
  body: (((threatListLength (project model categoryCounts)) =? (project model threatCount)) && (((threatListLength (project model mitigationCounts)) =? (project model threatCount)) && (((threatListLength (project model acceptanceCounts)) =? (project model threatCount)) && ((validateThreatCategories (project model categoryCounts)) && ((validateThreatsAnswered (project model mitigationCounts) (project model acceptanceCounts)) && (validateControlEvidence (project model evidenceCounts)))))))
}

definition{
  name: normalizedThreatModelValid,
  parameters: [model : NormalizedThreatModel],
  result: Prop,
  body: ((validateNormalizedThreatModel model) = true)
}

theorem{
  name: normalizedThreatModel_sound_complete,
  parameters: [model : NormalizedThreatModel],
  statement: (((validateNormalizedThreatModel model) = true) <-> (normalizedThreatModelValid model)),
  proof: reflexivity{}
}

definition{
  name: threatModelVector,
  parameters: [
    categoryCounts : (List Nat),
    mitigationCounts : (List Nat),
    acceptanceCounts : (List Nat),
    evidenceCounts : (List Nat)
  ],
  result: NormalizedThreatModel,
  body: (record NormalizedThreatModel {threatCount := 2, categoryCounts := categoryCounts, mitigationCounts := mitigationCounts, acceptanceCounts := acceptanceCounts, evidenceCounts := evidenceCounts})
}

theorem{
  name: threatModelVectorAccepted,
  parameters: [],
  statement: ((validateNormalizedThreatModel (threatModelVector (cons 1 (cons 1 (nil Nat))) (cons 2 (cons 0 (nil Nat))) (cons 0 (cons 1 (nil Nat))) (cons 1 (cons 2 (nil Nat))))) = true),
  proof: decide{}
}

theorem{
  name: unmappedThreatRefused,
  parameters: [],
  statement: ((validateNormalizedThreatModel (threatModelVector (cons 1 (cons 1 (nil Nat))) (cons 2 (cons 0 (nil Nat))) (cons 0 (cons 0 (nil Nat))) (cons 1 (cons 2 (nil Nat))))) = false),
  proof: decide{}
}

theorem{
  name: controlWithoutEvidenceRefused,
  parameters: [],
  statement: ((validateNormalizedThreatModel (threatModelVector (cons 1 (cons 1 (nil Nat))) (cons 2 (cons 0 (nil Nat))) (cons 0 (cons 1 (nil Nat))) (cons 1 (cons 0 (nil Nat))))) = false),
  proof: decide{}
}

theorem{
  name: threatWithoutCategoryRefused,
  parameters: [],
  statement: ((validateNormalizedThreatModel (threatModelVector (cons 1 (cons 0 (nil Nat))) (cons 2 (cons 0 (nil Nat))) (cons 0 (cons 1 (nil Nat))) (cons 1 (cons 2 (nil Nat))))) = false),
  proof: decide{}
}
\end{semanticmodule}
\end{lexlean}

Language packages

Each entry is a word of the controlled vocabulary an app's facet records are written in, and the declaration it denotes.

prism.arch 1.0.0

app/language/prism.arch/lexicon.toml, from UOR-Foundation/template@e79e0dcd.

prism.arch 1.0.0 40 rows
EntryWordDenotes
arch-componentarchitectural componentFoundation.Arch::Component
arch-component-kindarchitectural component kindFoundation.Arch::ComponentKind
arch-concernarchitectural concernFoundation.Arch::Concern
arch-design-diagramdesign diagramFoundation.Arch::DesignDiagram
arch-design-viewdesign viewFoundation.Arch::DesignView
arch-edgearchitectural edgeFoundation.Arch::Edge
arch-edge-kindarchitectural edge kindFoundation.Arch::EdgeKind
arch-featurefeatureFoundation.Arch::Feature
arch-journeyjourneyFoundation.Arch::Journey
arch-model-kindarchitecture model kindFoundation.Arch::ModelKind
arch-opm-linkOPM linkFoundation.Arch::OpmLink
arch-opm-link-kindOPM link kindFoundation.Arch::OpmLinkKind
arch-opm-stateOPM stateFoundation.Arch::OpmState
arch-opm-thingOPM thingFoundation.Arch::OpmThing
arch-opm-thing-kindOPM thing kindFoundation.Arch::OpmThingKind
arch-opm-zoomOPM zoomFoundation.Arch::OpmZoom
arch-stakeholderstakeholderFoundation.Arch::Stakeholder
arch-standard-referencestandards referenceFoundation.Arch::StandardReference
arch-system-processsystem processFoundation.Arch::SystemProcess
arch-system-statesystem stateFoundation.Arch::SystemState
arch-text-application-modelText application modelFoundation.View.Text.V1.Model::TextApplication
arch-uml-componentUML componentFoundation.Arch::UmlComponent
arch-uml-connectorUML connectorFoundation.Arch::UmlConnector
arch-uml-lifelineUML lifelineFoundation.Arch::UmlLifeline
arch-uml-messageUML messageFoundation.Arch::UmlMessage
arch-uml-message-kindUML message kindFoundation.Arch::UmlMessageKind
arch-uml-stateUML stateFoundation.Arch::UmlState
arch-uml-transitionUML transitionFoundation.Arch::UmlTransition
arch-viewarchitecture viewFoundation.Arch::View
arch-view-classarchitecture view classFoundation.Arch::ViewClass
arch-viewpointarchitecture viewpointFoundation.Arch::Viewpoint
arch-viewpoint-classarchitecture viewpoint classFoundation.Arch::ViewpointClass
holo-flat-validation-inputflat validation inputFoundation.Holo::FlatValidationInput
holo-normalized-featuresnormalized feature modelFoundation.Holo::NormalizedFeatures
holo-normalized-modelnormalized hologram modelFoundation.Holo::NormalizedHolo
holo-standards-profilefixed standards profileFoundation.Holo::StandardsProfile
prism-bounded-byte-bufferBounded byte bufferFoundation.Bytes::BoundedBuffer
prism-browser-system-modelBrowser-resident system modelProduction.BrowserSystem::SystemModel
prism-production-system-modelProduction system modelProduction.Core::Component
prism-unicode-text-codecUnicode text codecFoundation.Utf8::encode

prism.qual 1.0.0

app/language/prism.qual/lexicon.toml, from UOR-Foundation/PrismPM@3db7f3e6.

EntryWordDenotes
qual-characteristicquality characteristicFoundation.Qual::ProductQualityCharacteristic
qual-measurequality measureFoundation.Qual::QualityMeasure
qual-requirementquality requirementFoundation.Qual::QualityRequirement
qual-subcharacteristicquality subcharacteristicFoundation.Qual::QualitySubcharacteristic

prism.sec 1.0.0

app/language/prism.sec/lexicon.toml, from UOR-Foundation/PrismPM@3db7f3e6.

EntryWordDenotes
sec-activitysecurity activityFoundation.Sec::SecurityActivity
sec-assetsecurity assetFoundation.Sec::Asset
sec-controlsecurity controlFoundation.Sec::ApplicationSecurityControl
sec-impactsecurity impactFoundation.Sec::Impact
sec-likelihoodsecurity likelihoodFoundation.Sec::Likelihood
sec-measurementsecurity verification measurementFoundation.Sec::VerificationMeasurement
sec-risksecurity riskFoundation.Sec::Risk
sec-threatsecurity threatFoundation.Sec::Threat

prism-code journey

These modules check a prism/spec/1 spec and turn it into the LexLean model the app is built from. They come from the npm package prism-code 0.7.2. Each has the SHA-256 that VENDOR.md records.

prism-code journey 5 rows
ModuleWhat it doesSHA-256
spec.mjsThe Prism spec (`prism/spec/1`): what a decision app does, in the words a user gives it. One spec renders to one LexLean model (render.mjs), whose theorems Lean proves and whose acceptance vectors the guest replays.80f22a5ddd3f018d3711c067c1a93bd48b9f5627b459dac5710540c83c01104f
render.mjsRender a `prism/spec/1` spec into the LexLean model of a text application, its acceptance vectors and SPEC.md.55f784df40a34f36992cf397c4ff0ba55a5b89b498eca397cd910238e2def64f
session.mjsThe spec session: six questions, asked one at a time, each answer checked as it arrives. The spec is rebuilt from the raw answers every time, so an earlier answer can be revised and everything after it is checked again.73b2f266120a52d2951b5973afd664336748bb7c5693748207abcdd6c055a582
template.mjsThe files that make a guided-journey app an instance of UOR-Foundation/template, so it has the template's frame, page, gate and Pages URL.97885e092443ae6eb46060c976d9c6ee9ca9e138d8914e4f4ae32c0b9dad6ead
mcp.mjs`prism-code mcp`: the Prism MCP server, over stdio, with no dependencies.4da58794e4f5c1609ffaf2902419cb05300be39a21f69f05f55a64417c002740

referenceBuildMarkdown

Words on this page 3
facet
One view of a model, such as its architecture, its security or its quality. Each facet holds records.
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.