Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Similar documents
Language properties and Grammar of Parallel and Series Parallel Languages

Grammars & Parsing, Part 1:

Informatics 2A: Language Complexity and the. Inf2A: Chomsky Hierarchy

A R "! I,,, !~ii ii! A ow ' r.-ii ' i ' JA' V5, 9. MiN, ;

Erkki Mäkinen State change languages as homomorphic images of Szilard languages

RANKING AND UNRANKING LEFT SZILARD LANGUAGES. Erkki Mäkinen DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A ER E P S I M S

A General Class of Noncontext Free Grammars Generating Context Free Languages

Syntax Parsing 1. Grammars and parsing 2. Top-down and bottom-up parsing 3. Chart parsers 4. Bottom-up chart parsing 5. The Earley Algorithm

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

A Version Space Approach to Learning Context-free Grammars

Proof Theory for Syntacticians

CS 598 Natural Language Processing

Enumeration of Context-Free Languages and Related Structures

Basic Parsing with Context-Free Grammars. Some slides adapted from Julia Hirschberg and Dan Jurafsky 1

arxiv: v1 [math.at] 10 Jan 2016

Discriminative Learning of Beam-Search Heuristics for Planning

systems have been developed that are well-suited to phenomena in but is properly contained in the indexed languages. We give a

Context Free Grammars. Many slides from Michael Collins

Refining the Design of a Contracting Finite-State Dependency Parser

Objectives. Chapter 2: The Representation of Knowledge. Expert Systems: Principles and Programming, Fourth Edition

A Grammar for Battle Management Language

PRODUCT PLATFORM DESIGN: A GRAPH GRAMMAR APPROACH

On the Polynomial Degree of Minterm-Cyclic Functions

Parsing of part-of-speech tagged Assamese Texts

AP Calculus AB. Nevada Academic Standards that are assessable at the local level only.

We are strong in research and particularly noted in software engineering, information security and privacy, and humane gaming.

Lecture 10: Reinforcement Learning

Natural Language Processing. George Konidaris

"f TOPIC =T COMP COMP... OBJ

IT Students Workshop within Strategic Partnership of Leibniz University and Peter the Great St. Petersburg Polytechnic University

(Sub)Gradient Descent

ENGBG1 ENGBL1 Campus Linguistics. Meeting 2. Chapter 7 (Morphology) and chapter 9 (Syntax) Pia Sundqvist

Improving Fairness in Memory Scheduling

Ch VI- SENTENCE PATTERNS.

Grade 5 + DIGITAL. EL Strategies. DOK 1-4 RTI Tiers 1-3. Flexible Supplemental K-8 ELA & Math Online & Print

ARNE - A tool for Namend Entity Recognition from Arabic Text

GRAMMAR IN CONTEXT 2 PDF

Language Evolution, Metasyntactically. First International Workshop on Bidirectional Transformations (BX 2012)

CS177 Python Programming

Morphotactics as Tier-Based Strictly Local Dependencies

TabletClass Math Geometry Course Guidebook

Lecture 1: Machine Learning Basics

WSU Five-Year Program Review Self-Study Cover Page

Evolution of Collective Commitment during Teamwork

Artificial Neural Networks written examination

Short vs. Extended Answer Questions in Computer Science Exams

Spring 2016 Stony Brook University Instructor: Dr. Paul Fodor

Chapter 9 Banked gap-filling

Modern Fantasy CTY Course Syllabus

11/29/2010. Statistical Parsing. Statistical Parsing. Simple PCFG for ATIS English. Syntactic Disambiguation

An Introduction to Simio for Beginners

Language Acquisition Fall 2010/Winter Lexical Categories. Afra Alishahi, Heiner Drenhaus

MASTER OF SCIENCE (M.S.) MAJOR IN COMPUTER SCIENCE

Liquid Narrative Group Technical Report Number

Developing a TT-MCTAG for German with an RCG-based Parser

The Strong Minimalist Thesis and Bounded Optimality

ISFA2008U_120 A SCHEDULING REINFORCEMENT LEARNING ALGORITHM

Module 12. Machine Learning. Version 2 CSE IIT, Kharagpur

Parallel Evaluation in Stratal OT * Adam Baker University of Arizona

Efficient Normal-Form Parsing for Combinatory Categorial Grammar

Computer Science 141: Computing Hardware Course Information Fall 2012

Improving Action Selection in MDP s via Knowledge Transfer

have to be modeled) or isolated words. Output of the system is a grapheme-tophoneme conversion system which takes as its input the spelling of words,

Probability and Statistics Curriculum Pacing Guide

Answers To Hawkes Learning Systems Intermediate Algebra

Multiple case assignment and the English pseudo-passive *

Intensive Writing Class

CS 101 Computer Science I Fall Instructor Muller. Syllabus

KLI: Infer KCs from repeated assessment events. Do you know what you know? Ken Koedinger HCI & Psychology CMU Director of LearnLab

BANGLA TO ENGLISH TEXT CONVERSION USING OPENNLP TOOLS

Action Models and their Induction

