Power Set of a set and Relations

Similar documents
CS 441 Discrete Mathematics for CS Lecture 24. Relations IV. CS 441 Discrete mathematics for CS. Equivalence relation

Binary Relations McGraw-Hill Education

9.5 Equivalence Relations

Discrete Mathematics. Kruskal, order, sorting, induction

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric

Slides for Faculty Oxford University Press All rights reserved.

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

CHAPTER 3 FUZZY RELATION and COMPOSITION

Relations, Equivalence Relations, and Partial Orders

Introduction to Sets and Logic (MATH 1190)

CONTENTS Equivalence Classes Partition Intersection of Equivalence Relations Example Example Isomorphis

10/11/2018. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings

CSE 20 DISCRETE MATH. Winter

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3.

Discrete mathematics , Fall Instructor: prof. János Pach

CHAPTER 3 FUZZY RELATION and COMPOSITION

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CSE 20 DISCRETE MATH. Fall

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

What is Set? Set Theory. Notation. Venn Diagram

CSC Discrete Math I, Spring Sets

1. Represent each of these relations on {1, 2, 3} with a matrix (with the elements of this set listed in increasing order).

Integers and Mathematical Induction

Combinatorial properties and n-ary topology on product of power sets

Fundamentals of Discrete Mathematical Structures

r=1 The Binomial Theorem. 4 MA095/98G Revision

THEORY OF COMPUTATION

Point-Set Topology 1. TOPOLOGICAL SPACES AND CONTINUOUS FUNCTIONS

Recursive Definitions Structural Induction Recursive Algorithms

Lattice Tutorial Version 1.0

Nim-Regularity of Graphs

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

Introduction III. Graphs. Motivations I. Introduction IV

Math 395: Topology. Bret Benesh (College of Saint Benedict/Saint John s University)

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

A metric space is a set S with a given distance (or metric) function d(x, y) which satisfies the conditions

Module 11. Directed Graphs. Contents

Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

CMSC Honors Discrete Mathematics

Recursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences

Discrete Mathematics Lecture 4. Harper Langston New York University

Definition. Given a (v,k,λ)- BIBD, (X,B), a set of disjoint blocks of B which partition X is called a parallel class.

MA651 Topology. Lecture 4. Topological spaces 2

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Simple graph Complete graph K 7. Non- connected graph

Lamé s Theorem. Strings. Recursively Defined Sets and Structures. Recursively Defined Sets and Structures

Topology I Test 1 Solutions October 13, 2008

Foundations of Computer Science Spring Mathematical Preliminaries

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

CS388C: Combinatorics and Graph Theory

Integer Partition Poset

Math 170- Graph Theory Notes

Math 776 Graph Theory Lecture Note 1 Basic concepts

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

2. CONNECTIVITY Connectivity

Lecture 15: The subspace topology, Closed sets

ON CONSISTENCY CHECKING OF SPATIAL RELATIONSHIPS IN CONTENT-BASED IMAGE DATABASE SYSTEMS

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets


2.1 Sets 2.2 Set Operations

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

Recognizing Interval Bigraphs by Forbidden Patterns

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Logic and Discrete Mathematics. Section 2.5 Equivalence relations and partitions

DISCRETE MATHEMATICS

Lecture 17: Continuous Functions

Chapter I PRELIMINARIES

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

What Is A Relation? Example. is a relation from A to B.

Lecture 22 Tuesday, April 10

Alphabets, strings and formal. An introduction to information representation

Lecture 6,

1 Digraphs. Definition 1

Polygon Triangulation

3 Fractional Ramsey Numbers

Recursively Defined Functions

Polytopes Course Notes

2.8. Connectedness A topological space X is said to be disconnected if X is the disjoint union of two non-empty open subsets. The space X is said to

Ambiguous Grammars and Compactification

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

Elementary Topology. Note: This problem list was written primarily by Phil Bowers and John Bryant. It has been edited by a few others along the way.

