CS250 at CCUT Week 1: Introductions
Course Title: CS250 -- Discrete Structures I
Instructor: David Lu
Some facts about me:
- Born and grew up in the US (mostly in New York, near New York city)
- Went to college at the University at Buffalo, which is located in upstate NY, near Canada.
- Graduated with a BA in Philosophy
- Worked on a PhD in Philosophy at Syracuse University (also located in upstate NY - central), specializing in metaphysics and philosophical methodology
- Taught philosophy courses on ethics, metaphysics and epistemology, critical thinking, and formal logic at Syracuse University
Here are some pictures of SU:
The building housing the philosophy department:
- Now I teach discrete math, introduction to C++, and ethics at Portland State University
Here are some pictures of PSU and Portland
PSU Library:
PSU location in downtown Portland:
Portland from the east side, looking west to downtown:
Portland steel bridge:
Mount Hood in the distance view from PSU:
Columbia River that separates Oregon state from Washington state:
Willamette River that separates east from west Portland:
Willamette River:
CS250 Purpose and Goals
CS 250 is the first term of the two term sequence CS 250-251. The main goal of the sequence is that students obtain those skills in discrete mathematics and logic that are used in the study and practice of computer science.
The goals of the course are listed below:
- Describe basic properties of sets, bags, tuples, relations, graphs, trees, and functions.
- Perform traversals of graphs and trees; construct simple functions by composition of known functions; determine whether simple functions are injective, surjective, or bijective; and classify simple functions by rate of growth.
- Describe the concepts of countable and uncountable sets, and apply the diagonalization method to construct elements that are not in certain countable sets.
- Construct inductive definitions for sets, construct grammars for languages (sets of strings), and construct recursive definitions for functions and procedures.
- Construct a topological sort of a partially ordered set and determine whether a partially ordered set is well-founded.
- Use elementary counting techniques to count simple finite structures that are either ordered or unordered, to count the worst case number of comparisons and, with discrete probability, to count the average number of comparisons for simple decision trees.
- Find closed form solutions for simple recurrences using the techniques of substitution, cancellation, and generating functions.
- Demonstrate standard proof techniques and the technique of inductive proof by writing short informal proofs about simple properties of numbers, sets, and ordered structures.
You should have had an introduction to set theory by now. Let's do a little review before we take a look at our next topic.
Basic definitions for set theory.
Definition 1: A set is a well defined collection of objects, considered as an object itself. The objects making up the set are called elements or members of the set. There is no order to the elements and no multiplicity.
If a is an element of set X, then we write a∈X. And if not, we write a∈/X.
Sets are conventionally denoted with capital letters.
There is a set with no members, and it's called the empty set, denoted by ∅.
There are two ways of describing a set.
-
The first is by extension, listing each member of the set. For example: T={1,2,3,4}
-
The other is by intensional definition, using a rule or semantic description. For example: S is the set containing the siblings of Richard. (Written S={x : x is a sibling of Richard})
We often have the choice of specifying a set either intensionally or extensionally. For example: R={x : x is one of the first four positive integers}. So T=R. We use a pipe, '∣', or sometimes a colon to read "such that." Here are some more examples:
- S={x∣ x is a positive integer less than 100 }
- S={x∣x∈Z+ and x<100}
- S={x∈Z+∣x<100}
- A predicate can be used, e.g., S={x∣P(x)} where P(x) is true iff x is a prime number.
- Positive rational numbers Q+={x∈R∣∃p,q∈Z+x=p/q}
Review:
- S={a,b,c,d}.
- Order not important S={a,b,c,d}={b,c,a,d}.
- Each distinct object is either a member or not; listing more than once does not change the set. S={a,b,c,d}={a,b,c,b,c,d}.
- Dots “. . . ” may be used to describe a set without listing all of the members when the pattern is clear. S={a,b,c,d,...,z} or S={5,6,7,...,20}.
- Try not to overuse this. Patterns are not always as clear as the writer thinks.
- Sets can be elements of other sets, e.g.,
{{1,2,3},a,{u},{b,c}}
- The empty set is different from the set containing the empty set ∅̸={∅}
Definition 2: If X and Y are sets and have the same elements, then they are identical. (Extensionality) The identity of sets are given by their extensions (the elements they contain). This definition gives us a common proof strategy for proving set identities.
Definition 3: If every element of X is an element of Y, then X is a subset of Y. We write X⊆Y.
It follows from this definition that every set is a subset of itself.
Also, it's possible for a set to be an element of another set.
If X⊆Y and Y̸⊆X then X⊂Y. In other words, if every element of X is an element of Y, but not every element of Y is an element of X, then we say that X is a proper subset of Y.
Definition 4: The set consisting of all subsets of X is called the power set of X, written P(X)
What are all the possible subsets of {a,b,c}?
Definition 5: The union of X and Y, written X∪Y, is the set of all things which are elements of X or Y or both.
X∪Y={x : x∈X∨x∈Y}
Venn diagrams can be useful to illustrate union and intersection.
Definition 6: The intersection of X and Y, written X∩Y, is the set of all things which are elements of both X and Y.
Definition 7: If Z is a set of sets, then ⋃Z is the set of elements of elements of Z.
⋃Z={x : x belongs to an element of Z} or
⋃Z={x : there is a Y∈Z such that x∈Y}
Definition 8: If Z is a set of sets, then ⋂Z is the set of objects which all elements of Z have in common.
⋂Z={x : x belongs to every element of Z} or
⋂Z={x : for all Y∈Z, x∈Y}
Definition 9 The difference X∖Y is the set of all elements of X which are not elements of Y.
X∖Y={x : x∈X and x∈/Y}
B = Boolean values = {true,false}
N = natural numbers = {0,1,2,3,...}
Z = integers = {...,−3,−2,−1,0,1,2,3,...}
Z+ = Z≥1 = positive integers = {1,2,3,...}
R = set of real numbers
R+ = R>0 = set of positive real numbers
C = set of complex numbers
Q = set of rational numbers
We can use interval notation to describe subsets of sets upon which an order is defined, e.g., numbers.
- [a,b]={x∣a≤x≤b}
- [a,b)={x∣a≤x<b}
- (a,b]={x∣a<x≤b}
- (a,b)={x∣a<x<b}
- closed interval [a,b]
- open interval (a,b)
- half-open intervals [a,b) and (a,b]
Definition:
If there are exactly n distinct elements in a set S, where n is a nonnegative integer, we say that S is finite. Otherwise it is infinite.
Definition
The cardinality of a finite set S, denoted by ∣S∣, is the number of
(distinct) elements of S.
Examples:
- ∣∅∣=0
- Let S be the set of letters of the English alphabet. Then ∣S∣=26.
- ∣{1,2,3}∣=3
- ∣{∅}∣=1
- The set of integers Z is infinite.
Definition
The set of all subsets of a set S is called the power set of S.
- It is denoted by P(S).
- Formally: P(S)={S′∣S′⊆S}
- In particular, S∈P(S) and ∅∈P(S).
- Example: P({a,b})={∅,{a},{b},{a,b}}
- If ∣S∣=n then ∣P(S)∣=2n
- The ordered n-tuple (a1,a2,...,an) is the ordered collection of n elements, where a1 is the first, a2 the second, etc., and an the n-th (i.e., the last).
- Two n-tuples are equal iff their corresponding elements are equal.
(a1,a2,...,an)=(b1,b2,...,bn)↔a1=b1∧a2=b2∧...∧an=bn
- 2-tuples are called ordered pairs
Ordered pairs, Tuples, and Cartesian Products
Sets have no order, but sometimes it is necessary to think of a collection in ordered terms. We use angle brackets to specify ordered pairs, such as ⟨x,y⟩. Order matters so ⟨x,y⟩̸=⟨y,x⟩.
Definition 10: Given sets X and Y, their Cartesian product X×Y={⟨x,y⟩ : x∈X and y∈Y}.
If X={0,1} and Y={1,a,b} what is X×Y?
Theorem 1 If X has n elements and Y has m elements, then X×Y has n⋅m elements.
Why is this the case?
Proof
For every element x in X, there are m elements of the form ⟨x,y⟩∈X×Y.
Let Yx=⟨x,y⟩:y∈Y.
Since whenever x1̸=x2,⟨x1,y⟩̸=⟨x2,y⟩, Yx1∩Yx2=∅.
But if X=x1,...,xn, then X×Y=Yx1∪⋅⋅⋅∪Yxn, and so has n⋅m elements.
To visualize this, arrange the elements of X×Y in a grid:
Yx1={⟨x1,y1⟩⟨x1,y2⟩...⟨x1,ym⟩}
Yx2={⟨x2,y1⟩⟨x2,y2⟩...⟨x2,ym⟩}
...
Yxn={⟨xn,y1⟩⟨xn,y2⟩...⟨xn,ym⟩}
Since the xi are all different, and the yj are all different, no two of the pairs in this grid are the same, and there are n⋅m of them.
Russell's Paradox
In a village, the barber shaves everyone who does not shave themselves, and no one else.
The question that prompts the paradox is this: Does the barber shave himself?
Another Informal proof:
If X has n elements then P(X) has 2n elements.
proof
Given an element $x$ of $S$, each subset of $S$ either includes $x$ or does not include $x$ (by definition of set), which gives us two possibilities.
The same reasoning holds for any element of $S$.
We can see that this means there are 2 * 2 * … * 2 = $2^{|S|}$ total possible combinations of elements of $S$.
- Which of these sets are equal?
{x,y,z}, {z,y,z,x}, {y,x,y,z}, {y,z,x,y}
- List the elements of each set where N = {1,2,3,...}.
(a) A= { x∈N | 3<x<9}
(b) B= { x∈N | x is even, x<11}
- Prove that B∖A=B∩A
(The complement of a set X, X = {x | x∈U and x∈/X})
- Give some example sets that make the following statements true:
(a) A∩B=A∩C and B̸=C
(b) D∪E=D∪F and E=F
- Prove that A∩(B∪C)=(A∩B)∪(A∩C) (Set distributivity law)
- Determine the validity of the following argument, using a Venn diagram:
- All my friends are musicians.
- Link is my friend.
- None of my neighbors are musicians.
Therefore Link is not my neighbor.
- Which of the following sets are identical?
A={x∣x2−4x+3=0}
B={x∣x2−3x+2=0}
C={x∣x∈N,x<3}
D={x∣x∈N,x is odd, x<5}
E={1,2}
F={1,2,1}
G={3,1}
H={1,1,3}
- Find the power set P(A) of A={{a,b},{c},{d,e,f}}