Created
March 13, 2020 19:28
-
-
Save aterga/c11a36e0ea7f67ea17317615750050ad to your computer and use it in GitHub Desktop.
Outputs comma-separated pairs of the form: "file.smt2, (A0, A1, ..., AN)" where As are the names of SMT assertions (set via the :named annotations).
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
| #!/bin/bash | |
| printf "$1," | |
| RESPONSE=$(( | |
| (echo "(set-option :produce-unsat-cores true)"); | |
| (echo "(set-option :smt.core.minimize true)"); | |
| (cat $1); | |
| (echo "(get-unsat-core)") | |
| ) | z3 -smt2 -in) | |
| if echo $RESPONSE | grep -q unknown; | |
| then | |
| >&2 echo Did not get Unsat Core from Z3, taking all named assertions instead; | |
| UNSAT_CORE=$(cat $1 | grep -oP ':named \K.*(?=\)\))' | tr "\n" " " | awk '{$1=$1};1') | |
| printf "($UNSAT_CORE)\n"; | |
| else | |
| echo ${RESPONSE#"unsat"}; | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment