dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
PredicateAbstractor.h
1
8#pragma once
9
10#include <unordered_map>
11#include <vector>
12
13#include "dlinear/symbolic/FormulaVisitor.h"
14#include "dlinear/symbolic/LinearFormulaFlattener.h"
15#include "dlinear/symbolic/literal.h"
16#include "dlinear/symbolic/symbolic.h"
17#include "dlinear/util/Config.h"
18
19namespace dlinear {
20
28 public:
34 : FormulaVisitor{config, "PredicateAbstractor"}, flattener_{config} {}
44 [[nodiscard]] Formula Process(const Formula &f);
45 [[nodiscard]] Formula operator()(const Formula &f);
46
57 [[nodiscard]] Formula Process(const std::vector<Formula> &formulas);
58 [[nodiscard]] Formula operator()(const std::vector<Formula> &formulas);
59
61 [[nodiscard]] const std::unordered_map<Variable, Formula> &var_to_formula_map() const { return var_to_formula_map_; }
62
63 [[nodiscard]] const Variable &operator[](const Formula &f) const { return formula_to_var_map_.at(f); }
64 [[nodiscard]] const Formula &operator[](const Variable &var) const { return var_to_formula_map_.at(var); }
65
66 private:
76 [[nodiscard]] Formula VisitFormula(const Formula &f) const override;
77 [[nodiscard]] Formula VisitAtomic(const Formula &f) const;
78 [[nodiscard]] Formula VisitEqualTo(const Formula &f) const override;
79 [[nodiscard]] Formula VisitNotEqualTo(const Formula &f) const override;
80 [[nodiscard]] Formula VisitGreaterThan(const Formula &f) const override;
81 [[nodiscard]] Formula VisitGreaterThanOrEqualTo(const Formula &f) const override;
82 [[nodiscard]] Formula VisitLessThan(const Formula &f) const override;
83 [[nodiscard]] Formula VisitLessThanOrEqualTo(const Formula &f) const override;
84 [[nodiscard]] Formula VisitConjunction(const Formula &f) const override;
85 [[nodiscard]] Formula VisitDisjunction(const Formula &f) const override;
86 [[nodiscard]] Formula VisitNegation(const Formula &f) const override;
87 [[nodiscard]] Formula VisitForall(const Formula &f) const override;
88
89 mutable std::unordered_map<Variable, Formula>
91 mutable std::unordered_map<Formula, Variable>
94};
95
96} // namespace dlinear
Simple dataclass used to store the configuration of the program.
Definition Config.h:38
This base class provides all the methods expected to visit the underlying formula and return a modifi...
Used by the PredicateAbstractor to ensure that all the theory literals are in the flattened standard ...
Predicate abstraction is a method to convert a first-order logic formula into a Boolean formula.
Formula Process(const Formula &f)
Convert a first-order logic formula f into a Boolean formula by predicate abstraction.
Formula VisitFormula(const Formula &f) const override
Visit an atomic formula.
std::unordered_map< Formula, Variable > formula_to_var_map_
Map from previously converted formula to Boolean variable.
const std::unordered_map< Variable, Formula > & var_to_formula_map() const
Get read-only access to the map of previously converted formulae to variable of the PredicateAbstract...
PredicateAbstractor(const Config &config)
Construct a new PredicateAbstractor object with the given config.
std::unordered_map< Variable, Formula > var_to_formula_map_
Map from Boolean variable to previously converted formula.
LinearFormulaFlattener flattener_
Linear formula flattener.
Represents a symbolic form of a first-order logic formula.
Represents a symbolic variable.
Global namespace for the dlinear library.