Re: Codd and many-valued logics

From: Nicola <nvitacolonna_at_gmail.com>
Date: Fri, 3 Jun 2016 16:25:41 +0200
Message-ID: <nis415$oic$1_at_adenine.netfront.net>


On 2016-06-03 13:56:09 +0000, Tegiri Nenashi said:

> On Friday, June 3, 2016 at 12:51:14 AM UTC-7, Nicola wrote:

>> From a theoretical point of view, though, one may legitimately> wonder 
>> about the relationship between SQL with nulls and 3VLs in the> same way 
>> as we know the relationship between SQL without nulls and> classical 
>> logic, at least for a fragment of SQL.

> Is there a connection between SQL with nulls and 3VLs? The former is
> about peculiar values in the domain, and the later is about extra
> logical value. 3VL has been introduced for propositional logic, and has
> been extended to predicate calculus. The straightforward interpretation
> of 3VL in terms of relations and tuples would be tuples equipped with
> weights which are 3 valued (either tuple is member of a relation, or
> tuple not belonging to relation, tuple is fuzzy member of the set).
> This is different from SQL where tuples have some omitted values
> (nulls) but their membership in the set is sharp (not fuzzy).

In fact, SQL's semantics is a mix of two- and three-valued logic. A mix of this kind is present in Bochvar's internal/external system, although the semantics of Bochvar's logic does not match SQL's.

Membership is not sharp in SQL. SQL closely follows Codd's first proposal, so the truth value of expressions like 'null belongs to S' and '{null} is a subset of S' is 'unknown' (which SQL represents with 'null') when S is a non-empty unary relation. Try the following queries in your favourite (standard-compliant) DBMS:

select null in (1);
select null in (null);

and also:

select 0 not in (null,1);

Then, SQL collapses 'unknown' to 'false', e.g., in where clauses (this is one of the “resolution rules” mentioned by Celko, I think).

Nicola

Received on Fri Jun 03 2016 - 16:25:41 CEST

Original text of this message