Enhancing Unlexicalized Parsing Performance using a Wide Coverage Lexicon, Fuzzy Tag-set Mapping, and EM-HMM-based Lexical Probabilities

Chapter 4: Valence & Agreement CSLI Publications

TEACHING AND EXAMINATION REGULATIONS PART B: programme-specific section MASTER S PROGRAMME IN LOGIC

NATURAL LANGUAGE PARSING AND REPRESENTATION IN XML EUGENIO JAROSIEWICZ

NAME: East Carolina University PSYC Developmental Psychology Dr. Eppler & Dr. Ironsmith

CSC200: Lecture 4. Allan Borodin

THEORETICAL CONSIDERATIONS

CS Course Missive

Hyperedge Replacement and Nonprojective Dependency Structures

COMMUNICATION AND JOURNALISM Introduction to Communication Spring 2010

Listening and Speaking Skills of English Language of Adolescents of Government and Private Schools

Parsing natural language

Teaching a Laboratory Section

Introduction to Simulation

An Introduction to the Minimalist Program

Specification and Evaluation of Machine Translation Toy Systems - Criteria for laboratory assignments

Learning to Think Mathematically With the Rekenrek

Aspectual Classes of Verb Phrases

Towards a MWE-driven A* parsing with LTAGs [WG2,WG3]

Hindi Aspectual Verb Complexes

THE ANTINOMY OF THE VARIABLE: A TARSKIAN RESOLUTION Bryan Pickel and Brian Rabern University of Edinburgh

Self Study Report Computer Science

EECS 700: Computer Modeling, Simulation, and Visualization Fall 2014

Probability and Game Theory Course Syllabus

IAT 888: Metacreation Machines endowed with creative behavior. Philippe Pasquier Office 565 (floor 14)

PH.D. IN COMPUTER SCIENCE PROGRAM (POST M.S.)

Learning Object-Oriented Programming in Python: Towards an Inventory of Difficulties and Testing Pitfalls

Chinese Language Parsing with Maximum-Entropy-Inspired Parser

Approaches to control phenomena handout Obligatory control and morphological case: Icelandic and Basque

Transcription:

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

Take home! Midterm Date: 1. During the week before Spring break (out March 3, due March 6)? Don t have to worry over the break 2. After Spring break (4 days within March 16-23)? 1 more week of content but 2 more weeks to solve problems I will hold Skype/Google Hangout office hours over the break Ready, set, vote!

Half * Let HALF( L) { v v, w s.t. v w vw L} Show that HALF preserves regularity. e.g. if RingoStarr is in L, then Ringo is in HALF(L) Let M be a DFA for language L Intuition: follow the transitions of M for string v. Check that there is a path from v to an accept state that consumes v characters. How do we do this check? M v w

Half * Let HALF( L) { v v, w s.t. v w Show that HALF preserves regularity. vw L} Intuition: follow the transitions of M for string v. Check that there is a path from v to an accept state that consumes v characters. How do we do this check? Use the machine for M Σ Σ Σ w Σ Σ ε ε F={(q,q)} M v R L

Double Let DOUBLE( L) { w ww L} Show that DOUBLE preserves regularity. e.g. if BamBam is in L, then Bam is in DOUBLE(L) Let M be a DFA for language L Intuition: Run L on w, in parallel non-deterministically guess the end state in machine M on w and check if starting from that guess puts the machine in an accept state M M w w Guess

