def test_simple_prop_cnf_has_same_truth_table(): pq = Proposition('''p -> q''') pq_cnf = Proposition(str(cnf(expressify(pq)))) assert same_truth_table(pq, pq_cnf)
def test_complex_prop_cnf_has_same_truth_table(): pqrst = Proposition('''((p v q) -> (r -> s)) <-> ~t''') pqrst_cnf = Proposition(str(cnf(expressify(pqrst)))) assert same_truth_table(pqrst, pqrst_cnf)
def test_absorption(): assert same_truth_table(Proposition('''p -> q'''), Proposition('''p -> (p & q)'''))
def test_contraposition_theorem(): assert same_truth_table(Proposition('''(p -> q)'''), Proposition('''(~q -> ~p)'''))
def test_implication_distribution(): assert same_truth_table(Proposition('''p -> (q -> r)'''), Proposition('''(p -> q) -> (p -> r)'''))