Add an exhaustive readable-instance sweep and a coverage gate requiring 100% line coverage of the summarised implementation. Delete branches that are unreachable under `Readable`, centralise and assert the 32-bit offset contract at the public entry points, and stop materialising `n` zero bytes when deciding `keyAfterN n k < upper`. Also add the extreme-offset regression test, harden the corpus parsers, remove unused model helpers, document the literal-total / fast-readable split, and refresh the validation and benchmark numbers.
58 lines
3.1 KiB
Markdown
58 lines
3.1 KiB
Markdown
# conflict-range
|
|
|
|
A formalised **closed form** for the minimal conflict range of a read/result
|
|
pair, together with a C++20 translation and its test harness.
|
|
|
|
Given a database, a range read (two selectors plus offsets, either traversal
|
|
direction), and the keys a transaction observed, `Statement.closedForm` computes
|
|
a minimal sound conflict range: a set of keys that is sufficient to detect every
|
|
conflicting write, and none of whose proper subranges is sufficient.
|
|
|
|
## Layout
|
|
|
|
| Path | Purpose |
|
|
| --- | --- |
|
|
| `Statement.lean` | The statement: keys, selectors, reads, results, conflict ranges, soundness, minimality, and the closed form itself. It imports only Mathlib and states the definitions and headlines without using `theorem`, `axiom`, or `sorry`. |
|
|
| `FormalConflictRange/` | The reference development that proves the closed form minimal. |
|
|
| `Bridge.lean` | Definitional bridge from `Statement`'s types to the reference development, plus the transport lemmas. |
|
|
| `Proof.lean` | Proves `Statement.ClosedFormMinimal` and `Statement.MinimalUnique` by transporting the reference theorems across the bridge. |
|
|
| `Challenge.lean` | The same two headline statements with placeholder proofs (`sorry`). This is the trusted statement side of the comparator check. |
|
|
| `Solution.lean` | The solution side of the comparator check; it imports `Proof`. |
|
|
| `comparator.json` | Comparator configuration: challenge/solution modules, theorem names, and permitted axioms. |
|
|
| `cpp/` | A C++20 translation of `closedForm`, an equivalent summarised implementation, golden-vector and fuzz tests, and a benchmark. See `cpp/README.md`. |
|
|
|
|
## Build and check
|
|
|
|
```sh
|
|
lake build
|
|
lake comparator
|
|
```
|
|
|
|
This repository pins Lean `v4.35.0` and Mathlib `v4.35.0`
|
|
(`lean-toolchain`, `lakefile.toml`). `lake comparator` checks that the solution
|
|
proves the challenge's statements and that the proofs use only `propext`,
|
|
`Quot.sound`, and `Classical.choice`.
|
|
|
|
## Status and scope
|
|
|
|
* `Statement.ClosedFormMinimal` and `Statement.MinimalUnique` are proved, and no
|
|
proof in `Proof.lean`, `Bridge.lean`, or `FormalConflictRange/` uses `sorry`.
|
|
* `Challenge.lean` deliberately contains `sorry`: it is the statement side of
|
|
the comparator check, not part of the proof.
|
|
* Some docstrings in `FormalConflictRange/` are a research log and refer to
|
|
files that are **not** part of this repository:
|
|
`FormalConflictRange/Counterexample`, `FormalConflictRange/Open`, and
|
|
`notes/main.tex`. Those references appear only in comments and docstrings, so
|
|
they do not affect the build or the headline proofs, but their specific claims
|
|
cannot be checked here. `FormalConflictRange/Prototype.lean` is likewise an
|
|
experimental prototype, not part of the headline proof path.
|
|
* The C++ tree is validated against Lean-generated golden vectors, by
|
|
differential fuzzing, and by a deterministic exhaustive sweep of small
|
|
readable instances; `cpp/README.md` describes the model, the tests, the
|
|
coverage check, and the benchmark. The summarised implementation has 100%
|
|
line coverage via `cpp/run-coverage.sh`.
|
|
|
|
## License
|
|
|
|
Apache License 2.0; see `LICENSE`.
|