Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 16 / LogicExpressions / Source.cpp
blob: af86b62f0a4acd5ddaede06287efea5828e2c425 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "LogicExpressions/LogicExpr.h"

using namespace LogicExpressions;

// or |, and ^, negation !, implies >, iff -
int main()
{
	LogicExpr* expr = new Operation(new Var('p'), '|', new Negation(new Var('p'))); // p | !p
	expr->print();
	cout << " " << isTautology(expr, { 'p' }) << endl;

	LogicExpr* expr2 = new Operation(new Var('q'),'^',new Operation(new Var('p'), '^', new Negation(new Var('p')))); // q ^ (p ^ !p)
	expr2->print();
	cout << " " << isContradiction(expr2, { 'p', 'q' }) << endl;
}