Пример #1
0
    #    # print clauses
    # print
    # z3_formula = clauses_to_z3(clauses)
    # print z3_formula
    # print
    # print

    # f = clauses_to_z3(ivy_logic.to_clauses("[[p()],[~p()]]"))
    # s = z3.Solver()
    # s.add(f)
    # print s.check() # should be unsat

    # f1 = clauses_to_z3(ivy_logic.to_clauses("[[p()]]"))
    # f2 = clauses_to_z3(ivy_logic.to_clauses("[[~p()]]"))
    # s = z3.Solver()
    # s.add(f1)
    # s.add(f2)
    # print s.check() # this is also unsat

    # ivy_logic.add_symbol('p',ivy_logic.RelationSort([ivy_logic.universe]))
    # cls = to_clauses("p(x) & ~p(y)")
    # print clauses_model_to_clauses(cls)

    s = ivy_logic.EnumeratedSort(["a", "b", "c"])
    for c in s.defines():
        t = add_symbol(c, s)
        ivy_logic.sig.constructors.add(t)
    add_symbol('f', ivy_logic.FunctionSort([ivy_logic.universe], s))
    cls = to_clauses("f(x) = a & f(y) = b")
    print clauses_model_to_clauses(cls)
Пример #2
0
    #    # print clauses
    # print
    # z3_formula = clauses_to_z3(clauses)
    # print z3_formula
    # print
    # print

    # f = clauses_to_z3(ivy_logic.to_clauses("[[p()],[~p()]]"))
    # s = z3.Solver()
    # s.add(f)
    # print s.check() # should be unsat

    # f1 = clauses_to_z3(ivy_logic.to_clauses("[[p()]]"))
    # f2 = clauses_to_z3(ivy_logic.to_clauses("[[~p()]]"))
    # s = z3.Solver()
    # s.add(f1)
    # s.add(f2)
    # print s.check() # this is also unsat

    # ivy_logic.add_symbol('p',ivy_logic.RelationSort([ivy_logic.universe]))
    # cls = to_clauses("p(x) & ~p(y)")
    # print clauses_model_to_clauses(cls)

    s = ivy_logic.EnumeratedSort(["a", "b", "c"])
    for c in s.defines():
        t = add_symbol(c, s)
        ivy_logic.sig.constructors.add(t)
    add_symbol("f", ivy_logic.FunctionSort([ivy_logic.universe], s))
    cls = to_clauses("f(x) = a & f(y) = b")
    print clauses_model_to_clauses(cls)