Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Database Design
»
Relational Theory
»
The Logic, Mathematics, and Utility of NULLs
68 posts, Page 7 of 7
««
«
3
4
5
6
7
The Logic, Mathematics, and Utility of NULLs
Rate Topic
Display Mode
Topic Options
Author
Message
mtillman921105
mtillman921105
Posted Wednesday, September 08, 2010 4:33 PM
Right there with Babe
Group: General Forum Members
Last Login: Tuesday, February 25, 2014 8:59 AM
Points: 754,
Visits: 3,813
Since I've made that distinction, one aspect of logic and unknowns has become clear to me, although I'm thinking outloud some here...
Logic divides arguments into subjects and predicates. A column is usually the subject in a table, and the value for each row the predicate. So, you have a Car table, one of the columns is MPG. For a row, a number 27 in the MPG column would describe the gas mileage of that particular make and model of car for example. The value in the rows become the predicates.
In logic, if one of the values is missing, we simply do not make the claim
: "This car gets x MPG" is not very useful, is it?
So in logic, the whole sentence is avoided, which actually makes more sense. In programming on the other hand, it is as if we assume that a value must be there.
______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.  Stephen Hawking
Post #982719
TomThomson
TomThomson
Posted Friday, September 10, 2010 4:01 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:37 AM
Points: 8,287,
Visits: 8,738
mtillman921105 (9/8/2010)
In the first post, it says that NULLs are, in effect, in logic and in algebra. But notice that we should be more careful about that since logic can only use BOOLEAN types.
Noone who has seriously studied logic in the 20th or 21st century believes that  and the idea of 3valued logic started a couple of thousand years ago with Aristotle (who asserted that there were exceptions to the principle of bivalence despite numerous mumbojumbo artists claiming that he was responsible for promoting that principle).
If you have NULLs in a relational system you had better not have a 2valued logic as the logic component of your relational calculus, because the combination just doesn't work.
A large number of mathematicians prefer to work using "constructive logic" which doesn't just have one or a couple more truth values than "true" and "false", but which has no models in which the cardinality of the set of truth values is as small as the cardinality of the set of all integers. "Fuzzy logic" is another logic with an infinite set of truth values. These things are used for good reasons  so don't assume that a 2valued logic is enough.
Tom
Post #984176
mtillman921105
mtillman921105
Posted Friday, September 10, 2010 4:28 PM
Right there with Babe
Group: General Forum Members
Last Login: Tuesday, February 25, 2014 8:59 AM
Points: 754,
Visits: 3,813
Tom.Thomson (9/10/2010)
mtillman921105 (9/8/2010)
In the first post, it says that NULLs are, in effect, in logic and in algebra. But notice that we should be more careful about that since logic can only use BOOLEAN types.
Noone who has seriously studied logic in the 20th or 21st century believes that  and the idea of 3valued logic started a couple of thousand years ago with Aristotle (who asserted that there were exceptions to the principle of bivalence despite numerous mumbojumbo artists claiming that he was responsible for promoting that principle).
If you have NULLs in a relational system you had better not have a 2valued logic as the logic component of your relational calculus, because the combination just doesn't work.
A large number of mathematicians prefer to work using "constructive logic" which doesn't just have one or a couple more truth values than "true" and "false", but which has no models in which the cardinality of the set of truth values is as small as the cardinality of the set of all integers. "Fuzzy logic" is another logic with an infinite set of truth values. These things are used for good reasons  so don't assume that a 2valued logic is enough.
All right Tom, I like your take on this, but I'm actually not convinced. I'm kindof playing the devil's advocate now, but here it goes:
People usually reason with the law of the excluded middle intact. That is, if p is true, then NOT P is false. To give a simple example for those who are not used to talking logic, either apples are a fruit or apples are not a fruit. So a or ~a, period. Both or neither is not a possibility. Allowing NULLs creates a whole new plain  an apple is neither a fruit nor not a fruit? (This may be somewhat oversimplified, but this is the gist of it.)
When NULLs are introduced, SQL logic becomes counterintuitive and creates a big, confusing mess.
By the way, I read that a sort of 3VL also came up when the "Cancel" option was added in Windows  so the options were "Yes", "No", or "Cancel."
So apparently DBMS are not alone in this.
______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.  Stephen Hawking
Post #984188
TomThomson
TomThomson
Posted Friday, September 10, 2010 8:22 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:37 AM
Points: 8,287,
Visits: 8,738
mtillman921105 (9/8/2010)
Logic divides arguments into subjects and predicates. A column is usually the subject in a table, and the value for each row the predicate. So, you have a Car table, one of the columns is MPG. For a row, a number 27 in the MPG column would describe the gas mileage of that particular make and model of car for example. The value in the rows become the predicates.
In logic, if one of the values is missing, we simply do not make the claim
: "This car gets x MPG" is not very useful, is it?
So in logic, the whole sentence is avoided, which actually makes more sense. In programming on the other hand, it is as if we assume that a value must be there.
I'm not sure about that use of "predicate" but that's just terminology so who cares.
Not making the claim  I agree with that. What we see in SQL is something like "where mpg > 26"  and if the database has NULL for the mpg column for a particular row it is not making any claim (other that "I don't have any value for the mpg for this row") about mpg for that row. It's not a question we can avoid though  someone is going to make that query  so all the database can say is " I don't have a value so I can't tell you whether it's greater than 26 or not": in other words, the database's answer for "is it greater than 26" isn't "Yes" and it isn't "No", it's "I haven't a clue". So it has to work in (at least) a threevalued logic, with the three values "True", "False", and "I Don't know".
"It is as if we can assume the value must be there" is a place where lots of people go wrong: we can't make that assumption, it's just nonsense. (I think I'm agreeing with you here.)
The rest of this comment is a [n ex] mathematical logician's take on Codd's work on having two sorts of NULL. Don't read it if you want to stick in the real world instead of in speculative mathematical theory.
In databases with more than one type of NULL this can get quite messy: if we look at Codd's NULLi and NULLa, we find one version where NULLi means "known to be inapplicable" and NULLa means "don't have a value and don't know why"; then there's another version where NULLa means "we don't have a value but we know it's applicable" and NULLi means "we don't have a value because it's inapplicable" (so there's no way of covering the case "we don't know whether it's applicable or not"; Codd fans  including me, I have to admit,  tend to forget about this gap in that version, which is the version in RM version 2, and prefer either his other version of his 2NULL system or his 1NULL system, which is what SQL attempted to implememt and failed). The reason for the RM2 version was that Codd wanted to be able to reason about some of the cases where it was known that a value was applicable: for example a proposition like "NULLa < 0 or NULL >= 0" is guaranteed to be True when NULLa is a marker for a missing value from the integer domain provided NULL_a is guaranteed to signal an applicable value (and, in Codd's RM2 system, if I'm remembering correctly, "NULLi < 0 or NULLi >= 0" was guaranteed to be "False", while "NULLi < NULLi or NULLi >= NULLi" was none of "True", "False" or "Unknown" but had a fourth truth value "Inapplicable"). All the stuff about the relational calculus engine needing to detect tautologies could be discarded if there were no version of NULL which offered a guarantee of applicability, as could the fourth truth value in the logic component of the relational calculus; and the RM2 gap in absentvalue coverage would disappear; of course the basic problem in the RM2 NULLs can also be fixed by introducing a 3rd NULL (to cover the "we don't even know whether it's applicable" case) and keeping RM2's 4 truth values, but doing that would leave the question of tautology detection still a valid one. But of course there's no imaginable way that Date's nonsense about needing an unbounded set of NULLs as soon as one goes to two can be justified.
Tom
Post #984239
RBarryYoung
RBarryYoung
Posted Wednesday, September 15, 2010 4:02 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Friday, March 28, 2014 2:25 PM
Points: 9,902,
Visits: 9,479
Tom.Thomson (9/10/2010)
...
The rest of this comment is a [n ex] mathematical logician's take on Codd's work on having two sorts of NULL. Don't read it if you want to stick in the ...
In databases with more than one type of NULL this can get quite messy: if we look at Codd's NULLi and
NULLa
, we find one version ...
Heh, he. You said
NullA
, ha.(*)
(*  obscure A. E. Van Vogt reference...)
 RBarryYoung
,
(302)3750451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #986759
mtillman921105
mtillman921105
Posted Wednesday, September 15, 2010 4:34 PM
Right there with Babe
Group: General Forum Members
Last Login: Tuesday, February 25, 2014 8:59 AM
Points: 754,
Visits: 3,813
RBarryYoung (9/15/2010)
Tom.Thomson (9/10/2010)
...
The rest of this comment is a [n ex] mathematical logician's take on Codd's work on having two sorts of NULL. Don't read it if you want to stick in the ...
In databases with more than one type of NULL this can get quite messy: if we look at Codd's NULLi and
NULLa
, we find one version ...
Heh, he. You said
NullA
, ha.(*)
(*  obscure A. E. Van Vogt reference...)
Actually, did you know that NULL is an elegant computer language too?
http://baetzler.de/humor/null.html
______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.  Stephen Hawking
Post #986778
TomThomson
TomThomson
Posted Wednesday, September 15, 2010 6:13 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:37 AM
Points: 8,287,
Visits: 8,738
RBarryYoung (9/15/2010)
Heh, he. You said
NullA
, ha.(*)
(*  obscure A. E. Van Vogt reference...)
What's obscure about it? The Pawns of NullA was his second best book (by my counting The Weapon Shops of Isher was the best).
There's a problem with the term NULLA in that book: nonAristotelian is a pretty ambiguous (actually not ambiguous, because there are 3 possible meanings, not 2
) term which has been used to mean (a) disagreeing with Aristotle and accepting the principle of bivalence, (b) disagreeing with Aristotle and rejecting the principle of bivalence, and (c) agreeing with Aristotle but disagreeing with the idiots who use it to mean either (a) or (b) because they think that the principle of bivalence is the only thing that matters in logic. I guess Van Vogt's use of the term was with meaning (c), because he was a fan of Korzybski who was clearly a proponent of (c).
But of course the use of "NULLa" (or, in some papers, just "a") in relational calculi has no real connection with its use by Van Vogt.
Tom
Post #986814
TomThomson
TomThomson
Posted Wednesday, September 15, 2010 6:18 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 8:37 AM
Points: 8,287,
Visits: 8,738
mtillman921105 (9/15/2010)
Actually, did you know that NULL is an elegant computer language too?
http://baetzler.de/humor/null.html
The trouble with Andrews' presentation of the language is that he doesn't mention its principle advantage: that no programme in NULL can contain a bug.
Tom
Post #986818
« Prev Topic

Next Topic »
68 posts, Page 7 of 7
««
«
3
4
5
6
7
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 20022014 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.