430 likes | 511 Views
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.
E N D
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. • 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?
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 : • A sequential algorithm consists of a set of states S, a set of initial states , and a next-state function k :S S. • Each state is an algebra • preserves the universe of states • S and J are closed under isomorphism, and preserves isomorphism • 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.
Axiom N1 A 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.
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:
Axiom N2 For a nondeterministic algorithm N, all states in SN are Algebras over the same signature ∑N
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.
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:
Axiom N3 For a nondeterministic algorithm N, the following holds: for each step (A,A’) of N, A and A’ have the same universe
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:
Axiom N4 For a nondeterministic algorithm N, the following holds: • SN and JN are closed under isomorphism • 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.
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.
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).
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.
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
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 “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:
Axiom N5 For 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.
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.
We start by introducing the syntax and semantics of nondeterministic ASM rules which form the syntactical basis of nondeterministic ASMs introduced afterwards
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
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 jkjkjkby the value • ASM may update a few locations each time, that is represented by an update set.
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.
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.
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 Par Where x1,…,xn are variables, is a Boolean formula, and Par is a parallel rule such that and Par contain only variables from {x1,…,xn}.
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 .
Nondeterministic ASMs In 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.
The Equivalence Theorem Nondeterministic algorithms and non-deterministic ASMs describe the same set of transition systems. Now, let’s prove it!
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.
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.
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.
Lemma 1 Let and let . Then (A,A’) is a completion of (M,M’) iff and .
Lemma 2 Let 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.
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.
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.
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.
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,
Finally, let B,B’ be states of N such that hlhlhlhlhlhlhlhWe 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.
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 .
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
Lemma 4 Let 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.
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 The end!