Top Banner
1 Welcome to CS105 and Happy and fruitful New Year ההה הההה(Happy New Year)
41

1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

1

Welcome to CS105and

Happy and fruitful New Year

טובה שנה(Happy New Year)

Page 2: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Staff

Instructor: Amos Israeli room 2-106 .Office Hours: Fri 10-12 or by arrangement Tel#: 534-886e-mail: aisraeli “at” cs.ucsd.edu

TA: Scott Yilek room B-240aOffice Hours: Mon 4-5:30e-mail: syilek “at” cs.ucsd.edu

• Web Page:http://www.cse.ucsd.edu/classes/fa08/cse105

2

Page 3: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Meeting Times

Lectures: Tue, Thu 3:30p - 4:50p WLH 2111 Note: Thu Oct 9 Lecture is canceled, there may be a make-up lecture by quarter’s end.

Sections: Mon, 1:00p - 1:50p WLH 2209 – Scott Tue, 3:00p - 3:50p WLH 2209 – Amos

Note: Students should come to both sections.Mid-term: Thu Oct 23 3:30p WLH 2111Final: Tue Dec 9 11:30a - 2:20p TBA

3

Page 4: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Homework

There will be 5-6 assignments.Assignments will be given on Monday’s section

and must be returned by the Thu lecture one week later.

First assignment will be given next Monday and must be returned on Wed Oct 8 or in Scott’s mailbox on Thu Oct 9th.

4

Page 5: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Academic Integrity

• You are encouraged to discuss the assignments problems among yourselves.

• Each student must hand in her/his own solution.

• You must Adhere to all rules of Academic Integrity of CS Dept. UCSD and others.(Meaning: no cheating or copying from any source)

5

Page 6: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Grading

• Assignments: 20%• Midterm: 30% - 0% (students are allowed to

drop it), open book, open notes. • Final: 50% - 80%, open book, open notes.

6

Page 7: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Grading

• A: (85-100)• B: (70-84)• C: (55-69)• D: (40-54)• F: (0-39)

7

Page 8: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Bibliography

8

Required: Michael Sipser: Introduction to the Theory of Computation, Second Edition, Thomson.

Page 9: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

9

Introduction to Computability Theory

Lecture1: Finite Automata and Regular Languages

Prof. Amos Israeli( ישראלי' עמוס (פרופ

Page 10: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Introduction

Computer Science stems from two starting points:

Mathematics: What can be computed?And what cannot be computed?Electrical Engineering: How can we build

computers?Not in this course.

10

Page 11: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Introduction

Computability Theory deals with the profound mathematical basis for Computer Science, yet it has some interesting practical ramifications that I will try to point out sometimes.

The question we will try to answer in this course is:

“What can be computed? What Cannot be computed and where is the line between the two?”

11

Page 12: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Computational Models

A Computational Model is a mathematical

object (Defined on paper) that enables us to

reason about computation and to study the

properties and limitations of computing.

We will deal with Three principal computational

models in increasing order of Computational

Power. 12

Page 13: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Computational Models

We will deal with three principal models of computations:

1. Finite Automaton (in short FA).recognizes Regular Languages .

2. Stack Automaton.recognizes Context Free Languages .

3. Turing Machines (in short TM).recognizes Computable Languages .

13

Page 14: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Alan Turing - A Short Detour

Dr. Alan Turing is one of the founders of Computer Science (he was an English Mathematician). Important facts:

1. “Invented” Turing machines.2. “Invented” the Turing Test.3. Broke the German submarine transmission

coding machine “Enigma”.4. Was arraigned for being gay and committed

suicide soon after. 14

Page 15: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Finite Automata - A Short Example

• The control of a washing machine is a very simple example of a finite automaton.

• The most simple washing machine accepts quarters and operation does not start until at least 3 quarters were inserted.

Page 16: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Thanks: Vadim Lyubasehvsky

Now on PostDoc in Tel-Aviv

Page 17: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Finite Automata - A Short Example

• The control of a washing machine is a very simple example of a finite automaton.

• The most simple washing machine accepts quarters and operation does not start until at least 3 quarters were inserted.

• The second washing machine accepts 50 cents coins as well.

Page 18: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)
Page 19: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Finite Automata - A Short Example

• The control of a washing machine is a very simple example of a finite automaton.

• The most simple washing machine accepts quarters and operation does not start until at least 3 quarters were inserted.

• The second washing machine accepts 50 cents coins as well.

• The most complex washing machine accepts $1 coins too.

