Skip to main content
Log in

A note on the complexity of program evaluation

  • Published:
Mathematical systems theory Aims and scope Submit manuscript

Abstract

A simple problem concerning evaluation of programs is shown to be nonelementary recursive. The problem is the following: Given an input-free programP (i.e. all variables are initially 0) without nested loops using only instructions of the formx ← 1, x ← x + y,\(x \leftarrow x\dot - y\),do x... end, doesP output 0? This problem has time complexity\(2^{2^{ {\mathinner{\mkern2mu\raise1pt\hbox{.}\mkern2mu \raise4pt\hbox{.}\mkern2mu\raise7pt\hbox{.}\mkern1mu}} ^2 } } \)}cn-levels for some constantc. Other results are presented which show how the complexity of the 0-evaluation problem changes when the nonlooping instructions are varied. For example, it is shown that 0-evaluation is PSPACE-complete even for the case when the nonlooping instructions are onlyx ← x + 1,if x = 0then yy \(y \leftarrow y\dot - 1\).

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A. V., Hopcroft, J. E. and Ullman, J. D.,The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, MA, 1974.

    Google Scholar 

  2. Cherniavsky, J., Simple programs realize exactly Presburger formulas,SIAM J. Comput., 5 (1976), pp. 666–677.

    Google Scholar 

  3. Constable, R. and Borodin, A., Subrecursive programming languages. Part I: Efficiency and program structure,JACM 19 (1972), 526–568.

    Google Scholar 

  4. Gurari, E. M. and Ibarra, O. H., The complexity of the equivalence problem for simple programs,JACM 28 (1981), 535–560.

    Google Scholar 

  5. Hartmanis, J. and Stearns, R. E., On the computational complexity of algorithms,Trans. AMS 117 (1965), 285–306.

    Google Scholar 

  6. Hopcroft, J. E. and Ullman, J. D.,Introduction to Automata Theory, Languages, and Computation, Addison-Wesley, Reading, MA, 1979.

    Google Scholar 

  7. Hunt, H. B. III, Constable, R. L., and Sahni, S., On the computational complexity of program scheme equivalence,SIAM J. Comput. 9 (1980), 396–416.

    Google Scholar 

  8. Hunt, H. B. III, On the complexity of flowchart and loop program schemes and programming languages,JACM 29 (1982), 228–249.

    Google Scholar 

  9. Ibarra, O. H. and Leininger, B. S., Characterizations of Presburger functions,SICOMP 10 (1981), 22–39.

    Google Scholar 

  10. Ibarra, O. H. and Rosier, L. E., Simple programming languages and restricted classes of Turing machines,Theoretical Computer Science, Vol. 26, No. 1 and 2, pp. 197–220, September 1983.

    Google Scholar 

  11. Ibarra, O. H. and Rosier, L. E., Some comments concerning the analysis of simple programs over different sets of primitives. University of Minnesota, Department of Computer Science, Tech. Rep. No. 82–10 (1982).

  12. Kfoury, A. J., Analysis of simple programs over different sets of primitives,7th ACM SIGACT-SIGPLAN Conference Record, 1980, pp. 56–61.

  13. Knuth, D.,The Art of Computer Programming: Vol. 2,Seminumerical Algorithms, Addison-Wesley, Reading, MA, 1973.

    Google Scholar 

  14. Machtey, M. and Young, P.,An Introduction to the General Theory of Algorithms, North-Holland, New York, NY, 1978.

    Google Scholar 

  15. Meyer, A. R., Weak monadic second order theory of successor is not elementary recursive, Project MAC Report, MIT, Cambridge, MA, 1972.

    Google Scholar 

  16. Meyer, A. R. and Ritchie, D. M., The complexity of loop programs,Proc. ACM Nat'l. Conf. (1967), 465–469.

  17. Meyer, A. R. and Stockmeyer, L. J., Nonelementary word problems in automata and logic,Proc. AMS Symp. on Complexity of Computation, 1973.

  18. Minsky, M. L.,Computation: Finite and Infinite Machines, Prentice Hall, Englewood Cliffs, NJ, 1967.

    Google Scholar 

  19. Stockmeyer, L. J. and Meyer, A. R., Word problems requiring exponential space,Proc. Fifth Annual ACM STOC (1973), 1–9.

  20. Tsichritzis, D., The equivalence problem of simple programs,JACM 17 (1970), 729–738.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

This research was supported in part by NSF Grant MCS78-01736 and MCS81-02853.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Ibarra, O.H., Leininger, B.S. & Rosier, L.E. A note on the complexity of program evaluation. Math. Systems Theory 17, 85–96 (1984). https://doi.org/10.1007/BF01744435

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01744435

Keywords

Navigation