Skip to content

Commit

Permalink
added z3 problem export synatx feature
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-hauns committed Dec 11, 2024
1 parent 0b78e07 commit f867ded
Show file tree
Hide file tree
Showing 11 changed files with 1,062 additions and 224 deletions.
7 changes: 4 additions & 3 deletions Inferences/TheoryInstAndSimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ TheoryInstAndSimp::TheoryInstAndSimp(Options& opts) : TheoryInstAndSimp(
opts.thiTautologyDeletion(),
opts.showZ3(),
opts.thiGeneralise(),
opts.exportThiProblem()
opts.exportThiProblem(),
opts.problemExportSyntax()
) {}


Expand All @@ -87,12 +88,12 @@ Options::TheoryInstSimp manageDeprecations(Options::TheoryInstSimp mode)
}
}

TheoryInstAndSimp::TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib)
TheoryInstAndSimp::TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib, Shell::Options::ProblemExportSyntax problemExportSyntax)
: _splitter(0)
, _mode(manageDeprecations(mode))
, _thiTautologyDeletion(thiTautologyDeletion)
, _naming()
, _solver(new Z3Interfacing(_naming, showZ3, /* unsatCoresForAssumptions = */ generalisation, exportSmtlib))
, _solver(new Z3Interfacing(_naming, showZ3, /* unsatCoresForAssumptions = */ generalisation, exportSmtlib, problemExportSyntax))
, _generalisation(generalisation)
, _instantiationConstants ("$inst")
, _generalizationConstants("$inst$gen")
Expand Down
2 changes: 1 addition & 1 deletion Inferences/TheoryInstAndSimp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TheoryInstAndSimp
TheoryInstAndSimp(TheoryInstAndSimp&&) = default;

TheoryInstAndSimp(Options& opts);
TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib);
TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib, Shell::Options::ProblemExportSyntax problemExportSyntax);

void attach(SaturationAlgorithm* salg);

Expand Down
21 changes: 21 additions & 0 deletions Kernel/Theory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ class DivByZeroException : public ArithmeticException
DivByZeroException() : ArithmeticException("divided by zero"){}
};

enum class Sign : uint8_t {
Zero = 0,
Pos = 1,
Neg = 2,
};

inline std::ostream& operator<<(std::ostream& out, Sign const& self)
{
switch(self) {
case Sign::Zero: return out << "0";
case Sign::Pos: return out << "+";
case Sign::Neg: return out << "-";
}
ASSERTION_VIOLATION
}

class IntegerConstantType
{
public:
Expand Down Expand Up @@ -100,6 +116,11 @@ class IntegerConstantType

InnerType toInner() const { return _val; }

Sign sign() const
{ return _val > 0 ? Sign::Pos
: _val < 0 ? Sign::Neg
: Sign::Zero; }

bool isZero(){ return _val==0; }
bool isNegative(){ return _val<0; }

Expand Down
Loading

0 comments on commit f867ded

Please sign in to comment.