Packages
muro
0.24.1
0.24.5
0.24.4
0.24.3
0.24.2
0.24.1
0.24.0
0.23.2
0.23.1
0.23.0
0.22.72
0.22.71
0.22.70
0.22.69
0.22.68
0.22.67
0.22.66
0.22.65
0.22.64
0.22.63
0.22.62
0.22.61
0.22.60
0.22.59
0.22.58
0.22.57
0.22.56
0.22.55
0.22.54
0.22.53
0.22.52
0.22.51
0.22.50
0.22.49
0.22.48
0.22.47
0.22.45
0.22.44
0.22.43
0.22.42
0.22.41
0.22.40
0.22.39
0.22.38
0.22.36
0.22.35
0.22.34
0.22.33
0.22.32
0.22.31
0.22.30
0.22.29
0.22.28
0.22.27
0.22.26
0.22.25
0.22.24
0.22.23
0.22.22
0.22.21
0.22.20
0.22.19
0.22.18
0.22.17
0.22.16
0.22.15
0.22.14
0.22.13
0.22.12
0.22.11
0.22.10
0.22.9
0.22.6
0.22.5
0.22.4
0.22.1
0.22.0
0.21.20
0.21.19
0.21.18
0.21.17
0.21.16
0.21.15
0.21.14
0.21.6
0.21.0
0.20.45
0.20.42
0.20.40
0.20.36
0.20.35
0.20.34
0.20.33
0.20.32
0.20.31
0.20.30
0.20.26
0.20.24
0.20.20
0.20.19
0.20.18
0.20.17
0.20.16
0.20.15
0.20.14
0.20.12
0.20.8
0.20.7
0.20.6
0.20.4
0.20.3
0.20.1
0.20.0
0.19.7
0.19.6
0.19.5
0.19.4
0.19.1
0.19.0
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.0
0.16.78
0.16.77
0.16.76
0.16.75
0.16.73
0.16.70
0.16.69
0.16.57
0.16.51
0.16.39
0.16.37
0.16.36
0.16.32
0.16.30
0.16.29
0.16.28
0.16.27
0.16.25
0.16.24
0.16.23
0.16.22
0.16.19
0.16.17
0.16.16
0.16.15
0.16.12
0.16.11
0.16.10
0.16.9
0.16.8
0.16.7
0.16.6
0.16.5
0.16.4
0.16.3
0.16.2
0.16.1
0.15.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.6.0
0.5.0
0.3.0
0.2.1
0.2.0
0.1.0
An explicit affine dependent type theory
Current section
Files
Jump to
Current section
Files
README.md
<p align="center">
<a href="https://muro-lang.dev"><img src="assets/muro-logo.png" alt="Muro" width="180"></a>
</p>
<h1 align="center">Write the program and its proof in one file. Ship ordinary code.</h1>
<p align="center">
<a href="https://hex.pm/packages/muro"><img src="https://img.shields.io/hexpm/v/muro?style=flat-square&label=hex&labelColor=111111&color=e8e8e8" alt="Hex version"></a>
</p>
muro checks your spec when you compile, then ships only the code that runs: no proof overhead in the binary. Targets include Elixir (BEAM), C, Rust, Zig, Go, and JavaScript.
Nothing is inferred. An agent writes every type and every proof step. The checker accepts the file or names each definition that fails, so you can trust the check without trusting the agent.
[60-second tour](#60-second-tour) · [Install](#install) · [Docs](https://muro-lang.dev/docs) · [For agents](https://muro-lang.dev/docs/for-agents)
<!-- muro:what-is:start -->
Muro is a programming language for programs that come with proofs. A .muro file holds three kinds of definition: spec (what something means), evidence (a proof about a program) and run (the program). `muro check` accepts the file or names each definition that fails; nothing is inferred. Proofs are checked at compile time and gone at run time: only run definitions are compiled, to Elixir, C, Rust, Zig, Go or JavaScript, among other targets. Muro also checks protocols between processes (sessions, choreographies, and temporal properties such as leads_to). It is designed for AI agents to write and for people to review.
<!-- muro:what-is:end -->
[muro on Hex](https://hex.pm/packages/muro) is published by the [murolang](https://hex.pm/users/murolang) organization. Current release: 0.24.1. Releases are listed in [CHANGELOG.md](CHANGELOG.md).
## Why muro
- **Proofs, not only samples.** A test checks inputs you thought of. A proof covers every input, checked at compile time and gone at run time.
- **Protocols, not only functions.** Sessions for two processes, choreographies for several, `may fail` when a party may crash, and `leads_to` for "this state is always followed by that one."
- **Built for agents.** Every step is written out. An error names the definition, the `line:col`, and the expected term.
- **Keep your stack.** Elixir or a GenServer, C or a NIF, Rust, Zig, Go, or an ES module with TypeScript types. Book equations become ExUnit, pytest, Rust, or C# tests for code you already have.
- **Fast where it matters.** [muro-http](https://github.com/murolang/muro-http) serves a checked HTTP core from C. Numbers: [Built with muro](#built-with-muro).
## 60-second tour
The self-contained binary carries its own Erlang runtime. This page names the version this release ships:
```
mise use -g github:murolang/muro@0.24.1
```
The transcript below was run with muro 0.22.64. The acceptance line is the same. The first line of `muro check` is the version that ran.
```
curl -fsSL -o half_ok.muro https://raw.githubusercontent.com/murolang/muro/main/examples/half_ok.muro
muro check half_ok.muro
```
```
Muro v0.22.64
All terms check. Evidence never becomes a run.
```
Three definitions, trimmed. `IsEven` is the spec, `half` is the program, `half_ok` is the proof that twice `half n` is `n` when `n` is even. The file also defines `plus` and `plus_suc`.
```
-- What "even" means. Not a program.
def IsEven : spec Π (n : Nat) → Type := …
-- The program. This is what will run.
def half : run Π (n : Nat) → Nat :=
λ (n : Nat) →
match n motive (λ _ → Nat)
| 0 => 0
| suc n1 =>
match n1 motive (λ _ → Nat)
| 0 => 0
| suc p => suc(half p)
-- Twice half n is n, when n is even.
def half_ok : evidence Π (n : Nat) → Π (e : IsEven n) →
{plus (half n) (half n) ≡ n : Nat} := …
```
Break `half`: in the last arm, change `suc(half p)` to `half p`. Check exits 1 and names the proof:
```
Muro v0.22.64
half_ok.muro:37:1: half_ok body: cannot convert suc(plus (half n) suc(half n)) ≁ match match n motive (λ x → Nat) | 0 => 0 | suc n => …
```
Restore the file. Emit JavaScript and run it. Node on the machine that recorded this was v26.8.2.
```
muro emit half_ok.muro --backend js
node -e 'import("./half_ok.mjs").then(m => console.log(m.half(8n)))'
```
```
./half_ok.mjs
./half_ok.d.ts
./half_ok.d.mts
4n
```
The proof is gone from the output. The program is what runs.
## Protocols in 15 lines
`examples/may-fail-free.muro` is a server and a task. The task may crash. The checker accepts that the server still finishes. Comments at the top of the file are omitted here.
```
data Report : Type where
ok : Report
session task-work := send Report end
session server-wait := recv Report end
conform task : task-work := put ok done
conform server : server-wait :=
get (r : Report) done
fail
done
meet free : server with task may fail buffer 1
temporal freed : free := (server at first get) leads_to (server done)
```
```
muro check may-fail-free.muro
```
```
Muro v0.22.64
temporal freed: holds in 5 reachable states, 6 transitions
All terms check. Evidence never becomes a run.
```
Both arms are `done`, so the server finishes on the report and on the crash. `leads_to` says that waiting is followed by done.
Several parties share one script in [`examples/two-phase-commit.muro`](examples/two-phase-commit.muro): a coordinator and two participants prepare, then commit or abort together.
## What you get
| Target | Flag | What it writes |
| --- | --- | --- |
| Elixir | (default) | module on stdout; public `run` is `def` |
| OTP | `--backend otp` | a GenServer per session |
| State machine | `--backend fsm` | machines, dispatchers, monitors, on stdout |
| C | `--backend c` | `.h` and `.c`; a `Nat` run is a NIF |
| Rust | `--backend rust` | `.rs` |
| Zig | `--backend zig` | `.zig` |
| Go | `--backend go` | `.go`: machines, monitors, dispatchers, runs |
| JavaScript | `--backend js` | `.mjs`, `.d.ts`, `.d.mts`; a cross is `create(host)` |
| Assembly | `--backend asm` | Cortex-M0 `.s`, `Nat` runs |
| MBI | `--backend mbi` | one graded `.mbi` run, for [muro-beam](https://github.com/doctorcorral/muro-beam) |
| ExUnit | `--backend exunit` | closed equations as ExUnit |
| pytest | `--backend pytest` | the same equations as pytest |
| Rust tests | `--backend rust-test` | the same equations as Rust tests |
| C# tests | `--backend csharp-test` | the same equations as C# xUnit |
| Family JSON | `--backend family-json` | hold graph as JSON |
| Mermaid | `--backend mermaid` | one flowchart per family; one sequence per choreography family |
`--backend otp` and `--backend fsm` run a `may fail` arm (`down` on the machine). `--backend go` emits it when every failure arm is `finish` or `leave`. Elixir, C, Rust, Zig, JavaScript, assembly, and the four test backends refuse that book with `c:mayfail`.
## Install
Three ways. Which copy of the compiler runs, and how words and host codecs are emitted, is in [Start](manual/start.md) and [The executable](manual/binary.md).
**Binary** (no Elixir required):
```
mise use -g github:murolang/muro@0.24.1
muro check path.muro
```
**Mix archive**, in any directory:
```
mix archive.install hex muro
```
Pinned: `mix archive.install hex muro 0.24.1`. From a checkout: `mix archive.build && mix archive.install muro-0.24.1.ez`. From GitHub, Mix fetches the default branch and builds the archive: `mix archive.install github murolang/muro`.
**Hex dependency:**
```elixir
def deps do
[
{:muro, "~> 0.24.1"}
]
end
```
## Built with muro
- **[muro-http](https://github.com/murolang/muro-http).** HTTP/1.1 core (classifier, connection, response bytes) as muro books, served from C. Hello-world in [`bench/perf3-2026-11-23.md`](https://github.com/murolang/muro-http/blob/main/bench/perf3-2026-11-23.md): 4 workers, keep-alive GET, 128 connections, 6-byte `hello`, median of three 5-second runs, 0 errors: 236,145 req/s, nginx 1.30.7 at 221,140, h2o 2.3.0-DEV at 243,011. About 7% ahead of nginx and about 3% behind h2o. CI runs ASan/UBSan and a libFuzzer smoke test.
- **[muro_plug](https://github.com/murolang/muro_plug).** Plug and Phoenix on Thousand Island: HTTP/1.1, TLS, WebSockets, permessage-deflate. The checked step book decides each HTTP/1.1 protocol fact. Not yet on Hex.
- **[muro_visor](https://hex.pm/packages/muro_visor)** 0.5.2. Read-only explorer for a checked book. Source is `ui/` in this repository.
- **[muro-beam](https://github.com/doctorcorral/muro-beam).** A virtual machine for `.mbi` images. Early design.
## How we know the checker is right
The checker is what you trust. Its rules are a formal model, machine-checked in Agda (a proof assistant) under `agda/`. You never install Agda. `muro check` is the whole interface.
For the core (functions, data, pairs, equality, streams), acceptance means the rules derive the definition, a spec or proof never becomes running code, and no closed normal evidence term has type Empty. Normalisation of every closed proof is not proved. Outside those theorems: termination of accepted recursion, temporal checks including `may fail`, tensors, and atoms. CI checks the Agda tree under `--safe`, with no postulates, on every push to main. See [How we know the checker is right](manual/proofs.md) and [Limits](manual/limits.md).
## Docs
The book is [`manual/`](manual/index.md). [muro-lang.dev/docs](https://muro-lang.dev/docs) renders it. The list is [`manual/manifest.yml`](manual/manifest.yml).
- **Start.** [Start](https://muro-lang.dev/docs/start) · [For agents](https://muro-lang.dev/docs/for-agents) · [Examples](https://muro-lang.dev/docs/examples)
- **Language.** [Marks](https://muro-lang.dev/docs/marks) · [The wall](https://muro-lang.dev/docs/wall) · [Terms](https://muro-lang.dev/docs/language) · [Grammar](https://muro-lang.dev/docs/grammar) · [Library](https://muro-lang.dev/docs/library) · [Reals](https://muro-lang.dev/docs/reals)
- **Protocols.** [Sessions](https://muro-lang.dev/docs/sessions) · [Temporal](https://muro-lang.dev/docs/temporal) · [Choreography](https://muro-lang.dev/docs/choreography) · [State machines](https://muro-lang.dev/docs/fsm)
- **Backends.** [Emit](https://muro-lang.dev/docs/emit) · [Go](https://muro-lang.dev/docs/go) · [MBI](https://muro-lang.dev/docs/mbi)
- **Reference.** [Limits](https://muro-lang.dev/docs/limits) · [How we know](https://muro-lang.dev/docs/proofs)
## Contributing
Two jobs. Do not mix them.
| You want to… | Do this |
| --- | --- |
| Write a program | Add a `.muro` file. Check it with `mix muro.check`. Do not change the kernel. |
| Change the type theory | Follow [Extending](manual/extending.md). Agda first, then the matching Elixir. |
```
mise install
mix deps.get
mix test
mix muro.check
mix muro.check examples/half_ok.muro
```
Kernel only, Agda 2.8+ and standard library 2.3:
```
git clone --depth 1 --branch v2.3 https://github.com/agda/agda-stdlib.git vendor/agda-stdlib
make agda
```
`Muro.Lexer.tokenize/1` returns `{kind, start, stop}` spans. A rejected snippet still yields spans, and joining them gives the source back. `Muro.MakeupLexer` maps them to Makeup tags (`"muro"`, `.muro`) when the app starts. `Muro.Check.check_sig/2` returns `:ok` or every definition error, in book order, each on its own process. Names: Muro, theory MuroTT, files `.muro`, Elixir `Muro.Check` / `Muro.Emit` / `Muro.Parser`, Agda `Muro.*`.
Agents follow [`manual/for-agents.md`](manual/for-agents.md). If this file and that page disagree, that page wins.