Page 20: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)
Page 21: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

},,{ 10 qqqQ s

Finite Automaton - An Example

21

sq

1q

0q0

1

States:

,

0,1

0,1

,

Initial State: sq

Final State: 0q

Page 22: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Finite Automaton – An Example

22

sq

1q

0q0

1

,

0,1

0,1

,

Accepted words: ,...001,000,01,00,0

Transition Function: 00, qqs 11, qqs

000 1,0, qqq 111 1,0, qqq

Alphabet: . 1,0 Note: Each state has all transitions .

Page 23: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

A finite automaton is a 5-tupple where:

1. is a finite set called the states.2. is a finite set called the alphabet.3. is the transition function.4. is the start state, and5. is the set of accept states.

Finite Automaton – Formal Definition

23

,

,

FqQ ,,,, 0

Q

QQ :

Qq 0

QF

Page 24: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

1. Each state has a single transition for each symbol in the alphabet.

2. Every FA has a computation for every finite string over the alphabet.

Observations

24

,

,

Page 25: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

1. accepts all words (strings) ending with 1.

The language recognized by , called

satisfies: .

1 withends |2 wwML

Examples

25

2M

2M

2ML

Page 26: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

How to do it

1. Find some simple examples (short accepted and rejected words)

2. Think what should each state “remember” (represent).

3. Draw the states with a proper name.4. Draw transitions that preserve the states’

“memory”.5. Validate or correct.6. Write a correctness argument.

Page 27: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

The automaton

Correctness Argument: The FA’s states encode the last input bit and

is the only accepting state. The transition function preserves the states encoding.

1q

Page 28: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

1. accepts all words (strings) ending with 1.

.

2. accepts all words ending with 0.

2’. accepts all words ending with 0 and the

empty word . This is the Complement Automaton of .

Examples

28

2M

1 withends |2 wwML

3M

4M

2M

Page 29: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

1. accepts all words (strings) ending with 1.

.

2. accepts all words ending with 0.

3. accepts all strings over alphabet

that start and end with the same symbol .

Examples

29

2M

1 withends |2 wwML

3M

4M ba,

Page 30: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

4. accepts all words of the form

where are integers and .

5. accepts all words in .

Examples (cont)

30

5M

6M 10,01,00,1,0

nm10

0, nmnm,

Page 31: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

4 of multiplea is value

binary whosestringsbit 3L

• Definition: A language is a set of strings over some alphabet .

• Examples:– –

Languages

31

1110001,10,1,01 L

integers positive are ,|102 mnL nm

Page 32: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

• A language of an FA, , , is the set of

words (strings) that accepts.

• If we say that recognizes .

• If is recognized by some finite automaton

, is a Regular Language.

Languages

32

,

M ML

M

MLLa M La

La

A La

Page 33: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Q1: How do you prove that a language is regular?

A1: By presenting an FA, , satisfying .

Q2: How do you prove that a language is not regular?

A2: Hard! to be answered on Week3 of the course.

Q3: Why is it important?

A3: Recognition of a regular language requires a controller with bounded Memory.

Some Questions

33

M MLLa

La

La

Page 34: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Let and be 2 regular languages above the same alphabet, . We define the 3 Regular Operations:

• Union: .

• Concatenation: .

• Star: .

The Regular Operations

34

A B

BxAxxBA or |

ByAxxyBA and |

AxkxxxA kk and 0|,...,, 21*

Page 35: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

• given a language one can verify it is regular by presenting an FA that accept the language.

• Regular Operations give us a systematic way of constructing languages that are apriority regular. (That is: No verification is required).

The Regular Operations

35

Page 36: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

• .

• .

The Regular Operations - Examples

36

boygirl,B badgoodA , boygirlbadgoodBA ,,,

badboybadgirlgoodboygoodgirlBA ,,,

,...,

,,,,,*

badbadbadgoododbadgoodgoodgo

goodbadgoodgoodbadgoodA

Page 37: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

The class of Regular languages, above the same alphabet, is closed under the union operation. Meaning: The union of two regular languages is Regular.

.

Theorem

37

Page 38: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

Example

Consider , and .The union set is the set of all bit strings that

either start with 1, or end with 0.Each of these sets can be recognized by an FA

with 3 states.Can you construct an FA that recognizes the

union set?

1 withstarts |1 wwL 0 withends |2 wwL

Page 39: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

If and are regular, each has its own recognizing automaton and , respectively.

In order to prove that the language is regular we have to construct an FA that accepts exactly the words in .

Note: cannot apply followed by .

Proof idea

39

1A 2A

1N 2N

21 AA

21 AA

1N 2N

Page 40: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

• We construct an FA that simulates the computations of, and simultaneously.

• Each state of the simulating FA represents a pair of states of and of respectively.

• Can you define the transition function and the final state(s) of the simulating FA?

Proof idea

40

1N 2N

1N 2N

Page 41: 1 Welcome to CS105 and Happy and fruitful New Year שנה טובה (Happy New Year)

In this talk we:

1. Motivated the course.

2. Defined Finite Automata (Latin Pl. form of automaton).

3. Learned how to deal with construction of automata and how to come up with a correctness argument.

Wrap up

41

1A