Using Wolfram|Alpha to simplify logical expressions

You can use Wolfram|Alpha to simplify logical expressions, which is particularly handy if you’re a programmer.

Take the following contrived expression, in Ruby:

if (not ((a < s) or (b > t))) ...

This can be converted to the following query in Conjunctive Normal Form for Wolfram|Alpha:

CNF (~((a < s) || (b > t)))

The result of which shows that it simplifies to:

a >= s ∧ b <= t

Which makes our Ruby a little nicer:

if (a >= s and b <= t) ...

Here’s the actual query on Wolfram|Alpha: CNF (~((a < s) || (b > t)))

Symbols

Because Wolfram|Alpha is a web site that has to accept typed text, it uses the programming symbols, but it shows its results using the maths symbols.

Operation Maths Programming
not ¬ !
and &&
or ||

Last modified: 03/03/2013 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top