Skip to content

Commit

Permalink
fix: instantiate mvars of indices before instantiating fvars
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-adjedj committed Jul 10, 2024
1 parent 582d6e7 commit 72a876c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Lean/Elab/Inductive.lean
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ private def mkInductiveDecl (vars : Array Expr) (views : Array InductiveView) :
let indFVar := indFVars[i]!
Term.addLocalVarInfo views[i]!.declId indFVar
let r := rs[i]!
let type := r.type |>.abstract r.params |>.instantiateRev params
let type ← instantiateMVars r.type
let type := type |>.abstract r.params |>.instantiateRev params
let type ← mkForallFVars params type
let ctors ← withExplicitToImplicit params (elabCtors indFVars indFVar params r)
indTypesArray := indTypesArray.push { name := r.view.declName, type, ctors }
Expand Down
9 changes: 9 additions & 0 deletions tests/lean/run/3242.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ inductive R (F: α → α → Prop) (a : α) : α → Prop where
inductive And₂ (F: α → α → Prop) (a : α) : α → (Nat → α) → Nat → Prop where
| mk (b : α) (f : Nat → α) (n : Nat): R F a (f n) → F (f n) b → And₂ F a b f n
end


structure Salg (n k: Nat) where
D: Type

mutual
inductive Ins (salg: Salg n k) : salg.D → Prop
inductive Out (salg: Salg n k) : salg.D → Prop
end

0 comments on commit 72a876c

Please sign in to comment.