discrete mathematics in computer science
play

Discrete Mathematics in Computer Science Operations on Relations - PowerPoint PPT Presentation

Discrete Mathematics in Computer Science Operations on Relations Malte Helmert, Gabriele R oger University of Basel Relations: Recap A relation over sets S 1 , . . . , S n is a set R S 1 S n . A binary relation is a


  1. Discrete Mathematics in Computer Science Operations on Relations Malte Helmert, Gabriele R¨ oger University of Basel

  2. Relations: Recap A relation over sets S 1 , . . . , S n is a set R ⊆ S 1 × · · · × S n . A binary relation is a relation over two sets. A homogeneous relation R over set S is a binary relation R ⊆ S × S .

  3. Relations: Recap A relation over sets S 1 , . . . , S n is a set R ⊆ S 1 × · · · × S n . A binary relation is a relation over two sets. A homogeneous relation R over set S is a binary relation R ⊆ S × S .

  4. Relations: Recap A relation over sets S 1 , . . . , S n is a set R ⊆ S 1 × · · · × S n . A binary relation is a relation over two sets. A homogeneous relation R over set S is a binary relation R ⊆ S × S .

  5. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  6. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  7. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . With the standard relations <, = and ≤ for N 0 , relation ≤ corresponds to the union of relations < and =. Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  8. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . With the standard relations <, = and ≤ for N 0 , relation ≤ corresponds to the union of relations < and =. Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  9. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . With the standard relations <, = and ≤ for N 0 , relation ≤ corresponds to the union of relations < and =. Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? With the standard relations ≤ , = and ≥ for N 0 , relation = corresponds to the intersection of ≤ and ≥ . If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  10. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . With the standard relations <, = and ≤ for N 0 , relation ≤ corresponds to the union of relations < and =. Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? With the standard relations ≤ , = and ≥ for N 0 , relation = corresponds to the intersection of ≤ and ≥ . If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R .

  11. Set Operations Relations are sets of tuples, so we can build their union, intersection, complement, . . . . Let R be a relation over S 1 , . . . , S n and R ′ a relation over n . Then R ∪ R ′ is a relation over S 1 ∪ S ′ S ′ 1 , . . . , S ′ 1 , . . . , S n ∪ S ′ n . With the standard relations <, = and ≤ for N 0 , relation ≤ corresponds to the union of relations < and =. Let R and R ′ be relations over n sets. Then R ∩ R ′ is a relation. Over which sets? With the standard relations ≤ , = and ≥ for N 0 , relation = corresponds to the intersection of ≤ and ≥ . If R is a relation over S 1 , . . . , S n then so is the complementary relation ¯ R = ( S 1 × · · · × S n ) \ R . With the standard relations for N 0 , relation = is the complementary relation of � = and > the one of ≤ .

  12. Inverse of a Relation Definition Let R ⊆ A × B be a binary relation over A and B . The inverse relation of R is the relation R − 1 ⊆ B × A given by R − 1 = { ( b , a ) | ( a , b ) ∈ R } . The inverse of the < relation over N 0 is the > relation. Relation R with xRy iff person x has a key for y . Inverse: Q with aQb iff lock a can be openened by person b .

  13. Inverse of a Relation Definition Let R ⊆ A × B be a binary relation over A and B . The inverse relation of R is the relation R − 1 ⊆ B × A given by R − 1 = { ( b , a ) | ( a , b ) ∈ R } . The inverse of the < relation over N 0 is the > relation. Relation R with xRy iff person x has a key for y . Inverse: Q with aQb iff lock a can be openened by person b .

  14. Composition of Relations Definition (Composition of relations) Let R 1 be a relation over A and B and R 2 be a relation over B and C . The composition of R 1 and R 2 is the relation R 2 ◦ R 1 with: R 2 ◦ R 1 = { ( a , c ) | there is a b ∈ B with ( a , b ) ∈ R 1 and ( b , c ) ∈ R 2 } How can we illustrate this graphically?

  15. Composition of Relations Definition (Composition of relations) Let R 1 be a relation over A and B and R 2 be a relation over B and C . The composition of R 1 and R 2 is the relation R 2 ◦ R 1 with: R 2 ◦ R 1 = { ( a , c ) | there is a b ∈ B with ( a , b ) ∈ R 1 and ( b , c ) ∈ R 2 } How can we illustrate this graphically?

  16. Composition is Associative Theorem (Associativity of composition) Let S 1 , . . . , S 4 be sets and R 1 , R 2 , R 3 relations with R i ⊆ S i × S i +1 . Then R 3 ◦ ( R 2 ◦ R 1 ) = ( R 3 ◦ R 2 ) ◦ R 1 .

  17. Composition is Associative Theorem (Associativity of composition) Let S 1 , . . . , S 4 be sets and R 1 , R 2 , R 3 relations with R i ⊆ S i × S i +1 . Then R 3 ◦ ( R 2 ◦ R 1 ) = ( R 3 ◦ R 2 ) ◦ R 1 . Proof. It holds that ( x 1 , x 4 ) ∈ R 3 ◦ ( R 2 ◦ R 1 ) iff there is an x 3 with ( x 1 , x 3 ) ∈ R 2 ◦ R 1 and ( x 3 , x 4 ) ∈ R 3 .

  18. Composition is Associative Theorem (Associativity of composition) Let S 1 , . . . , S 4 be sets and R 1 , R 2 , R 3 relations with R i ⊆ S i × S i +1 . Then R 3 ◦ ( R 2 ◦ R 1 ) = ( R 3 ◦ R 2 ) ◦ R 1 . Proof. It holds that ( x 1 , x 4 ) ∈ R 3 ◦ ( R 2 ◦ R 1 ) iff there is an x 3 with ( x 1 , x 3 ) ∈ R 2 ◦ R 1 and ( x 3 , x 4 ) ∈ R 3 . As ( x 1 , x 3 ) ∈ R 2 ◦ R 1 iff there is an x 2 with ( x 1 , x 2 ) ∈ R 1 and ( x 2 , x 3 ) ∈ R 2 , we have overall that ( x 1 , x 4 ) ∈ R 3 ◦ ( R 2 ◦ R 1 ) iff there are x 2 , x 3 with ( x 1 , x 2 ) ∈ R 1 , ( x 2 , x 3 ) ∈ R 2 and ( x 3 , x 4 ) ∈ R 3 .

  19. Composition is Associative Theorem (Associativity of composition) Let S 1 , . . . , S 4 be sets and R 1 , R 2 , R 3 relations with R i ⊆ S i × S i +1 . Then R 3 ◦ ( R 2 ◦ R 1 ) = ( R 3 ◦ R 2 ) ◦ R 1 . Proof. It holds that ( x 1 , x 4 ) ∈ R 3 ◦ ( R 2 ◦ R 1 ) iff there is an x 3 with ( x 1 , x 3 ) ∈ R 2 ◦ R 1 and ( x 3 , x 4 ) ∈ R 3 . As ( x 1 , x 3 ) ∈ R 2 ◦ R 1 iff there is an x 2 with ( x 1 , x 2 ) ∈ R 1 and ( x 2 , x 3 ) ∈ R 2 , we have overall that ( x 1 , x 4 ) ∈ R 3 ◦ ( R 2 ◦ R 1 ) iff there are x 2 , x 3 with ( x 1 , x 2 ) ∈ R 1 , ( x 2 , x 3 ) ∈ R 2 and ( x 3 , x 4 ) ∈ R 3 . This is the case iff there is an x 2 with ( x 1 , x 2 ) ∈ R 1 and ( x 2 , x 4 ) ∈ R 3 ◦ R 2 , which holds iff ( x 1 , x 4 ) ∈ ( R 3 ◦ R 2 ) ◦ R 1 .

  20. Transitive Closure Definition (Transitive closure) The transitive closure R ∗ of a relation R over set S is the smallest relation over S that is transitive and has R as a subset. The transitive closure always exists. Why? Example: If aRb specifies that block a lies on block b , what does R ∗ express?

  21. Transitive Closure Definition (Transitive closure) The transitive closure R ∗ of a relation R over set S is the smallest relation over S that is transitive and has R as a subset. The transitive closure always exists. Why? Example: If aRb specifies that block a lies on block b , what does R ∗ express?

  22. Transitive Closure Definition (Transitive closure) The transitive closure R ∗ of a relation R over set S is the smallest relation over S that is transitive and has R as a subset. The transitive closure always exists. Why? Example: If aRb specifies that block a lies on block b , what does R ∗ express?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend