- 91 Views
- Uploaded on
- Presentation posted in: General

Predicate Calculus to Sets

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

- x : integers positive (x) is a predicate statement:
- There are some integers that are “positive.”
- Some “sub-group” of the domain of integers has attribute of being “positive”

- Another way to specify this is via:
- List the positive integers { 42, 7009, 64, 679} as a group

- When we list the positive integers by unique (non-repeating) elements, then we have specified those positive integers as a SET of elements.

- Def: A SET is a collection of objects. (In listing the collection, no duplication is allowed.)
- Good example: a set called Fruit
- Fruit = { apple, banana, orange, pear, grape}

- Bad example ; a non-set called Fruit
- Fruit = { apple, banana, orange, apple, pear}

- Another example : a set called Homeowners
- Homeowners = { (Joe, #203); (Sally, #7); (Tom, #143) }
- note that the elements of this set are “pairs”

- Good example: a set called Fruit

- Def. : elements that belong to a set, S, are called members of S
- If x is a member of the set, S, then we may use the following notation:
x S

I will use a substitute symbol, ε , in these slides.

- so y ε S will mean y is a member of S.
- and y ε S will mean y is not a member of S

- Example from Book (Exercise 5.1 (i))
- Express the following in predicate calculus:
- “All the files in the System will be read-access files or write-access files.”
- \/ files: System_files ( readAccess(file) \/ writeAcess(file) )

- Express it with set notations:
- file ε System_files
- file ε readAccess_files \/ file ε writeAccess_files

- A set S may contain a finite number of members or an infinite number of members.
- How do we “list” an infinite number of members?
- A different notation is used (much like predicate calculus) :
- {signature I predicate term}

- Example 1 : set of integers larger than 100:
- { n : N I n > 100 n}

- Example 2 : set composed of pairs of integers where the 1st element is less than the 2nd:
- { x,y : N I x<y (x,y) }

- Def: A set that contains no member is called an empty set.
- Example : consider the following set
- { x : people I father (x,x) x}
- There is no one who is his/her own father.
- Therefore this is an empty set.
- An empty set may be represented as { } or O

- Def: A subset of a set S is a set that contains one or more elements of S (but does not contain any element that is not a member of S).
- Example : Let S = { 3, 11, 15, 4} and Z = {11, 15}
- Z is a subset of S or
- We can represent it with the notation Z S

- Example : Let S = { 3, 11, 15, 4} and Z = {11, 15}
- A subset Z of a set S is called a proper subset of S if Z is not equal to (contains less members) S.
- Example : S is the set of integers, and Z is the set of negative integers. Then Z is a proper subset of S.
- Z S

- Example : S is the set of integers, and Z is the set of negative integers. Then Z is a proper subset of S.

Note : Empty set, { }, is considered a subset of every set.

- Given a set S = { 1, 2, 3}, how may one increase the size of this set?
- Add more members into S (we will discuss operators on sets later)
- Consider permutations of subsets of S.

- Def: The set of all possible subsets of S is called the power set of S. The power set of S is represented as PS or sometimes IP S.
- Example ; let S = {4, 7, 2} then the PS is represented by Z, where:
- Z = { s1={ }, s2={4}, s3={7}, s4={2}, s5={4,7}, s6={4,2}, s7={7,2}, s8={4,7,2} }
- The power set, PS, or Z has 8 members.
- So, if x ε PS , then x S. (x is a member of power set of S then it is a subset of S.)

- Equality: Two sets, A and B, are equal ( = ) if they contain the same members.
A = B if and only if

{ \/ x I (x ε A) -> (x ε B) } and { \/ y I (y ε B) -> (y ε A) }

- The notion of proper subset may be expressed as:
- a set A is a proper subset of set B if and only if A is a subset of B but not equal to B
- A B but A = B.

- The notion of proper subset may be expressed as:

- Union: set A union set B results in a new set C whose members are composed of members from either set A or set B.
- The union operator may be specified as U.
- Example : A = {5, 34, 98} and B= { 23, 34, 58}
A U B = { 5, 23, 34, 58, 98}

- Thus A U B = { x I (x ε A) \/ (x ε B) }
- Intersection: set A intersect set B results in a new set C whose members are composed of members that are in both sets A and B.
- Intersection operator may be specified as
- Example : A = {5,34,98} and B { 23, 34, 58}
A B = { 34 }

- Thus A B = {x I (x ε A) /\ (x ε B) }

- Difference : The difference of set A and set B is defined as a set C formed by removing the members which are in B from the members of A.
- The difference operator is specified as \
- Example : A = { 34, 28, 5, 72} and B = { 22, 34, 5, 99}
A \ B = {28, 72}

- Example : “all files that are not used,”
- where A is the set of all files and
- B is the set of all used files.
A\B = all unused files

Set A

Set B

Union of Set A and B

Set A

Set B

Intersection of Set A and B

( the cross section)

Where is A\B in the above picture?

- Cross Product: the cross product of set A and set B forms a new set C whose members are pairs made up of members from set A and B.
- Cross product operator is specified with X
- Example: A = { Joe, Sally} and B = { 23, 56, 89}
- A X B = { (Joe,23), (Joe,56), (Joe,89), (Sally,23), (Sally,56), (Sally,89) }

- A generalized form of cross product of sets A1,- - -,An would be a set composed of n-tuples or {(a1,1 , a 2,1- - - ,an,1), (a1,2 , a2,2 - - -, an,2), (a1,3, a2,3 - - - ,an,3), - - - } where a1,1, a2,1, a3,1, - - - are elements of A1, A2, A3, - - - .
- Example: A = {2, 6}, B= {11, 45, 7}, and c = {90}
- A X B X C = { (2,11,90), (2,45,90), (2,7,90), (6,11,90), (6,45,90), (6,7,90) }