Om, a small terracotta machine under a watercolor glass dome

Learn to read
Omega

Omega is a proof-checked systems language whose programs are data-oriented state machines. There is no if statement, no loop keyword, and no implicit self: a program is explicit states, exhaustive transitions, fixed-layout data, and contracts the compiler refuses to guess.

In practice, an agent will write most of your Omega. Your job is to specify the state graph, data bounds, and service reach up front, and to know when to send the agent's work back.

IA Program Is a MachineAn Omega program has no main function and no ambient OS access. It starts in a machine that declares which outside services it reaches.IIStates, Not IfsBranching is a transition that picks which machine runs next, or a match that picks a value. Looping is a machine that calls itself as its last action, so the stack does not grow.IIIFields Are the MemoryMachines do not own hidden fields. Persistent state lives in explicit data declarations with fixed layouts and is passed in by value or reference.IVChoice Is a Value TooSum types are data declarations with case members. You inspect them through exhaustive transition or match dispatch, and the data's requires clause can constrain each case's payload.VWriting for the ProverDefault integer arithmetic is Exact: every operation, index, and narrowing cast is a proof obligation. If the checker cannot prove a step fits, compilation stops.VIThe Boundary WallMachines never call OS syscalls or globals directly. Every external effect crosses a boundary trait, appears in reaches, and is wired to a provider by the build.VIIThe Build MachineBuild configuration is Omega source, not a separate manifest format. build.omg is an ordinary checked machine that declares the package kind, dependencies, and per-target entry bindings.VIIIText Is a BlockCore has no format strings or String type; text is bytes. Fixed [u8; N] byte arrays and borrowed @[u8] slices make every buffer size and index proof explicit.IX--check Is the Flooromega --check proves type, domain, ownership, and reach contracts. It does not prove your algorithm computed the intended answer — run both the interpreter and native binary.XWorking With the AgentAn agent can write Omega quickly once the machine graph, data bounds, and capabilities are pinned. Your job is to specify those three up front and verify the run.XIOne Whole ProgramEverything in one twenty-line program: it counts the base-10 digits of 2026 with a nested machine that calls itself, and exits with status 4.

Every code figure follows the Omega language guide and compiles under the reference compiler. Hover or click any circled number to trace the line its note explains.

A Program Is a Machine

An Omega program has no main function and no ambient OS access. It starts in a machine that declares which outside services it reaches.

The smallest whole program

1use {omega}/language/core/process_exit.omg;1
2use {omega}/language/core/process_authority.omg;
3use {system}/console.omg;2
4
5machine start() reaches |process_authority|::​StandardOutput + |process_exit|::​ProcessExit {3
6|console|::​Console::​write_line("Hello, Omega.");4
7|process_exit|::​ProcessExit::​exit_process(0);5
8}
1

The first two imports name the core services this entry can reach: ProcessExit ends the process, and StandardOutput covers writing to its designated output stream.

2

Brings in the Console boundary trait. The standard library supplies the provider for each hosted target, and build.omg can select another one.

3

machine declares a state machine with no implicit state or self. reaches StandardOutput + ProcessExit allows writing to the process’s designated standard output and exiting the process.

4

Console::write_line calls the boundary contract statically. The source never names a platform handle or syscall.

5

ProcessExit::exit_process(0) terminates the process domain with status 0. Printing never implies permission to exit, so the signature names both services.

What the supervisor reads

Review agent-written Omega in three passes: first the reaches clause (what outside services it can touch), then the data declarations (what memory it owns and its bounds), and finally the graph of machines (how control moves). If those three are honest, the implementation inside each machine is boxed in by the checker.

Capabilities first, data layout second, transitions between machines third. Every review in this guide follows that order.

States, Not Ifs

Branching is a transition that picks which machine runs next, or a match that picks a value. Looping is a machine that calls itself as its last action, so the stack does not grow.

A guard picks the next machine

1machine choose(flag: bool) -> u64 {
2transition flag {1
3true -> yes(),
4_ -> no()2
5}
6
7machine yes() -> u64 { 70u64 }3
8machine no() -> u64 { 71u64 }
9}
10
11machine main() -> u64 { choose(true) }4
1

transition evaluates its subject once and runs only the first arm that matches. The chosen arm is the last thing the machine does, so its result becomes the machine's result.

