## Truth Tables and De Morgan's Rules

Read this chapter, which discusses Boolean variables as used in decision tables. Truth tables are used to collect variables and their values relative to decisions that have to be made within control structures.

### 13. De Morgan's Rules

Answer:if ( value == 399 )
System.out.println("Correct Value");
else
System.out.println("Wrong Value");

# De Morgan's Rules

Augustus De Morgan was a nineteenth century British mathematician who showed the importance of several rules of logic. Two of these, De Morgan's Rules, show how the NOT operator can be moved to the inside of an expression. (Although these rules are named after De Morgan, they were, in fact, known to Aristotle.)

!(A && B) is equivalent to !A || !B
!(A || B)is equivalent to !A && !B              
These rules are very useful. Make sure you know them.

This truth table shows why the first rule is true.

A
B
(A && B)
!(A && B)
!A
!B
!A || !B
F
F
F
T
T
T
T
F
T
F
T
T
F
T
T
F
F
T
F
T
T
T
T
T
F
F
F
F

The fourth column and the last column have the same truth values. This shows the the expressions at the top of those columns are equivalent.

Question 13:Rewrite the following fragment (from a previous example):boolean reject =  !(speed > 2000 && memory > 512)