Top Banner
CS 3240: Languages and Computation Course Overview
28
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: week1

CS 3240: Languages and Computation

Course Overview

Page 2: week1

Course Staff

Instructor: Prof. Alberto Apostolico Email: axa@cc Office: KLAUS 1310 Office Hours:

Tue. & Thur. at 4-5pm Or by appointment

TA: Akshay Wadia Email: [email protected] Office: KLAUS 2124 Office Hours:

Tue. & Thur. at 10.30-11.30am, Or by appointment

Page 3: week1

Required Textbook

Introduction to Automata Theory, Languages, and Computation

(3rd Edition) by John E. Hopcroft , Rajeev Motwani , Jeffrey D. UllmanHardcover Addison Wesley; 3 edition (July 8, 2006)ISBN-10: 0321455363ISBN-13: 978-0321455369

Page 4: week1

Required TextbookIntroduction to Automata Theory, Languages, and Computation

(3rd Edition) by John E. Hopcroft , Rajeev Motwani , Jeffrey D. UllmanHardcover Addison Wesley; 3 edition (July 8, 2006)ISBN-10: 0321455363ISBN-13: 978-0321455369

This book is complemented by an online resource found at

http://www.aw.com/gradiance

Go to this site, register using the student access code provided with your copy of the book, then login and enter the following class token at the prompt:

71E4F530PLEASE DO NOT DISTRIBUTE THIS TOKEN

OUTSIDE THE CLASS

Page 5: week1

Course Objectives

Formal languages Understand definitions of regular and context-free languages

and their corresponding “machines” Understand their computational powers and limitations

Theory of computation Understand Turing machines Understand decidability

Applications Basics Lexical Analysis & Compiler Text searching Finite state device design

Page 6: week1

Outline Regular expressions, DFAs, NFAs and automata Limits on regular expressions, pumping lemma Practical parsing and other applications Context-free languages, grammars, Chomsky Hierarchy Pushdown automata, deterministic vs. non-deterministic Attribute grammars, type inferencing Context-free vs. context-sensitive grammars Turing machines, decidable vs. undecidable problems,

reducibility

Page 7: week1

Grading Homework: 20% Mini-project: 25% Tests: 30% Final: 25%

Homework will try to exploit Gradiance resource http://www.aw.com/gradiance with final version due in class

No late homework or assignments without prior approval of instructor

Homework should be concise, complete, and precise Tests will be in class. Closed book, closed notes, but one-page

cheat-sheet allowed.

Page 8: week1

Collaboration Policy

Students must write solutions to assignments completely independently

General discussions are allowed on assignments among students, but names of collaborators must be reported

Page 9: week1

Resources

Class webpagehttp://www.cc.gatech.edu/classes/AY2007/cs3240_fall/

http://www.cc.gatech.edu/~axa/teaching/Fall2007/

GRADIANCE webpagehttp://www.aw.com/gradiance

Check often for announcements and schedule changes.

Page 10: week1

Introduction & Motivation

Page 11: week1

Automata & Formal Languages

1930-1940 Turing Machines 1960-1070 Automata & Grammars Compilers Text & Web applications

Page 12: week1

Compilers What is a compiler?

A program that translates an executable program from source language into target language

Usually source language is high-level language, and target language is object (or machine) code

Related to interpreters Why compilers?

Programming in machine (or assembly) language is tedious, error prone, and machine dependent

Historical note: In 1954, IBM started developing FORTRAN (FORmula TRANslation) language and its compiler

Page 13: week1

How Does Compiler Work?Scanner

Parser

SemanticAction

IntermediateRepresentation

IntermediateRepresentation

SemanticError

RequestToken

GetToken

Checking

Start

•Front End: Analysis of program syntax and semantics

Page 14: week1

Parts of Compilers

1. Lexical Analysis2. Syntax Analysis3. Semantic Analysis

4. Code Generation5. Optimization

Analysis

Synthesis

Fro

ntE

ndB

ack

End

Focus of this class.

