14
A Quick Math Overview (not the last one!) •Section 1.4, you should it read carefully! •Reading the corresponding material from the book is strongly encouraged

A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Embed Size (px)

Citation preview

Page 1: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

A Quick Math Overview(not the last one!)

•Section 1.4, you should it read carefully!

•Reading the corresponding material from the book is strongly encouraged

Page 2: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Why Math?

•We will formulate precise definitions of different kinds of automata

•We will formulate and proof properties of these automata

Math provides the tools to make these definitions unambiguous

Among others,Today’s computers

Again we need math to do this

•Along the way we will formulate precisely:•Nondeterminism•Computation•State (configuration) of a computation

Page 3: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Why Math? (II)We are going to define formal models of computation

Name of Model Kind of language

Finite Automata regular languages

Pushdown Automata Context-free Languages

Turing Machines Turing-computable languages

Page 4: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Sets

• Sets are denoted by { <collection of elements> }

•Examples:

{}{a,b}{{}}{1, 2, …, 100}

{0, 1, 2, …}

{0,2,4, …}{2n | n }

“the empty set”“the set consisting of the elements a and b”“the set consisting of the empty set”

“the set consisting of the first 100 natural numbers”“the set consisting of all natural numbers” Also denoted by .“the set of all natural pair numbers”“the set of all natural pair numbers”

Page 5: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Set Inclusion and Set Equality

Definition: Given 2 sets, A and B, A is contained in B, denoted by A B, if every element in A is also an element in B

True or false:

{e,i,t,c} {a, b, …, z}

for any set A, A A

for any set A, A {A}

true

true

false

Definition: Given 2 sets A and B, A is equal to B, denoted by A = B, if A B and B A

Page 6: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Cartesian Product

Definition: Given two sets, A and B, the Cartesian product of A and B, denoted by A B, is the following set:

{(a,b) | a A and b B}

Examples:

•What is: {1, 2 , 3} {a,b} =

•True or false: {(1,a), (3,b)} {1, 2 , 3} {a,b}

•True or false: {1,2,3} {1, 2 , 3} {a,b}

true

false

pair or 2-tuple

{(1,a), (1,b), (2,a), (2,b), (3,a), (3,b)}

Page 7: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Cartesian Product II

Definition: Given three sets, A, B and C, the Cartesian product of A, B, and C denoted by A B C, is the following set:

{(a,b,c) | a A, b B, c C}

Definition. (x,y,z) = (x’,y’, z’) only if

x = x’, y = y’ and z = z’

These definitions can be extended to define the Cartesian product: A1 A2 … An

and equality between n-tuples

Triple or 3-tuple

Page 8: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Cartesian Product (2)

More examples:

•What is: {1, 2 , 3} {a,b} {,} =

•What is the form of the set A B C D

•What is the form of the set A B (C D)

•What is the form of the set (A B ) (C D)

Page 9: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Conventions and Precedence

( (8 2) + (3 + 7))

A (B C) D

(1) (1)

(2)

(2)

(1)

Page 10: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Relations

Definition: Given two sets, A and B, A relation R is any subset of A B. In other words, R A B

Motivation: We want to indicate which elements in A are related to which elements in B

Question: what does the relation A B indicates?

Examples of relations in “real life”?

{(p,s) : p is a professor in Lehigh, s is an student in Lehigh and s is taking a class with p}

Page 11: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Functions

Definition: A function f from a subset A to a set B, denoted by f: A B, is a relation such that: for each a A’ there is one and only one b B such that (a,b) f

{(p,s) : p is a professor in Lehigh, s is an student in Lehigh and s is taking a class with p}

Question: Is the following relation:

a function from {p: professor in Lehigh} to {s: is an student in Lehigh}?

No

Page 12: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Functions (2)

Example of other functions in real life?

SSN: People Social Security Number

The KEY Question: When should we use functions and when should we use relations?

The KEY Answer: •We use functions if each element in A has to be related to one and only one element in B (think SSN)•Otherwise, we use relations (think professor-student relation)

Page 13: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Homework (for next class)

•Book: 1.2 a) 1.4 c) 1.5

•True or false (explain your answers):

A B = B AA (B C) = (A B) C

•Give an example of a “real-life” function (what is A? what is B?)

•Give an example of a related “real-life” relation (what is A? what is B?)

Page 14: A Quick Math Overview (not the last one!) Section 1.4, you should it read carefully! Reading the corresponding material from the book is strongly encouraged

Equivalence Relations

A relation R is an equivalence relations if R is reflexive, R is symmetric and R is transitive

R is reflexive if (a,a) R for each a in the languageR is symmetric if the following property holds: if (a,b) R holds then (b,a) R also holdsR is transitive if the following property holds: (a,b) R and (b,c) R hold then (a,c) R also hold

Equivalence relations are generalizations of the equality relation

{(1,2),(1,3),…, (2,3),(2,4),…}

{(a,b) such that a and b are artificial lights of color red}

“the relation x < y”