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 mymax :: Integer -> Integer -> Integer mymax x y | x >= y = x | otherwise = y prop_mymax_assoc x y z = mymax x (mymax y z) == mymax (mymax 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 >= 0 ==> sumTo n == n*(n+1) `div` 2