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

# Guarantees

> What the RSL 0.4 compiler verifies and which checks apply to the RSL 0.5 rating preview.

The properties below apply to RSL 0.4. In the RSL 0.5 rating preview, the compiler checks expressions reached from the entry function. An unused helper can contain a type error and still pass. A successful 0.5 check also leaves work bounds, citation provenance and the ability of every live process state to reach an end act unverified.

See the [two-edition authoring guide](https://docs.canary.effectiveai.app/rsl/tutorial/author-a-rater-in-either-edition.md) for the checks to use when rewriting a rater.

## RSL 0.4 properties

| Property | What holds |
| - | - |
| A function always returns | It holds a fixed set of calculations, and each one reads values computed before it |
| Each operation succeeds | Each division, lookup, `match`, fold and date shift is safe for every accepted input |
| The result is the same everywhere | A result depends only on the arguments, and arithmetic is exact |
| An absent value is handled | It has the type `Option`, and each read handles both cases |
| The work has a bound | The check prints a bound in the sizes of the input lists, on its `cost` line |
| Each filed number has a source | Each table, constant and rounding cites a region of a declared source |
| Each process can finish | An `end` act leaves each live state, so every log can reach a final status |

## Check messages

This calculation divides by the difference of two inputs, each from 1 to 10:

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
x: Num = self.a / (self.a - self.b),
```

> [accordion] divide/rater.rsl
>
> ```rsl divide/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Guarantees",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     k [cite: manual:p1] = 3
> }
>
> Records = {
>     Policy = {
>         inputs {
>             a: Num {precision: int} where self in [1, 10],
>             b: Num {precision: int} where self in [1, 10]
>         },
>         step rating {
>             x: Num = self.a / (self.a - self.b),
>             premium: Premium [cite: manual:p1] = round(self.x * k, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check divide/rater.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL divide/rater.rsl (strict)
error: E-DIV-ZERO divide/rater.rsl:27:22: guard the division by `self.a - self.b` against 0 (range -9..9)
  = help: (if self.a - self.b != 0 then self.a / (self.a - self.b) else <value>)
  = applicability: placeholders
cost premium: 2 (each list of size 1: 2, 3: 2, 10: 2)
```

The check works out the range of each value from the ranges of the inputs it reads.
A guard such as `if self.a != self.b then … else 0` removes the case, and the check then passes.

The check is conservative. It tracks one range for each value, so it refuses some safe programs.
A guard or a narrower input gives the check the fact it needs.

## Proof sources

| Property | Established by |
| - | - |
| A function returns and gives the same result everywhere | The language: its forms leave out loops, recursion, clocks and outside input |
| Each operation succeeds, and each value has its type | The checker. Each of its rules has tests that accept and refuse programs |
| Rounding behaves as written | Machine-checked proofs, in Lean, of each rounding mode, root bounds and stepwise sums |

The checker itself is unproven. A failure that it misses stops that one rating with an error, in place of a premium.

## Reviewer checks

The check proves what the program does. It leaves open whether the program follows its filing.

* A reviewer reads each cited region and confirms the value or rule.
* Independent rating examples confirm the premiums.
* `Premium`, `Rate`, `Factor` and `Pct` name what a number is, and the check leaves unit arithmetic to the author.

## Related

* [Check messages](https://docs.canary.effectiveai.app/rsl/reference/check-messages.md) explains each message, with a program that gets it and the fix.
* [Check guarantees](https://docs.canary.effectiveai.app/rsl/reference/language.md#check-guarantees) in the language reference states the rule in one paragraph.
* [Test a rater](https://docs.canary.effectiveai.app/rsl/how-to/test-a-rater.md) compares a program with independent examples.


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