Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce Eq.rec when mvars are present #6577

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Lean/Meta/WHNF.lean
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ private def toCtorWhenK (recVal : RecursorVal) (major : Expr) : MetaM Expr := do
let majorTypeI := majorType.getAppFn
if !majorTypeI.isConstOf recVal.getMajorInduct then
return major
else if majorType.hasExprMVar && majorType.getAppArgs[recVal.numParams:].any Expr.hasExprMVar then
return major
else do
let (some newCtorApp) ← mkNullaryCtor majorType recVal.numParams | pure major
let newType ← inferType newCtorApp
Expand Down
24 changes: 24 additions & 0 deletions tests/lean/6562.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/-! Patterns with metavariables should still satisfy defeqs -/

example : (x : Nat) → (Eq.refl x).symm.ndrec (motive := fun _ => Bool) false = false → Unit
| _, rfl => ()

inductive Mem (a : α) : List α → Type
| head (as : List α) : Mem a (a::as)
| tail (b : α) {as : List α} : Mem a as → Mem a (b::as)

def del : @Mem α a as → List α
| .head as => as
| .tail b mem => b :: del mem

def memOfDel : (mem : Mem c as) → Mem a (del mem) → Mem a as
| .head _, mem => .tail _ mem
| .tail _ mem, .head _ => .head _
| .tail _ mem, .tail _ mem' => .tail _ (memOfDel mem mem')

def memOfDel' : (mem : Mem c as) → Mem a (del mem) → Mem a as
| .head _, mem => .tail _ mem
| .tail b mem, (mem' : Mem a (b :: del mem)) =>
match mem' with
| .head _ => .head _
| .tail _ mem' => .tail _ (memOfDel' mem mem')
Empty file.
Loading