Пример #1
0
def test_or_commutative():
    assert (L("x") | L("y") | L("z")) == (L("z") | L("y") | L("x"))
Пример #2
0
def test_negated_substitute_or():
    (~L("x")).substitute("x", L("y") | L("z")) == ((~L("y")) & (~L("z")))
Пример #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")
Пример #6
0
def test_literal_xored_with_self():
    assert ((L("x") ^ L("x")) is False)
Пример #7
0
def test_xor_is_associative():
    assert (L("x") ^ L("y")) == (L("y") ^ L("x"))
Пример #8
0
def test_true_and_literal():
    assert (True & L("x")) == L("x") and (L("x") & True) == L("x")
Пример #9
0
def test_true_or_literal():
    assert ((True | L("x")) is True) and ((L("x") | True) is True)
Пример #10
0
def test_de_morgan_negation_of_disjunction():
    assert (~(L("x") | L("y"))) == ((~L("x")) & (~L("y")))
Пример #11
0
def double_negation():
    assert (~(~L("x"))) == L("x")
Пример #12
0
def test_de_morgan_negation_of_conjunction():
    assert (~(L("x") & L("y"))) == ((~L("x")) | (~L("y")))
Пример #13
0
def test_reflexive():
    assert L("x") == L("x")
Пример #14
0
def test_conjunction_over_disjunction():
    assert (L("x") & (L("y") | L("z"))) == ((L("x") & L("y")) |
                                            (L("x") & L("z")))
Пример #15
0
def test_substitute_true_into_disjuction():
    assert ((L("x") | L("y")).substitute("x", True)) is True
Пример #16
0
def test_false_and_literal():
    assert ((False & L("x")) is False) and ((L("x") & False) is False)
Пример #17
0
def test_substitute_false_into_conjunction():
    assert ((L("x") & L("y")).substitute("x", False) is False)
Пример #18
0
def test_false_or_literal():
    assert (False | L("x")) == L("x") and (L("x") | False) == L("x")
Пример #19
0
def test_literal_xored_with_negated_self():
    assert ((L("x") ^ ~L("x")) is True)
Пример #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
Пример #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")
Пример #24
0
def test_conjunction_with_negation():
    assert ((L("x") & (~L("x"))) is False)
Пример #25
0
def test_substitute_or():
    L("x").substitute("x", L("y") | L("z")) == (L("y") | L("z"))
Пример #26
0
def test_false_and_formula():
    f = L("x") & L("y")
    assert ((False & f) is False) and ((f & False) is False)
Пример #27
0
def test_substitute_and():
    L("x").substitute("x", L("y") & L("z")) == (L("y") & L("z"))
Пример #28
0
def test_false_or_formula():
    f = L("x") | L("y")
    assert (False | f) == f and (f | False) == f
Пример #29
0
def test_negated_substitute_and():
    (~L("x")).substitute("x", L("y") & L("z")) == ((~L("y")) | (~L("z")))
Пример #30
0
def test_and_commutative():
    assert (L("x") & L("y") & L("z")) == (L("z") & L("y") & L("x"))