
26 Jul
2004
26 Jul
'04
1:46 p.m.
Hello, I have a question that may pertain to type theory. According to Enderton, one of the ways to define an ordered pair (a,b) is {{a},{a,b}}. A relation is defined as a set of ordered-pairs. A map, of course, is a single-valued relation. Given all that, suppose I have a "FiniteMap Int String" in Haskell. This is, according to the definitions above, a "Set (Int,String)". An element of that has type (Int,String), which contains {Int,String}. But that can't exist because a Set contains only elements of one type. What I'm getting at is that it seems that a Relation should be defined type Relation a = Set (a,a) rather than type Relation a b = Set (a,b) so that we don't have this problem. Thanks.