2

_ covers every remaining value. Transition arms must cover every possible value, so every path has a destination.

3

yes is a machine nested inside choose. Nesting only limits where the name is visible; yes has its own signature and contract and is not a closure over choose's parameters. The old state declaration is retired: there is one kind of machine.

4

A machine that holds no persistent state needs no data declaration. Its inputs and return type are its entire interface. main is an ordinary name here: nothing runs it unless the build binds it as the program's entry (Chapter VII).

A machine that calls itself is a loop

1machine countdown(n: u64) -> u64 {
2transition n > 0u64 {
3true -> tick(n),
4_ -> n
5}
6machine tick(n: u64) -> u64
7requires n > 0u64
8{1
9let next: u64 = n - 1;
10transition next > 0u64 {2
11true -> tick(next),3
12_ -> next4
13}
14}
15}
16
17machine main() -> u64 { countdown(5u64) }
1

A nested machine is checked against its own contract, not against whatever was true where it was called. tick writes requires n > 0u64 itself; the guard on line 2 is what lets the call on line 3 establish it.

2

Unsigned n - 1 is legal because tick's requires says n > 0. A nested machine may also leave requires out: the compiler then infers n > 0 from the subtraction and checks it at every call. Once you write a requires, it must cover everything the body needs (spec: private entry inference).

3

tick tests next > 0 explicitly: the call tick(next) on the next line must establish tick's requires for its new argument.

4

tick(next) calls tick again with a smaller argument, as the last thing the arm does, so it compiles to a jump and the stack does not grow. Self-calls in last position replace while and for loops.

When reviewing a loop, check two things: the contract that proves the step cannot underflow, and the value that strictly decreases on every back-edge. A machine that promises to finish also writes terminates by n -> Nat::Descending (see the termination spec).

Reading the graph

Ask the agent for the list of nested machines and the transitions between them before asking for code. Good machine names describe stages of the domain workflow (scan, wipe, done); vague names (step2, helper, process) mean the control flow has not been designed yet.

Machine names are the cheapest design review you can run, and the fastest way to catch a muddled design.

Fields Are the Memory

Machines do not own hidden fields. Persistent state lives in explicit data declarations with fixed layouts and is passed in by value or reference.

The data block is the data model

1data Room {
2label: [u8; 4];1
3}
4
5data Level {
6rooms: [Room; 2];2
7ticks: i32 in Wrapping;3
8}
9
10machine rename(level: @mutable Level) {4
11level.rooms[1].label[0] = 82; // 'R'5
12level.ticks = level.ticks + 1;
13}
14
15machine main() {
16let mutable level: Level = Level {6
17rooms: [
18Room { label: "room" },
19Room { label: "hall" }
20],
21ticks: 0 as +Wrapping,
22};
23rename(@mutable level);
24}
1

[u8; 4] is a fixed-length array of four bytes stored inline. Capacity is part of the type, not a runtime allocation.

2

[Room; 2] nests two Room records inline inside Level. The element count is part of the type, so Level has a fixed size.

3

i32 in Wrapping qualifies the field with modular two's-complement arithmetic, allowing level.ticks + 1 without an upper-bound proof. A plain literal never picks up a domain by itself, so the initial value is written 0 as +Wrapping (line 21).

4

@mutable Level lends mutable access to level for the duration of the call. There is no implicit self parameter, and the data is always an ordinary parameter.

5

Constant indices 1 and 0 are statically in bounds against [Room; 2] and [u8; 4], so the checker discharges both array bounds automatically.

6

Record construction names every field. let mutable is required here: writing a local's fields or lending it with @mutable or @write both need a mutable binding, and without it the call on line 23 is rejected (spec: owned local mutability).

If an agent starts threading five loose parameters through every nested machine, stop and have it group that state into a data record with explicit field types.

Choice Is a Value Too

Sum types are data declarations with case members. You inspect them through exhaustive transition or match dispatch, and the data's requires clause can constrain each case's payload.

Three cases, one value

