dbTalk Databases Forums  

POSSREPs as union types

comp.databases.theory comp.databases.theory


Discuss POSSREPs as union types in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marshall
 
Posts: n/a

Default POSSREPs as union types - 08-30-2009 , 01:07 AM






I had a though about possreps the other day, and I wanted to post
it, for no particular reason. This thought is not much developed,
so don't expect much. :-)

It occurred to me that possreps have a lot in common with union
types. Briefly, a disjoint union is a language construct that permits
a type to consist of disjoint sets of values, each disjoint set having
its own named constructor and constructor arguments.

For example, one could define a binary tree of ints as follows:

type tree = leaf int | branch tree tree;

Meaning a tree is either a leaf with an associated int, or a branch
with a left (sub)tree and right (sub)tree.

Suppose one were to give names to the attributes of the constructors:

type tree = leaf value:int | branch left:tree right:tree;

No big deal.

Suppose I use the classic possrep example, a point with polar
or rectangular coordinates.

type point = polar r:real theta:real | rectangular x:real y:real;

Now suppose I add to the type enough information to describe
the bijection between the two constructors:

type point = polar r:real theta:real | rectangular x:real y:real
where
x = r * cos(theta),
y = r * sin(theta);

(Please allow me to be all handwavey about the r=0 case
so as to focus on the big picture.)

I think that's roughly enough information to be able to
do all the necessary work.

This makes possreps and union types look quite similar
to me. It also gives a clear idea of how to differentiate
between "member functions" that ought to belong
("directly" if you will) to the type, and those that are
less immediately associated: whether or not they
are constructor arguments.

Is it necessary that there always be a bijection
between multiple possreps for a type? If not, how does
one convert between them?


Marshall

Reply With Quote
  #2  
Old   
none
 
Posts: n/a

Default Re: POSSREPs as union types - 08-31-2009 , 03:29 PM






Marshall wrote:

Quote:
I had a though about possreps the other day, and I wanted to post
it, for no particular reason. This thought is not much developed,
so don't expect much. :-)
It would help if you stated your ideas in terms that don't require
the whole-sale purchase of C. Date's books in order to be appreciated.
(This is not intended as a comment on the usefulness of your idea.
Just a comment that I don't have a fucking clue what you're talking about.)

--
Reinier

Reply With Quote
  #3  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: POSSREPs as union types - 09-01-2009 , 09:39 PM



rp (AT) raampje (DOT) (none) (Reinier Post) wrote:

Quote:
Marshall wrote:

I had a though about possreps the other day, and I wanted to post
it, for no particular reason. This thought is not much developed,
so don't expect much. :-)

It would help if you stated your ideas in terms that don't require
the whole-sale purchase of C. Date's books in order to be appreciated.
(This is not intended as a comment on the usefulness of your idea.
Just a comment that I don't have a fucking clue what you're talking about.)
Well, then you probably ought to read a book or two.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Reply With Quote
  #4  
Old   
none
 
Posts: n/a

Default Re: POSSREPs as union types - 09-02-2009 , 04:51 PM



Gene Wirchenko wrote:

Quote:
rp (AT) raampje (DOT) (none) (Reinier Post) wrote:

Marshall wrote:

I had a though about possreps the other day, and I wanted to post
it, for no particular reason. This thought is not much developed,
so don't expect much. :-)

It would help if you stated your ideas in terms that don't require
the whole-sale purchase of C. Date's books in order to be appreciated.
(This is not intended as a comment on the usefulness of your idea.
Just a comment that I don't have a fucking clue what you're talking about.)

Well, then you probably ought to read a book or two.
I have. I'm not impressed with their overall quality.

--
Reinier

Reply With Quote
  #5  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: POSSREPs as union types - 09-02-2009 , 05:42 PM



rp (AT) raampje (DOT) (none) (Reinier Post) wrote:

Quote:
Gene Wirchenko wrote:

rp (AT) raampje (DOT) (none) (Reinier Post) wrote:

Marshall wrote:

I had a though about possreps the other day, and I wanted to post
it, for no particular reason. This thought is not much developed,
so don't expect much. :-)

It would help if you stated your ideas in terms that don't require
the whole-sale purchase of C. Date's books in order to be appreciated.
(This is not intended as a comment on the usefulness of your idea.
Just a comment that I don't have a fucking clue what you're talking about.)

Well, then you probably ought to read a book or two.

I have. I'm not impressed with their overall quality.
What? So bad that you could not even pick up a few definitions?

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Reply With Quote
  #6  
Old   
compdb@hotmail.com
 
Posts: n/a

Default Re: POSSREPs as union types - 09-03-2009 , 03:22 PM



Marshall,

In Date and Darwen's The Third Manifesto a type is a named set of
values. A possrep (possible representation) maps a subset of a
cartesian product (namely those that satisfy the possrep constraint)
to values of the type. Two cartesian tuples can map to the same
value. A selector invocation (a possrep name with arguments) maps
its arguments as a cartesian tuple to the corresponding value.

On Aug 29, 11:07 pm, Marshall <marshall.spi... (AT) gmail (DOT) com> wrote:

Quote:
It occurred to me that possreps have a lot in common with union
types.
In Plain Ol' Data, the different constituent types of a union type
are
disjoint. That's not like possreps, where each possrep of a type runs
the gamut of values of that type.

Also, in typical recursive type definitions all the values of each
specified form are distinct. Not like possreps. And often they're all
legal. Not like possreps. And most importantly values with different
tags are distinct. Not like possreps.

Quote:
type tree = leaf int | branch tree tree;
Is there a particular language where this is considered a union type
definiton?

