UMBC CS 201, Fall 98
UMBC CMSC 201 & 201H Fall '98 CSEE | 201 | 201 F'98 | lectures | news | help

Demorgan's Law

Sometimes it can be confusing to think about boolean expressions with not's and or's.

For example

If the value is not 2 or not 3 then ...
if translated literally from English, becomes :
     if ((v != 2) || (v != 3)) ...
which is ALWAYS TRUE

what we really want is:

     if ((v != 2) && (v != 3)) ...

You can always use some tautologies to simplify things.

Demorgan's law

from the meaning of not


CSEE | 201 | 201 F'98 | lectures | news | help

Saturday, 12-Sep-1998 16:52:24 EDT