journeyDevRelAuthor
- actor
Architecture::stakeholderDevRelAuthor- steps
Taught by Turn a Rust project into a Prism model, Features and journeys
// tutorial · Learn
Run UORust on a sample workspace and check what it writes. Then read a Rust function beside the LexLean it became.
Subject: UORust at commit afd5cea950a8, 331 facet records, source digest f3f743b6834adaff.
| Step | What happens |
|---|---|
| 1. Pick a workspace | thermostat: 2 crates, 15 files |
| 2. Project it | 81 files of Prism source |
| 3. Check it | the Lean kernel checks every theorem |
| 4. Read the lift | 141 of 150 functions lifted |
In this tutorial you run UORust on thermostat, the workspace UORust tests itself with. You check what it writes with the locked SDK. Then you read one Rust function beside the LexLean definition UORust lifted it to. Every command is a line UORust's own gate runs: the uorust recipe of its Justfile. Every number is read from UORust at commit afd5cea950a8, so what you see is what you will get.
Everything Prism runs in the PrismPM SDK image a repository's prismpm.lock pins. Follow the Prism quickstart. You need it for step 5. UORust itself needs only a Rust toolchain.
Check out the commit this page was generated from, so your output matches it byte for byte:
git clone https://github.com/afflom/uorust
cd uorust
git checkout afd5cea950a8987da02bbf0cc7cca420b71c4b53crates/uorust/tests/fixtures/thermostat is a Cargo workspace of 2 crates (thermo-core, thermo-cli). These are all its files:
cargo run -q --locked -p uorust -- project crates/uorust/tests/fixtures/thermostat --out thermostat-prism --name thermostat --last-modified 2026-11-11T00:00:00ZUORust reads the workspace through cargo metadata, Cargo.lock and its own Rust syntax reader. It routes every fact through its route table. Then it writes 81 files into thermostat-prism/: prismpm.toml, lexlean.toml, one module per facet, the register and scenarios, frontier.toml, and the uorust.manifest that lists them all.
--name and --last-modified fix two inputs that would otherwise come from the directory name and the last commit. So a second run writes the same bytes. The modules hold these records:
| Facet | Records |
|---|---|
| Architecture | 29 |
| Design views | 839 |
| Features and journeys | 10 |
| Security and threat model | 71 |
| Quality | 30 |
| Behavior and proofs | 68 |
First ask UORust whether a directory holds exactly the projection. This is the line its gate runs, against the projection committed beside the fixture. Point --out at thermostat-prism to check yours:
cargo run -q --locked -p uorust -- check crates/uorust/tests/fixtures/thermostat --out crates/uorust/tests/fixtures/thermostat-prism --name thermostat --last-modified 2026-11-11T00:00:00ZThen run three checks inside the SDK image. LexLean confirms the modules are canonical and locked. The Lean kernel checks every definition and theorem. PrismPM checks every facet, from design views to the threat model:
cd crates/uorust/tests/fixtures/thermostat-prism && lexlean fmt --check && lexlean lock --check && lexlean verify && prismpm checkBoth commands exit 0. UORust's gate holds these registered claims at every commit:
UE-01:
uorust projects the fixture workspace into exactly the committed Prism project, which lexlean fmt, lexlean lock and prismpm check accept
UE-16:
A lifted function never turns unlifted: every function of product code has exactly one row of the lift register, keyed by the κ of its crate path and normalized tokens and typed as lifted, residue (with its cause), foreign (naming the registry crate of its type) or effect (naming the operating-system effect), a lifted row may carry a divergence saying where its definition parts from the Rust function (such as a Unicode table LexLean does not bind) and no other row carries one, and a projection that decides a κ the committed register records as lifted exactly as diverging, or a κ it records as lifted (the fixture's frontier.toml, this workspace's frontier.toml) as anything else is refused; a changed function is a new question, and the unlifted rows are the distance to the requirement that every function lifts, reported as an open claim and never a ceiling
thermostat-prism/frontier.toml gives every function of the workspace exactly one row. A lifted row names the LexLean definition the function became. The other rows say why a function was not lifted, so nothing is left out unseen:
| Row | Rows | Meaning |
|---|---|---|
| refusal | 1 | A fact the router proposed and admission would not decide, kept as an open claim. |
| residue | 5 | A pure function outside the lift so far, with the construct that stopped it. |
| effect | 3 | The I/O shell. It reads files, the environment, a process or the network, and is recorded as a capability in the security facet. |
| lifted | 141 | The function became a LexLean definition the kernel checks. |
The first lifted row is thermo_core::band::above. Here is the function, at thermo-core/src/band.rs:57:
thermo-core/src/band.rs:57pub fn above(readings: &[u32], target: u32) -> u32 {
match readings {
[] => 0,
[first, rest @ ..] => {
if *first > target {
above(rest, target).saturating_add(1)
} else {
above(rest, target)
}
}
}
}Behavior::above, in src/Behavior.lex.texdefinition{
name: above,
parameters: [readings : (List Nat), target : Nat],
result: Nat,
body: (match readings
| List.nil => 0
| List.cons firstValue1 rest => (if (target <? firstValue1) then (if (((above rest target) + 1) <? 4294967296) then ((above rest target) + 1) else 4294967295) else (above rest target))),
recursive_argument: readings
}The Lean kernel checked that definition in step 5. The projection's theorems and acceptance rows are stated over definitions like it.
Run the same two commands on your own workspace. Without --name and --last-modified, UORust takes the name from the directory and the time from its last commit. --register keeps a lift register. project writes it and check requires it to be current. A function the committed register records as lifted can never come back unlifted. Commit the register beside your workspace:
cargo run -q --locked -p uorust -- project path/to/workspace --out path/to/prism-project --register path/to/workspace/frontier.toml
cargo run -q --locked -p uorust -- check path/to/workspace --out path/to/prism-project --register path/to/workspace/frontier.tomlUORust's gate does the same to its own workspace:
cargo run -q --locked -p uorust -- check . --out target/uorust-self --name uorust --last-modified 2026-11-11T00:00:00Z --register frontier.toml {{mir}}Every option is in the UORust command reference. To publish the result, start a repository from UOR-Foundation/template. Put the projection in its app/ and push to main. Its Pages workflow verifies, signs and deploys it (Ship).
UORust's own model names a journey for each of its stakeholders, and the application record its holo is built from. This tutorial is the start of the Rust developer's journey:
Architecture::stakeholderDevRelAuthorTaught by Turn a Rust project into a Prism model, Features and journeys
Architecture::stakeholderMaintainerTaught by Turn a Rust project into a Prism model, Features and journeys
Architecture::stakeholderPrismModelerTaught by Turn a Rust project into a Prism model, Features and journeys
Architecture::stakeholderRustDeveloperTaught by Turn a Rust project into a Prism model, Features and journeys
Taught by Turn a Rust project into a Prism model, Features and journeys
prismpm/text-application/3uorust-routes0.1.1Routes each kind of Rust fact UORust reads from a Cargo workspace to the one Prism record kind it emits, or refuses it.https://github.com/afflom/uorusthttps://afflom.github.io/UORust/Uorust.Routes.dispatch(acceptanceVectors)Uorust.Routes.dispatchhologram:guest/core-wasm@1(318 : UInt32)(8192 : UInt32)(319 : UInt32)(ctor Option.some [UInt32] (32 : UInt32))(ctor Option.some [UInt32] (65536 : UInt32))truetrue(0 : UInt8)(1 : UInt8)UORust route tableUORust route tableRust fact kinds, one per lineRouteRoute or refusalEnter UTF-8 text of at most 512 bytes.The answer could not be displayed.routeUORust reads a Cargo workspace and writes a complete Prism model of it. This page runs UORust's route table, the verified function that decides which Prism record each kind of Rust fact becomes, or refuses the fact.
(64 : UInt8)(74 : UInt8)(ctor Option.none [UInt8])routedroute (0 : UInt8)refusedrefused (1 : UInt8)errorerror (2 : UInt8)REQUESTOne kind of Rust fact per line, such as pub-fn, error-enum or unsafe-block. Every line must name the same route.
ANSWER route ID, fact KIND, record PRISM-RECORD, facet FACET
the one route every kind names
refused unknown-fact, fact KIND
no route names the kind
refused ambiguous, fact KIND, fact KIND
two kinds name different routes
error REASON
the request is empty, too large, not UTF-8 or has a blank line
routederror-enumambiguouserror-enum
state-enum(ctor Option.some [Foundation.View.Text.V3.Model::WorkbenchView] (Guide::view))Taught by Turn a Rust project into a Prism model, How UORust was modeled, Slides and video script