Re: ((a&&b)||c)==((a||c)&&(b||c))
- To: mathgroup at smc.vnet.net
- Subject: [mg62107] Re: ((a&&b)||c)==((a||c)&&(b||c))
- From: John Doty <jpd at whispertel.LoseTheH.net>
- Date: Fri, 11 Nov 2005 02:52:36 -0500 (EST)
- References: <200511090845.DAA17387@smc.vnet.net> <43721D94.9050307@wolfram.com> <dkv013$7ts$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Steven T. Hatton wrote:
> On Wednesday 09 November 2005 11:02 am, Daniel Lichtblau wrote:
>>Equal does not do logical manipulations on its operands.
>
>
> That's part of what I'm trying to understand. Mathamatica AFAIK takes
> expressions and transforms them into the simplest form possible, and then
> does pattern patching.
No, that's not what it does. There are a few transformations it does
automatically, but they don't add up to anything like a transformation
to "simplest form possible". There are expensive heuristic procedures,
Simplify[] and FullSimplify[] that attempt this, but they are not
invoked automatically and also cannot be guaranteed to find the
"simplest form possible".
Ordinary algebra in Mathematica defies most of your expectations also:
In[1]:= (a + 1)^2 == a^2 + 2*a + 1
Out[1]= (1 + a)^2 == 1 + 2*a + a^2
In[2]:= Expand[%]
Out[2]= (1 + a)^2 == 1 + 2*a + a^2
In[3]:= Simplify[%]
Out[3]= True
The main difference is that Simplify[] won't apply LogicalExpand[]
automatically. I suppose this would be hazardous if some symbols didn't
represent booleans. However:
In[10]:= Simplify[((a && b) || c) == ((a || c) && (b || c)),
TransformationFunctions -> {Automatic, LogicalExpand}]
Out[10]= True
-jpd
- References:
- ((a&&b)||c)==((a||c)&&(b||c))
- From: "Steven T. Hatton" <hattons@globalsymmetry.com>
- ((a&&b)||c)==((a||c)&&(b||c))