Documentation

Provenance.Util.Kleene

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.

inductive Kleene :

A three-valued truth value.

  • false : Kleene

    Definitely false.

  • unknown : Kleene

    Neither: a comparison with a NULL operand.

  • true : Kleene

    Definitely true.

Instances For
    Dependency graph
    @[instance_reducible]
    Equations
    Dependency graph
    Equations
    Instances For
      Dependency graph
      @[instance_reducible]
      Equations
      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.

        Equations
        Instances For
          Dependency graph

          Kleene negation: it exchanges the definite values and fixes unknown.

          Equations
          Instances For
            Dependency graph
            Dependency graph
            Dependency graph