a semantic characterization of unbounded-nondeterministic abstract state machines

43
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1

Upload: lee

Post on 22-Feb-2016

25 views

Category:

Documents


0 download

DESCRIPTION

A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines. Andreas Glausch and Wolfgang Reisig. Some Review and Reminder. ASM is a transition system where each state is an Algebra. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

1

A Semantic Characterization of

Unbounded-Nondeterministic Abstract

State MachinesAndreas Glausch and Wolfgang Reisig

Page 2: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

2

SOME REVIEW AND REMINDER ASM is a transition system where each state

is an Algebra. An algebra A consists of a non empty set Ua

(its universe), together with a finitely many functions defined over Ua, each with a fixed arity.

Therefore, each state of an ASM may naturally include any mathematical data structure that can be described in terms of logic (sets, real numbers, uncomputable function, etc.).

A class S of ASMs maybe characterized by answering the following question: Which transition system can be

represented by the ASMs in S

?

Page 3: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

3

Gurevich Answers this question for the class of sequential ASMs. He defines a class of transition systems which he calls sequential algorithms by the next axioms, and proves this class to be equivalent to sequential ASMs :

1. A sequential algorithm consists of a set of states S, a set of initial states , and a next-state function k :S S.

2. Each state is an algebra3. preserves the universe of states4. S and J are closed under isomorphism, and preserves

isomorphism5. A finite set of ground terms is sufficient to characterize

In this presentation we define the class of non-deterministic algorithms by 5 axioms, when the first 4 are basically an extension of Gurevich’s original axioms.

A S

J S

Page 4: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

4

AXIOM N1A non-deterministic algorithm N consists of: A set of states SN

A set of initial states A next – state relation

Each pair is a step on N.A run of N is a sequence A0A1A2… of states with

k and for all indices i.

This axiom actually assumes that a non-deterministic can be represented by a transition system.

N NI S N N NS S

