logical expression 'simplifier'
| From: | Gyozo Papp | Date: | Mon, 07 May 2001 23:18:08 +0000 |
| Subject: | logical expression 'simplifier' | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51841@lists.php.net to get a copy of this message | ||
Hello, girls and boys,
my question sounds a bit strange, but it 's very important for me to simplify my database
queries.
So, is there any known and implementable algorithm that simplifies an arbitrary logical expression
such as:
(either in PHP-style and in mathematical forms separated by comma)
(A && B) || (B && C) , (A ^ B) v (B ^ C) to:
---------------------
(A || C) && B , (A v C) ^ B. // applying distribution rule - I guess this is the english
name
or an other ( in PHP-style or if you love better )
(A && B) || B , (A ^ B) v B to :
--------------
B
As above I mentioned i'm looking for an algorithm that can be implemented in PHP which does as
most as possible.
This kind of simplifications is also used in the 'FROM' clause of the SQL-query, and
that's why I can't pass this job to the DB.
Papp Gyozo
- pgerzson@freestart.hu