1 Non greedy algorithms (which we should have covered

Chapter 3. Set Theory. 3.1 What is a Set?

Notes on metric spaces and topology. Math 309: Topics in geometry. Dale Rolfsen. University of British Columbia

Paths partition with prescribed beginnings in digraphs: a Chvátal-Erdős condition approach.

I BSc(Computer Science)[ ] Semester - II Allied:DISCRETE MATHEMATICS - 207D Multiple Choice Questions.

Pebble Sets in Convex Polygons

Topology notes. Basic Definitions and Properties.

It All Depends on How You Slice It: An Introduction to Hyperplane Arrangements

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

(l) Represent each of the sets A, B and C using bit strings. Then, use bit string representation and bitwise logical operations to find

Introduction to Graphs

LECTURE 1 Basic definitions, the intersection poset and the characteristic polynomial

CS3102 Theory of Computation Solutions to Problem Set 1, Spring 2012 Department of Computer Science, University of Virginia

Transcription:

Power Set of a set and Relations 1

Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}} Let A={{a,b},c}, P(A)={,{{a,b}},{c},{{a,b},c}} Note: the empty set and the set itself are always elements of the power set.

Power Set (2) The power set is a fundamental combinatorial object useful when considering all possible combinations of elements of a set Fact: Let S be a set such that S =n, then P(S) = 2 n

Proof of P(A) =2^ A Proof: ( By induction) Base case holds: A =0, then A={} and P(A)={ }. Induction Hypothesis: Assume to be true for all sets of cardinality n-1, i.e. A =n-1 implies P(A) =2^{n-1}. For A =n Let A={a_1,a_2,,a_n}. Any subset not containing a_n is a subset of B=A\{a_n}. How many subsets of A are there not containing a_n? This is nothing but the set of all subsets of B. The number is 2^{n-1} by induction hypothesis. 4

Proof of P(A) =2^ A Contd How to get a subset of A containing a_n? Take a subset S of B. Let S =S {a_n}. Now S is a subset of A containing a_n. Can any subset of A containing a_n be obtained in this way? Answer is Yes!! Let S be any subset of A containing a_n. Let S=S \{a_n}. Now S is a subset of A not containing a_n. 5

Proof of P(A) =2^ A Contd Let X_1 be the set of all subsets of A not containing a_n Let X_2 be the set of all subsets of A containg a_n. Now P(A)= X_1 X_2 and X_1 X_2 =. Also S S =S {a_n} is a bijection. This implies S = S =2^{n-1} by induction hypothesis So P(A)) = S + S = 2^{n-1} +2^{n-1}=2^{n}. 6

How to generate all subsets of a Set of n elements? 7

Computer Representation of Sets (1) There really aren t ways to represent infinite sets by a computer since a computer has a finite amount of memory If we assume that the universal set U is finite, then we can easily and effectively represent sets by bit vectors Specifically, we force an ordering on the objects, say: U={a 1, a 2,,a n } For a set A U, a bit vector can be defined as, for i=1,2,,n b i =0 if a i A b i =1 if a i A

Computer Representation of Sets (2) Examples Let U={0,1,2,3,4,5,6,7} and A={0,1,6,7} The bit vector representing A is: 1100 0011 How is the empty set represented? How is U represented? Set operations become trivial when sets are represented by bit vectors Union is obtained by making the bit-wise OR Intersection is obtained by making the bit-wise AND

BITWISE OPERATOR (IN C) Operators & Meaning of operators Bitwise AND Bitwise OR ^ Bitwise exclusive OR ~ Bitwise complement << Shift left >> Shift right

Computer Representation of Sets (3) Let U={0,1,2,3,4,5,6,7}, A={0,1,6,7}, B={0,4,5} What is the bit-vector representation of B? Compute, bit-wise, the bit-vector representation of A B Compute, bit-wise, the bit-vector representation of A B What sets do these bit vectors represent?

