+ All Categories
Home > Documents > Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory...

Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory...

Date post: 28-Oct-2019
Category:
Upload: others
View: 17 times
Download: 0 times
Share this document with a friend
33
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.
Transcript
Page 1: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Automata Theory for Presburger Arithmetic Logic

References from

Introduction to Automata Theory, Languages & Computation

and

Constraints in Computational Logic

Theory & ApplicationPresented by Masood Obaid 18th Jan. 2002 International Max Planck Research School

Saarbrucken.

Page 2: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Structure of Presentation

§ Introduction of notions and automata theoryl Formal definitions and examples

§ Presburger Arithmetic § Translation from Presburger formulas

to finite automatal Automata associated with equalities and

inequalities

§ Extensions….

Page 3: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Introduction to notions

§ Stringsl Prefix

l Suffix

l Concatenation• Empty string

Page 4: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Language

§ ∑ ={a} then ∑*={e, a, aa,aaa,.,.,.,.,.,}

Alphabets§ An Alphabet is a finite set of

symbols

Page 5: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Graph§ Mathematically written as G (V, E)§ Path

l v1, v2,.,.,., vk, k>=1, such that there is an edge (vi,vi+1) for each i, 1 <= i < k

§ Cyclel if vi=vk the path is a cycle

2

3

4

1

Page 6: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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

Page 7: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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

Page 8: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Inductive Proofs

§ Principle of Mathematical induction is as followsl Basic Step P(0)l Inductive Step P(n) implies P(n+1)

for n>=0

§ Example• To prove that

0+1+2+3+…+n=n(n+1)/2

Page 9: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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.

Page 10: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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”.

Page 11: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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 2A

Page 12: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Relationl Domain

l 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)}

Page 13: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Finite State System§ Linear Control Systems

l Control Mechanism of an elevator

§ Telecommunicationl Pay phone controller

§ Computer Sciencel Compilers

l Switching circuit (control unit of a computer)

No Zero

2 or more 0’s

0

0

1

1One Zero

start

1,0

Page 14: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Finite Automaton§ Formally a finite automaton is defined by

a 5-tuple (Q, A, δ, q0, Qf)l Q is the finite set of states. l A is the input alphabet. l δ 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.

l q0 ∈ Q is the initial state, l Qf ⊆ Q is the set of Final states.

Page 15: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Transition Diagram§ A directed graph that represents

finite automaton is called Transition Diagram.

§ States of the automaton

§ Transition from one state to another

Page 16: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

An Example

§ In this transition diagram of finite automaton, the control is at q0 if and only if there are both an even number of 0’s and even number of 1’s in the input

sequence

q1

q2 q3

q0

0 0

1

0

1

0

1

1

start

Page 17: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

M=(Q,A, δ, q0, Qf).

§ Where Q ={q0, q1, q2, q3 } and A={0,1}, Qf={q0} and δ is shown in the following table.

0 1q0 q2 q1q1 q3 q0

q2 q0 q3

q3 q1 q2

InputsStates

Applying 110101 as input sequence to M. We get q0 .

Page 18: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Finite Automaton Continued…l 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 ith

letter of word wl A run of the automaton (Q, Qf, q0, ,) on a word w ∈ A* is a

state sequence Q* such that (0) = q0, and if (i) = q, (i+1) =q’ then (q, w (i), q’)

§ Successful Runl A successful run on w is a run such that

(n+1) Qf where n is length of w

Page 19: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Non Deterministic Finite Automata§ Definition

§ An Example

§ Difference

q0q1 q3

q2 q4

1 0

0

01

1

0

1Start

10

I/P sequence 01001 is accepted by the NFA. The sequence of transitions is through the states q0, q0, q0, q3, q4, q4

Page 20: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Finite Automata with output

§ Moore MachineRepresented by tuple (Q, A, δ, q0 ,Qf,λ, ∆,) where Q, A, δ, q0, Qf 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 0 1 0 1

q0 q1 q2

On input 1010 number of states entered is q0, q1, q2 , q2 , q1 giving output sequence 01221.

i.e., e has residue 0, 1 has 1, 210 has 2, 510 has 2 and 1010 has 1.

Mac

hine

ca

lcul

atin

g re

sidu

e m

od 3 start

10 2

Page 21: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

0/nStart

0/n

0/y

1/n

1/n

1/y

q0

p1

p0

§ Mealy Machine

Represented by (Q, A, δ, q0, Qf, ∆, λ) where Q, A, δ, q0, Qf

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.

Machine M({q0,p0,p1 }, {0,1}, δ, {q0}, {y,n}, λ)

Response of M to input 01100 is n, n, y, n, y with the sequence of states being entered q0, p0, p1, p1, p0, p0,

Page 22: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Presburger Arithmetic

§ Basic termsl x+x+1+1+1 is an example which is a basic term and can be

