MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ((a&&b)||c)==((a||c)&&(b||c)) is not true


Richard Fateman wrote:

> A good reason for Mathematica to fail to show that these
> are the same, is that they are in some senses different.
> 
> 
> These look like logical statements and as such they look like they
> are logically identical, but these are actually
> programs with short-circuit evaluation.
> 
> 
> Consider
> c[] := (Print[C_called]; True)
> a[] := (Print[A_called]; False)
> b[] := (Print[B_called]; True)
> (a[] && b[]) || c[]
> (a[] || c[]) && (b[] || c[])
> 
> They are different PROGRAMS.

Good observation.  There should, however, be some way to tell Mathematica to
treat them as traditional symbolic logic statements.  I don't believe that
LogicExpand will do that for me.  I'm not sure what happens with Implies,
but my observation is that it does not handle all cases.
-- 
The Mathematica Wiki: http://www.mathematica-users.org/
Math for Comp Sci http://www.ifi.unizh.ch/math/bmwcs/master.html
Math for the WWW: http://www.w3.org/Math/


  • Prev by Date: Re: Plot Angle between Vectors
  • Next by Date: Re: FileNamesin a loop..
  • Previous by thread: Re: ((a&&b)||c)==((a||c)&&(b||c))
  • Next by thread: Re: ((a&&b)||c)==((a||c)&&(b||c))