It is used to us using two-value logic in the application system: non-True is False. The calculation system of two-value logic is quite mature, or, or, non-derived, and non-oriented. But in practical applications, we will have a chance to encounter trial logic.
Three-value logic usually contains optional True, False, Null. How to join this NULL in a complete two-value logic arithmetic system, make it satisfied, and will not trigger logical contradictions, that is, we have to discuss here.
NULL is actually different algorithms when participating in logical operations. According to the "priority" of the NULL value in the calculation.
Usually we use the three-value logic used in the database, follow the principles of NULL. When there is a NULL value to participate in the binary operation, the return result is NULL, and the other is the same as the binary logic. This principle is based on the relational database to treat NULL as "unknown". Due to its unknown content, the results of any logical value and the operation are unknown (unconscious), which is also consistent with the processing of NULL with many data relational databases.
On the other hand, some friends may not notice that the common permission system is also a three-value logic. The null value in this system is at the lowest priority. When the two rations are merged, FALSE is higher than everything. When there is no negation value, the affirmation value is higher than NULL, and only two values are NULL, the result is NULL. In fact, we can think of it as a three-value and computing, so it is easy to construct a corresponding logic or calculation for mathematical symmetry. This arithmetic rule will depend on NULL "not assigned".
The last specified NULL value is between TRUE and FALSE, and the operation, when the two has a false, return false, otherwise, when there is a NULL, return null, both of which return true; Or the operation, the two returns true when True, otherwise there is a NULL back to NULL, both of which return false when FALSE. This is equal to the respective priority of True and False or with the calculation. Also it is also based on the NULL value "unknown". However, under this rule, the NULL value is strictly considered as unknown TRUE or FALSE, and the first rule treats it as an independent existence outside of the binary logic. There are also some database three-value logic based on this system. The MSDN gives a DBBOOL example of this rule (implementation with C # implementation), which will construct a more practical three-value based on this example in the discussion. Logical class.
The academic discussion about NULL values has not been restless, and there is still a four-dimensional logic during this period. Practice also proves that there is more than one three-value logical system in the "true" world. In practice, the most suitable rule should be selected according to the specific situation.