Академический Документы
Профессиональный Документы
Культура Документы
Science (COSC-3302),
Lecture 1 (prepared after
Chapter 1 of Martins 2011
Stefan Andrei
textbook)
04/22/16
COSC-3302, Lecture 1
Foundations of Computer
Science
COSC-3302 is a 3 credit points module with the
following grading percentages:
04/22/16
COSC-3302, Lecture 1
Course Etiquette
Code of conduct
no copying
for details, see webpage
04/22/16
COSC-3302, Lecture 1
04/22/16
COSC-3302, Lecture 1
COSC-3302, Lecture 1
Course Objectives
Preliminary review
04/22/16
COSC-3302, Lecture 1
Lecture Structure
04/22/16
COSC-3302, Lecture 1
04/22/16
COSC-3302, Lecture 1
04/22/16
COSC-3302, Lecture 1
04/22/16
COSC-3302, Lecture 1
10
04/22/16
pq
pq
pq
pq
COSC-3302, Lecture 1
11
04/22/16
(p q)
(p
q)
COSC-3302, Lecture 1
12
Example: p p
Example: p p
This is written as P Q
This is written as P Q
04/22/16
COSC-3302, Lecture 1
13
COSC-3302, Lecture 1
14
04/22/16
COSC-3302, Lecture 1
15
04/22/16
COSC-3302, Lecture 1
16
x (x - 1 is prime)
x (x - 1 is prime)
04/22/16
COSC-3302, Lecture 1
17
04/22/16
COSC-3302, Lecture 1
18
Initial assumptions
Statements that have been derived
previously
Generally accepted facts
04/22/16
COSC-3302, Lecture 1
19
COSC-3302, Lecture 1
20
An indirect proof:
04/22/16
COSC-3302, Lecture 1
21
04/22/16
COSC-3302, Lecture 1
22
A proof by cases:
04/22/16
COSC-3302, Lecture 1
23
Sets
04/22/16
COSC-3302, Lecture 1
24
Sets (contd.)
COSC-3302, Lecture 1
25
Sets (contd.)
04/22/16
COSC-3302, Lecture 1
26
Sets (contd.)
Examples:
{1, 2, 3, 5} {2, 4, 6} = {1, 2, 3, 4, 5, 6}
{1, 2, 3, 5} {2, 4, 6} = {2}
{1, 2, 3, 5} - {2, 4, 6} = {1, 3, 5}
04/22/16
COSC-3302, Lecture 1
27
Sets (contd.)
04/22/16
COSC-3302, Lecture 1
28
Sets (contd.)
04/22/16
COSC-3302, Lecture 1
29
Sets (contd.)
2A = { X | X A }.
Example:
2{a,b,c} = {, {a}, {b}, {c}, {a,b}, {a,c}, {b,c},
{a,b,c}}.
Note: the empty set and the set A itself are in As power
set.
Example: How much is 2{a,b,c,d}?
04/22/16
COSC-3302, Lecture 1
30
Sets (contd.)
04/22/16
COSC-3302, Lecture 1
31
Examples:
1.
2.
04/22/16
COSC-3302, Lecture 1
32
04/22/16
COSC-3302, Lecture 1
33
f -1( f(x) ) = x
f (f -1(y)) = y.
04/22/16
COSC-3302, Lecture 1
-1
is also a
34
04/22/16
COSC-3302, Lecture 1
35
04/22/16
COSC-3302, Lecture 1
36
Relations
04/22/16
COSC-3302, Lecture 1
37
Examples:
04/22/16
COSC-3302, Lecture 1
38
04/22/16
COSC-3302, Lecture 1
39
Languages
04/22/16
COSC-3302, Lecture 1
40
Languages (contd.)
04/22/16
COSC-3302, Lecture 1
41
Languages (contd.)
04/22/16
COSC-3302, Lecture 1
42
Languages (contd.)
04/22/16
COSC-3302, Lecture 1
43
Languages (contd.)
L* = {Lk | k }.
L* for every language L, since L0 = {}.
Strings are finite, and languages may not be,
but to use a language we need a finite
description:
04/22/16
COSC-3302, Lecture 1
44
Recursive Definitions
Basis statement: 0 .
Recursive part: if n then n+1 .
Every element of can be obtained from the
first two statements.
04/22/16
COSC-3302, Lecture 1
45
Recursive Definitions
(contd.)
Summary:
1B
For every n B, 2n B
For every n B, 5n B
04/22/16
COSC-3302, Lecture 1
46
Recursive Definitions
(contd.)
We denote by F the subset of 2
{a, b}*
defined
by:
04/22/16
COSC-3302, Lecture 1
47
Recursive Definitions
(contd.)
Example (real-world): The set of cities
reachable from city s.
s r(s).
04/22/16
COSC-3302, Lecture 1
48
Structural Induction
a Expr.
For every x and every y in Expr, x y and x y are in
Expr (where x y and x y are the strings x+y, x*y).
For every x Expr, (x) Expr (where (x) is (x) ).
04/22/16
COSC-3302, Lecture 1
49
04/22/16
COSC-3302, Lecture 1
50
04/22/16
COSC-3302, Lecture 1
51
04/22/16
COSC-3302, Lecture 1
52
04/22/16
COSC-3302, Lecture 1
53
04/22/16
COSC-3302, Lecture 1
54
04/22/16
55
04/22/16
COSC-3302, Lecture 1
56
Structural Induction
(contd.)
Proof:
04/22/16
57
04/22/16
COSC-3302, Lecture 1
58
Balanced
If x, y Balanced, then xy Balanced and (x)
Balanced
04/22/16
COSC-3302, Lecture 1
59
Structural Induction
(contd.)
The basis step is to show that B() is true.
04/22/16
COSC-3302, Lecture 1
60
04/22/16
COSC-3302, Lecture 1
61
04/22/16
COSC-3302, Lecture 1
62
COSC-3302, Lecture 1
63
Summary
1.
2.
3.
4.
5.
6.
04/22/16
COSC-3302, Lecture 1
64
Reading suggestions
04/22/16
COSC-3302, Lecture 1
65
Coming up next
04/22/16
COSC-3302, Lecture 1
66
04/22/16
COSC-3302, Lecture 1
67