N(A,A')

0 NA I i N i 1A A

Page 5: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

5

SOME NOTIONS Algebras are general enough to describe any

static mathematical entity

A signature ∑ is used to address to the functions of an algebra, it consists of function symbols.

An Algebra A is a ∑-algebra if A determines for each n-ary function symbol f, a unique function fa

As an algorithm always has a finite syntactical representation, therefore, a single signature is suffice for all states

Which leads us to the 2-nd axiom:

Page 6: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

6

AXIOM N2

For a nondeterministic algorithm N, all states in SN are Algebras over the same signature ∑N

Page 7: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

7

SOME MORE NOTIONS

The elements of a universe Ua of an algebra A are atomic and foundational objects that cannot be decomposed, destroyed or created.

Only the functions of A are modified.

Page 8: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

8

As an example consider the Euclidian algorithm: it computes the greatest common divisor between two integers.

The states of the algorithm are built over the universe of integers.

The algorithm defines a new relationship between the integers, but non of the computation in this algorithm add or remove integers from its universe.

What leads us to:

Page 9: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

9

AXIOM N3

For a nondeterministic algorithm N, the following holds: for each step (A,A’) of N, A and A’ have the same universe

Page 10: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

10

SOME MORE NOTIONS As we already seen in previous

lectures, Isomorphic algebras only differ I their concrete representation of the universe

The functions of both algebras are essentially the same

In general, the algorithm does not distinguish isomorphic states

This insight is formalized by:

Page 11: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

11

AXIOM N4

For a nondeterministic algorithm N, the following holds:

(i) SN and JN are closed under isomorphism

(ii) Let (A,A’) be a step of N and let with an isomorphism . Then there is a step (B,B’) of N such that is an isomorphism.

NB Si : A B

i : A' B'

Page 12: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

12

SOME ADDITIONAL NOTIONS Every real-world processor we know,

such as a computer, a human being, performs only bounded time of work each step.

It is quite natural then, to require an algorithm to limit the amount of work to be done in each step.

Page 13: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

13

As we already seen, for a step (A,A’), A and A’ only differ in their function values

For convenience, in order to represent such differences formally, we will now consider a state A as a set of location-value-triples.

A location consists of n-ary function symbol f, and n-ary argument tuple a.

Each location (f,a) of A defines a unique value v=fA(a).

Page 14: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

14

A triple (f,a,v) represents a small component of A which we call a molecule of A.

A state is completely described by a set of molecules.

Page 15: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

15

In order to formalize the idea of “performing bounded work in each step”, we should only allow a bounded part of A to contribute to each step.

We call each a subset of A

A substep changes a substate M by updating the values of the molecules in M

M A

Page 16: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

16

In order to capture the “amount of work” performed by a step of N:

Each step (A,A’) is decomposed into a substep (M,M’) and a substate E such that:

In this case, the substep (M,M’) describes the actual work performed by the step

We call (A,A’) a completion of (M,M’)

(A,A') (M E,M' E)

Page 17: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

17

A “bounded amount of work then is captured by a substep bounded in size: for a natural number k, a substep (M,M’) is k-bounded iff |M|< k

We are now able to formulate the final axiom stating that the steps of a nondeterministic algorithm performs only bounded substeps:

Page 18: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

18

AXIOM N5For a nondeterministic algorithm N there

exists a constant and a set W of k-bounded substeps such that for all states A,A’ of N, the following holds: (A,A’) is a step of N iff (A,A’) is an completion of a substep in W

We call W a bounded-work witness of N.

k

Page 19: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

19

From now on, we call any entity satisfying the Axioms N1-N5 a nondeterministic algorithm.

This raises the question, is there a language expressive enough to describe any nondeterministic algorithm?

In the following we answer this question positively by presenting to you the nondeterministic ASMs.

Page 20: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

20

We start by introducing the syntax and semantics of nondeterministic ASM rules which form the syntactical basis of nondeterministic ASMs introduced afterwards

Page 21: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

21

ASSIGNMENT RULES ∑-terms are constructed inductively

from a signature ∑ and a set of variables V

Given a ∑-algebra A and a variable assignment , each ∑-term t is evaluated to a unique value

Terms are used to form assignment rules which update a single function value of an algebra

A: V U A, At U

Page 22: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

22

The general form of an assignment rule is:f(t1,…,tn):=t’where t1,…,tn and t’ are ∑-terms, and f is n-ary function symbol of ∑.Applied at a state A and variable assignment kj, the rule updates the value of the function symbol at f at the argument jkjkjk by the value

ASM may update a few locations each time, that is represented by an update set.

def 1,A, n,a,a (t ,..., t ) def A,v t'

Page 23: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

23

CONDITIONAL RULES

The general form of a conditional rule is:if then ASSIGN Where is a Boolean formula and ASSIGN is an assignment rule.

ASSIGN is executed if the condition is satisfied by A and , otherwise the state stays untouched.

For technical convenience, we assume every assignment rule has a special conditional rule whose condition holds in every state.

Page 24: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

24

PARALLEL RULES Several condition rules nay be executed

simultaneously, which is represented by a parallel rule.

The general form of an assignment rule Par is:par Cond1…Condn endpar

Where Cond1…Condn are conditional rules. Executing Par at a state A and variable assignment will result in a simultaneous execution of the updates performed by Cond1…Condn.

For technical convenience, we assume every conditional Cond as a parallel rule par Cond endpar.

Page 25: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

25

CHOICE RULES Choice rule allow nondeterministic

choice of elements of the universe of a state.

The general form of a choice rule is:Choose x1,…,xn with do ParWhere x1,…,xn are variables, is a Boolean formula, and Par is a parallel rule such that and Par contain only variables from {x1,…,xn}.

Page 26: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

26

First, for a given state A, the choice rule chooses nondeterministically a variable assignment , such that is satisfied by A and .

Then Par is executed by use of the variable assignment .

Page 27: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

27

NONDETERMINISTIC ASMSIn conclusion, ASM M consists of: A signature ∑M A set of ∑M-algebras SM, closed under

isomorphism (the states of M) A set JM SM, closed under

isomorphism (the initial states of M) A choice rule CHOICE built over the

signature ∑M.

Page 28: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

28

THE EQUIVALENCE THEOREM

Nondeterministic algorithms and non-deterministic ASMs describe the same set of transition systems.

Now, let’s prove it!

Page 29: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

29

PART 1 OF THE PROOF We need to show that every

nondeterministic ASM represents a nondeterministic algorithm.

Let M be a nondeterministic ASM with CHOICE its choice rule.

All we need to do is to verify that M satisfies the axioms N1-N5.

Page 30: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

30

Axioms N1 and N2 are satisfied by the definition of nondeterministic ASMs.

Axioms N3 and N4 are properties of the semantics of CHOICE that are easily verified.

Axiom N5 holds due to the fact that in each step (A,A’)of M, CHOICE access and modifies only a bounded subset of A.

Page 31: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

31

PART 2 OF THE PROOF We need to show that every

nondeterministic algorithm can be represented by a nondeterministic ASM.

Let N be a nondeterministic algorithm. Let W be a bounded work witness for

N.

Page 32: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

32

LEMMA 1Let and let .

Then (A,A’) is a completion of (M,M’) iff and .

(M,M') W NA,A' S

M A A' A M'

Page 33: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

33

LEMMA 2Let denote the

next state computed by Par at state A and variable assignment .

Let Par be a parallel rule over a signature ∑, let A,B be a ∑-algebras with an isomorphism i: A B, and let be a variable assignment with values in UA. Then khkhkhkhkhkhkhkh also is an isomorphism.

i : (Par,A, ) (Par,B,i )

def A,(Par,A, ) A Par

Page 34: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

34

LEMMA 3

Let (A,A’) be a step of N. Then there is a choice rule CHOICE such that and implies for all states B,B’ of N.

CHOICEA A' CHOICEB B' NB B'

Page 35: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

35

PROOF OF LEMMA 3 By axiom N5, there exists a subset

such that (A,A’) is a completion of (M,M’).

Let denote the elements of the universe of A occurring in M and M’.

As the size of M is bounded, V is finite. For each element , choose a

unique variable xv.

(M,M') W

AV U

v V

Page 36: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

36

Define the Boolean formulas and by:

v wdef v u Vx x

1 n1 n

u u vdef (f ,[u ,...,u ],v) Mf(x ,...x ) x

Page 37: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

37

Construct for each molecule the assignment rule .

Combine all these assignment rules to a single parallel rule Par.

Let v1,…,vn be the elements in V. Define CHOICE as:choose with do Par

According to axiom N5, the size of M and M’ is bounded by a constant k.

Consequently, the size of CHOICE also is bounded by a constant c.

1 n(f,[u ,...,u ],v) M'1 nu u vf(x ,..., x ) : x

1 mv vx ,...,x

Page 38: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

38

We first show that : Let be the variable assignment

defined by for all . Then and are satisfied by A

and . Further, by construction of Par, we have kjkjkjkjkjk.

There fore, , by Lemma 1,

CHOICEA A' v(x ) v v V

A,Par M' CHOICEA A M'

A M' A'

Page 39: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

39

Finally, let B,B’ be states of N such that hlhlhlhlhlhlhlh We need to show that

As , there is a variable assignment such that and are satisfied at B and , and .

Construct from B an isomorphic state C:for each , replace the element by v, and replace every other element in UB by a new element not contained in UB.

This construction is well defined. Let i: B C be the corresponding

isomorphism.

CHOICEB B'. NB B' CHOICEB B'

B' (Par,B, )

v V v(x )

Page 40: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

40

As is satisfied by B and , one can show that .

By construction of Par, we have = M’.

Let . By lemma 2, is an isomorphism.

As B,B’ are states of N, Axiom N4 implies that C,C’ also are states of N.

As and by definition of we conclude .

M C

C,iPar defC' (Par,C,i ) i : B' C'

c,iPar M' (Par,c,i ) C' C M'

Page 41: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

41

As , lemma 1 implies that (C,C’) is a completion of (M,M’).

By axiom N5, (C,C’) is a step of N.

As , and are isomorphisms, Axiom N5 implies that (B,B’) also is a step of N

i : (B C) i : (B' C')

M C

Page 42: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

42

LEMMA 4Let CHOICE1,…CHOICEn be choice rules. Then

there exists a single choice rule Union such that

CHOICE is the union of CHOICE1,…CHOICEn.

The proof is by presenting a nested choice rule, when every nested choice rule can be transformed in an un-nested choice rule.

1 nCHOICE CHOICE CHOICE...

Page 43: A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines

43

FINAL PROOF OF THE THEOREM For all steps (A,A’), derive a choice rule

CHOICE(A,A’) by applying Lemma 3. Let S be the set of all these choice rules By lemma 4, let CHOICE be the union of all

choice rules. Then for all states A,A’ of N, we have

iff NA A'

CHOICEA A'.

The end!