> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Search and read these docs from your coding agent with the [CodeRabbit documentation MCP server](https://docs.coderabbit.ai/mcp).
> Give your coding agent the [CodeRabbit Agent Skill](https://docs.coderabbit.ai/.well-known/agent-skills/index.json) for configuring reviews, running CLI reviews, coding tasks and API calls.

# Formal verification

> How CodeRabbit backs some review findings with TLA+, SMT, Lean and Quint checks, what a check proves, and where to read its evidence.

GitHub Cloud (GitHub Enterprise Server isn't supported.) GitLab.com (Self-managed GitLab and GitLab Dedicated aren't supported.) Azure DevOps Services (Azure DevOps Server isn't supported.) Bitbucket Cloud (Bitbucket Data Center isn't supported.) | Cloud Only (This feature is available on CodeRabbit Cloud only. It is not available on self-hosted CodeRabbit deployments.)

Some bugs only show up when events happen in an unlucky order or when values combine in a way nobody tried: two webhooks that race, a retry that runs a charge twice, a limit that overflows for one input in a million. Tracing a few examples through the diff rarely finds them.

When a finding depends on a property like that, CodeRabbit can test it formally while it verifies the finding. It writes a small model of the logic in question and runs a formal tool on it: a model checker that tries every allowed order of events, a solver that searches for an input that breaks a condition, or a proof checker that confirms a rule holds for every input. The result becomes evidence for or against the finding, and you can read it.

## Where it runs

Formal checks run in pull request reviews on CodeRabbit Cloud for repositories on GitHub Cloud (github.com), GitLab.com, Azure DevOps Services and Bitbucket Cloud, public and private, on every plan. They're on by default, and there's nothing to configure.

They don't run for GitHub Enterprise Server, self-managed GitLab, Azure DevOps Server or Bitbucket Data Center, even when connected to CodeRabbit Cloud, or in self-hosted CodeRabbit, IDE and CLI reviews.

CodeRabbit decides for each finding whether a check would help settle it.

## The tools

| Tool | What it checks | Engine |
| - | - | - |
| TLA+ | Whether any order of events allowed by the model breaks a property, such as two handlers updating the same record. | TLC model checker |
| SMT | Whether some input breaks a condition under stated assumptions, such as a bounds check or a pricing rule. | cvc5 solver |
| Lean | Whether a rule holds for every allowed input, as a machine-checked proof. | Lean 4 |
| Quint | Whether a short sequence of events breaks a property, by simulating random runs of the model. A Quint result appears only when it finds a counterexample. | Quint simulator |

## What a check proves

A check runs on the model CodeRabbit wrote, not on your code. It shows what holds in that model, and the model can leave out details of the real code. That's why a check is evidence for a finding and not a verdict:

* A check can't decide a finding, [Merge Risk](https://docs.coderabbit.ai/pr-reviews/merge-risk.md) or an [automatic approval](https://docs.coderabbit.ai/pr-reviews/automatic-approvals.md) on its own. CodeRabbit weighs it with the rest of what it found in the code.
* A check that fails to run or can't express the property doesn't hold up or fail the review. CodeRabbit verifies the finding another way.
* A check never posts a finding by itself. It only tests a concern that the review raised.

A check result can show one of these outcomes:

| Outcome | Meaning |
| - | - |
| Counterexample found in the model | The tool found an order of events or an input that breaks the property. |
| No counterexample found in the model | TLA+ explored every state of the model and the property held. |
| Property holds under checked assumptions | The SMT solver found no input that breaks the condition. |
| Proof checked | Lean accepted the proof. |

## Read the evidence

### In CodeRabbit Explain

On GitHub, in [CodeRabbit Explain](https://docs.coderabbit.ai/change-stack.md), the finding's comment has a **View evidence** button. It opens **Review evidence**, which shows:

* The analysis title, such as **Code analysis · TLA+ model checking**, and **Supporting formal checks**, followed by the tools behind it.
* One item per check, such as **TLA+ check**, with its outcome and the model CodeRabbit ran. Expand an item to read the full model.

CodeRabbit Explain shows this evidence whatever your review details setting is.

### In the pull request comment

When [review details](https://docs.coderabbit.ai/pr-reviews/walkthroughs.md#review-details) are on, a finding that a formal check supports has a collapsed section titled after the tools, such as **🔎 Code analysis · TLA+ model checking**. It lists each model CodeRabbit ran. The outcome labels appear only in CodeRabbit Explain.

Review details are off by default. Turn them on with [`reviews.review_details`](https://docs.coderabbit.ai/reference/configuration#param-reviews-review-details), or `reviews.output.review_details` in [configuration V3](https://docs.coderabbit.ai/reference/configuration-v3.md).

```yaml .coderabbit.yaml theme={null}
reviews:
  review_details: true
```

Bitbucket Cloud comments don't show this section.

## What's next

> [card] [Understand findings](https://docs.coderabbit.ai/change-stack/findings.md)
>
> Read the labels on each finding in CodeRabbit Explain and decide what to fix first.

> [card] [Merge Risk](https://docs.coderabbit.ai/pr-reviews/merge-risk.md)
>
> See how CodeRabbit rates the risk of merging a pull request from the findings that remain.

> [card] [PR Walkthroughs](https://docs.coderabbit.ai/pr-reviews/walkthroughs.md)
>
> Choose which sections, including review details, appear in CodeRabbit's review comments.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.