mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
Six Lean 4 + Mathlib modules prove or refute the audited properties and cite the Go files they model. FINDINGS.md records each verdict with its Lean theorem, Go test and fix commit. The axiom audit and the currency check live in lean4/scripts.
28 lines
912 B
Lean4
28 lines
912 B
Lean4
import Gohoarder
|
|
import Lean
|
|
|
|
/-! Fails unless every theorem under `Gohoarder` depends only on `propext`, `Classical.choice` and
|
|
`Quot.sound`. Run from `lean4/`: `lake env lean scripts/Axioms.lean`. -/
|
|
|
|
open Lean Elab Command
|
|
|
|
elab "#audit_axioms" : command => do
|
|
let env ← getEnv
|
|
let allowed : List Name := [``propext, ``Classical.choice, ``Quot.sound]
|
|
let mut audited : Nat := 0
|
|
let mut bad : Array String := #[]
|
|
for (n, ci) in env.constants.map₁.toList do
|
|
if `Gohoarder |>.isPrefixOf n then
|
|
if let .thmInfo _ := ci then
|
|
audited := audited + 1
|
|
let axs ← liftCoreM (collectAxioms n)
|
|
for a in axs do
|
|
if !allowed.contains a then
|
|
bad := bad.push s!"{n} uses {a}"
|
|
if bad.isEmpty then
|
|
logInfo m!"{audited} theorems audited, axioms within {allowed}"
|
|
else
|
|
throwError "unexpected axioms:\n{"\n".intercalate bad.toList}"
|
|
|
|
#audit_axioms
|