Remove legacy assumptions thus improving import time (#963)
Removed are:
- is_noncommutative (use is_commutative=False)
- is_noncomplex (use is_complex=False)
- homogenous/inhomogenous (were never used)
- is_nni, is_npi, is_pi, is_ni (were never used besides some tests)
This greatly offloads assumptions engine and on my host "time import sympy":
before merging assumptions: 0.51
after merging assumptions: 0.65
after this patch: 0.53
I hope this is tolerable.
Ondrej:
> +1 to the patch.
>
> Only I don't understand in what way it affects performance? That the assumption
> engine has harder time to infer the correct assumptions if there are more rules?
As written at the top of facts.py assumption engine consists of two parts:
- rules compilation and preparation of tables
- runtime inference
When doing it, I've put special attention to optimizing "runtime inference", but
before going to runtime the rules have to be first compiled.
This is the job of Prover
http://hg.sympy.org/sympy/file/
ca74a684946c/sympy/core/facts.py#l385
And other 80% of facts.py, and infering additional rules from initial ones is
costy, because:
1. preparation steps was optimized only in a way to produce minimal deduction
tables - performance was not a high priority because compilation is done only once
2. beta rules (rules like &(a, b) -> c) is costy itself. Again as written on top of
facts.py
http://hg.sympy.org/sympy/file/
ca74a684946c/sympy/core/facts.py#l20
"""
The major complexity is in efficient beta-rules processing and usually for an
expert system a lot of effort goes into code that operates on beta-rules.
"""
So that's why removing some not-so-needed beta rules from our assumptions rules
improves "time import sympy". I'd proceed this way...
All tests and doctests pass.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Ondrej Certik <ondrej@certik.cz>