The Equivalence Problem and Correctness Formulas for a Simple Class of Programs

This paper is concerned with the semantics (or computational power) of very simple loop programs over different sets of primitive instructions. Recently, a complete and consistent Hoare axiomatics for the class of {x←0, x←y, x←x+1, x←x∸1, do x...end} programs which contain no nested loops, was given, where the allowable assertions were those formulas in the logic of Presburger arithmetic. The class of functions computable by such programs is exactly the class of Presburger functions. Thus, the resulting class of correctness formulas has a decidable validity problem. In this paper, we present simple loop programming languages which are, computationally, strictly more powerful, i.e. which can compute more than the class of Presburger functions. Furthermore, using a logical assertion language that is also more powerful than the logic of Presburger arithmetic, we present a class of correctness formulas over such programs that also has a decidable validity problem. In related work, we examine the expressive power of loop programs over different sets of primitive instructions. In particular, we show that an {x←0, x←y, x←x+1, do x ... end, if x=0 then y←z}-program which contains no nested loops can be transformed into an equivalent {x←0, x←y, x←x+1, do x ... end}-program (also without nested loops) in exponential time and space. This translation was earlier claimed, in the literature, to be doable in polynomial time, but then this was subsequently shown to imply that PSPACE=PTIME. Consequently, the question of translatability was left unanswered. Also, we show that the class of functions computable by {x←0, x←y, x←x+1, x←x∸1, do x ... end, if x=0 then x←c}-programs is exactly the class of Presburger functions. When the conditional instruction is changed to “if x=0 then x←y+1”, then the class of computable functions is significantly enlarged, enough so, in fact, as to render many decision problems (e.g. equivalence) undecidable.

[1]  Eitan M. Gurari,et al.  Two-Way Counter Machines and Diophantine Equations , 1982, JACM.

[2]  Eitan M. Gurari,et al.  The Complexity of the Equivalence Problem for Simple Programs , 1981, JACM.

[3]  C. A. R. HOARE,et al.  An axiomatic basis for computer programming , 1969, CACM.

[4]  M. Fischer,et al.  SUPER-EXPONENTIAL COMPLEXITY OF PRESBURGER ARITHMETIC , 1974 .

[5]  John C. Cherniavsky Simple Programs Realize Exactly Presberger Formulas , 1976, SIAM J. Comput..

[6]  Oscar H. Ibarra,et al.  Simple Programming Languages and Restricted Classes of Turing Machines , 1983, Theor. Comput. Sci..

[7]  C. A. R. Hoare,et al.  An axiomatic basis for computer programming , 1969, CACM.

[8]  Donald E. Knuth,et al.  The art of computer programming: V.1.: Fundamental algorithms , 1997 .

[9]  Sartaj Sahni,et al.  On the Computational Complexity of Scheme Equivalence , 1974 .

[10]  Samuel N. Kamin,et al.  A Complete and Consistent Hoare Axiomatics for a Simple Programming Language , 1979, JACM.

[11]  Eitan M. Gurari Decidable problems for powerful programs , 1985, JACM.

[12]  Oscar H. Ibarra,et al.  Characterizations of Presburger Functions , 1981, SIAM J. Comput..

[13]  David Jefferson,et al.  Verification Decidability of Presburger Array Programs , 1980, JACM.

[14]  Dennis M. Ritchie,et al.  The complexity of loop programs , 1967, ACM National Conference.

[15]  David R. Jefferson Type reduction and program verification , 1980 .

[16]  Helmut Alt,et al.  Functions Equivalent to Integer Multiplication , 1980, International Colloquium on Automata, Languages and Programming.

[17]  Julia Robinson,et al.  Definability and decision problems in arithmetic , 1949, Journal of Symbolic Logic.

[18]  Samuel N. Kamin,et al.  A complete and consistent hoare axiomatics for a simple programming language , 1977, POPL '77.

[19]  Dennis Tsichritzis,et al.  The Equivalence Problem of Simple Programs , 1970, JACM.

[20]  Oscar H. Ibarra,et al.  On the Simplification and Equivalence Problems for Straight-Line Programs , 1983, JACM.