Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tool for testing logic expressions

can anyone recommend software (preferably for mac) or a web based tool, that can be used to evaluate logic expressions?

For example I would like to be able to quickly test whether two expressions like:

$a = 'foo';
$b = 'bar';
$c = 'foo';

( !(($a == $c) && ($b == $c)) )

// and

( ($a != $c) || ($b != c$) )

are interchangeable or not.

And also, is there generally an agreed upon best practice in relation to how to construct such expressions? For example to try to minimize the use of the negation, the order of the elements or something like that?

Sometimes I find myself struggling a bit with these things :)

like image 618
mikkelbreum Avatar asked Sep 17 '25 09:09

mikkelbreum


2 Answers

You can also use Wolfram Alpha

https://www.wolframalpha.com/input/?i=P+%26%26+(Q+%7C%7C+R)&lk=3

or

https://www.dcode.fr/boolean-expressions-calculator

like image 79
Revious Avatar answered Sep 20 '25 02:09

Revious


You can use something like http://www-cs-students.stanford.edu/~silver/truth/ and compare the generated truth tables.

like image 40
Paweł Obrok Avatar answered Sep 20 '25 01:09

Paweł Obrok