Re: Proposal: 6NF

From: Jan Hidders <hidders_at_gmail.com>
Date: 16 Oct 2006 04:18:41 -0700
Message-ID: <1160997521.137113.74950_at_e3g2000cwe.googlegroups.com>


vc wrote:
> 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.

Ok. I'm holding 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').

When I say "the set of integers" I mean "the set of integers" and not "the set of integers plus some operations" which is a tuple and not a set. I get the impression that every time I write "the set of X" you actually read "the algebraic structure that descibes X", which might explain why you think I'm being imprecise. If I understand you correctly you don't accept that "the set of X" is actually a meaningful concept? Correct?

If that is the case then let us concentrate on that question. Agreed?

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

I don't think that is clear, at all, and in fact I think your argument is actually circular. If we consider the two algebraic structures (R,+,x,/, ..) and (Z,+,x, ..) and if we assume that Z is a subset of R then there *is* a division operation for the elements in Z, namely the one you find in the algebraic structure of R. Now your argument seems to be based on the assumption that the sets R and Z are distinct, in which case it is not very surprising that this leads to the conclusion that Z cannot be a subset of R.

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

Right, that's were we disagree and probably related to the central issue I mentioned earlier. I would say that the elements of these sets have lots of interesting properties, such as theire representation as a string. Just because this set is left abstract in the algebraic structure doesn't mean it cannot have other properties. I could for example define the sets of integers and the set of floating point numbers as equivalence classes over possible string representations.

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

What would be the problem? If the result of 2.0 / 3.0 is well defined, then what is problematic about the claim that the result of 2 / 3 is well defined and in fact the same?

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

You mean "idiv"? It would probably only be defined for integers.

  • Jan Hidders
Received on Mon Oct 16 2006 - 13:18:41 CEST

Original text of this message