MathGroup Archive 2005

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

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg62086] Re: ((a&&b)||c)==((a||c)&&(b||c)) is not true
  • From: "Steven T. Hatton" <hattons at>
  • Date: Fri, 11 Nov 2005 02:51:49 -0500 (EST)
  • References: <> <dksig6$k6l$> <dkuvog$7rc$>
  • Sender: owner-wri-mathgroup at

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:
Math for Comp Sci
Math for the WWW:

  • 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))