Title: Different discrete structures are used in modeling and
1Sets
Different discrete structures are used in
modeling and problem solving sets (unordered
collections) relations (sets of pairs) graphs
(sets of vertices and edges)
Sets are used to group objects together.
- A set is a collection of objects (members,
elements). - A set is completely defined by its elements.
- An element belongs to a set
- (or a set contains its elements).
- Notation
- x?A, x belongs to set A
- y ?A, y does not belong to set A
2Ways to describe sets
1. To list its elements in curly braces
- a set of vowels in English alphabet
- V a, e, i, o, u
- a set of odd positive integers less then 10
- B 1, 3, 5, 7, 9
- a set of natural numbers (nonnegative integers)
- ? 0, 1, 2, 3,
- a set of integers
- Z,-2, -1, 0, 1, 2,
32. To use set builder notation
- set of odd positive integers less then 10
- Bx x is positive odd integer less then 10
- set of rational numbers
- Q a / b a, b ?Z and b ?0
- set of positive integers
- Z x x ?Z ? xgt0
- a set of squares of natural numbers
- S x2 x?N
- A (a, b) a, b ?N and a b
3. Special notation an empty (null) set ?
or ?x x ? ?
4Definition. The set A is said to be a subset of
B if and only if every element of A is also an
element of B. A ? B ? ?x x? A ? x ?B The
subset A is said to be a proper subset of B if
and only if B contains at least one element that
is not in A. A ? B ? ?x x?A ?x ?B??x x?B
? x ? A
5Venn diagrams help visualize relation between sets
U
A ? B ?x x?A? x?B
B
? x
A
? y
A ? B ?x x?A? x?B and ?y y?B ? y?A
U - universe (of discourse), a set that contains
all elements under consideration.
6Theorem. Empty set is a subset of every set, that
is ? ??S
Proof. We need to prove that any x that belongs
to ? belongs to S, i. e. ?x x?? ? x?S . But
the hypothesis x?? is always false by the
definition of empty set. So, the implication x??
? x?S is vacuously true.
7Do not confuse ? and ? (or ?) signs!
Let A a, ?, b.
a ? A a? A a ? A a ? A a ? A b ?
A b ? A a, b ? A a, b ? A ? ? A ?
? A ? ? A
T F F T T F T T T T T T
8Equality of two sets
- Two sets are considered to be equal if they
contain the same - elements. For example
- 1, 3, 5 3, 5, 1, 5
- 1, 4, 9, 16 x2 x ? Z ? x2 lt20
More rigorously
Definition. Two sets are equal if and only if
each of them is a subset of the other. A B ?
A? B ? B ? A
9Set operations
- The union of two sets contain elements which
belong to - either of them or to both
By x?A ? x?A ? x? B (p ? p ?q is a tautology)
we can show that A ? A ?B and similar B ? A ?B
10By x?A ? x?B ? x?A (p ? q ? p is a tautology)
you can show that A ?B ? A and similar A?B ? B
11The difference of two sets A-B is the set of
elements that belong to A and do not belong to B
Pay attention that A-B ? B-A
A
A
B
B-A
A-B
12- Compliment of a set A (with respect to some
universe U) - is defined as
Another notation
U
A
?A
13Definition. Let S be a set. If there are exactly
n distinct elements in S where n is a nonnegative
integer, we say that S is a finite set and n is
the cardinality of S. S n.
What is the cardinality of each of the following
sets?
a
1
a
1
a, a
2
a, a, a, a
3
14Cardinality of empty set ? 0
?1
?, ?2
?, ?, ?, ?3
15Definition. Given a set S, the power set of S is
the set of all subsets of set S. The power set of
S is denoted Power(S).
?, a, b, a, b
Power(a, b)
Power(a, b)
4
Theorem. The cardinality of a finite set S with
cardinality Sn is 2n, Power(S)2S.
How to count all subsets of the set S?
S x1, x2 , x3, x4, , xn-1, xn
1 0 1 0 0 1
x1, x3, xn ? S
2 ? 2 ? 2 ? ... ? 2 2n
16 Set Laws The proof follows directly
from the definitions of set operations and laws
of logic
- Commutative Law
- A?B B ?A
- A?B B ? A
Proof. A?Bx x?A ? x?B , by definition of
union x x?B ? x?A , by commutative
property of ? B ?A, by definition of union
17- Associative Law
- A?(B ?C) (A ?B) ?C
- A ?(B?C) (A ? B) ?C
Proof. A ?(B?C) x (x ? A) ? (x? B?C), by
definition of sets intersection x (x ? A) ?
(x? B) ?(x ?C), by definition of sets
intersection x (x ? A) ? (x? B) ?(x ?C),
by associative property of ? x (x ? A ? B)
?(x ?C), by definition of sets intersection
(A ?B) ?C, by definition of sets intersection
18- Distributive Law
- A ?(B?C) (A ?B) ? (A ?C)
- A ? (B ?C) (A ?B) ? (A ?C)
- Lets prove it by using another way to prove
equality of two sets, - membership table method.
- This method is based upon observation that for
any element - x there are only to possibilities for every set
- either x? A or x?A .
- For two sets we have four possibilities
- x? A, x? B
- x? A, x?B
- x ?A, x?B
- x ?A, x?B
19If there are three sets involved, we have 23
cases.
A B C B?C A ?(B?C) A ?B A ?C (A ?B) ?
(A ?C) 1 1 1 1 1
1 1 1 1 1 0
0 1 1 1
1 1 0 1 0 1
1 1 1 1 0
0 0 1 1
1 1 0 1 1 1 1
1 1
1 0 1 0 0 0 1
0 0 0 0 1 0
0 0 1
0 0 0 0 0 0
0 0 0
20The following laws can be proved by using
appropriate logic laws in set descriptors
21A ?? A
Proof. A ?? x x ?A ? x??, by defn of a set
union x x ?A ? F, since ?x x?? , x??F
x x ?A , by identity law p ? F ? p A
In the proof of A ?U A you can consider x ? U
T and use another identity law p ? T ? p
22- DeMorgans Laws
- ?(A?B) ?A??B
- ?(A?B) ?A??B
?
23Example of using DeMorgans Law
Let A a, d, e, g and B c, d, f, g from
the universe U a, b, c, d, e, f, g, h, i. To
verify that ?(A?B) ?A??B find each of these two
sets independently to find that they are indeed
the same.
1) ?(A?B) ?a, c, d, e, f, g b, h, i
2) ?A??B b, c, f, h, i ? a, b, e, h, i b,
h, i
are the same, as predicted.
24A ?U U A ? ? ?
p?T ? T p ? F ? F
- Absorption Laws
- A ?(A ?B) A
- A ?(A ?B) A
p? (p ?q) ? p p ?(p ? q) ? p
These laws can be proved by using logic laws or
membership tables.
25What is a proof?
A proof is a method of ascertaining truth.
- In everyday life different kinds of proofs are
acceptable - Jury trial.
- Word of God.
- Word of Boss.
- Experimental science The truth is guesses and
confirmed - or refuted by experiments.
- Sampling like public opinion is obtained by
polling. - Inner conviction..
These are not valid proofs in mathematical sense.
They all can go wrong
26Mathematics uses a particularly convincing way to
argue that something is true.
Definition. A proof is a formal verification of a
proposition by a chain of logical deductions
starting from the base set of axioms. A proof
takes axioms and definitions and uses deduction
rules, step by step, to get a desired conclusion.
27Proof methods If a statement considers a few
numbers of cases it can be proved by
exhaustive checking. Example All
students in this class are computer science
major. We can easily verify is it true or
false. Truth table method. To prove a
statement about small number of Boolean
variables make a truth table and check all
possible cases. Example (p?q) ? (? q? ?p). By
inspection we see that lhs has the same truth
value as the rhs for all values of p and q.
28Theorem 1. Let A and B be any two sets. Prove
that A ? A?B
- How can we prove that A ? A?B for any sets A and
B? - It is not sufficient to consider 10 or 100 (or
even 1000, etc.) - different sets! We must prove it in general.
- First we need to use the definition of subset
relation to state - what we need to prove in the formal way
- A ? A?B ? ?x x?A ? x?A ?B.
- To prove something for any x, it is sufficient
to prove it - for arbitrary x. So, take arbitrary x and prove
that if x?A, - then x?A ?B.
29Proof. Assume x is arbitrary element from set A
x?A, (1).
But x ?A ? x ?A ? (any other proposition) by
the inference rule p ?p ? q ( or since p ?p ? q
is a tautology) So, (1) implies in particular,
that x ?A ? x ?B, (2). By the definition of set
union, (2) is equivalent to x?A ?B, (3).
We showed that arbitrary element x from set A
belongs to the union A ?B, that is A ? A?B.
30Now you might be able to prove in similar way the
following
Theorem 2. Let A and B be any two sets. Prove
that A?B ? A.
Proof. We need to prove that for any x such that
x? A?B, x?A, i.e. ?x x? A?B ? x? A. So, take
arbitrary x ? A?B (1). By the definition of the
set intersection (1) implies that x ? A ? x?B,
(2). (2) implies that x ? A, (3) by the
inference rule p ?q ? p. We showed that any
element from A?B belongs to A. By the
definition of subset relation it means that A?B ?
A.
31Theorem 3. Let A, B and C be any sets. Then if A
? B and B ? C , then A ? C.
- To prove a statement p?q means to show that it
is always true, - or it is a tautology.
- If p is false, the whole implication is true
regardless of the - value of q. So, if p is false we have nothing to
prove.
- If p is true, than the whole implication may
turn to false if q is false. - We need to show that it never happens. In other
words, we need - to show that if p is true than q is always true.
32This is called a direct proof.
In direct proof we assume that p is true.
Making use of this assumption and any other
relevant facts (definitions, axioms, principles,
proved theorems, etc.) we build a chain of
logical reasoning leading to the conclusion that
q is true.
Proof. Assume p A ? B and B ? C to prove q
A ? C. To prove A ? C take any x? A, (1) to show
that x?C. By assumption A ? B and subset
definition, it can be implied from (1) that x?
B, (2). By assumption B ? C it can be implied
from (2) that x ? C, (3). We showed that any
element from A belongs to C, that is A ? C. So,
assuming p we showed that q is implied, or p?q
is always true.