1data Phase [copy] {1
2case Red;2
3case Green;
4case Yellow;
5}
6
7data Light [copy] {
8phase: Phase;
9advances: i32 in Wrapping;
10}
11
12machine next(phase: Phase) -> Phase {
13transition {3
14phase == Phase::​Red -> Phase::​Green,
15phase == Phase::​Green -> Phase::​Yellow,
16_ -> Phase::​Red4
17}
18}
19
20machine advance(light: Light) -> Light {
21Light {5
22phase: next(light.phase),
23advances: light.advances + 1,6
24}
25}
26
27machine main() {
28let light: Light = Light {
29phase: Phase::​Red,
30advances: 0 as +Wrapping,
31};
32let once: Light = advance(light);
33let twice: Light = advance(once);
34let again: Light = advance(light);7
35}
1

Owned data is affine by default (move at most once). Marking a pure value type [copy] makes it unrestricted so passing it does not consume the binding.

2

case Red; declares one variant of Phase. A Phase value is always one of its declared cases.

3

Guard-list transition { ... } tests boolean conditions in order and evaluates only the chosen arm.

4

The _ fallback completes exhaustive coverage and returns Phase::Red when phase is Yellow.

5

A record literal supplies every field. There is no struct-update shorthand (..old): a final bare .. only waives fields, it never copies them from another value, so advance names every field.

6

Because advances carries i32 in Wrapping, the addition uses modular wrapping semantics automatically.

7

light was already passed on line 32, and [copy] lets line 34 use it again. Without [copy], the checker rejects the second use because a moved affine binding holds no value.

match and transition share one pattern vocabulary, including case patterns and payload bindings: match produces a value, while transition chooses what runs next.

Cases carry cargo

1data Reply
2requires (self in Reply::​Miss)1
3|| ((self in Reply::​Hit) && self.value >= 0 && self.value <= 255)2
4{
5case Hit(value: i32);
6case Miss;
7}
8
9machine read(reply: Reply) -> i32 {
10transition reply {3
11Reply::​Hit { value } -> keep(value),4
12Reply::​Miss -> miss()5
13}
14
15machine keep(value: i32) -> i32
16requires value >= 0 && value <= 2556
17{
18value
19}
20machine miss() -> i32 { 0 }
21}
22
23machine main() -> i32 {
24let reply: Reply = Reply::​Hit { value: 66 };7
25read(reply)
26}
1

A requires clause on the data states what holds for every value; self is the whole value. Reply::Miss carries no payload, so nothing more is asked of it.

2

A case test on the left of && permits reading that case's payload on the right. Constructing Reply::Hit must prove value is in 0..=255; matching Hit hands that fact back.

3

Subject-form transition reply dispatches on the active case of reply. Every declared case must be handled.

4

Reply::Hit { value } destructures the payload by field name and calls keep(value). The 0..=255 fact is known here, but keep is checked against its own contract, so it states that range as its own requires.

5

Reply::Miss has no payload fields, so the variant path alone matches it.

6

keep's requires is what its body may rely on. The call on line 11 must establish it, and the case invariant is what lets it.

7

The literal 66 satisfies 0..=255 at compile time. Change it to 300 and construction is rejected: construction is the gate for the data's requires.

Standard-library ByteRead uses this exact pattern: case Eof; and case Byte(value: i32); under a data requires that bounds the byte to 0..=255.

Writing for the Prover

Default integer arithmetic is Exact: every operation, index, and narrowing cast is a proof obligation. If the checker cannot prove a step fits, compilation stops.

Contracts are part of the signature

1machine bounded(input: u16) -> u16
2requires input <= 255u161
3ensures result <= input2
4{
5transition { _ -> finish(input) }3
6
7machine finish(saved: u16) -> u16 {4
8saved
9}
10}
1

requires states a precondition the caller must establish before invoking bounded; the body may rely on it. It is a proof obligation at each call, not a runtime check.

2

ensures states the postcondition guaranteed on normal return, using the reserved name result for the returned value.

3

finish(input) is the last thing bounded does, so finish's result becomes bounded's result.

4

How the checker proves result <= input: (1) finish is in the same file, so the checker reads its body, which returns saved unchanged; (2) the call passes input as saved, so the result equals input; (3) input <= input, which is what bounded promised. Nothing needed an ensures on finish here. Code outside this verification unit, such as another package, sees only a machine's written contract, so a machine meant for outside callers writes the guarantees they need. This matters because a promise is only as good as the proof behind it.

