Skip to content

Commit cdcd7b0

Browse files
committed
fix: .eq_def theorem generation with messy universes
closes #4673
1 parent ce73bbe commit cdcd7b0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/Lean/Elab/PreDefinition/Eqns.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def tryContradiction (mvarId : MVarId) : MetaM Bool := do
333333
partial def mkUnfoldProof (declName : Name) (mvarId : MVarId) : MetaM Unit := do
334334
let some eqs ← getEqnsFor? declName | throwError "failed to generate equations for '{declName}'"
335335
let tryEqns (mvarId : MVarId) : MetaM Bool :=
336-
eqs.anyM fun eq => commitWhen do
336+
eqs.anyM fun eq => commitWhen do checkpointDefEq (mayPostpone := false) do
337337
try
338338
let subgoals ← mvarId.apply (← mkConstWithFreshMVarLevels eq)
339339
subgoals.allM fun subgoal => do

tests/lean/run/4673.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def iscoh_wmap {A:Type _}{B:Type _} : (A -> B) -> Type _ :=
2+
fun f => @Subtype (B -> A) fun r => ∀ a , a = r (f a)
3+
def wmap : Type _ -> Type _ -> Type _ :=
4+
fun A B => @Sigma (A -> B) fun f => iscoh_wmap f
5+
6+
def hgroup : Nat -> Type _ -> Type _
7+
| .zero , T => wmap T T
8+
| .succ a, T => wmap (hgroup a T) (hgroup a T)
9+
10+
example : hgroup 0 Unit := by
11+
unfold hgroup
12+
admit
13+
14+
-- TODO: we should improve univere inference. It should be
15+
-- hgroup.{u} : Nat → Type u → Type u
16+
/--
17+
info: hgroup.{u_1, u_2} : Nat → Type (max u_1 u_2) → Type (max u_1 u_2)
18+
-/
19+
#guard_msgs in
20+
#check hgroup

0 commit comments

Comments
 (0)