Theory of Computation

Similar documents
Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Closure under the Regular Operations

CPSC 421: Tutorial #1

Theory of Computation

Theory of Computation

Theory of Computation

Fooling Sets and. Lecture 5

Extended transition function of a DFA

TURING MAHINES

CSE 105 Theory of Computation Professor Jeanne Ferrante

Nondeterministic Finite Automata

Course 4 Finite Automata/Finite State Machines

CSE 555 Homework Three Sample Solutions

CS 154, Lecture 3: DFA NFA, Regular Expressions

Chap. 1.2 NonDeterministic Finite Automata (NFA)

About the relationship between formal logic and complexity classes

Chapter Five: Nondeterministic Finite Automata

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

Nondeterminism. September 7, Nondeterminism

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Languages, regular languages, finite automata

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Exam Computability and Complexity

Turing Machines. Lecture 8

Formal Definition of Computation. August 28, 2013

Decidability of WS1S and S1S (An Exposition) Exposition by William Gasarch-U of MD

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Lecturecise 22 Weak monadic second-order theory of one successor (WS1S)

Deterministic Finite Automata (DFAs)

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

Deterministic Finite Automata (DFAs)

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

September 7, Formal Definition of a Nondeterministic Finite Automaton

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Finite Automata Part Two

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

1 Showing Recognizability

Deterministic Finite Automata (DFAs)

Turing Machines Part III

Most General computer?

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

CSE 1400 Applied Discrete Mathematics Definitions

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

Introduction to Turing Machines. Reading: Chapters 8 & 9

Lecture 3: Nondeterministic Finite Automata

Introduction to Languages and Computation

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Friendly Logics, Fall 2015, Lecture Notes 1

Introduction to Turing Machines

Lecture 4: More on Regexps, Non-Regular Languages

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

Complexity Theory Part I

CS 322 D: Formal languages and automata theory

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Please give details of your answer. A direct answer without explanation is not counted.

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Nondeterminism and Epsilon Transitions

False. They are the same language.

3515ICT: Theory of Computation. Regular languages

CpSc 421 Homework 9 Solution

Automata and Computability. Solutions to Exercises

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 154 Formal Languages and Computability Assignment #2 Solutions

Computability Theory

Homework 1 Due September 20 M1 M2

Notes for Lecture Notes 2

where Q is a finite set of states

V Honors Theory of Computation

CSCI3390-Lecture 14: The class NP

Chapter 6: NFA Applications

Non-deterministic Finite Automata (NFAs)

Nondeterministic Finite Automata

Decidability: Church-Turing Thesis

Proving languages to be nonregular

front pad rear pad door

Deterministic Finite Automaton (DFA)

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

ACS2: Decidability Decidability

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CSC173 Workshop: 13 Sept. Notes

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

arxiv: v2 [cs.fl] 29 Nov 2013

CSE 105 THEORY OF COMPUTATION

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

Theory of Computation

Decidability (What, stuff is unsolvable?)

CSE 105 THEORY OF COMPUTATION

E.g. The set RE of regular expressions is given by the following rules:

Automata Theory for Presburger Arithmetic Logic

Computational Models Lecture 8 1

Transcription:

Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation /

Lecture 3: Overview Decidability of Logical Theories Presburger arithmetic Decidability of Presburger Arithmetic Dr. Sarmad Abbasi () Theory of Computation 2 /

Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 3 /

We started with an alphabet. {,,, (, ),,, x, R, R 2,..., R k } We considered formulas with this alphabet. Some examples of formulas 2 x x 2 R (x, x 2 ) R 2 (x, x 3 ) x x 2 x 3 R 2 (x ) (R 3 (x, x 3 ) R (x 2, x 2 )) Dr. Sarmad Abbasi () Theory of Computation 4 /

A sentence is a formula without any free variables: 2 This defines the syntax. x x 2 R (x, x 2 ) R 2 (x 2, x ) xr (x, x) Dr. Sarmad Abbasi () Theory of Computation 5 /

To specify a model M. We have to specify U the universe where the variables will take values. 2 P,..., P k are relation assigned to symbols R,..., R k. Dr. Sarmad Abbasi () Theory of Computation 6 /

The language of a model M is the set of all formulas which use the relation symbols with correct airy Suppose in the model M R is assigned a binary relation P. 2 R 2 is assigned a unary relation P 2. 3 R 3 is assigned a 5-ary relation P 3. Dr. Sarmad Abbasi () Theory of Computation 7 /

