Mat3770 — Relations Relations Digraphs Mat3770 — Relations Reflexive Symmetric Transitive Composition Data Structure Spring 2014 Equiv Relation Equiv Classes Partitions Transitive Closure tsr(R)
Student Responsibilities Mat3770 — Relations Reading : Textbook, Section 8.1, 8.3, 8.5 Assignments : Relations Digraphs Sec 8.1 1a-d, 3a-d, 5ab, 16, 28, 31, 48bd Reflexive Sec 8.3 1ab, 3ab, 5, 14a-c, 18(ab), 23, 26, 36 Symmetric Sec 8.5 2ad, 5, 15, 22, 35, 43a-c, 61 Transitive Attendance : Spritefully Encouraged Composition Data Structure Overview Equiv Relation Sec 8.1 Relations and Their Properties Equiv Classes Sec 8.3 Representing Relations Partitions Sec 8.5 Equivalence Relations Transitive Closure tsr(R)
Section 8.1 — Relations and Their Properties Mat3770 — Relations Binary Relations Relations Digraphs Definition : A binary relation R from a set A to a set B is a Reflexive subset R ⊆ A × B . Symmetric Transitive Composition Note: there are no constraints on relations as there are on Data functions. Structure Equiv Relation Equiv Classes We have a common graphical representation of relations, a Partitions directed graph. Transitive Closure tsr(R)
Directed Graphs Mat3770 — Relations Definition : A Directed Graph (Digraph) D from A to B is: Relations 1. a collection of vertices V ⊆ A ∪ B , and Digraphs Reflexive 2. a collection of edges E ⊆ A × B Symmetric Transitive Composition If there is an ordered pair e = < x , y > in R, then there is an Data arc or edge from x to y in D. (Note: E = R ) Structure Equiv Relation Equiv Classes The elements x and y are called the initial and terminal Partitions vertices of the edge e. Transitive Closure tsr(R)
Relation Example Mat3770 — Let A = { a, b, c } , Relations B = { 1, 2, 3, 4 } , and Relations Digraphs R be defined by the ordered pairs or edges: Reflexive { < a , 1 >, < a , 2 >, < c , 4 > } Symmetric Transitive Then we can represent R by the digraph D: Composition Data 1 Structure A Equiv Relation 2 B Equiv Classes 3 Partitions C Transitive Closure 4 tsr(R)
Relation on a Single Set A Mat3770 — Definition : A binary relation R on a set A is a subset of Relations A × A or a relation from A to A. Relations Digraphs Let A = { a, b, c } Reflexive Symmetric Transitive R = { < a , a >, < a , b >, < a , c > } Composition Data Structure Equiv Then a digraph representation of R is: Relation Equiv Classes b Partitions a Transitive Closure c tsr(R)
Notes Mat3770 — Relations Relations Digraphs An arc of the form < x , x > on a digraph is called a loop . Reflexive Symmetric Transitive Question: How many binary relations are there on a set A? Composition Another way to think of it: Data Structure How many subsets are there of A × A? Equiv Relation Equiv Classes Partitions Transitive Closure tsr(R)
Special Properties of Binary Relations Given Mat3770 — Relations 1. A universe U Relations 2. A binary relation R on a subset A of U Digraphs Reflexive Definition : R is reflexive IFF Symmetric Transitive ∀ x [ x ∈ A → < x , x > ∈ R ] Composition Data Notes: Structure If A = ∅ , then the implication is vacuously true Equiv Relation Equiv Classes The void relation on an empty set is reflexive Partitions Transitive If A is not void, then all vertices in the reflexive relation must Closure have loops tsr(R)
Symmetric and Antisymmetric Properties Mat3770 — Definition : R is symmetric IFF Relations ∀ x ∀ y [ < x , y > ∈ R → < y , x > ∈ R ] Relations Note: if there is an arc < x , y > , there must be an arc Digraphs Reflexive < y , x > Symmetric Transitive Composition Definition : R is antisymmetric IFF Data Structure ∀ x ∀ y [( < x , y > ∈ R ) ∧ ( < y , x > ∈ R ) → x = y ] Equiv Relation Note: If there is an arc from x to y, there cannot be one from Equiv Classes y to x if x � = y. Partitions Transitive To prove a relation is antisymmetric, show logically that if Closure < x , y > is in R and x � = y, then < y , x > is not in R. tsr(R)
The Transitive Property Mat3770 — Relations Definition : R is transitive IFF Relations Digraphs ∀ x ∀ y ∀ z [( < x , y > ∈ R ) ∧ ( < y , z > ∈ R ) → < x , z > ∈ R ] Reflexive Symmetric Transitive Note: If there is an arc from x to y and one from y to z, then Composition there must be one from x to z. Data Structure Equiv This is the most difficult property to check. We will develop Relation algorithms to check this later. Equiv Classes Partitions Transitive Closure tsr(R)
Mat3770 — A B Relations Relations Digraphs Reflexive C D Symmetric Transitive Composition Data Structure Equiv Relation R reflexive symmetric antisymmetric transitive Equiv Classes √ √ √ Partitions A Transitive B √ Closure C √ √ tsr(R) D
Combining Relations — Set Operations Mat3770 — Relations A very large set of potential questions! For example, let R1 and R2 be binary relations on a set A. Then we have Relations questions of the form: Digraphs If R1 has Property 1 and Reflexive R2 has Property 2, Symmetric Transitive does R1 ⋆ R2 have Property 3? Composition Data Structure For example, If R1 is symmetric and R2 is antisymmetric, Equiv does it follow that R1 ∪ R2 is transitive? Relation Equiv Classes If so, we need to prove it; Partitions otherwise, we can find a counterexample. Transitive Closure tsr(R)
Another Example Mat3770 — Relations Let R1 and R2 be transitive on A. Does it follow that R1 ∪ Relations R2 is transitive? Digraphs Reflexive Symmetric Consider: Transitive A = { 1, 2 } Composition R1 = { < 1 , 2 > } Data R2 = { < 2 , 1 > } Structure Equiv Relation Then R1 ∪ R2 = { < 1 , 2 >, < 2 , 1 > } . which is not Equiv Classes Partitions transitive. (Why not?) Transitive Closure tsr(R)
Composition of Relations Mat3770 — Definition : Suppose Relations R1 is a relation from A to B R2 is a relation from B to C Relations Then the composition of R2 with R1 , denoted R2 ◦ R1, is Digraphs the relation from A to C: Reflexive Symmetric If < x , y > is a member of R1 and Transitive < y , z > is a member of R2 , then Composition < x , z > is a member of R2 ◦ R1 Data Structure Equiv Relation For < x , y > to be in the composite relation R2 ◦ R1, there Equiv Classes must exist a y in B Partitions Transitive We read compositions right to left as in functions, applying Closure R1 first, then R2 in this example. tsr(R)
Example of a Composite Relation Mat3770 — Relations 1 A Relations 2 Digraphs B Reflexive Symmetric 3 Transitive C Composition 4 Data Structure R1 R2 Equiv Relation Equiv Classes Partitions Transitive Closure R2 ◦ R1 = { < B , 2 >, < B , 4 > } tsr(R)
A Relation Composed with Itself Mat3770 — Relations Definition : Let R be a binary relation on A. Then the Relations powers R n , n = 1 , 2 , 3 , . . . are defined recursively by: Digraphs Reflexive Basis : R 1 = R Symmetric Induction : R n +1 = R n ◦ R Transitive Composition Data Structure Equiv Note: An ordered pair < x , y > is in R n IFF there is a path Relation of length n from x to y following the arcs (in the direction of Equiv Classes Partitions the arrows) in R. Transitive Closure tsr(R)
Composites on R Mat3770 — Relations Relations Digraphs Reflexive 1 R 1 2 = R Symmetric R = R R Transitive Composition Data Structure Equiv Relation Equiv Classes Partitions Transitive 4 = R R 3 2 3 Closure R = R R R tsr(R)
A Very Important Theorem R is transitive IFF R n ⊆ R for n > 0. Mat3770 — Relations Proof ( ⇒ ): R transitive → R n ⊆ R Relations Use a direct proof with proof by induction Digraphs Assume R is transitive & show R n ⊆ R by induction Reflexive Symmetric Basis : Obviously true for n = 1 Transitive Induction : Composition IH: Assume R k ⊆ R for some arbitrary k > 0 Data IS: Show R k +1 ⊆ R Structure R k +1 = R k ◦ R, so if < x , y > is in R k +1 , then there is a z Equiv Relation such that < x , z > is in R k and < z , y > is in R. Equiv Classes But, since R k ⊆ R, < x , z > is in R Partitions Transitive R is transitive, so < x , y > is in R Closure Since < x , y > was an arbitrary edge, the result follows tsr(R)
Proof ( ⇐ ) Mat3770 — Relations To complete the proof, we need to show: Relations R n ⊆ R → R is transitive Digraphs Reflexive Symmetric Use the fact that R 2 ⊆ R and the definition of transitivity. Transitive Proof left as an exercise. . . Composition Data Structure Equiv Relation Thus, (given a finished proof of the above) we have shown: Equiv Classes Partitions R is transitive IFF R n ⊆ R for n > 0 Transitive Closure tsr(R)
Section 8.3 — Representing Relations Mat3770 — Relations Connection Matrices Relations Digraphs Let R be a relation from A = { a 1 , a 2 , . . . , a m } to Reflexive B = { b 1 , b 2 , . . . , b n } Symmetric Transitive Composition Data Structure Definition : An m × n connection matrix , M, for R is Equiv Relation defined by: � 1 if < a i , b j > ∈ R Equiv Classes m i , j = 0 Partitions otherwise Transitive Closure tsr(R)
Recommend
More recommend