Beispiel #1
0
def test_or_commutative():
    assert (L("x") | L("y") | L("z")) == (L("z") | L("y") | L("x"))
Beispiel #2
0
def test_negated_substitute_or():
    (~L("x")).substitute("x", L("y") | L("z")) == ((~L("y")) & (~L("z")))
Beispiel #3
0
def test_formula_substitue_disjuntion_into_conjunction():
    assert (L("a") & L("b")).substitute("a",
                                        L("c") | L("d")) == (L("b") &
                                                             (L("d") | L("c")))
def test_is_boolean_formula_with_formula():
    assert is_boolean_formula(L("a") & L("b")) is True
def test_or():
    assert (L("a") | L("b") | L("c") | L("d")) == or_("a", "b", "c", "d")
Beispiel #6
0
def test_literal_xored_with_self():
    assert ((L("x") ^ L("x")) is False)
Beispiel #7
0
def test_xor_is_associative():
    assert (L("x") ^ L("y")) == (L("y") ^ L("x"))
Beispiel #8
0
def test_true_and_literal():
    assert (True & L("x")) == L("x") and (L("x") & True) == L("x")
Beispiel #9
0
def test_true_or_literal():
    assert ((True | L("x")) is True) and ((L("x") | True) is True)
Beispiel #10
0
def test_de_morgan_negation_of_disjunction():
    assert (~(L("x") | L("y"))) == ((~L("x")) & (~L("y")))
Beispiel #11
0
def double_negation():
    assert (~(~L("x"))) == L("x")
Beispiel #12
0
def test_de_morgan_negation_of_conjunction():
    assert (~(L("x") & L("y"))) == ((~L("x")) | (~L("y")))
Beispiel #13
0
def test_reflexive():
    assert L("x") == L("x")
Beispiel #14
0
def test_conjunction_over_disjunction():
    assert (L("x") & (L("y") | L("z"))) == ((L("x") & L("y")) |
                                            (L("x") & L("z")))
Beispiel #15
0
def test_substitute_true_into_disjuction():
    assert ((L("x") | L("y")).substitute("x", True)) is True
Beispiel #16
0
def test_false_and_literal():
    assert ((False & L("x")) is False) and ((L("x") & False) is False)
Beispiel #17
0
def test_substitute_false_into_conjunction():
    assert ((L("x") & L("y")).substitute("x", False) is False)
Beispiel #18
0
def test_false_or_literal():
    assert (False | L("x")) == L("x") and (L("x") | False) == L("x")
Beispiel #19
0
def test_literal_xored_with_negated_self():
    assert ((L("x") ^ ~L("x")) is True)
Beispiel #20
0
def test_true_and_formula():
    f = L("x") & L("y")
    assert (True & f) == f and (f & True) == f
def test_is_boolean_formula_with_literal():
    assert is_boolean_formula(L("a")) is True
Beispiel #22
0
def test_true_or_formula():
    f = L("x") | L("y")
    assert ((True | f) is True) and ((f | True) is True)
def test_and():
    assert (L("a") & L("b") & L("c") & L("d")) == and_("a", "b", "c", "d")
Beispiel #24
0
def test_conjunction_with_negation():
    assert ((L("x") & (~L("x"))) is False)
Beispiel #25
0
def test_substitute_or():
    L("x").substitute("x", L("y") | L("z")) == (L("y") | L("z"))
Beispiel #26
0
def test_false_and_formula():
    f = L("x") & L("y")
    assert ((False & f) is False) and ((f & False) is False)
Beispiel #27
0
def test_substitute_and():
    L("x").substitute("x", L("y") & L("z")) == (L("y") & L("z"))
Beispiel #28
0
def test_false_or_formula():
    f = L("x") | L("y")
    assert (False | f) == f and (f | False) == f
Beispiel #29
0
def test_negated_substitute_and():
    (~L("x")).substitute("x", L("y") & L("z")) == ((~L("y")) | (~L("z")))
Beispiel #30
0
def test_and_commutative():
    assert (L("x") & L("y") & L("z")) == (L("z") & L("y") & L("x"))