SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS.

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Copyright © Cengage Learning. All rights reserved.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Instructor: Hayk Melikya
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
1 Simulator-Model Checker for Reactive Real-Time Abstract State Machines Anatol Slissenko University Paris 12 Pavel Vasilyev University Paris 12 University.
Math 3121 Abstract Algebra I
Faculty Of Computer Science Simon Fraser University Cmpt 880 presentation An Abstract Communication Model Uwe Glasser, Yuri Gurevich and Margus Veanes.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
Introduction to Computability Theory
Background, Reserve & Gandy Machines Andres Blass & Yuri Gurevich.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Lecture 9 Recursive and r.e. language classes
Programming Language Semantics Denotational Semantics Chapter 5 Based on a lecture by Martin Abadi.
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
CS 454 Theory of Computation Sonoma State University, Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Original slides by Vahid and.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
CHAPTER 4 Decidability Contents Decidable Languages
CS 454 Theory of Computation Sonoma State University, Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Original slides by Vahid and.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Describing Syntax and Semantics
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
Abstract State Machines and Computationally Complete Query Languages Andreas Blass,U Michigan Yuri Gurevich,Microsoft Research & U Michigan Jan Van den.
The Church-Turing Thesis over Arbitrary Domains Udi Boker and Nachum Dershowitz Presenting: Yorai Geffen.
Introduction to ASMs Dumitru Roman Digital Enterprise Research Institute
Chapter 3 – Set Theory  .
The Recursion Theorem Pages 217– ADVANCED TOPICS IN C O M P U T A B I L I T Y THEORY.
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Chapter 5 – Relations and Functions. 5.1Cartesian Products and Relations Definition 5.1: For sets A, B  U, the Cartesian product, or cross product, of.
Turing Machines. Intro to Turing Machines A Turing Machine (TM) has finite-state control (like PDA), and an infinite read-write tape. The tape serves.
1 Section 13.2 The Church-Turing Thesis The Church-Turing Thesis: Anything that is intuitively computable can be be computed by a Turing machine. It is.
Discrete Mathematics R. Johnsonbaugh
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Mathematical Preliminaries
Math 3121 Abstract Algebra I Lecture 5 Finish Sections 6 + Review: Cyclic Groups, Review.
INM175 Topic 8 1 Module INM175 Discrete Mathematics Topic 8 Algebraic Theories.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Math 3121 Abstract Algebra I
The Acceptance Problem for TMs
Chapter 5, Set Theory 1.
Chapter 9 TURING MACHINES.
Math 3121 Abstract Algebra I
Alternating tree Automata and Parity games
Decidable Languages A language L is decidable if there is a Turing machine ML such that given any word w  0*, then: Input of ML: a  b  … w Output of.
Instructor: Aaron Roth
Presentation transcript:

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. Can one generalize Turing machines so that any algorithm, never mind how abstract, can be modeled by a generalized machine very closely and faithfully?

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?

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

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.

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

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.

The First Postulate : SEQUENTIAL TIME

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.

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 T A : S(A)  S(A) that will be called the one-step transformation of A.

Some Definitions For The Future.. A run (or computation) of A is a finite or infinite sequence X 0,X 1,X 2,….. where X 0 is an initial state and every X i+1 =T A (X i ). 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),T A =T B. Equivalent algorithms have the same runs.

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 T A (X) = X if A terminates in a state X.

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.

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.

The Second Postulate : ABSTRACT STATE

Lets talk a bit more about the notion STATE

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.

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.

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 t 1,…,t j are terms, then f(t 1,…, t j ) is a term. If the outermost function name is relational, then the term is Boolean.

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.

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.

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( x 1,…, x j ) = x 0 in Y whenever f(x 1,…, x j ) = x 0 in X.

Up-to-Isomorphism Abstraction Distinct isomorphic structures are just different representations of the same isomorphic type Isomorphic structures have the same computational 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.

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

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.

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??

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.

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 T A 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 T A (X) onto T A (Y ).

The third Postulate : BOUNDED EXPLORATION

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. Content X (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+.

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=Content Y (f,a) Content X (f,a)}. THE SET WILL BE DENOTED Y-X

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 T A (X) have the same elements and the same locations. Define: (A,X) T A (X)-X so that T A (X)=X+ (A,X).

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.

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.

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.

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.

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.

ANALYSIS OF THE POSTULATES AND THE MAIN THEOREM

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.

An update rule of vocabulary has the form f(t 1,…, t j ) := t 0 where f is a j-ary function symbol in and t 0,…, t j 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 R 1. R k endpar The par rules are called blocks. The empty block is abbreviated to skip.

If R is an update rule f(t 1,…, t j ) := t 0 and a i = Val (t i,X) for i = 0,…, j then (R,X) {(f,(a 1,…, a j ), a 0 )} If R is a par rule with constituents R 1,…,R k then (R,X) (R 1,X) (R k,X). For every state X, there exists a rule R such that: *R uses only critical terms. * (R,X) = (A,X).

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

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 E X (t 1, t 2 ) Val (t 1, X) = Val (t 2, X) over critical terms. Call states X,Y T-similar if E X = E Y. Lemma: (R,Y )= (A,Y) for every state Y T-similar to X.

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 {X 1,…,X m } of states such that every state is T-similar to one of the states X i. 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.

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

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 X 1,…,X m be states. The desired is: par if then R. if then R endpar Given a program, T (X) X+ (,X).

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 T B which is the restriction of T to S(B).

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),T A =T B.

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

The end!! (Finally.. )