I got screwed when trying to understand this expression. I\'ve thought several times but I cant get the meaning.
! (p || q) is equivalent to !p && !
You can use a Truth table to see how the two expressions are equal. Like This:
!(P || Q) = !P && !Q _________________________________________________ P Q P || Q !(P||Q) !P !Q !P && !Q _________________________________________________ 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 0 1 1 1 1 _________________________________________________
Note that the column labeled !(P||Q) is the same as the column labeled !P && !Q. You can work this from the left most column where we set the initial values for P and Q. Then work out each column towards the right.
!(P && Q) = !P || !Q _________________________________________________ P Q P && Q !(P&&Q) !P !Q !P && !Q _________________________________________________ 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 1 0 1 1 0 1 0 0 0 1 1 1 1 _________________________________________________