29
THEORY OF AUTOMATA CS3131 Lecture 01

THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

  • Upload
    hahanh

  • View
    303

  • Download
    1

Embed Size (px)

Citation preview

Page 1: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

THEORY OF AUTOMATACS3131

Lecture 01

Page 2: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

THE COURSE

Course Code: CS-3131

Course Title: Theory of Automata and Formal Languages

Instructor: JAWAD AHMAD

Email Address: [email protected]

Web Address: http://csandituoslahore.weebly.com/toafl.html

Term (Semester): Summer 2018

Duration: 16 Weeks

04/07/2018 THEORY OF AUTOMATA 2

Page 3: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

TEXT AND REFERENCE MATERIAL

1. Introduction to Computer Theory, by Daniel I. Cohen, John

Wiley and Sons, Inc., 1991, Second Edition

2. Introduction to Languages and Theory of Computation, by J. C. Martin, McGraw Hill Book Co., 1997, Second Edition

304/07/2018 THEORY OF AUTOMATA

Page 4: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

GRADING

Following is the division of marks:

Mid-Term Exam 30

Assignments and Quizzes 15

Attendance 05

Final Exams. 50

Marks division might change during the semester

404/07/2018 THEORY OF AUTOMATA

Page 5: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

PURPOSE OF COURSE

In this Course our concern is not with actual hardware and software.

More interested in capability of computers.

specifically, what can and what cannot be done by any existing computer or any computer ever built in the future.

We will study different types of theoretical machines that are mathematical models for actual physical processes.

04/07/2018 THEORY OF AUTOMATA 5

Page 6: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

CONT….

By considering the possible inputs on which these machines can work,we can analyze their various strengths and weaknesses.

We can then develop what we may believe to be the most powerful machine possible.

Surprisingly, it will not be able to perform every task.

04/07/2018 THEORY OF AUTOMATA 6

Page 7: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

CONT….

In particular, the way we shall be studying aboutcomputers is to build mathematical models, calledmachines, and then to study their limitations by analyzingthe types of inputs on which they can operate successfully.

The collection of these successful inputs is called thelanguage of the machine

04/07/2018 THEORY OF AUTOMATA 7

Page 8: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

WHAT DOES AUTOMATA MEAN?

Automata is Greek letters. Automata is a word formulatedfrom automation, which means machine designing orreplacing human beings with machines

It is the plural of automaton, and it means “something that works automatically”.

04/07/2018 THEORY OF AUTOMATA 8

Page 9: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

Why study automata?

Automata theory is the study of abstract computingdevices or “machines.”

A. Turing in the 1930’s studied an abstract machine thathad all the capabilities of today’s computers, at least asfar as in what they could compute.

04/07/2018 THEORY OF AUTOMATA 9

Page 10: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

WHY STUDY AUTOMATA?

Turing’s goal was to describe precisely the boundary betweenwhat a computing machine could do and what it couldn’t.

His conclusions apply not only to his abstract Turing machine, butalso to today’s real machine.

Turing machine”, whose core design is automata, help usunderstand what the computer can do, and what we can expectfrom our software.

04/07/2018 THEORY OF AUTOMATA 10

Page 11: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

Introduction

04/07/2018 THEORY OF AUTOMATA 11

Page 12: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

LANGUAGE

In English, there are at least three different types of entities: letters, words, sentences.

Letters are from a finite alphabet { a, b, c, . . . , z }

Words are made up of certain combinations of letters from the alphabet.

Not all combinations of letters lead to a valid English word.

04/07/2018 THEORY OF AUTOMATA 12

Page 13: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

Sentences are made up of certain combinations of words.

Not all combinations of words lead to a valid English sentence.

So we see that some basic units are combined to make bigger units.

04/07/2018 THEORY OF AUTOMATA 13

Page 14: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

LANGUAGES

How can you tell whether a given sentence belongs to a particular languages

Black is cat the

The tea is hot

I like chocolates two much

Rules give a clue to forming as well as validating sentences.

04/07/2018 THEORY OF AUTOMATA 14

Page 15: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

FORMAL VS. INFORMAL RULES

Informal language -> abstract languages

Incoherent strings are also understandable

Slang, idiom etc.

Raise ambiguity

Interpretation varies with region

(BrE/AmE)

Same words have multiple meanings.

Like, light, base, etc.

04/07/2018 THEORY OF AUTOMATA 15

Page 16: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

INFORMAL LANGUAGES

Natural languages are generally defined informally

Human brain

Capable to understand incoherent even invalid sentences.

You mangoes like

Rectify grammatical errors etc.

Resolve ambiguity

Interpret according to context

Supporting aids such as Facial expressions and body language etc.

04/07/2018 THEORY OF AUTOMATA 16

