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 285 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
285 commits
Select commit Hold shift + click to select a range
e08bfc6
added and finished BitVector Parser
Oct 23, 2023
879643a
fixed BitVector Parser
Oct 23, 2023
34e5f8d
added Array Parser
Oct 23, 2023
e6d52c5
finished Array Parser, updated operands structure
Oct 24, 2023
fd25650
added and finished UF Parser
Oct 24, 2023
54dde49
fixed bugs in array and bitvector
Oct 28, 2023
045c3ad
added define-fun to parser
Oct 29, 2023
626cdb0
Backup
Nov 1, 2023
5f14e48
Fixed Generator Modifier
Nov 1, 2023
6d46feb
Added UnitTest for BooleanGenerator
Nov 1, 2023
11178b6
Fixed addConstraint
Nov 2, 2023
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
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
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SPDX-License-Identifier: Apache-2.0
<classpathentry kind="lib" path="lib/java/runtime-cvc5/cvc5.jar"/>
<classpathentry kind="lib" path="lib/java/test/truth-java8-extension.jar" sourcepath="lib/java-contrib/truth-java8-extension-sources.jar"/>
<classpathentry kind="lib" path="lib/java/core/checker-qual.jar" sourcepath="lib/java-contrib/checker-qual-sources.jar"/>
<classpathentry kind="lib" path="lib/java/core/antlr4-runtime.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
Expand Down
9 changes: 9 additions & 0 deletions .idea/JavaSMT.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions build/Checkstyle.exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>

<!--
This file is part of CPAchecker,
a tool for configurable software verification:
https://cpachecker.sosy-lab.org

SPDX-FileCopyrightText: 2007-2025 Dirk Beyer <https://www.sosy-lab.org>

SPDX-License-Identifier: Apache-2.0
-->

<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- Generated code gets excluded -->
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Visitor.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Listener.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Visitor.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Lexer.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2Parser.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseListener.java" checks=".*"/>
<suppress files="src/org/sosy_lab/java_smt/basicimpl/parserInterpreter/Smtlibv2BaseVisitor.java" checks=".*"/>
</suppressions>
2 changes: 2 additions & 0 deletions build/SpotBugs.exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ SPDX-License-Identifier: Apache-2.0
<Match><Bug pattern="RV_RETURN_VALUE_IGNORED"/></Match>
<!-- Exclude AutoValue classes -->
<Match><Class name="~.*\.AutoValue_.*"/></Match>
<!-- Exclude autogenerated ANTLR files -->
<Match><Class name="~.*\.Smtlibv2.*"/></Match>
</FindBugsFilter>
1 change: 0 additions & 1 deletion build/ivysettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ SPDX-FileCopyrightText: 2018-2020 Dirk Beyer <https://www.sosy-lab.org>
SPDX-License-Identifier: Apache-2.0
-->

<!DOCTYPE ivysettings> <!-- generic AcceptAllDTD to make the Eclipse Warning go away -->
<ivysettings>
<!-- DO NOT EDIT LOCALLY!
Keep this file synchronized with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public static void main(String[] args) throws SolverException, InterruptedExcept
for (Solvers s : Solvers.values()) {
infos.add(infoProvider.getSolverInformation(s));
}

infos.sort(Comparator.comparing(SolverInfo::getName)); // alphabetical ordering

RowBuilder rowBuilder = new RowBuilder();
Expand Down
3 changes: 3 additions & 0 deletions lib/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ SPDX-License-Identifier: Apache-2.0
As long as this is the case we need to provide the JAR, otherwise javac complains. -->
<dependency org="org.codehaus.mojo" name="animal-sniffer-annotations" rev="1.18" conf="core->default;"/>

<!-- Antlr grammar support for our SMTLIB2 parser/generator -->
<dependency org="org.antlr" name="antlr4-runtime" rev="4.13.1" conf="core->default;"/>

<!-- Guava has a dependency on error_prone_annotations without a revision number, need an override. -->
<override org="com.google.errorprone" module="error_prone_annotations" rev="2.4.0"/>

Expand Down
37 changes: 33 additions & 4 deletions src/org/sosy_lab/java_smt/SolverContextFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
import org.sosy_lab.java_smt.api.FloatingPointRoundingMode;
import org.sosy_lab.java_smt.api.SolverContext;
import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager.NonLinearArithmetic;
import org.sosy_lab.java_smt.basicimpl.Generator;
import org.sosy_lab.java_smt.delegate.debugging.DebuggingSolverContext;
import org.sosy_lab.java_smt.delegate.logging.LoggingSolverContext;
import org.sosy_lab.java_smt.delegate.statistics.StatisticsSolverContext;
import org.sosy_lab.java_smt.delegate.synchronize.SynchronizedSolverContext;
import org.sosy_lab.java_smt.solvers.SolverLess.SolverLessContext;
import org.sosy_lab.java_smt.solvers.bitwuzla.BitwuzlaSolverContext;
import org.sosy_lab.java_smt.solvers.boolector.BoolectorSolverContext;
import org.sosy_lab.java_smt.solvers.cvc4.CVC4SolverContext;
Expand Down Expand Up @@ -60,7 +62,8 @@ public enum Solvers {
CVC4,
CVC5,
YICES2,
BITWUZLA
SOLVERLESS,
BITWUZLA,
}

