Automata Theory for Presburger Arithmetic Logic

Similar documents
Sri vidya college of engineering and technology

Automata and Languages

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Automata Theory and Formal Grammars: Lecture 1

CS 455/555: Finite automata

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

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

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Theory of Computation

INF210 Datamaskinteori (Models of Computation)

Automata, Logic and Games: Theory and Application

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Computational Models #1

CSE 1400 Applied Discrete Mathematics Definitions

Chapter 3. Regular grammars

Preliminaries to the Theory of Computation

Deterministic Finite Automata (DFAs)

Computational Models - Lecture 1 1

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Deterministic Finite Automata (DFAs)

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

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Introduction to Automata

Nondeterministic Finite Automata

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

Models of Computation. by Costas Busch, LSU

Deterministic Finite Automata (DFAs)

Closure under the Regular Operations

Finite Automata and Languages

CS 154, Lecture 3: DFA NFA, Regular Expressions

Regular Expressions. Definitions Equivalence to Finite Automata

Mathematical Preliminaries. Sipser pages 1-28

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

CSC173 Workshop: 13 Sept. Notes

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY


Equivalence of DFAs and NFAs

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Fooling Sets and. Lecture 5

Automata and Languages

CS 208: Automata Theory and Logic

3515ICT: Theory of Computation. Regular languages

The Parikh image of languages and linear constraints

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

Introduction to Computers & Programming

CPSC 421: Tutorial #1

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Discrete Mathematics. Benny George K. September 22, 2011

Uses of finite automata

Java II Finite Automata I

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

Informal Statement Calculus

Circles & Interval & Set Notation.notebook. November 16, 2009 CIRCLES. OBJECTIVE Graph a Circle given the equation in standard form.

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Theory of Computation (I) Yijia Chen Fudan University

Chapter Five: Nondeterministic Finite Automata

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Finite Automata and Regular languages

CS243, Logic and Computation Nondeterministic finite automata

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

Representing Arithmetic Constraints with Finite Automata: An Overview

Languages, regular languages, finite automata

Opleiding Informatica

Section Summary. Relations and Functions Properties of Relations. Combining Relations

(c) Give a proof of or a counterexample to the following statement: (3n 2)= n(3n 1) 2

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Foundations of Informatics: a Bridging Course

Theory Bridge Exam Example Questions

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th,

Question Bank UNIT I

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,

COMP4141 Theory of Computation

Final exam study sheet for CS3719 Turing machines and decidability.

COMP1002 exam study sheet

Theory of Computation

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

Finite-state machines (FSMs)

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Computational Models - Lecture 3

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Closure under the Regular Operations

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Relations Graphical View

Automata-based Verification - III

Formal Languages, Automata and Models of Computation

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

Transcription:

Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory, Languages & Computation and Constraints in Computational Logic Theory & Application Presented by Masood Obaid 18th Jan. 2002 International Max Planck Research School Saarbrucken.

Structure of Presentation Introduction of notions and automata theory Formal definitions and examples Presburger Arithmetic Translation from Presburger formulas to finite automata Automata associated with equalities and inequalities Extensions.

Introduction to notions Strings Prefix Suffix Concatenation Empty string

Alphabets An Alphabet is a finite set of symbols Language ={a} then *={e, a, aa,aaa,.,.,.,.,.,}

Graph Mathematically written as G (V, E) Path v1, v2,.,.,., vk, k>=1, such that there is an edge (vi,vi+1) for each i, 1 <= i < k Cycle if vi=vk the path is a cycle 2 1 3 4

Directed Graph Also called as digraph is a sequence of vertices and an ordered pair of edges called arcs vi v(i+1) is an arc for each i, 1<=i<k An arc from x to y is denoted by x y. In the arc x y, x is the predecessor of y and y is the successor of x 1 2 3 4

Tree There is one vertex called the root that has no predecessors and from which there is a path to every vertex Each vertex other than the root has exactly one predecessor The successors of each vertex are ordered from the left

Inductive Proofs Principle of Mathematical induction is as follows Basic Step P(0) Inductive Step P(n) implies P(n+1) for n>=0 Example To prove that 0+1+2+3+ +n=n(n+1)/2

Proof We could argue like this: For n = 0, the result is clearly true i.e., 0=0.2/2=0 Now suppose that for integer n >= 1, 0+1+2+.+n = n(n+1)/2 By induction hypothesis (1+2+ n)+(n+1)=n(n+1) + (n+1) 2 = n(n+1)+2(n+1) 2 = (n+1)(n+2) = (n+1)(n+1+1) 2 2 and so the result follows by induction.

