Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Boolean algebra

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69426] Re: [mg69373] Boolean algebra
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Tue, 12 Sep 2006 06:52:42 -0400 (EDT)
  • References: <200609090726.DAA21734@smc.vnet.net>

Menace wrote:
> I'd like to solve the following problem in Mathematica,
> 
> Given are the following preliminaries:
> (a1 || a2)=True
> (a1 && a2) = False
> 
> Then, given the following conjunctive normal form:
> 
> (b1 || a1) && (b1 || a2)
> 
> This can be simpliefied to: b1 || (a1 && a2)
> 
> Given the prelininaries I'd like Mathematica to simplify this to: b1.
> However, I cant figure out how to do this. I tried the following:
> 
> prelims := {(a1 && a2) -> False, (a1 || a2) -> True};
> f1 := (b1 || a2) && (b1 || a1);
> Simplify[f1] /. prelims
> 
> and this seems to work. However
> 
> f2 := (b1 || a1 || c1) && (b2 || a2 || a1);
> Simplify[f2] /. prelims
> 
> evaluates to: (b1 || a1 || c1) && (b2 || a2 || a1) instead of b1 || a1
> || c1.
> The reason of this seems to be the order in which a2 and a1 occur in
> f2. How can I make sure it works regardless of the order of a1 and a2?

Here is one possibility that might be helpful:

cond = Not[a1&&a2]&&(a1||a2);
f1=(b1 || a2) && (b1 || a1);
f2=(b1 || a1 || c1) && (b2 || a2 || a1);

In[5]:= Simplify[f1 && cond || ! cond, cond]

Out[5]= b1

In[6]:= Simplify[f2 && cond || ! cond, cond]

Out[6]= a1 || b1 || c1 || ! a2

The first example could also be done with Simplify[f1,cond]. 
Unfortunately, in the second example the result isn't quite what you 
wanted (as Andrzej said, variable elimination in Boolean algebras would 
be needed to eliminate the !a2 term), and I suspect that this technique 
will not be adequate for more complex examples.

Carl Woll
Wolfram Research


  • Prev by Date: Re: generalized foldlist problem - part 2
  • Next by Date: Re: Mathmatica StyleSheet questions
  • Previous by thread: Boolean algebra
  • Next by thread: Re: Boolean algebra