Skip to content

Instantly share code, notes, and snippets.

@park-sewon
Created March 2, 2025 16:28
Show Gist options
  • Save park-sewon/d1a4c56b5a39765f37995c717830de36 to your computer and use it in GitHub Desktop.
Save park-sewon/d1a4c56b5a39765f37995c717830de36 to your computer and use it in GitHub Desktop.
LEAN tag attribute for checking classical axioms in Prop
import Lean
import Lean.Util.CollectAxioms
open Lean
initialize intuitionisticAttr : TagAttribute ←
registerTagAttribute `intuitionistic "Tag attribute for intuitionistic prop"
fun decl =>
do
let axioms ← collectAxioms decl
let invalid_axioms := axioms.filter
fun | `propext | `Quot.sound => false
| x => true
if ! invalid_axioms.isEmpty then
throwError "'{decl}' depends on the following classical axiom(s): {invalid_axioms.qsort Name.lt |>.toList}"
pure ()
@park-sewon
Copy link
Author

park-sewon commented Mar 2, 2025

Rejects @[intuitionistic] theorem a : ... when a is proved depending on axioms other than propext or Quot.sound. This attribute cannot be used in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment