
s = \x y z -> x z (y z)
k = \x y -> x
i = \x -> x

-- typo in question sheet, cerror and werror are according to the
-- question sheet as issued
c = \f x y -> f y x
cerror = \f x y -> f x y
b = \f g x -> f (g x)

w = c s i
werror = cerror s i
c' = \f x -> s f (k x)
b' = b (s b) k

-- this file gives the following types:
-- *Main> :t w
-- w :: (t -> t -> t1) -> t -> t1
-- *Main> :t c'
-- c' :: (t -> t1 -> t2) -> t1 -> t -> t2
-- *Main> :t b'
-- b' :: (t2 -> t) -> (t -> t1) -> t2 -> t1
--

werror1 = (\f x y -> f x y) s i
werror2a = (\x y -> s x y) i
werror2 = \y -> s i y 
werror3 = \y -> (\x y z -> x z (y z)) i y 
werror3' = \y -> (\x y' z -> x z (y' z)) i y 
werror4 = \y -> (\y' z -> i z (y' z)) y 
werror5 = \y -> (\z -> i z (y z)) 
werror6 = \y -> (\z -> (\x -> x) z (y z)) 
werror7 = \y -> (\z -> z (y z)) 

w1 = (\f x y -> f y x) s i
w2a = (\x y -> s y x) i
w2 = \y -> s y i 
w3 = \y -> (\x y z -> x z (y z)) y i 
w3' = \y -> (\x y' z -> x z (y' z)) y i 
w4 = \y -> (\y' z -> y z (y' z)) i 
w5 = \y -> (\z -> y z (i z)) 
w6 = \y -> (\z -> y z ((\x -> x) z)) 
w7 = \y -> (\z -> y z z) 
w7' = \y z -> y z z 

-- :t [werror, werror1,werror2a,werror2,werror3,werror3']
-- :t [werror4,werror5,werror6,werror7] 
-- :t [w, w1,w2a,w2,w3,w3',w4,w5,w6,w7] 
-- better, check the types of each one individually,
-- to be sure none of them has a more general type which 
-- has got specialised by putting it into the list

c1 = \f x -> (\x y z -> x z (y z)) f (k x)
c2 = \f x -> (\y z -> f z (y z)) (k x)
c3 = \f x -> (\z -> f z (k x z)) 
c4 = \f x -> (\z -> f z ((\x' y -> x') x z)) 
c5 = \f x -> (\z -> f z ((\y -> x) z)) 
c6 = \f x -> (\z -> f z x) 
c7 = \f x z -> f z x 

-- :t [c',c1,c2,c3,c4,c5,c6,c7] 

b1 = (\f g x -> f (g x)) (s b) k
b2 = (\g x -> (s b) (g x)) k
b3 = \x -> s b (k x) 
b4 = \x -> (\x' y z -> x' z (y z)) b (k x) 
b5 = \x -> (\y z -> b z (y z)) (k x) 
b6 = \x -> (\z -> b z (k x z)) 
b7 = \x -> (\z -> (\f g x' -> f (g x')) z (k x z)) 
b8 = \x -> (\z -> (\g x' -> z (g x')) (k x z)) 
b9 = \x -> (\z -> (\x' -> z (k x z x'))) 
b10 = \x -> (\z -> (\x' -> z ((\x'' y -> x'') x z x'))) 
b11 = \x -> (\z -> (\x' -> z ((\y -> x) z x'))) 
b12 = \x -> (\z -> (\x' -> z (x x'))) 
b13 = \x z x' -> z (x x') 

-- :t [b', b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13] 


