Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omega canonicalizer vs. universe expressions #3848

Closed
nomeata opened this issue Apr 8, 2024 · 0 comments · Fixed by #3853
Closed

omega canonicalizer vs. universe expressions #3848

nomeata opened this issue Apr 8, 2024 · 0 comments · Fixed by #3853
Labels
bug Something isn't working

Comments

@nomeata
Copy link
Collaborator

nomeata commented Apr 8, 2024

At the time of writing, omega does not use full defEq when recognizing atoms, but since #3639 the aim is to consider atoms equal if they are definitionally equal, but differ only in implicit parameters.

Universe parameters are similarly implicit to the user, and cause great confusion in a proof like

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

where the user sees

omega did not find a contradiction:
[0, 0, 1] ∈ [0, ∞)
[0, 0, 0, 1] ∈ [0, ∞)
[1, -1, -1] ∈ [2, ∞)
[0, 1] ∈ [0, ∞)
[0, 0, 1, -1] ∈ [1, ∞)
[1] ∈ [0, ∞)

when they expect omega to solve it.

To debug the problem I had to come up with #3847 and turn on set_option pp.universes true, and now we see what goes wrong:

omega could not prove the goal:
a possible counterexample may satisfy the constraints
x₃ ∈ [0, ∞)
x₄ ∈ [0, ∞)
x₁ - x₂ - x₃ ∈ [2, ∞)
x₂ ∈ [0, ∞)
x₃ - x₄ ∈ [1, ∞)
x₁ ∈ [0, ∞)
where
x₁ := ↑(sizeOf.{(max u v) + 1} xs)
x₂ := ↑(sizeOf.{u + 1} fst✝)
x₃ := ↑(sizeOf.{v + 1} snd✝)
x₄ := ↑(sizeOf.{max (u + 1) (v + 1)} xs)

One can work around the problem by changing the lemma statement as such

theorem sizeOf_snd_lt_sizeOf_list
  {α : Type u} {β : Type v} [SizeOf α] [SizeOf β] {x : α × β} {xs : List (α × β)} :
  x ∈ xs → sizeOf x.snd < 1 + sizeOf.{(max u v)+1} xs

but arguably one shouldn't have to.

Versions

0aa6831

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant