Skip to content

Commit

Permalink
fix: omega: ignore levels in canonicalizer (#3853)
Browse files Browse the repository at this point in the history
fixes #3848
  • Loading branch information
nomeata authored Apr 10, 2024
1 parent 892bfe2 commit 280525f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Lean/Meta/Canonicalizer.lean
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ private partial def mkKey (e : Expr) : CanonM Key := do
return key
else
let key ← match e with
| .sort .. | .fvar .. | .bvar .. | .const .. | .lit .. =>
| .sort .. | .fvar .. | .bvar .. | .lit .. =>
pure { e := (← shareCommon e) }
| .const n ls =>
pure { e := (← shareCommon (.const n (List.replicate ls.length levelZero))) }
| .mvar .. =>
-- We instantiate assigned metavariables because the
-- pretty-printer also instantiates them.
Expand Down
12 changes: 12 additions & 0 deletions tests/lean/run/issue3848.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
theorem sizeOf_snd_lt_sizeOf_list
{α : Type u} {β : Type v} [SizeOf α] [SizeOf β] {x : α × β} {xs : List (α × β)} :
x ∈ xs → sizeOf x.snd < 1 + sizeOf xs
:= by
intro h
have h1 := List.sizeOf_lt_of_mem h
have h2 : sizeOf x = 1 + sizeOf x.1 + sizeOf x.2 := rfl
cases x; dsimp at *
omega -- this only works if universe levels are normalizes by the omega canonicalizier

-- another example
theorem ex.{u,v} : sizeOf PUnit.{(max u v) + 1} = sizeOf PUnit.{max (u + 1) (v + 1)} := by omega

0 comments on commit 280525f

Please sign in to comment.