import Test.Extrapolate
-- incorrect property:
prop_lengthZip :: [a] -> [a] -> Bool
prop_lengthZip xs ys = length (zip xs ys) == max (length xs) (length ys)
main :: IO ()
main = do
check (prop_lengthZip :: [Int] -> [Int] -> Bool)
putStrLn "\n"
check (prop_lengthZip :: [()] -> [()] -> Bool)
putStrLn "\n"
check (prop_lengthZip :: [Bool] -> [Bool] -> Bool)
For the above program, the output is the following:
*** Failed! Falsifiable (after 2 tests):
[] [0]
Generalization:
xs (_:xs)
Conditional Generalization:
xs ys when length xs /= length ys
*** Failed! Falsifiable (after 2 tests):
[] [()]
Generalization:
us (_:us)
*** Failed! Falsifiable (after 2 tests):
[] [False]
Generalization:
ps (_:ps)
Extrapolate is able to produce a conditional generalization involving length of [Int] but not of [Bool] and [()]. Why?
For the above program, the output is the following:
Extrapolate is able to produce a conditional generalization involving
lengthof[Int]but not of[Bool]and[()]. Why?