def is_assignment_relation()

in src/math_verify/grader.py [0:0]


def is_assignment_relation(expr: Basic | MatrixBase) -> bool:
    """Check if an expression is an assignment relation. E.g a=1

    Args:
        expr: The expression to check
    Returns:
        bool: True if expr is a relational expression or And of relations, False otherwise
    """
    if isinstance(expr, Eq) and is_expr_of_only_symbols(expr.lhs):
        return True

    if isinstance(expr, And) and len(expr._unsorted_args) > 0:
        return all(
            isinstance(arg, Eq) for arg in expr._unsorted_args
        ) and is_expr_of_only_symbols(expr._unsorted_args[0].lhs)

    return False