Tutorial

Five short lessons that take you from Hello, world! to a self-healing live block whose contracts are discharged by Z3. Each one builds on the last. Every code snippet in every lesson is verified by docs/verify_tutorial_snippets.sh — if a snippet stops working, CI notices.

What you’ll build

  1. Hello, Resilient — install the compiler, run your first program, peek at the three execution backends.
  2. Variables and typeslet, primitives, optional type annotations, and how --typecheck catches mismatches.
  3. Functions and contractsfn + requires + ensures, and what --audit reports back.
  4. Live blocks — the self-healing construct: how retries work, how to read the runtime telemetry.
  5. Verifying with Z3 — build with --features z3, emit a certificate, re-verify it with stock Z3.

Conventions

Code blocks marked ```resilient are runnable as-is:

resilient path/to/snippet.rz

Copy-paste any one of them into a .rz file and run it. Install the VS Code extension for syntax highlighting and one-click run. See the syntax reference for the grammar.

If you’d rather start with the grand tour, the getting-started guide is the 60-second version; the tutorial is the 30-minute version.


Table of contents