---
title: "5. Proof plan · perennial"
description: "The target crates keep their tests inside their MPL-licensed source modules; they cannot be run against another crate without editing them, and implementers…"
canonical: "https://perennial.avarok.net/docs/design/05-proof/"
lastmod: "2026-12-01T20:11:23Z"
tokens: 993
---

1. [Docs](https://perennial.avarok.net/docs/)
2. [Design](https://perennial.avarok.net/docs/design/)

# 5\. Proof plan

perennial@0.1.0·Updated 2026-12-01·2 min read·[View as markdown](https://perennial.avarok.net/docs/design/05-proof/index.md)

## Why the target's own suite is not the drop-in proof here

The target crates keep their tests inside their MPL-licensed source modules; they cannot be run against another crate without editing them, and implementers may not read them. The drop-in claim therefore rests on three black-box proofs instead:

1. **Differential model tests (proptest).** For each collection and flavour, a random sequence of operations is applied to perennial, to imbl 7.0.2 and im/im-rc 15.1.0 (dev-dependencies, used only as black-box oracles) and to a std model (`BTreeMap`, `HashMap`, `Vec`). After every step, observable results must agree: return values, `len`, iteration order (ordered types and Vector), `Debug` strings, equality and ordering between collections. Where the oracle and the spec disagree with each other, `docs/COMPAT.md` records the case.
2. **cargo's own test suite with perennial-rc in place of im-rc.** CI checks out rust-lang/cargo at a pinned commit (MIT OR Apache-2.0), changes its `im-rc` line to `{ package = "perennial-rc", path = … }`, and runs the resolver tests and the cargo test targets that exercise resolution. This is the realistic drop-in proof: a large program using OrdMap, OrdSet, HashMap with a custom hasher, HashSet and the Entry API, unmodified.
3. **Compile-level API compatibility.** A test crate written from docs/spec/ calls every documented method of im-rc 15.1.0 by path and signature; it must compile against `perennial-rc`, and the same file against `im-rc` (proves the test reflects the real API).

## Unit and property tests

- Invariant checkers per structure (B+tree: sorted, balanced, fill bounds; HAMT: bitmap/storage agreement, canonical form after remove; RRB: size tables consistent, tail invariants), called after every step in debug test builds. Not in production paths.
- Structural sharing tests: after `clone` + mutate, the untouched handle is unchanged and `ptr_eq` behaves as documented.
- Panic-safety and advisory tests (chapter 4). Miri on a reduced proptest budget.

## Negative controls

Every new check is shown to fail once: break the code (e.g. skip a `make_mut`, off-by-one in a split, wrong popcount rank), watch the check go red, restore, and record it in the PR that adds the check.

## CI jobs

fmt, clippy `-D warnings`, test (stable, MSRV, Linux/macOS/Windows), Miri, fuzz smoke, no\_std build (`--no-default-features` for `thumbv7em-none-eabi` and wasm32-unknown-unknown), cargo-suite, line guard (≤ 250 lines per file), unsafe guard, charts diff, docs build.

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@id": "https://thomaspbraun.com/#person",
      "@type": "Person",
      "name": "Thomas Braun",
      "sameAs": [
        "https://github.com/tbraun96",
        "https://x.com/tbraun96"
      ],
      "url": "https://thomaspbraun.com",
      "worksFor": {
        "@type": "Organization",
        "name": "Avarok",
        "url": "https://avarok.net"
      }
    },
    {
      "@id": "https://perennial.avarok.net/docs/design/05-proof/",
      "@type": "WebPage",
      "author": {
        "@id": "https://thomaspbraun.com/#person"
      },
      "dateModified": "2026-12-01T20:11:23Z",
      "description": "The target crates keep their tests inside their MPL-licensed source modules; they cannot be run against another crate without editing them, and implementers…",
      "inLanguage": "en",
      "isPartOf": {
        "@id": "https://perennial.avarok.net/#website",
        "@type": "WebSite",
        "name": "perennial",
        "url": "https://perennial.avarok.net/"
      },
      "name": "5. Proof plan · perennial",
      "url": "https://perennial.avarok.net/docs/design/05-proof/"
    }
  ]
}
```
