Chapter 18
Tuple / Relation Valueswith Inheritance (cont.)
I have known her continue in this a quarter of an hour
—William Shakespeare: Macbeth (1606)
He’s not such a super type —rather a common type, really
—Anon.: Where Bugs Go
The previous chapter explained the basic concept of tuple and relation subtypes and supertypes; in particular, it touched on the fact that every pair of tuple types and every pair of relation types has both a least specific common subtype—i.e., an intersection type—and a most specific common supertype (just so long as the types in question both belong to the same type lattice, of course, as we saw in the answer to Exercise 17.4). For example, consider the pair of (either tuple or relation) types CR and ES from Fig. 17.1. For that pair, type CS is the least specific common subtype and type ER is the most specific common supertype. This chapter explains such matters in depth.
IM PRESCRIPTION 24: COMMON TUPLE / RELATION SUBTYPES AND SUPERTYPES
Let T1, T2, ..., Tm (m ≥ 0), T, and T′ be all tuple types or all relation types, with headings
{ <A1,T11> , <A2,T12> , ... , <An,T1n> }{ <A1,T21> , <A2,T22> , ... , <An,T2n> } ......................................{ <A1,Tm1> , <A2,Tm2> , ... , <An,Tmn> }{ <A1,T01> , <A2,T02> , ... , <An,T0n> }{ <A1,T01′> , <A2,T02′> , ... , <An,T0n′> }
respectively. Then:
Type T shall be a common supertype for, or of, types T1, T2, ..., Tm if and only if, for all j (j = 1, 2, ..., n), type T0j is a common supertype for ...
Get Type Inheritance and Relational Theory now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.