DeMorgans Laws
-
Upload
cuppa-coffee -
Category
Documents
-
view
104 -
download
0
description
Transcript of DeMorgans Laws
![Page 1: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/1.jpg)
Warm-upA Little Boolean Review
DeMorgan’s Laws:!(P&&Q) = ___________________!(P || Q) = ____________________
![Page 2: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/2.jpg)
Warm-upA Little Boolean Review
DeMorgan’s Laws:!(P&&Q) = !P || !Q!(P || Q) = !P && !Q
![Page 3: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/3.jpg)
Warm-upA Little Boolean Review
! (x > = y ) = _______________
! ( x > y ) = _______________
![Page 4: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/4.jpg)
Warm-upA Little Boolean Review
Use DeMorgan’s Law to change these:
! (x > = y && a < b ) = ____________
! ( x >= y || a >= b ) = _____________
![Page 5: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/5.jpg)
Warm-upA Little Boolean Review
Use DeMorgan’s Law to change these:
! (x > = y && a < b ) = x<y || a>=b
! ( x >= y || a >= b ) = x<y || a<b
![Page 6: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/6.jpg)
More Boolean!
(y>10000) || ( x>1000 && x<1500 )
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 7: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/7.jpg)
Use the old distributive property:
(y>10000) || ( x>1000 && x<1500 )
A * (B + C) = A * B + A * C
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 8: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/8.jpg)
Use the old distributive property:
(y>10000) || ( x>1000 && x<1500 )
A * (B + C) = A * B + A * C
(y>10000 || x>1000)
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 9: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/9.jpg)
Use the old distributive property:
(y>10000) || ( x>1000 && x<1500 )
A * (B + C) = A * B + A * C
(y>10000 || x>1000) &&
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 10: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/10.jpg)
Use the old distributive property:
(y>10000) || ( x>1000 && x<1500 )
A * (B + C) = A * B + A * C
(y>10000 || x>1000) && (y>10000 || x<1500)
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 11: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/11.jpg)
Use the old distributive property:
(y>10000) || ( x>1000 && x<1500 )
A * (B + C) = A * B + A * C
(y>10000 || x>1000) && (y>10000 || x<1500)
a. (y>10000 || x>1000) && (y>10000 || x<1500)
b. (y>10000 || x>1000) || (y>10000 || x<1500)
c. (y>10000) && (x>1000 || x<1500 )
d. (y>10000 && x>1000) || (y>10000 && x<1500)
e. (y > 10000 && x>1000) && (y>10000 && x<1500)
![Page 12: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/12.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)Let’s see what happens if the last statement is true.
![Page 13: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/13.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)Let’s see what happens if the last statement is true.
The value of the left side and the right side can’t be the same. They must be “Not Equal”. One side must be true and the other side must be false.
![Page 14: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/14.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)Since x = y or x = z, but x doesn’t equal y and z. If all three are equal, then both the left and right would be true, and would not meet the != condition
![Page 15: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/15.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)In other words, they can’t all be the same.
Furthermore, if all three are different, then both the left and right side would be false, which means they don’t meet the != condition.
![Page 16: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/16.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)Conclusion: x is equal to either y or z. Does this condition make the two statements above true?
![Page 17: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/17.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
Knowing this, let’s look at this statement.
Do the same conditions make it true?
![Page 18: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/18.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
If x equals y and does not equal z, the left side is true
Since the operator is OR, the statement is true no matter what is on the right side.
![Page 19: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/19.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
If x equals z and does not equal y, the right side is true
Since the operator is OR, the statement is true no matter what is on the left side.
![Page 20: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/20.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
So, the third and first meet the same conditions
when evaluating to “true”. How about the middle?
![Page 21: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/21.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
If x equals either ‘y’ or ‘z’, the left is true. If the ‘x’
is different than either ‘y’ or ‘z’, the right is true.
![Page 22: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/22.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)
So given the exact conditions again, that x equals
either y or z, but not both, the middle statement is true.
![Page 23: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/23.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)You may figure out the condition that make the last statement false and follow the same steps to compare those conditions to the other two statements
![Page 24: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/24.jpg)
(x==y && x!=z) || (x!=y && x==z)
(x==y || x==z) && (x!=y || x!= z)
(x==y) != (x==z)Hint: This statement is false only if
* all three are the same, * all three are different, * or y = z but not x.
![Page 25: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/25.jpg)
De Morgan’s Laws
• !(a&&b) = !a || !b
• !(a || b) = !a && !b
![Page 26: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/26.jpg)
Using DeMorgans LawsThe expression !((x<=y) && (y>5)) is
equivilant to which of the following?
• A. (x<=y) && (y>5)
• B. (x<=y) || (y>5)
• C. (x>=y) || (y<5)
• D. (x>y) || (y<=5)
• E. (x>y) && (y<=5)
![Page 27: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/27.jpg)
Using DeMorgans LawsThe expression !((x<=y) && (y>5)) is
equivilant to which of the following?
• A. (x<=y) && (y>5)
• B. (x<=y) || (y>5)
• C. (x>=y) || (y<5)
• D. (x>y) || (y<=5)
• E. (x>y) && (y<=5)
![Page 28: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/28.jpg)
Using DeMorgans LawsThe expression !(x>y && y<=0) is equivilant
to which of the following?
• A. !(x<=y) || (y>0)
• B. x>y && y<=0
• C. x<=y || y>0
• D. x>y || y<0
• E. x<=y && y<=0
![Page 29: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/29.jpg)
Using DeMorgans LawsThe expression !(x>y && y<=0) is equivilant
to which of the following?
• A. !(x<=y) || (y>0)
• B. x>y && y<=0
• C. x<=y || y>0
• D. x>y || y<0
• E. x<=y && y<=0
![Page 30: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/30.jpg)
Given that x is true, y is true, and z is false, which of the following expressions will evaluate to false?
A. (x&&y) || zB. (x || y) && zC. y || (x&&z)D. x || (y && z)E. x && (y || z)
![Page 31: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/31.jpg)
Given that x is true, y is true, and z is false, which of the following expressions will evaluate to false?
A. (x&&y) || zB. (x || y) && zC. y || (x&&z)D. x || (y && z)E. x && (y || z)
![Page 32: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/32.jpg)
Assuming that c and d are boolean variables, the expression !c || d is equivalent to which of the following?
• A. !(c && d)
• B. !(c && !d)
• C. c && !d
• D. !(c || !d)
• E. !(!c && d)
![Page 33: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/33.jpg)
Assuming that c and d are boolean variables, the expression !c || d is equivalent to which of the following?
• A. !(c && d)
• B. !(c && !d)
• C. c && !d
• D. !(c || !d)
• E. !(!c && d)
![Page 34: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/34.jpg)
Assuming that a and b are boolean when is the following expression true:
!(!a || b) || (!a && b)
• A. If and only if a and b have different values
• B. If and only if a and b have the same value
• C. If and only if both a and b are true
• D. If and only if both a and b are false
• E. None
![Page 35: DeMorgans Laws](https://reader036.fdocuments.us/reader036/viewer/2022081412/544fd43fb1af9f25698b458c/html5/thumbnails/35.jpg)
Assuming that a and b are boolean when is the following expression true:
!(!a || b) || (!a && b)
• A. If and only if a and b have different values
• B. If and only if a and b have the same value
• C. If and only if both a and b are true
• D. If and only if both a and b are false
• E. None