Commit Graph
15 Commits
Author SHA1 Message Date
andrew bb32cca6f9 Point README at the C++ implementation 2026-11-18 10:45:55 -05:00
andrew cb160a6881 Limit copyright headers to reviewed files 2026-11-18 10:38:21 -05:00
andrew 4e26f3710b Refine README introduction 2026-11-18 10:36:05 -05:00
andrew 273ad72f0c Polish release docs and add CI checks
- Correct stale references and headline-path wording in READMEs and Lean docstrings
- Document build steps, comparator requirements, sweep scope, and coverage
- Unify Apache headers across Lean and C++ sources
- Add a bwrap-free axiom audit for the headline theorems
- Add a Gitea workflow running lake build, the axiom audit, C++ tests, and coverage
- Match LLVM coverage tool versions to the compiler and recreate stale build dirs
2026-11-17 21:29:16 -05:00
andrew 73e371fb40 Remove dead branches from the fast translation
Drop predicate operands and unreachable arms that dispatch and readable invariants fix, and extend the exhaustive sweep to cover every branch side. Gate coverage on branch coverage as well.
2026-11-17 19:26:09 -05:00
andrew 3bb5d062ff Harden and fully cover the C++ translation
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.
2026-11-17 18:46:24 -05:00
andrew e32e42d933 Add a C++ translation of the closed form
- Literal transliteration of `Statement.closedForm` plus an equivalent
  summarised implementation
- Borrowed input keys (`std::string_view` / `std::span`) and owned result
  keys (`std::string`)
- Golden-vector test, differential/safety fuzzers, and a nanobench
  comparison

The literal and summarised implementations agree on 40,000 Lean golden
vectors, 18,971 sorted corpus cases, and the readable fuzzer; the raw fuzzer
runs both implementations under ASan/UBSan.  `build/` and the generated
`oracle/golden.txt` are ignored.
2026-11-17 16:08:07 -05:00
andrew 6559cc582b Simplify the closed-form statement
Collapse duplicated cells and share their conditions:

- Merge the crossed complete clamp cells.  They all fall through to
  `end_.key`, and only the bottom / infinite / head-bottom / last-ge cells
  conflict with the long nonpositive cell, so test `negCrossClampNonposLastGe`
  explicitly and let the rest share the fall-through.
- Allow `r.end_.offset ≤ 1` in the crossed truncated nonpositive cell and
  merge it with the old `...Small` cell into `negCrossTruncRevCrossedLow`.
- Use `overshoot r res` in `negCrossOvershoot` and
  `negCrossTruncRevBelowEnd` instead of spelling out the same key bound.
- Drop the `r.begin.key ≤ r.end_.key` shortcut in `emptyValue`; the
  cardinality branch below already returns `bottom..end_.key` in that case.
- Inline the single-use helpers: `...TruncRevBelowEnd`,
  `...TruncRevCrossedNonposLarge`, `...ResidualFiniteUnder`,
  `...ResidualTopLargeSentinel`, `...TruncRevUnder` and
  `...TruncTopTopEq`.

`Bridge.lean` follows the removed cells, keeping the deleted reference
predicate as a private legacy abbreviation for the bridge proof.
`lake build` is clean.
2026-11-17 16:05:43 -05:00
andrew 6cfdb13da1 Fold the clamped branch into the positive rule
On a clamped nonpositive begin the reference clamped rule `compactClamped` and
the positive rule `compactPositive` coincide: the begin offset is nonpositive,
so `residualB = 0`, and the reversed-truncated rule collapses to its no-skip
case.

So `closedForm` now dispatches on `1 ≤ r.begin.offset ∨ clampedNonpos r res`
and drops `closedFormClamped`, `closedFormNonposRevTrunc` and
`nonposRevReduced`, together with their bridges.  `closedForm_eq` splits
explicitly on the positive and clamped regions, using the new reference lemmas
`ref_closedFormNonposRevTrunc_eq` and `ref_compactClamped_eq_compactPositive`.

The headlines, their statements and the comparator inputs are unchanged.
2026-11-17 14:39:41 -05:00
andrew efd1b323e7 Prove minimality is unique and add it to the headlines
- Define `ConflictRange.toSet`, the set of keys lying in a range
- Add the headline `MinimalUnique`: any two minimal sound ranges for the
  same read and result denote the same set of keys
- Transport `FormalConflictRange.Minimal.toSet_eq` across the bridge; the
  statement is unconditional, since `Minimal` already carries soundness
- State `Statement.minimalUnique` in the challenge and add it to the
  comparator's `theorem_names`

`lake build` is warning-free and `lake comparator` accepts both headlines.
2026-11-17 11:39:52 -05:00
andrew bd5b3c885c Upgrade to Lean 4.35 and add comparator check
- Move to lean-toolchain v4.35.0 and mathlib v4.35.0
- Opt out of the module-system warning with `allowNonModules`
- Adapt to Lean/Mathlib 4.35 changes: drop now-redundant
  `List.filter_congr` blocks and no-op `ring` calls
- Add `Challenge.lean`, `Solution.lean`, and `comparator.json`

`lake comparator` now accepts the solution against the trusted challenge.
2026-11-17 10:28:15 -05:00
andrew fc8335c380 Remove prototype demo evaluation block 2026-11-17 10:08:36 -05:00
andrew af318a7d32 Fix all Lean build warnings
- Update deprecated lemmas (ite_eq_left/right, ENat casts, List.Sublist, ...)
- Replace push_neg with push Not and resolve unused-variable warnings
- Convert flexible simp/simp_all calls to explicit simp only lists
- Remove unscoped maxHeartbeats options, open scoped Classical, and unused tactics
- Add missing module docstrings and clean up style linter hits
- Wrap over-long lines and flatten the deeply nested
  minimal_conflictRangeClosedForm_total proof

`lake build` now completes with zero warnings.
2026-11-17 10:04:35 -05:00
andrew a54a5f82f8 Prove conflict-range closed-form minimality
- Vendor the FormalConflictRange reference library needed by the proof
- Add Bridge.lean with simp lemmas connecting the Statement definitions
  to the reference library
- Prove Statement.closedFormMinimal in Proof.lean
- Register the new libraries in the Lake config
2026-11-16 21:53:59 -05:00
andrew 7a0826e873 Add statement of conflict-range minimality and license 2026-11-16 15:24:39 -05:00