def testWrappedFormula(self):
        """
        Test basic parsing and output of wrapped formulae.
        """
        lex = Lexer(self.wformulas)
        f1 = parseWFormula(lex)
        print(f1)
        f2 = parseWFormula(lex)
        print(f2)
        f3 = parseWFormula(lex)
        print(f3)
        f4 = parseWFormula(lex)
        print(f4)
        toggleDerivationOutput()
        print(f1)
        print(f2)
        print(f3)
        print(f4)
        toggleDerivationOutput()

        sig = f1.collectSig()
        f2.collectSig(sig)
        f3.collectSig(sig)
        f4.collectSig(sig)

        print(sig)
        sig.isPred("q")
        sig.isPred("r")
        sig.isFun("a")
        sig.isConstant("a")
Esempio n. 2
0
    def testClausification(self):
        """
        Test conversion of wrapped formulas into lists of clauses.
        """
        lex = Lexer(self.testformulas)

        while not lex.TestTok(Token.EOFToken):
            wf = parseWFormula(lex)
            clauses = wFormulaClausify(wf)
            enableDerivationOutput()
            print("==================")
            for c in clauses:
                print(c)
            toggleDerivationOutput()
Esempio n. 3
0
    def testCNFization(self):
        """
        Test conversion of wrapped formulas into conjunctive normal
        form.
        """
        lex = Lexer(self.testformulas)

        while not lex.TestTok(Token.EOFToken):
            wf = parseWFormula(lex)
            wf = wFormulaCNF(wf)
            enableDerivationOutput()
            self.assertTrue(wf.formula.isCNF())
            deriv = wf.orderedDerivation()
            print("==================")
            for s in deriv:
                print(s)
            toggleDerivationOutput()