aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/formal/SMTLib2Interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/formal/SMTLib2Interface.h')
-rw-r--r--libsolidity/formal/SMTLib2Interface.h127
1 files changed, 12 insertions, 115 deletions
diff --git a/libsolidity/formal/SMTLib2Interface.h b/libsolidity/formal/SMTLib2Interface.h
index d8c11df9..5755ae3f 100644
--- a/libsolidity/formal/SMTLib2Interface.h
+++ b/libsolidity/formal/SMTLib2Interface.h
@@ -18,6 +18,7 @@
#pragma once
#include <libsolidity/formal/SMTSolverCommunicator.h>
+#include <libsolidity/formal/SolverInterface.h>
#include <libsolidity/interface/Exceptions.h>
#include <libsolidity/interface/ReadFile.h>
@@ -38,129 +39,26 @@ namespace solidity
namespace smt
{
-enum class CheckResult
-{
- SAT, UNSAT, UNKNOWN, ERROR
-};
-
-enum class Sort
-{
- Int, Bool
-};
-
-/// C++ representation of an SMTLIB2 expression.
-class Expression
-{
- friend class SMTLib2Interface;
- /// Manual constructor, should only be used by SMTLib2Interface and the class itself.
- Expression(std::string _name, std::vector<Expression> _arguments):
- m_name(std::move(_name)), m_arguments(std::move(_arguments)) {}
-
-public:
- Expression(size_t _number): m_name(std::to_string(_number)) {}
- Expression(u256 const& _number): m_name(_number.str()) {}
- Expression(bigint const& _number): m_name(_number.str()) {}
-
- Expression(Expression const& _other) = default;
- Expression(Expression&& _other) = default;
- Expression& operator=(Expression const& _other) = default;
- Expression& operator=(Expression&& _other) = default;
-
- friend Expression operator!(Expression _a)
- {
- return Expression("not", std::move(_a));
- }
- friend Expression operator&&(Expression _a, Expression _b)
- {
- return Expression("and", std::move(_a), std::move(_b));
- }
- friend Expression operator||(Expression _a, Expression _b)
- {
- return Expression("or", std::move(_a), std::move(_b));
- }
- friend Expression operator==(Expression _a, Expression _b)
- {
- return Expression("=", std::move(_a), std::move(_b));
- }
- friend Expression operator!=(Expression _a, Expression _b)
- {
- return !(std::move(_a) == std::move(_b));
- }
- friend Expression operator<(Expression _a, Expression _b)
- {
- return Expression("<", std::move(_a), std::move(_b));
- }
- friend Expression operator<=(Expression _a, Expression _b)
- {
- return Expression("<=", std::move(_a), std::move(_b));
- }
- friend Expression operator>(Expression _a, Expression _b)
- {
- return Expression(">", std::move(_a), std::move(_b));
- }
- friend Expression operator>=(Expression _a, Expression _b)
- {
- return Expression(">=", std::move(_a), std::move(_b));
- }
- friend Expression operator+(Expression _a, Expression _b)
- {
- return Expression("+", std::move(_a), std::move(_b));
- }
- friend Expression operator-(Expression _a, Expression _b)
- {
- return Expression("-", std::move(_a), std::move(_b));
- }
- friend Expression operator*(Expression _a, Expression _b)
- {
- return Expression("*", std::move(_a), std::move(_b));
- }
- Expression operator()(Expression _a) const
- {
- solAssert(m_arguments.empty(), "Attempted function application to non-function.");
- return Expression(m_name, _a);
- }
-
- std::string toSExpr() const
- {
- if (m_arguments.empty())
- return m_name;
- std::string sexpr = "(" + m_name;
- for (auto const& arg: m_arguments)
- sexpr += " " + arg.toSExpr();
- sexpr += ")";
- return sexpr;
- }
-
-private:
- explicit Expression(std::string _name):
- Expression(std::move(_name), std::vector<Expression>{}) {}
- Expression(std::string _name, Expression _arg):
- Expression(std::move(_name), std::vector<Expression>{std::move(_arg)}) {}
- Expression(std::string _name, Expression _arg1, Expression _arg2):
- Expression(std::move(_name), std::vector<Expression>{std::move(_arg1), std::move(_arg2)}) {}
-
- std::string const m_name;
- std::vector<Expression> const m_arguments;
-};
-
-class SMTLib2Interface: public boost::noncopyable
+class SMTLib2Interface: public SolverInterface, public boost::noncopyable
{
public:
SMTLib2Interface(ReadFile::Callback const& _readFileCallback);
- void reset();
+ void reset() override;
- void push();
- void pop();
+ void push() override;
+ void pop() override;
- Expression newFunction(std::string _name, Sort _domain, Sort _codomain);
- Expression newInteger(std::string _name);
- Expression newBool(std::string _name);
+ Expression newFunction(std::string _name, Sort _domain, Sort _codomain) override;
+ Expression newInteger(std::string _name) override;
+ Expression newBool(std::string _name) override;
- void addAssertion(Expression const& _expr);
- std::pair<CheckResult, std::vector<std::string>> check(std::vector<Expression> const& _expressionsToEvaluate);
+ void addAssertion(Expression const& _expr) override;
+ std::pair<CheckResult, std::vector<std::string>> check(std::vector<Expression> const& _expressionsToEvaluate) override;
private:
+ std::string toSExpr(Expression const& _expr);
+
void write(std::string _data);
std::string checkSatAndGetValuesCommand(std::vector<Expression> const& _expressionsToEvaluate);
@@ -170,7 +68,6 @@ private:
std::vector<std::string> m_accumulatedOutput;
};
-
}
}
}
cgi/freebsd-ports-gnome/commit/audio?id=2dce4721d2738cb90c14505e32f244c591aa0c2c'>No longer BROKEN on -CURRENT.vs2004-05-131-7/+1 * - configure --with-drmpav2004-05-122-10/+8 * - Add AAC support, optionally either with faad or mpeg4ippav2004-05-124-41/+54 * Update to 0.12.3.linimon2004-05-123-23/+18 * Drop maintainership.eik2004-05-111-1/+1 * 1. Add CONFIGURE_TARGET to fix warning in configure scheme.naddy2004-05-102-2/+3 * - Update to version 0.2.1krion2004-05-102-3/+3 * - Avoid extract depend on faad now that it provides all required headerspav2004-05-101-3/+1 * - Fix typo in PORTREVISIONpav2004-05-101-1/+1 * - Install systems.h header. This will help faac to build independently.pav2004-05-102-0/+5 * Add musepack, decoder, encoder and replaygain for musepack audio format.pav2004-05-105-0/+131 * Drop maintainership. Maintainer is not using FreeBSD aserwin2004-05-091-1/+1 * Update to 2.1.19.ume2004-05-092-4/+3 * - Fix dependencieskrion2004-05-071-0/+2 * - Update to 0.10.1krion2004-05-073-5/+7 * Bump PORTREVISION by previous commit.nork2004-05-071-1/+1 * Add missing brace and fix comment.nork2004-05-071-2/+2 * - Update to latest versionvs2004-05-073-10/+35 * - Add support for FAAC encoderpav2004-05-061-1/+6 * Add faac, an AAC audio encoder. FAAC currently supports MPEG-4 LTP,pav2004-05-065-0/+57 * Chase vte shlib version.bland2004-05-061-0/+1 * Shrink description and update to 2.4.0.naddy2004-05-063-22/+8 * Update to 3.6.0. Notable changes in this release:naddy2004-05-062-3/+3 * - Add mp3encode to optionspav2004-05-051-0/+9 * - Fix build of gtk12 extension on gcc 3.3pav2004-05-052-0/+20 * Update to 1.0nsayer2004-05-042-3/+3 * - Upgrade to 5.1.5.brooks2004-05-043-0/+27 * Update to 0.8.3.marcus2004-05-044-6/+6 * - Upgrade to 5.1.5.brooks2004-05-0420-58/+436 * - Use Libtoolpav2004-05-031-1/+1 * - Fix path to XMMS socketpav2004-05-031-1/+2 * - Update to 3.2.0pav2004-05-032-7/+64 * - Update to 0.1.1pav2004-05-032-5/+3 * - update to 0.3petef2004-05-034-10/+16 * Add optional dependencies on esound and NAS.lofi2004-05-031-1/+31 * - Update to 0.20.0pav2004-05-024-12/+16 * - update to 0.94petef2004-05-024-16/+8 * Update to 0.8.2.marcus2004-05-014-6/+6 * - Update to version 0.8.3krion2004-04-304-26/+14 * - Fix typokrion2004-04-291-1/+1 * - Update to version 0.9krion2004-04-2915-239/+158 * - Update to version 0.86krion2004-04-292-13/+10 * - Update to version 1.2.9krion2004-04-293-4/+15 * Update to 0.8.1.marcus2004-04-294-6/+6 * Update to tiny version 3.3.2. This is a bug fix to prevent cda fromdeischen2004-04-252-13/+4 * - Enable cdparanoia supportkrion2004-04-211-0/+1 * - Handle OPTIONS properlykrion2004-04-211-3/+4 * - Update to version 3.1.10krion2004-04-212-3/+5 * Update to KDE 3.2.2lofi2004-04-203-40/+47 * Update to 2.6.1.marcus2004-04-206-8/+8 * Update to 0.10nsayer2004-04-202-3/+3 * Make fetchable.trevor2004-04-201-7/+2 * Update to latest stable release 3.02.12b.osa2004-04-192-3/+3 * - Update to 0.2pav2004-04-197-68/+11 * These broken ports are scheduled for deletion on June 18 if they arekris2004-04-195-0/+12 * As detected by fenner's survey, the OGI FTP site is not working properly.trevor2004-04-192-1/+2 * Fix packing list. Be a little less verbose.trevor2004-04-191-7/+10 * Update to 0.14.2.knu2004-04-192-3/+3 * Chase the newly introduced 302 redirection.knu2004-04-193-3/+3 * update to 4.0.5oliver2004-04-193-7/+8 * - Update to 2.0dpav2004-04-192-3/+3 * - Update to 2004.04.11pav2004-04-182-3/+3 * - Update to 2.1.19pav2004-04-182-3/+3 * - Correct plistkrion2004-04-172-6/+11 * - Update to 0.97 (unbreak fetch)pav2004-04-172-4/+5 * Update to 0.8.0. For a list of what's changed, see:marcus2004-04-1712-96/+126 * Fix make describe for old make's.arved2004-04-161-1/+1 * - Remove USE_SIZE knobkrion2004-04-163-3/+0 * Add slimserver 5.1.1,krion2004-04-1630-0/+4031 * Mark broken on 5.x with libc_r.arved2004-04-161-1/+7 * - Change maintainer's emailkrion2004-04-161-1/+1 * libflac -> libFLACedwin2004-04-151-1/+1 * Add missing filekris2004-04-151-0/+1 * Reset bouncing maintainer address:kris2004-04-151-1/+1 * Add missing directorieskris2004-04-151-0/+2 * Add missing directorykris2004-04-151-0/+1 * - Update to 3.1.9krion2004-04-152-4/+3 * - Fix MASTER_SITESkrion2004-04-151-1/+1 * Add ncmpc 0.10.0,krion2004-04-145-0/+47 * Update to 0.5.11bland2004-04-145-46/+3 * Fix typo in previous.kris2004-04-141-1/+1 * Make audio/flac a LIB_DEPENDS instead of a RUN_DEPENDS.deischen2004-04-141-2/+2 * Fix build on amd64 (and probably on ia64), by fixing path to endian.harved2004-04-133-4/+62 * Move the gtk20 dependency to USE_GNOME to chase the gtk20 shared lib version.marcus2004-04-131-1/+1 * Make it work on 64bit platforms.arved2004-04-132-6/+92 * Respect CC and CFLAGSarved2004-04-131-3/+3 * s/ /\t/ in the newly added BUILD_DEPENDS line.deischen2004-04-131-1/+1 * Add missing includekris2004-04-131-0/+1 * Add a BUILD_DEPENDS for audio/flac.deischen2004-04-121-0/+1 * Update to 3.96.netchild2004-04-123-6/+4 * Point WWW to new projectsitemarkus2004-04-121-2/+1 * Teach this port about USE_GNOME, add add the gtk20 component to fix the buildmarcus2004-04-121-2/+3 * BROKEN: Does not compile on sparc64kris2004-04-121-1/+7 * BROKEN on sparc64: Does not compilekris2004-04-121-1/+7 * Fix plist.kris2004-04-121-13/+13 * Move post-extract to pre-build so that gmake is used after it is added.kris2004-04-121-1/+1 * - Update to 0.10.3krion2004-04-114-16/+12 * Unbreak on -stable by commenting out a call to pthread_atfork().deischen2004-04-111-0/+26 * Update to 0.9nsayer2004-04-112-2/+3 * Tidy up whitespace.trevor2004-04-114-13/+13 * Cram into 80 columns by 24 rows.trevor2004-04-111-33/+20 * Update to xmcd-3.3.1.deischen2004-04-113-20/+35 * - Fix dependencieskrion2004-04-101-1/+2 * Per distfile survey, chase mastersite.linimon2004-04-101-1/+1 * - Update to version 2.0.5krion2004-04-103-17/+16 * Fix broken plistarved2004-04-092-1/+2 * - Utilize lthackkrion2004-04-092-3/+3 * - Update to version 3.1.11krion2004-04-092-10/+8 * Update to 0.4, and add support for gstreamer-0.8.marcus2004-04-096-19/+107 * - Fix build on 4-xkrion2004-04-082-4/+19 * Update to 1.0arved2004-04-083-16/+14 * Mark ONLY_FOR_ARCHS= i386 amd64arved2004-04-081-0/+1 * Add xmms-jack, a Output plugin for the JACK sound serverarved2004-04-085-0/+69 * Chase gstreamer-plugins shared lib version, but this port still needs anmarcus2004-04-081-2/+3 * Chase the gstreamer-plugins shared lib version.marcus2004-04-082-2/+2 * Use the gstreamerplugins GNOME component to chase the gstreamer-pluginsmarcus2004-04-081-2/+3 * - tar -> ${TAR} (since we have now a bsdtar ;)clement2004-04-071-1/+1 * BROKEN: Does not fetchkris2004-04-071-0/+2 * BROKEN: Unfetchablekris2004-04-071-0/+2 * - Update to version 0.99.10krion2004-04-075-26/+5 * sox is also a BUILD_DEPENDSkris2004-04-061-0/+1 * Update to 0.7.1.fjoe2004-04-064-44/+17 * Reinitate maintainer:edwin2004-04-051-1/+1 * Fix some known compatibility problems with GNOME 2.6.marcus2004-04-054-3/+16 * Remove maintainer since he is blocked email from FreeBSD.org:edwin2004-04-051-1/+1 * Chase the glib20 update, and bump all affected ports' PORTREVISIONs.marcus2004-04-0536-27/+36 * Presenting GNOME 2.6.0. The FreeBSD GNOME Team feels this our best releasemarcus2004-04-0514-328/+356 * - Remove post-install: completely, it's being done by the software anyway.pav2004-04-041-4/+0 * BROKEN: Patch failskris2004-04-041-0/+2 * - Flip ln -sf arguments, they were in wrong orderpav2004-04-041-2/+2 * Remove a somewhat out-of-date BUILD_DEPEND and associated comment,ade2004-04-031-5/+0 * Update to 3.5.2:naddy2004-04-023-4/+4 * Add kmp 0.01, a graphical interface to musicpd written with Qt.krion2004-04-025-0/+41 * Remove category pkg/COMMENT files in favour of a COMMENT variable in thekris2004-04-022-1/+2 * - Mark IGNORE for amd64, it builds but does not work properly.pav2004-04-021-0/+6 * - Respect CXXkrion2004-04-011-0/+1 * Update to 0.1.0.nork2004-03-315-14/+13 * Update to 0.4.0.nork2004-03-313-4/+6 * Update to 0.3.4nork2004-03-312-4/+6 * Update to 0.12.1.nork2004-03-313-6/+18 * Change the last remaining references to philip@paeps.cx to philip@FreeBSD.org.philip2004-03-311-1/+1 * SIZEify (maintainer timeout)trevor2004-03-31128-0/+144 * - Use USE_ICONV knobkrion2004-03-315-7/+6 * Update to 2.1.16.ume2004-03-312-4/+3 * Update to 0.6.10.marcus2004-03-306-42/+16 * Update to 3.02.11b.osa2004-03-294-12/+54 * Add missing USE_GETTEXT, conditionally on WITHOUT_NLS.kris2004-03-292-13/+21 * Fix build on amd64 (don't try and link static libraries into shared)kris2004-03-291-4/+19 * - Update to version 3.1.8krion2004-03-292-3/+3 * Avoid linking with libintl. As found by kris, opmixer does nottrevor2004-03-282-6/+7 * Support WITHOUT_NLSkris2004-03-282-2/+9 * Support WITHOUT_NLSkris2004-03-282-3/+10 * - Fix security issues (and remove forbidden):netchild2004-03-273-3/+35 * - Update to version 1.2.8krion2004-03-262-3/+3 * - Remove unneeded patchkrion2004-03-264-8/+0 * - Update to version 3.1.7krion2004-03-263-3/+4 * - Update to version 2.7krion2004-03-266-59/+66 * - Update to version 2004.03.21krion2004-03-262-3/+3 * Fix plist entries.bland2004-03-262-1/+3 * Update MASTER_SITES.osa2004-03-262-1/+2 * Unreak on alpha/CURRENT and hopefully make the world a better placevs2004-03-262-7/+12 * - Update to 0.10.2krion2004-03-266-46/+47 * - Update to 0.10.2krion2004-03-263-67/+3 * Drop maintainership.nbm2004-03-263-3/+3 * BROKEN: Unfetchablekris2004-03-251-0/+2 * Update to 0.3:vs2004-03-253-6/+6 * - Fix MASTER_SITESkrion2004-03-251-2/+1 * Clean up USE_{LIBTOOL,AUTOCONF,AUTOMAKE} to appropriate *_VER variablesade2004-03-251-1/+1 * SIZE update jumbo-commit.bms2004-03-253-0/+3 * Add size data, approved by maintainers.trevor2004-03-251-0/+1 * Unbreak the fetch step: USE_BZIP2 must be set before the use ofgreen2004-03-241-1/+1 * Fix another Memory Leak.arved2004-03-242-4/+10 * Add the ability to install the XMMS plugin (WITH_XMMS option).green2004-03-242-2/+14 * s/freebsd.org/FreeBSD.org/marcus2004-03-232-2/+2 * Update to 0.7.1nsayer2004-03-232-2/+2 * Update to version 1.0.1green2004-03-233-3/+4 * Add SIZE data.knu2004-03-2212-0/+13 * Fix path in sample configuration file.clement2004-03-221-0/+2 * o/~ Everybody was distfile sizing! o/~kris2004-03-221-0/+1 * Mark IGNORE until the distfile catches up with libmusicbrainz.marcus2004-03-221-0/+2 * Mark IGNORE until distfile catches up with libmusicbrainz.marcus2004-03-221-0/+2 * Split out header/PTHREAD_LIBS fixups into post-patch, otherwise thekris2004-03-222-4/+12 * Reassign maintainership to Serge Gagnon.thierry2004-03-211-1/+1 * Add size data, approved by maintainers.trevor2004-03-214-0/+4 * Trevor thinks we may be seen as a manufacturer of lame if we distributenetchild2004-03-201-0/+2 * SIZEifyerwin2004-03-201-0/+1 * Extend -fPIC hack to cover ia64, which also requires it, and properlykris2004-03-201-2/+2 * - Update to version 2.0.p6krion2004-03-208