28 class Expr :
public std::enable_shared_from_this<Expr> {
62 virtual std::pair<bool, std::string>
freeVar() = 0;
71 virtual std::shared_ptr<Expr>
guessVar(std::string var,
bool val) = 0;
96 virtual std::shared_ptr<Expr>
getLeft() = 0;
108 virtual std::unordered_set<std::string>
literals() = 0;
117 std::string var) = 0;
129 virtual std::vector<std::shared_ptr<Expr>>
clauses() = 0;
142 std::pair<bool, std::string>
freeVar()
override {
return {
true,
name}; }
143 std::shared_ptr<Expr>
simplify()
override {
return shared_from_this(); }
146 std::shared_ptr<Expr>
guessVar(std::string var,
bool val)
override;
148 std::shared_ptr<Expr>
fixNegations()
override {
return shared_from_this(); }
149 std::shared_ptr<Expr>
distribute()
override {
return shared_from_this(); }
150 std::shared_ptr<Expr>
getLeft()
override {
return std::shared_ptr<Expr>(); }
152 return std::shared_ptr<Expr>();
157 std::string var)
override {
158 std::unordered_map<std::string, Polarity> polarity_map;
166 std::vector<std::shared_ptr<Expr>>
clauses()
override {
167 return {shared_from_this()};
189 return "(" +
left->to_string() +
" && " +
right->to_string() +
")";
194 std::pair<bool, std::string>
freeVar()
override {
195 std::pair<bool, std::string> leftVar =
left->freeVar();
199 return right->freeVar();
205 return std::make_shared<And>(
left->fixNegations(),
206 right->fixNegations());
210 return std::make_shared<And>(
left->distribute(),
right->distribute());
216 std::unordered_set<std::string>
literals()
override {
217 auto leftLiterals =
left->literals();
218 auto rightLiterals =
right->literals();
219 leftLiterals.insert(rightLiterals.begin(), rightLiterals.end());
224 std::string var)
override {
225 std::unordered_map<std::string, Polarity> polarity_map;
227 std::unordered_map<std::string, Polarity> left_polarity =
228 left->literalPolarity(var);
229 std::unordered_map<std::string, Polarity> right_polarity =
230 right->literalPolarity(var);
232 for (
auto &pair : left_polarity) {
233 polarity_map[pair.first] = pair.second;
236 for (
auto &pair : right_polarity) {
237 if (polarity_map.find(pair.first) == polarity_map.end()) {
238 polarity_map[pair.first] = pair.second;
239 }
else if (polarity_map[pair.first] != pair.second) {
247 std::pair<std::string, bool>
unitClause()
override {
return {
"",
false}; }
249 std::vector<std::shared_ptr<Expr>>
clauses()
override {
250 auto left_clause =
left->clauses();
251 auto right_clause =
right->clauses();
252 left_clause.insert(left_clause.end(), right_clause.begin(),
257 std::shared_ptr<Expr>
guessVar(std::string var,
bool val)
override;
258 std::shared_ptr<Expr>
simplify()
override;
282 return "(" +
left->to_string() +
" || " +
right->to_string() +
")";
287 std::pair<bool, std::string>
freeVar()
override {
288 std::pair<bool, std::string> leftVar =
left->freeVar();
292 return right->freeVar();
298 return std::make_shared<Or>(
left->fixNegations(),
299 right->fixNegations());
304 return std::make_shared<And>(
305 std::make_shared<Or>(
left->distribute(),
306 right->getLeft()->distribute()),
307 std::make_shared<Or>(
left->distribute(),
308 right->getRight()->distribute()));
309 }
else if (
left->opcode ==
AND) {
310 return std::make_shared<And>(
311 std::make_shared<Or>(
right->distribute(),
312 left->getLeft()->distribute()),
313 std::make_shared<Or>(
right->distribute(),
314 left->getRight()->distribute()));
316 return std::make_shared<Or>(
left->distribute(),
right->distribute());
323 std::unordered_set<std::string>
literals()
override {
324 auto leftLiterals =
left->literals();
325 auto rightLiterals =
right->literals();
326 leftLiterals.insert(rightLiterals.begin(), rightLiterals.end());
331 std::string var)
override {
332 std::unordered_map<std::string, Polarity> polarity_map;
334 std::unordered_map<std::string, Polarity> left_polarity =
335 left->literalPolarity(var);
336 std::unordered_map<std::string, Polarity> right_polarity =
337 right->literalPolarity(var);
339 for (
auto &pair : left_polarity) {
340 polarity_map[pair.first] = pair.second;
343 for (
auto &pair : right_polarity) {
344 if (polarity_map.find(pair.first) == polarity_map.end()) {
345 polarity_map[pair.first] = pair.second;
346 }
else if (polarity_map[pair.first] != pair.second) {
354 std::pair<std::string, bool>
unitClause()
override {
return {
"",
false}; }
356 std::vector<std::shared_ptr<Expr>>
clauses()
override {
357 return {shared_from_this()};
360 std::shared_ptr<Expr>
guessVar(std::string var,
bool val)
override;
361 std::shared_ptr<Expr>
simplify()
override;
383 return "(!(" +
expr->to_string() +
"))";
388 std::pair<bool, std::string>
freeVar()
override {
return expr->freeVar(); }
391 return std::make_shared<Not>(
expr->distribute());
396 std::shared_ptr<Expr>
getLeft()
override {
return std::shared_ptr<Expr>(); }
398 return std::shared_ptr<Expr>();
401 std::unordered_set<std::string>
literals()
override {
402 return expr->literals();
406 std::string var)
override {
407 std::unordered_map<std::string, Polarity> polarity_map;
416 return {
expr->name,
false};
421 std::vector<std::shared_ptr<Expr>>
clauses()
override {
422 return {shared_from_this()};
426 std::shared_ptr<Expr>
guessVar(std::string var,
bool val)
override;
427 std::shared_ptr<Expr>
simplify()
override;
445 std::string
name =
"Const";
452 std::pair<bool, std::string>
freeVar()
override {
return {
false,
""}; }
456 std::shared_ptr<Expr>
simplify()
override {
return shared_from_this(); };
457 std::shared_ptr<Expr>
fixNegations()
override {
return shared_from_this(); }
458 std::shared_ptr<Expr>
distribute()
override {
return shared_from_this(); }
459 std::shared_ptr<Expr>
getLeft()
override {
return std::shared_ptr<Expr>(); }
461 return std::shared_ptr<Expr>();
464 std::unordered_set<std::string>
literals()
override {
return {}; }
466 std::shared_ptr<Expr>
guessVar(std::string var,
bool val)
override;
469 std::string var)
override {
470 std::unordered_map<std::string, Polarity> polarity_map;
474 std::pair<std::string, bool>
unitClause()
override {
return {
"",
false}; }
476 std::vector<std::shared_ptr<Expr>>
clauses()
override {
477 return {shared_from_this()};
486 return std::make_shared<Const>(val);
488 return std::make_shared<Var>(
name);
493 return std::make_shared<And>(
left->guessVar(var, val),
494 right->guessVar(var, val));
498 return std::make_shared<Or>(
left->guessVar(var, val),
499 right->guessVar(var, val));
503 return std::make_shared<Not>(
expr->guessVar(var, val));
507 return std::make_shared<Const>(
value);
511 auto simplifiedLeft =
left->simplify();
512 auto simplifiedRight =
right->simplify();
514 if (simplifiedLeft->to_string() ==
"True" &&
515 simplifiedRight->to_string() ==
"True") {
516 return std::make_shared<Const>(
true);
517 }
else if (simplifiedLeft->to_string() ==
"False" ||
518 simplifiedRight->to_string() ==
"False") {
519 return std::make_shared<Const>(
false);
520 }
else if (simplifiedLeft->to_string() ==
"True") {
521 return simplifiedRight;
522 }
else if (simplifiedRight->to_string() ==
"True") {
523 return simplifiedLeft;
525 return std::make_shared<And>(simplifiedLeft, simplifiedRight);
530 auto simplifiedLeft =
left->simplify();
531 auto simplifiedRight =
right->simplify();
533 if (simplifiedLeft->to_string() ==
"False" &&
534 simplifiedRight->to_string() ==
"False") {
535 return std::make_shared<Const>(
false);
536 }
else if (simplifiedLeft->to_string() ==
"True" ||
537 simplifiedRight->to_string() ==
"True") {
538 return std::make_shared<Const>(
true);
539 }
else if (simplifiedLeft->to_string() ==
"False") {
540 return simplifiedRight;
541 }
else if (simplifiedRight->to_string() ==
"False") {
542 return simplifiedLeft;
544 return std::make_shared<Or>(simplifiedLeft, simplifiedRight);
549 auto simplifiedExpr =
expr->simplify();
551 if (simplifiedExpr->to_string() ==
"True") {
552 return std::make_shared<Const>(
false);
553 }
else if (simplifiedExpr->to_string() ==
"False") {
554 return std::make_shared<Const>(
true);
556 return std::make_shared<Not>(simplifiedExpr);
561 if (
expr->to_string() ==
"True") {
563 return std::make_shared<Const>(
false);
564 }
else if (
expr->to_string() ==
"False") {
566 return std::make_shared<Const>(
true);
568 return std::make_shared<Not>(
expr->fixNegations());
571 return expr->fixNegations();
573 return std::make_shared<Or>(
574 std::make_shared<Not>(
expr->getLeft())->fixNegations(),
575 std::make_shared<Not>(
expr->getRight())->fixNegations());
577 return std::make_shared<And>(
578 std::make_shared<Not>(
expr->getLeft())->fixNegations(),
579 std::make_shared<Not>(
expr->getRight())->fixNegations());
581 return std::make_shared<Not>(
expr->fixNegations());
589 inline std::shared_ptr<Expr>
cnf(std::shared_ptr<Expr>
expr) {
590 std::shared_ptr<Expr> new_expr =
expr->fixNegations()->distribute();
591 if (
expr->to_string() == new_expr->to_string()) {
594 return cnf(new_expr);
605 std::shared_ptr<Expr>
expr,
606 std::unordered_map<std::string, bool> &assignments_map) {
607 std::unordered_set<std::string> literal_set =
expr->literals();
608 std::unordered_map<std::string, Polarity> polarity_map;
609 std::vector<std::pair<std::string, bool>> assignments;
611 for (std::string var : literal_set) {
612 polarity_map =
expr->literalPolarity(var);
613 if (polarity_map.find(var) != polarity_map.end()) {
615 assignments.push_back(std::make_pair(var,
true));
617 assignments.push_back(std::make_pair(var,
false));
622 for (
auto &assignment : assignments) {
623 std::string var = assignment.first;
624 bool value = assignment.second;
626 if (assignments_map.find(var) == assignments_map.end()) {
627 assignments_map.emplace(var, value);
629 assignments_map[var] = value;
642 std::shared_ptr<Expr>
expr) {
643 std::vector<std::pair<std::string, bool>> result;
644 std::vector<std::shared_ptr<Expr>> exprs =
expr->clauses();
645 for (
auto e : exprs) {
646 auto uc = e->unitClause();
647 if (uc.first !=
"") {
648 result.emplace_back(uc);
661 std::shared_ptr<Expr>
expr,
662 std::unordered_map<std::string, bool> &assignments_map) {
663 std::vector<std::pair<std::string, bool>> assignments =
665 for (
auto &assignment : assignments) {
666 std::string var = assignment.first;
667 bool value = assignment.second;
669 if (assignments_map.find(var) == assignments_map.end()) {
670 assignments_map.emplace(var, value);
672 assignments_map[var] = value;
686 std::shared_ptr<Expr>
expr,
687 std::unordered_map<std::string, bool> &assignments_map) {
692 std::pair<bool, std::string> freevar = expr2->freeVar();
693 if (!freevar.first) {
694 return expr2->simplify()->unConst();
696 std::string var = freevar.second;
698 auto trueGuess = expr2->guessVar(var,
true)->simplify();
699 std::unordered_map<std::string, bool> true_assignments_map =
701 if (true_assignments_map.find(var) == true_assignments_map.end()) {
702 true_assignments_map.emplace(var,
true);
704 true_assignments_map[var] =
true;
707 assignments_map = true_assignments_map;
711 auto falseGuess = expr2->guessVar(var,
false)->simplify();
712 std::unordered_map<std::string, bool> false_assignments_map =
714 if (false_assignments_map.find(var) == false_assignments_map.end()) {
715 false_assignments_map.emplace(var,
false);
717 false_assignments_map[var] =
false;
720 assignments_map = false_assignments_map;
737 std::unordered_map<std::string, gymbo::Sym *> &unique_sym_map) {
740 return std::make_shared<And>(
sym2expr(sym->
left, unique_sym_map),
744 return std::make_shared<Not>(
sym2expr(sym->
left, unique_sym_map));
747 return std::make_shared<Or>(
sym2expr(sym->
left, unique_sym_map),
751 unique_sym_map.insert({sym->
toString(
true), sym});
752 return std::make_shared<Var>(sym->
toString(
true));
766 std::vector<gymbo::Sym> &constraints,
767 std::unordered_map<std::string, gymbo::Sym *> &unique_sym_map) {
768 if (constraints.size() == 0) {
769 return std::make_shared<Const>(
true);
771 std::shared_ptr<Expr> res =
sym2expr(&constraints[0], unique_sym_map);
772 for (
int i = 1; i < constraints.size(); i++) {
773 res = std::make_shared<And>(
774 res,
sym2expr(&constraints[i], unique_sym_map));
Class representing the logical AND operation.
Definition: sat.h:175
std::pair< bool, std::string > freeVar() override
Identify and return free variables in the logical expression.
Definition: sat.h:194
std::shared_ptr< Expr > getRight() override
Get the right child expression.
Definition: sat.h:214
bool evaluate() override
Evaluate the logical expression.
Definition: sat.h:192
std::shared_ptr< Expr > left
Definition: sat.h:261
std::vector< std::shared_ptr< Expr > > clauses() override
Get a vector of clauses present in the logical expression.
Definition: sat.h:249
std::shared_ptr< Expr > getLeft() override
Get the left child expression.
Definition: sat.h:213
std::unordered_set< std::string > literals() override
Get the literals present in the logical expression.
Definition: sat.h:216
std::shared_ptr< Expr > simplify() override
Simplify the logical expression.
Definition: sat.h:510
bool unConst() override
Check if the logical expression can be simplified by removing constants.
Definition: sat.h:202
std::shared_ptr< Expr > right
Definition: sat.h:261
std::unordered_map< std::string, Polarity > literalPolarity(std::string var) override
Get the polarities of literals with respect to a specific variable.
Definition: sat.h:223
std::shared_ptr< Expr > distribute() override
Distribute operations in the logical expression.
Definition: sat.h:209
And(std::shared_ptr< Expr > left, std::shared_ptr< Expr > right)
Constructor for the And class.
Definition: sat.h:182
std::shared_ptr< Expr > guessVar(std::string var, bool val) override
Make a guess for a variable's value and return the resulting expression.
Definition: sat.h:492
std::shared_ptr< Expr > fixNegations() override
Fix negations in the logical expression.
Definition: sat.h:204
std::string to_string() override
Convert the logical expression to a string representation.
Definition: sat.h:188
std::pair< std::string, bool > unitClause() override
Get a unit clause from the logical expression.
Definition: sat.h:247
Class representing a boolean constant in a logical expression.
Definition: sat.h:437
std::shared_ptr< Expr > simplify() override
Simplify the logical expression.
Definition: sat.h:456
std::shared_ptr< Expr > guessVar(std::string var, bool val) override
Make a guess for a variable's value and return the resulting expression.
Definition: sat.h:506
std::shared_ptr< Expr > getRight() override
Get the right child expression.
Definition: sat.h:460
std::pair< std::string, bool > unitClause() override
Get a unit clause from the logical expression.
Definition: sat.h:474
bool unConst() override
Check if the logical expression can be simplified by removing constants.
Definition: sat.h:454
std::shared_ptr< Expr > fixNegations() override
Fix negations in the logical expression.
Definition: sat.h:457
bool value
Definition: sat.h:481
std::vector< std::shared_ptr< Expr > > clauses() override
Get a vector of clauses present in the logical expression.
Definition: sat.h:476
std::pair< bool, std::string > freeVar() override
Identify and return free variables in the logical expression.
Definition: sat.h:452
Const(bool value)
Constructor for the Const class.
Definition: sat.h:443
std::shared_ptr< Expr > distribute() override
Distribute operations in the logical expression.
Definition: sat.h:458
std::string to_string() override
Convert the logical expression to a string representation.
Definition: sat.h:448
std::unordered_set< std::string > literals() override
Get the literals present in the logical expression.
Definition: sat.h:464
bool evaluate() override
Evaluate the logical expression.
Definition: sat.h:450
std::shared_ptr< Expr > getLeft() override
Get the left child expression.
Definition: sat.h:459
std::unordered_map< std::string, Polarity > literalPolarity(std::string var) override
Get the polarities of literals with respect to a specific variable.
Definition: sat.h:468
Base class for representing logical expressions.
Definition: sat.h:28
virtual std::shared_ptr< Expr > getLeft()=0
Get the left child expression.
virtual std::shared_ptr< Expr > fixNegations()=0
Fix negations in the logical expression.
virtual std::vector< std::shared_ptr< Expr > > clauses()=0
Get a vector of clauses present in the logical expression.
virtual bool unConst()=0
Check if the logical expression can be simplified by removing constants.
virtual std::shared_ptr< Expr > simplify()=0
Simplify the logical expression.
virtual std::shared_ptr< Expr > guessVar(std::string var, bool val)=0
Make a guess for a variable's value and return the resulting expression.
virtual std::shared_ptr< Expr > distribute()=0
Distribute operations in the logical expression.
virtual std::pair< std::string, bool > unitClause()=0
Get a unit clause from the logical expression.
virtual std::string to_string()=0
Convert the logical expression to a string representation.
virtual std::pair< bool, std::string > freeVar()=0
Identify and return free variables in the logical expression.
virtual std::unordered_set< std::string > literals()=0
Get the literals present in the logical expression.
OpCode opcode
Definition: sat.h:30
virtual std::shared_ptr< Expr > getRight()=0
Get the right child expression.
virtual bool evaluate()=0
Evaluate the logical expression.
std::string name
Definition: sat.h:31
virtual std::unordered_map< std::string, Polarity > literalPolarity(std::string var)=0
Get the polarities of literals with respect to a specific variable.
virtual ~Expr()
Destructor for the Expr class.
Definition: sat.h:36
Class representing the logical NOT operation.
Definition: sat.h:371
std::pair< bool, std::string > freeVar() override
Identify and return free variables in the logical expression.
Definition: sat.h:388
Not(std::shared_ptr< Expr > expr)
Constructor for the Not class.
Definition: sat.h:377
std::shared_ptr< Expr > getRight() override
Get the right child expression.
Definition: sat.h:397
std::pair< std::string, bool > unitClause() override
Get a unit clause from the logical expression.
Definition: sat.h:414
std::string to_string() override
Convert the logical expression to a string representation.
Definition: sat.h:382
std::shared_ptr< Expr > guessVar(std::string var, bool val) override
Make a guess for a variable's value and return the resulting expression.
Definition: sat.h:502
std::shared_ptr< Expr > distribute() override
Distribute operations in the logical expression.
Definition: sat.h:390
std::shared_ptr< Expr > simplify() override
Simplify the logical expression.
Definition: sat.h:548
bool unConst() override
Check if the logical expression can be simplified by removing constants.
Definition: sat.h:394
std::unordered_set< std::string > literals() override
Get the literals present in the logical expression.
Definition: sat.h:401
std::unordered_map< std::string, Polarity > literalPolarity(std::string var) override
Get the polarities of literals with respect to a specific variable.
Definition: sat.h:405
std::shared_ptr< Expr > getLeft() override
Get the left child expression.
Definition: sat.h:396
std::shared_ptr< Expr > expr
Definition: sat.h:430
std::vector< std::shared_ptr< Expr > > clauses() override
Get a vector of clauses present in the logical expression.
Definition: sat.h:421
std::shared_ptr< Expr > fixNegations() override
Fix negations in the logical expression.
Definition: sat.h:560
bool evaluate() override
Evaluate the logical expression.
Definition: sat.h:386
Class representing the logical OR operation.
Definition: sat.h:268
std::shared_ptr< Expr > distribute() override
Distribute operations in the logical expression.
Definition: sat.h:302
std::shared_ptr< Expr > left
Definition: sat.h:364
std::pair< std::string, bool > unitClause() override
Get a unit clause from the logical expression.
Definition: sat.h:354
std::string to_string() override
Convert the logical expression to a string representation.
Definition: sat.h:281
std::shared_ptr< Expr > right
Definition: sat.h:364
std::vector< std::shared_ptr< Expr > > clauses() override
Get a vector of clauses present in the logical expression.
Definition: sat.h:356
std::shared_ptr< Expr > simplify() override
Simplify the logical expression.
Definition: sat.h:529
std::pair< bool, std::string > freeVar() override
Identify and return free variables in the logical expression.
Definition: sat.h:287
std::unordered_map< std::string, Polarity > literalPolarity(std::string var) override
Get the polarities of literals with respect to a specific variable.
Definition: sat.h:330
std::shared_ptr< Expr > guessVar(std::string var, bool val) override
Make a guess for a variable's value and return the resulting expression.
Definition: sat.h:497
bool unConst() override
Check if the logical expression can be simplified by removing constants.
Definition: sat.h:295
Or(std::shared_ptr< Expr > left, std::shared_ptr< Expr > right)
Constructor for the Or class.
Definition: sat.h:275
bool evaluate() override
Evaluate the logical expression.
Definition: sat.h:285
std::shared_ptr< Expr > fixNegations() override
Fix negations in the logical expression.
Definition: sat.h:297
std::shared_ptr< Expr > getRight() override
Get the right child expression.
Definition: sat.h:321
std::shared_ptr< Expr > getLeft() override
Get the left child expression.
Definition: sat.h:319
std::unordered_set< std::string > literals() override
Get the literals present in the logical expression.
Definition: sat.h:323
Class representing a variable in a logical expression.
Definition: sat.h:136
std::vector< std::shared_ptr< Expr > > clauses() override
Get a vector of clauses present in the logical expression.
Definition: sat.h:166
Var(std::string name)
Definition: sat.h:140
std::shared_ptr< Expr > guessVar(std::string var, bool val) override
Make a guess for a variable's value and return the resulting expression.
Definition: sat.h:484
std::string name
Definition: sat.h:137
std::unordered_map< std::string, Polarity > literalPolarity(std::string var) override
Get the polarities of literals with respect to a specific variable.
Definition: sat.h:156
std::shared_ptr< Expr > getRight() override
Get the right child expression.
Definition: sat.h:151
bool unConst() override
Check if the logical expression can be simplified by removing constants.
Definition: sat.h:145
std::unordered_set< std::string > literals() override
Get the literals present in the logical expression.
Definition: sat.h:155
std::shared_ptr< Expr > distribute() override
Distribute operations in the logical expression.
Definition: sat.h:149
std::pair< bool, std::string > freeVar() override
Identify and return free variables in the logical expression.
Definition: sat.h:142
std::pair< std::string, bool > unitClause() override
Get a unit clause from the logical expression.
Definition: sat.h:165
std::string to_string() override
Convert the logical expression to a string representation.
Definition: sat.h:141
std::shared_ptr< Expr > getLeft() override
Get the left child expression.
Definition: sat.h:150
std::shared_ptr< Expr > simplify() override
Simplify the logical expression.
Definition: sat.h:143
std::shared_ptr< Expr > fixNegations() override
Fix negations in the logical expression.
Definition: sat.h:148
bool evaluate() override
Evaluate the logical expression.
Definition: sat.h:144
Node * expr(Token *&token, char *user_input)
Parses an expression from a C-like language program.
Definition: parser.h:210
std::shared_ptr< Expr > sym2expr(gymbo::Sym *sym, std::unordered_map< std::string, gymbo::Sym * > &unique_sym_map)
Convert a symbolic expression to a logical expression.
Definition: sat.h:735
bool satisfiableDPLL(std::shared_ptr< Expr > expr, std::unordered_map< std::string, bool > &assignments_map)
Check satisfiability of a logical expression using the DPLL algorithm.
Definition: sat.h:685
std::shared_ptr< Expr > literalElimination(std::shared_ptr< Expr > expr, std::unordered_map< std::string, bool > &assignments_map)
Eliminate literals in a logical expression based on assignments.
Definition: sat.h:604
std::vector< std::pair< std::string, bool > > allUnitClauses(std::shared_ptr< Expr > expr)
Extract all unit clauses from a logical expression.
Definition: sat.h:641
OpCode
Enum representing different logical operation codes.
Definition: sat.h:17
@ VAR
Definition: sat.h:17
@ CONST
Definition: sat.h:17
@ NOT
Definition: sat.h:17
@ AND
Definition: sat.h:17
std::shared_ptr< Expr > pathconstraints2expr(std::vector< gymbo::Sym > &constraints, std::unordered_map< std::string, gymbo::Sym * > &unique_sym_map)
Convert a vector of symbolic path constraints to a logical expression.
Definition: sat.h:765
std::shared_ptr< Expr > unitPropagation(std::shared_ptr< Expr > expr, std::unordered_map< std::string, bool > &assignments_map)
Perform unit propagation on a logical expression based on assignments.
Definition: sat.h:660
Polarity
Enum representing different polarities in logical expressions.
Definition: sat.h:22
@ Positive
Definition: sat.h:22
@ Mixed
Definition: sat.h:22
@ Negative
Definition: sat.h:22
std::shared_ptr< Expr > cnf(std::shared_ptr< Expr > expr)
Convert a logical expression to conjunctive normal form (CNF).
Definition: sat.h:589
Struct representing a symbolic expression.
Definition: type.h:265
Sym * right
Definition: type.h:268
SymType symtype
Definition: type.h:266
Sym * left
Definition: type.h:267
std::string toString(bool convert_to_num) const
Converts the symbolic expression to a string representation.
Definition: type.h:694
Implementatations of basic alias, types, and classes.