![]() | |
![]() |
| | Thread Tools | Display Modes |
#41
| |||
| |||
|
|
On 20 feb, 03:40, David BL <davi... (AT) iinet (DOT) net.au> wrote: I agree this provides some motivation, but it doesn't seem sufficient justification to "conflate" concerns (as Bob says). The crucial point is this: The attribute domains are part of the relation-type, whereas the attribute names are part of the relation-value. What happens with your suggestion? |
|
It's very important to keep a clear separation between a value and its declared type, in order to understand equality. Your suggestion ends up conflating relation-type and relation-value. How do you support sub-typing of relation-types according to sub- typing of the attribute domains, and still allow for addressing the attributes by type name? That's actually no problem at all. The formal definition of a relation type / relation header in Keith's approach would be a set of types (*). For those types you can define a subtyping relation as follows: a relation header H1 is said to be a subtype of H2 if for every type in R2 there is a subtype in R1. It's even possible to have a matching semantics with that that follows the subtype=subset principle. So no notion of coercion is really needed here. (*) Note there would / should be an additional requirement that a header can only contain incomparable types, i.e., it cannot contain t1 and t2 such that t1 is a proper subtype of t2. |
#42
| |||
| |||
|
|
As for having just types, I still think that Codd introduced his attribute names because of relations that can have two 'columns' of the same type. I think Keith D is arguing against this and if I'm right about that, I'd like him to deal with that case, not to say it can't be done, just that I'd like to see whether his "copy" in a language is a better tool. |
#43
| |||
| |||
|
|
On Feb 21, 8:10 pm, paul c <toledobythe... (AT) oohay (DOT) ac> wrote: As for having just types, I still think that Codd introduced his attribute names because of relations that can have two 'columns' of the same type. I think Keith D is arguing against this and if I'm right about that, I'd like him to deal with that case, not to say it can't be done, just that I'd like to see whether his "copy" in a language is a better tool. How about we do some concrete exercises then? Please provide your favorite example of some relations with attributes having the same type along with some associated code operating on those relations. Then I will convert the {(name,type)} system example into a {type} only system so we can compare. KHD |
#44
| |||
| |||
|
|
While I sympathize with Keith D's wish to eliminate the 'name,type' double, I think that practical issues require not only so-called 'possreps' but also what I think of as a 'name,type,use' triples. What a mess! |
#45
| |||
| |||
|
|
On Feb 21, 7:05 pm, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: On 20 feb, 03:40, David BL <davi... (AT) iinet (DOT) net.au> wrote: I agree this provides some motivation, but it doesn't seem sufficient justification to "conflate" concerns (as Bob says). *The crucial point is this: *The attribute domains are part of the relation-type, whereas the attribute names are part of the relation-value. *What happens with your suggestion? I got that wrong. *I should have said: The crucial point is this: *Whereas both the declared attribute names and attribute domains are part of the relation-type, only the attribute names are part of the relation-value. It's very important to keep a clear separation between a value and its declared type, in order to understand equality. *Your suggestion ends up conflating relation-type and relation-value. How do you support sub-typing of relation-types according to sub- typing of the attribute domains, and still allow for addressing the attributes by type name? That's actually no problem at all. The formal definition of a relation type / relation header in Keith's approach would be a set of types (*). For those types you can define a subtyping relation as follows: a relation header H1 is said to be a subtype of H2 if for every type in R2 there is a subtype in R1. It's even possible to have a matching semantics with that that follows the subtype=subset principle. So no notion of coercion is really needed here. (*) Note there would / should be an additional requirement that a header can only contain incomparable types, i.e., it cannot contain t1 and t2 such that t1 is a proper subtype of t2. There is a problem. Let's write t1 <= t2 if t1 is a subtype of t2 (let this include the case t1 = t2). Definition: header H is valid if for all t1,t2 in H, * t1 <= t2 * *implies * t1 = t2. (this is your "additional requirement") Definition: *H1 <= H2 if * exists bijection f from H1 to H2 * * such that for each t in H1, t <= f(t). |
|
[...] Ambiguity in the bijection is incompatible with the subtype = subset principle. *So multiple inheritance throws a spanner in the works. *The only way to salvage the situation is to require the bijection be unique (so in the above example it is deemed that H1 is not a subtype of H2). *However I find this gratuitous at best. |
#46
| |||
| |||
|
|
On Feb 21, 8:10 pm, paul c <toledobythe... (AT) oohay (DOT) ac> wrote: As for having just types, I still think that Codd introduced his attribute names because of relations that can have two 'columns' of the same type. I think Keith D is arguing against this and if I'm right about that, I'd like him to deal with that case, not to say it can't be done, just that I'd like to see whether his "copy" in a language is a better tool. How about we do some concrete exercises then? Please provide your favorite example of some relations with attributes having the same type along with some associated code operating on those relations. |
#47
| |||
| |||
|
|
On 22 feb, 03:40, David BL <davi... (AT) iinet (DOT) net.au> wrote: On Feb 21, 7:05 pm, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: On 20 feb, 03:40, David BL <davi... (AT) iinet (DOT) net.au> wrote: I agree this provides some motivation, but it doesn't seem sufficient justification to "conflate" concerns (as Bob says). *The crucial point is this: *The attribute domains are part of the relation-type, whereas the attribute names are part of the relation-value. *What happenswith your suggestion? I got that wrong. *I should have said: The crucial point is this: *Whereas both the declared attribute names and attribute domains are part of the relation-type, only the attribute names are part of the relation-value. It's very important to keep a clear separation between a value and its declared type, in order to understand equality. *Your suggestion ends up conflating relation-type and relation-value. How do you support sub-typing of relation-types according to sub- typing of the attribute domains, and still allow for addressing the attributes by type name? That's actually no problem at all. The formal definition of a relation type / relation header in Keith's approach would be a set of types (*). For those types you can define a subtyping relation as follows: a relation header H1 is said to be a subtype of H2 if for every type in R2 there is a subtype in R1. It's even possible to have a matching semantics with that that follows the subtype=subset principle. So no notion of coercion is really needed here. (*) Note there would / should be an additional requirement that a header can only contain incomparable types, i.e., it cannot contain t1 and t2 such that t1 is a proper subtype of t2. There is a problem. Let's write t1 <= t2 if t1 is a subtype of t2 (let this include the case t1 = t2). Definition: header H is valid if for all t1,t2 in H, * t1 <= t2 * *implies * t1 = t2. (this is your "additional requirement") Definition: *H1 <= H2 if * exists bijection f from H1 to H2 * * such that for each t in H1, t <= f(t). That was not my definition. It would be: *Definition: *H1 <= H2 if ** exists a function f : H2 -> H1 ** * such that for each t in H2, f(t) <= t. Note the direction of f. But also this function is not unique, and yes, I do think that this is a problem. [...] Ambiguity in the bijection is incompatible with the subtype = subset principle. *So multiple inheritance throws a spanner in the works. *The only way to salvage the situation is to require the bijection be unique (so in the above example it is deemed that H1 is not a subtype of H2). *However I find this gratuitous at best. There is indeed a problem with the subtype = subset principle, or at least the one that I had in mind: - if t1 <= t2 then [[t1]] is a subset of [[t2]] where [[t]] denotes the set of all values that are of type t. Sorry for being unclear about that. The restriction that f in the definition should be uniquely defined is implied by this principle, which IMNSHO makes it not ad-hoc or gratuitous but rather well-founded. The proof is left to the reader as an exercise. ;-) |
#48
| |||
| |||
|
|
On 22 feb, 15:39, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: There is indeed a problem with the subtype = subset principle, or at least the one that I had in mind: - if t1 <= t2 then [[t1]] is a subset of [[t2]] where [[t]] denotes the set of all values that are of type t. Sorry for being unclear about that. The restriction that f in the definition should be uniquely defined is implied by this principle, which IMNSHO makes it not ad-hoc or gratuitous but rather well-founded. The proof is left to the reader as an exercise. ;-) |
|
PS. Note that the corrected definition can be compactly formulated: Definition: H1 <= H2 if for each type t2 in H2 there is exactly one type t1 in H1 such that t1 <= t2. |
#49
| |||
| |||
|
|
On Feb 23, 12:49 am, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: On 22 feb, 15:39, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: There is indeed a problem with the subtype = subset principle, or at least the one that I had in mind: - if t1 <= t2 then [[t1]] is a subset of [[t2]] where [[t]] denotes the set of all values that are of type t. Sorry for being unclear about that. The restriction that f in the definition should be uniquely defined is implied by this principle, which IMNSHO makes it not ad-hoc or gratuitous but rather well-founded. The proof is left to the reader as an exercise. ;-) My problem is that there may be existing types t1,t2,t3,t4 and an existing declared relation-type with H2 = {t3,t4}. *Someone wants to create a new relation-type with H1 = {t1,t2} that subtypes H2, perhaps where it is required that t1,t3 represent one role and t2,t4 represent another. *However it happens that both t1 and t2 subtype both t3 and t4 so therefore it cannot be done because of ambiguity. *That seems unreasonable. |
|
PS. Note that the corrected definition can be compactly formulated: Definition: *H1 <= H2 if * *for each type t2 in H2 * *there is exactly one type t1 in H1 * *such that t1 <= t2. That doesn't seem right to me - by that definition H1 might have more attributes than H2 and yet be considered a subtype. |
#50
| |||
| |||
|
|
On 23 feb, 01:33, David BL <davi... (AT) iinet (DOT) net.au> wrote: On Feb 23, 12:49 am, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: On 22 feb, 15:39, Jan Hidders <hidd... (AT) gmail (DOT) com> wrote: There is indeed a problem with the subtype = subset principle, or at least the one that I had in mind: - if t1 <= t2 then [[t1]] is a subset of [[t2]] where [[t]] denotes the set of all values that are of type t. Sorry for being unclear about that. The restriction that f in the definition should be uniquely defined is implied by this principle, which IMNSHO makes it not ad-hoc or gratuitous but rather well-founded. The proof is left to the reader as an exercise. ;-) My problem is that there may be existing types t1,t2,t3,t4 and an existing declared relation-type with H2 = {t3,t4}. Someone wants to create a new relation-type with H1 = {t1,t2} that subtypes H2, perhaps where it is required that t1,t3 represent one role and t2,t4 represent another. However it happens that both t1 and t2 subtype both t3 and t4 so therefore it cannot be done because of ambiguity. That seems unreasonable. Mathematics can sometimes be very unreasonable. :-) But I think this makes sense. If you give me a tuple (row/record) of H2 and would ask for the t1-value in that tuple, then this is ambiguous, since both the t3 and t4 value are also t1 values. It seems reasonable to assume that for tuples of type H1 we require that they contain a single value of type t1 and a single value of type t2. But the tuple of type H2 would actually in some sense contain two values of type t1 (and two values of type t2). So semantically speaking it is indeed not really a subtype. You could try to fix this by taking another semantics of the types, but I don't see a reasonable alternative at the moment. In fact, my current intuition is that this is a symptom of the fact that we are trying to shoehorn the atrribute-type relationship into the subtype relationship, where it doesn't really fit comfortably. |
|
PS. Note that the corrected definition can be compactly formulated: Definition: H1 <= H2 if for each type t2 in H2 there is exactly one type t1 in H1 such that t1 <= t2. That doesn't seem right to me - by that definition H1 might have more attributes than H2 and yet be considered a subtype. Of course. For the usual record types it holds that <a:t1, b:t2> is a supertype of <a:t1, b:t2, c:t3>. You can use values of the latter where values of the first are expected, not the other way around. |
![]() |
| Thread Tools | |
| Display Modes | |
| |