Skip to content

Commit

Permalink
fix: missing whnf in mkBelowBinder and mkMotiveBinder (leanprov…
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-adjedj authored Dec 1, 2023
1 parent 8be3897 commit 66cb44c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Lean/Meta/IndPredBelow.lean
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ where
let fail _ := do
throwError "only trivial inductive applications supported in premises:{indentExpr t}"

let t ← whnf t
t.withApp fun f args => do
if let some name := f.constName? then
if let some idx := ctx.typeInfos.findIdx?
Expand All @@ -190,6 +191,7 @@ where
(domain : Expr)
{α : Type} (k : Expr → MetaM α) : MetaM α := do
forallTelescopeReducing domain fun xs t => do
let t ← whnf t
t.withApp fun _ args => do
let hApp := mkAppN binder xs
let t := mkAppN vars.motives[indValIdx]! $ args[ctx.numParams:] ++ #[hApp]
Expand Down
10 changes: 10 additions & 0 deletions tests/lean/deltaRedIndPredBelow.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/-!
# Verify that `below` lemmas work in cases where they may need to δ-reduce things
Fixes issue #2990
-/

def Foo (F : α -> Prop) : Prop :=
∀ x , F x

inductive Bad : Nat -> Prop :=
| bar e : Foo (fun _ => Bad e) -> Bad e
Empty file.

0 comments on commit 66cb44c

Please sign in to comment.