---
title: "Turn a Rust project into a Prism model"
url: https://afflom.github.io/prism-devrel/case-studies/uorust/getting-started/
diataxis: tutorial
developer-journey: learn
subject: https://github.com/afflom/uorust
commit: afd5cea950a8987da02bbf0cc7cca420b71c4b53
---

# Turn a Rust project into a Prism model

> Run UORust on a sample workspace and check what it writes. Then read a Rust function beside the LexLean it became.

Subject: [UORust](https://github.com/afflom/uorust) at commit [`afd5cea950a8`](https://github.com/afflom/uorust/tree/afd5cea950a8987da02bbf0cc7cca420b71c4b53), 331 facet records, source digest `f3f743b6834adaff`.

**Figure: What you do with UORust.** The four things this tutorial does, with the numbers UORust gives at commit afd5cea950a8.

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](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/Justfile). Every number is read from UORust at commit `afd5cea950a8`, so what you see is what you will get.

## 1. Get the SDK

Everything Prism runs in the PrismPM SDK image a repository's `prismpm.lock` pins. Follow the [Prism quickstart](https://uor.foundation/docs/get-started/quickstart). You need it for step 5. UORust itself needs only a Rust toolchain.

## 2. Get UORust

Check out the commit this page was generated from, so your output matches it byte for byte:

```sh
git clone https://github.com/afflom/uorust
cd uorust
git checkout afd5cea950a8987da02bbf0cc7cca420b71c4b53
```

## 3. Look at the workspace

`crates/uorust/tests/fixtures/thermostat` is a Cargo workspace of 2 crates (`thermo-core`, `thermo-cli`). These are all its files:

| File |
| --- |
| [Cargo.lock](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/Cargo.lock) |
| [Cargo.toml](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/Cargo.toml) |
| [thermo-cli/Cargo.toml](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-cli/Cargo.toml) |
| [thermo-cli/src/main.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-cli/src/main.rs) |
| [thermo-cli/tests/cli.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-cli/tests/cli.rs) |
| [thermo-core/Cargo.toml](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/Cargo.toml) |
| [thermo-core/examples/decide.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/examples/decide.rs) |
| [thermo-core/src/band.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/band.rs) |
| [thermo-core/src/config.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/config.rs) |
| [thermo-core/src/lib.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/lib.rs) |
| [thermo-core/src/roster.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/roster.rs) |
| [thermo-core/src/schedule.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/schedule.rs) |
| [thermo-core/src/sensor.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/sensor.rs) |
| [thermo-core/tests/config.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/tests/config.rs) |
| [thermo-core/tests/schedule.rs](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/tests/schedule.rs) |

## 4. Project it

```sh
cargo run -q --locked -p uorust -- project crates/uorust/tests/fixtures/thermostat --out thermostat-prism --name thermostat --last-modified 2026-11-11T00:00:00Z
```

UORust 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 |

## 5. Check it

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:

```sh
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:00Z
```

Then 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:

```sh
cd crates/uorust/tests/fixtures/thermostat-prism && lexlean fmt --check && lexlean lock --check && lexlean verify && prismpm check
```

Both 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

## 6. Read what was lifted

