阿克曼函數

阿克曼函數是非原始递归函数的例子;它需要兩個自然數作為輸入值,輸出一個自然數。它的輸出值增長速度非常高。

歷史
1920年代後期,數學家大衛·希爾伯特的學生Gabriel Sudan和威廉·阿克曼,當時正研究計算的基礎。Sudan發明了一個遞歸卻非原始遞歸的苏丹函数。1928年,阿克曼又獨立想出了另一個遞歸卻非原始遞歸的函數。

他最初的念頭是一個三個變數的函數A(m,n,p),使用康威鏈式箭號表示法是mnp。阿克曼證明了它是遞歸函數。希爾伯特在On the Infinite猜想這個函數不是原始遞歸函數。阿克曼在On Hilbert's Construction of the Real Numbers證明了這點。

後來和拉斐尔·米切尔·罗宾逊定義了一個類似的函數,但只用兩個變數。

定義
以下是阿克曼函數的虛擬碼:

function ack(m, n)
while m ≠ 0
if n = 0
n := 1
else
n := ack(m, n-1)
m := m - 1
return n+1

Haskell 语言能生成更精确的定义:

ack 0 n = n + 1
ack m 0 = ack (m - 1) 1
ack m n = ack (m - 1) (ack m (n - 1))

递归是有界的,因为在每次应用递归時,要么 m 递减,要么 m 保持不变而 n 递减。每次 n 达到零,m 递减,所以 m 最终可以达到零。(較技術性的表达:在每种情况下,有序对(m, n)按字典次序递减,它保持了非负整数的良序关系)。但是,在 m 递减的时候, n 的增加没有上界,而且增加的幅度比較大。

這個函數亦可用康威鏈式箭號表示法來作一個非遞迴性的定義:
: 對於m>2,A(m, n) = (2 → (n+3) → (m - 2)) - 3。
即是
: 對於n>2,2 → nm = A(m+2,n-3) + 3。

使用hyper運算符就是
: A(m, n) = hyper(2, m, n + 3) - 3。

使用高德納箭號表示法則為
: A(m, n) = 2↑m-2(n+3) - 3。

函数值表
反函數
由於函數f (n) = A(nn)的增加速率非常快,因此其反函數f−1則會以非常慢的速度增加。阿克曼反函數常用α表示。因為A(4, 4)的數量級約等於2^{2^{10^{19729}}},因此對於一般可能出現的數值n,α(n)均小於5。

阿克曼反函數會出現在一些演算法的時間複雜度分析中,例如并查集或是Chazelle針對最小生成树的演算法中。有時會使用一些阿克曼函數的變體,例如省略運算式中的-3等,但其增加的速率都相當慢。

以下是一個两個輸入值的阿克曼反函數,其中\lfloor x \rfloor為下取整函數:
:\alpha(m,n) = \min\{i \geq 1 : A(i,\lfloor m/n \rfloor) \geq \log_2 n\}.
許多演算法的複雜度分析會用到此函數,可以以此得到一個較好的時間上限。在并查集的資料結構中,m表示其運算的次數,而n表示元素的個數。在最小生成树演算法中,m表示其邊的個數,而n表示其頂點的個數。

有些定義方式會用上述的定義略作修改,例如log2 n改為n,或是下取整函數改為上取整函數。

有些研究則是用上述的定義,但是令m為常數,因此只需要一個輸入值。

参见

  • 迭代冪次
  • 忙碌的海狸

引用

  • Raphael M. Robinson, Recursion and double recursion, Bull. Amer. Math. Soc., Vol. 54, pp. 987-993.

参考资料
外部链接
*[https://web.archive.org/web/20060910150829/http://www.stetson.edu/~efriedma/periodictable/html/Ac.html Erich Friedman's page on Ackermann] at Stetson University
Scott Aaronson, [http://www.scottaaronson.com/writings/bignumbers.html Who can name the biggest number?] * (1999)
*[http://www-users.cs.york.ac.uk/~susan/cyc/a/ackermnn.htm Some values of the Ackermann function] .
*[http://www.xgc.com/benchmarks/benchmarks.htm Example use of the Ackermann function as a benchmark] . Note the huge number of function calls used in computing low values.
*[https://web.archive.org/web/20080317104411/http://www.kosara.net/thoughts/ackermann42.html Decimal expansion of A(4,2)]
*[http://forum.wolframscience.com/showthread.php?s=&threadid=579 Hyper-operations] Posting on A New Kind of Science Forum discussing the arithmetic operators of the Ackermann function and their inverse operators with link to an extended article on the subject.
[https://web.archive.org/web/20020815083542/http://home.earthlink.net/~mrob/pub/math/ln-2deep.html Robert Munafo's Versions of Ackermann's Function] describes several variations on the definition of A*.
*Zach, Richard,
[http://plato.stanford.edu/archives/fall2003/entries/hilbert-program/ "Hilbert's Program"] , The Stanford Encyclopedia of Philosophy (Fall 2003 Edition), Edward N. Zalta (ed.)

评论 (0)

  • 还没有评论,来抢沙发吧。