(expr, model={})
Return True if the propositional logic expression is true in the model,
    and False if it is false. If the model does not specify the value for
    every proposition, this may return None to indicate 'not obvious';
    this may happen even when the expression is tautological.

    The model is implemented as a dict containing the pair symbol, boolean value.

    Examples
    ========

    >>> from sympy.abc import A, B
    >>> from sympy.logic.inference import pl_true
    >>> pl_true( A & B, {A: True, B : True})
    True
Return True if the propositional logic expression is true in the model,
    and False if it is false. If the model does not specify the value for
    every proposition, this may return None to indicate 'not obvious';
    this may happen even when the expression is tautological.
Return True if the propositional logic expression is true in the model and False if it is false . If the model does not specify the value for every proposition this may return None to indicate not obvious ; this may happen even when the expression is tautological .
def pl_true(expr, model={}):
    """
    Return True if the propositional logic expression is true in the model,
    and False if it is false. If the model does not specify the value for
    every proposition, this may return None to indicate 'not obvious';
    this may happen even when the expression is tautological.

    The model is implemented as a dict containing the pair symbol, boolean value.

    Examples
    ========

    >>> from sympy.abc import A, B
    >>> from sympy.logic.inference import pl_true
    >>> pl_true( A & B, {A: True, B : True})
    True

    """

    if isinstance(expr, bool):
        return expr

    expr = sympify(expr)

    if expr.is_Symbol:
        return model.get(expr)

    args = expr.args
    func = expr.func

    if func is Not:
        p = pl_true(args[0], model)
        if p is None:
            return None
        else:
            return not p
    elif func is Or:
        result = False
        for arg in args:
            p = pl_true(arg, model)
            if p is True:
                return True
            if p is None:
                result = None
        return result
    elif func is And:
        result = True
        for arg in args:
            p = pl_true(arg, model)
            if p is False:
                return False
            if p is None:
                result = None
        return result

    elif func is Implies:
        p, q = args
        return pl_true(Or(Not(p), q), model)

    elif func is Equivalent:
        p, q = args
        pt = pl_true(p, model)
        if pt is None:
            return None
        qt = pl_true(q, model)
        if qt is None:
            return None
        return pt == qt
    else:
        raise ValueError("Illegal operator in logic expression" + str(expr))
def pl_true ( expr , model = { } ) : if isinstance ( expr , bool ) : return expr expr = sympify ( expr ) if expr . is_Symbol : return model . get ( expr ) args = expr . args func = expr . func if func is Not : p = pl_true ( args [ 0 ] , model ) if p is None : return None else : return not p elif func is Or : result = False for arg in args : p = pl_true ( arg , model ) if p is True : return True if p is None : result = None return result elif func is And : result = True for arg in args : p = pl_true ( arg , model ) if p is False : return False if p is None : result = None return result elif func is Implies : p , q = args return pl_true ( Or ( Not ( p ) , q ) , model ) elif func is Equivalent : p , q = args pt = pl_true ( p , model ) if pt is None : return None qt = pl_true ( q , model ) if qt is None : return None return pt == qt else : raise ValueError ( "Illegal operator in logic expression" + str ( expr ) )