@Option(secure = true, description = "Export solver queries in SmtLib format into a file.")
Expand Down Expand Up @@ -113,6 +116,15 @@ public enum Solvers {
+ "This affects only the theories of integer and rational arithmetic.")
private NonLinearArithmetic nonLinearArithmetic = NonLinearArithmetic.USE;

@Option(secure = true, description = "Enable SMTLIB2 script generation.")
private boolean generateSMTLIB2 = false;

@Option(secure = true, description = "Run the solver binary instead of using the library.")
private boolean useBinary = false;

@Option(secure = true, description = "Which Solver SolverLess should use to solve constraints")
private Solvers usedSolverBySolverLess = Solvers.Z3;

private final LogManager logger;
private final ShutdownNotifier shutdownNotifier;
private final Configuration config;
Expand Down Expand Up @@ -158,6 +170,11 @@ public SolverContextFactory(
Consumer<String> pLoader)
throws InvalidConfigurationException {
pConfig.inject(this);
if (useBinary && !generateSMTLIB2) {
throw new InvalidConfigurationException(
"Can't use option solver.useBinary without also enabling solver.generateSMTLIB2.");
}

logger = pLogger.withComponentName("JavaSMT");
shutdownNotifier = checkNotNull(pShutdownNotifier);
config = pConfig;
Expand Down Expand Up @@ -208,7 +225,13 @@ public SolverContext generateContext() throws InvalidConfigurationException {
@SuppressWarnings("resource") // returns unclosed context object
public SolverContext generateContext(Solvers solverToCreate)
throws InvalidConfigurationException {

if (useBinary && solverToCreate != Solvers.PRINCESS) {
throw new InvalidConfigurationException(
String.format(
"Can't use option solver.useBinary with solver %s. Currently only Princess is"
+ "supported in binary mode.",
solverToCreate));
}
SolverContext context;
try {
context = generateContext0(solverToCreate);
Expand All @@ -234,7 +257,11 @@ public SolverContext generateContext(Solvers solverToCreate)
// statistics need to be the most outer wrapping layer.
context = new StatisticsSolverContext(context);
}

if (solverToCreate == Solvers.SOLVERLESS) {
Generator.setIsLoggingEnabled(true);
} else {
Generator.setIsLoggingEnabled(generateSMTLIB2);
}
return context;
}

Expand Down Expand Up @@ -292,13 +319,15 @@ private SolverContext generateContext0(Solvers solverToCreate)

case PRINCESS:
return PrincessSolverContext.create(
config, shutdownNotifier, logfile, (int) randomSeed, nonLinearArithmetic);
config, useBinary, shutdownNotifier, logfile, (int) randomSeed, nonLinearArithmetic);

case YICES2:
return Yices2SolverContext.create(nonLinearArithmetic, shutdownNotifier, loader);

case BOOLECTOR:
return BoolectorSolverContext.create(config, shutdownNotifier, logfile, randomSeed, loader);
case SOLVERLESS:
return SolverLessContext.create(usedSolverBySolverLess);

case BITWUZLA:
return BitwuzlaSolverContext.create(
Expand Down
19 changes: 18 additions & 1 deletion src/org/sosy_lab/java_smt/api/FloatingPointRoundingMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,22 @@ public enum FloatingPointRoundingMode {
NEAREST_TIES_AWAY,
TOWARD_POSITIVE,
TOWARD_NEGATIVE,
TOWARD_ZERO
TOWARD_ZERO;

public String getSMTLIBFormat() {
switch (this) {
case NEAREST_TIES_TO_EVEN:
return "RNE";
case NEAREST_TIES_AWAY:
return "RNA";
case TOWARD_POSITIVE:
return "RTP";
case TOWARD_NEGATIVE:
return "RTN";
case TOWARD_ZERO:
return "RTZ";
default:
throw new IllegalArgumentException("Unknown rounding mode: " + this);
}
}
}
21 changes: 21 additions & 0 deletions src/org/sosy_lab/java_smt/api/FormulaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,37 @@

import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.sosy_lab.common.Appender;
import org.sosy_lab.common.configuration.InvalidConfigurationException;
import org.sosy_lab.java_smt.api.visitors.FormulaTransformationVisitor;
import org.sosy_lab.java_smt.api.visitors.FormulaVisitor;
import org.sosy_lab.java_smt.api.visitors.TraversalProcess;

/** FormulaManager class contains all operations which can be performed on formulas. */
public interface FormulaManager {

/**
* Parses an SMT-LIB2 String and translates it into an equivalent BooleanFormula constraint.
*
* @param pString SMT-LIB2 formula as String that will be parsed
* @return BooleanFormula equivalent to the SMT-LIB2 string
*/
// TODO Clean up exceptions?
BooleanFormula universalParseFromString(String pString)
throws IOException, SolverException, InterruptedException, InvalidConfigurationException;

/**
* Calls the dumpSMTLIB2 method from the Generator, which will write the assembled SMT-LIB2 to a
* file 'Out.smt2'.
*
* @throws IOException if writing to file fails
*/
// TODO Return a String, instead of writing to a file
void dumpSMTLIB2() throws IOException;

/**
* Returns the Integer-Theory. Because most SAT-solvers support automatic casting between Integer-
* and Rational-Theory, the Integer- and the RationalFormulaManager both return the same Formulas
Expand Down
5 changes: 3 additions & 2 deletions src/org/sosy_lab/java_smt/api/FormulaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ public String toString() {
}

@Override
public String toSMTLIBString() {
return "(_ FloatingPoint " + exponentSize + " " + mantissaSize + ")";
public String toSMTLIBString() { // SMTLIB2 ALWAYS CONSIDERS SIGN BIT IN THE MANTISSA SIZE!
// returning (_ FloatingPoint 8 23) for single precision is incorrect.
return "(_ FloatingPoint " + exponentSize + " " + mantissaSize + 1 + ")";
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/org/sosy_lab/java_smt/api/SolverContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ enum ProverOptions {
GENERATE_UNSAT_CORE_OVER_ASSUMPTIONS,

/** Whether the solver should enable support for formulae build in SL theory. */
ENABLE_SEPARATION_LOGIC
ENABLE_SEPARATION_LOGIC,

// TODO Document this option
USE_BINARY
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ public <TI extends Formula, TE extends Formula> TE select(
// Rational

final TFormulaInfo term = select(extractInfo(pArray), extractInfo(pIndex));

return (TE) getFormulaCreator().encapsulate(elementType, term);
TE result = (TE) getFormulaCreator().encapsulate(elementType, term);
if (Generator.isLoggingEnabled()) {
ArrayGenerator.logSelect(result, pArray, pIndex);
}
return result;
}

protected abstract TFormulaInfo select(TFormulaInfo pArray, TFormulaInfo pIndex);
Expand All @@ -52,7 +55,12 @@ public <TI extends Formula, TE extends Formula> ArrayFormula<TI, TE> store(
final FormulaType<TE> elementType = getFormulaCreator().getArrayFormulaElementType(pArray);

final TFormulaInfo term = store(extractInfo(pArray), extractInfo(pIndex), extractInfo(pValue));
return getFormulaCreator().encapsulateArray(term, indexType, elementType);
ArrayFormula<TI, TE> result =
getFormulaCreator().encapsulateArray(term, indexType, elementType);
if (Generator.isLoggingEnabled()) {
ArrayGenerator.logStore(result, pArray, pIndex, pValue);
}
return result;
}

protected abstract TFormulaInfo store(
Expand All @@ -64,10 +72,16 @@ protected abstract TFormulaInfo store(
TE extends Formula,
FTI extends FormulaType<TI>,
FTE extends FormulaType<TE>>
ArrayFormula<TI, TE> makeArray(String pName, FTI pIndexType, FTE pElementType) {
ArrayFormula<TI, TE> makeArray(String pName, FTI pIndexType, FTE pElementType)
throws GeneratorException {
checkVariableName(pName);
final TFormulaInfo namedArrayFormula = internalMakeArray(pName, pIndexType, pElementType);
return getFormulaCreator().encapsulateArray(namedArrayFormula, pIndexType, pElementType);
ArrayFormula<TI, TE> result =
getFormulaCreator().encapsulateArray(namedArrayFormula, pIndexType, pElementType);
if (Generator.isLoggingEnabled()) {
ArrayGenerator.logMakeArray(result, pName, pIndexType, pElementType);
}
return result;
}

@Override
Expand Down Expand Up @@ -101,8 +115,13 @@ public <TE extends Formula> FormulaType<TE> getElementType(ArrayFormula<?, TE> p
@Override
public <TI extends Formula, TE extends Formula> BooleanFormula equivalence(
ArrayFormula<TI, TE> pArray1, ArrayFormula<TI, TE> pArray2) {
return getFormulaCreator()
.encapsulateBoolean(equivalence(extractInfo(pArray1), extractInfo(pArray2)));
BooleanFormula result =
getFormulaCreator()
.encapsulateBoolean(equivalence(extractInfo(pArray1), extractInfo(pArray2)));
if (Generator.isLoggingEnabled()) {
ArrayGenerator.logArrayEquivalence(result, pArray1, pArray2);
}
return result;
}

protected abstract TFormulaInfo equivalence(TFormulaInfo pArray1, TFormulaInfo pArray2);
Expand Down
Loading