Skip to content

Commit 5044181

Browse files
committed
fix: grind invalid universe level regression
This PR fixes the `grind` invalid universe level regression reported in #11036 Closes #11036
1 parent 16d0005 commit 5044181

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/Lean/Meta/Tactic/Grind/Arith/Linear/StructId.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def getStructId? (type : Expr) : GoalM (Option Nat) := do
171171
return id?
172172
where
173173
go? : GoalM (Option Nat) := do
174-
let u ← getDecLevel type
174+
let some u ← getDecLevel? type | return none
175175
let ringId? ← CommRing.getCommRingId? type
176176
let leInst? ← getInst? ``LE u type
177177
let ltInst? ← getInst? ``LT u type

tests/lean/run/grind_11036.lean

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
variable {α : Sort u} {β : α → Sort v} {α' : Sort w} [DecidableEq α]
2+
{f : (a : α) → β a} {a : α} {b : β a}
3+
4+
/-- Replacing the value of a function at a given point by a given value. -/
5+
def Function.update (f : ∀ a, β a) (a' : α) (v : β a') (a : α) : β a :=
6+
if h : a = a' then Eq.ndrec v h.symm else f a
7+
8+
@[simp]
9+
theorem Function.update_self (a : α) (v : β a) (f : ∀ a, β a) : update f a v a = v :=
10+
dif_pos rfl
11+
12+
@[simp]
13+
theorem Function.update_of_ne {a a' : α} (h : a ≠ a') (v : β a') (f : ∀ a, β a) : update f a' v a = f a :=
14+
dif_neg h
15+
16+
theorem domDomRestrict_aux {ι : Sort u_1} [DecidableEq ι] (P : ι → Prop) [DecidablePred P] {M₁ : ι → Type u_2}
17+
[DecidableEq {a // P a}]
18+
(x : (i : {a // P a}) → M₁ i) (z : (i : {a // ¬ P a}) → M₁ i) (i : {a : ι // P a})
19+
(c : M₁ i) : (fun j ↦ if h : P j then Function.update x i c ⟨j, h⟩ else z ⟨j, h⟩) =
20+
Function.update (fun j => if h : P j then x ⟨j, h⟩ else z ⟨j, h⟩) i c := by
21+
ext j
22+
by_cases h : j = i <;> grind only [Function.update_self, Function.update_of_ne]

0 commit comments

Comments
 (0)