Computer Representation of Sets Array representations: U={1,2,.n} S can be represented by an array A such that A[i]=1 if i S else A[i]=0. Disjoint Set operations: Union, j=find(i) if I in S_j. 12

Programming Question Using bit vector, we can represent sets of cardinality equal to the size of the vector What if we want to represent an arbitrary sized set in a computer (i.e., that we do not know a priori the size of the set)? What data structure could we use? Tree representation of disjoint Set: To be discussed after Graphs are introduced.

Relations 14

Relations and Their Properties To represent relationships between elements of sets Ordered pairs: binary relations Definition 1: Let A and B be sets. A binary relation from A to B is a subset of A B. a R b: (a,b) R a is related to b by R R a b: (a,b) R Ex.1-3 Functions as relations Relations are generalization of functions

FIGURE 1 (8.1) FIGURE 1 Displaying the Ordered Pairs in the Relation R from Example 3.

Relations on a Set Definition 2: a relation on the set A is a relation from A to A. How many relations are there on a set with n elements? ( Such questions will be discussed in Counting and advanced counting)

FIGURE 2 Displaying the Ordered Pairs in the Relation R from Example 4.

Properties of Relations Definition 3: A relation R on a set A is called reflexive if (a,a) R for every element a A. a((a,a) R) Definition 4: A relation R on a set A is called symmetric if (b,a) R whenever (a,b) R, for all a,b A. A relation R on a set A such that for all a,b A, if (a,b) R and (b,a) R, then a=b is called antisymmetric. a b((a,b) R (b,a) R) a b(((a,b) R (b,a) R) (a=b)) Not opposites

Definition 5: A relation R on a set A is called transitive if whenever (a,b) R and (b,c) R, then (a,c) R, for all a,b,c A. a b c(((a,b) R (b,c) R) (a,c) R)

Combining Relations Two relations can be combined in any way two sets can be combined Definition 6: R: relation from A to B, S: relation from B to C. The composite of R and S is the relation consisting of ordered pairs (a,c), where a A, c C, and there exists an element b B such that (a,b) R and (b,c) S. (denoted by S R)

Definition 7: Let R be a relation on the set A. The powers R n, n=1,2,3,, are defined recursively by R 1 =R, and R n+1 =R n R. Theorem 1: The relation R on a set A is transitive iff R n R for n=1,2,3, Proof.

Representing Relations To represent binary relations Ordered pairs Tables Zero-one matrices Directed graphs

Representing Relations Using Matrices Suppose that R is a relation from A={a 1,a 2,,a m } to B={b 1,b 2,,b n }. R can be represented by the matrix M R =[m ij ], where m ij =1 if (a i,b j ) R, or 0 if (a i,b j ) R.

FIGURE 1 The Zero-One Matrix for a Reflexive Relation.

FIGURE 2 (8.3) FIGURE 2 The Zero-One Matrices for Symmetric and Antisymmetric Relations.

Representing Relations Using Digraphs Definition 1: A directed graph (digraph) consists of a set V of vertices (or nodes) and a set E of ordered pairs of elements of V called edges (or arcs). The vertex a is called the initial vertex of the edge (a,b), and the vertex b is called the terminal vertex of this edge.

FIGURE 3 The Directed Graph.

FIGURE 4 (8.3) FIGURE 4 The Directed Graph of the Relations R.

FIGURE 5 (8.3) FIGURE 5 The Directed Graph of the Relations R.

FIGURE 6 (8.3) FIGURE 6 The Directed Graph of the Relations R and S.

Closures of Relations Ex. Telephone line connections Let R be a relation on a set A. R may or may not have some property P. If there is a relation S with property P containing R such that S is a subset of every relation with property P containing R, then S is called the closure of R with respect to P. S: the smallest relation that contains R

