html5-img
1 / 50

SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS

SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS. The “official" Turing thesis is that every computable function is Turing computable. Turing stronger thesis: every algorithm can be simulated by a Turing machine.

chaela
Download Presentation

SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS

  2. The “official" Turing thesis is that every computable function is Turing computable. Turing stronger thesis: every algorithm can be simulated by a Turing machine. Can one generalize Turing machines so that any algorithm, never mind how abstract, can be modeled by a generalized machine very closely and faithfully?

  3. The obvious answer seems to be NO.. • Suppose such generalized Turing machines exist.. • What would their states be? • What instructions should the generalized machines have? • Can one get away with only a bounded set of instructions?

  4. “A New Thesis” [Gurevich 1985] If we stick to one abstraction level (abstracting from low-level details and being oblivious to a possible higher-level picture) And if the states of the algorithm reflect all the pertinent information Then a particular small instruction set suffices in all cases.

  5. First-order structures with purely functional vocabulary are called algebras. • Accordingly, the new machines were called dynamic structures/ dynamic algebras/ evolving algebras. • The evolving-algebra-community changed it to abstract state machines, or ASMs.

  6. The Original Sequential ASM Thesis “Every sequential algorithm can be step-for-step simulated by an appropriate sequential ASM.”

  7. What are sequential algorithms exactly? A sequential algorithm is any object that satisfies the next three postulates: • The Sequential Time Postulate. • The Abstract-State Postulate. • The Bounded-Exploration Postulate.

  8. The First Postulate : SEQUENTIAL TIME

  9. Syntax • Any algorithm A can be given by a finite text. • We will concentrate on the behavior of algorithms, and not on the language it’s programmed in.

  10. Behavior Let A be a sequential algorithm. A is associated with: • A set S(A) whose elements will be called states of A. • A subset I(A) of S(A) whose elements will be called initial states of A. • A map TA: S(A)  S(A) that will be called the one-step transformation of A.

  11. Some Definitions For The Future.. • A run (or computation) of A is a finite or infinite sequence X0,X1,X2,….. where X0 is an initial state and every Xi+1 =TA(Xi). The computation steps of A form a sequence. In that sense the computation time is sequential. • Algorithms A and B are equivalent if S(A)=S(B), I(A)=I(B),TA=TB. Equivalent algorithms have the same runs.

  12. States are Full instantaneous descriptions of the algorithm. • A state X of an algorithm A reachable if X occurs in some run of A. • we do not require that an algorithm halts on all inputs. • We stipulate that TA(X) = X if A terminates in a state X.

  13. Why do we need the other 2 postulates? • Example 1 do for all x,y with Edge(x,y) R(x) R(y) R(y):=true; The algorithm is sequential-time but it is highly parallel. A sequential algorithm should make only local changes. The total change should be bounded.

  14. Example 2 If x y Edge(x,y) then Output:=false; else Output:=true; The algorithm changes only one Boolean but it explores the whole graph in one step. A sequential algorithm should be not only bounded change, but also bounded-exploration.

  15. The Second Postulate : ABSTRACT STATE

  16. Lets talk a bit more about the notion STATE

  17. Until now, states were merely elements of the set of states. Now, we argue that states can be viewed as (first-order) structures of mathematical logic. What exactly is this structure? We will describe its syntax and its semantics.

  18. Syntax • A vocabulary is a finite collection of function names. Some function names may be marked as relational. Every vocabulary contains: * The equality sign. * true, false and undef. * The unary name Boole. * the names of the usual Boolean operations.

  19. Terms are defined by the usual induction. A nullary function is a term. If f is a function name of positive arity j and if t1,…,tj are terms, then f(t1,…, tj) is a term. If the outermost function name is relational, then the term is Boolean.

  20. Semantics • A structure X of vocabulary is a nonempty set S (the base set of X), together with interpretations of the function names in over S. • A j-ary function name is interpreted as a function from S to S, a basic function of X. • We identify a nullary function with its value. • A j-ary relation R is a function from S to {true,false}, a basic relation of X.

  21. Example of states as structures:The Euclidean algorithm The goal is to find greatest common divisor (gcd) of two natural numbers a and b. One step of the algorithm can be described as: if b=0 then d:=a; else if b=1 then d:=1; else par a := b; b := a mod b; The base set of any state X of the algorithm includes: *Set of natural numbers (which comes with 0,1 as distinguished elements). *The binary operation mod. *Three dynamic distinguished elements a, b and d.

  22. Isomorphism Let X and Y be structures of the same vocabulary . Recall that an isomorphism from X onto Y is a one-to-one function from the base set of X onto the base set of Y, such that f( x1,…, xj) = x0 in Y whenever f(x1,…, xj) = x0 in X.

  23. Up-to-Isomorphism Abstraction • Distinct isomorphic structures are just different representations of the same isomorphic type • Isomorphic structures have the samecomputational power. • Suppose that X and Y are distinct states of the algorithm A and is an isomorphism from X onto Y, maps the base set of X onto the base set of Y, and preserves all functions of X.

  24. In a more graphic way… f A x f( x) A ~ A’ Mapping  f’ A’ x’ f’( x’) “101” f “110”  f’ 6 5

  25. Fixed Vocabulary • In logic, the vocabularies are not necessarily finite. • In our case, by definition, vocabularies are finite. • The vocabulary does not change during that evolution.

  26. The Base Set • The base set can change from one initial state to another. • The base set does not change during the computation. • All states of a given run have the same base set. Does it make any sense??

  27. The Environment • The initial state contains an infinite set, the reserve. • The environment’s job is to get the elements from the reserve. • We can use a special external function to fish out an element from the reserve. • That function is controlled by the environment.

  28. More exact wording of the second postulate • States of A are first-order structures. • All states of A have the same vocabulary. • The one-step transformation TA does not change the base set of any state. • S(A) and I(A) are closed under isomorphism. Further, any isomorphism from a state X onto a state Y is also an isomorphism from TA(X) onto TA(Y ).

  29. The third Postulate : BOUNDED EXPLORATION

  30. States as Memories • If f is a j-ary function name and a is a j-tuple of elements of X, then the pair (f,a) is a location. • ContentX(f,a) is the element f(a) in X. • If (f,a) is a location of X and b is an element of X, then (f,a,b) is an update of X. • Two updates clash if they refer to the same location but are distinct. • A set of updates is consistent if it has no clashing updates. • The result of executing an update set over X will be denoted X+ .

  31. LEMMA: If X,Y are structures of the same vocabulary and with the same base set, then there is a unique consistent set of nontrivial updates of X such that Y = X+ . PROOF: X and Y have the same locations. The desired set is: {(f,a,b)| b=ContentY(f,a) ContentX(f,a)}. THE SET WILL BE DENOTED Y-X

  32. The Update Set of an Algorithm at a State Let X be a state of an algorithm A. By the abstract-state postulate, X and TA(X) have the same elements and the same locations. Define: (A,X) TA(X)-X so that TA(X)=X+ (A,X).

  33. The Accessibility Principle • According to the abstract-state postulate, an algorithm A does not distinguish between isomorphic states. • A state X of A is just a particular implementation of its isomorphism type. • How can A access an element a of X? One way is to produce a ground term that evaluates to a in X. • The assertion that this is the only way can be called the sequential accessibility principle.

  34. An element a of a structure X is accessible if a = Val (t,X) for some ground term t in the vocabulary of X. • A location (f,a) is accessible if every member of the tuple a is accessible. • An update (f,a,b) is accessible if both the location (f,a) and the element b are accessible.

  35. The accessibility principle and the informal assumption that any algorithm has a finite program indicate that any given algorithm A examines only a bounded number of elements in any state.

  36. And yet another definition.. We say that two structures X and Y of the same vocabulary coincide over a set T of -terms if Val(t,X)=Val(t,Y) for all t T.

  37. More exact wording of the third postulate • There exists a finite set T of terms in the vocabulary of A such that (A,X)= (A,Y) whenever states X,Y of A coincide over T. • Intuitively, the algorithm A examines only the part of the given state which is given by means of terms in T. • The set T itself is a bounded-exploration witness for A.

  38. ANALYSIS OF THE POSTULATESANDTHE MAIN THEOREM

  39. Let T be a bounded-exploration witness for algorithm A. Without loss of generality, we assume the following: *T is closed under subterms. *T contains the logical terms true, false, undef. • Call terms in T critical. • For every state X, the values of critical terms in X will be called critical elements of X.

  40. An update rule of vocabulary has the form f(t1,…, tj) := t0 where f is a j-ary function symbol in and t0,…, tj are terms over . • Every update in (A,X) can be programmed as an update rule. • To execute all updates in (A,X) in parallel, as a single transaction, we’ll use the par construct: par R1 . . Rk endpar • The par rules are called blocks. • The empty block is abbreviated to skip.

  41. If R is an update rule f(t1,…, tj) := t0 and ai = Val (ti,X) for i = 0,…, j then (R,X) {(f,(a1,…, aj), a0)} • If R is a par rule with constituents R1,…,Rk then (R,X) (R1,X) (Rk,X). • For every state X, there exists a rule R such that: *R uses only critical terms. * (R ,X) = (A,X).

  42. LEMMA If states X and Y coincide over the set T of critical terms, then (R ,Y)= (A, Y). (R ,Y)= (R ,X)= (A,X)= (A,Y). PROOF X and Y has the same critical terms. By the definition of R X and Y coincide

  43. Lemma: Suppose that X,Y are states and (R ,Z) = (A,Z) for some state Z isomorphic to Y, Then (R ,Y)= (A, Y). Definition: At each state X, the equality relation between critical elements induces an equivalence relation EX(t1, t2) Val (t1,X) = Val (t2,X) over critical terms. Call states X,Y T-similar if EX = EY . Lemma: (R ,Y )= (A,Y) for every state Y T-similar to X.

  44. For every state X, there exists a Boolean term that evaluates to true in a structure Y if and only if Y is T-similar to X. • There is a finite set {X1,…,Xm} of states such that every state is T-similar to one of the states Xi. • To program A on all states, we need a single rule that is applied to every state X and has the effect of R at X.

  45. CONDITIONAL RULES If is a Boolean term over vocabulary and R1,R2 are rules of vocabulary then if then R1 else R2 endif is a rule of vocabulary . To fire R at any -structure X, evaluate at X. If the result is true then (R,X)= (R1,X) otherwise (R,X) = (R2,X).

  46. MAIN LEMMA For every sequential algorithm A of vocabulary , there is an ASM program of vocabulary such that ( ,X)= (A,X) for all states X of A. PROOF Let X1,…,Xm be states. The desired is: par if then R . . if then R endpar Given a program , T (X) X+ ( ,X).

  47. One Last Definition A sequential abstract state machine B of vocabulary is given by: * a program of vocabulary . * a set S(B) of -structures closed under isomorphisms and under the map T . * a subset I(B) S(B) that is closed under isomorphisms. * the map TB which is the restriction of T to S(B).

  48. It is easy to see that an abstract state machine satisfies the sequential-time, abstract-state and bounded-exploration postulates. • By Definition, it is an algorithm. • Recall the definition of equivalent algorithms : Algorithms A and B are equivalent if S(A)=S(B), I(A)=I(B),TA=TB.

  49. MAIN THEOREM “For every sequential algorithm A, there exists an equivalent sequential abstract state machine B.” PROOF By the Main Lemma, there exists an ASM program such that ( ,X) = (A ,X) for all states X of A. Set S(B) = S(A) and I(B) = I(A).

  50. The end!! (Finally.. )

More Related