Re: A Logical Model for Lists as Relations
Date: Thu, 11 May 2006 23:42:43 GMT
Message-ID: <TZP8g.23847$YI5.8121_at_tornado.ohiordc.rr.com>
vc wrote:
> Jay Dee wrote:
>
>> >>I think not. Relations are sets, lists aren't. >> > >> > Of course lists are sets plus the 'cons' operation. >> >>I suspect we're stumbling into differing conventional definitions >>rather than fundamental differences. In my mind, a list may >>hold duplicates, while a set may not. [More follows.] Too, my >>reading of MS's post led me to think position in the list was >>significant. >> >>Maybe that's covered in your theory of lists -- plus the 'cons' >>operation -- but not in mine.
>
>
> What 'theory of lists' do you have in mind ? Lists are a simple
> recursive data type defined by something like this:
>
> data List a = Nil | Cons a (List a)
>
> Naturals can also be considered a similar recursive data structure
> defined by:
>
> data Nat = Zero | Succ Nat
Others might write `0, nat+1: nat'
>>See, I probably grok a successor operator, maybe a nil operator, but >>I'm not tracking cons and am not sure why zero and nil differ.
>
> You do not know what the difference between the number zero and the
> empty list (Nil) is ?
The empty bunch is null and the empty set is {null}.
Strings consist of items which may be any boolean, number, character,
non-empty bunch, or set. Strings are catenated with ; (semicolon).
So
17; 42; A; 17
Lists are to strings as sets are to bunches.
17; 42; A; 17 is a string
Empty strings and empty lists? Call 'em nil and [nil].
is a string of length 4. Items in a string can be referred to by
their 0-origin ordinal position. Ordering is defined as lexical and
the < = > &c operators are defined. Indexing? You bet! Slicing?
Of course!
Catenation can be defined on lists:
[A] + [B] = [A; B]
So can mapping, composition, &c -- all it takes is definition.
There's really nothing in any of this that's revolutionary or new; everything, to some extent or another, has been made manifest in other disciplines/languages/notations/whatever. It's simply unfortunate that our language prevents us from understanding each other.
[I was wrong when I earlier said that MS needed bunches rather than
lists. He needs lists to represent lists and, as BB and VT pointed
out, they are readily accommodated in RM as relations. But, you
know, I wasn't sure what MS meant when he said "list."]
RM has its own scheme: everything in RM is of type boolean, other
scalar, tuple, or relation. That "other scalar" is where we can
put any of the things referred to here -- as well as many things
that haven't been mentioned.