Page 17: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

HOW TO COMMUNICATE WITH MACHINES ?

Need a language: what sort

Machines don’t have human mind though may have its partial imitation

Would fail on incorrect or ambiguous input

Some recovery or input corrections may be proposed but again very limited.

Thus need a precise, explicit and universal definition of communication language

04/07/2018 THEORY OF AUTOMATA 17

Page 18: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

SUMMARY OF LANGUAGES

Three aspects/specifications

Lexical

Defines valid words/units of a language

Syntactic

Defines rules for combining the units to form valid sentences (computer programs in context of machines)

Semantic

Concerned with the interpretation or meaning of a sentence (what output to produce in context of machines)

Affected by ambiguity the most.

04/07/2018 THEORY OF AUTOMATA 18

Page 19: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

FORMAL LANGUAGES

Rules defined explicitly and clearly

No ambiguities

Universally uniform understanding

Lets the machine

Interpret an input uniformly every time. i.e. always produces same output for a particular input

Avoid crashes because of ambiguity.

Explicitly and categorically reject invalid input

04/07/2018 THEORY OF AUTOMATA 19

Page 20: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

FORMAL LANGUAGES

Need uniformly understandable notation

Representations

Alphabet

Represents a finite set of fundamental units of languages, e.g. for English ={a,b,….z. A,B,…Z.}

∑ = {0,1}

∑ = {0,1,2,3,4,5,6,7,8,9}

04/07/2018 THEORY OF AUTOMATA 20

Page 21: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

FORMAL LANGUAGES

List of words

Set of all valid words of a given language, e.g., a language English Words that contains all valid words of English would have a = {all entries of the dictionary + punctuation marks and blank space}

Denoted by

Is Finite or Infinite set.

Strings: A string a finite sequence of symbols chosen from alphabet. For example

0111100 , 123045, abbbcdeg etc.

04/07/2018 THEORY OF AUTOMATA 21

Page 22: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

String Variable: A letter used for denoting a string. The author uses w, x, y and z as string variable. For example

w = 0111100 , x = 123045, z = abbbcdeg

Length of String: The number of positions for symbols in the string. For simplicity we can say that it is the number of symbols in the string. For example

|w| = 7 , |x| = ? , |z| = ?

04/07/2018 THEORY OF AUTOMATA 22

Page 23: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

FINITE VS. INFINITE LANGUAGES

Finite Languages

Countable set of words

Can be defined by rigorously listing the words in

E.g. English-Words

Infinite Languages

Infinite set of valid words

Cant be listed completely

E.g. English_Sentences

04/07/2018 THEORY OF AUTOMATA 23

Page 24: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

INFINITE LANGUAGES

Most of the languages are infinite

How can u check whether a word belongs to a language if it is

Finite

Checking its entry in

Infinite

Validating against rules

04/07/2018 THEORY OF AUTOMATA 24

Page 25: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

DEFINING LANGUAGES

Define alphabet set

Define rules for forming valid words and sequences of words from

Called grammar

Can be descriptive

Can be mathematical

Can also define supporting functions e.g., length(X), reverse(x)

04/07/2018 THEORY OF AUTOMATA 25

Page 26: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

DEFINING LANGUAGES

Example ={a,b,…z}

L = {all words formed only of odd number of xs}

L = {xn | n is odd}

L = {all words of length less than or equal to 4}

PALINDROME ={Λ, all strings x such that reverse (x) = x}

04/07/2018 THEORY OF AUTOMATA 26

Page 27: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

KLEENE CLOSURE

Set closure

Kleene Closure (applied to )

A set of all the strings (finite) that can be formed by the elements of where the elements may be repeated any number of times.

Denoted by *

Also called Kleene star.

04/07/2018 THEORY OF AUTOMATA 27

Page 28: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

∑* : The set of all strings over an alphabet ∑ and called Kleene Star Closure of alphabet. So we have

∑* = ∑0 U ∑1 U ∑2 U ∑3 U……………

∑+ : The set of all strings over an alphabet ∑ excluding empty string, ε, and called plus operation. So we have

∑+ = ∑1 U ∑2 U ∑3 U……………

04/07/2018 THEORY OF AUTOMATA 28

Page 29: THEORY OF AUTOMATA CS3131csandituoslahore.weebly.com/uploads/3/9/9/2/3992537/lecture__1_toa...... Theory of Automata and Formal Languages ... WHAT DOES AUTOMATA MEAN? Automata is Greek

SOME OBSERVATIONS

Λ represents an empty string (not alphabet thus not a part of )

ε also represents the same

ε is not equivalent to

If = then

* = {Λ}

Is S* == (S*)* and so on

04/07/2018 THEORY OF AUTOMATA 29