(expr, symbol)
Helper for ask().

    Extracts the facts relevant to the symbol from an assumption.
    Returns None if there is nothing to extract.
Helper for ask().
Helper for ask () .
def _extract_facts(expr, symbol):
    """
    Helper for ask().

    Extracts the facts relevant to the symbol from an assumption.
    Returns None if there is nothing to extract.
    """
    if isinstance(expr, bool):
        return
    if not expr.has(symbol):
        return
    if isinstance(expr, AppliedPredicate):
        if expr.arg == symbol:
            return expr.func
        else:
            return
    args = [_extract_facts(arg, symbol) for arg in expr.args]
    if isinstance(expr, And):
        args = [x for x in args if x is not None]
        if args:
            return expr.func(*args)
    if args and all(x != None for x in args):
        return expr.func(*args)
def _extract_facts ( expr , symbol ) : if isinstance ( expr , bool ) : return if not expr . has ( symbol ) : return if isinstance ( expr , AppliedPredicate ) : if expr . arg == symbol : return expr . func else : return args = [ _extract_facts ( arg , symbol ) for arg in expr . args ] if isinstance ( expr , And ) : args = [ x for x in args if x is not None ] if args : return expr . func ( * args ) if args and all ( x != None for x in args ) : return expr . func ( * args )