Beispiel #1
0
    def test_misc(self):
        a, b = self.a, self.b
        i_, i_a, i_b, i_ab = self.i_, self.i_a, self.i_b, self.i_ab

        material_implication = PLEquivalence(
            [PLOr([PLNot(a), b]), PLNot(PLAnd([a, PLNot(b)])), PLImplies([a, b])]
        )

        # the equivalence is valid (i.e. satisfied for every interpretation)
        assert material_implication.truth(i_)
        assert material_implication.truth(i_a)
        assert material_implication.truth(i_b)
        assert material_implication.truth(i_ab)

        a_and_false_and_true = PLAnd([a, PLFalse(), PLTrue()])
        assert not a_and_false_and_true.truth(i_)
        assert not a_and_false_and_true.truth(i_a)
        assert not a_and_false_and_true.truth(i_b)
        assert not a_and_false_and_true.truth(i_ab)

        a_or_false_or_true = PLOr([a, PLFalse(), PLTrue()])
        assert a_or_false_or_true.truth(i_)
        assert a_or_false_or_true.truth(i_a)
        assert a_or_false_or_true.truth(i_b)
        assert a_or_false_or_true.truth(i_ab)
Beispiel #2
0
    def test_and(self):
        a, b = self.a, self.b
        i_, i_a, i_b, i_ab = self.i_, self.i_a, self.i_b, self.i_ab

        a_and_b = PLAnd([a, b])
        assert not a_and_b.truth(i_)
        assert not a_and_b.truth(i_a)
        assert not a_and_b.truth(i_b)
        assert a_and_b.truth(i_ab)

        not_a_and_not_b = PLAnd([PLNot(a), PLNot(b)])
        assert not_a_and_not_b.truth(i_)
        assert not not_a_and_not_b.truth(i_a)
        assert not not_a_and_not_b.truth(i_b)
        assert not not_a_and_not_b.truth(i_ab)