Professional Documents
Culture Documents
Agi Kurucz
Room S1.17
E-mail: agi.kurucz@kcl.ac.uk
URL:
http://www.inf.kcl.ac.uk/staff/kuag/
Course structure
11 weeks, with a reading week in between:
c
A.
Kurucz, Kings College London, 2015
Course material
Recommended textbooks:
K.H. Rosen, Discrete Mathematics and Its Applications.
6th ed., McGraw Hill, 2007. ISBN 9780072880083
E. Kinber and C. Smith, Theory of Computing: A Gentle Introduction.
Prentice Hall, 2001. ISBN 0130279617
c
A.
Kurucz, Kings College London, 2015
Coursework, exam
Coursework:
You do not need to submit the coursework solutions, the courseworks are
so-called self tests. Their solution will be published usually two weeks after
their issue dates, so you will be able to compare your solutions with the given
ones.
There will be four courseworks, please consult KEATS regularly.
c
A.
Kurucz, Kings College London, 2015
c
A.
Kurucz, Kings College London, 2015
The course aims to develop your problem solving skills and your ability to
express yourself in a more precise manner.
c
A.
Kurucz, Kings College London, 2015
Sets
Relations
Functions
Discrete probability
Graphs
Trees
Finite automata
Regular languages
c
A.
Kurucz, Kings College London, 2015
xS
x
/S
x, y S
4CCS1FC1 Foundations of Computing I
c
A.
Kurucz, Kings College London, 2015
EXAMPLE :
Any set defined this way is denoted by listing its elements, separated by
commas, and surrounding the listing with braces:
A = {Cinderella, Tasmania, Tuesday} .
EXAMPLE :
c
A.
Kurucz, Kings College London, 2015
c
A.
Kurucz, Kings College London, 2015
10
Special sets
The set with no elements is called the empty set. The empty set is denoted
by { } or more often by the symbol
EXAMPLE :
{a, , Joe}
or
{}.
EXAMPLE :
c
A.
Kurucz, Kings College London, 2015
11
Equality of sets
Two sets are equal if they have the same elements.
We denote the fact that two sets A and B are equal by writing
A=B
A 6= B
F OR
EXAMPLE :
{u, g, h} = {h, u, g}
{a, b, c} =
6 {a, c}
{Monday} =
6
{1, 2} = {1, 1, 1, 2, 2}
{2} =
6 {{2}}
c
A.
Kurucz, Kings College London, 2015
12
OF INFINITE SETS :
N = {0, 1, 2, 3, . . . }
N+ = {1, 2, 3, . . . }
natural numbers,
positive natural numbers,
integers,
R+
c
A.
Kurucz, Kings College London, 2015
13
S =
x | x has property P
We read this as
S is the set of all x such that x has property P.
Or, if we also know that all the elements in S come from a larger set A,
then we can write
S = x A | x has property P
c
A.
Kurucz, Kings College London, 2015
14
c
A.
Kurucz, Kings College London, 2015
15
Russells paradox
Not every property is suitable for describing sets. Here is a tricky one.
Let T be the set of all sets that are not elements of themselves:
T = {A | A is a set and A
/ A}
Q UESTION :
Is T T or not?
Well, either T T or T
/ T . Let us examine both cases:
If T
/ T , then the property we used to describe T does hold for T .
So it is not the case that T is a set and T
/ T .
So either T is not a set, or T T .
But as T is a set, T T follows. So this case is impossible as well.
c
A.
Kurucz, Kings College London, 2015
16
c
A.
Kurucz, Kings College London, 2015
17
If n N then n + 1 N.
0N
1 Odd
If n Odd then n + 2 Odd and n 2 Odd.
1A
If x A then x + 3 A.
c
A.
Kurucz, Kings College London, 2015
18
Subsets
A set B is a subset of a set A, if every element of B is also an element of A.
Notation:
BA
.
Venn diagram of B A
A
.
F OR
EXAMPLE :
{a, c} {a, b, c, d}
{0, 1, 5} N
SS
NZ
NN
BA .
c
A.
Kurucz, Kings College London, 2015
19
E XERCISE 1:
Show that A B.
Show that A B.
As 0 N and 3 = 4 0 + 3, we have 3 B.
c
A.
Kurucz, Kings College London, 2015
20
A = {3k + 1 | k N},
B = {4k + 1 | k N}.
E XERCISE :
4 = 3 1 + 1. So k = 1 shows that 4 A.
c
A.
Kurucz, Kings College London, 2015
21
A=B ,
AB
AND
BA .
A 6= B ,
c
A.
Kurucz, Kings College London, 2015
22
P (S)
F OR
EXAMPLE :
P {u, v, w} = , {u}, {v}, {w}, {u, v}, {u, w}, {v, w}, {u, v, w}
P {Joe, Tuesday} = , {Joe}, {Tuesday}, {Joe, Tuesday}
P (N) = {X | X N}.
c
A.
Kurucz, Kings College London, 2015
23
A B = {x | x A or x B}
.
Venn diagram of A B
.
F OR
EXAMPLE :
A = {4, 7, 8}
and
B = {10, 4, 9} .
c
A.
Kurucz, Kings College London, 2015
24
Properties of union
A=A
AB =BA
(A B) C = A (B C)
commutativity of
associativity of
n
[
Ai .
i=1
AA=A
if A B then A B = B
if A B = B then A B
c
A.
Kurucz, Kings College London, 2015
25
A B = {x | x A and x B}
.
F OR
EXAMPLE :
A = {4, 7, 8}
and
B = {10, 4, 9} .
Then A B = {4} .
If A B = , then A and B are called disjoint.
4CCS1FC1 Foundations of Computing I
c
A.
Kurucz, Kings College London, 2015
26
Properties of intersection
A=
AB =BA
(A B) C = A (B C)
commutativity of
associativity of
n
\
Ai .
i=1
AA=A
if A B then A B = A
if A B = A then A B
distributive laws: A (B C) = (A B) (A C)
A (B C) = (A B) (A C)
A (B C) 6= (A B) C
c
A.
Kurucz, Kings College London, 2015
27
A B = {x | x A and x
/ B}
.
F OR
EXAMPLE :
A = {4, 7, 8}
and
B = {10, 4, 9} .
c
A.
Kurucz, Kings College London, 2015
28
A = U A = {x U | x
/ A}
.
U
Venn diagram of A
A
c
A.
Kurucz, Kings College London, 2015
29
A A = U
A A =
A = A
U =
= U
De Morgans laws: A B = A B
A B = A B
AB =AB
A
if A B then B
A then A B
if B
c
A.
Kurucz, Kings College London, 2015
30
Exercise 1.1
Show that, for any X, Y and Z, we always have X (Y Z) = (X Y ) (X Z).
S OLUTION : According to slide 22, we need to show both
(1) X (Y Z) (X Y ) (X Z), and
(2) (X Y ) (X Z) X (Y Z).
Watch out! It is not enough to give (or draw) some example sets X, Y, Z for
which (1) and (2) hold. We need to show (1) and (2) using no assumptions
on the sets X, Y, Z, using only the properties of set operations and .
For (1): We need to show that every element of X (Y Z) is also an element
of (X Y ) (X Z). Take an arbitrary x X (Y Z). Then both x X and
x Y Z. There are two cases: either x Y or x Z. In the first case, x X Y .
In the second case x X Z. So in either case, x (X Y ) (X Z).
For (2): Take an arbitrary x (X Y ) (X Z). Then there are two cases: either
x X Y , or x X Z. In the first case, both x X and x Y . In the second
case, both x X and x Z. So x X in both cases, and either x Y or x Z,
so x Y Z. So, x X (Y Z).
4CCS1FC1 Foundations of Computing I
c
A.
Kurucz, Kings College London, 2015
31
Exercise 1.2
6= A B.
Show that in general A B
and
S OLUTION : We need to find and describe some sets A and B such that A B
A B are different sets. There can be many possible solutions, here is one.
Let the universal set be U = {1, 2, 3}. Let A = {1} and B = {2}.
= {1, 3}. So A B
= {1, 3} and A B = {2, 3}.
Then A = {2, 3} and B
but 1
These are two different sets as, for example, 1 A B,
/ A B.
c
A.
Kurucz, Kings College London, 2015
32