From 2ec83857678cf1028080ea9cb1f8791aa00c87d0 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 13 Apr 2022 07:54:47 -0700 Subject: [PATCH] fix: `isDomainDefEq` --- src/Lean/Elab/Inductive.lean | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Lean/Elab/Inductive.lean b/src/Lean/Elab/Inductive.lean index f54e03b756..ae7a7a4990 100644 --- a/src/Lean/Elab/Inductive.lean +++ b/src/Lean/Elab/Inductive.lean @@ -640,8 +640,17 @@ private def isDomainDefEq (arrowType : Expr) (type : Expr) : MetaM Bool := do if !arrowType.isForall then return false else - withNewMCtxDepth do -- Make sure we do not assign univers metavariables - isDefEq arrowType.bindingDomain! type + /- + We used to use `withNewMCtxDepth` to make sure we do not assign universe metavariables, + but it was not satisfactory. For example, in declarations such as + ``` + inductive Eq : α → α → Prop where + | refl (a : α) : Eq a a + ``` + We want the first two indices to be promoted to parameters, and this will only + happen if we can assign universe metavariables. + -/ + isDefEq arrowType.bindingDomain! type /-- Convert fixed indices to parameters.