The formula x x 2 (R (x, x 2 ) R 2 (x 4 )) (R 3 (x 2, x, x 3, x 4, x 5 ) is in the language. Since, all relations have the right airty but x x 2 (R (x ) R 2 (x 4 )) (R 3 (x 2, x ) is not since the airty of two relations is wrong. Dr. Sarmad Abbasi () Theory of Computation 8 /

If M is a model. We let TH(M) denote the theory of M. It is by definition the set of all sentences that are true sentences in the language of that M. A central point of investigation is to find out which theories are decidable and which ones are not. Dr. Sarmad Abbasi () Theory of Computation 9 /

Note that when we are talking about a model in which relations have some usual meaning then we shift to infix notation. We also saw examples of sentences that are true in one model and false in another model. Dr. Sarmad Abbasi () Theory of Computation /

Let us look at one: φ = y x[r (x, x, y)] M was the model with N as the universe. R was assigned PLUS. The sentence can be rewritten as and it is not true. φ = y x[x + x = y] 2 M 2 was the model with R as the universe. R was again assigned PLUS. The sentence can be rewritten as and it is true. φ = y x[x + x = y] Dr. Sarmad Abbasi () Theory of Computation /

Given a Model M we would like to know which sentences are true and which ones are not true. What we want is a decision procedure or an algorithm which will take a sentence and tell us if the sentence is true or not. Dr. Sarmad Abbasi () Theory of Computation 2 /

One of the most interesting model is number theory where M with relation + and, =, with their usual meaning. This theory is undecidable. This is a major theorem by Alonzo Church building on the work of Godel. Dr. Sarmad Abbasi () Theory of Computation 3 /

Let us start with a simpler theory. This theory is called Presburger Arithmetic. The universe is the natural numbers N. 2 Two relations + and = with their usual meaning. So only multiplication is missing in Presburger Arithmetic. Dr. Sarmad Abbasi () Theory of Computation 4 /

Let us look at some sentences: y x[x + x = y] 2 x y z[(x + y = z) ((x + x + y = z) (x + y = z + z + z))] Note that it is possible to write 5x as x + x + x + x + x. However, we cannot write xy or x 2. So in this theory the variables are only multiplied by constants. We cannot use higher powers either. Dr. Sarmad Abbasi () Theory of Computation 5 /

We want to prove that this theory is decidable. So, we want to design an algorithm (or a TM) with will take as input a sentence and decide if it is true or not. How does the input look like: y z x[(x + x = y) (y + x = z)] 2 x y z[(z + x = z + y) (y + x = z + z])] How will the algorithm decide if a sentence is true. Dr. Sarmad Abbasi () Theory of Computation 6 /

Lets start with something simpler. Let us look at the simple atomic formula x + y = z Can we design a DFA that accepts x, y, z if and only if they satisfy this equation? Dr. Sarmad Abbasi () Theory of Computation 7 /

Let us be more clear. How will the input be given to the DFA. Let us define Σ 3 =,,,,,, Dr. Sarmad Abbasi () Theory of Computation 8 /

Now, we can give input to the DFA. Suppose x = 5, y = 3, z = 6 then the input to the DFA would be The top row is x in binary. 2 The second row is y in binary. 3 The third row is z in binary. Dr. Sarmad Abbasi () Theory of Computation 9 /

Can we design a DFA where the input alphabet is Σ 3 and it accepts a string I Σ 3 such that the top row of the string when added to the second row of the string gives us the last row of the string? Dr. Sarmad Abbasi () Theory of Computation 2 /

The answer is yes. But it is easier if the machine is given the strings in reverse. Lets see how do we add in binary: The way we add is we remember the carry and compute the next digit and keep moving left. If the numbers were given to us in reverse we will remember the carry and keep moving right. So, if these numbers were given to us in reverse. Dr. Sarmad Abbasi () Theory of Computation 2 /

c = c = c = Dr. Sarmad Abbasi () Theory of Computation 22 /

c = c = c = Dr. Sarmad Abbasi () Theory of Computation 23 /

If the answer were given to us. We could check it as we go along. Actually this DFA is very very simple. Let us look at it. It has only two state and a trap state. q, q and q r. q is the accept state. Here are the transitions. When the machine is in q the carry is. When it is in q the carry is. 2 δ(q, δ(q, ) = q ) = q r Dr. Sarmad Abbasi () Theory of Computation 24 /

2 3 δ(q, δ(q, δ(q, ) = q r ) = q ) = q Dr. Sarmad Abbasi () Theory of Computation 25 /

So we can make a DFA which accepts all strings I Σ 3 such that The top row of I read revered in binary + Second row of I read reversed in binary = Last row of I read reverse in binary Thus if I represents three numbers x, y and z then the DFA accepts if and only if x + y = z. Dr. Sarmad Abbasi () Theory of Computation 26 /

What about other equations in Presburger Arithmetic. Let us think about We can use the same trick. Let Σ 4 = x + y = z + z + t,, Each string I Σ 4 represents four numbers x, y, z and t written in reverse binary. We can make a DFA D such that D accepts I if and only if. x + y = z + z + t Dr. Sarmad Abbasi () Theory of Computation 27 /

Given a atomic formula F (in Presburger Arithmetic) in i variables variables we define x,..., x i to be an alphabet with 2 i characters. Each string S Σ i defines i numbers a,..., a i. We can make a DFA D such that D accepts S if and only if a,..., a i satisfy the equation F. Σ i Dr. Sarmad Abbasi () Theory of Computation 28 /

x + x 2 + x 2 + x 2 = x 3 + x 3 + x 4 + x 5. 2 x + x 2 + x 3 + x 5 = x 4 + x 4 + x 4 We can make DFA D such which accepts strings over Σ 5 in the first case and another DFA D 2 which accepts strings over Σ 5. So, in some sense DFAs can capture atomic formulas of Presburger Arithmetic. What about non atomic formulas? Dr. Sarmad Abbasi () Theory of Computation 29 /

What about non atomic formulas? (x + x 2 + x 2 + x 2 = x 3 + x 3 + x 4 + x 5 ) (x + x 2 + x 3 + x 5 = x 4 + x 4 + x 4 ) (x + x 2 + x 2 + x 2 = x 3 + x 3 + x 4 + x 5 ) (x + x 2 + x 3 + x 5 = x 4 + x 4 + x 4 ) (x + x 2 + x 2 + x 2 = x 3 + x 3 + x 4 + x 5 ) (x + x 2 + x 3 + x 5 = x 4 + x 4 + x 4 ) In the first case we can make a DFA that accepts all the strings accepted by D or D 2. Regular languages are closed under union, intersection and complementarily. Dr. Sarmad Abbasi () Theory of Computation 3 /

Given quantifier free formula f (in Presburger Arithmetic) in i variables variables we define x,..., x i to be an alphabet with 2 i characters. Each string S Σ i defines i numbers a,..., a i. We can make a DFA D such that D accepts S if and only if a,..., a i satisfy F. Σ i Dr. Sarmad Abbasi () Theory of Computation 3 /

What about formulas with quantifiers lets look at one of them:. This formula has two free variables x 3 [x + x 2 + x 2 = x 3 ] x, x 2 So lets work with Σ 2 and Σ 3. We can make a DFA D that accepts strings S Σ 3 such that S represents x, x 2 and x 3 which satisfy x + x 2 + x 2 = x 3. We would like a DFA D that accepts strings S Σ 2 such that S represent x, x 2 and satisfy x 3 [x + x 2 + x 2 = x 3 ]. Dr. Sarmad Abbasi () Theory of Computation 32 /

It is much easier to make an NFA given the DFA D. The NFA N simply guesses the value of x 3 as it goes along moving to the right. Thus in each move it makes two non-deterministic moves. One pretending the current bit of x 3 is and the other pretending that it is. We can then convert this NFA N to a DFA using a standard algorithm. Dr. Sarmad Abbasi () Theory of Computation 33 /

We can deal with quantifiers like this one by one. Let say we have a formula φ = x i ψ First we make an DFA D that accepts those over Σ i that represent x,..., x i and satisfy ψ. Then we make an NFA that uses D and guesses the value of each bit of x i as it goes along. We convert this D to D which now accepts strings over Σ i. Dr. Sarmad Abbasi () Theory of Computation 34 /

How to handle This is easy since φ = x i ψ x i ψ = ψ First we make an DFA D that accepts those over Σ i that represent x,..., x i and satisfy ψ. Thus we can use the fact that regular languages are closed under complementarily to make a DFA D that accepts φ. We also use the technique for handling. Dr. Sarmad Abbasi () Theory of Computation 35 /

This way if we have a sentence Q x Q 2 x 2 x i φ We can make a DFA D that will accept the empty string over Σ if and only if the formula is true. In the end we run D on the empty string to see if accepts ɛ. If it does then the formula is true. Otherwise it is false. Dr. Sarmad Abbasi () Theory of Computation 36 /