Ejemplo n.º 1
0
def make_skolems(fmla, ast, pol, univs):
    global macro_dep_map
    global strat_map
    if isinstance(fmla, il.Not):
        make_skolems(fmla.args[0], ast, not pol, univs)
    if isinstance(fmla, il.Implies):
        make_skolems(fmla.args[0], ast, not pol, univs)
        make_skolems(fmla.args[1], ast, pol, univs)
    is_e = il.is_exists(fmla)
    is_a = il.is_forall(fmla)
    if is_e and pol or is_a and not pol:
        fvs = set(il.free_variables(fmla))
        for u in univs:
            if u in fvs:
                for e in il.quantifier_vars(fmla):
                    macro_dep_map[e].add(strat_map[u])
    if is_e and not pol or is_a and pol:
        make_skolems(fmla.args[0], ast, pol,
                     univs + list(il.quantifier_vars(fmla)))
    for arg in fmla.args:
        make_skolems(arg, ast, pol, univs)
    if isinstance(fmla, il.Ite):
        make_skolems(fmla.args[0], ast, not pol, univs)
    if isinstance(fmla, il.Iff) or (il.is_eq(fmla)
                                    and il.is_boolean(fmla.args[0])):
        make_skolems(fmla.args[0], ast, not pol, univs)
        make_skolems(fmla.args[1], ast, not pol, univs)
Ejemplo n.º 2
0
def get_qa_arcs(fmla,ast,pol,univs,strat_map):
    if isinstance(fmla,il.Not):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        return
    if isinstance(fmla,il.Implies):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        for a in get_qa_arcs(fmla.args[1],ast,pol,univs,strat_map):
            yield a
        return
    is_e = il.is_exists(fmla)
    is_a = il.is_forall(fmla)
    if is_e and pol or is_a and not pol:
        fvs = set(il.free_variables(fmla))
        for u in univs:
            if u in fvs:
                for e in il.quantifier_vars(fmla):
                    yield (find(strat_map[u]),find(strat_map[e]),ast)
    if is_e and not pol or is_a and pol:
        for a in get_qa_arcs(fmla.args[0],ast,pol,univs+list(il.quantifier_vars(fmla)),strat_map):
            yield a
    for arg in fmla.args:
        for a in get_qa_arcs(arg,ast,pol,univs,strat_map):
            yield a
    if isinstance(fmla,il.Ite):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
    if isinstance(fmla,il.Iff) or (il.is_eq(fmla) and il.is_boolean(fmla.args[0])):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        for a in get_qa_arcs(fmla.args[1],ast,not pol,univs,strat_map):
            yield a
Ejemplo n.º 3
0
def get_qa_arcs(fmla,ast,pol,univs,strat_map):
    if isinstance(fmla,il.Not):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        return
    if isinstance(fmla,il.Implies):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        for a in get_qa_arcs(fmla.args[1],ast,pol,univs,strat_map):
            yield a
        return
    is_e = il.is_exists(fmla)
    is_a = il.is_forall(fmla)
    if is_e and pol or is_a and not pol:
        fvs = set(il.free_variables(fmla))
        for u in univs:
            if u in fvs:
                for e in il.quantifier_vars(fmla):
                    yield (find(strat_map[u]),find(strat_map[e]),ast)
    if is_e and not pol or is_a and pol:
        for a in get_qa_arcs(fmla.args[0],ast,pol,univs+list(il.quantifier_vars(fmla)),strat_map):
            yield a
    for arg in fmla.args:
        for a in get_qa_arcs(arg,ast,pol,univs,strat_map):
            yield a
    if isinstance(fmla,il.Ite):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
    if isinstance(fmla,il.Iff) or (il.is_eq(fmla) and il.is_boolean(fmla.args[0])):
        for a in get_qa_arcs(fmla.args[0],ast,not pol,univs,strat_map):
            yield a
        for a in get_qa_arcs(fmla.args[1],ast,not pol,univs,strat_map):
            yield a
Ejemplo n.º 4
0
def get_qa_arcs(fmla, ast, pol, univs):
    if isinstance(fmla, il.Not):
        for a in get_qa_arcs(fmla.args[0], ast, not pol, univs):
            yield a
        return
    is_e = il.is_exists(fmla)
    is_a = il.is_forall(fmla)
    if is_e and pol or is_a and not pol:
        fvs = set(il.free_variables(fmla))
        for u in univs:
            if u in fvs:
                for e in il.quantifier_vars(fmla):
                    yield (u.sort, e.sort, ast)
    if is_e and not pol or is_a and pol:
        for a in get_qa_arcs(fmla.args[0], ast, pol, univs + list(il.quantifier_vars(fmla))):
            yield a
    for arg in fmla.args:
        for a in get_qa_arcs(arg, ast, pol, univs):
            yield a
Ejemplo n.º 5
0
def get_qa_arcs(fmla, ast, pol, univs):
    if isinstance(fmla, il.Not):
        for a in get_qa_arcs(fmla.args[0], ast, not pol, univs):
            yield a
        return
    is_e = il.is_exists(fmla)
    is_a = il.is_forall(fmla)
    if is_e and pol or is_a and not pol:
        fvs = set(il.free_variables(fmla))
        for u in univs:
            if u in fvs:
                for e in il.quantifier_vars(fmla):
                    yield (u.sort, e.sort, ast)
    if is_e and not pol or is_a and pol:
        for a in get_qa_arcs(fmla.args[0], ast, pol,
                             univs + list(il.quantifier_vars(fmla))):
            yield a
    for arg in fmla.args:
        for a in get_qa_arcs(arg, ast, pol, univs):
            yield a