ε M Double Let DOUBLE( L) { w ww L} Intuition: Run L on w, in parallel non-deterministically guess the end state in machine M on w and check if starting from that guess puts the machine in an accept state ε ε M M M 1 M 2 M F Accept if: M ends in state M ends in an accept state {(, q') q' F } Q

Yet Another Non-Regular Language Let Σ={ (, ) } B { w wis a stringof balanced E.g. ( ( ) ), ()()(), (()())(()) are all in the language (()(((()() is not in the language Show that B is not regular: Use Pumping Lemma! Consider ( p ) p By the pumping lemma y may only contain (, so the string cannot be pumped. Thus B is not regular. What does this mean? parentheses} Regular expressions are useless for checking language syntax

Context-Free Grammars Basic idea: set of production rules induces a language Finite set of variables: V = {V 1, V 2,..., V k } Finite set of terminals: Σ = {t 1, t 2,..., t j } Finite set of productions: R Start symbol: Productions: V i D where V i V and D (V Σ)* Applying V i D to av i b yields: a D b Note: productions do not depend on context - hence the name context free! S

Example: design a context-free grammar for strings representing all well-balanced parenthesis. Idea: create rules for generating nesting & juxtaposition. G 1 : S SS (S) e V = {S} Σ = {(,), e} R = {G 1 } Ex: S SS (S)(S) ()() S (S) ((S)) (()) S (S) (SS)... (()((())()))

Context-Free Grammars Def: A language is context-free if it is accepted by some context-free grammar. Theorem: All regular languages are context-free. Given a DFA, we construct an equivalent CFG. For DFA M=(Q, Σ, δ, q 0, F) let: V=Q S= q 0 If δ(q i,a)=q j then make Q i a Q j If q i is an accept state then add rule Q i ε a b a stack

Ambiguity Def: A grammar is ambiguous if some string in its language has two non-isomorphic derivations. Theorem: Some context-free grammars are ambiguous. Ex: G 1 : S SS a e Derivation 1: S SS aa Derivation 2: S SS SSS aa Def: A context-free language is inherently ambiguous if every context-free grammar for it is ambiguous. Theorem: Some context-free languages are inherently ambiguous (i.e., no non-ambiguous CFG exists). Ex: {a i b j c k i=j or j=k} Prove this for EC!

Example: design a context-free grammar for strings representing all well-balanced parenthesis. Idea: create rules for generating nesting & juxtaposition. G 1 : S SS (S) e Ex: S SS (S)(S) ()() S (S) ((S)) (()) S (S) (SS)... (()((())())) Q: Is G 1 ambiguous? Another grammar: G 2 : S (S)S e Q: Is L(G 1 ) = L(G 2 )? Q: Is G 2 ambiguous?

Example : design a context-free grammar that generates all valid regular expressions. Idea: embedd the RE rules in a grammar. G: S a for each a L S (S) SS S* S+S S S* (S)* (S+S)* (a+b)* S SS SSSS abs*b aba*a Q: Is G ambiguous?

Historical Perspectives Noam Chomsky (1928-) Linguist, philosopher, cognitive scientist, political activist, dissident, author Father of modern linguistics Pioneered formal languages Developed generative grammars Invented context-free grammars Defined the Chomsky hierarchy Influenced cognitive psychology, philosophy of language and mind Chomskyan linguistics, Chomskyan syntax, Chomskyan models Critic of U.S. foreign policy Most widely cited living scholar Eighth most-cited source overall!

I must admit to taking a copy of Noam Chomsky's Syntactic Structures along with me on my honeymoon in 1961 Here was a marvelous thing: a mathematical theory of language in which I could use as a computer programmer's intuition! - Don Knuth on Chomsky s influence

Pushdown Automata Basic idea: a pushdown automaton is a finite automaton that can optionally write to an unbounded stack. Finite set of states: Q = {q 0, q 1, q 3,..., q k } Input alphabet: Stack alphabet: Transition function: Initial state: Final states: G d: Q ( {e}) G 2 Q G* q 0 Q F Q Pushdown automaton is M=(Q,, G, d, q 0, F) Note: pushdown automata are non-deterministic! (proof of why next time) q 1 q i q 0 q k q j

Pushdown Automata A pushdown automaton can use its stack as an unbounded but access-controlled (last-in/first-out or LIFO) storage. A PDA accesses its stack using push and pop Stack & input alphabets may differ. Input read head only goes 1-way. Acceptance can be by final state or by empty-stack. Note: a PDA can be made deterministic by restricting its transition function to unique next moves: d: Q ( {e}) G Q G * M Input 1 0 1 1 0 1 0 a b a stack

Closure Properties of CFLs Theorem: The context-free languages are closed under union. Hint: Derive a new grammar for the union. Theorem: The CFLs are closed under Kleene closure. Hint: Derive a new grammar for the Kleene closure. Theorem: The CFLs are closed under with regular langs. Hint: Simulate PDA and FA in parallel. Theorem: The CFLs are not closed under intersection. Hint: Find a counter example. Theorem: The CFLs are not closed under complementation. Hint: Use De Morgan s law.

Decidable PDA / CFG Problems Given an arbitrary pushdown automata M (or CFG G) the following problems are decidable (i.e., have algorithms): Q 1 : Is L(M) = Ø? Q 5 : Is L(G) = Ø? Q 2 : Is L(M) finite? Q 6 : Is L(G) finite? Q 3 : Is L(M) infinite? Q 7 : Is L(G) infinite? Q 4 : Is w L(M)? Q 8 : Is w L(G)?

Undecidable PDA / CFG Problems Theorem: the following are undecidable (i.e., there exist no algorithms to answer these questions): Q: Is PDA M minimal? Q: Are PDAs M 1 and M 2 equivalent? Q: Is CFG G minimal? Q: Is CFG G ambiguous? Q: Is L(G 1 ) = L(G 2 )? Q: Is L(G 1 ) L(G 2 ) = Ø? Q: Is CFL L inherently ambiguous?

PDA Enhancements Theorem: 2-way PDAs are more powerful than 1-way PDAs. Hint: Find an example non-cfl accepted by a 2-way PDA. Theorem: 2-stack PDAs are more powerful than 1-stack PDAs. Hint: Find an example non-cfl accepted by a 2-stack PDA. Theorem: 1-queue PDAs are more powerful than 1-stack PDAs. Hint: Find an example non-cfl accepted by a 1-queue PDA. Theorem: 2-head PDAs are more powerful than 1-head PDAs. Hint: Find an example non-cfl accepted by a 2-head PDA. Theorem: Non-determinism increases the power of PDAs. Hint: Find a CFL not accepted by any deterministic PDA.