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

Fix issue 737 #738

Closed
wants to merge 4 commits into from
Closed

Fix issue 737 #738

wants to merge 4 commits into from

Conversation

Halbaroth
Copy link
Collaborator

This PR fix the issue #737.

@Halbaroth Halbaroth added this to the 2.5.0 milestone Jul 18, 2023
@Halbaroth Halbaroth linked an issue Jul 18, 2023 that may be closed by this pull request
@Halbaroth Halbaroth mentioned this pull request Jul 18, 2023
@Halbaroth Halbaroth changed the title Fix the error message. Fix issue 737 Jul 18, 2023
begin
(* TODO: add the location of the statement. *)
Printer.print_smtlib_err
"get-model is not supported with the SAT solver %a."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we actually reach this point? I think that if the SAT solver is not Tableaux, we will already fail when set-option :produce-models is encountered, and if set-option :produce-models is not encountered, we will fail as well.

(Actually, do we? We probably should just error out with "model generation is disabled" here, independenty of the solver, no?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can reach this point. This is the very purpose of this PR to add an appropriate error message in this case.
This error occurs when we call Alt-Ergo without specifying the sat solver but using get-model in the input file. Another solution would be to change automatically the SAT solver to Tableaux when we see a set-option :produce-models.

Copy link
Collaborator

@bclement-ocp bclement-ocp Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot do that because set-option :produce-models happens after we have chosen the SAT solver.

But what I don't understand is if we call Alt-Ergo without a solver but use get-model without setting --interpretation we should have an error that the interpretation is INone, so I don't understand why we proceed past that part. Maybe we don't have that error.

To clarify:

  • If we see a get-model and the interpretation is INone, we must error out because we are not in model-generation mode. This is independent of the solver used. I am not sure we actually do this currently but we must do it.
  • To reach get-model with a non-INone interpretation, we must either have a (set-option :produce-models), or set the --interpretation or --produce-model command line flags.
  • (set-option :produce-models) errors out if the solver is not Tableaux (I think it does, but am not actually sure)
  • The flags --interpretation and --produce-model forces the solver to Tableaux, or error out if another solver is explicitly provided (I believe I wrote that code)

So I don't understand when we reach the point where the solver is relevant here -- either we have the interpretation set, and the solver is necessarily Tableaux, or we don't, and that's an error independent of the solver. If we can have a non-INone interpretation with a non-Tableaux solver somehow, that's the bug we need to fix.

Copy link
Collaborator Author

@Halbaroth Halbaroth Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, you are right. I tried to do it last month, I forgot this issue.

  • Currently, if we use (set-option :produce-models), AE actives the generation of models but you have to choose the SAT-solver.
    | ":produce-models", Symbol { name = Simple "true"; _ } ->
    (* TODO: The generation of models is supported only with the SAT
    solver Tableaux. Remove this line after merging the OptimAE
    PR. See https://github.com/OCamlPro/alt-ergo/pull/553 *)
    if Stdlib.(Options.get_sat_solver () = Tableaux) then
    Options.set_interpretation ILast
    else Printer.print_wrn "%a The generation of models is not supported \
    for the current SAT solver. Please choose the \
    SAT solver Tableaux."
    Loc.report st_loc

    It doesn't produce an error if you use the flag --interpretation none.
    If you reach a get-model without using set-option :produce-models or the flags --interpretation, --produce-model, --dump-models, AE displays a smtlib error.
  • It is the case.
  • (set-option :produce-models) produces an error if we don't choose an appropriate SAT solver.
  • I confirm that AE prints an error if we try to use another SAT solver with the flags --produce-model and --interpretation forces the SAT-solver to Tableaux.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming! Then it seems to me that this new error is redundant with the existing one below (which should mention --produce-models in addition to :produce-models, I guess), no?

Copy link
Collaborator

@bclement-ocp bclement-ocp Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, then that's the actual issue. We should fail if we see (set-option :produce-models true) but can't produce models due to a wrong solver being selected.

(I said "we should ignore" but no -- we really should error I think)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the warning message and now AE fails properly when we forget to set the right sat solver.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually after re-reading the smtlib spec I believe we should "fail" in the sense of returning an smtlib error but then continue as if the set-option was not encountered.

I think this PR should also update the message when we see a get-model but we are not in model-production mode; currently it says to use (set-option :produce-models true) but it should say to use --produce-models instead, because otherwise there will immediately be another error due to Tableaux not being selected.

(And maybe add tests for the combinations of --produce-models / set-option / get-model?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we can add some cram tests but we should fix the issue with Mac OS first.

I will print a smtlib error but we don't print anything if there is (get-model) after a failed set-option?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do I think? It's the message that currently says "please use set-option :produce-models"

src/bin/common/solving_loop.ml Outdated Show resolved Hide resolved
SAT solver Tableaux."
else Printer.print_wrn "%a The generation of models is not supported yet \
by the SAT solver %a. Please use the \
meta-option `--produce-models`."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is meta about that option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this option turns some other options on. I can remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right -- it is roughly equivalent to --sat-solver Tableaux --interpretation last indeed (but not exactly; --interpretation can still be overwritten separately) but that is an implementation detail, from the user point of view it is just an option.

bclement-ocp added a commit to bclement-ocp/alt-ergo that referenced this pull request Jul 25, 2023
@Halbaroth Halbaroth closed this Jul 25, 2023
Halbaroth pushed a commit that referenced this pull request Jul 25, 2023
This is a reloaded version of #738 with tests.

Fixes #737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print irrelevant smt error when we don't choose the tableaux solver
2 participants