fix: do not generate injectivity theorems for unsafe inductive datatypes
This commit is contained in:
parent
175311b2f0
commit
05147fd352
1 changed files with 6 additions and 5 deletions
|
|
@ -140,10 +140,11 @@ register_builtin_option genInjective : Bool := {
|
|||
def mkInjectiveTheorems (declName : Name) : MetaM Unit := do
|
||||
if (← getEnv).contains ``Eq.propIntro && genInjective.get (← getOptions) && !(← isInductivePredicate declName) then
|
||||
let info ← getConstInfoInduct declName
|
||||
for ctor in info.ctors do
|
||||
let ctorVal ← getConstInfoCtor ctor
|
||||
if ctorVal.numFields > 0 then
|
||||
mkInjectiveTheorem ctorVal
|
||||
mkInjectiveEqTheorem ctorVal
|
||||
unless info.isUnsafe do
|
||||
for ctor in info.ctors do
|
||||
let ctorVal ← getConstInfoCtor ctor
|
||||
if ctorVal.numFields > 0 then
|
||||
mkInjectiveTheorem ctorVal
|
||||
mkInjectiveEqTheorem ctorVal
|
||||
|
||||
end Lean.Meta
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue