3. 1. Revision Concrete World Abstract World Relation R from A to B a. ___ has been to ___ {John, Mary, Peter} {Tokyo, NY, HK} {(John,Tokyo), (John,NY), (Peter, NY)} b. ___ is in ___ {Tokyo, NY} {Japan, USA} {(Tokyo,Japan), (NY,USA)} c. ___ divides ___ {1,2,3,4} {10,11,12} {(1,10),(1,11),(1,12), (2,10), (2,12),(3,12), (4,12)} d. ___ less than ___ {1,2,3} {1,2,3} {(1,2),(1,3),(2,3)} ___ R ___ A B R A B Q: What can you do with relations? A: (1) Set Operations; (2) Complement; (3) Inverse; (4) Composition Q: What happens if A = B ?
4. 1. Revision Concrete World a. ___ same age as ___ {John, Mary, Peter} {(John,John), (Mary,Mary) (Peter,Peter), (Mary,Peter), (Peter,Mary)} b. ___ same # of elements as ___ { {}, {1}, {2}, {3.4} } { ({},{}), ({1},{1}), ({2},{2}) ({3,4},{3,4}) ({1},{2}), ({2},{1}) c. ___ ___ { {}, {1}, {2}, {1,2} } { ({},{}), ({},{1}), ({},{2}), ({},{1,2}), ({1},{1}), ({1},{1,2}), ({2},{2}), ({2},{1,2}) ({1,2},{1,2}) } d. ___ ___ {1,2,3} {(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)} ___ R ___ A R A 2 Relation R on A “ Everyone is related to himself” Reflexive “ If x is related to y and y is related to z , then x is related to z .” Transitive “ If x is related to y , then y is related to x ” Symmetric “ If x is related to y and y is related to x , then x = y .” Anti-Symmetric
5.
6.
7.
8.
9. 3.1 Examples (Partial Orders in life) Let T be the set of all tasks. We define a relation R on T such that x R y iff x = y or task x must be done before task y . Q: How long does it take to complete the entire project? (7) (14) (16) (19) (21) (20) (26) Task 1 7 hrs Task 2 6 hrs Task 3 3 hrs Task 7 1 hrs Task 5 3 hrs Task 8 2 hrs Task 9 5 hrs Task 6 1 hrs Task 4 6 hrs (13) (10)
10. 3.1 Examples (Partial Orders in life) Let T be the set of all tasks. We define a relation R on T such that x R y iff x = y or task x must be done before task y . Q: Critical Path? (7) (14) (16) (19) (21) (20) (26) Task 1 7 hrs Task 2 6 hrs Task 3 3 hrs Task 7 1 hrs Task 5 3 hrs Task 8 2 hrs Task 9 5 hrs Task 6 1 hrs Task 4 6 hrs (13) (10)