---
title: "Correctness and Expressiveness"
description: "Dex has two computer-checked proofs. Under the conditions they assume, a"
canonical_url: "https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/"
source: "docs/content/correctness-and-expressiveness/index.mdx"
locale: "en"
---

> Index of every page for AI agents: https://docs.superdurable.io/llms.txt

# Correctness and Expressiveness

Dex has two computer-checked proofs. Under the conditions they assume, a
crash, a takeover, or a retry can change only one thing you observe: an
external effect can repeat, and the repeat can arrive late. Otherwise the run
produces the same events as a run without failures. The proofs cover every
well-formed program of a small concurrent language.
[What this means for your code](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/failure-transparency-proof.md#what-it-means-for-you)
says how to make repeats safe.

The proofs are about a model of Dex and hold only under a limited scope, such
as one Flow, **SYNC** methods only, and retries that never run out.
[What the proof assumes](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/failure-transparency-proof.md#what-the-proof-assumes)
lists every condition.

## Expressiveness

The [Expressiveness proof](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/expressiveness-proof.md)
shows that any program in a small concurrent language, with threads, locks,
timers, and cancellation, can be written as a Dex Flow that behaves the same.
The proof is written in the Lean proof assistant, which checks every step. The
[paper](https://docs.superdurable.io/papers/dex-expressiveness.pdf) has the full argument.

The [Workflow Patterns evaluation](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/workflow-patterns-evaluation.md)
rates Dex against the 43 control-flow Workflow Patterns. Researchers use these
patterns to compare workflow languages and engines. Each rating comes with a
runnable example and an integration test.

## Correctness

[Advanced Step Guarantees](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/advanced-step-guarantees.md) states what Dex promises when
a Step method fails or runs again.

The [Failure transparency proof](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/failure-transparency-proof.md)
shows that server crashes, takeovers, retries, late Workers, and duplicate
results add only repeated external effects. In fair runs the ending is also
unchanged. The proof page lists its conditions.

<a id="coverage"></a>

## What covers each feature

| Feature                             | Lean failure proof                                                | Deterministic simulation                 | Server integration tests |
| ----------------------------------- | ----------------------------------------------------------------- | ---------------------------------------- | ------------------------ |
| SYNC Steps                          | Yes                                                               | Yes                                      | Yes                      |
| ASYNC Steps                         | No                                                                | No                                       | Yes                      |
| RPCs, including transactional RPCs  | No                                                                | Yes                                      | Yes                      |
| Attribute locks                     | No                                                                | Yes                                      | Yes                      |
| SubFlows                            | No                                                                | Yes                                      | Yes                      |
| Failure policies and recovery Steps | No                                                                | Yes, in the apply-level stage            | Yes                      |
| Heartbeats                          | Partly: resuming from a heartbeat checkpoint is outside the proof | Yes, with and without values             | Yes                      |
| Time Travel                         | No                                                                | No: the simulated clients do not call it | Yes                      |
| StopFlow                            | No                                                                | Yes                                      | Yes                      |

The proof column follows [What the proof assumes](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/failure-transparency-proof.md#what-the-proof-assumes).
[How it was checked](https://docs.superdurable.io/evaluate-dex/correctness-and-expressiveness/failure-transparency-proof.md#how-it-was-checked)
describes the simulation and names the integration test for each feature.