Closures Reflexive closure Ex: R={(1,1),(1,2),(2,1),(3,2)} on the set A={1,2,3} The smallest relation contains R? The reflexive closure of R=R, where ={(a,a) a A} Symmetric closure The symmetric closure of R=R R -1, where R -1 ={(b,a) (a,b) R} Transitive closure

Paths in Directed Graphs Definition 1: A path from a to b in the directed graph G is a sequence of edges (x0,x1), (x1,x2),,(xn-1,xn) in G, where n is a nonnegative integer, and x0=a and xn = b. The path denoted by x0,x1,,xn-1, xn has length n. A path of length n >=1 that begins and ends at the same vertex is called a circuit or cycle. There is a path from a to b in R if there is a sequence of elements a, x1, x2,, xn-1, b with (a,x1) R, (x1,x2) R,, and (xn-1,b) R.

FIGURE 1 A Directed Graph.

Theorem 1: Let R be a relation on a set A. There is a path of length n, where n is a positive integer, from a to b iff (a,b) R n. Proof. (by mathematical induction)

Transitive Closures Definition 2: Let R be a relation on a set A. The connectivity relation R* consists of pairs (a,b) such that there is a path of length at least one from a to b in R. R*= n=1.. R n.

Theorem 2: The transitive closure of a relation R equals the connectivity relation R*. Proof. Lemma 1: Let A be a set with n elements, and R be a relation on A. If there is a path of length at least one in R from a to b, then there is such as path with length not exceeding n. When a b, if there is a path of length at least one in R from a to b, then there is such as path with length not exceeding n-1. Proof.

FIGURE 2 Producing a Path with Length Not Exceeding n.

Theorem 3: Let M R be the zero-one matrix of the relation R on a set with n elements. Then the zero-one matrix of the transitive closure R* is M R* = M R M R [2] M R [3] M R [n].

Algorithm 1: A procedure for computing the transitive closure. Procedure transitive closure (M R : zero-one n*n matrix) A:= M R B:=A for i:=2 to n begin A:=A M R B:=B A end O(n 4 ) bit operations

Warshall s Algorithm Named after Stephen Warshall in 1960 2n 3 bit operation Also called Roy-Warshall algorithm, Bernard Roy in 1959 Interior vertices W0, W1,, Wn Wk=[w ij (k) ], where w ij (k) =1 if there is a path from v i to v j such that all interior vertices of this path are in the set [v1, v2,, vk]. Wn= M R*

FIGURE 3 The Directed Graph of the Relations R.

Observation: we can compute Wk directly from Wk-1 Two cases (Fig. 4) There is a path from vi to vj with its interior vertices among the first k-1 vertices w ij (k-1) =1 There are paths from vi to vk and from vk to vj that have interior vertices only among the first k-1 vertices w ik (k-1) =1 and w kj (k-1) =1

FIGURE 4 Adding v k to the Set of Allowable Interior Vertices.

Lemma 2: Let Wk=w ij (k) be the zero-one matrix that has a 1 in its (i,j)th position iff there is a path from vi to vj with interior vertices from the set {v1, v2,, vk}. Then w ij (k) =w ij (k-1) (w ik (k-1) w kj (k-1) ), whenever I, j, and k are positive integers not exceeding n.

Algorithm 2: Warshall Algorithm Procedure Warshall(M R : n*n zero-one matrix) W:= M R for k:=1 to n begin for i:=1 to n begin for j:=1 to n wij:=wij (wik wkj) end end

Equivalence Relations Definition 1: A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. Definition 2: Two elements a and b are related by an equivalence relation are called equivalent. The notation a~b: to denote that a and b are equivalent elements with respect to a particular equivalence relation

Equivalence Classes Definition 3: Let R be an equivalence relation on a set A. The set of all elements that are related to an element a of A is called the equivalence class of a. Denoted by [a] R or [a] [a] R = {s (a,s) R} If b [a] R, then b is called a representative of the equivalence class

Equivalence Classes and Partitions Theorem 1: Let R be an equivalence relation on a set A. These statements for elements a and b of A are equivalent: a R b [a]=[b] [a] [b] Proof.

Observations a A [a] R =A [a] [b]= when [a] R [b] R The equivalence classes form a partition of A A partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union Ai for i I, Ai Aj= when i j i I Ai=S

FIGURE 1 A Partition of a Set.

Theorem 2: Let R be an equivalence relation on a set S. Then the equivalence classes of R form a partition of S. Conversely, given a partition {Ai i I} of the set S, there is an equivalence relation R that has the sets Ai, i I, as its equivalence classes.

Partial Orderings Definition 1: A relation R on a set S is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive. A set S together with its partial ordering R is called a partially ordered set, or poset, (S, R). Proof. Ex.1-3:,, Ex.4: older than Notation: : a b, but a b

Definition 2: The elements a and b of a poset (S, ) are called comparable if either a b or b a. If neither a b nor b a, a and b are incomparable. ( partial ) Ex. 5 When every two elements in the set are comparable, the relation is called a total ordering

Definition 3: If (S, ) is a poset and every two elements of S are comparable, S is called a totally ordered or linearly ordered set (or a chain), and is called a total order or a linear order. Ex.6: (Z, ) Ex.7: (Z+, ) Definition 4: (S, ) is a well-ordered set if it is a poset such that is a total ordering and every nonempty subset of S has a least element. Ex.8

Theorem 1: (The Principle of Well-Ordered Induction) Suppose that S is a well-ordered set. Then P(x) is true for all x S, if (inductive step): For every y S, if P(x) is true for all x S with x y, then P(y) is true. Proof.

Lexicographic Order (a 1, a 2 ) (b 1, b 2 ) (A 1, 1), (A 2, 2) Either if a 1 1 b 1 Or if a 1 =b 1 and a 2 2 b 2 n-tuples (Fig. 1)

FIGURE 1 The Ordered Pairs Less Than (3,4) in Lexicographic Order.

Hasse Diagrams Hasse Diagrams: some edges do not have to be shown Reflexive: loops can be removed Transitive: if (a,b) and (b,c), then (a,c) can be removed Remove all the arrows

FIGURE 2 Constructing the Hasse Diagram for ({1,2,3,4}, ).

FIGURE 3 (8.6) FIGURE 3 Constructing the Hasse Diagram of ({1,2,3,4,6,8,12}, ).

FIGURE 4 The Hasse Diagram of (P({a,b,c}), ).

Maximal and Minimal Elements a is maximal in the poset (S, ) if there is no b S such that a b. a is minimal in the poset (S, ) if there is no b S such that b a.

FIGURE 5 The Hasse Diagram of a Poset.

FIGURE 6 Hasse Diagrams of Four Posets. FIGURE 6 (8.6)

In a subset A of a poset (S, ), if u is an element of S such that a u for all a A, then u is an upper bound of A. In a subset A of a poset (S, ), if l is an element of S such that l a for all a A, then l is an lower bound of A.

FIGURE 7 The Hasse Diagram of a Poset.

Lattices A partially ordered set in which every pair of elements has both a least upper bound and a greatest lower bound is called a lattice

FIGURE 8 Hasse Diagrams of Three Posets. FIGURE 8 (8.6)

Topological Sorting Topological sorting: constructing a compatible total ordering from a partial ordering A total ordering is said to be compatible with the partial ordering R if a b whenever a R b. Lemma 1: Every finite nonempty poset (S, ) has at lease one minimal element.

Algorithm 1: topological sorting Procedure topological sort(s, : finite poset) k:=1 while S begin ak:=a minimal element of S S:=S-{ak} k:=k+1 end

FIGURE 9 (8.6) FIGURE 9 A Topological Sort of ({1,2,4,5,12,20}, ).

FIGURE 10 The Hasse Diagram for Seven Tasks.

FIGURE 11 A Topological Sort of the Tasks. FIGURE 11 (8.6)