Kleene's three-valued logic #
A comparison with a NULL operand is neither true nor false but unknown,
and SQL evaluates predicates in Kleene's strong three-valued logic. A row on
which a predicate is unknown is not selected, and neither is it selected by
the predicate's negation: unknown is a fixed point of negation, which is
what no two-valued reading can imitate.
The connectives are the minimum and maximum of the order
false < unknown < true, with negation exchanging the two definite values.
Every law of a De Morgan algebra holds; what fails is the excluded middle,
a ⊔ ¬a = true, exactly at unknown.
A three-valued truth value.
- false : Kleene
Definitely false.
- unknown : Kleene
Neither: a comparison with a
NULLoperand. - true : Kleene
Definitely true.
Instances For
Dependency graph
Dependency graph
Equations
- instReprKleene.repr Kleene.false prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Kleene.false")).group prec✝
- instReprKleene.repr Kleene.unknown prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Kleene.unknown")).group prec✝
- instReprKleene.repr Kleene.true prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Kleene.true")).group prec✝
Instances For
Dependency graph
Equations
- instReprKleene = { reprPrec := instReprKleene.repr }
Dependency graph
A two-valued truth value read as a three-valued one.
Equations
Instances For
Dependency graph
Whether the value is definitely true. This is the reading a selection takes: a row on which the predicate is unknown is not selected.