Commit 033db585 by Frontull Samuel

### with nonrecursive y combinator

parent 09f4f358
 ... ... @@ -105,8 +105,11 @@ hd = \s -> LCStr \$ \x a b -> unChurch s x (\y -> a x) (\y -> b x) tl :: LCStr -> LCStr tl = \s -> second (unChurch s (pair empty empty) nexta nextb) ycomb :: (t -> t) -> t ycomb g = g (ycomb g) -- ycomb :: (t -> t) -> t -- ycomb f = f (ycomb f) newtype Mu a = Mu (Mu a -> a) ycomb f = (\h -> h \$ Mu h) (\x -> f . (\(Mu g) -> g) x \$ x) eq :: LCStr -> LCStr -> LCBool eq = ycomb (\f x y -> ... ... @@ -173,6 +176,15 @@ lcstr_tostr = \s -> unChurch s ("") (\a -> "a" ++ a) (\b -> "b" ++ b) lcbool_tostr :: LCBool -> String lcbool_tostr = \b -> ite b "True" "False" -- lcbool_tostr (pcp (cons (pair a ab) (cons (pair bb b) nil))) -- lcbool_tostr (pcp (cons (pair a abbb) (cons (pair bb b) nil))) -- lcbool_tostr (pcp (cons (pair bba b) (cons (pair b ab) (cons (pair a bba) nil)))) -- PCP Problems problem_1 :: LCList (LCPair LCStr) problem_1 = cons (pair a ab) (cons (pair bb b) nil) problem_2 :: LCList (LCPair LCStr) problem_2 = cons (pair a abbb) (cons (pair bb b) nil) problem_3 :: LCList (LCPair LCStr) -- undecidable problem_3 = cons (pair bba b) (cons (pair b ab) (cons (pair a bba) nil)) -- lcbool_tostr (pcp problem_1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!