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

Extend Solver Independent SMTLib2 Parser/Generator #436

Draft
wants to merge 296 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
296 commits
Select commit Hold shift + click to select a range
8539cca
Laptopwechsel
Nov 3, 2023
d247236
Fixed nested AND for Booleans, added NumeralGeneratorTest
Nov 3, 2023
01dfc8f
added more NumeralGeneratorTests
Nov 3, 2023
f38f8e2
Finished NumeralGenerator test
Nov 4, 2023
471181c
Added BitVecGenerator test
Nov 5, 2023
df8c447
Changed Constructors of Models, Provers and SolverContexts to accept …
Nov 5, 2023
ba5a6be
Backup Model
Nov 6, 2023
c26d0a1
Fixed UFGenerator
Nov 6, 2023
e009c86
Fixed Modelparsing
Nov 7, 2023
6fc71c4
Backup to transfer to other Laptop
Nov 10, 2023
16fd369
connected Parser with SolverFactory and Prover
Nov 10, 2023
12e24b2
Backup fixes in Generator
Nov 12, 2023
e31ddea
Created Exceptions
Nov 13, 2023
2626c17
Finished BitvectorGeneratorTest
Nov 13, 2023
bf85403
added "let" expressions to Parser
Nov 13, 2023
ba624de
added ArrayGeneratorTest
Nov 13, 2023
6501b15
added UFGeneratorTest
Nov 14, 2023
1545c52
finished UFGeneratorTest
Nov 14, 2023
3ba08be
added BooleanParserTest
Nov 14, 2023
2055caf
fixed Arrays - again
Nov 14, 2023
96a9db2
finished ArrayParserTest
Nov 15, 2023
24cd1d5
fixed SpotBugs bugs
Nov 17, 2023
9e253ab
Refactoring, tested with Arrays
Nov 18, 2023
16dfa6a
Backup ivy configs
Nov 18, 2023
b1dbb10
Backup ivy configs without cs
Nov 18, 2023
91a28fc
Clean up Antlr4 dependency and add to classpath/Intellij config
Nov 20, 2023
c1de84e
Format project and add serial implementation in needed classes
Nov 20, 2023
dfcdb26
for pull
Nov 20, 2023
17dade6
for pull
Nov 20, 2023
4abe65e
for pull
Nov 20, 2023
0c0fc4f
refactoring
Nov 21, 2023
7bbba49
Fix publish scripts for Princess fat jar
Nov 21, 2023
27210fe
Add UnnecessaryParentheses suppression to SMTLIB2 parser
Nov 21, 2023
35fe43d
added princess dependency
Nov 21, 2023
d2efae5
Process
Nov 21, 2023
f7d8914
refactored ParserFormula
Nov 22, 2023
7248ad9
princess-all.jar with modified manifest added
Nov 22, 2023
a021e00
refactored
Nov 23, 2023
d877043
refactored
Nov 23, 2023
e33c7f0
refactored
Nov 23, 2023
ef0e3a6
first eval results
Nov 24, 2023
d832fdb
fixed bugs
Nov 26, 2023
7298d8a
Merge branch 'main' of github.com:KJanelle/java-smt into main
Nov 26, 2023
ec4f43e
xml file
Nov 27, 2023
2c3ae57
fixed usage of Generator
Nov 27, 2023
7ce18dd
Merge branch 'main' of github.com:KJanelle/java-smt into main
Nov 27, 2023
77d7a7c
fixed usage of Generator
Nov 27, 2023
b9ddfc9
fixed usage of Generator
Nov 27, 2023
0a4ca35
fixed usage of Generator
Nov 27, 2023
9f82157
fixed usage of Generator
Nov 27, 2023
568d607
evaluation tables
Nov 28, 2023
e8430eb
improved coverage of UnitTests
Nov 29, 2023
de862c2
improved coverage of UnitTests Parser
Nov 30, 2023
96da4b2
Added model tests
Dec 18, 2023
b1f260f
made keyword an ENUM
Dec 18, 2023
4579f7f
made methodToEvaluate in Generator "Optional"
Dec 18, 2023
8ef60d4
Bugfix
Dec 18, 2023
95af1b9
comments and test coverage
Dec 18, 2023
debbf48
final refactoring
Dec 18, 2023
fa5efe2
deleted princess_all-2023-06.jar
Dec 18, 2023
92d5d7a
Readd missing checkstyle config and remove Princess binary
Dec 19, 2023
8e6673d
Revert .idea and .gitignore to previous states
Dec 19, 2023
e2978b0
Fix idead Intellij JavaSMT setup (without local paths)
Dec 19, 2023
c0e0ab3
Merge branch 'solver-independent-smtlib2-parser-generator' into PR
daniel-raffler Jan 12, 2024
3927dbe
Fixed merge issues.
daniel-raffler Jan 12, 2024
a1f23d2
Added missing override annotation in SolverStackTest
daniel-raffler Jan 12, 2024
d65c73a
Use ProcessBuilder to avoid checkstyle complaint. Runtime.exec() has …
daniel-raffler Jan 12, 2024
99e1b91
Revert changes to the API. We need to find a better way of handling I…
daniel-raffler Jan 12, 2024
a243696
Restored idea files and build scripts.
daniel-raffler Jan 12, 2024
58e6586
Cleaned up SMTLIB2ParserInterpreterTest and fixed the tests for OpenSMT.
daniel-raffler Jan 13, 2024
72a8793
Rewrote BinaryModel. This fixes the remaining tests in SMTLIB2ParserI…
daniel-raffler Jan 13, 2024
6314f65
Fixed option to enable SMTLIB2 script generation. All tests in Numera…
daniel-raffler Jan 13, 2024
530f231
Fixed error message
daniel-raffler Jan 13, 2024
8f5df34
Use the princess binary from lib/native/source/princess. This should …
daniel-raffler Jan 13, 2024
cb1c441
Use the princess binary from the ivy repository.
daniel-raffler Jan 13, 2024
17ea745
Remove standalone binary of Rrincess from the repository.
daniel-raffler Jan 13, 2024
8ccd242
Delete lib/native/source/princess/princess-bin-2023-06-19/testcases/a…
daniel-raffler Jan 14, 2024
f591709
Removed backup files that were left from the Princess standalone binary.
daniel-raffler Jan 14, 2024
ce9a614
Removed Princess from build-publish-solvers.xml
daniel-raffler Jan 14, 2024
e942df6
Removed ivy conf for Princess
daniel-raffler Jan 14, 2024
58a2456
Removed unused file.
daniel-raffler Apr 21, 2024
2c77df0
Make sure logging option is always set in generateContext()
daniel-raffler Apr 21, 2024
bec413b
Enabled two tests from SolverTheoriesTest that use bitvector arrays f…
daniel-raffler Apr 21, 2024
5350d70
Cleaned up the commits.
daniel-raffler Apr 21, 2024
08dd934
Added smtlib2 logging to the OpenSmt prover.
daniel-raffler Apr 21, 2024
7d23fc6
Removed PRINCESS_BINARY from solver backends. Instead we now set the …
daniel-raffler Apr 22, 2024
f731a24
Temporarily enabled "binary mode" for all tests when Princess is used…
daniel-raffler Apr 22, 2024
b97482e
Formatting
daniel-raffler Apr 22, 2024
92531f9
Disabled tests that use parsing while testing the binary backend for …
daniel-raffler Apr 22, 2024
6dc2e94
Disabled tests that require quantifiers while testing the binary back…
daniel-raffler Apr 22, 2024
3659a5b
Disabled more tests that require features not supported by the binary…
daniel-raffler Apr 22, 2024
23746df
Partial fix for BinaryModel.
daniel-raffler Apr 22, 2024
57e6d70
Applied refaster patch.
daniel-raffler Apr 23, 2024
22003fb
Added missing license information.
daniel-raffler Apr 23, 2024
b682a70
Removed ANTLR intermediate files.
daniel-raffler Apr 23, 2024
a62e69d
Ignore autogenerated ANTLR files when running spotbugs.
daniel-raffler Apr 23, 2024
a1a31b9
Fixed Spotbug issue and made member variables in parserInterpreter.Vi…
daniel-raffler Apr 23, 2024
295be44
Skip CheckStyle checks for autogenerated ANTLR files.
daniel-raffler Apr 23, 2024
3a66546
Fixed remaining CheckStyle issues.
daniel-raffler Apr 23, 2024
9d9b28e
Fixed CheckStyle issues for the tests.
daniel-raffler Apr 23, 2024
8a51079
Fixed indentation.
daniel-raffler Apr 23, 2024
1cb60fd
Removed the line from the last commit. Checksyle and format-source ca…
daniel-raffler Apr 23, 2024
fc416e0
ParserGenerator: Add "set-logic" command only when the SMTLIB2 string…
daniel-raffler May 2, 2024
45a1e35
Add missing checks to make sure SMTLIB code is only generated when th…
daniel-raffler Oct 12, 2024
6c94141
Added more todos
daniel-raffler Oct 12, 2024
0987488
Moved comments to avoid formatting issues
daniel-raffler Oct 12, 2024
8335b63
Enable SMTLIB generation for all solvers in generator tests
daniel-raffler Oct 12, 2024
5390df5
Remove copy of SMT2_UF_and_Array.smt2 in the main folder
daniel-raffler Oct 12, 2024
24fce73
Fixed parsing of large integer constants
daniel-raffler Oct 12, 2024
e18d297
Added/updated todos
daniel-raffler Oct 12, 2024
5e4b086
Add missing cases for generator logging in AbstractEvaluator
daniel-raffler Oct 14, 2024
f63ba0c
Added missing assertion in AbstractEvaluator
daniel-raffler Oct 16, 2024
9076150
[Unstable Floating Points not useable yet!]
DavidGalllob Nov 3, 2024
c2beaca
Revert "[Unstable Floating Points not useable yet!] as it should be o…
Nov 4, 2024
61ad6d0
Revert "Revert "[Unstable Floating Points not useable yet!] as it sho…
Nov 4, 2024
f153d36
-added FloatingPoint Conversions in smtlibv2.g4 (Bitvector and Floati…
DavidGalllob Nov 5, 2024
05d2af1
Fix commit 5e4b086e6d9140629de7c37c708e2f848db8528a
daniel-raffler Nov 5, 2024
b02769b
Merge branch 'solver-independent-smtlib2-parser-generator' into exten…
Nov 6, 2024
5e68617
-added Floating Point Conversion functions in the grammar file
DavidGalllob Nov 11, 2024
b8a2c6d
-removed wrong declarations in grammar file (removed return types as …
DavidGalllob Nov 11, 2024
d358557
-added floating points to the identifiers in the grammar file, so now…
DavidGalllob Nov 11, 2024
67922cf
-generated updated parser, lexer and Visitor classes using ANTLR
DavidGalllob Nov 11, 2024
14c9da0
-fixed tiny mistakes in smtlibv2.g4 file
DavidGalllob Nov 12, 2024
3a59c54
-added declaration of floating point constants in the Visitor.java
DavidGalllob Nov 12, 2024
57e1ddf
-added almost all floating point operations to the visitor.java class…
DavidGalllob Nov 12, 2024
8904824
-changed the Constructor of the Visitor.java class so that it now tak…
DavidGalllob Nov 13, 2024
58fe220
-added parsing of Floating-Points which are in the Standard Format e.…
DavidGalllob Nov 19, 2024
7859b6e
-Visitor.java should now be able to recognize all Floating Points def…
DavidGalllob Nov 20, 2024
cacc499
-removed entire FloatingPoint implementation in smtlibv2.g4 file as i…
DavidGalllob Nov 21, 2024
a3786f5
-created 2 small tests for Floating Points
DavidGalllob Nov 22, 2024
7bef610
-created tests for Floating Point
DavidGalllob Nov 22, 2024
2bf0519
-added parsing of Strings in the Visitor.java class. (Not Tested yet)
DavidGalllob Nov 23, 2024
4b958c9
-introduced FloatingPoints and Strings as Sorts in the Generator.java
DavidGalllob Nov 26, 2024
1b4ddfd
-readded recognizitaion for FloatingPoints in the grammer file
DavidGalllob Nov 27, 2024
7838da3
-introduced FloatingPoints to the grammar again to allow whitespaces
DavidGalllob Nov 27, 2024
3815c95
-created Tests for Strings and added more for FloatingPoints
DavidGalllob Nov 27, 2024
1dda73b
-Strings now work in the Parser (tested)
DavidGalllob Nov 28, 2024
766ee33
-created empty Generator classes for FloatingPoints and Strings
DavidGalllob Nov 28, 2024
9667eeb
-added basic FloatingPoint Operations in the FloatingPointGenerator c…
DavidGalllob Nov 29, 2024
bfb9484
-added FloatingPoints and their operations to the Generator (NOT TESTED)
DavidGalllob Nov 30, 2024
cb92fff
-added missing StringOperations
DavidGalllob Dec 2, 2024
893b5d2
-added missing logging Operations to the AbstractFloatingPointFormula…
DavidGalllob Dec 3, 2024
65ad61d
-minor changes in the testclasses
DavidGalllob Dec 5, 2024
99a3379
created "SolverLess"-Dummy empty Classes to be able to parse and gene…
DavidGalllob Dec 5, 2024
19d7799
-added Dummy classes for Solving (contains errors) unstable
DavidGalllob Dec 6, 2024
2c017fd
-added SolverLess FormulaManagers and dummytypes
DavidGalllob Dec 8, 2024
13ad326
-added SolverLess FormulaManager (not working correctly yet)
DavidGalllob Dec 11, 2024
4d7fb87
-added support for floatingPoints in the solverless Solver
DavidGalllob Dec 13, 2024
896dc9b
-Fixed bugs where Arrays and Integers couldn't be created correctly
DavidGalllob Dec 14, 2024
f9a3d3a
- Bitvectors now can be parsed without a Solver.
DavidGalllob Dec 14, 2024
b16cf18
-changed formula creation and recognization in Formulacreator
DavidGalllob Dec 15, 2024
5e0c515
-added UF Manager in Solverless Solver
DavidGalllob Jan 2, 2025
df52e4e
-added correct creation of nested arrays in the Solverless Solver
DavidGalllob Jan 6, 2025
a529138
Clean up registering of SMTLIB2 Int or Real number in the generator
Jan 7, 2025
c03a3f5
Add precondition and some simplifications to recursive evaluation of …
Jan 7, 2025
bd7cdd6
Call solvers only once when logging SMTLib2 generation independently
Jan 7, 2025
1924ffb
Solverless Sovler now works with all types (nearly correctly) except UFs
DavidGalllob Jan 11, 2025
479a14d
Refactored Solverless Package name and created evaluation tests.
DavidGalllob Jan 14, 2025
f424513
-added small tests
DavidGalllob Jan 14, 2025
f74c2cd
-added FloatingPointTests
DavidGalllob Jan 16, 2025
6cb380a
Created a test environment where a String will be put directly to Z3 …
DavidGalllob Jan 18, 2025
3f627ef
fixed a problem where "makeString" would not work because they weren'…
DavidGalllob Jan 21, 2025
948eacd
-added basic functions for UFManager
DavidGalllob Jan 25, 2025
8c45e8c
-added support for Bitvectors in UFs
DavidGalllob Jan 26, 2025
9f1b5cd
-added full Support for Uninterpreted Functions in Solverless Solver
DavidGalllob Jan 27, 2025
6f72c82
bugfixes
DavidGalllob Feb 3, 2025
0e12e7d
-Solverless now can work with Floating Point formulas but still can't…
DavidGalllob Feb 11, 2025
e4e981d
-Solveless now can correctly Generate FloatingPoints
DavidGalllob Feb 11, 2025
1da6680
-Refactorings
DavidGalllob Feb 12, 2025
7cd9f6f
Bring ivysettings in line with main branch
Feb 19, 2025
a44c8ec
Refactorings.
DavidGalllob Feb 20, 2025
c28fd49
minor refactorings
DavidGalllob Feb 20, 2025
bc9e8bc
minor refactorings
DavidGalllob Feb 20, 2025
6f4a6a9
bugfixes
DavidGalllob Feb 20, 2025
0651fc7
-fixed all Warnings
DavidGalllob Feb 21, 2025
ef745e3
-modified all tests which aren't focused on Parsing/Generating to ign…
DavidGalllob Feb 22, 2025
0641132
Merge remote-tracking branch 'origin/extend-solver-independent-smtlib…
DavidGalllob Feb 22, 2025
b94eb6c
-added FloatingPoints and Strings to the ArrayGenerator
DavidGalllob Feb 22, 2025
24dc558
Disable independent SMTLib2 generator per default
Feb 25, 2025
5b6239e
Disable independent SMTLib2 generator and binary usage for Princess i…
Feb 25, 2025
08a26d7
Update results of NumeralSMTLIB2GeneratorTests for the changed SMTLib…
Feb 25, 2025
6f7dd05
Format source code (including code by Janelle)
Feb 26, 2025
689a4a5
Switch ArrayList to List types in return types
Feb 26, 2025
bd64984
-fixed all checkstyle errors
DavidGalllob Feb 27, 2025
97c170f
-fixed refaster warnings
DavidGalllob Feb 27, 2025
e6c307f
-removed unused variables
DavidGalllob Feb 27, 2025
7ca99af
-refactorings
DavidGalllob Feb 27, 2025
af41ebb
Add Checkstyle exclusion of SMTLib2 parser/lexer components that are …
Feb 28, 2025
8d1ea0a
Fix typo in spotbugs exclusion of smtlib2 parser/lexer autogenerated …
Feb 28, 2025
1108da0
-checkstyle fixes
DavidGalllob Feb 28, 2025
82b402f
-reformated source-code
DavidGalllob Mar 1, 2025
cbe3c3c
-reformated source-code
DavidGalllob Mar 1, 2025
15150f1
-added licenses everywhere it is needed.
DavidGalllob Mar 2, 2025
1692bcf
- refactorings
DavidGalllob Mar 2, 2025
4efb0ff
-fixed a bug where the generator would use equals when it should use …
DavidGalllob Mar 3, 2025
167b55e
-IMPORTANT: Excluded all mistakes from previous implementation from t…
DavidGalllob Mar 3, 2025
2ac1ce3
-reformated
DavidGalllob Mar 3, 2025
cfc6691
-excluded all tests that fail because of internal errors and previous…
DavidGalllob Mar 3, 2025
5e07da7
-reformated
DavidGalllob Mar 3, 2025
abe0781
-tiny ignores for internal errors
DavidGalllob Mar 3, 2025
56999ec
-restored all failing tests
DavidGalllob Mar 4, 2025
757f308
Merge 5.0.0 release into feature branch extend-solver-independent-smt…
Mar 5, 2025
b3a7bbf
-modified the code to fullfill code-review annotations.
DavidGalllob Mar 5, 2025
c54c7fb
Resolve merge errors and cleanup from merge of 5.0.0 release into fea…
Mar 5, 2025
3e23ef4
Merge new changes into merge of 5.0.0 release into feature branch ext…
Mar 5, 2025
dda2c8c
Format source
Mar 5, 2025
90e806b
- implemented missing overrides due to merge.
DavidGalllob Mar 6, 2025
0440f1f
- reformated
DavidGalllob Mar 6, 2025
9f2cd29
- excluded Solverless from the new merged tests.
DavidGalllob Mar 7, 2025
28c30c9
-reformated and added unfinished EvaluationTest.java for Evaluation
DavidGalllob Mar 7, 2025
a57e410
tweaked floating Point handling in the parser
DavidGalllob Mar 10, 2025
a1c37a1
included new generated files
DavidGalllob Mar 10, 2025
74acb02
- added missing parts of the FloatingPoint Support in the Visitor and…
DavidGalllob Mar 10, 2025
503b1cb
- FloatingPoints and Strings are now fully implemented in the Parser/…
DavidGalllob Mar 10, 2025
b6fb669
- refactorings
DavidGalllob Mar 11, 2025
e566af1
- added NullChecks to all Classes in basicimpl package made by me and…
DavidGalllob Mar 11, 2025
960910c
-removed unfinished file from tests
DavidGalllob Mar 11, 2025
4996608
- refactored to ImmutableList to fulfill refaster requirements
DavidGalllob Mar 11, 2025
1634df4
- refactored Tests
DavidGalllob Mar 11, 2025
605b1d6
- gave BinaryModel more time to finish its process. Tests would fail …
DavidGalllob Mar 11, 2025
ab7c432
-tweaked Tests so Appveyor build won't fail as it can't execeute Bina…
DavidGalllob Mar 11, 2025
168191d
added new option to set which Solver should SolverLess use when using…
DavidGalllob Mar 16, 2025
5ef3e1a
bugfixes
DavidGalllob Mar 16, 2025
a97530d
-removed unused fields
DavidGalllob Mar 16, 2025
c22d99a
- fixed ProverEnvironment
DavidGalllob Mar 17, 2025
f1db0b4
- fixed ProverEnvironment
DavidGalllob Mar 17, 2025
110b8d7
-refactorings
DavidGalllob Mar 17, 2025
a6cfb59
-fixed bug where solverContext would disable logging without a reason
DavidGalllob Mar 17, 2025
512fc57
-bugfix and refactorings
DavidGalllob Mar 17, 2025
428d446
-removed logging of push and pop as the parser can't support it.
DavidGalllob Mar 17, 2025
b80b7d0
- introduced a workaround for push and pop for the evaluation in Solv…
DavidGalllob Mar 18, 2025
4c7d01a
- made the SolverLessProver more efficient.
DavidGalllob Mar 18, 2025
38aca61
- added full support for Regex as datatype in SMTLIB2 in the parser a…
DavidGalllob Mar 18, 2025
0ea597b
-refactorings
DavidGalllob Mar 18, 2025
e17c5ca
fixed a wrong test
DavidGalllob Mar 18, 2025
d88bf6b
added new tests
DavidGalllob Mar 18, 2025
e71de93
- introduced a ParseGenerateAndReparseTest class that provides the ma…
DavidGalllob Mar 19, 2025
6612420
fixed local String Usage
DavidGalllob Mar 19, 2025
bac133b
excluded EvaluationFiles from Tests.
DavidGalllob Mar 19, 2025
0c1269f
added javaclass for evaluation with benchexec.
DavidGalllob Mar 21, 2025
933bf52
added javaclass for evaluation with benchexec.
DavidGalllob Mar 21, 2025
325d186
added javaclass for evaluation with benchexec.
DavidGalllob Mar 21, 2025
37f2e50
refactorings
DavidGalllob Mar 21, 2025
e743028
fixed bug
DavidGalllob Mar 21, 2025
4dcd480
- fixed a Generator bug
DavidGalllob Mar 21, 2025
3253291
- ParseGenerateAndReparse now makes sure that the exception wasn't ca…
DavidGalllob Mar 21, 2025
a6fe77f
- Better logging for Evaluation in the file
DavidGalllob Mar 21, 2025
b257f57
- removed outdated UFGenerator test
DavidGalllob Mar 21, 2025
1b80695
-changed push/pop to UnsupportedOperationException
DavidGalllob Mar 26, 2025
1badf47
-fixed tests
DavidGalllob Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing checks to make sure SMTLIB code is only generated when th…
…e option was selected
daniel-raffler committed Oct 12, 2024
commit 45a1e35d1c60e1ad0c51f40287898a215d797dbf
Original file line number Diff line number Diff line change
@@ -126,16 +126,22 @@ public BooleanFormula and(Collection<BooleanFormula> pBits) {
switch (pBits.size()) {
case 0:
BooleanFormula result0 = makeTrue();
BooleanGenerator.logMakeTrue(result0, "true");
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logMakeTrue(result0, "true");
}
return result0;
case 1:
BooleanFormula result1 = pBits.iterator().next();
BooleanGenerator.logAnd(result1, pBits);
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logAnd(result1, pBits);
}
return result1;
case 2:
Iterator<BooleanFormula> it = pBits.iterator();
BooleanFormula result2 = and(it.next(), it.next());
BooleanGenerator.logAnd(result2, pBits);
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logAnd(result2, pBits);
}
return result2;
default:
BooleanFormula result = wrap(andImpl(Collections2.transform(pBits, this::extractInfo)));
@@ -209,16 +215,22 @@ public BooleanFormula or(Collection<BooleanFormula> pBits) {
switch (pBits.size()) {
case 0:
BooleanFormula result0 = makeFalse();
BooleanGenerator.logMakeFalse(result0, "false");
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logMakeFalse(result0, "false");
}
return result0;
case 1:
BooleanFormula result1 = pBits.iterator().next();
BooleanGenerator.logOr(result1, pBits);
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logOr(result1, pBits);
}
return result1;
case 2:
Iterator<BooleanFormula> it = pBits.iterator();
BooleanFormula result2 = or(it.next(), it.next());
BooleanGenerator.logOr(result2, pBits);
if (Generator.isLoggingEnabled()) {
BooleanGenerator.logOr(result2, pBits);
}
return result2;
default:
BooleanFormula result = wrap(orImpl(Collections2.transform(pBits, this::extractInfo)));
24 changes: 18 additions & 6 deletions src/org/sosy_lab/java_smt/basicimpl/AbstractEvaluator.java
Original file line number Diff line number Diff line change
@@ -41,23 +41,29 @@ protected AbstractEvaluator(
public final <T extends Formula> T eval(T f) {
Preconditions.checkState(!isClosed());
TFormulaInfo evaluation = evalImpl(creator.extractInfo(f));
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
return evaluation == null ? null : (T) creator.encapsulateWithTypeOf(evaluation);
}

@Nullable
@Override
public final BigInteger evaluate(IntegerFormula f) {
Preconditions.checkState(!isClosed());
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
return (BigInteger) evaluateImpl(creator.extractInfo(f));
}

@Nullable
@Override
public Rational evaluate(RationalFormula f) {
Object value = evaluateImpl(creator.extractInfo(f));
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
if (value instanceof BigInteger) {
// We simplified the value internally. Here, we need to convert it back to Rational.
return Rational.ofBigInteger((BigInteger) value);
@@ -70,7 +76,9 @@ public Rational evaluate(RationalFormula f) {
@Override
public final Boolean evaluate(BooleanFormula f) {
Preconditions.checkState(!isClosed());
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
return (Boolean) evaluateImpl(creator.extractInfo(f));
}

@@ -92,7 +100,9 @@ public final String evaluate(EnumerationFormula f) {
@Override
public final BigInteger evaluate(BitvectorFormula f) {
Preconditions.checkState(!isClosed());
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
return (BigInteger) evaluateImpl(creator.extractInfo(f));
}

@@ -103,7 +113,9 @@ public final Object evaluate(Formula f) {
Preconditions.checkArgument(
!(f instanceof ArrayFormula),
"cannot compute a simple constant evaluation for an array-formula");
Generator.getLines().append("(get-value (" + f + "))\n");
if (Generator.isLoggingEnabled()) {
Generator.getLines().append("(get-value (" + f + "))\n");
}
return evaluateImpl(creator.extractInfo(f));
}

Original file line number Diff line number Diff line change
@@ -202,7 +202,11 @@ public BooleanFormula universalParseFromString(String pString) {

@Override
public void dumpSMTLIB2() throws IOException {
Generator.dumpSMTLIB2();
if (Generator.isLoggingEnabled()) {
Generator.dumpSMTLIB2();
} else {
throw new UnsupportedOperationException("Generator needs to be enabled");
}
}

@Override
8 changes: 6 additions & 2 deletions src/org/sosy_lab/java_smt/basicimpl/AbstractProver.java
Original file line number Diff line number Diff line change
@@ -87,7 +87,9 @@ public int size() {
@Override
public final void push() throws InterruptedException {
checkState(!closed);
Generator.logPush();
if (Generator.isLoggingEnabled()) {
Generator.logPush();
}
pushImpl();
assertedFormulas.add(new LinkedHashMap<>());
}
@@ -98,7 +100,9 @@ public final void push() throws InterruptedException {
public final void pop() {
checkState(!closed);
checkState(assertedFormulas.size() > 1, "initial level must remain until close");
Generator.logPop();
if (Generator.isLoggingEnabled()) {
Generator.logPop();
}
assertedFormulas.remove(assertedFormulas.size() - 1); // remove last
popImpl();
}
14 changes: 10 additions & 4 deletions src/org/sosy_lab/java_smt/basicimpl/AbstractUFManager.java
Original file line number Diff line number Diff line change
@@ -40,8 +40,11 @@ protected AbstractUFManager(FormulaCreator<TFormulaInfo, TType, TEnv, TFunctionD
public final <T extends Formula> FunctionDeclaration<T> declareUF(
String pName, FormulaType<T> pReturnType, List<FormulaType<?>> pArgTypes) {
checkVariableName(pName);
if (pName.contains("PIPE")) {
pName = pName.replaceAll("PIPE", "|");
if (Generator.isLoggingEnabled()) {
// FIXME Find a better way to handle quoted symbols
if (pName.contains("PIPE")) {
pName = pName.replaceAll("PIPE", "|");
}
}
List<TType> argTypes = Lists.transform(pArgTypes, this::toSolverType);
FunctionDeclaration<T> result =
@@ -87,8 +90,11 @@ public final <T extends Formula> T callUF(
public <T extends Formula> T declareAndCallUF(
String name, FormulaType<T> pReturnType, List<Formula> pArgs) {
checkVariableName(name);
if (name.contains("PIPE")) {
name = name.replaceAll("PIPE", "|");
if (Generator.isLoggingEnabled()) {
// FIXME Find a better way to handle quoted symbols
if (name.contains("PIPE")) {
name = name.replaceAll("PIPE", "|");
}
}
List<FormulaType<?>> argTypes = Lists.transform(pArgs, getFormulaCreator()::getFormulaType);
FunctionDeclaration<T> func = declareUF(name, pReturnType, argTypes);
Original file line number Diff line number Diff line change
@@ -84,11 +84,13 @@ public void close() {
*/
@Override
public boolean isUnsat() throws SolverException, InterruptedException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
// FIXME: Find a better way to handle the IOException
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
// FIXME Find a better way to handle the IOException
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
wasLastSatCheckSat = false;
10 changes: 6 additions & 4 deletions src/org/sosy_lab/java_smt/solvers/cvc4/CVC4TheoremProver.java
Original file line number Diff line number Diff line change
@@ -185,10 +185,12 @@ public ImmutableList<ValueAssignment> getModelAssignments() throws SolverExcepti
@Override
@SuppressWarnings("try")
public boolean isUnsat() throws InterruptedException, SolverException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
closeAllEvaluators();
10 changes: 6 additions & 4 deletions src/org/sosy_lab/java_smt/solvers/cvc5/CVC5AbstractProver.java
Original file line number Diff line number Diff line change
@@ -164,10 +164,12 @@ public ImmutableList<ValueAssignment> getModelAssignments() throws SolverExcepti
@Override
@SuppressWarnings("try")
public boolean isUnsat() throws InterruptedException, SolverException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
closeAllEvaluators();
Original file line number Diff line number Diff line change
@@ -101,10 +101,12 @@ private long buildConfig(Set<ProverOptions> opts) {

@Override
public boolean isUnsat() throws InterruptedException, SolverException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
return !msat_check_sat(curEnv);
Original file line number Diff line number Diff line change
@@ -219,10 +219,12 @@ protected String getReasonFromSolverFeatures(
@SuppressWarnings("try") // ShutdownHook is never referenced, and this is correct.
public boolean isUnsat() throws InterruptedException, SolverException {
Preconditions.checkState(!closed);
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
closeAllEvaluators();
changedSinceLastSatQuery = false;
Original file line number Diff line number Diff line change
@@ -105,10 +105,12 @@ protected String addConstraint0(BooleanFormula constraint) {

@Override
public boolean isUnsat() throws InterruptedException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
checkState(!closed);

Original file line number Diff line number Diff line change
@@ -120,10 +120,12 @@ protected void pushImpl() throws InterruptedException {

@Override
public boolean isUnsat() throws SolverException, InterruptedException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
boolean unsat;
10 changes: 6 additions & 4 deletions src/org/sosy_lab/java_smt/solvers/z3/Z3OptimizationProver.java
Original file line number Diff line number Diff line change
@@ -135,10 +135,12 @@ protected long getUnsatCore0() {

@Override
public boolean isUnsat() throws Z3SolverException, InterruptedException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
logSolverStack();
10 changes: 6 additions & 4 deletions src/org/sosy_lab/java_smt/solvers/z3/Z3TheoremProver.java
Original file line number Diff line number Diff line change
@@ -82,10 +82,12 @@ protected void assertContraintAndTrack(long constraint, long symbol) {

@Override
public boolean isUnsat() throws Z3SolverException, InterruptedException {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
if (Generator.isLoggingEnabled()) {
try {
Generator.dumpSMTLIB2();
} catch (IOException pE) {
throw new RuntimeException(pE);
}
}
Preconditions.checkState(!closed);
logSolverStack();
4 changes: 3 additions & 1 deletion src/org/sosy_lab/java_smt/test/SolverBasedTest0.java
Original file line number Diff line number Diff line change
@@ -196,7 +196,9 @@ public final void initSolver() throws InvalidConfigurationException {
} catch (UnsupportedOperationException e) {
emgr = null;
}
Generator.resetGenerator();
if (Generator.isLoggingEnabled()) {
Generator.resetGenerator();
}
}

@After