(y, phi, logic=AUTO, maxloops=None,
          esolver_name=None, fsolver_name=None,
          verbose=False)
Solves exists x. forall y. phi(x, y)
Solves exists x. forall y. phi(x, y)
Solves exists x . forall y . phi ( x y )
def efsmt(y, phi, logic=AUTO, maxloops=None,
          esolver_name=None, fsolver_name=None,
          verbose=False):
    """Solves exists x. forall y. phi(x, y)"""

    y = set(y)
    x = phi.get_free_variables() - y

    with Solver(logic=logic, name=esolver_name) as esolver:

        esolver.add_assertion(Bool(True))
        loops = 0
        while maxloops is None or loops <= maxloops:
            loops += 1

            eres = esolver.solve()
            if not eres:
                return False
            else:
                tau = {v: esolver.get_value(v) for v in x}
                sub_phi = phi.substitute(tau).simplify()
                if verbose: print("%d: Tau = %s" % (loops, tau))

                fmodel = get_model(Not(sub_phi),
                                   logic=logic, solver_name=fsolver_name)
                if fmodel is None:
                    return tau
                else:
                    sigma = {v: fmodel[v] for v in y}
                    sub_phi = phi.substitute(sigma).simplify()
                    if verbose: print("%d: Sigma = %s" % (loops, sigma))
                    esolver.add_assertion(sub_phi)

        raise SolverReturnedUnknownResultError
def efsmt ( y , phi , logic = AUTO , maxloops = None , esolver_name = None , fsolver_name = None , verbose = False ) : y = set ( y ) x = phi . get_free_variables ( ) - y with Solver ( logic = logic , name = esolver_name ) as esolver : esolver . add_assertion ( Bool ( True ) ) loops = 0 while maxloops is None or loops <= maxloops : loops += 1 eres = esolver . solve ( ) if not eres : return False else : tau = { v : esolver . get_value ( v ) for v in x } sub_phi = phi . substitute ( tau ) . simplify ( ) if verbose : print ( "%d: Tau = %s" % ( loops , tau ) ) fmodel = get_model ( Not ( sub_phi ) , logic = logic , solver_name = fsolver_name ) if fmodel is None : return tau else : sigma = { v : fmodel [ v ] for v in y } sub_phi = phi . substitute ( sigma ) . simplify ( ) if verbose : print ( "%d: Sigma = %s" % ( loops , sigma ) ) esolver . add_assertion ( sub_phi ) raise SolverReturnedUnknownResultError