LogiXpr
Loading...
Searching...
No Matches
solver.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "equivLaws.h"
9#include "expression.h"
10#include <queue>
11#include <utility>
12#include <vector>
13#include <algorithm>
14
24extern std::unordered_map<EquivLaws::EquivLaw, std::string> equivalences;
25
29extern int MAX_QUEUE_SIZE;
30
34extern int MAX_EXPRESSION_LENGTH;
35
40void preprocess(std::shared_ptr<Expression> lhs, std::shared_ptr<Expression> rhs);
41
55std::vector<std::vector<std::string>> proveEquivalence(std::shared_ptr<Expression> lhs, std::shared_ptr<Expression> rhs);
56
75void generateNextSteps(std::shared_ptr<Expression> expr, std::shared_ptr<Expression> end, bool &found, std::queue<std::shared_ptr<Expression>> &queue, std::unordered_map<std::string, std::pair<std::string, std::string>> &visited);
Header file for equivalence laws class.
Header file for expression class.
int MAX_EXPRESSION_LENGTH
Maximum length of the expressions in the queue.
Definition solver.cpp:11
void generateNextSteps(std::shared_ptr< Expression > expr, std::shared_ptr< Expression > end, bool &found, std::queue< std::shared_ptr< Expression > > &queue, std::unordered_map< std::string, std::pair< std::string, std::string > > &visited)
Generate the next expressions from the current expression. Creates a new expression for each law that...
Definition solver.cpp:78
std::vector< std::vector< std::string > > proveEquivalence(std::shared_ptr< Expression > lhs, std::shared_ptr< Expression > rhs)
Prove the expressions are equivalence using equivalence laws by solving the left hand side to the rig...
Definition solver.cpp:34
std::unordered_map< EquivLaws::EquivLaw, std::string > equivalences
Map of equivalences to be applied to the expressions.
Definition solver.cpp:8
int MAX_QUEUE_SIZE
Maximum size of the queue of expressions to be processed.
Definition solver.cpp:10
void preprocess(std::shared_ptr< Expression > lhs, std::shared_ptr< Expression > rhs)
Fill the map of equivalences to be applied to the expressions. Must be called before any other functi...
Definition solver.cpp:13