#ifndef __Monotonicity__
#define __Monotonicity__
#include "Forwards.hpp"
#include "Lib/DHMap.hpp"
#include "Lib/ScopedPtr.hpp"
#include "Kernel/Term.hpp"
#include "Kernel/Clause.hpp"
#include "SAT/SATSolver.hpp"
#include "SAT/SATLiteral.hpp"
namespace FMB {
using namespace Kernel;
using namespace SAT;
using namespace Lib;
class Monotonicity{
public:
Monotonicity(ClauseList* clauses, unsigned srt);
DArray<signed char>* check();
static void addSortPredicates(bool withMon, ClauseList*& clauses, const DArray<bool>& del_f,
DHMap<unsigned,DArray<signed char>*>& monotonic_vampire_sorts, Stack<unsigned>& sort_predicates);
static void addSortFunctions(bool withMon, ClauseList*& clauses,
DHMap<unsigned,DArray<signed char>*>& monotonic_vampire_sorts, Stack<unsigned>& sort_functions);
private:
void monotone(Clause* c, Literal* l);
void safe(Clause* c, Literal* l, TermList* t);
void safe(Clause* c, Literal* l, TermList* t, SATLiteral add);
void safe(Clause* c, Literal* l, TermList* t, Stack<SATLiteral>& slits);
bool guards(Literal* l, unsigned var, Stack<SATLiteral>& slits);
unsigned _srt;
bool _result;
DHMap<unsigned,SATLiteral> _pF;
DHMap<unsigned,SATLiteral> _pT;
ScopedPtr<SATSolver> _solver;
};
}
#endif