Skip to content

Commit

Permalink
fix: instantiate the types of inductives with the right parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-adjedj committed Feb 2, 2024
1 parent 43bbedc commit bfaefc2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Lean/Elab/Inductive.lean
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,9 @@ private def mkInductiveDecl (vars : Array Expr) (views : Array InductiveView) :
for i in [:views.size] do
let indFVar := indFVars[i]!
Term.addLocalVarInfo views[i]!.declId indFVar
let r := rs[i]!
let type ← mkForallFVars params r.type
let r := rs[i]!
let type := r.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 }
Term.synthesizeSyntheticMVarsNoPostponing
Expand Down
13 changes: 13 additions & 0 deletions tests/lean/run/3242.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mutual
inductive A (α : Type) : α → Type where

inductive B (α : Type) : α → Type where
end

mutual
inductive R (F: α → α → Prop) (a : α) : α → Prop where
| ind : ∀ (f: Nat → α) b, (∀ n, And₂ F a b f n) → R F a b

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

0 comments on commit bfaefc2

Please sign in to comment.