skirpichev/sympy — pull request #21 by smichr (2014-11-04 03:15:19+00:00)
Title: Relational gets keyword `check`

An additional level of evaluation is added with the keyword `check`.

Both Lt(x, 1) and x < 1 behave the same in returning an unevaluated
relational, even if evaluate=True. The only checking that occurs is
a check that x.is_real is not False. Since the value of x is unknown
the unevaluated relation "x < 1" is returned. This means that code
that wants to test if an actual value was returned must test it
explicitly as 'if (x < 1) == True'. Even applying doit() does not
cause an unevaluate form like x < y (with vanilla symbols) to raise
an error.

With the new keyword, checking that the result was obtained is
part of the function call itself. If a result was not (or could not)
be obtained an error is raised. There are 3 levels of checking as
described in the function's docstring.

var('x y')
Lt(x, y, 0) -> x < y
Lt(x, y, 1) -> error
Lt(x, x + 1, 1) -> True
Lt(x, x + 1, 2) -> error