Sets A set is a collection of objects without repetition. Set notation {x in A p(x)} The set of objects x such that p (x) is true.

Operations On Sets Union {x x A or x B} Intersection {x x A and x B} Difference {x x A and x B} Product X {(a,b) a A and b B} Power Set is the set of all subsets of A. Denoted by 2 A

Relation Domain Range Properties of Relations Reflexive if ara for all a in set {(a,a),(b,b)} Irreflexive if ara is false for all a in set {(a,b)} Transitive if arb and brc imply arc {(a,b),(b,c),(a,c)} Symmetric if arb implies bra {(a,b),(b,a)} Asymmetric if arb implies bra is false {(a,b),(b,c)}

0 0 Finite State System start No Zero One Zero 2 or more 0 s 1 1 1,0 Linear Control Systems Control Mechanism of an elevator Telecommunication Pay phone controller Computer Science Compilers Switching circuit (control unit of a computer)

Finite Automaton Formally a finite automaton is defined by a 5-tuple (Q, A, δ, q 0, Q f ) Q is the finite set of states. A is the input alphabet. δ is the transition relation mapping Q x A to Q, i.e., δ(q, a) is a state for each state q and input symbol a. q 0 Q is the initial state, Q f Q is the set of Final states.

Transition Diagram A directed graph that represents finite automaton is called Transition Diagram. States of the automaton Transition from one state to another

An Example 1 start q 0 q 1 0 0 1 1 0 0 q 2 q 3 1 In this transition diagram of finite automaton, the control is at q 0 if and only if there are both an even number of 0 s and even number of 1 s in the input sequence

M=(Q,A, δ, q 0, Q f ). Where Q ={q 0, q 1, q 2, q 3 } and A={0,1}, Q f ={q 0 } and δ is shown in the following table. Applying 110101 as input sequence to M. We get q 0. States Inputs 0 1 q 0 q 2 q 1 q 1 q 3 q 0 q 2 q 0 q 3 q 3 q 1 q 2

Finite Automaton Continued For every word w A* if i is a natural number which is smaller or equal to the length of w we can say w (i) is the i th letter of word w A run of the automaton (Q, Q f, q 0,, ) on a word w A* is a state sequence Q* such that (0) = q 0, and if (i) = q, (i+1) =q then (q, w (i), q ) Successful Run A successful run on w is a run such that (n+1) Q f where n is length of w

Non Deterministic Finite Automata Definition An Example I/P sequence 01001 is accepted by the NFA. The sequence of transitions is through the states q 0, q 0, q 0, q 3, q 4, q 4 1 0 q 1 q 0 q 3 1 1 0 Start q 2 q 4 0 1 0 Difference 0 1

Machine calculating residue mod 3 Finite Automata with output Moore Machine Represented by tuple (Q, A, δ, q 0,Q f,λ,,) where Q, A, δ, q 0, Q f have their usual meanings as in FA. is the output alphabet and λ is mapping from Q to giving the output associated with each state 1 0 start 0 1 2 q 0 q 1 q 2 0 1 0 1 On input 1010 number of states entered is q 0, q 1, q 2, q 2, q 1 giving output sequence 01221. i.e., e has residue 0, 1 has 1, 2 10 has 2, 5 10 has 2 and 10 10 has 1.

Mealy Machine Represented by (Q, A, δ, q 0, Q f,, λ) where Q, A, δ, q 0, Q f have their usual meanings as in Moore machine. Except that λ is mapping from Q X A to. i.e., λ (q,a) gives the output associated with the transition from state q on input a. Response of M to input 01100 is n, n, y, n, y with the sequence of states being entered q 0, p 0, p 1, p 1, p 0, p 0, Start q 0 0/n 1/n 1/n 0/y p 0 p 1 0/n Machine M({q 0,p 0,p 1 }, {0,1}, δ, {q 0 }, {y,n}, λ) 1/y

Presburger Arithmetic Basic terms x+x+1+1+1 is an example which is a basic term and can be abbreviated as 2x+3. Atomic formula are equalities and inequalities between basic terms. For instance x+2y=3z+1 is an atomic formula Formulas of the logic are the first-order formula built on the atomic formulas.

Connectives Conjunction ( ) Disjunction ( ) Negation ( ) Existential Quantification ( ) Universal Quantification ( ) An example of a logical formula is x ( y x=2y y x=2y+1) Expressing in words as, every integer is even or odd.

