Skip to content

chore: Cleanup and linting after the initial Clean changes#104

Merged
dtumad merged 9 commits into
mainfrom
dtumad/cleanup-pass
Jun 26, 2026
Merged

chore: Cleanup and linting after the initial Clean changes#104
dtumad merged 9 commits into
mainfrom
dtumad/cleanup-pass

Conversation

@dtumad

@dtumad dtumad commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch began as a proof/lemma cleanup pass after the initial Clean-native refactor and
grew to also restructure and harden CI. The two halves are independent and neither changes any
declarations or mathematical content.

CI

The CI workflow (.github/workflows/lean_action_ci.yml) went from a single build job to four
jobs, and the project now has lake test / lake lint drivers plus lightweight compiler trust guards.

Job graph

  • guards — source-policy gates on a standard runner, in parallel with the heavy build so a
    forbidden pattern fails the PR in seconds without a Lean build:
    • scripts/check_no_skipkerneltc.sh — no set_option (debug.)skipKernelTC in source (it bypasses
      the kernel type-check re-run, the trust anchor for axiom-clean proofs).
    • scripts/check_no_native_decide.sh — no native_decide in the main SP1Clean/ library (it trusts
      the whole compiler via Lean.ofReduceBool/Lean.trustCompiler).
  • build — the heavy project build, now also publishing the freshly-built .lake/build oleans to a
    commit-keyed cache (lake-build-${{ github.sha }}) for the downstream jobs. lean-action's own cache
    only covers dependencies (keyed on the manifest), not the per-commit project build.
  • lint (needs: build) — lake lint (the new sp1Lint driver) split into its own job so it shows
    up as an independent check. Restores the commit-keyed cache so it reads the already-built oleans instead
    of rebuilding.
  • test (needs: build, parallel with lint) — lake test (the new SP1CleanTest library: the
    witness-generation + whole-trace native_decide conformance anchors, checked against batteries dumped
    from SP1's real Rust prover). Restores the same cache and only elaborates the test modules. Split out so
    the trusted-compiler checks are clearly independent in the checks list.

Test / lint drivers and the test-library split

  • Added a top-level SP1CleanTest library (glob SP1CleanTest.+) holding all witness/trace
    conformance anchors — the only place native_decide is allowed. It imports SP1Clean but is never
    imported by it, so the default lake build SP1Clean stays native_decide-free (now enforced by the
    guards job). Wired as the testDriver in lakefile.toml.
  • Added scripts/sp1Lint.lean + a sp1Lint lean_exe, wired as the lintDriver. A thin custom driver
    over the Batteries #lint framework running a curated subset of linters over the hand-written
    SP1Clean.* declarations only, excluding the auto-generated Extracted/ + *Vectors code (the stock
    runLinter scopes by namespace root and can't make that exclusion). Residual suppressions live in
    scripts/nolints.json.
  • Moved the Mathlib syntactic style linters from package scope to per-lib moreLeanArgs on every
    hand-written pillar (SP1Math/SP1Model/SP1FormalModel/SP1Native/SP1Proofs + SP1CleanTest),
    which keeps the auto-gen SP1Extracted library out of the linter set. All eight flags are at zero
    violations.
  • scripts/run_audit.sh now invokes both guard scripts as gates and reports the native_decide count
    from SP1CleanTest/ rather than SP1Clean/.

Cleanup

  • DivRem soundness tail extraction — factored the ~267-line, byte-identical soundness tail that was
    duplicated across all nine DivRemChip/Soundness/*.lean variant files into a single shared
    DivRemChip/Soundness/Tail.lean helper (Already in perf: optimize the expensive portions of DivRem proofs #103 so could either merge that first or just close it).
  • Golfed proofs throughout the chip layer (Bridge/Formal/Core/Math files across Bitwise, Lt, Jal,
    Addw, Shift, Store*, Load* chips, …) and extracted shared helper lemmas into Math/Gate.lean and
    Math/Word.lean.
  • Fixed all errors from now-enforced syntactic style linters.
  • Refreshed docs (AGENTS.md, docs/agents/proof-patterns.md, docs/architecture.md, docs/roadmap.md,
    docs/release-audit.md) and the audit snapshots (axiom-census.txt, axiom-ledger.md,
    compile-profile.md) to match the new layout and CI, plus minor generator tweaks
    (update_extracted.py, scripts/gen_axiom_probe.py).

dtumad and others added 8 commits June 22, 2026 15:44
Move the environment-linter pass out of the `build` job into a separate `lint`
job so it shows up independently in the checks list. The lint job `needs: build`
and restores the project oleans from a commit-keyed cache the build job publishes
(lean-action's own cache covers dependencies only, not the per-commit project
build), so `lake lint` runs without a redundant full rebuild. The restore is
best-effort — on a miss, lean-action rebuilds, so the job stays correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dtumad dtumad merged commit 512e944 into main Jun 26, 2026
4 checks passed
dtumad added a commit that referenced this pull request Jun 27, 2026
The W11 channel-pull work (byte finish, state gate, program polarity flip + ROM
provider + capstone link retirement) was developed on top of the same cleanup main
landed in #104, so the 3-way merge flagged conflicts on every line both sides
re-touched relative to the #102 base. Resolved all proof/contract conflicts to the
W11 side (the correct end state — the merged circuits carry the byte/state/program
pulls, whose off-gate `Requirements` and paired reader `Assumptions` the W11 proofs
discharge; main's pre-pull proofs would not typecheck against them). The only net
new content from main was its CI-workflow rework (lean-action restore-keys), taken
as-is.

`Math/Gate.lean` resolved to the W11 superset (main's consolidated gate lemmas +
`off_gate_vacuous`). Flip invariants verified intact: `programLookups` negated,
build green (3638 jobs, 0/0 bar the pre-existing `sp1_witness_decode` sorry),
`lake lint` + native_decide/skipKernelTC guards pass, flip-critical decls
axiom-clean `[propext, Classical.choice, Quot.sound]`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants