Add assertion levels in SatML#1297
Merged
Merged
Conversation
`Satml_frontend` assumes that `assume` and `check_sat` are always called on a SatML environment with no prior decisions. It works in the current codebase because, in the presence of pop/push, we always restart from a fresh environment. The assertion: ```ocaml assert (SAT.decision_level env.satml == 0) ``` is replaced with: ```ocaml assert (SAT.decision_level env.satml <= SAT.assertion_level env.satml) ``` Notice that we cannot enforce the assertion: ```ocaml assert (SAT.decision_level env.satml = SAT.assertion_level env.satml) ``` Consider for instance: ```ocaml let env = SAT.env () in SAT.push env 1; SAT.assume env f; (* <--- HERE *) ... ``` Internally, `SAT.assume env f` adds the formula `g => f` into the environment of SatML where `g` is a guard formula introduced in `SAT.push`. But `SatML.assume` does not decide the guard formula [g], so the decision level is 0 but the assertion level is 1. Guards are decided (with the highest priority) in `SatML.solve`, which is called by `SAT.unsat`. I didn't add the new assertion into `SAT.assume_th_elt` because this function is only used for handling the theory concept in native language and we always invoke it at the assertion level 0.
bclement-ocp
approved these changes
Feb 17, 2025
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Satml_frontendassumes thatassumeandcheck_satare always called on a SatML environment with no prior decisions. It works in the current codebase because, in the presence of pop/push, we always restart from a fresh environment.This PR is a preparation for #1288.
The assertion:
is replaced with:
Notice that we cannot enforce the assertion:
Consider for instance:
Internally,
SAT.assume env fadds the formulag => finto the environment of SatML wheregis a guard formula introduced inSAT.push. ButSatML.assumedoes not decide the guard formulag, so the decision level is 0 but the assertion level is 1. Guards are decided (with the highest priority) inSatML.solve, and is called bySAT.unsat.I didn't add the new assertion into
SAT.assume_th_eltbecause this function is only used for handling the theory concept in native language and we always invoke it at the assertion level 0.