Classical union type definitions reference other existing types and
only introduce the union type. Classical recursive type definitions
introduce distinct values with tags (ie leaf & branch), but only a
single type (ie tree). But a language could interpret this recursive
definition of tree as also introducing types leaf and branch. So I
can
see how it could be considered to include a union type definition in
the classical sense.

Note that in this definition leaf values are distinct from branch
values.

Quote:
type point = polar r:real theta:real | rectangular x:real y:real;
If this is a double possrep definition, the two sets of values, polar
and rectangular, are by definition the same set. Namely the set of
point values. This is not like your previous example (or classical
union types). This does not define distinct polar and rectangular
value sets.

Quote:
Is it necessary that there always be a bijection
between multiple possreps for a type?
If you mean between their cartesian products, no, because a possrep
can involve only some of the cartesian tuples.

If you mean between legal selector invocations, no, because two
cartesian tuples can map to the same value.

But if all of a type's possreps' legal selector invocations are in
bijection with its values then there is a bijection between legal
selector
invocations for different possreps, because you can map between
two selector invocations via their value.

Quote:
If not, how does
one convert between them?
One defines each selector and equality in terms of the actual
representation and/or other possreps.

I don't know what the "them" are that you want to convert between.
Selector invocations denote values of their return type. The
alternatives do not define different value sets, they denote the same
value set.

Quote:
This makes possreps and union types look quite similar
to me.
Your tree example is interpreted differently than your point example,
since the alternate value sets are disjoint in the former but equal
in
the latter. Presumably syntax would distinguish them. But even if
the rest of the syntax were similar the semantics would still be
different.

Quote:
It also gives a clear idea of how to differentiate
between "member functions" that ought to belong
("directly" if you will) to the type, and those that are
less immediately associated: whether or not they
are constructor arguments.
The only association of operators and types in TTM is via signatures
(parameter and return types) with subtyping (of parameter types)
(other than those further implied by an operator being a selector or
equality). Operators do not "belong to" types. Unless you consider an
operator to "belong to" all the distinct declared types of its
parameters (and return type?). But such a statement of belonging is
just peculiar wording for giving some essentially useless
information:
that (per that definition) a given operator has given distinct
declared
types.

philip

Reply With Quote
  #7  
Old   
compdb@hotmail.com
 
Posts: n/a

Default Re: POSSREPs as union types - 09-04-2009 , 02:55 PM



Please ignore all mention of "cartesian" in my last message.

On Sep 3, 1:22*pm, com... (AT) hotmail (DOT) com wrote:
Quote:
A possrep (possible representation) maps a subset of a
cartesian product (namely those that satisfy the possrep constraint)
to values of the type. Two cartesian tuples can map to the same
value. A selector invocation (a possrep name with arguments) maps
its arguments as a cartesian tuple to the corresponding value.
I should have said:
A possrep (possible representation) maps a subset of a
tuple type (namely those that satisfy the possrep constraint)
to values. Two tuples can map to the same
value. A selector invocation (a possrep name with arguments) maps
its arguments as a tuple to the corresponding value.

philip

Reply With Quote
  #8  
Old   
Bob Badour
 
Posts: n/a

Default Re: POSSREPs as union types - 09-04-2009 , 03:01 PM



compdb (AT) hotmail (DOT) com wrote:

Quote:
Please ignore all mention of "cartesian" in my last message.

On Sep 3, 1:22 pm, com... (AT) hotmail (DOT) com wrote:

A possrep (possible representation) maps a subset of a
cartesian product (namely those that satisfy the possrep constraint)
to values of the type. Two cartesian tuples can map to the same
value. A selector invocation (a possrep name with arguments) maps
its arguments as a cartesian tuple to the corresponding value.

I should have said:
A possrep (possible representation) maps a subset of a
tuple type (namely those that satisfy the possrep constraint)
to values. Two tuples can map to the same
value.
Tuples are values -- no mapping required. In the situation you describe,
two representations represent the same value.

Reply With Quote
  #9  
Old   
compdb@hotmail.com
 
Posts: n/a

Default Re: POSSREPs as union types - 09-05-2009 , 06:23 PM



On Sep 4, 1:01 pm, Bob Badour <bbad... (AT) pei (DOT) sympatico.ca> wrote:
Quote:
com... (AT) hotmail (DOT) com wrote:
On Sep 3, 1:22 pm, com... (AT) hotmail (DOT) com wrote:
A possrep (possible representation) maps a subset of a
tuple type (namely those that satisfy the possrep constraint)
to values. Two tuples can map to the same
value.

Tuples are values -- no mapping required. In the situation you describe,
two representations represent the same value.
Sorry, it's not clear to me what you mean.

In TTM a possrep maps ordered components to a value.
This is why I originally used cartesian tuples.
But TTM also requires names for the components.
So I changed to (plain) tuples (with named elements) ("no big deal").

I was using "value" to mean represented value
(of the type represented by a given possrep)
and "tuple" to mean representing tuple
(of possrep components or selector invocation arguments).
I characterized a possrep as a mapping from
representing tuple to represented value.

philip

Reply With Quote
  #10  
Old   
none
 
Posts: n/a

Default Re: POSSREPs as union types - 09-06-2009 , 08:42 AM



Gene Wirchenko wrote:

Quote:
What? So bad that you could not even pick up a few definitions?
POSSREP wasn't defined in them. Google Books has fragments of a book by Date
that mentions POSSREPs. It says: for a formal treatment, see reference [number].
But the reference list is not included.

That is the problem I was referring to.
Fortunately Paul has explained the term.

--
Reinier

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.