| | |
Summary: Semantics by lub's of Approximations
fact :: Int -> Int
fact = \x -> if x <= 0 then 1 else fact(x-1) * x
Regard non-recursively defined approximations
fact0 = \x -> bot
fact1 = \x -> if x <= 0 then 1 else fact0(x - 1) x
fact2 = \x -> if x <= 0 then 1 else fact1(x - 1) x
. . .
Thus: facti+1 = ff facti where
ff :: (Int -> Int) -> (Int -> Int)
ff g = \x -> if x <= 0 then 1 else g(x-1) * x
Define semantics fact of fact as
fact = {fact0, fact1, . . .} = {ff i
() | i IN}
Semantics by Least Fixpoints
fact :: Int -> Int
fact = \x -> if x <= 0 then 1 else fact(x-1) * x
Semantics fact of fact should satisfy the defining equation
fact = \x -> if x <= 0 then 1 else fact(x - 1) x
ff (fact)
|