Skip to content

Inconsistent generalizations for [Int] and [Bool] #4

@rudymatela

Description

@rudymatela
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions