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

Adding dReal to JavaSMT #313 #328

Open
wants to merge 157 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
5ede66e
init dreal4
juliusbrehme Jul 16, 2023
531966c
added QuantifiedFormulaManager
juliusbrehme Jul 17, 2023
dacfc77
Updated to use QuantifiedFormulaManager and implemented the rest of N…
juliusbrehme Jul 17, 2023
9a4d26d
added getType to DRealTerm
juliusbrehme Jul 21, 2023
f3e49bf
implemented visit-Method
juliusbrehme Jul 21, 2023
346d7f7
remove wrong Documentation
juliusbrehme Jul 21, 2023
1328bbc
added explaination to why that class is needed
juliusbrehme Jul 21, 2023
ca3c95f
implemented callFunctionImpl
juliusbrehme Jul 22, 2023
7073df5
changed TFunctDecl from DRealTerm to FunctionDeclarationKind
juliusbrehme Jul 22, 2023
2d9b8ca
added Method to get the type when splitting formula into Expressions
juliusbrehme Jul 23, 2023
fdbc185
Changed DRealTerm to generic class
juliusbrehme Jul 24, 2023
075e00e
implemented FormulaCreator
juliusbrehme Jul 24, 2023
053b3c7
Use Wildcard Operator, so that there are no raw types
juliusbrehme Jul 25, 2023
6ccb739
Added VariableSet to getQuantifiedVariabes and modified CheckSat, so …
juliusbrehme Jul 26, 2023
db32be5
added visitQuantified in visit-method
juliusbrehme Jul 26, 2023
a817e9d
added isUnsat and addConstraint to TheoremProver
juliusbrehme Jul 26, 2023
ab59f77
init NativeAPITest
juliusbrehme Jul 27, 2023
7898073
init Model
juliusbrehme Jul 28, 2023
c9a0e15
added dReal to SolverContextFactory
juliusbrehme Jul 28, 2023
2860dde
corrected add and substract methods
juliusbrehme Jul 28, 2023
6e5b0ab
addded HashMap to store Variables for only creating new Variables
juliusbrehme Aug 2, 2023
f7afde7
changed Type when creating Formulas from Expression in <, <=, etc.
juliusbrehme Aug 2, 2023
a6ba7cc
corrected equals method
juliusbrehme Aug 2, 2023
f3555dd
added pLoader dreal
juliusbrehme Aug 2, 2023
f2d784b
overwritte addImpl and orImpl
juliusbrehme Aug 2, 2023
19f75ef
implemented rest of TheoremProver
juliusbrehme Aug 2, 2023
37bc31f
override substitute-method
juliusbrehme Aug 5, 2023
4e7a4a9
fixed iterater used in visit and added pow(x,-1) in visit, when negat…
juliusbrehme Aug 5, 2023
4af6a01
added evalImpl
juliusbrehme Aug 5, 2023
318bf7d
corrected negate method to inverse variable/number
juliusbrehme Aug 5, 2023
48aec6f
added close()
juliusbrehme Aug 5, 2023
a6490eb
added method to retrieve the results of the box/model
juliusbrehme Aug 5, 2023
aeddffc
implemented convertValue method
juliusbrehme Aug 7, 2023
9629b5f
updated evalImpl
juliusbrehme Aug 7, 2023
60d6815
fixed that Variable of boolean type can be substituted
juliusbrehme Aug 7, 2023
f050e3d
updated fixed getResult
juliusbrehme Aug 7, 2023
0e246a4
added dReal to supported OS
juliusbrehme Aug 7, 2023
7443697
fixed ifthenelse in BooleanFormula
juliusbrehme Aug 7, 2023
32cee0e
fixed equals method
juliusbrehme Aug 7, 2023
f285a23
added new cases to getTypeForExpressions and fixed case FormulaKind.V…
juliusbrehme Aug 7, 2023
e23fbcb
added if Variable is Boolean type to create Forall
juliusbrehme Aug 7, 2023
c11771a
Revert "fixed iterater used in visit and added pow(x,-1) in visit, wh…
juliusbrehme Aug 8, 2023
6d94e95
revert .idea
juliusbrehme Aug 8, 2023
c72e60e
added pow(x,-1) in visit
juliusbrehme Aug 8, 2023
dfc37f3
fixed getExpressionsFromDiv
juliusbrehme Aug 8, 2023
b8f1bee
added getAssertedExpressions in Prover and edited one exception message
juliusbrehme Aug 8, 2023
84fb35f
implemented asList()
juliusbrehme Aug 8, 2023
5ba4ec5
updated evalImpl
juliusbrehme Aug 9, 2023
428f8a7
added getFreeVariables and getVariables in Formula and Expression and…
juliusbrehme Aug 9, 2023
f76a9d1
Merge branch 'master' into 313-adding-dreal-to-javasmt
juliusbrehme Aug 9, 2023
b42baf5
added SupressWarning and Overrides and some minor fixes, so that the …
juliusbrehme Aug 10, 2023
cad9ae8
ITE updated and updated use of constructor for dReal
juliusbrehme Aug 11, 2023
d4dc13d
updated DRealTerm usage
juliusbrehme Aug 11, 2023
fe7acac
updated DRealTerm usage
juliusbrehme Aug 11, 2023
40e8b3e
updated DRealTerm to save declaration as well, only used for visitor
juliusbrehme Aug 14, 2023
c372deb
Fixed callFunctionImpl
juliusbrehme Aug 14, 2023
0260668
updated substitute
juliusbrehme Aug 14, 2023
cb0abc7
divide only for integers
juliusbrehme Aug 14, 2023
bbbb4bb
updated mkQuantifier
juliusbrehme Aug 14, 2023
b994610
divide only for rationals
juliusbrehme Aug 14, 2023
0ae81f8
grammar error
juliusbrehme Aug 14, 2023
134cd70
updated ITE
juliusbrehme Aug 16, 2023
7760a09
better implementation of getTypeForExpression and update convertValue…
juliusbrehme Aug 16, 2023
3f9fc0a
environment changed to Config
juliusbrehme Aug 16, 2023
67c1eff
corrected Integer division with two constants
juliusbrehme Aug 16, 2023
64217b7
change to NonLinearArithmetic.USE to disable ALWAYS/FALLBACK
juliusbrehme Aug 16, 2023
0302708
updatet test for dReal
juliusbrehme Aug 16, 2023
9a0057c
added test for dReal and changed some test to work with dReal
juliusbrehme Aug 16, 2023
d78a127
updated ModelTest for dReal
juliusbrehme Aug 16, 2023
7ced0d3
updated test, because dReal does not support ALWAYS/FALLBACK
juliusbrehme Aug 16, 2023
f31720d
added requireUnsatCore, because dReal does not support it
juliusbrehme Aug 16, 2023
0ece445
added requireDumping, requireUF, requireExistQuantifier, requireFloor
juliusbrehme Aug 16, 2023
52be92c
updated some test, because dReal does not support real integer division
juliusbrehme Aug 16, 2023
e565838
updated some test, because dReal does not support existantial quantif…
juliusbrehme Aug 16, 2023
77a0498
updated test, because dReal does not support existantial quantifier
juliusbrehme Aug 16, 2023
9d5d616
ant format-source to format code
juliusbrehme Aug 16, 2023
16f8ac7
updated exception and added preconditions
juliusbrehme Aug 16, 2023
8c92208
updated equals, toString, hashCode
juliusbrehme Aug 16, 2023
5f0a5fc
added preconditions and rewrite of callFunctionImpl
juliusbrehme Aug 16, 2023
909cf8a
small fixes
juliusbrehme Aug 16, 2023
5de2db6
small fixes and clean up
juliusbrehme Aug 16, 2023
88b00c0
updated equals, toString, hashCode
juliusbrehme Aug 16, 2023
0b51a50
added a few test
juliusbrehme Aug 16, 2023
73722a7
clean up
juliusbrehme Aug 16, 2023
2107564
ant format-source
juliusbrehme Aug 16, 2023
99fcc99
removed unnecassary method
juliusbrehme Aug 16, 2023
376c66f
fixed wrong precondition
juliusbrehme Aug 16, 2023
ca112b2
updated test, beacuse assertTrue,False not allowed
juliusbrehme Aug 17, 2023
bcef913
changed method names to acceptable names in Java
juliusbrehme Aug 17, 2023
c3cedaa
added licenses
juliusbrehme Aug 17, 2023
7f7e27e
updated methods names
juliusbrehme Aug 17, 2023
0bba522
renamed methods from generated Wrapper
juliusbrehme Aug 17, 2023
b11385e
updated JNI methods
juliusbrehme Aug 17, 2023
974825d
updated methods used from the generated wrapper
juliusbrehme Aug 17, 2023
be29636
never used pLogger
juliusbrehme Aug 17, 2023
293f76d
added licenses
juliusbrehme Aug 18, 2023
c99a853
updated methods used from the generated wrapper
juliusbrehme Aug 18, 2023
fcb0823
added licenses
juliusbrehme Aug 18, 2023
1119119
ant format-source
juliusbrehme Aug 18, 2023
1bfb93e
added licenses
juliusbrehme Aug 18, 2023
407543d
deleted
juliusbrehme Aug 18, 2023
1b1dd72
added licenses
juliusbrehme Aug 18, 2023
83fd4e1
original from master
juliusbrehme Aug 18, 2023
c524d49
added licenses
juliusbrehme Aug 18, 2023
dddd392
added precondition
juliusbrehme Aug 18, 2023
d3b4544
updated methods used from the generated wrapper
juliusbrehme Aug 18, 2023
703797f
ant format-source
juliusbrehme Aug 18, 2023
d90fd57
updated checkstyle
juliusbrehme Aug 18, 2023
a4be205
added package-info
juliusbrehme Aug 18, 2023
7468273
updated checkstyle
juliusbrehme Aug 18, 2023
e37ed75
updated checkstyle
juliusbrehme Aug 18, 2023
7a68016
ant format-source
juliusbrehme Aug 18, 2023
f9f0586
added var unused
juliusbrehme Aug 18, 2023
1ec0cb0
added SupressWarning classTypeParameterName
juliusbrehme Aug 18, 2023
1b52918
corrected naming convention
juliusbrehme Aug 18, 2023
0047bc7
added SupressWarning unused
juliusbrehme Aug 18, 2023
cf8e253
added dot on first sentence
juliusbrehme Aug 18, 2023
e376d87
updated equals-method
juliusbrehme Aug 18, 2023
6312b69
added NotThreadSafe
juliusbrehme Aug 18, 2023
d6d63a8
ant format-source
juliusbrehme Aug 18, 2023
2e5e214
cp mistake in equals
juliusbrehme Aug 18, 2023
6507272
annotationstyle
juliusbrehme Aug 18, 2023
9d9bf9f
DRealTerm was not referenced
juliusbrehme Aug 18, 2023
016970d
added @CanIgnoreREturnValue
juliusbrehme Aug 18, 2023
809a85c
added comments for methods
juliusbrehme Aug 19, 2023
aba7ea5
updated documentation for wrapper/swig
juliusbrehme Aug 19, 2023
736931c
fixed static initializer creates instance before all static final fie…
juliusbrehme Aug 23, 2023
5e5cc7e
ant format-source
juliusbrehme Aug 23, 2023
54453be
fixed some checkstyles
juliusbrehme Aug 23, 2023
7478303
ant format-source
juliusbrehme Aug 23, 2023
f3bcd85
updated docu for getting the library
juliusbrehme Aug 26, 2023
aa0eef8
updated documentaion for creating shared libraries
juliusbrehme Aug 27, 2023
fc071bf
added SolverRace to compare performance between solvers solving ratio…
juliusbrehme Aug 28, 2023
a98d7b7
updated the assertion
juliusbrehme Aug 28, 2023
f013b66
format source code
juliusbrehme Aug 28, 2023
2ad3549
added private constructor for utility class
juliusbrehme Aug 28, 2023
6ad85d4
use of preconditions
juliusbrehme Aug 28, 2023
cc7b8dc
removed unnecassary ;
juliusbrehme Aug 28, 2023
ff425ff
DReal: Removed 2 project files from the repository.
daniel-raffler Apr 25, 2024
7e1adae
DReal: Moved native code to /lib and remove an object file that shoul…
daniel-raffler Apr 25, 2024
8a973c6
DReal: Fixed a typo in a class name.
daniel-raffler Apr 25, 2024
84912b7
Merge remote-tracking branch 'refs/remotes/origin/master' into 313-ad…
daniel-raffler Apr 25, 2024
1d77a80
DReal: Moved handling of the assertion stack from DReal4TheoremProver…
daniel-raffler Apr 25, 2024
dc0484e
DReal: Updated build instruction for Ubuntu 23.10
daniel-raffler Apr 25, 2024
e339dca
DReal: Added missing step
daniel-raffler Apr 25, 2024
f2af4b3
DReal: Updated build documentation
daniel-raffler Apr 26, 2024
a25d764
DReal: Added skeleton build script for the backend.
daniel-raffler Apr 26, 2024
bb272a2
DReal: Fixed formatting
daniel-raffler Apr 26, 2024
172b017
DReal: Fixed crashes in ModelTest and ModelEvaluationTest. There seem…
daniel-raffler Apr 26, 2024
b62b272
DReal: Fixed library loading in DReal4NativeAPITest
daniel-raffler Apr 26, 2024
5f39ba6
DReal: Fixed getVariablesTest from DReal4NativeAPITest (See 172b017ab…
daniel-raffler Apr 26, 2024
c1c1bd6
DReal: Blacklisted dReal for some tests in SolverStackTest0
daniel-raffler Apr 26, 2024
9baa309
DReal: Use requireUnsatCore in a tests that used to check manually.
daniel-raffler Apr 26, 2024
045f894
DReal: Added missing license information
daniel-raffler Apr 28, 2024
263756d
DReal: Added a proper build script for dReal.
daniel-raffler Apr 29, 2024
97068ef
DReal: Remove dReal build files in 'ant clean' task.
daniel-raffler Apr 29, 2024
bb405c0
DReal: Fixed git hash for the version used in the build file.
daniel-raffler Apr 30, 2024
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
4 changes: 3 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ SPDX-License-Identifier: Apache-2.0
runtime-princess,
runtime-smtinterpol,
runtime-yices2,
runtime-z3
runtime-z3,
runtime-dreal
"/>
<property name="ivy.configuration.main" value="core"/>
<property name="ivy.configurations" value="build, ${ivy.configuration.main}, ${ivy.solver.configurations}, test, format-source, checkstyle, spotbugs"/>
Expand Down Expand Up @@ -81,6 +82,7 @@ SPDX-License-Identifier: Apache-2.0
<delete includeEmptyDirs="true">
<fileset dir="." includes="${class.dir}/** ${ivy.module}-*.jar ivy-*.xml *.so *.dll *.dylib *.jar"/>
<fileset dir="lib/native/source/libmathsat5j" includes="*.so *.dll *.o"/>
<fileset dir="build-deps"/> <!-- remove dReal build files -->
</delete>
</target>

Expand Down
3 changes: 2 additions & 1 deletion build/build-publish-solvers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SPDX-License-Identifier: Apache-2.0
-->

<!-- vim: set tabstop=8 shiftwidth=4 expandtab sts=4 filetype=ant fdm=marker: -->
<project name="publish-solvers" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<project name="publish-solvers" basedir=".">

<import file="build-publish-solvers/solver-boolector.xml"/>
<import file="build-publish-solvers/solver-cvc4.xml"/>
Expand All @@ -20,5 +20,6 @@ SPDX-License-Identifier: Apache-2.0
<import file="build-publish-solvers/solver-opensmt.xml"/>
<import file="build-publish-solvers/solvers-yices.xml"/>
<import file="build-publish-solvers/solver-z3.xml"/>
<import file="build-publish-solvers/solver-dreal.xml"/>

</project>
110 changes: 110 additions & 0 deletions build/build-publish-solvers/solver-dreal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
This file is part of JavaSMT,
an API wrapper for a collection of SMT solvers:
https://github.com/sosy-lab/java-smt

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

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

<!-- vim: set tabstop=8 shiftwidth=4 expandtab sts=4 filetype=ant fdm=marker: -->
<project name="publish-solvers-dreal" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

<import file="macros.xml"/>

<!-- SECTION: Publishing dReal
==================================================================
-->
<target name="package-dreal" depends="">
<fail unless="dreal.customRev">
Please specify a custom revision with the flag -Ddreal.customRev=XXX.
The custom revision has to be unique amongst the already known version
numbers from the ivy repository. The script will append the git revision.
</fail>

<!-- build a version string for dreal -->
<property name="dreal.version" value="${dreal.customRev}-g4067225"/>
<echo message="Building dReal in version '${dreal.version}'"/>

<!-- fetch and install libibex and dreal -->
<mkdir dir="build-deps"/>
<exec executable="curl" dir="build-deps" failonerror="true">
<arg value="-O"/>
<arg value="-L"/>
<arg value="https://launchpad.net/~dreal/+archive/ubuntu/dreal/+files/libibex-dev_2.7.4.20220710184652.git352eeeb2345fb2b7a7ec248b44770d8cdc4a5d67~22.04_amd64.deb"/>
</exec>
<exec executable="dpkg" dir="build-deps" failonerror="true">
<arg value="-x"/>
<arg value="libibex-dev_2.7.4.20220710184652.git352eeeb2345fb2b7a7ec248b44770d8cdc4a5d67~22.04_amd64.deb"/>
<arg value="."/>
</exec>
<exec executable="curl" dir="build-deps" failonerror="true">
<arg value="-O"/>
<arg value="-L"/>
<arg value="https://github.com/dreal/dreal4/releases/download/4.21.06.2/dreal_4.21.06.2_amd64.deb"/>
</exec>
<exec executable="dpkg" dir="build-deps" failonerror="true">
<arg value="-x"/>
<arg value="dreal_4.21.06.2_amd64.deb"/>
<arg value="."/>
</exec>

<property name="path.source" value="${user.dir}/lib/native/source/dreal"/>

<property name="dreal.install" value="${user.dir}/build-deps/opt/dreal/4.21.06.2"/>
<property name="ibex.install" value="${user.dir}/build-deps/opt/libibex/2.7.4"/>

<!-- compile the JNI code -->
<exec executable="g++" dir="${path.source}" failonerror="true">
<arg value="-fpic"/>
<arg value="-c"/>
<arg value="dreal_wrap.cxx"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
<arg value="-I${ibex.install}/include"/>
<arg value="-I${ibex.install}/include/ibex"/>
<arg value="-I${ibex.install}/include/ibex/3rd"/>
<arg value="-I${dreal.install}/include/"/>
</exec>

<!-- link the JNI code as a new library -->
<exec executable="g++" dir="${path.source}" failonerror="true">
<arg value="-shared"/>
<arg value="dreal_wrap.o"/>
<arg value="-ldreal"/>
<arg value="-libex"/>
<arg value="-o"/>
<arg value="libdrealjava.so"/>
<arg value="-L${ibex.install}/lib"/>
<arg value="-L${dreal.install}/lib/"/>
</exec>

<!-- copy library files to the main directory -->
<copy file="${ibex.install}/lib/libibex.so" tofile="libibex-${dreal.version}.so"/>
<copy file="${dreal.install}/lib/libdreal.so" tofile="libdreal-${dreal.version}.so"/>
<copy file="${path.source}/libdrealjava.so" tofile="libdrealjava-${dreal.version}.so"/>

<!-- patch dependencies -->
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/><arg value="$ORIGIN"/>
<arg value="libibex-${dreal.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/><arg value="$ORIGIN"/>
<arg value="libdreal-${dreal.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/><arg value="$ORIGIN"/>
<arg value="libdrealjava-${dreal.version}.so"/>
</exec>
</target>

<target name="publish-dreal" depends="package-dreal, load-ivy"
description="Publish dReal binaries to Ivy repository.">
<ivy:resolve conf="solver-dreal" file="solvers_ivy_conf/ivy_dreal.xml" />
<publishToRepository solverName="dReal" solverVersion="${dreal.version}"/>
</target>
</project>
4 changes: 3 additions & 1 deletion lib/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SPDX-License-Identifier: Apache-2.0
<conf name="runtime-cvc5" extends="core" description="only one solver included"/>
<conf name="runtime-boolector" extends="core" description="only one solver included"/>
<conf name="runtime-yices2" extends="core" description="only one solver included"/>
<conf name="runtime-dreal" extends="core" description="only one solver included"/>

<!-- The normal dependencies with all solvers included. -->
<conf name="runtime"
Expand All @@ -49,7 +50,7 @@ SPDX-License-Identifier: Apache-2.0

<!-- The normal dependencies with all solvers included, except those unter GPL. -->
<conf name="runtime-without-gpl"
extends="runtime-mathsat,runtime-opensmt,runtime-optimathsat,runtime-smtinterpol,runtime-princess,runtime-z3,runtime-cvc4,runtime-cvc5,runtime-boolector"
extends="runtime-mathsat,runtime-opensmt,runtime-optimathsat,runtime-smtinterpol,runtime-princess,runtime-z3,runtime-cvc4,runtime-cvc5,runtime-boolector, runtime-dreal"
description="all solvers included, except those unter GPL"/>

<!-- Dependencies needed for building or running tests. -->
Expand Down Expand Up @@ -165,6 +166,7 @@ SPDX-License-Identifier: Apache-2.0
<dependency org="org.sosy_lab" name="javasmt-solver-cvc4" rev="1.8-prerelease-2020-06-24-g7825d8f28" conf="runtime-cvc4->solver-cvc4" />
<dependency org="org.sosy_lab" name="javasmt-solver-cvc5" rev="1.0.5-g4cb2ab9eb" conf="runtime-cvc5->solver-cvc5" />
<dependency org="org.sosy_lab" name="javasmt-solver-boolector" rev="3.2.2-g1a89c229" conf="runtime-boolector->solver-boolector" />
<dependency org="org.sosy_lab" name="javasmt-solver-dreal" rev="4.21.06.2-gf93bdcc" conf="runtime-dreal->solver-dreal" />

<!-- additional JavaSMT components with Solver Binaries -->
<dependency org="org.sosy_lab" name="javasmt-yices2" rev="4.1.1-59-gaf9c0520c" conf="runtime-yices2->runtime; contrib->sources" />
Expand Down
Loading