When the prover refuses an expression, do not fight the syntax. Tighten a precondition, hoist an intermediate value into a guarded transition, or declare an explicit overflow policy.

An empty body is a claim

1machine less_than_transitive(a: u64, b: u64, c: u64)
2requires
3a < b1
4b < c
5ensures
6a < c
7{
8}2
1

Multiple requires rows combine as premises that hold on entry.

2

A machine with an empty body is a pure compile-time lemma: the checker must derive a < c directly from a < b and b < c.

samples/cli/proofs/math_proofs builds a whole chain of arithmetic lemmas this way. It is a compile-checked sample: the lemmas are the point, not a program to run.

What a refusal reads like

omega --check
1error: exact arithmetic in machine `rename` state `entry`1
2assignment may overflow `i32`: the operands are not provably in range2
3(decision 17 -- exact arithmetic is a proof obligation).3
4Widen with an `as` cast to a larger type, constrain the operands'4
5range (bound a parameter with a `requires` clause, or narrow a value
6with a dominating guard), or opt into a defined-overflow domain
7(`i32 in Wrapping`/`Saturating`/`Trapping`).
1

The omega --check diagnostic when in Wrapping is removed from ticks in Chapter III. The compiler prints it on one line; line breaks are added here, and it ends with the source position.

2

may overflow means the range proof is missing, not that a specific input overflowed. Every Exact operation owes a proof that its result fits the carrier.

3

decision 17 is the compiler's own label for the rule. The rule itself is in wiki/spec/language/numeric_values.md: there is no implicit widening, and Exact arithmetic must fit its carrier.

4

Every refusal lists the legal repairs: widen with as, bound the inputs with requires or a guard, or qualify the type with Wrapping, Saturating, or Trapping.

The Boundary Wall

Machines never call OS syscalls or globals directly. Every external effect crosses a boundary trait, appears in reaches, and is wired to a provider by the build.

Reach is declared, then checked

1use {omega}/language/core/process_exit.omg;
2use {omega}/language/core/process_authority.omg;
3use {system}/console.omg;
4
5machine start() reaches |process_authority|::​StandardOutput + |process_exit|::​ProcessExit {1
6|console|::​Console::​write_line("through one wall");2
7|process_exit|::​ProcessExit::​exit_process(0);3
8}
1

reaches StandardOutput + ProcessExit is a conservative upper bound on the external services this machine (and anything it calls) may touch.

2

Console::write_line writes to the process’s designated standard output. The build selects the provider that implements the call.

3

This entry machine returns no value; it ends the process explicitly through ProcessExit::exit_process. The compiler rejects an entry machine that returns a value.

Audit reaches first during code review. A sorting helper or parser that asks to reach StandardOutput or ProcessExit is a design bug.

A contract, and who fills it

1public boundary trait Clock {1
2machine now() -> u642
3reaches Clock3
4crashes none;
5}
6
7public FakeClock satisfies Clock {4
8machine now() -> u64 {5
91000u64
10}
11}
12
13machine uptime() -> u64 reaches Clock {6
14Clock::​now()
15}
1

boundary trait defines a portable external interface by signature only. public exports the declaration across package boundaries.

2

Requirements can also publish operational envelopes (suspends, blocks, crashes Trap); callers must acknowledge them at the call site with suspend or block.

3

A boundary requirement explicitly names Clock in its own reaches row. The trait name is never added implicitly.

4

FakeClock satisfies Clock declares a named implementation. It is not a data type with machines attached to it, and it holds no state: anything that must outlive a call is a value the service returns and the caller passes back.

5

The implementation's machine inherits Clock::now's contract, and the checker verifies the body refines it.

6

uptime calls Clock::now() against the trait and declares reaches Clock, staying decoupled from FakeClock. The build selects which implementation answers Clock.

block Console::read_byte() may wait for the process’s designated standard input. With reaches StandardInput, a caller can read a byte, see ByteRead::Eof, or handle a host read failure as ByteRead::Error.

The Build Machine

Build configuration is Omega source, not a separate manifest format. build.omg is an ordinary checked machine that declares the package kind, dependencies, and per-target entry bindings.

Wiring, declared

