What type is an empty set?

I start by observing that scalar values in D/TD have a type, that every value can belong to only one type, so that the type of any given value or of a scalar variable can be determined by inspection. No type declaration is required.

Then I note that tuple values have a name and a value for each attribute, and again the type of each value and thus the type of the tuple can be determined by inspecting its values. Again no type declaration is required.

The type of any relation value can likewise be determined by inspecting the values of the attributes of any of its tuples. With one exception. It is not possible to determine the type of a relation that has attributes but is empty (contains no tuples) by inspecting its values, because there are none.

This leads to an interesting special case for a compiler that is trying to perform type inference. But apart from that, I am left with the question: how does an empty set have a type? If I consider the set of odd numbers divisible by two, and the set of circles with corners, I see that both are empty sets. But are they the same empty set, or do they preserve a ‘type’ which keeps them somehow distinct?

What does an empty relation signify? In what sense is it meaningful to have a relation that claims to have attributes of some type(s) but asserts no facts?

If we had some ham we could have ham and eggs, if we had some eggs. Or so my father used to say.

Leave a Comment

Filed under Pondering

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.