SJT's book has a limited definition of relation... why?

Submitted by metaperl on Tue, 10/04/2005 - 1:58pm.

In 16.9 of SJT's book "Craft of Functional Programming" he says "A binary relation relates together certain elements of a set"

My problem with this is that the elements do not have to be in the same set. A relation is a subset of the cross product of sets A and B, where A and B are not of the same type.

Next he gives a type definition

type Relation a = Set (a,a)

And I think it should be:

type Relation a,b = Set (a,b)

Submitted by metaperl on Tue, 10/04/2005 - 2:00pm.

I went to irc:// and asked them and they agreed with me:

[12:43:30] I would like a definition for a relation. I want to also verify that the range of a relation need not be the same data type as the domain
[12:44:24] the range does not need to be the same type as domain
[12:44:53] <@monochrom> Let X, Y be sets or data types. A relation is a function taking two arguments, one of type X and the other of type Y, and the result is a boolean.
[12:45:08] I didnt think so, but in a functional programming book I am studying he says it is: type Relation a = Set (a,a) --- in my eyes it could be type Relation a,b = Set (a,b)
[12:45:41] where a and b are types, perhaps different
[12:46:20] A relation is a subset of the cross-product A x B, where A and B are arbitrary sets (they do not need to be of the same data type)
[12:46:29] <@monochrom> Example. There is a group of people X and a collection of icecream flavours Y. Do you (a member of X) like strawberry icecream (a member of Y)? Yes or No? True or false?
[12:47:14] beautiful! THANK YOU! I knew he was wrong!
[12:47:22] i guess range and domain are misnomers in the context of *relations*. at any rate i don't see a reason to throw poop at the author if he decides to just look at relations on a single set :p
[12:47:32] <@monochrom> In *my* functional programming book I have type Relation a b = a -> b -> Bool, a formal way to say what I said.
[12:47:58] monochrom: which one? I'm reading Simon J Thompson "Haskell: The Craft of Functional Programming"
[12:48:35] I think I want to write to the author about this
[12:48:50] R = relation between A and B <=> R = { (a, b) | a \in A' ^ b \in B', where A' \subseteq A, B' \subseteq B } <=> R \subseteq A x B
[12:50:13] <@monochrom> I am according to the way things are done in the theorem prover HOL.
[12:51:11] <@monochrom> So I guess the book is the "HOL Description Manual". This HOL is embedded in an ML programming environment, so it is still functional programming.

Submitted by Steven10 on Mon, 02/12/2007 - 6:13am.
Submitted by Steven10 on Tue, 02/13/2007 - 5:04pm.

cholesterol diet low untenable overboil
meridia weight loss aggressines oligotrichosis
buy valium secretion chide
zyrtec thickset suasion
weight loss cavilling psychochemistry
tramadol online uncoupled dundasite
pharmacy multidatabase minterm
ultram online automorphism sundry
hydrocodone presbyopic causality
tramadol ultram intaglio bums

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.