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

Decision level of SatML after calling unsat #1063

Open
Halbaroth opened this issue Mar 19, 2024 · 0 comments
Open

Decision level of SatML after calling unsat #1063

Halbaroth opened this issue Mar 19, 2024 · 0 comments
Assignees

Comments

@Halbaroth
Copy link
Collaborator

Halbaroth commented Mar 19, 2024

While implementing the get-value support (see #1032), I noticed that the decision level of SatML isn't always zero after calling SAT.unsat. It means we cannot always assert new facts after unsat if we use directly the SAT API of Alt-Ergo. A minimal example:

open AltErgoLib
module SAT = Satml_frontend.Make(Theory.Main_Default)

let assume env id e =
  SAT.assume env
    {Expr.ff= e;
     origin_name = id;
     gdist = -1;
     hdist = 0;
     trigger_depth = max_int;
     nb_reductions = 0;
     age=0;
     lem=None;
     mf=true;
     gf=false;
     from_terms = [];
     theory_elim = true;
    }
    Explanation.empty

let check env =
  try
    let ex = SAT.unsat env
        {Expr.ff=Expr.vrai;
         origin_name = "";
         hdist = -1;
         gdist = 0;
         trigger_depth = max_int;
         nb_reductions = 0;
         age=0;
         lem=None;
         mf=true;
         gf=true;
         from_terms = [];
         theory_elim = true;
        }
    in
    raise_notrace (SAT.Unsat ex)
  with
  | SAT.I_dont_know | SAT.Sat -> ()

let () =
  let p = Expr.mk_term (Symbols.name "p") [] Ty.Tbool in
  let q = Expr.mk_term (Symbols.name "q") [] Ty.Tbool in
  let imp = Expr.mk_imp p q in
  let env = SAT.empty () in
  assume env "foo" imp;
  try
    check env;
    let r = Expr.mk_term (Symbols.name "r") [] Ty.Tbool in
    assume env "boo" r;
    Format.printf "unknown@."
  with
  | SAT.Unsat _ -> Format.printf "unsat@."

The line assume env "boo" r raises the assertion:

assert (SAT.decision_level env.satml == 0);

This program behaves as expected if we replace SatML by FunSAT.

@Halbaroth Halbaroth added the bug label Mar 19, 2024
@Halbaroth Halbaroth self-assigned this Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants