comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: Is T an ancestor of T?
Date: Fri, 22 Oct 2004 02:27:26 +0000 (UTC)
Date: 2004-10-22T02:27:26+00:00	[thread overview]
Message-ID: <cl9r6e$ae1$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: hBCdd.6699$d5.56164@newsb.telia.net

Bj�rn Persson <spam-away@nowhere.nil> wrote:
: Georg Bauhaus wrote:
: 
:> So we know there is exactly one ultimate ancestor for each type T.
:> If T is at the root of a derivation hierarchy of height 0,
:> is there a named type that is the ultimate ancestor of T?
:> Is it T? By 10.d I would say yes.
: 
: Yes.
: 
:> By the last sentence of (10),
:> the ultimate ancestor (T) "is not a descendant of any other type".
:> So if T is the ultimate ancestor, it is not a descendant of T.
:> Which it is by the first sentence of (10).
:> I must be missing something. Specific types?
: 
: Maybe it's the word "other" you're missing?

I don't speak English.  Is there a mix of defined (linguistic)
"ambiguity" (T descends from itself) and assumed clarity of "other"
in this paragraph? (Is there a well defined mathematical meaning of
"other" in general, not just in paragraph 3.4.1(10)? What is the set
of "not any other types"?)

Adding to the quote from Douglas Adams about the descendence
issue, here is one that I remembered when I thought about
"other" once more. It is by M. Kline, and is quoted in some other
book, so I don't know the reference details.

"When a twelfth century youth fell in love he did not take three paces
backward, gaze into her eyes, and tell her she was too beautiful to
live.  He said he would step outside and see about it.  And if, when
he got out, he met a man and broke his head--the other man's head, I
mean--then that proved that his--the firsts fellow's--girl was a
pretty girl. But if the other fellow broke _his_ head--not his own,
you know, but the other fellow's--the other fellow to the second
fellow, that is, because of course the other fellow would only be the
other fellow to him, not the first fellow who--well if he broke his
head, then _his_ girl--not the other fellow's, but the fellow who was
the--Look here, if A broke B's head, then A's girl was a pretty girl;
but if B broke A's head, then A's girl wasn't a pretty girl, but B's
girl was."

I think the issue (or my problem if you wish) might have to do with the
non-natural semantics of mathematical usage (descendant of self etc ...).
Here is one that has caused headaches many times (it's even reported
in well know standard works of math "basics", like in Halmos'). "It"
has also caused an internal assertion failure in ObjectAda when I
"misspelled" part of the following procedure, writing some text that
was not an extension aggregate ;-)
In one of my favorite programming books the authors tell their readers
that a datatype shish_kebab =
Skewer
| Onion of shish_kebab
| Lamb of shish_kebab
| Tomato of shish_kebab.

They go on that if you have just a Skewer, there are only Onions on
this particular shish_kebab which is just a Skewer. Well... There are
no Onions at all and therefore there are only Onions on a shish_kebab?
(Felleisen/Friedman, The Little MLer, Sec. 2) Anyway,


with Answer;  use Answer;

procedure answer_test is

begin

   if
     true = only_onions(Skewer'
                        (null record)) and

     true = only_onions(Onion'
                        (on => new Skewer)) and

     not true = only_onions(Lamb'
                            (on => new Skewer)) and

     not true = only_onions(Onion'
                            (on => new Lamb'
                             (on => new Onion'
                              (on => new Skewer))))
   then
      raise Mathematical_Reasoning;
   end if;

end answer_test;



package Answer is


   type Skewer is tagged null record;
   type Shish_Kebab is access all Skewer'class;

   function only_onions (s: Skewer) return Boolean;

   type Onion (on: Shish_Kebab) is new Skewer with null record;
   function only_onions (s: Onion) return Boolean;

   type Lamb (on: Shish_Kebab) is new Skewer with null record;
   function only_onions (s: Lamb) return Boolean;

   type Tomato (on: Shish_Kebab) is new Skewer with null record;
   function only_onions (s: Tomato) return Boolean;

end Answer;


package body Answer is


   function only_onions (s: Skewer) return Boolean is
   begin
      return true;
   end only_onions;


   function only_onions (s: Onion) return Boolean is
   begin
      return only_onions(s.on.all);
   end only_onions;


   function only_onions (s: Lamb) return Boolean is
   begin
      return false;
   end only_onions;


   function only_onions (s: Tomato) return Boolean is
   begin
      return false;
   end only_onions;

end Answer;

-- Georg Bauhaus

 
: By the way, did you notice that class-wide types aren't ancestors or 
: descendants of themselves?

Yes, and class-wide types don't have parents or ancestors at all,
do they?



  reply	other threads:[~2004-10-22  2:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18  5:55 Is T an ancestor of T? Christoph Karl Walter Grein
2004-10-20 14:02 ` Georg Bauhaus
2004-10-20 16:18   ` Björn Persson
2004-10-20 21:41     ` Georg Bauhaus
2004-10-20 23:33       ` Björn Persson
2004-10-22  2:27         ` Georg Bauhaus [this message]
2004-10-23 16:55           ` Björn Persson
2004-10-26  0:37             ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2004-10-12  1:31 record extension aggregate for returned type legal? Georg Bauhaus
2004-10-12  8:04 ` Martin Krischik
2004-10-12 14:36   ` Georg Bauhaus
     [not found]     ` <1940150.rU8f1KaX3L@linux1.krischik.com>
2004-10-12 20:24       ` Georg Bauhaus
2004-10-13  7:52         ` Martin Krischik
     [not found]           ` <ckjlhm$2hh$1@a1-hrz.uni-duisburg.de>
     [not found]             ` <ukhbd.106086$dP1.396181@newsc.telia.net>
2004-10-14  0:29               ` Is T an ancestor of T? Georg Bauhaus
2004-10-14  8:54             ` Is T an ancestor of T? (was: Re: record extension aggregate for returned type legal?) Martin Krischik
     [not found]               ` <ckot3m$hek$1@a1-hrz.uni-duisburg.de>
2004-10-15 16:55                 ` Is T an ancestor of T? Martin Krischik
2004-10-15 17:19                   ` Georg Bauhaus
2004-10-16 14:37                     ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox