Skip to content

Commit

Permalink
fix: force non-prop theorems to opaque
Browse files Browse the repository at this point in the history
  • Loading branch information
digama0 committed May 7, 2024
1 parent 43c75e9 commit e93cf6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Mathport/Binary/Apply.lean
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,18 @@ def applyAxiomVal (ax : AxiomVal) : BinportM Unit := do
}
if clashKind == ClashKind.freshDecl then maybeRegisterEquation decl.toName

open private isAlwaysZero from Lean.Meta.InferType in
def applyTheoremVal (thm : TheoremVal) : BinportM Unit := do
let type ← trExpr thm.type
let value ← if (← read).config.skipProofs then
let u ← liftMetaM <| getLevel type <|> pure .zero
pure <| mkApp2 (mkConst ``sorryAx [u]) type (toExpr true)
else trExpr thm.value
let (decl, clashKind) ← refineAddDecl <| .thmDecl { thm with type, value }
let isProp ← liftMetaM try isProp type catch _ => pure true
let (decl, clashKind) ← refineAddDecl <| if isProp then
.thmDecl { thm with type, value }
else
.opaqueDecl { thm with type, value, isUnsafe := false }
if clashKind == ClashKind.freshDecl then maybeRegisterEquation decl.toName

def applyDefinitionVal (defn : DefinitionVal) : BinportM Unit := do
Expand Down

0 comments on commit e93cf6b

Please sign in to comment.