Sunday, May 10, 2009

C Programming Language: Reducing Boolean expressions?

We are asked to reduce all of the following Boolean expressions. I believe all of my answers are correct and are in the most reduced form, but I just want to make sure. Please let me know if all of the answers I have are correct, and for any that are not correct, please explain how to get to the correct solution.








Use DeMorgan's law to reduce the following Boolean expressions:





a) !A %26amp;%26amp; !B





ANSWER: !(A || B)





b) !A || !B





ANSWER: !(A %26amp;%26amp; B)





c) !(!A %26amp;%26amp; !B)





ANSWER: A || B





d) !(!A || !B)





ANSWER: A %26amp;%26amp; B





e) !(A != B %26amp;%26amp; C == D)





ANSWER: A == B || C != D





f) !(A %26lt; B %26amp;%26amp; C %26gt;= D)





ANSWER: A %26gt;=B || C %26lt; D








Use Distributive law to reduce the following Boolean expressions:





a) (A || B) %26amp;%26amp; (A || C)





A %26amp;%26amp; A || A %26amp;%26amp; C || B %26amp;%26amp; A || B %26amp;%26amp; C





ANSWER: A || A %26amp;%26amp; C || B %26amp;%26amp; A || B %26amp;%26amp; C (from idempotence of


A %26amp;%26amp; A)





b) A %26amp;%26amp; B || A %26amp;%26amp; D





(A || A) %26amp;%26amp; (A || D) %26amp;%26amp; (B || A) %26amp;%26amp; (B || D)





ANSWER: A %26amp;%26amp; (A || D) %26amp;%26amp; (B || A) %26amp;%26amp; (B || D) (from


idempotence of A ||A)





c) a %26gt; b %26amp;%26amp; c != d || e %26lt;= f %26amp;%26amp; a %26gt; b





a %26gt; b %26amp;%26amp; c != d || a %26gt; b %26amp;%26amp; e %26lt;= f (commutativity)





(a %26gt; b || a %26gt; b) %26amp;%26amp; (a %26gt; b || e %26lt;= f) %26amp;%26amp; (c != d || a %26gt; b) %26amp;%26amp;


(c != d || e %26lt;= f)





ANSWER: a %26gt; b %26amp;%26amp; (a %26gt; b || e %26lt;= f) %26amp;%26amp; (c != d || a %26gt; b) %26amp;%26amp;


(c != d || e %26lt;= f)


(idempotence)

C Programming Language: Reducing Boolean expressions?
d)!(!A || !B)


=


(A || B)





--------------------------------------...


a)(A || B) %26amp;%26amp; (A || C)


=


A || (B %26amp;%26amp; C)





b)A %26amp;%26amp; B || A %26amp;%26amp; D


=


A %26amp;%26amp; (B || D)





c)a %26gt; b %26amp;%26amp; c != d || e %26lt;= f %26amp;%26amp; a %26gt; b


=


(a %26gt; b) %26amp;%26amp; (c != d || e %26lt;= f)


No comments:

Post a Comment