build.omg
1use {omega}/build/dependency.omg;
2use main.omg;
3
4machine build(builder: @mutable Build) {1
5Build::​application(builder, "learn_omega");2
6let system_registration: DependencyRegistration = Build::​dependency(builder, |dependency|::​from_source(Source::​Bundled {3
7name: "system"
8}));
9Build::​bind(4
10builder,
11windows_x86_64::​ProgramEntry,5
12|main|::​start
13);
14Build::​bind(6
15builder,
16linux_x86_64::​ProgramEntry,
17|main|::​start
18);
19Build::​bind(
20builder,
21linux_arm64::​ProgramEntry,
22|main|::​start
23);
24Build::​bind(
25builder,
26macos_arm64::​ProgramEntry,
27|main|::​start
28);
29}
1

build.omg defines machine build(builder: @mutable Build). It is parsed, type-checked, and evaluated under the same rules as application code.

2

Build::application declares an executable root (libraries use Build::package; workspaces use Build::member). Mixing or repeating kinds is rejected.

3

Build::dependency registers the standard library from a source so main.omg can import the Console trait. Dependencies come only from this registration; imports never add one.

4

Build::bind connects a target's ProgramEntry slot to the free entry machine start. Naming start selects the entry without allocating hidden state.

5

A project with dependencies records its accepted resolution in omega.lock; omega packages update acquires and reviews it (spec: package acceptance).

6

Each hosted target (windows_x86_64, linux_x86_64, linux_arm64, macos_arm64) binds its own ProgramEntry to the same portable start machine. A required slot with no binding for the selected target is an error.

Read build.omg first when reviewing a package: it shows every dependency, provider selection, and target entry point in one place.

Text Is a Block

Core has no format strings or String type; text is bytes. Fixed [u8; N] byte arrays and borrowed @[u8] slices make every buffer size and index proof explicit.

Pad it yourself

1use {omega}/language/core/process_exit.omg;
2use {omega}/language/core/process_authority.omg;
3use {system}/console.omg;
4
5machine clear(line: @mutable [u8; 28]) {1
6transition { _ -> scan(line, 0u64) }
7
8machine scan(line: @mutable [u8; 28], k: u64) {2
9transition k < 28u64 {3
10true -> wipe(line, k),
11_ -> done()
12}
13}
14
15machine wipe(line: @mutable [u8; 28], k: u64) {
16line[k] = 32;4
17transition { _ -> scan(line, k + 1u64) }5
18}
19
20machine done() { }
21}
22
23machine main() reaches |process_authority|::​StandardOutput + |process_exit|::​ProcessExit {
24let mutable line: [u8; 28] =6
25"this text is about to vanish";
26clear(@mutable line);
27|console|::​Console::​write_line(@line[..]);7
28|process_exit|::​ProcessExit::​exit_process(0);
29}
1

@mutable [u8; 28] borrows a mutable 28-byte array. Its static length 28 travels with the type.

2

Nested machines do not capture the enclosing machine's parameters or locals, so scan takes both the borrowed line and the current index k explicitly.

3

The guard k < 28u64 is the bounds proof. wipe writes no requires, so the compiler infers one from its body (k < 28) and checks it at every call; on the true edge into wipe the call establishes it. Once you write a requires yourself, it must cover everything the body needs.

4

line[k] = 32 writes ASCII space (0x20). Zero-initialized bytes are NUL (0x00), so fixed-width output buffers are padded with spaces before printing.

5

Because wipe is only entered with k < 28u64, k + 1u64 is provably <= 28 and cannot overflow u64.

6

An ASCII string literal initializes a [u8; N] array of the exact matching byte length (here 28 bytes).

7

@line[..] borrows the full [u8; 28] array as a @[u8] byte slice for Console::write_line.

Formatting integers works the same way: divide by 10, take % 10, add 48 ('0'), and write into a space-padded [u8; N] buffer.

--check Is the Floor

omega --check proves type, domain, ownership, and reach contracts. It does not prove your algorithm computed the intended answer — run both the interpreter and native binary.

What the check does and doesn't say

Verification stepWhat it actually establishes
omega --check passesTypes, range proofs, affine moves, exhaustive transitions, and reaches ceilings all hold statically.
The repository sample gate passesThe Psi interpreter and native binary each execute the sample and match its expected observations.
Output bytes inspectedStdout bytes, space padding, line endings, and the exit code match the specification.
--check aloneProves the program is safe to run, not that a constant return or wrong formula solved the problem.

