Beispiel #1
0
    def test_currect_unification(self):
        f3 = Function("f", [Variable("X"), Variable("Z")])
        f2 = Function("f", [Variable("X"), Function("g")])
        f1 = Function("f", [Function("h"), Variable("Z")])
        liste = [f1, f2, f3]
        sigma = u.multiple_robinson(liste)

        self.assertEqual(len(sigma), 2)
Beispiel #2
0
    def test_currect_unification(self):
        f3 = Function("f",[Variable("X"), Variable("Z")])
        f2 = Function("f",[Variable("X"), Function("g")])
        f1 = Function("f",[Function("h"), Variable("Z")])
        liste = [f1, f2, f3]
        sigma = u.multiple_robinson(liste)

        self.assertEqual(len(sigma),2)
Beispiel #3
0
def proof(formulas):
    print(type(formulas[0]))
    disjunctions = [Disjunction([x]) for x in formulas]
    unsplitted = Conjunction(disjunctions)
    splitted = Conjunction([])

    while len(unsplitted) > 0:

        disj = unsplitted.pop()

        if all([
                type(x) == f.Relation or type(x.negate()) == f.Relation
                for x in disj
        ]):
            splitted.add(disj)

        [unsplitted.add(x) for x in split_any(disj)]

    # Phase 2
    knf = splitted

    iterations = 30

    print("atomics", knf)

    for i in range(iterations):

        resolvents = resolute_all(deepcopy(knf))

        for disj in resolvents:

            # apply factoring rule (slide 54)
            sigma = u.multiple_robinson(disj)

            if sigma != None:
                disj = Disjunction([s_wrapper(x, sigma) for x in disj])

            if len(disj) == 0:
                return True

            knf.add(disj)
        print("Iteration", i)
        print("Set", knf)
    return None