Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Course: Theory of Computation

Instructor: Dr. Atif Khan


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
3. Introduction to Automata theory,Languages
and Computation, by John E. Hopcroft, Rajeev
Motwani and Jefferey D. Ullman
About the Course

 First pure course in theoretical computer


science.
 No Programming is involved.

 Difficult from other courses because this course


will ask questions that you will think hard and
deep about.
Motivation
 Automata theory/Language theory is the branch of computer science.
 This theory plays important role in computer science.
 Many students do not see the importance of mathematical approach to
computer science.
 Students say, let give me a keyboard and code; it is common
 A survey of Stanford graduates 5 years out. The university wanted to find
whether Stanford teaching stuff was actually used in their jobs.
 So CS graduates cited the introductory programming course the most.
 Next they cited data structures and algorithms and system software.
 After the required courses, Automata theory was second to database
course and was cited 3 times as many as cited the introductory AI course.
Motivation
 Automata theory/Language theory is the branch of computer science.
 This theory plays important role computer science.
 Many students do not see the importance of mathematical approach to
computer science.
 Students say, let give me a keyboard and code; it is common
 A survey of Stanford graduates 5 years out. The university wanted to find
whether Stanford teaching stuff was actually used in their jobs.
 So CS graduates cited the introductory programming course the most.
 Next they cited data structures and algorithms and system software.
 After the required courses, Automata theory was second to database
course and was cited 3 times as many as cited the introductory AI course.
Regular Expression
Lets look at some ideas of this course and how they appear in practice.
 Regular Expression: It is a simple notation for describing many patterns
that arise naturally in practice.
 Construct regular expression for the language of all C identifiers. An
identifier is any string of length 1 or more that contains only letters, digits,
and underscore and begins with a letter or underscore. Note: use
Let digit=[0-9] letter= [A-Za-z] underscore= [-]
(letter+underscore)(digit+letter+underscore)*
 Many UNIX text processing commands use variety of regular expressions.
This expression describes a line of text that has letter ‘a’ followed by any
number of characters followed by letter ‘b’.
a.*b
 XML document mark up language invites us to describe the structure of
document with DTD (document type definition). DTD language consists of
elements such as person(name,addres,child*)
 Person element consists of name element followed by address element
followed by any number of child elements.
A regular expression, regex or regexp (sometimes called
a rational expression) is, in theoretical computer science and
formal language theory, a sequence of characters that define
a search pattern.

Usually this pattern is then used by string searching


algorithms for "find" or "find and replace" operations on strings.
Regular expressions are used in search engines, search and
replace dialogs of word processors and text editors, and in
lexical analysis.

Many programming languages provide regex capabilities,


built-in, or via libraries.
Here's a list of some of the common problems in web
application that are solved with regular expressions:
 Validating email and/or password formats on the server side
 Extracting specific sections from an HTML page (perhaps one
retrieved with XMLHttp)
 Parsing text data files into sections for import into a database
 Replacing values in text to clean, reformat, or change content
(replace ? with spaces)
Data validation
Data validation checks that data are valid, sensible,
reasonable, and secure before they are processed.
Format or picture check
Checks that the data is in a specified format
(template), e.g., dates have to be in the format
DD/MM/YYYY. Regular expressions should be
considered for this type of validation.
Telephone no’s and CNIC can be validated in the same
way.
Allowed character checks
Checks to ascertain that only expected characters are
present in a field. For example a numeric field may only
allow the digits 0–9, the decimal point and perhaps a
minus sign or commas.
A text field such as a personal name might disallow
characters .
An e-mail address might require at least one @ sign and
various other structural details.
Regular expressions are effective ways of implementing
such checks
Theoretical computer science
 Theoretical computer science, or TCS, is a
division or subset of general computer science
and mathematics that focuses on more abstract
or mathematical aspects of computing and
includes the theory of computation.
 TCS covers a wide variety of topics including algorithms,
data structures, computational complexity, parallel and
distributed computation,
probabilistic computation, quantum computation,
automata theory, information theory, cryptography,
program semantics and verification, machine learning,
computational biology, computational economics,
computational geometry, and computational number theory
and algebra.

 Work in this field is often distinguished by its emphasis on


mathematical technique and rigor.
Computation is any type of calculation that includes both arithmetical and non-
arithmetical steps.
Computation is something that need to be computed to get a desired result/solution.

Problem------------Computation----------------Result/solution
what How what space and how efficiently
Input Output

WHAT KINDS
What kinds of problems can be computed.
or what is computable.
HOW
How it will be computed/ means what procedure will be used to get solution of the given
problem.
WHAT
What space and how efficiently the problem will be computed.
Theory of Computation

 Theory of computation can be divided into 3 branches:


 Theory of Computability: It deals the question what can be computed.
 What kinds of problems are computable and non-computable.
 Computable problems are those which can be solved in a finite amount of
time in finite no steps (Algorithm). Algorithm always halts.
 Non-computable problems are those for which a procedure (finite number
of steps) exists but you may not reach a solution in finite amount of time.
Procedure may or may not halt. So any problem for which you can not get
a solution in a finite amount of time or it may run forever. so it is un-
computable problem
Theory of Automata
 It deals the question how anything be computed?
 Here we study the mathematical models or abstract machines
which can perform the computation. for example FA, TM
 Automata Theory is an exciting, theoretical branch of computer
science.
 It is the study of abstract machines or models of computation
which are defined mathematically.
 Abstract machines are simplified model of real computation.
 The computation that any computer perform can be modeled by
abstract machine.
 Automatons are abstract models of machines that perform
computations on an input by moving through a series of states or
configurations.
Theory of Automata
 Computation consists of executing an algorithm:
 Starting with some input and following a step by step procedure
that will produce result.
 Computation is simply sequence of steps that can be performed by
a computer.
 Why abstract devices.
 The theory based on actual piece of hardware would not be useful,
because it would have to be changed every time hardware was
changed or enhanced.
 Actual computer is too much complicated, the idealized
computer(abstract machines) we study are simple because they are
not subject to physical constraints on memory.
Theory of Complexity
 It deals the question What space and how efficiently the problem
will be computed.
 we deal with the efficiency of computational models (CM). How
much space and time CM needs to compute a problem
 All these branches linked with a common question: "What are the
fundamental capabilities and limitations of computational model?"
 In today's word, computational model is a computer, anything
which solves a particular problem.

You might also like