Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantics of the Boolean and comparison operators in the context of three-valued-logic

Professor ask me this question:

What is the semantics of the Boolean and comparison operators in the context of three-valued-logic?

I'm not sure what he meant by that. What is comparison operator? Is that the same as relational operator? Semantics? He asking about 'meaning' of those two terms in context of three-valued-logic?

Thanks.

like image 661
DB Student Avatar asked Mar 02 '10 00:03

DB Student


1 Answers

Boolean values by definition consist of two options: True and False, or some representation of them like 1/0, ON/OFF, YES/NO, etc.

Many database systems also allow you to store a NULL value in fields designated as Boolean to allow them to represent three values: Yes, No, and Unknown (NULL).

The Boolean Operators are AND, OR, and NOT.
Comparison Operators are some form of EQUALS or NOT EQUALS.

Operations with TRUE/FALSE values on both ends are obvious:
TRUE or FALSE -> TRUE
NOT TRUE -> FALSE
TRUE=TRUE -> TRUE

What he is getting at are the consequences of adding the NULL (Unknown) value:
TRUE or UNKNOWN(NULL) -> ???
NOT UNKNOWN(NULL) -> ???
TRUE=UNKNOWN(NULL) -> ???

like image 123
JohnFx Avatar answered Oct 19 '22 22:10

JohnFx