1

Which laws do I need to use to simplify

!X + (!Y + !Z)*(Y + Z)

to

!X + (Y*!Z) + (!Y*Z)
Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
Meeran
  • 91
  • 5
  • What do you mean by `+` and `*`? Boolean `OR` and `AND`? – Ondrej Tucny Mar 01 '15 at 18:30
  • yes, sorry I thought that was equivalent – Meeran Mar 01 '15 at 18:31
  • Try "multiplying out" the second term in the original expression. Then you can find rules that simplify the longer expression. Also, I don't think this question is completely appropriate for this site because it's not related to programming. –  Mar 01 '15 at 18:35

3 Answers3

2

No need to apply any specific 'laws', just write down a simple table to figure out the two expression are equivalent (providing + is OR and * is AND):

Y  Z  !Y  !Z  (!Y+!Z)*(Y+Z)      (Y*!Z) +(!Y*Z)
0  0  1   1   (1+1=1)*(0+0=0)=0  (0*1=0)+(1*0=0)=0
0  1  1   0   (1+0=1)*(0+1=1)=1  (0*0=0)+(1*1=1)=1
1  0  0   1   (0+1=1)*(1+0=1)=1  (1*1=1)+(0*0=0)=1
1  1  0   0   (0+0=0)*(1+1=1)=0  (1*0=0)+(0*1=0)=0

Likewise you can deduct that (X or Y) and Z is equivalent to (X and Z) or (Y and Z). This is called distributivity of and over or. Further reading is a nice article about Boolean algebra on Wikipedia.

In your example: (!Y + !Z)*(Y + Z) = !Y*(Y + Z) + !Z*(Y + Z) = !Y*Y + !Y*Z + !Z*Y + !Z*Z. Trivially A and not A == false, then your expression simplifies to !Y*Z + !Z*Y and further to Y*!Z + !Y*Z because of commutativity.

Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
1

You can first start by distributivity of multiplication over addition:

!X + (!Y + !Z)*(Y + Z) = !X + !Y*Y + !Z*Y + !Y*Z + !Z*Z

Then, we can use complementation to remove elements of the form !p*p:

= !X + 0 + !Z*Y + !Y*Z + 0

And finally remove the 0 as they are +'s neutral.

PatJ
  • 5,996
  • 1
  • 31
  • 37
0

If memory serves (and I take your notation correctly), then that's an SLD resolution inside a simple conjunction: http://en.wikipedia.org/wiki/SLD_resolution

jcc333
  • 759
  • 5
  • 15