The bug was due to the auto-generalization feature.
This commit is contained in:
Leonardo de Moura 2021-04-13 19:10:24 -07:00
parent 327eb1a96d
commit c1f45ecd48
2 changed files with 13 additions and 1 deletions

View file

@ -277,13 +277,16 @@ where
Collect forward dependencies that are not in the forbidden set, and depend on some variable in `targets`.
Remark: this method assumes `targets` are free variables.
Remark: we *not* collect instance implicit arguments nor auxiliary declarations for compiling
recursive declarations.
-/
private def collectForwardDeps (targets : Array Expr) (forbidden : NameSet) : MetaM NameSet := do
let mut s : NameSet := targets.foldl (init := {}) fun s target => s.insert target.fvarId!
let mut r : NameSet := {}
for localDecl in (← getLCtx) do
unless forbidden.contains localDecl.fvarId do
unless localDecl.isAuxDecl do
unless localDecl.isAuxDecl || localDecl.binderInfo.isInstImplicit do
if (← getMCtx).findLocalDeclDependsOn localDecl fun fvarId => s.contains fvarId then
r := r.insert localDecl.fvarId
s := s.insert localDecl.fvarId

9
tests/lean/run/394.lean Normal file
View file

@ -0,0 +1,9 @@
def casesTFOn {motive : Prop → Sort _} (P) [inst : Decidable P] : (T : motive True) → (F : motive False) → motive P :=
λ ht hf => match inst with
| isTrue H => eqTrue H ▸ ht
| isFalse H => eqFalse H ▸ hf
example (P) [Decidable P] : ¬¬P → P := by
induction P using casesTFOn
admit
admit