{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 14 - for example we use the logical notation loves x,y...

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

Forenames ::= (FirstName, SecondName) Name2 ::= (Forenames, Surname) 3 Relations We wish to capture the concept of objects being related : for example, John loves Mary; 2 < 5 ; two programs P and Q are ‘equal’. Such properties can be expressed in logic using relations on atomic terms, as you have seen in the logic course. Here we define relations as special sets. For instance, assume the universal set People of all people. We form a set loves consisting of all ordered pairs of people such that the first loves the second: loves = { ( x, y ) : x, y People x loves y } Thus loves People × People . 3.1 Introducing Relations D EFINITION 3.1 (B INARY R ELATIONS ) A binary relation between (arbitrary) sets A and B is a subset of the binary product A × B . We use R, S, . . . to range over relations. If R A 1 × A 2 , we say that R has type A 1 × A 2 . If R A × A , we sometimes just say that R is a binary relation on A . Instead of ( a 1 , a 2 ) R , we often write R ( a 1 , a 2 ) ; for example, we use
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; for example, we use the logical notation loves ( x,y ) rather than ( x,y ) ∈ loves . We sometimes write aR b instead of R ( a,b ) ; for example, x loves y or 2 < 5 or a ‘ f ‘ b in Haskell. In general, there will be many relations on any set. A relation does not have to be meaningful; any subset of a Cartesian product is a relation. ±or example, for A = { a,b } , there are sixteen relations on A : ∅ { ( a,b ) , ( b,a ) } { ( a,a ) } { ( a,b ) , ( b,b ) } { ( a,b ) } { ( b,a ) , ( b,b ) } { ( b,a ) } { ( a,a ) , ( a,b ) , ( b,a ) } { ( b,b ) } { ( a,a ) , ( a,b ) , ( b,b ) } { ( a,a ) , ( a,b ) } { ( a,a ) , ( b,a ) , ( b,b ) } { ( a,a ) , ( b,a ) } { ( a,b ) , ( b,a ) , ( b,b ) } { ( a,a ) , ( b,b ) } { ( a,a ) , ( a,b ) , ( b,a ) , ( b,b ) } 15...
View Full Document

{[ snackBarMessage ]}