280 likes | 445 Views
CS 3240: Languages and Computation. Course Overview. 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: awadia3@mail.gatech.edu Office: KLAUS 2124 Office Hours:
E N D
CS 3240: Languages and Computation Course Overview
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: awadia3@mail.gatech.edu • Office: KLAUS 2124 • Office Hours: • Tue. & Thur. at 10.30-11.30am, • Or by appointment
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
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 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: 71E4F530 PLEASE DO NOT DISTRIBUTE THIS TOKEN OUTSIDE THE CLASS
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
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
Grading • Homework: 20% • Mini-project: 25% • Tests: 30% • Final: 25% • Homework will try to exploit Gradiance resource http://www.aw.com/gradiancewith 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.
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
Resources • Class webpage http://www.cc.gatech.edu/classes/AY2007/cs3240_fall/ http://www.cc.gatech.edu/~axa/teaching/Fall2007/ • GRADIANCE webpage http://www.aw.com/gradiance • Check often for announcements and schedule changes.
Automata & Formal Languages • 1930-1940 Turing Machines • 1960-1070 Automata & Grammars • Compilers • Text & Web applications
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
How Does Compiler Work? Scanner Request Token Get Token Start Parser • Front End: Analysis of program syntax and semantics Semantic Action Semantic Error Checking Intermediate Representation
Parts of Compilers Focus of this class. Analysis Front End 1. Lexical Analysis 2. Syntax Analysis 3. Semantic Analysis Synthesis Back End 4. Code Generation 5. Optimization
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
Limits of Computation • Three easy functions defined onthe decimal development of Greek Pi p3.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 p f(n) = 0 otherwise • g(n) = 1, if 4 appears as the nth decimal digit of p g(n) = 0 otherwise • h(n) = 1, if 4 appears after the nth decimal digit of p h(n) = 0 otherwise • Do we have an algorithm for f? for g? for h?
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
Proofs • Deductive proofs • Inductive proofs • If-and-only-if proofs • Proofs by contradiction • Proofs by counterexample • Etc.
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)
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)
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)
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
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
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.