{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 2 - the above relationship between equivalent Haskell...

This preview shows page 1. Sign up to view the full content.

bottom :: Bool bottom = bottom The functions myand and myand ’ do not behave in the same way using bottom . The expression ( myand False bottom ) evaluates to False , whereas the ex- pression ( myand False bottom ) does not terminate. Now consider in addi- tion the Haskell function myand’’ :: Bool -> Bool -> Bool myand’’ b1 b2 = if b1 then b2 else False The function myand’’ has identical behaviour to myand’ . We can describe the relationship between equivalent Haskell functions as follows: Two Haskell functions f : A B and g : A B behave in the same way if and only if, for all terms a in type A , then if f a terminates then g a terminates and f a = g a , and if f a does not terminate then g a does not terminate. You will be learning more about this story in the operational semantics course in the second year. Here, we explore the abstract concept of rela- tions. We will describe equivalence relations , special relations which for ex- ample behave like the standard equality on the natural numbers and include
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the above relationship between equivalent Haskell functions, and orderings which for example behave like the ‘less than’ ordering between natural num-bers. We will also describe natural ways of constructing new relations from old, including those used in relational databases. 2 Sets Our starting point will be the idea of a set, a concept that we shall not formally deFne. Instead, we shall simply use the intuitive idea that a set is a collection of objects. D EFINITION 2.1 (I NFORMAL ) A set is a collection of objects (or individuals) taken from a pool of objects. The objects in a set are also called the elements , or members , of the set. A set is said to contain its elements. We write x ∈ A when object x is a member of set A . When x is not a member of A , we write x ±∈ A or sometimes ¬ ( x ∈ A ) using notation from the logic course. 3...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern