Re: Proposal: 6NF

From: vc <boston103_at_hotmail.com>
Date: 15 Oct 2006 09:18:09 -0700
Message-ID: <1160929089.285618.172910_at_i42g2000cwa.googlegroups.com>


Jan Hidders wrote:
> vc wrote:

[...]
> > 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.

Hold on.

o The set plus some operations over the the set *is* an algebraic structure so there is no substantial difference between case one and case two. Once again, this is an example of imprecise language which one would want to avoid (saying 'set' and meaning 'structure').

o In rthe second case, if you want to say that you take a set of real numbers (which, in fact, is not just a set but an agebraic structure, a field) and arbitrarily excise the division operation in order to make it fit the "subset as subtype" mold, then the new bastartdized thing is not a set of reals any more but some structure that you've made to satisfy the LSP.

> 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.

Clearly, it is not because objects of the integer type do not have the division 'method' which its parent real type has, as simple as that, unless you deform the type of reals by excising division. The LSP does not mean that there exists a property that should but rather that all the properties should, as otherwise how would the substitution be possible ?

> 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.

Well, it does not simply because a naked set has no interesting properties except perhaps its cardinality.

>
> > >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.

So we are back to where we started from, how do you substitute objects of the integer type for objects of the real type in an expression like x/y ?

[...]
> 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.

What about 'integer' division as part of such behavior ?

>
> -- Jan Hidders
Received on Sun Oct 15 2006 - 18:18:09 CEST

Original text of this message