-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix(Dolmen): Parse triggers from formula body #1051
fix(Dolmen): Parse triggers from formula body #1051
Conversation
CI is failing due to #1052 |
src/lib/frontend/d_cnf.ml
Outdated
| _ -> [] | ||
end | ||
in | ||
let trgs = root_trgs @ body_trgs in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my understanding, root_trgs
or body_trgs
are disjoint? I understand you use the concatenation operator here because l @ []
and [] @ l
are reduced immediately to l
, but for sake of readability, I would prefer to match on the logic stored in the state of the typer as you did here:
let builtins =
fun _st (lang : Typer.lang) ->
match lang with
| `Logic Alt_ergo -> ae_fpa_builtins
| `Logic (Smtlib2 _) -> bv_builtins ++ smt_fpa_builtins
| _ -> fun _ _ -> `Not_found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to say that doing a concatenation this way is more robust to potential future Dolmen changes, but actually the code as written is buggy in the case of nested quantifiers in SMT (we pick up the pattern for both the outer and inner quantifier), good catch!
41c4b0b
to
0d54248
Compare
Ready for round 2 - updated to dispatch trigger parsing depending on current language. This is a bit more involved because we needed to pass through the language information to the |
It seems the CI still fails even after we have merged #1052. Do you know what's happening? |
I think either the language attribute from Dolmen is wrong, or there are certain cases where Dolmen actually stores the annotations on the body of the trigger in AE format… looking into it. |
Well it looks like what is happening is that the triggers are always on the body 😅 That's what I get for not double-checking this statement from a hallway conversation with @Gbury:
(In hindsight, the fact that some AE tests were failing with our old code was suspicious) |
Triggers are annotated on the body of the quantifier, but Alt-Ergo looks them up on the quantifier itself. This used to be OK, because Dolmen used to copy tags from the body to the quantifier. Since Gbury/dolmen#207 Dolmen no longer performs this copy, which means that we now ignore triggers (or rather, we use the triggers of the parent quantifier if it exists -- which is wrong). This patch looks for trigger on the body instead, to be compatible with future Dolmen releases. This patch also bumps the Dolmen version for obvious reasons.
c3b225c
to
c296019
Compare
Updated the patch to only look on the body for triggers and filters as per the AE parser in Dolmen. Also added more tests to cover success and failure cases in both formats. |
Oops, sorry about that. Maybe I should try and add some documentation about that kind of things (but the question is then: where ?). |
No worries; I think we were both confused between what Alt-Ergo does (it did check on the quantifier) and what the Dolmen parser for Alt-Ergo does (it annotates on the body). We could probably add a note here; the SMT-LIB triggers is documented to be on the body but not the AE trigger. (Both are used through here which mixes all these together even though they share many of the same fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and the clarification.
Triggers are annotated on the body of the quantifier, but Alt-Ergo looks them up on the quantifier itself. This used to be OK, because Dolmen used to copy tags from the body to the quantifier.
Since Gbury/dolmen#207 Dolmen no longer performs this copy, which means that we now ignore triggers (or rather, we use the triggers of the parent quantifier if it exists -- which is wrong).
This patch looks for trigger on the body instead, to be compatible with future Dolmen releases.
This patch also bumps the Dolmen version for obvious reasons.
See also: #1050