home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / folklore / computer / 16670 < prev    next >
Encoding:
Internet Message Format  |  1992-11-23  |  3.1 KB

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!ukma!cs.widener.edu!dsinc!ub!galileo.cc.rochester.edu!rochester!cornell!chapman
  2. From: chapman@cs.cornell.edu (Richard Chapman)
  3. Newsgroups: alt.folklore.computers
  4. Subject: Re: Ackermann's function
  5. Keywords: Ackermann's function, recursion, primitive-recursive, FORTRAN, COBOL
  6. Message-ID: <1992Nov23.193734.253@cs.cornell.edu>
  7. Date: 23 Nov 92 19:37:34 GMT
  8. References: <ken.722284796@base>
  9. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  10. Lines: 52
  11.  
  12. ken@us.oracle.com (Ken C. Stewart) writes:
  13.  
  14. >Can anyone remind me (ahem) of the definition of Ackermann's function (a pair
  15. >of mutually-recursive functions I think?)?  
  16.  
  17. The Ackermann function: 
  18.  
  19.     f(0,y)  = y + 1
  20.     f(x+1,0) = f(x,1)
  21.     f(x+1,y+1) = f(x,f(x+1,y))
  22.  
  23. >I saw it on the 'net years ago
  24. >that it was one of the simpler examples of a recursive function that was not
  25. >"primitive recursive", meaning, I think, that it could not be evaluated
  26. >by iterative means, as the terminating condition for the loop to evaluate it
  27. >depended on evaluating Ackermann's function ... I also seem to remember that
  28. >since it required the programming language it was expressed in to support
  29. >recursion, and since COBOL and FORTRAN (or at least some standard flavour
  30. >thereof) don't, that COBOL and FORTRAN are not general purpose programming
  31. >languages, whereas, say, vi macros are (see articles passim concerning
  32. >Universal Turing Machine simulation using vi macros).
  33.  
  34. The Ackermann function is total recursive but not primitive recursive. The
  35. primitive recursive functions are the smallest class of functions
  36. containing the constant function f(x) = 0, the successor function f(x)
  37. = x+1, projection functions for all arities to select each argument
  38. (e.g.  a function of 4 arguments that returns its second argument),
  39. and closed under the operations of substitution and recursion.
  40.  
  41. The proof that Ackermann is not p.r. is rather long, and is based on
  42. showing that it grows faster than any p.r.  function.
  43.  
  44. If you augment the class of p.r. fun's by making it closed under the
  45. operation of unbounded minimization (given a function, return the
  46. least argument value for which that function returns zero) you get the
  47. class of partial recursive functions, which is the same as the class
  48. of Turing computable functions.
  49.  
  50. While recursion is not allowed in FORTRAN, you can implement it
  51. yourself in a FORTRAN program by explicitly implementing a stack and
  52. handling it all yourself. Now, whether or not FORTRAN has recursion
  53. has little to do with the expressive power of the language; since
  54. on-line storage and memory are finite, the most you can implement in
  55. any language on any computer is a function that could be implemented by
  56. a finite-state automaton (which is a far smaller class than the Turing
  57. computable functions). However, barring the finite memory limit. If
  58. you assume you have infinite memory size, and each location can hold
  59. an arbitrarily large integer, all you need to implement all the
  60. computable functions are: load a memory location with zero, increment
  61. contents of a memory location, conditional jump, and transfer contents of one
  62. memory location to another. All these are operations which FORTRAN and
  63. COBOL are both capable of.
  64.