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)
Exemple #3
0
def test_absorption():
    assert same_truth_table(Proposition('''p -> q'''),
                            Proposition('''p -> (p & q)'''))
Exemple #4
0
def test_contraposition_theorem():
    assert same_truth_table(Proposition('''(p -> q)'''),
                            Proposition('''(~q -> ~p)'''))
Exemple #5
0
def test_implication_distribution():
    assert same_truth_table(Proposition('''p -> (q -> r)'''),
                            Proposition('''(p -> q) -> (p -> r)'''))