-
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
CDCL
produces model values for popped symbols
#1243
Comments
CDCL
produces model values CDCL
produces model values for popped symbols
This PR removes: - the deprecated legacy frontend (parser and typechecker), - the deprecated AB-Why3 plugin which depends on the legacy parser, - the associated opam packages and dependencies (including `shell.nix` and our Makefile), - all the reference in the documentation to these bastards, - simplify `gentest` and rename the tag `dolmen` into `cdcl` in `tests/`, - the option `frontend` in `Options`. I also update the `Lib_usage` example because we now use the Dolmen. We keep the `--frontend` option but now it is a no op command and we output an appropriate message if users still use it. This PR cannot be merged before fixing OCamlPro#1243.
This PR removes: - the deprecated legacy frontend (parser and typechecker), - the deprecated AB-Why3 plugin which depends on the legacy parser, - the associated opam packages and dependencies (including `shell.nix` and our Makefile), - all the reference in the documentation to these bastards, - simplify `gentest` and rename the tag `dolmen` into `cdcl` in `tests/`, - the option `frontend` in `Options`. I also update the `Lib_usage` example because we now use the Dolmen. We keep the `--frontend` option but now it is a no op command and we output an appropriate message if users still use it. This PR cannot be merged before fixing OCamlPro#1243.
After a quick investigation, I have an almost correct patch to apply on diff --git a/src/lib/reasoners/uf.ml b/src/lib/reasoners/uf.ml
index 4049634c..391c3746 100644
--- a/src/lib/reasoners/uf.ml
+++ b/src/lib/reasoners/uf.ml
@@ -1122,14 +1122,19 @@ let is_suspicious_symbol = function
| Symbols.Name { hs; _ } when is_suspicious_name hs -> true
| _ -> false
-let terms env =
+let terms ~declared_ids env =
+ let set =
+ List.fold_left
+ (fun acc (hs, _, _) -> Hstring.Set.add hs acc)
+ Hstring.Set.empty declared_ids
+ in
ME.fold
(fun t r ((terms, suspicious) as acc) ->
let Expr.{ f; _ } = Expr.term_view t in
match f with
- | Name { defined = true; _ } ->
- (* We don't store names defined by the user. *)
- acc
+ | Name { hs; _ } when
+ not @@ Hstring.Set.mem (Hstring.make @@ Id.show hs) set ->
+ acc
| _ ->
let suspicious = is_suspicious_symbol f || suspicious in
MED.add t r terms, suspicious
@@ -1251,7 +1256,7 @@ let extract_concrete_model cache =
let compute_concrete_model_of_val = compute_concrete_model_of_val cache in
let get_abstract_for = Cache.get_abstract_for cache.abstracts
in fun ~prop_model ~declared_ids env ->
- let terms, suspicious = terms env in
+ let terms, suspicious = terms ~declared_ids env in
let model, mrepr =
MED.fold (fun t _mk acc -> compute_concrete_model_of_val env t acc)
terms (ModelMap.empty ~suspicious declared_ids, ME.empty) But this patch is not correct for two reasons:
|
Ah yes of course because we will still decide on I'm not sure there is an easy fix possible for that 2nd issue, we probably just should have a proper scoping mechanism for push/pop, not just the SAT-level guards — I'd say it is fine to have the fix for models adapted for #1251 and live with the extra symbols in the union-find for now (keeping this issue open of course). To be fair, I also think it is fine to leave things as is; realistically, nobody is using the (non-Tableaux) CDCL solver for model generation. Edit: I accidentally a sentence. |
I caught the bug because I ran model tests with both CDCL-Tableaux and CDCL. I didn't intend to test the feature with CDCL but it happened when I modified
I am not sure to understand why we still decide on this propositional variable after popping. I thought that the guard mechanism will introduce a fresh variable |
Yes I understand you were not looking for this specifically — all I am saying is that I don't think it is worth expending too much effort fixing it in full, because I don't think a "proper" fix is possible without reworking the push/pop mechanism itself. The patch proposed above should be sufficient for the time being IMO (edit: IOW I think your proposed plan above looks good; I'm not sure the 3rd point is necessary because if we do the 2nd point model generation should work as expected with CDCL). Your reasoning is correct, except that CDCL-Tableaux has two relevant differences with CDCL here: it does not make irrelevant decisions (so here we would not decide on (If you use |
The SAT solver
CDCL
still produces model values for symbols that have been popped of the context. For instance this input file:produces a value for
f
withCDCL
but does not it withCDCL-Tableaux
.The text was updated successfully, but these errors were encountered: