-
Notifications
You must be signed in to change notification settings - Fork 0
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
Verifier 1 #10
Merged
Verifier 1 #10
Conversation
This file contains 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.
Summary
z3
as a SMT solverst
blocks for satisfiabilityDescription
In this iteration of the verifier, we approach checking the logical bounds of different declarations for satisfiability. We first parse the declaration blocks and construct the scopes of
Z3
constants so we can refer to them in logical formulas.We then establish any links between declarations (i.e., an encapsulated model in a state, state transition bound in function, state inheritance bound in states). This later allows us to verify that constraints in linked entities don't contradict each other.
The next stage is to parse the expression AST into concrete Z3 AST.
With parsing, we have several limitations and workarounds:
s1.field
), then we resolve thes1
scope and lookup the Z3 constant forfield
.enum_ident.field_name
ident.field_no
k!1 => a > b
)Having parsed the expression, we can now check the constraints of individual blocks for satisfiability. We extract a list of constraints for each declaration block and use the solver to check. If the bounds are unsatisfiable, then we find the unsatisfiable core (the constants that contradict each other) and return their numbers to the caller, which later gets reported by the CLI.
With constraints from linked blocks, we construct an undirected graph of linked nodes and find linked components using the Tarjan scc algorithm. For each block of connected components, we collect constraints and map them to their respective declaration symbols. The verification procedure is the same as above, except we return constraint numbers with their respective symbols in order to find conflicting declarations.