LogiXpr
|
Class that handles equivalence laws. More...
#include <equivLaws.h>
Public Types | |
typedef bool(* | EquivLaw) (std::shared_ptr< Expression > &) |
Function pointer type for an equivalence law. | |
Static Public Member Functions | |
static void | replace (std::shared_ptr< Expression > &expression, std::shared_ptr< Expression > newExpression) |
Replace the current expression with the new expression. | |
static bool | identity (std::shared_ptr< Expression > &expression) |
Applies the identity law (p & T) = p, (p | F) = p. | |
static bool | domination (std::shared_ptr< Expression > &expression) |
Applies the domination law (p | T) = T, (p & F) = F. | |
static bool | idempotent (std::shared_ptr< Expression > &expression) |
Applies the idempotent law (p | p) = p, (p & p) = p. | |
static bool | doubleNegation (std::shared_ptr< Expression > &expression) |
Applies the double negation law !!p = p. | |
static bool | commutative (std::shared_ptr< Expression > &expression) |
Applies the commutative law (p | q) = (q | p), (p & q) = (q & p) | |
static bool | associative (std::shared_ptr< Expression > &expression) |
Applies the associative law (p | q) | r = p | (q | r), (p & q) & r = p & (q & r) | |
static bool | associativeReversed (std::shared_ptr< Expression > &expression) |
Applies associative() but reversed p | (q | r) = (p | q) | r, p & (q & r) = (p & q) & r. | |
static bool | distributive (std::shared_ptr< Expression > &expression) |
Applies distributive law p | (q & r) = (p | q) & (p | r), p & (q | r) = (p & q) | (p & r) | |
static bool | distributiveReversed (std::shared_ptr< Expression > &expression) |
Applies distributive() but reversed (p | q) & (p | r) = p | (q & r), (p & q) | (p & r) = p & (q | r) | |
static bool | deMorgan (std::shared_ptr< Expression > &expression) |
Applies De Morgan's law !(p | q) = !p & !q, !(p & q) = !p | !q. | |
static bool | deMorganReversed (std::shared_ptr< Expression > &expression) |
Applies deMorgan() but reversed !p & !q = !(p | q), !p | !q = !(p & q) | |
static bool | absorption (std::shared_ptr< Expression > &expression) |
Applies the absorption law p | (p & q) = p, p & (p | q) = p. | |
static bool | negation (std::shared_ptr< Expression > &expression) |
Applies the negation law p | !p = T, p & !p = F. | |
static bool | implication0 (std::shared_ptr< Expression > &expression) |
Applies implication: p -> q = !p | q. | |
static bool | implication0Reversed (std::shared_ptr< Expression > &expression) |
Applies implication0() but reversed !p | q = p -> q. | |
static bool | implication1 (std::shared_ptr< Expression > &expression) |
Applies implication: p -> q = !q -> !p. | |
static bool | implication1Reversed (std::shared_ptr< Expression > &expression) |
Applies implication1() but reversed !q -> !p = p -> q. | |
static bool | implication2 (std::shared_ptr< Expression > &expression) |
Applies implication: p | q = !p -> q. | |
static bool | implication2Reversed (std::shared_ptr< Expression > &expression) |
Applies implication2() but reversed !p -> q = p | q. | |
static bool | implication3 (std::shared_ptr< Expression > &expression) |
Applies implication: p & q = !(p -> !q) | |
static bool | implication3Reversed (std::shared_ptr< Expression > &expression) |
Applies implication3() but reversed !(p -> !q) = p & q. | |
static bool | implication4 (std::shared_ptr< Expression > &expression) |
Applies implication: !(p -> q) = p & !q. | |
static bool | implication4Reversed (std::shared_ptr< Expression > &expression) |
Applies implication4() but reversed p & !q = !(p -> q) | |
static bool | implication5 (std::shared_ptr< Expression > &expression) |
Applies implication: (p -> q) & (p -> r) = p -> (q & r) | |
static bool | implication5Reversed (std::shared_ptr< Expression > &expression) |
Applies implication5() but reversed p -> (q & r) = (p -> q) & (p -> r) | |
static bool | implication6 (std::shared_ptr< Expression > &expression) |
Applies implication: (p -> q) & (q -> r) = (p | q) -> r. | |
static bool | implication6Reversed (std::shared_ptr< Expression > &expression) |
Applies implication6() but reversed (p | q) -> r = (p -> q) & (q -> r) | |
static bool | implication7 (std::shared_ptr< Expression > &expression) |
Applies implication: (p -> q) | (p -> r) = p -> (q | r) | |
static bool | implication7Reversed (std::shared_ptr< Expression > &expression) |
Applies implication7() but reversed p -> (q | r) = (p -> q) | (p -> r) | |
static bool | implication8 (std::shared_ptr< Expression > &expression) |
Applies implication: (p -> q) | (q -> r) = (p & q) -> r. | |
static bool | implication8Reversed (std::shared_ptr< Expression > &expression) |
Applies implication8() but reversed (p & q) -> r = (p -> q) | (q -> r) | |
static bool | bidirectionalImplication0 (std::shared_ptr< Expression > &expression) |
Applies bidirectional implication: p <-> q = (p -> q) & (q -> p) | |
static bool | bidirectionalImplication0Reversed (std::shared_ptr< Expression > &expression) |
Applies bidirectionalImplication0() but reversed (p -> q) & (q -> p) = p <-> q. | |
static bool | bidirectionalImplication1 (std::shared_ptr< Expression > &expression) |
Applies bidirectional implication: p <-> q = q <-> p. | |
static bool | bidirectionalImplication2 (std::shared_ptr< Expression > &expression) |
Applies bidirectional implication: p <-> q = !p <-> !q. | |
static bool | bidirectionalImplication2Reversed (std::shared_ptr< Expression > &expression) |
Applies bidirectionalImplication2() but reversed !p <-> !q = p <-> q. | |
static bool | bidirectionalImplication3 (std::shared_ptr< Expression > &expression) |
Applies bidirectional implication: p <-> q = (p & q) | (!p & !q) | |
static bool | bidirectionalImplication3Reversed (std::shared_ptr< Expression > &expression) |
Applies bidirectionalImplication3() but reversed (p & q) | (!p & !q) = p <-> q. | |
static bool | bidirectionalImplication4 (std::shared_ptr< Expression > &expression) |
Applies bidirectional implication: !(p <-> q) = p <-> !q. | |
static bool | bidirectionalImplication4Reversed (std::shared_ptr< Expression > &expression) |
Applies bidirectionalImplication4() but reversed p <-> !q = !(p <-> q) | |
Static Public Attributes | |
static std::unordered_map< EquivLaw, std::string > | laws |
Map of equivalence laws to their string representations. | |
static std::unordered_map< EquivLaw, std::string > | implications |
Map of implication equivalences to their string representations. | |
static std::unordered_map< EquivLaw, std::string > | bidirectionalImplications |
Map of biimplication equivalences to their string representations. | |
Class that handles equivalence laws.
Definition at line 15 of file equivLaws.h.
typedef bool(* EquivLaws::EquivLaw) (std::shared_ptr< Expression > &) |
Function pointer type for an equivalence law.
expr | the expression to apply the law to |
Definition at line 24 of file equivLaws.h.
|
static |
Applies the absorption law
p | (p & q) = p, p & (p | q) = p.
expression | pointer to the current expression |
Definition at line 408 of file equivLaws.cpp.
|
static |
Applies the associative law
(p | q) | r = p | (q | r), (p & q) & r = p & (q & r)
expression | pointer to the current expression |
Definition at line 190 of file equivLaws.cpp.
|
static |
Applies associative() but reversed
p | (q | r) = (p | q) | r, p & (q & r) = (p & q) & r.
expression | pointer to the current expression |
Definition at line 214 of file equivLaws.cpp.
|
static |
Applies bidirectional implication: p <-> q = (p -> q) & (q -> p)
expression | pointer to the current expression |
Definition at line 879 of file equivLaws.cpp.
|
static |
Applies bidirectionalImplication0() but reversed
(p -> q) & (q -> p) = p <-> q.
expression | pointer to the current expression |
Definition at line 903 of file equivLaws.cpp.
|
static |
Applies bidirectional implication: p <-> q = q <-> p.
expression | pointer to the current expression |
Definition at line 929 of file equivLaws.cpp.
|
static |
Applies bidirectional implication: p <-> q = !p <-> !q.
expression | pointer to the current expression |
Definition at line 949 of file equivLaws.cpp.
|
static |
Applies bidirectionalImplication2() but reversed
!p <-> !q = p <-> q.
expression | pointer to the current expression |
Definition at line 971 of file equivLaws.cpp.
|
static |
Applies bidirectional implication: p <-> q = (p & q) | (!p & !q)
expression | pointer to the current expression |
Definition at line 991 of file equivLaws.cpp.
|
static |
Applies bidirectionalImplication3() but reversed
(p & q) | (!p & !q) = p <-> q.
expression | pointer to the current expression |
Definition at line 1017 of file equivLaws.cpp.
|
static |
Applies bidirectional implication: !(p <-> q) = p <-> !q.
expression | pointer to the current expression |
Definition at line 1039 of file equivLaws.cpp.
|
static |
Applies bidirectionalImplication4() but reversed
p <-> !q = !(p <-> q)
expression | pointer to the current expression |
Definition at line 1060 of file equivLaws.cpp.
|
static |
Applies the commutative law
(p | q) = (q | p), (p & q) = (q & p)
expression | pointer to the current expression |
Definition at line 169 of file equivLaws.cpp.
|
static |
Applies De Morgan's law
!(p | q) = !p & !q, !(p & q) = !p | !q.
expression | pointer to the current expression |
Definition at line 331 of file equivLaws.cpp.
|
static |
Applies deMorgan() but reversed
!p & !q = !(p | q), !p | !q = !(p & q)
expression | pointer to the current expression |
Definition at line 372 of file equivLaws.cpp.
|
static |
Applies distributive law
p | (q & r) = (p | q) & (p | r), p & (q | r) = (p & q) | (p & r)
expression | pointer to the current expression |
Definition at line 237 of file equivLaws.cpp.
|
static |
Applies distributive() but reversed
(p | q) & (p | r) = p | (q & r), (p & q) | (p & r) = p & (q | r)
expression | pointer to the current expression |
Definition at line 281 of file equivLaws.cpp.
|
static |
Applies the domination law
(p | T) = T, (p & F) = F.
expression | pointer to the current expression |
Definition at line 103 of file equivLaws.cpp.
|
static |
Applies the double negation law
!!p = p.
expression | pointer to the current expression |
Definition at line 151 of file equivLaws.cpp.
|
static |
Applies the idempotent law
(p | p) = p, (p & p) = p.
expression | pointer to the current expression |
Definition at line 129 of file equivLaws.cpp.
|
static |
Applies the identity law
(p & T) = p, (p | F) = p.
expression | pointer to the current expression |
Definition at line 80 of file equivLaws.cpp.
|
static |
Applies implication: p -> q = !p | q.
expression | pointer to the current expression |
Definition at line 459 of file equivLaws.cpp.
|
static |
Applies implication0() but reversed
!p | q = p -> q.
expression | pointer to the current expression |
Definition at line 480 of file equivLaws.cpp.
|
static |
Applies implication: p -> q = !q -> !p.
expression | pointer to the current expression |
Definition at line 500 of file equivLaws.cpp.
|
static |
Applies implication1() but reversed
!q -> !p = p -> q.
expression | pointer to the current expression |
Definition at line 522 of file equivLaws.cpp.
|
static |
Applies implication: p | q = !p -> q.
expression | pointer to the current expression |
Definition at line 542 of file equivLaws.cpp.
|
static |
Applies implication2() but reversed
!p -> q = p | q.
expression | pointer to the current expression |
Definition at line 563 of file equivLaws.cpp.
|
static |
Applies implication: p & q = !(p -> !q)
expression | pointer to the current expression |
Definition at line 583 of file equivLaws.cpp.
|
static |
Applies implication3() but reversed
!(p -> !q) = p & q.
expression | pointer to the current expression |
Definition at line 605 of file equivLaws.cpp.
|
static |
Applies implication: !(p -> q) = p & !q.
expression | pointer to the current expression |
Definition at line 625 of file equivLaws.cpp.
|
static |
Applies implication4() but reversed
p & !q = !(p -> q)
expression | pointer to the current expression |
Definition at line 646 of file equivLaws.cpp.
|
static |
Applies implication: (p -> q) & (p -> r) = p -> (q & r)
expression | pointer to the current expression |
Definition at line 667 of file equivLaws.cpp.
|
static |
Applies implication5() but reversed
p -> (q & r) = (p -> q) & (p -> r)
expression | pointer to the current expression |
Definition at line 695 of file equivLaws.cpp.
|
static |
Applies implication: (p -> q) & (q -> r) = (p | q) -> r.
expression | pointer to the current expression |
Definition at line 720 of file equivLaws.cpp.
|
static |
Applies implication6() but reversed
(p | q) -> r = (p -> q) & (q -> r)
expression | pointer to the current expression |
Definition at line 748 of file equivLaws.cpp.
|
static |
Applies implication: (p -> q) | (p -> r) = p -> (q | r)
expression | pointer to the current expression |
Definition at line 773 of file equivLaws.cpp.
|
static |
Applies implication7() but reversed
p -> (q | r) = (p -> q) | (p -> r)
expression | pointer to the current expression |
Definition at line 801 of file equivLaws.cpp.
|
static |
Applies implication: (p -> q) | (q -> r) = (p & q) -> r.
expression | pointer to the current expression |
Definition at line 826 of file equivLaws.cpp.
|
static |
Applies implication8() but reversed
(p & q) -> r = (p -> q) | (q -> r)
expression | pointer to the current expression |
Definition at line 854 of file equivLaws.cpp.
|
static |
Applies the negation law
p | !p = T, p & !p = F.
expression | pointer to the current expression |
Definition at line 429 of file equivLaws.cpp.
|
static |
Replace the current expression with the new expression.
expression | pointer to original expression |
newExpression | pointer to expression to replace with |
Definition at line 58 of file equivLaws.cpp.
|
static |
Map of biimplication equivalences to their string representations.
Definition at line 46 of file equivLaws.h.
|
static |
Map of implication equivalences to their string representations.
Definition at line 24 of file equivLaws.h.
|
static |
Map of equivalence laws to their string representations.
Definition at line 8 of file equivLaws.h.