-
Notifications
You must be signed in to change notification settings - Fork 444
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
feat: omega: more helpful error messages #3847
Conversation
Mathlib CI status (docs):
|
Draft status to indicate that I don't consider the code finished, but would like to hear if I should go ahead with this, and what changes, if any, you’d like to see for the output. (I wonder if such non-trivial error messages should be constructed lazily, using |
while trying to help a user who was facing an unhelpful ``` omega did not find a contradiction: [0, 0, 0, 0, 1, -1] ∈ [1, ∞) [0, 0, 0, 0, 0, 1] ∈ [0, ∞) [0, 0, 0, 0, 1] ∈ [0, ∞) [1, -1] ∈ [1, ∞) [0, 0, 0, 1] ∈ [0, ∞) [0, 1] ∈ [0, ∞) [1] ∈ [0, ∞) [0, 0, 0, 1, 1] ∈ [-1, ∞) ``` I couldn’t resist and wrote a pretty-printer for these problem that shows the linear combination as such, and includes the recognized atoms. This is especially useful since oftem `omega` failures stem from failure to recognize atoms as equal. In this case, we now get: ``` omega-failure.lean:17:2-17:7: error: omega could not prove the goal: a possible counterexample may satisfy the constraints x₅ - x₆ ∈ [1, ∞) x₆ ∈ [0, ∞) x₅ ∈ [0, ∞) x₁ - x₂ ∈ [1, ∞) x₄ ∈ [0, ∞) x₂ ∈ [0, ∞) x₁ ∈ [0, ∞) x₄ + x₅ ∈ [-1, ∞) where x₁ := ↑(sizeOf xs) x₂ := ↑(sizeOf x) x₄ := ↑(sizeOf x.fst) x₅ := ↑(sizeOf x.snd) x₆ := ↑(sizeOf xs) ``` and this might help the user make progress (e.g. by using `case x` first, and investingating why `sizeOf xs` shows up twice)
also indent
a8cc51a
to
fee523c
Compare
I was expecting this to be somewhat expensive in the presence of So I guess we can merge this as it is (and maybe use lazy error message construction here once we have it.) |
This is really good stuff :-) But are subscripted
Otherwise we may end up squinting, especially when working on laptops. This example is not perfect - It's weird using beginning-of-alphabet for variables rather than constants, and the naming could use late-alphabet letters. But I do think separate names is good. In either case, I would hope that the name selection avoids things already in scope, which is needed with subscripted variables anyway, as users might do that. And I noticed that there was no x_3 atom in the original message - is that because the atom was unconstrained? |
As much as I 🤎 unicode, I fear you are right. |
@david-christiansen, I implemented your idea, I think. What do you think of that? |
while trying to help a user who was facing an unhelpful
I couldn’t resist and wrote a pretty-printer for these problem that
shows the linear combination as such, and includes the recognized atoms.
This is especially useful since oftem
omega
failures stem from failureto recognize atoms as equal. In this case, we now get:
and this might help the user make progress (e.g. by using
case x
first, and investingating why
sizeOf xs
shows up twice)