#19040: rewrite Expression.__nonzero__()
-------------------------+-------------------------------------------------
Reporter: rws | Owner:
Type: | Status: needs_review
enhancement | Milestone: sage-6.9
Priority: major | Resolution:
Component: | Merged in:
symbolics | Reviewers:
Keywords: | Work issues:
Authors: Ralf | Commit:
Stephan | ba8824e7c84d81f87bb3969bb831003057c48fbd
Report Upstream: N/A | Stopgaps:
Branch: |
u/rws/19040-2 |
Dependencies: |
-------------------------+-------------------------------------------------
Changes (by rws):
* status: needs_work => needs_review
Old description:
> Symbolic expressions may be part of type-neutral computations, e.g.
> matrices, polynomials. Developers do not expect proof machinery to crank
> up when writing `if x!=0`, but this is just what happens. So
> `bool(x1!=x2)` should be changed to mean `not (x1-x2).is_trivial_zero()`
> for symbolic `x`. The ticket should provide a different interface for
> cases requiring simplification/proof:
> * `bool(rel)` equivalent to `(not)(LHS-RHS).is_trivial_zero()` for ==,!=
> ; and for <, >, <=, >= the result follows alpha order of lhs and rhs
> * `satisfiable(rel)` returning
> `(Yes,example)/No/Undecidable/NotImplemented`
> * `solve(rel)` in case of `satisfiable=Yes` returning the full solution
> set
> * `is(rel)` attempting simplification/proof, returning `True`/`False`,
> throwing `NotImplementedError`
> * `ex.is_zero(simplify=False)` (default) calling the fast `bool(ex==0)`
> * `ex.is_zero(simplify=True)` attempting simplification/proof
> * `prove(rel)` showing more or less steps of simplification (which is
> out of reach for the moment)
>
> This ticket will implement the new behaviour of `bool(rel)` and put all
> other functionality of `ex.__nonzero__()` into `is()` and
> `ex.is_zero(simplify=True)`.
>
> See also #19162.
New description:
Symbolic expressions may be part of type-neutral computations, e.g.
matrices, polynomials. Developers do not expect proof machinery to crank
up when writing `if x!=0`, but this is just what happens. So
`bool(x1!=x2)` should be changed to mean `not (x1-x2).is_trivial_zero()`
for symbolic `x`. The ticket should provide a different interface for
cases requiring simplification/proof:
* `bool(rel)` equivalent to `(not)(LHS-RHS).is_trivial_zero()` for ==,!=
; and for <, >, <=, >= the result follows alpha order of lhs and rhs
* `satisfiable(rel)` returning
`(Yes,example)/No/Undecidable/NotImplemented`
* `solve(rel)` in case of `satisfiable=Yes` returning the full solution
set
* `holds(rel)` attempting simplification/proof, returning `True`/`False`,
throwing `NotImplementedError`
* `ex.is_zero(simplify=False)` (default) calling the fast `bool(ex==0)`
* `ex.is_zero(simplify=True)` attempting simplification/proof by calling
`ex==0`.holds()
* `prove(rel)` showing more or less steps of simplification (which is out
of reach for the moment)
This ticket will implement the new behaviour of `bool(rel)` and put all
other functionality of `ex.__nonzero__()` into `holds()` and
`ex.is_zero(simplify=True)`.
See also #19162.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/19040#comment:31>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.