Decidable Problems. We examine the problems for which there is an algorithm.

Similar documents
Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Computer Sciences Department

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Formal Languages and Automata

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

CT32 COMPUTER NETWORKS DEC 2015

Turing Machine Languages

ECS 120 Lesson 16 Turing Machines, Pt. 2

Theory of Computation, Homework 3 Sample Solution

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *

UNIT I PART A PART B

CSE 105 THEORY OF COMPUTATION

Pushdown Automata. A PDA is an FA together with a stack.

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

Equivalence of NTMs and TMs

Theory Bridge Exam Example Questions Version of June 6, 2008

Outline. Language Hierarchy

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

Decision Properties for Context-free Languages

CSE 105 THEORY OF COMPUTATION

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Actually talking about Turing machines this time

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Theory of Programming Languages COMP360


Formal Grammars and Abstract Machines. Sahar Al Seesi

JNTUWORLD. Code No: R

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

Chapter 14: Pushdown Automata

Multiple Choice Questions

Introduction to Computers & Programming

THEORY OF COMPUTATION

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

1. [5 points each] True or False. If the question is currently open, write O or Open.

Languages and Automata

Lecture 18: Turing Machines

CS21 Decidability and Tractability

14.1 Encoding for different models of computation

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

More on Polynomial Time and Space

Variants of Turing Machines

The Big Picture. Chapter 3


Final Course Review. Reading: Chapters 1-9

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.

Specifying Syntax COMP360

Limited Automata and Unary Languages

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}.

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

CS402 - Theory of Automata Glossary By

Theory of Languages and Automata

Context Free Languages and Pushdown Automata

Learn Smart and Grow with world

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis

AUTOMATA THEORY AND COMPUTABILITY

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Parsing. source code. while (k<=n) {sum = sum+k; k=k+1;}

A Note on the Succinctness of Descriptions of Deterministic Languages

R10 SET a) Explain the Architecture of 8085 Microprocessor? b) Explain instruction set Architecture Design?

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Languages and Compilers

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Lexical Analysis. Chapter 2

On the Recursion-Theoretic Complexity of Relative Succinctness of Representations of Languages

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Theory of Computation

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

KEY. A 1. The action of a grammar when a derivation can be found for a sentence. Y 2. program written in a High Level Language

A Characterization of the Chomsky Hierarchy by String Turing Machines

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

Optimizing Finite Automata

Structure of a Compiler: Scanner reads a source, character by character, extracting lexemes that are then represented by tokens.

CSC-461 Exam #2 April 16, 2014

1 Parsing (25 pts, 5 each)

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

Announcements! P1 part 1 due next Tuesday P1 part 2 due next Friday

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Lexical Analysis. Implementation: Finite Automata

Problems, Languages, Machines, Computability, Complexity

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

QUESTION BANK. Unit 1. Introduction to Finite Automata

CSE450. Translation of Programming Languages. Automata, Simple Language Design Principles

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

CS 44 Exam #2 February 14, 2001

Transcription:

Decidable Problems We examine the problems for which there is an algorithm.

Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always halts and always answers the question correctly. Goddard 13b: 2

Decidable Questions & Recursive Languages Given a problem, we build a language: take all the instances of the question where the answer is yes and convert the instance to a string. So, a problem is decidable if and only if the associated language is recursive. Goddard 13b: 3

Encodings We assume a standard encoding (or representation) of a machine. E.g., the format you would use to describe it if you wrote a Java program that simulated such a machine. The actual encoding does not matter, as long as it is fixed and one can easily get between A and its encoding A. We use A, B to denote the encoding of pair {A, B}. Goddard 13b: 4

Questions about Regular Languages It is easy to answer questions about regular languages: Recursive are: a) The acceptance problem: A fa = { M, w : M is FA that accepts w }. b) The emptiness problem: Empty fa = { M : M is FA with empty language }. c) The equivalence problem: EQ fa = { A, B : A and B are FAs with L(A) = L(B) }. We prove part (c). Goddard 13b: 5

Proof that Equivalence is Decidable We build a TM/program that first checks the input has the correct syntax (encodes some pair of FAs). If not, it rejects. Then, one approach is to construct the FA for the symmetric difference: (A, B) = (L(A) L(B)) (L(B) L(A)) and test (A, B) for emptiness. Goddard 13b: 6

Questions about Context-Free Languages Many questions about context-free grammars or languages can be readily answered: Recursive are: a) The acceptance problem: A cfg = { G, w : G is a CFG and w a string of L(G) } b) Any context-free language with grammar G c) The emptiness problem: Empty cfg = { G : L(G) is empty } We prove part (a). Goddard 13b: 7

Proof that Acceptance is Decidable For example, convert to Chomsky Normal Form. Examine all derivations of length 2 w 1 and conclude. (See also CYK algorithm from earlier.) Goddard 13b: 8

Totality for CFG is Not Decidable Surprisingly, perhaps, testing whether a CFG generates every string is hard: Total cfg = { G : L(G) = Σ } is not recursive. This will be established later. Goddard 13b: 9

Configurations Recall that a configuration of a machine is a complete record of the machine that tells one the current state and contents of memory. Specifically, for a 1-tape TM, we write the state where the head is. That is, the configuration is written as t L S t R where t L is the used tape to the left of the head, S the current state, and t R the used tape to the right of the head. Goddard 13b: 10

Configurations and Loops For a deterministic machine, if the same configuration recurs, then the machine is stuck in an infinite loop. Hence: Fact. If there are at most Q possible configurations of a deterministic machine and it runs for longer than Q, then it is in an infinite loop. Goddard 13b: 11

Computation Strings A computation string for machine M accepting string w is the string of configurations from start to finish (separated by some special symbol). Fact. It is decidable whether a given string is a computation string or not. Check that first configuration is correct and matches the input; check that each configuration follows from previous by the rules of M; and check that final configuration is accepting. Goddard 13b: 12

Other Models Recall that we introduced the Chomsky Hierarchy earlier. Though we do not prove it, the top level corresponds to TMs: Theorem. There is an unrestricted grammar for a language if and only if it is r.e. Goddard 13b: 13

Linearly Bounded Automata A linearly bounded automaton (LBA) is a 1- tape TM whose head is not allowed to move off the input portion of the tape (and there is a device that tells it where the tape starts and finishes). Though we do not prove it, it turns out that: Theorem. There is a nondeterministic LBA for a language if and only if there is a contextsensitive grammar for it. Goddard 13b: 14

Practice Show that it is decidable whether an NFA M generates all strings from the alphabet. Goddard 13b: 15

Solution to Practice One approach is to convert M to a DFA. It is easy to see whether a DFA accepts every string: only if every state is accepting. Goddard 13b: 16

Summary A problem is decidable if the associated language is recursive. All problems about FAs and REs are decidable; most problems about CFGs and PDAs are decidable. A computation string is a record of the computation of a machine. Goddard 13b: 17