Free Variables Variables which are not quantified are called free variables Solution A solution of a formula ϕ (x 1, x 2,.,x n ) is an assignment of x 1, x 2,.,x n in N which satisfies the formula. For Instance {x= 0; y = 2; z =1} is a solution of x+2y=3z+1 and every assignment {x= n} is a solution of, y (x=2y x=2y+1)

Translation from Presburger Formula to Finite Automata Automata associated with equalities For every basic formula a 1 x 1 +a 2 x 2 + +a n x n = b (where a 1,a 2,..,a n, b Z) The automaton is constructed by saturating the set of transition and the set of states, initially set to {q b } using the inference rule: q c Q a 1 θ 1 + a n θ n = 2 c ----------------------------- If { d =(c- a 1 θ 1 - a n θ n )/2 q d Q, (q c,θ, q d ) δ θ {0,1} n encodes (θ 1,, θ n ) For every state q c Q, computing the solutions (θ 1,,θ n ) of a 1 x 1 +a 2 x 2 + +a n x n = c modulo 2 and add the state q d and the rule q c θ q d where d =(c- a 1 θ 1 - a n θ n )/2

Considering the equation x+2y = 3z+1 Here b=1 we have q 1 Q. Computing the solution modulo 2 of the above equation we get {(0,0,1), (0,1,1), (1,0,0), (1,1,0)}. Computing the new states by d= (1-0-0+3)/2=2 i.e., q 2 d= (1-0-2+3)/2=1 i.e., q 1 d= (1-1-0-0)/2= 0 i.e., q 0 d= (1-1-2-0)/2= -1 i.e., q -1 q 2, q 1, q 0, q -1 are of Q. The new transitions q 1 (0,0,1) q 2 q 1(0,1,1) q 1 q 1(1,0,0) q 0 q 1(1,1,0) q -1

Automaton for equation x+2y = 3z+1 (0,1,0) -2 (0,0,0) (1,1,1) (1,0,1) (1,0,1) (0,1,0) 0 2 (0,0,0) (1,1,1) (1,1,0) (0,1,1) (0,1,0) (1,0,1) (1,0,0) (0,0,1) (0,0,0) (1,1,1) (0,0,1) -1 1 Start (1,0,0) (1,1,0) (0,1,1)

In this automaton our initial state is q 1 and final state is q 0 indicated by double circle. Traversing the transition diagram from initial state q 1 through q -1, q -2, q 0, q 1, q 2 to the final state q 0 we get the word # q 1 q -1 q -1 q -2 q -2 q 0 q 0 q 1 q 1 q 2 q 2 q 0 1 1 1 1 1 0 0 2 1 1 0 0 0 1 3 0 0 1 1 1 0 #1,2 & 3 gives x=15 d, y=35 d & z=28 d The word is accepted by the automaton and verifies the equation x+2y=3z+1 => 15+2(35)=3(28)+1 85=85

Automata associated with inequalities Computing an automaton for inequality a 1 x 1 +a 2 x 2 + +a n x n b Starting from state q b as initial state and from a state q c we compute the transitions and states as: q c θ 1.. θ n q d n with d= (c- a i θ i )/2 Q f = {q c c 0} i=1

Considering the in equality 2x-y -1 we get the following automaton (0,0) (0,1) -2-1 0 (1,1) (0,1) (1,0) (0,0) (1,1) start Traversing the machine from initial state q -1 through q -1, q -2, q -2, q -1, q 0 to the final state q 0 we get the word (0,1) (1,0) (1,1) # q -1 q -1 q -1 q -2 q -2 q -1 q -1 q 0 q 0 q 0 1 1 1 0 0 0 2 1 0 1 1 1 #1 & 2 gives x=3 d & y=29 d The word is accepted by the automaton and verifies the equation 2xy -1 => 2(3) - 29 = 6-29 = -23-1 (0,0) (0,1)

Closure properties A class of languages closed under a particular operation Union and intersection i.e., A ϕ1 A ϕ2, A ϕ1 A ϕ2 of two automata A ϕ1 (x) and A ϕ2 (x) can be computed by the classical constructions. Negation corresponds to complement. For quantifier x ϕ the complement is x ϕ. We only have to consider existential quantification. A x ϕ is computed from A ϕ by projection. Transitions, Initial and Final states are identical to those of A ϕ.

Example Automaton accepting solution for z x+2y=3z+1 (0,1) -2 (0,0) (1,1) (1,0) (1,0) (0,1) 0 2 (0,0) (1,1) (1,1) (0,1) (0,1) (1,0) (1,0) (0,0) (0,0) (1,1) (0,0) -1 1 Start (1,0) (1,1) (0,1)

Extensions... More expressive automata models are Push down automata (Stacks) Turing Machines Rabin Automata