import Test.QuickCheck -- Bool xor :: Bool -> Bool -> Bool xor x y = (x || y) && not(x && y) xor2 :: Bool -> Bool -> Bool xor2 True True = False xor2 True False = True xor2 False True = True xor2 False False = False prop_xor2 x y = xor x y == xor2 x y prop_xor_neq x y = xor x y == (not(x == y)) -- Integer sq :: Integer -> Integer sq n = n * n max2 :: Integer -> Integer -> Integer max2 x y | x >= y = x | otherwise = y prop_max2_assoc x y z = max2 x (max2 y z) == max2 (max2 x y) z pow x 0 = 1 pow x n | n > 0 = x * pow x (n-1) sumTo :: Integer -> Integer sumTo 0 = 0 sumTo n | n > 0 = n + sumTo (n-1) prop_sumTo n = n >= 100 ==> sumTo n == n*(n+1) `div` 2