is said that one can convert pseudo-product C' = (Int, Int, Bool) to product C = (Int, Bool) using function m that is uniquely determined as
m (x, _, b) = (x, b)
But there are two ways to define m
m (x, _, b) = (x, b)
m (_, x, b) = (x, b)
They are not equal, then m is not unique, then (int, bool) is not a product
Can you point where I'm wrong?
P.S. this is duplicate of issue https://github.com/hmemcpy/milewski-ctfp-pdf/issues/127
Update
(Int, Bool)together withp :: (Int, Bool) -> Intandq :: (Int, Bool) -> Boolgiven by the two projections is indeed a product ofIntandBool.Recall that a product of two objects
aandbis given by an objectctogether with two functionsp :: c -> a,q :: c -> bsuch that for any other objectc'and functionsp' :: c' -> a,q' :: c' -> bthere is a unique functionm :: c' -> csuch thatp' = p . m,q' = q . m.This last bit is important: there can be many functions
m' :: c' -> c, but only one of them shall satisfy bothp' = p . m'andq' = q . m'.Let
c' = (Int, Int, Bool)andp' :: (Int, Int, Bool) -> Int,q' :: (Int, Int, Bool) -> Boolwithp' (x, _, _) = xandq' (_, _, b) = b.If you define
m :: c' -> cbym (_, x, b) = (x, b), then you have thatp' (x, y, b) = xbutp (m (x, y, b)) = p (y, b) = y, and sop' = p . mdoes not hold.Therefore, it is true that there are two ways to define
m :: c' -> c– actually, there are even more! We could also havem (x, _, _) = (x, True), orm (_, _, b) = (0, b), ... but of all these functions there is only one that satisfiesp' = p . m,q' = q . m. This is what makes(Int, Bool)together withp :: (Int, Bool) -> Intandq :: (Int, Bool) -> Boola product ofIntandBool.