[Haskell-cafe] A non-inductive Haskell proof?
rj248842 at hotmail.com
Sun Mar 15 07:42:13 EDT 2009
The following theorem is obviously true, but how is it proved (most cleanly and simply) in Haskell?
Theorem: (nondecreasing xs) => nondecreasing (insert x xs), where:
nondecreasing :: (Ord a) => [a] -> Bool
nondecreasing  = True
nondecreasing xxs@(x : xs) = and [a <= b | (a, b) <- zip xxs xs]
insert :: (Ord a) => a -> [a] -> [a]
insert x xs = takeWhile (<= x) xs ++ [x] ++ dropWhile (<= x) xs
Hotmail® is up to 70% faster. Now good news travels really fast.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe