fix: omega: ignore levels in canonicalizer (#3853)

fixes #3848
This commit is contained in:
Joachim Breitner 2024-04-10 10:46:07 +02:00 committed by GitHub
parent 892bfe2c5f
commit 280525f1fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -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.

View file

@ -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