Choose test inputs whose expected result can only appear if the machine genuinely ran its loop.

In the Omega repository, run a capability fact with mbx xtask sample-gate --filter <sample-path> to check its native and Psi observations.

The exit code is an answer

1use {omega}/language/core/process_exit.omg;
2use {omega}/language/core/process_authority.omg;
3use {system}/console.omg;
4
5// Expected exit: 70.1
6machine start() reaches |process_authority|::​StandardOutput + |process_exit|::​ProcessExit {
7let sorted: u64 in Wrapping = (64u64 + 6u64) as +Wrapping;2
8|console|::​Console::​write_line("ten shelves, sorted");
9|process_exit|::​ProcessExit::​exit_process(sorted as -Wrapping as i32);3
10}
1

Executable samples declare an // Expected exit: N oracle comment at the top of main.omg, and the test harness verifies the exact status code.

2

u64 in Wrapping opts into modular arithmetic. A domain is gained or dropped only by a cast that names it: as +Wrapping adds it here. On line 9, as -Wrapping drops it first and as i32 then converts to the i32 status exit_process takes.

3

Real samples encode their computed result in the exit status (bubble_sort exits with 10, collatz_sequence with 111, and generic_counters with 16).

When an agent writes a sample that always exits 0 without checking its computed result against the oracle, send it back.

Working With the Agent

An agent can write Omega quickly once the machine graph, data bounds, and capabilities are pinned. Your job is to specify those three up front and verify the run.

A brief that produces real Omega

Give the agent a four-part brief before it writes code: (1) the machine names and the transitions between them, (2) the data records with exact array lengths and range/overflow domains, (3) the allowed reaches services, and (4) the non-trivial expected exit code or output bytes. When the checker rejects a line, require the agent to reshape the machine graph or tighten a contract rather than papering over the expression with Wrapping.

Most agent failures come from inventing fields mid-machine or slapping in Wrapping onto a loop counter whose termination depends on not wrapping.

Check the program with omega --check, then run the sample gate or its registered Build tests to verify the expected behavior.

The review checklist

SurfaceQuestion to ask
reaches ceilingDoes each machine declare only the external services it genuinely needs?
data layoutAre all persistent values stored in fixed-size records with explicit requires or domain bounds?
Borrowing (@ / @mutable)Are parameters borrowed @mutable only when the machine actually mutates them?
Machine graphDo machine names reflect domain steps, and does every loop edge shrink a clear measure?
Transition coverageAre case dispatches exhaustive without silent catch-all arms hiding unhandled variants?
Proof obligationsAre bounds the true domain range rather than arbitrary buffer capacities or lazy Wrapping?
Execution oracleDid the compiled binary run, and do the stdout bytes and exit code match the oracle?

Use the checklist alongside the actual execution results for the cases the machine must handle.

One Whole Program

Everything in one twenty-line program: it counts the base-10 digits of 2026 with a nested machine that calls itself, and exits with status 4.

The program, whole

1use {omega}/language/core/process_exit.omg;
2use {omega}/language/core/process_authority.omg;
3use {system}/console.omg;
4
5// Expected exit: 4.
6machine start() reaches |process_authority|::​StandardOutput + |process_exit|::​ProcessExit {1
7transition { _ -> count(2026u64, 0u8 as +Wrapping) }2
8
9machine count(n: u64, digits: u8 in Wrapping) {3
10transition n >= 10u64 {4
11true -> count(n / 10u64, digits + 1u8),5
12_ -> report(digits + 1u8)
13}
14}
15
16machine report(digits: u8 in Wrapping) {
17|console|::​Console::​write_line("counted the digits");
18|process_exit|::​ProcessExit::​exit_process(digits as -Wrapping as i32);6
19}
20}
1

Read the capability ceiling first: start may write to the designated standard output and terminate via ProcessExit, and nothing else.

2

Setup finishes with an unconditional transition into count(2026u64, 0u8), seeding the loop's initial arguments. The literal 0u8 gains the Wrapping domain only through the cast as +Wrapping; passing it to a Wrapping parameter does not add it.

