不動点が複数の関数である関数の例
Haskellで書くと
この関数 fact'
を元にした高階関数 phi'
を考える
hsfact' x = if x == 10 then fact 10 else x * fact' (x-1)
hsphi' f x = if x == 10 then fact 10 else x * f (x-1)
ちなみに、式内の
fact
は、通常の階乗関数
fact

この phi'
には複数の不動点が存在する
全ての不動点 g
は以下の形で表せる
g_\alpha(x)= \begin{cases}x ! * \alpha & (0 \leqq x<10) \\ x ! & (10 \leqq x)\end{cases}
ここで、\alphaは、 undefined
または任意の自然数
\alphaは無限個あるので、 phi'
の不動点も無限個あるといえる
例えば、 α = undefined
の時
hsg_ x
| x < 10 = undefined
| otherwise = fact x
この g_
は確かに、 phi' g_
と等しい挙動になる
だから g_
は phi'
の不動点である
これは fact'
と表示的意味論的には同じなので、 g_ = fact'
fact'
の方は、
undefiend
ではなく無限ループになるけど、無限ループを
undefiend
に表すなら同じになる

例えば、 α = 2
の時
hsg2 x
| x < 10 = fact x * 2
| otherwise = fact x
この g2
は確かに、 phi' g2
と等しい挙動になる
だから g2
は phi'
の不動点である
g2
の方が、 g_
よりも多く定義されている関数になので、
g_\bot \sqsubset g_2という関係になる
だから、 fix phi'
の返り値は g_
に等しくなる
id
とか
任意の値が不動点
(*3)
とか
0
、 undefined
など