Re: Proposal: 6NF
Date: 15 Oct 2006 07:39:32 -0700
Message-ID: <1160923172.467697.66570_at_h48g2000cwc.googlegroups.com>
vc wrote:
> Jan Hidders wrote:
> [...]
> > > I am actually puzzled when one sez, be it
> > > Cardelli or anyone else, subtyping is subsetting and then adds
> > > something like "Oh, by the way I am really talking about algebraic
> > > structures, not just arbitrary sets".
> >
> > I said no such thing. The whole point was that there are two ways of
> > defining certain data types, abstract algebraically and by direct
> > construction of the sets. In the second approach subtyping equals
> > subsetting,
>
> There are very many ways, maybe too many ways, to define the type.
You're beginning to sound like an old man. :-)
> The most familiar to the OOP person expectation of what the type is is
> based on the LSP where one can substitute objects of type S for objects
> of type T, S being a subtype of T, without change in behavior.
> Clearly, treating Z as subtype of R does not conform the LSP, because
> Z is not a subfield of R.
Depends on what you think of as the thing that is being defined. Is it
the algebraic structure or is it the set over which the operations are
defined? In the first case you cannot treat the Z algebraic structure
as a subtype of the R algebraic structure, but in the second case you
clearly can. Note that Liskov and Wong themselves defined the principle
as:
Let q(x) be a property provable about objects x of type T. Then q(y)
should be true for objects y of type S where S is a subtype of T.
Clearly this is the case if T is the set of reals and S the set of integers. In fact, I would say this is true iff S is a subset of T.
> Now, one can stipulate that subtype is just a subset (invoking the
> algebraic ghost subsequently in order to amend the R/Z problem would be
> cheating). According to such definition, Z *is* a subtype of R, but
> how useful such observation might be ? Not very much.
It implies LSP.
> > and I've discussed what the corresponding requirement in
> > the algebra setting is.
>
> My objection to that is, as was before, that in the original
> definition of subtypes as subsets there was no 'algebra' word.
Since when can a translation from French to German not be correct because the original text did not contain a word of German?
> >Neither of them is "what I'm really talking
> > about" because both can be valid ways of modelling certain types.
>
> Does the above mean that you agree that 'subtypes as subsets' cannot
> adequately model R/Z, Q/Z, or even Z/N type relationship ?
No.
> > But seriously, what does the order of derivation have to do with
> > direction of subtyping? Surely you are not making the mistake of
> > confusing inheritance, as a relationship that expresses that one thing
> > is constructed in terms of another, with subtyping that expresses a
> > conceptual relationship?
>
> I implicitely used the LSP. What's your subtype definition ? Perhaps
> we should have started with that.
How about we first start with what's a type? :-)
At the right abstraction level LSP and the subset definition are in fact the same. To be more exact, if you're interested in your objects as things that behave in a certain way, and that is how you define them, meaning that two objects are defined as the same iff they behave the same, then the two definitions are equivalent.
- Jan Hidders