Send Close Add comments: (status displays here)
Got it!  This site "creationpie.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
DeMorgan's Laws
by RS  admin@creationpie.com : 1024 x 640


1. DeMorgan's Laws

2. DeMorgan build
 ▶ 
 + 
 - 
 1 
 2 
 3 

3. DeMorgan's laws
Expression tree for (! (a & b)) = ((! a) | (! b))
DeMorgan's laws are always useful for reasoning about programs, especially loops and conditional statements. Here is one of DeMorgan's laws.
a b | ( ! ( a & b ) ) = ( ( ! a ) | ( ! b ) ) --------------------------------------------- 0 0 | ( 1 ( 0 0 0 ) ) 1 ( ( 1 0 ) 1 ( 1 0 ) ) 0 1 | ( 1 ( 0 0 1 ) ) 1 ( ( 1 0 ) 1 ( 0 1 ) ) 1 0 | ( 1 ( 1 0 0 ) ) 1 ( ( 0 1 ) 1 ( 1 0 ) ) 1 1 | ( 0 ( 1 1 1 ) ) 1 ( ( 0 1 ) 0 ( 0 1 ) )

The extended truth table constitutes a proof of the law since all values under the "=" are 1. DeMorgan's laws can be used to flip the then part and else part of an if construct in an algebraic manner. Here are some equivalent ways.
if (a & b) { p2 } else { p1 } if (! (a & b)) { p1 } else { p2 } if ((!a) | (!b)) { p2 } else { p1 }


4. DeMorgan's laws
Expression tree for (! (a | b)) = ((! a) & (! b))
Here is another way to express DeMorgan's laws.
a b | ( ! ( a | b ) ) = ( ( ! a ) & ( ! b ) ) --------------------------------------------- 0 0 | ( 1 ( 0 0 0 ) ) 1 ( ( 1 0 ) 1 ( 1 0 ) ) 0 1 | ( 0 ( 0 1 1 ) ) 1 ( ( 1 0 ) 0 ( 0 1 ) ) 1 0 | ( 0 ( 1 1 0 ) ) 1 ( ( 0 1 ) 0 ( 1 0 ) ) 1 1 | ( 0 ( 1 1 1 ) ) 1 ( ( 0 1 ) 0 ( 0 1 ) )

The extended truth table constitutes a proof of the law since all values under the "=" are 1. DeMorgan's laws can be used to flip the then part and else part of an if construct in an algebraic manner. Here are some equivalent ways.
if (a | b) { p 2 } else { p1 } if (! (a | b)) { p1 } else { p2 } if ((!a) & (!b)) { p2 } else { p1 }


5. End of page

by RS  admin@creationpie.com : 1024 x 640