def test_not_closing_1(self):
        # A
        expr = Atom("A")

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertFalse(builder.is_closed())
    def test_closing_3(self):
        # !A -> (A -> B)
        expr = Impl(Not(Atom("A")), Impl(Atom("A"), Atom("B")))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertTrue(builder.is_closed())
    def test_closing_1(self):
        # A | !A
        expr = Or(Atom("A"), Not(Atom("A")))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertTrue(builder.is_closed())
    def test_not_closing_4(self):
        # A&B | !A&B
        expr = Or(And(Atom("A"), Atom("B")), And(Not(Atom("A")), Atom("B")))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertFalse(builder.is_closed())
    def test_closing_7(self):
        # !!A <-> A
        expr = Eq(Not(Not(Atom("A"))), Atom("A"))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertTrue(builder.is_closed())
    def test_closing_4(self):
        # A -> (B -> C) <-> A&B -> C
        expr = Eq(Impl(Atom("A"), Impl(Atom("B"), Atom("C"))),
                  Impl(And(Atom("A"), Atom("B")), Atom("C")))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertTrue(builder.is_closed())
    def test_closing_11(self):
        # !(!A&!B) <-> A|B
        expr = Eq(Not(And(Not(Atom("A")), Not(Atom("B")))),
                  Or(Atom("A"), Atom("B")))

        builder = PropositionalTableauxBuilder(false_exprs=[expr])
        builder.auto_resolve()

        self.assertTrue(builder.is_closed())
Example #8
0
    def get_drawing_calculator(self, true_exprs, false_exprs):
        painter_mock = MagicMock()
        tableaux_builder = PropositionalTableauxBuilder(
            true_exprs=true_exprs,
            false_exprs=false_exprs,
            visit_idx=len(true_exprs) + len(false_exprs))
        tableaux_builder.auto_resolve()

        return DrawingCalculator(tableaux_builder, painter_mock, False, False,
                                 10)