3

digits: u8 in Wrapping qualifies the accumulator with wrapping arithmetic, and digits as -Wrapping as i32 (line 17) first drops the domain, then converts explicitly: Omega has no implicit widening, and every u8 value fits an i32.

4

n >= 10u64 partitions the loop: values with at least two digits left continue; single-digit remainders finish in report.

5

The back-edge count(n / 10u64, digits + 1u8) divides n by 10u64 (a nonzero constant divisor), strictly shrinking n on every iteration.

6

Exits with 4 — the four digits of 2026 — matching the // Expected exit: 4 oracle at the top of the file.

Because n and digits travel as state parameters across the loop, the program needs no data block at all.

What the check did not tell you

omega --check proved that 10u64 is a nonzero divisor, digits + 1u8 has a defined overflow policy, digits as -Wrapping as i32 is in range, every transition arm lands in a valid state, and only StandardOutput and ProcessExit are reached. It did not prove that 2026 has 4 digits rather than 5 — running the binary and checking exit code 4 against the oracle closes that loop.

Static proof guarantees the machine's invariants and safety boundaries; execution against an oracle verifies its domain answer.

Glossary

The core vocabulary used by the Omega language guide, specification, and compiler diagnostics.

machine
A state machine with explicit inputs, an optional return type, and a declared service ceiling (reaches). Entry points, helpers, and loops are all machines; there is no implicit self receiver.
state
A named internal control point inside a machine with its own parameter frontier. Jumping to a state transfers control without pushing a call frame.
transition
The control-transfer statement that ends a setup block or state body. Arms test a subject or guard list and jump to a state or return a value.
guard
A boolean condition or pattern on a transition arm. Guard facts propagate into the target state, and all arms together must be exhaustive.
data
A nominal record or sum-type declaration with a fixed compile-time layout and no hidden fields or default initializers.
case
One named variant of a data sum type (case Red; or case Hit(value: i32)). Inspected exhaustively through transition dispatch.
payload
The fields carried by a case variant, optionally constrained by a case-local where clause (case Hit(value: i32) where value in 0..=255;).
[copy]
Marks a pure value type as unrestricted so passing or assigning it duplicates the bits instead of consuming the binding.
affine
The default ownership multiplicity for data: an owned value may move at most once, after which the old binding holds no value.
reaches
A machine's conservative external-service ceiling, written reaches StandardOutput + ProcessExit. Calling a service outside that ceiling is rejected.
boundary trait
A portable external interface declared by machine signatures (public boundary trait Clock). Each member states its own reaches row and any suspends, blocks, or crashes envelope.
provider
A stateless type whose satisfies machines implement a boundary trait for a target or test harness (FakeClock::now satisfies Clock::now).
static boundary call
Calling a boundary requirement directly by trait path (Console::write_line(...)); the build selects the concrete provider for each target.
domain
A zero-cost static theory or policy attached to a value (i32 in Wrapping, Player::Alive), checked at compile time with no runtime tag.
arithmetic policy
The overflow contract on an integer type. Plain integers are Exact (every operation must be proven in range); in Wrapping, in Saturating, and in Trapping select defined overflow behavior.
proof obligation
A static requirement the compiler must discharge — array bounds, exact arithmetic range, exhaustive dispatch, or precondition entailment — before accepting the program.
requires / ensures
Machine contract clauses: requires states preconditions the caller must establish; ensures states postconditions guaranteed about result on normal return.
build machine
machine build(builder: @mutable Build) in build.omg: ordinary checked Omega code that declares the package kind, dependencies (Build::dependency), and per-target ProgramEntry bindings (Build::bind).
ProcessExit
The core boundary service (ProcessExit::exit_process(code: i32)) that ends the process domain with an explicit status code. Standard input and standard output have their own reach identities.

The Cast

In order of appearance: the Prover, the Provider, the Console, Om, and the Agent.

Character lineup: the Prover owl, the badger Provider, the Console printer, Om, and the Agent

Colophon

Set in Source Serif 4 and Hanken Grotesk on warm watercolor paper, with Om and the chapter vignettes painted from the canonical cast sheet. Every code figure in this guide is verified against the Omega reference compiler (bun run verify) before publication.

↑ back to the frontispiece