abbreviated as 2x+3.

§ Atomic formulal are equalities and inequalities between basic terms. For

instance x+2y=3z+1 is an atomic formula

§ Formulasl of the logic are the first-order formula built on the atomic

formulas.

Page 23: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

§ Connectivesl Conjunction (∧)

l Disjunction (∨)

l Negation (¬)

l Existential Quantification (∃)

l 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.

Page 24: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

§ Free Variablesl Variables which are not quantified are called free

variables

§ Solutionl A solution of a formula ϕ (x1, x2,….,xn) is an

assignment of x1, x2,….,xn 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)

Page 25: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Translation from Presburger Formula to Finite Automata

§ Automata associated with equalitiesFor every basic formula

a1x1+a2x2+……+anxn = b (where a1,a2,…..,an, b∈ Z)The automaton is constructed by saturating the set of transition

and the set of states, initially set to {qb } using the inference rule:

qc∈Q a1θ1+…… anθn = 2c----------------------------- If { d =(c- a1θ1 …- anθn )/2qd∈Q, (qc,θ, qd)∈δ θ∈{0,1}n encodes (θ1,……, θn)For every state qc ∈ Q, computing the solutions (θ1,…,θn) of

a1x1+a2x2+……+anxn = c modulo 2 and add the state qd and the rule qc θ qd where d =(c- a1θ1 …- anθn)/2

Page 26: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

§ Considering the equation x+2y = 3z+1Here b=1 we have q1∈ 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

l d= (1-0-0+3)/2=2 i.e., q2

l d= (1-0-2+3)/2=1 i.e., q1

l d= (1-1-0-0)/2= 0 i.e., q0

l d= (1-1-2-0)/2= -1 i.e., q-1

l q2, q1, q0, q-1 are ∈ of Q.

§ The new transitions

q1 (0,0,1) → q2 q1(0,1,1) → q1 q1(1,0,0) → q0 q1(1,1,0) → q-1

Page 27: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

(0,1,0)

(1,0,1) (0,1,0)

0-22

-1 1

(0,0,0)(1,1,1)

(1,1,0)

(0,1,1)

(0,1,0)

(0,0,1)

(1,1,0)(1,0,0) (0,1,1)

(0,0,1)(0,0,0)(1,1,1)

(1,0,0)(1,0,1)

(0,0,0)(1,1,1) (1,0,1)

§ Automaton for equation x+2y = 3z+1

Start

Page 28: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

§ In this automaton our initial state is q1 and final state is q0 indicated by double circle. Traversing the transition diagram from initial state q1through q-1, q-2, q0, q1, q2 to the final state q0 we get the word

# q1→q-1 q-1→q-2 q-2→q0 q0→q1 q1→q2 q2→q0

1 1 1 1 1 0 02 1 1 0 0 0 13 0 0 1 1 1 0#1,2 & 3 gives x=15d, y=35d & z=28d

The word is accepted by the automaton and verifies the equation x+2y=3z+1 => 15+2(35)=3(28)+1 85=85

Page 29: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Automata associated with inequalities

§ Computing an automaton for inequality

a1x1+a2x2+……+anxn ≤ b Starting from state qb as initial state and from a state qc we

compute the transitions and states as:

qc θ1…..θn qd

n

with d=(c-∑ aiθi )/2 Qf = {q c | c ≥ 0}i=1

Page 30: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

§ Considering the in equality 2x-y ≤ -1 we get the following automaton

-2 -1 0

(1,0)(1,1)

(0,0)(0,1)

(0,0)(0,1)

(1,1)(0,1) (1,0)

(0,1)

(0,0)(1,1)

Traversing the machine from initial state q-1 through q-1, q-2, q-2, q-1, q0 to the final state q0 we get the word

# q-1→q-1 q-1→q-2 q-2→q-1 q-1→q0 q0→q0

1 1 1 0 0 0

2 1 0 1 1 1

#1 & 2 gives x=3d & y=29d

The word is accepted by the automaton and verifies the equation 2x-y ≤ -1 => 2(3) - 29 = 6 - 29 = -23 ≤ -1

start

Page 31: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

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ϕ .

Page 32: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

(0,1)

(1,0) (0,1)

0-22

-1 1

(0,0)(1,1)

(1,1)

(0,1)

(0,1)

(0,0)

(1,1)(1,0) (0,1)

(0,0)(0,0)(1,1)

(1,0)(1,0)

(0,0)(1,1) (1,0)

Start

Automaton accepting solution for ∃z x+2y=3z+1

Example

Page 33: Automata Theory for Presburger Arithmetic Logichillen/documents/6_Presburger.pdf · Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory,

Extensions...

§ More expressive automata models are l Push down automata (Stacks)

l Turing Machines

l Rabin Automata


Recommended