Skip to content

feat: add opt-in axiom-audit check#166

Open
kim-em wants to merge 2 commits into
mainfrom
axiom-audit
Open

feat: add opt-in axiom-audit check#166
kim-em wants to merge 2 commits into
mainfrom
axiom-audit

Conversation

@kim-em

@kim-em kim-em commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

This PR adds an opt-in axiom-audit input that audits a project's axioms with leanprover-community/axiom-audit: it fails CI if any declaration defined under the project's library namespace transitively depends on an axiom outside an allowlist (default propext,Classical.choice,Quot.sound), catching sorry, native_decide (Lean.ofReduceBool), and home-rolled axioms — including ones reaching in through imports. Because it inspects the compiled kernel environment, it catches what a grep cannot.

Modeled on the nanoda integration: the tool is cloned (pinned at v0.1.0) and built with the project's own toolchain, then run against the compiled environment via lake env, so no per-project dependency is required. New inputs axiom-audit-allow and axiom-audit-root, a new axiom-audit-status output, and a functional test (.github/functional_tests/axiom_audit) that verifies success on a clean library and failure once a home-rolled axiom is introduced.

Default off — like every other check here, it does nothing unless axiom-audit: true is set. (axiom-audit builds with the project's toolchain, so it needs a recent enough Lean; the tool's README documents the minimum.)

I verified the integration end to end locally: on a clean lake init … lib package the check reports axiom-audit-status=SUCCESS (exit 0); after appending a home-rolled axiom, it reports the offending declarations and axiom-audit-status=FAILURE (exit 1).

Context: the tool generalizes an audit from the TauCeti project; its fast shared-cache axiom collection is also being upstreamed to Lean core as leanprover/lean4#14157.

Implemented with assistance from Claude Code (Anthropic).

kim-em and others added 2 commits June 23, 2026 07:13
This PR add an opt-in `axiom-audit` input that audits a project's axioms with
leanprover-community/axiom-audit: it fails CI if any declaration defined under the project's
library namespace transitively depends on an axiom outside an allowlist (default propext,
Classical.choice, Quot.sound), catching sorry, native_decide, and home-rolled axioms — including
ones reaching in through imports. Modeled on the nanoda integration, the tool is cloned and built
with the project's own toolchain, then run against the compiled environment via `lake env`, so no
per-project dependency is required. Adds `axiom-audit-allow` and `axiom-audit-root` inputs, an
`axiom-audit-status` output, and a functional test that verifies success on a clean library and
failure once a home-rolled axiom is introduced. Default off.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- force `lake build` before auditing so a `build: false` or stale checkout can't silently audit
  the wrong (or missing) oleans
- pin the tool by commit SHA (verified after clone), not just the mutable v0.1.2 tag
- let the tool auto-detect the library root from the lakefile (it now does), dropping the brittle
  bash lakefile parsing; pass --root only when axiom-audit-root overrides it
- run in a mktemp dir under RUNNER_TEMP instead of a _axiom_audit dir in the package tree
- shellcheck polish: set -euo pipefail, quote the exit status, re-exit from the trap
- run the functional test on the modern toolchain (the tool builds with the project's toolchain)
- fix the axiom-audit-root doc to say "first lean_lib", matching the implementation

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

1 participant