This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 27.7 Binary Relations 461 searchItem as ( s,S ) = i : S [ i ] = s if s ∈ S ( − i − 1) : ( ∀ j ≥ ,j < i ⇒ S [ j ] ≤ s ) ∧ ( ∀ j < len( S ) ,j ≥ i ⇒ S [ j ] > s ) otherwise (27.46) searchItem ds ( s,S ) = i : S [ i ] = s if s ∈ S ( − i − 1) : ( ∀ j ≥ ,j < i ⇒ S [ j ] ≥ s ) ∧ ( ∀ j < len( S ) ,j ≥ i ⇒ S [ j ] < s ) otherwise (27.47) Definition 27.25 ( removeListItem ). The function removeListItem( l,q ) finds one occur- rence of an element q in a list l by using the appropriate search algorithm and deletes it (returning a new list m ). m = removeListItem( l,q ) ⇔ braceleftbigg l if searchItem( q,l ) < deleteListItem( l, searchItem( q,l )) otherwise (27.48) We can further define transformations between sets and lists which will implicitly be used when needed in this book. It should be noted that “setToList” is not the inverse function of listToSet. B = setToList( set A ) ⇒ ∀ a ∈ A ∃ i : B [ i ] = a ∧ ∀ i ∈ [0 , len( B ) − 1] ⇒ B [ i ] ∈ A ∧ len(setToList( A )) = | A | (27.49) A = listToSet( list B ) ⇒ ∀ i ∈ [0 , len( B ) − 1] ⇒ B [ i ] ∈ A ∧ ∀ a ∈ A ∃ i ∈ [0 .. len( B ) − 1] : B [ i ] = a ∧ | listToSet( B ) | ≤ len( B ) (27.50) 27.7 Binary Relations Definition 27.26 (Binary Relation). A binary 19 relation 20 R is defined as an ordered triple ( A,B,P ) where A and B are arbitrary sets, and P is a subset of the Cartesian product A × B (see Equation 27.25 ). The sets A and B are called the domain and codomain of the relation and P is called its graph. The statement ( a,b ) ∈ P : a ∈ A ∧ b ∈ B is read “ a is R-related to b ” and is written as R ( a,b ). The order of the elements in each pair of P is important: If a negationslash = b , then R ( a,b ) and R ( b,a ) both can be true or false independently of each other. Some types and possible properties of binary relations are listed below and illustrated in Figure 27.2 . A binary relation can be : 1. Left-total if ∀ a ∈ A ∃ b ∈ B : R ( a,b ) (27.51) 2. Surjective 21 or right-total if ∀ b ∈ B ∃ a ∈ A : R ( a,b ) (27.52) 19 http://en.wikipedia.org/wiki/Binary_relation [accessed 2007-07-03] 20 http://en.wikipedia.org/wiki/Relation_%28mathematics%29 [accessed 2007-07-03] 21 http://en.wikipedia.org/wiki/Surjective [accessed 2007-07-03] 462 27 Set Theory left-total surjective non-injective functional non-bijective A B left-total surjective injective functional bijective A B left-total surjective injective non-functional non-bijective A B left-total non-surjective injective functional non-bijective A B not left-total non-surjective injective functional non-bijective A B left-total non-surjective non-injective functional non-bijective A B not left-total non-surjective non-injective non-functional non-bijective A B Figure 27.2: Properties of a binary relation R with domain A and codomain B ....
View Full Document
This document was uploaded on 08/10/2011.
- Spring '11