示例#1
0
    Equivalence(
        Conjunction([Variable('a'), Negation(Variable('b'))]),
        Disjunction([Variable('a'),
                     Implication(Variable('b'), Variable('a'))])),
    '((a&-b)<->(a|(b->a)))', [
        (valuations2[0], False),
        (valuations2[1], True),
        (valuations2[2], True),
        (valuations2[3], False),
    ])

print("Testing Negation.originalFormula")
a = Variable('a')
na = Negation(a)
nna = Negation(na)
t.compare(nna.originalFormula(), na, "Negation.originalFormula")

print("Testing Implication rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Implication(na, b)
t.compare(nab.leftSide(), na, "Implication.leftSide")
t.compare(nab.rightSide(), b, "Implication.rightSide")

print("Testing Equivalence rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Equivalence(na, b)
t.compare(nab.leftSide(), na, "Equivalence.leftSide")
示例#2
0
c = Variable('c')
d = Variable('a')
conj = Conjunction([a, b, c, d])
t.compare(conj.subf(), [a, b, c, d], "subf Conj3")

print("Testing Variable.name")
a = Variable('a')
b = Variable('b')
t.compare(a.name(), 'a', "Variable.name")
t.compare(b.name(), 'b', "Variable.name")

print("Testing Negation.originalFormula")
a = Variable('a')
na = Negation(a)
nna = Negation(na)
t.compare(nna.originalFormula() is na, True, "Negation.originalFormula")

print("Testing Implication rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Implication(na, b)
t.compare(nab.leftSide() is na, True, "Implication.leftSide")
t.compare(nab.rightSide() is b, True, "Implication.rightSide")

print("Testing Equivalence rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Equivalence(na, b)
t.compare(nab.leftSide() is na, True, "Equivalence.leftSide")
示例#3
0
            ])
        ),
        '((a&-b)<=>(a|(b=>a)))',
        [
            (interps2[0], False),
            (interps2[1], True),
            (interps2[2], True),
            (interps2[3], False),
        ])


print("Testing Negation.originalFormula")
a = Variable('a')
na = Negation(a)
nna = Negation(na)
t.compare(nna.originalFormula(), na, "Negation.originalFormula")

print("Testing Implication rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Implication(na, b)
t.compare(nab.leftSide(), na, "Implication.leftSide")
t.compare(nab.rightSide(), b, "Implication.rightSide")

print("Testing Equivalence rightSide / leftSide")
a = Variable('a')
b = Variable('b')
na = Negation(a)
nab = Equivalence(na, b)
t.compare(nab.leftSide(), na, "Equivalence.leftSide")