Page 15: week1

Basic Concepts Computational problems can be posed ultimately as decision (yes-no)

problems Yes-No problems can be posed ultimately as language recognition

problems A language is any set of strings over some alphabet Deciding a language means being able to discriminate the strings

belonging to it against all others There are two basic ways to ‘’decide’’ a language: Automata & Grammars An Automaton discriminates whether a given input string is in the

language or not A Grammar generates all and only the strings in the language There is a subtle correspondence between an automaton and a

corresponding grammar Some languages are easy to decide, some are harder, some are

‘’impossible’’ We can build a hierarchy of automata , and a corresponding one of

grammars based on the complexity of the languages we wish to decide

Page 16: week1

Limits of Computation Three easy functions defined on the decimal development of Greek

Pi 3.14159265… The ratio of the circumference to the diagonal of the unit circle

f(n) = 1, if 4 appears before the nth decimal digit of f(n) = 0 otherwise g(n) = 1, if 4 appears as the nth decimal digit of g(n) = 0 otherwise h(n) = 1, if 4 appears after the nth decimal digit of h(n) = 0 otherwise

Do we have an algorithm for f? for g? for h?

Page 17: week1

Computable, Undecidable, Untractable

Questions of decidability revolve around whether there is an algorithm to solve a certain problem

Questions of untractability revolve around whether there is a practically viable algorithm to solve a certain problem

Most of the algorithms we design and use are have low computational complexity

Page 18: week1

Proofs

Deductive proofs Inductive proofs If-and-only-if proofs Proofs by contradiction Proofs by counterexample Etc.

Page 19: week1

Deductive Proofs A chain of statements implying each the next one, leading from the

first one (hypothesis) to the last (thesis or conclusion)

For integer x = 4 or higher 2x is not smaller than x2

Try for few values of parameter x, e.g., x=4 or x=6 What happens to the left side and right side when x becomes larger

than 4? Left side doubles with unit increase, right side grows by not more than [(x+1)/x]2 , which is 1.5625 for x=4

Exercise 1: generalize to non-integers Exercise 2: give an inductive proof (see next)

Page 20: week1

Inductive Proofs

Prove a basis statement and an inductive step providing a propagation rule

Let S(n) be a statement about integer n Basis: prove S(i) for some fixed value i Inductive step: prove that for any m > i – 1,

S(m) implies S(m+1)

Page 21: week1

Inductive Proofs

Prove a basis statement and an inductive step providing a propagation rule

Let S(n) be a statement about integer n Basis: prove S(i) for some fixed value i Inductive step: prove for m > i-1 S(m) implies S(m+1)

E.g.1, prove that for any positive n the sum of the first n integers equals n(n+1)/2 (btw did you know how Pitagoras did it?)

E.g. 2 Let a binary tree be defined as ‘a single node or a node with having two trees as its children . Prove that any binary tree with n leaves (nodes without children) has precisely n-1 internal nodes (nodes with children)

Page 22: week1

The structure of Inductive Proofs

Prove the basis statement : check the validity of the claim for initial values of the parameter

Prove inductive step : assume statement is true for all values of the parameter up to n-1

providing a propagation rule Take instance associated with value n Decompose this instance into instances involving smaller values of the

parameter Force inductive hypothesis on these instances Re-assemble the instance for value n

Strange things happen when we are not careful E.g.: for any positive n, all horses in a group of n have the same

mantel

Page 23: week1

Additional Proofs

Proofs by contradiction Assume the opposite of hypothesis, show

thesis cannot follow Proofs by counterexample

All primes are odd – Exhibit the even prime 2

(are there also proofs ‘’by example’’?) If-then-else proofs

Page 24: week1

Automata

Finite Automata model many design and analysis tasks, e.g.

Lexical analyzer in a compiler Digital cicuit design Keywork searching in texts or on the web. Software for verifying finite state systems, such as communication protocols.Etc.

Page 25: week1
Page 26: week1
Page 27: week1
Page 28: week1