`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:

**Figure: Every function, by row kind.** Each of the 150 functions of the workspace has one row in frontier.toml. Lifted rows are LexLean definitions the kernel checks.

| | Count |
| --- | --- |
| refusal | 1 |
| residue | 5 |
| effect | 3 |
| lifted | 141 |

| 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](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat/thermo-core/src/band.rs):

`thermo-core/src/band.rs:57`

```rust
pub 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.tex`](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/crates/uorust/tests/fixtures/thermostat-prism/src/Behavior.lex.tex)

```lexlean
definition{
  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.

## 7. Now your workspace

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:

```sh
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.toml
```

UORust's gate does the same to its own workspace:

```sh
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](https://afflom.github.io/prism-devrel/case-studies/uorust/cli/). To publish the result, start a repository from [UOR-Foundation/template](https://github.com/UOR-Foundation/template). Put the projection in its `app/` and push to `main`. Its Pages workflow verifies, signs and deploys it ([Ship](https://uor.foundation/docs/guides/ship)).

## Next

- [How UORust was modeled](https://afflom.github.io/prism-devrel/case-studies/uorust/): why its own model is shaped as it is.
- [Architecture walkthrough](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/): Who UORust is for, what they care about, its parts and how they connect.
- [Design views in OPM and UML](https://afflom.github.io/prism-devrel/case-studies/uorust/design/): Every design view of UORust, drawn. It shows things, steps, parts, messages and states.
- [Features and journeys](https://afflom.github.io/prism-devrel/case-studies/uorust/features/): What UORust does, the calls that do it, the rows that accept it, and the paths people take.
- [Security and threat model](https://afflom.github.io/prism-devrel/case-studies/uorust/security/): The assets of UORust, its threats, risks and controls, and the risks it accepts on purpose.
- [Quality model (ISO/IEC 25010)](https://afflom.github.io/prism-devrel/case-studies/uorust/quality/): What good quality means for UORust, and the numbers that measure it.
- [Behavior and proofs](https://afflom.github.io/prism-devrel/case-studies/uorust/behavior/): Every theorem of UORust, and how it is proved. The Lean kernel checks each one.
- [System and release](https://afflom.github.io/prism-devrel/case-studies/uorust/system/): What UORust ships, its release manifest, and how its holo goes live.
- [Extension facets](https://afflom.github.io/prism-devrel/case-studies/uorust/extensions/): The records UORust adds of its own. They sit beside the standard facets.

## The journeys UORust plans for

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:

### `journeyDevRelAuthor`

`Features::journeyDevRelAuthor` · Journey · #152 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Features.lex.tex)

- actor: [`Architecture::stakeholderDevRelAuthor`](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/#Architecture-stakeholderDevRelAuthor)
- steps:
  - [`Features::featureBrowserRoutes`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureBrowserRoutes)
  - [`Features::featureRouteFacts`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureRouteFacts)
  - [`Features::featureSelfModel`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureSelfModel)

Taught by: getting-started, features

### `journeyMaintainer`

`Features::journeyMaintainer` · Journey · #153 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Features.lex.tex)

- actor: [`Architecture::stakeholderMaintainer`](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/#Architecture-stakeholderMaintainer)
- steps:
  - [`Features::featureSelfModel`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureSelfModel)
  - [`Features::featureRouteFacts`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureRouteFacts)
  - [`Features::featureDeterministicOutput`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureDeterministicOutput)
  - [`Features::featureCheckProjection`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureCheckProjection)

Taught by: getting-started, features

### `journeyPrismModeler`

`Features::journeyPrismModeler` · Journey · #154 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Features.lex.tex)

- actor: [`Architecture::stakeholderPrismModeler`](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/#Architecture-stakeholderPrismModeler)
- steps:
  - [`Features::featureRouteFacts`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureRouteFacts)
  - [`Features::featureRefuseAmbiguity`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureRefuseAmbiguity)
  - [`Features::featureLiftBehavior`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureLiftBehavior)
  - [`Features::featureCheckedOutput`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureCheckedOutput)

Taught by: getting-started, features

### `journeyRustDeveloper`

`Features::journeyRustDeveloper` · Journey · #155 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Features.lex.tex)

- actor: [`Architecture::stakeholderRustDeveloper`](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/#Architecture-stakeholderRustDeveloper)
- steps:
  - [`Features::featureProjectWorkspace`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureProjectWorkspace)
  - [`Features::featureCheckedOutput`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureCheckedOutput)
  - [`Features::featureDeterministicOutput`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureDeterministicOutput)
  - [`Features::featureCheckProjection`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureCheckProjection)

Taught by: getting-started, features

### `journeySecurityReviewer`

`Features::journeySecurityReviewer` · Journey · #156 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Features.lex.tex)

- actor: [`Architecture::stakeholderSecurityReviewer`](https://afflom.github.io/prism-devrel/case-studies/uorust/architecture/#Architecture-stakeholderSecurityReviewer)
- steps:
  - [`Features::featureProjectWorkspace`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureProjectWorkspace)
  - [`Features::featureRefuseAmbiguity`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureRefuseAmbiguity)
  - [`Features::featureTypedErrors`](https://afflom.github.io/prism-devrel/case-studies/uorust/features/#Features-featureTypedErrors)

Taught by: getting-started, features

### `UORust`

`Routes::application` · TextApplication · #207 · [source](https://github.com/afflom/uorust/blob/afd5cea950a8987da02bbf0cc7cca420b71c4b53/app/src/Routes.lex.tex)

- profile: `prismpm/text-application/3`
- cargoName: `uorust-routes`
- cargoVersion: `0.1.1`
- cargoDescription: `Routes each kind of Rust fact UORust reads from a Cargo workspace to the one Prism record kind it emits, or refuses it.`
- cargoRepository: `https://github.com/afflom/uorust`
- cargoHomepage: `https://afflom.github.io/UORust/`
- libraryRoots:
  - `Uorust.Routes.dispatch`
- acceptanceVectors: `(acceptanceVectors)`
- entryRoot: `Uorust.Routes.dispatch`
- coreContract: `hologram:guest/core-wasm@1`
- requestMaximum: `(318 : UInt32)`
- responseMaximum: `(8192 : UInt32)`
- guestAllocationMaximum: `(319 : UInt32)`
- coreMemoryPages: `(ctor Option.some [UInt32] (32 : UInt32))`
- coreStackBytes: `(ctor Option.some [UInt32] (65536 : UInt32))`
- capabilitiesEmpty: `true`
- fatArchive: `true`
- primaryLayer: `(0 : UInt8)`
- viewLayer: `(1 : UInt8)`
- view: TextView
  - title: `UORust route table`
  - heading: `UORust route table`
  - inputLabel: `Rust fact kinds, one per line`
  - submitLabel: `Route`
  - outputLabel: `Route or refusal`
  - inputError: `Enter UTF-8 text of at most 512 bytes.`
  - responseError: `The answer could not be displayed.`
- cli: TextCli
  - command: `route`
  - description: `UORust 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. `
  - usageCode: `(64 : UInt8)`
  - ioCode: `(74 : UInt8)`
  - limitCode: `(ctor Option.none [UInt8])`
  - outcomes:
    - TextCliOutcome
      - name: `routed`
      - prefix: `route `
      - exitCode: `(0 : UInt8)`
    - TextCliOutcome
      - name: `refused`
      - prefix: `refused `
      - exitCode: `(1 : UInt8)`
    - TextCliOutcome
      - name: `error`
      - prefix: `error `
      - exitCode: `(2 : UInt8)`
  - sections:
    - TextCliSection
      - title: `REQUEST`
      - body: `One kind of Rust fact per line, such as pub-fn, error-enum or unsafe-block. Every line must name the same route. `
    - TextCliSection
      - title: `ANSWER`
      - body: `    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 `
  - examples:
    - TextCliExample
      - name: `routed`
      - text: `error-enum`
    - TextCliExample
      - name: `ambiguous`
      - text: `error-enum state-enum`
- workbench: `(ctor Option.some [Foundation.View.Text.V3.Model::WorkbenchView] (Guide::view))`

Taught by: getting-started, case-study, slides

