[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"Dep34bscgS":3},"# LeanParanoia\n\n> **THIS TOOL IS NEW. USE WITH CAUTION!**\n\nConfigurable proof verification for Lean 4 that detects soundness exploits through dependency analysis and environment replay via [lean4checker](https://github.com/leanprover/lean4checker). Operates without trusted reference files and cannot guarantee complete soundness. Validate critical proofs with challenge-solution verifiers.\n\n## Exploits\n\nSee [VERIFIER_COMPARISON.md](VERIFIER_COMPARISON.md) for a comparison of different proof verifiers and exploits that LeanParanoia detects.\n\n## Installation & Usage\n\nAdd the LeanParanoia dependency to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"paranoia\"\ngit = \"https://github.com/oOo0oOo/LeanParanoia\"\nrev = \"main\"\n```\n\nThen, in your terminal, run:\n\n```bash\nlake update --keep-toolchain\nlake build paranoia\nlake exe paranoia MyTheoremName # Use Module.SubModule.theorem_name\n```\n\n## Example Output\n\nLeanParanoia returns a JSON. E.g verifying a theorem that uses `native_decide`:\n\n```json\n{\n    \"failures\": {\n        \"CustomAxioms\": [\n            \"Uses disallowed axiom: Lean.ofReduceBool\",\n            \"Uses disallowed axiom: Lean.trustCompiler\"\n        ],\n        \"NativeComputation\": [\n            \"Definition 'exploit_theorem' depends on native computation primitive 'Lean.reduceBool'\"\n        ],\n        \"Replay\": [\n            \"Replay verification failed: (kernel) (interpreter) unknown declaration 'exploit_theorem._nativeDecide_1_1'\"\n        ]\n    },\n    \"success\": false\n}\n```\n\n## Command Line Options\n\n```\nUsage: paranoia [OPTIONS] THEOREM_NAME\n\nSpecify theorems using their full module path: Module.SubModule.theorem_name\n\nOptions:\n  --no-sorry              Disable sorry check\n  --no-metavariables      Disable metavariable check\n  --no-unsafe             Disable unsafe check\n  --no-partial            Disable partial function check\n  --no-axioms             Disable axiom whitelist check\n  --no-extern             Disable extern check\n  --no-implemented-by     Disable implemented_by check\n  --no-csimp              Disable csimp attribute check\n  --no-native-computation Disable native_decide/ofReduce check\n  --no-constructors       Disable constructor integrity check\n  --no-recursors          Disable recursor integrity check\n  --no-source-check       Disable source-level pattern check\n  --no-replay             Disable environment replay\n  --no-opaque-bodies      Skip inspecting opaque constant bodies\n  --allowed-axioms AXIOMS Comma-separated list of allowed axioms\n                          (default: propext,Quot.sound,Classical.choice)\n  --source-blacklist PATTERNS Comma-separated list of source patterns to reject\n                          (default: 'local instance', 'local notation', etc.)\n  --source-whitelist PATTERNS Comma-separated list of patterns to allow despite blacklist\n  --trust-modules MODULES Comma-separated list of module prefixes to trust\n                          (e.g., Std,Mathlib to skip verification of those dependencies)\n  --fail-fast             Stop after first failing check\n  -h, --help              Show this help\n```\n\n## Related Projects\n\n- [lean4checker](https://github.com/leanprover/lean4checker): Recheck a compiled Lean olean file using the Lean kernel. **Direct dependency**\n- [SafeVerify](https://github.com/GasStationManager/SafeVerify): Check whether a file of submitted Lean code and/or proof matches the specifications. (Challenge-solution verifier)\n- [Comparator](https://github.com/leanprover/comparator): Comparator is a trustworthy judge for Lean proofs by the FRO. (Challenge-solution verifier)\n- [Pantograph](https://centaur.stanford.edu/PyPantograph/frontend.html#track-checking): Machine-to-machine interaction interface for Lean 4 includes a checker. (Challenge-solution verifier)\n- [Lean 4 Autograder](https://github.com/robertylewis/lean4-autograder-main): Lean 4 autograder that works with Gradescope.\n\n## Testing\n\nComprehensive integration tests using pytest:\n\n```bash\nuv sync\nuv run pytest tests/\n\n# Run tool comparison\nuv run pytest tests/benchmark/test_tool_comparison.py -m benchmark_comparison -v -s\n# Generate VERIFIER_COMPARISON.md from results\nuv run python tests/benchmark/generate_exploits_table.py\n```\n\n## License\n\n[MIT License](LICENSE)",1780846774764]