Why definition of categorical product works for $C'=$(Int, Int, Bool) and $C=($Int, Bool$)$?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












In milewski-ctfp



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



image part 1



image part 2







share|cite|improve this question





















  • Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
    – José Carlos Santos
    Jul 15 at 12:07










  • I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
    – Hurkyl
    Jul 15 at 12:27














up vote
2
down vote

favorite












In milewski-ctfp



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



image part 1



image part 2







share|cite|improve this question





















  • Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
    – José Carlos Santos
    Jul 15 at 12:07










  • I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
    – Hurkyl
    Jul 15 at 12:27












up vote
2
down vote

favorite









up vote
2
down vote

favorite











In milewski-ctfp



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



image part 1



image part 2







share|cite|improve this question













In milewski-ctfp



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



image part 1



image part 2









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 15 at 14:07
























asked Jul 15 at 11:56









sergey

133




133











  • Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
    – José Carlos Santos
    Jul 15 at 12:07










  • I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
    – Hurkyl
    Jul 15 at 12:27
















  • Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
    – José Carlos Santos
    Jul 15 at 12:07










  • I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
    – Hurkyl
    Jul 15 at 12:27















Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
– José Carlos Santos
Jul 15 at 12:07




Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to.
– José Carlos Santos
Jul 15 at 12:07












I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
– Hurkyl
Jul 15 at 12:27




I don't think you are using standard terminology; your question would be better if you wrote it in the language category theorists usually use, or at least provide sufficient definition so that people can know what you mean by the words and operations you use.
– Hurkyl
Jul 15 at 12:27










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










(Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool given by the two projections is indeed a product of Int and Bool.



Recall that a product of two objects a and b is given by an object c together with two functions p :: c -> a, q :: c -> b such that for any other object c' and functions p' :: c' -> a, q' :: c' -> b there is a unique function m :: c' -> c such that p' = 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 both p' = p . m' and q' = q . m'.



Let c' = (Int, Int, Bool) and p' :: (Int, Int, Bool) -> Int, q' :: (Int, Int, Bool) -> Bool with p' (x, _, _) = x and q' (_, _, b) = b.



If you define m :: c' -> c by m (_, x, b) = (x, b), then you have that p' (x, y, b) = x but p (m (x, y, b)) = p (y, b) = y, and so p' = p . m does not hold.



Therefore, it is true that there are two ways to define m :: c' -> c – actually, there are even more! We could also have m (x, _, _) = (x, True), or m (_, _, b) = (0, b), ... but of all these functions there is only one that satisfies p' = p . m, q' = q . m. This is what makes (Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool a product of Int and Bool.






share|cite|improve this answer























  • I still don't understand, I added images to my question
    – sergey
    Jul 15 at 14:08










  • I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
    – sergey
    Jul 15 at 14:14










  • You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
    – sergey
    Jul 15 at 14:17






  • 1




    Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
    – Luca Bressan
    Jul 15 at 15:05


















up vote
1
down vote













If I interprete the notation correctly, we are given



$$beginalignpcolon text(Int, Int, Bool)&to textInt\(x,y,z)&mapsto x\
qcolon text(Int, Int, Bool)&to textBool\(x,y,b)&mapsto bendalign$$
and are looking for $mcolontext(Int, Int, Bool)totext(Int, Bool) $ such that $textfstcirc m=p$ and $textsndcirc m=q$.
If we want to compute $m(x,y,z)$, the result will certainly be of the form $(u,v)$ with $uintextInt$ and $vintextBool$. From $$u=textfst(u,v)=textfst(m(x,y,z))=(textfstcirc m)(x,y,z)=p(x,y,z)=x$$
$$v=textsnd(u,v)=textsnd(m(x,y,z))=(textsndcirc m)(x,y,z)=q(x,y,z)=z$$
we conclude that $m(x,y,z)=(u,v)=(x,z)$, as stated in the text.




Remark: It seems you instead skimmed over a different bug in the text:



For instance, there is a
Boolean-valued function (a predicate) defined for every type:

beginVerbatim
yes :: a -> Bool
yes _ = True
endVerbatim
But codeBool is not a terminal object. There is at least one more
codeBool-valued function from every type:

beginVerbatim
no :: a -> Bool
no _ = False
endVerbatim


The point is that for the second function is in general not different from the first function (and so not "one more"). For (exhaustive) example, if a happens to be Void, both yes and no are the same, absurd.






share|cite|improve this answer





















  • Good point! Should be "every type, except Void".
    – Bartosz Milewski
    Jul 15 at 16:37










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2852451%2fwhy-definition-of-categorical-product-works-for-c-int-int-bool-and-c-i%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










(Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool given by the two projections is indeed a product of Int and Bool.



Recall that a product of two objects a and b is given by an object c together with two functions p :: c -> a, q :: c -> b such that for any other object c' and functions p' :: c' -> a, q' :: c' -> b there is a unique function m :: c' -> c such that p' = 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 both p' = p . m' and q' = q . m'.



Let c' = (Int, Int, Bool) and p' :: (Int, Int, Bool) -> Int, q' :: (Int, Int, Bool) -> Bool with p' (x, _, _) = x and q' (_, _, b) = b.



If you define m :: c' -> c by m (_, x, b) = (x, b), then you have that p' (x, y, b) = x but p (m (x, y, b)) = p (y, b) = y, and so p' = p . m does not hold.



Therefore, it is true that there are two ways to define m :: c' -> c – actually, there are even more! We could also have m (x, _, _) = (x, True), or m (_, _, b) = (0, b), ... but of all these functions there is only one that satisfies p' = p . m, q' = q . m. This is what makes (Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool a product of Int and Bool.






share|cite|improve this answer























  • I still don't understand, I added images to my question
    – sergey
    Jul 15 at 14:08










  • I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
    – sergey
    Jul 15 at 14:14










  • You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
    – sergey
    Jul 15 at 14:17






  • 1




    Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
    – Luca Bressan
    Jul 15 at 15:05















up vote
2
down vote



accepted










(Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool given by the two projections is indeed a product of Int and Bool.



Recall that a product of two objects a and b is given by an object c together with two functions p :: c -> a, q :: c -> b such that for any other object c' and functions p' :: c' -> a, q' :: c' -> b there is a unique function m :: c' -> c such that p' = 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 both p' = p . m' and q' = q . m'.



Let c' = (Int, Int, Bool) and p' :: (Int, Int, Bool) -> Int, q' :: (Int, Int, Bool) -> Bool with p' (x, _, _) = x and q' (_, _, b) = b.



If you define m :: c' -> c by m (_, x, b) = (x, b), then you have that p' (x, y, b) = x but p (m (x, y, b)) = p (y, b) = y, and so p' = p . m does not hold.



Therefore, it is true that there are two ways to define m :: c' -> c – actually, there are even more! We could also have m (x, _, _) = (x, True), or m (_, _, b) = (0, b), ... but of all these functions there is only one that satisfies p' = p . m, q' = q . m. This is what makes (Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool a product of Int and Bool.






share|cite|improve this answer























  • I still don't understand, I added images to my question
    – sergey
    Jul 15 at 14:08










  • I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
    – sergey
    Jul 15 at 14:14










  • You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
    – sergey
    Jul 15 at 14:17






  • 1




    Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
    – Luca Bressan
    Jul 15 at 15:05













up vote
2
down vote



accepted







up vote
2
down vote



accepted






(Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool given by the two projections is indeed a product of Int and Bool.



Recall that a product of two objects a and b is given by an object c together with two functions p :: c -> a, q :: c -> b such that for any other object c' and functions p' :: c' -> a, q' :: c' -> b there is a unique function m :: c' -> c such that p' = 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 both p' = p . m' and q' = q . m'.



Let c' = (Int, Int, Bool) and p' :: (Int, Int, Bool) -> Int, q' :: (Int, Int, Bool) -> Bool with p' (x, _, _) = x and q' (_, _, b) = b.



If you define m :: c' -> c by m (_, x, b) = (x, b), then you have that p' (x, y, b) = x but p (m (x, y, b)) = p (y, b) = y, and so p' = p . m does not hold.



Therefore, it is true that there are two ways to define m :: c' -> c – actually, there are even more! We could also have m (x, _, _) = (x, True), or m (_, _, b) = (0, b), ... but of all these functions there is only one that satisfies p' = p . m, q' = q . m. This is what makes (Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool a product of Int and Bool.






share|cite|improve this answer















(Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool given by the two projections is indeed a product of Int and Bool.



Recall that a product of two objects a and b is given by an object c together with two functions p :: c -> a, q :: c -> b such that for any other object c' and functions p' :: c' -> a, q' :: c' -> b there is a unique function m :: c' -> c such that p' = 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 both p' = p . m' and q' = q . m'.



Let c' = (Int, Int, Bool) and p' :: (Int, Int, Bool) -> Int, q' :: (Int, Int, Bool) -> Bool with p' (x, _, _) = x and q' (_, _, b) = b.



If you define m :: c' -> c by m (_, x, b) = (x, b), then you have that p' (x, y, b) = x but p (m (x, y, b)) = p (y, b) = y, and so p' = p . m does not hold.



Therefore, it is true that there are two ways to define m :: c' -> c – actually, there are even more! We could also have m (x, _, _) = (x, True), or m (_, _, b) = (0, b), ... but of all these functions there is only one that satisfies p' = p . m, q' = q . m. This is what makes (Int, Bool) together with p :: (Int, Bool) -> Int and q :: (Int, Bool) -> Bool a product of Int and Bool.







share|cite|improve this answer















share|cite|improve this answer



share|cite|improve this answer








edited Jul 15 at 12:43


























answered Jul 15 at 12:35









Luca Bressan

3,86621036




3,86621036











  • I still don't understand, I added images to my question
    – sergey
    Jul 15 at 14:08










  • I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
    – sergey
    Jul 15 at 14:14










  • You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
    – sergey
    Jul 15 at 14:17






  • 1




    Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
    – Luca Bressan
    Jul 15 at 15:05

















  • I still don't understand, I added images to my question
    – sergey
    Jul 15 at 14:08










  • I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
    – sergey
    Jul 15 at 14:14










  • You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
    – sergey
    Jul 15 at 14:17






  • 1




    Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
    – Luca Bressan
    Jul 15 at 15:05
















I still don't understand, I added images to my question
– sergey
Jul 15 at 14:08




I still don't understand, I added images to my question
– sergey
Jul 15 at 14:08












I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
– sergey
Jul 15 at 14:14




I think I understand now - though possible implementations of graphs are many, in each of them there only one possible implementation of m
– sergey
Jul 15 at 14:14












You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
– sergey
Jul 15 at 14:17




You are saying that m (_, x, b) = (x, b) will not work with p' (x, y, b) = x - of course it will not, but it will work with p' (x, y, b) = y, this is second possible implementation of graph, and them are many, and each of them have unique m. But (Int, Int, Bool) will not have unique m, that's why its not a product
– sergey
Jul 15 at 14:17




1




1




Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
– Luca Bressan
Jul 15 at 15:05





Yes. To be more precise, you shouldn't say "(Int, Int, Bool) will not have a unique m". You should say "(Int, Int, Bool) together with p' :: (Int, Int, Bool) -> Int and q' :: (Int, Int, Bool) -> Bool defined by p' (x, _, _) = x and q' (_, _, b) = b is not a product of Int and Bool because it's not true that for any c'' together with p'' :: c'' -> Int and q'' :: c'' -> Bool there exists a unique m :: c'' -> (Int, Int, Bool) such that p'' = p' . m and q'' = q' . m".
– Luca Bressan
Jul 15 at 15:05











up vote
1
down vote













If I interprete the notation correctly, we are given



$$beginalignpcolon text(Int, Int, Bool)&to textInt\(x,y,z)&mapsto x\
qcolon text(Int, Int, Bool)&to textBool\(x,y,b)&mapsto bendalign$$
and are looking for $mcolontext(Int, Int, Bool)totext(Int, Bool) $ such that $textfstcirc m=p$ and $textsndcirc m=q$.
If we want to compute $m(x,y,z)$, the result will certainly be of the form $(u,v)$ with $uintextInt$ and $vintextBool$. From $$u=textfst(u,v)=textfst(m(x,y,z))=(textfstcirc m)(x,y,z)=p(x,y,z)=x$$
$$v=textsnd(u,v)=textsnd(m(x,y,z))=(textsndcirc m)(x,y,z)=q(x,y,z)=z$$
we conclude that $m(x,y,z)=(u,v)=(x,z)$, as stated in the text.




Remark: It seems you instead skimmed over a different bug in the text:



For instance, there is a
Boolean-valued function (a predicate) defined for every type:

beginVerbatim
yes :: a -> Bool
yes _ = True
endVerbatim
But codeBool is not a terminal object. There is at least one more
codeBool-valued function from every type:

beginVerbatim
no :: a -> Bool
no _ = False
endVerbatim


The point is that for the second function is in general not different from the first function (and so not "one more"). For (exhaustive) example, if a happens to be Void, both yes and no are the same, absurd.






share|cite|improve this answer





















  • Good point! Should be "every type, except Void".
    – Bartosz Milewski
    Jul 15 at 16:37














up vote
1
down vote













If I interprete the notation correctly, we are given



$$beginalignpcolon text(Int, Int, Bool)&to textInt\(x,y,z)&mapsto x\
qcolon text(Int, Int, Bool)&to textBool\(x,y,b)&mapsto bendalign$$
and are looking for $mcolontext(Int, Int, Bool)totext(Int, Bool) $ such that $textfstcirc m=p$ and $textsndcirc m=q$.
If we want to compute $m(x,y,z)$, the result will certainly be of the form $(u,v)$ with $uintextInt$ and $vintextBool$. From $$u=textfst(u,v)=textfst(m(x,y,z))=(textfstcirc m)(x,y,z)=p(x,y,z)=x$$
$$v=textsnd(u,v)=textsnd(m(x,y,z))=(textsndcirc m)(x,y,z)=q(x,y,z)=z$$
we conclude that $m(x,y,z)=(u,v)=(x,z)$, as stated in the text.




Remark: It seems you instead skimmed over a different bug in the text:



For instance, there is a
Boolean-valued function (a predicate) defined for every type:

beginVerbatim
yes :: a -> Bool
yes _ = True
endVerbatim
But codeBool is not a terminal object. There is at least one more
codeBool-valued function from every type:

beginVerbatim
no :: a -> Bool
no _ = False
endVerbatim


The point is that for the second function is in general not different from the first function (and so not "one more"). For (exhaustive) example, if a happens to be Void, both yes and no are the same, absurd.






share|cite|improve this answer





















  • Good point! Should be "every type, except Void".
    – Bartosz Milewski
    Jul 15 at 16:37












up vote
1
down vote










up vote
1
down vote









If I interprete the notation correctly, we are given



$$beginalignpcolon text(Int, Int, Bool)&to textInt\(x,y,z)&mapsto x\
qcolon text(Int, Int, Bool)&to textBool\(x,y,b)&mapsto bendalign$$
and are looking for $mcolontext(Int, Int, Bool)totext(Int, Bool) $ such that $textfstcirc m=p$ and $textsndcirc m=q$.
If we want to compute $m(x,y,z)$, the result will certainly be of the form $(u,v)$ with $uintextInt$ and $vintextBool$. From $$u=textfst(u,v)=textfst(m(x,y,z))=(textfstcirc m)(x,y,z)=p(x,y,z)=x$$
$$v=textsnd(u,v)=textsnd(m(x,y,z))=(textsndcirc m)(x,y,z)=q(x,y,z)=z$$
we conclude that $m(x,y,z)=(u,v)=(x,z)$, as stated in the text.




Remark: It seems you instead skimmed over a different bug in the text:



For instance, there is a
Boolean-valued function (a predicate) defined for every type:

beginVerbatim
yes :: a -> Bool
yes _ = True
endVerbatim
But codeBool is not a terminal object. There is at least one more
codeBool-valued function from every type:

beginVerbatim
no :: a -> Bool
no _ = False
endVerbatim


The point is that for the second function is in general not different from the first function (and so not "one more"). For (exhaustive) example, if a happens to be Void, both yes and no are the same, absurd.






share|cite|improve this answer













If I interprete the notation correctly, we are given



$$beginalignpcolon text(Int, Int, Bool)&to textInt\(x,y,z)&mapsto x\
qcolon text(Int, Int, Bool)&to textBool\(x,y,b)&mapsto bendalign$$
and are looking for $mcolontext(Int, Int, Bool)totext(Int, Bool) $ such that $textfstcirc m=p$ and $textsndcirc m=q$.
If we want to compute $m(x,y,z)$, the result will certainly be of the form $(u,v)$ with $uintextInt$ and $vintextBool$. From $$u=textfst(u,v)=textfst(m(x,y,z))=(textfstcirc m)(x,y,z)=p(x,y,z)=x$$
$$v=textsnd(u,v)=textsnd(m(x,y,z))=(textsndcirc m)(x,y,z)=q(x,y,z)=z$$
we conclude that $m(x,y,z)=(u,v)=(x,z)$, as stated in the text.




Remark: It seems you instead skimmed over a different bug in the text:



For instance, there is a
Boolean-valued function (a predicate) defined for every type:

beginVerbatim
yes :: a -> Bool
yes _ = True
endVerbatim
But codeBool is not a terminal object. There is at least one more
codeBool-valued function from every type:

beginVerbatim
no :: a -> Bool
no _ = False
endVerbatim


The point is that for the second function is in general not different from the first function (and so not "one more"). For (exhaustive) example, if a happens to be Void, both yes and no are the same, absurd.







share|cite|improve this answer













share|cite|improve this answer



share|cite|improve this answer











answered Jul 15 at 12:40









Hagen von Eitzen

265k20258477




265k20258477











  • Good point! Should be "every type, except Void".
    – Bartosz Milewski
    Jul 15 at 16:37
















  • Good point! Should be "every type, except Void".
    – Bartosz Milewski
    Jul 15 at 16:37















Good point! Should be "every type, except Void".
– Bartosz Milewski
Jul 15 at 16:37




Good point! Should be "every type, except Void".
– Bartosz Milewski
Jul 15 at 16:37












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2852451%2fwhy-definition-of-categorical-product-works-for-c-int-int-bool-and-c-i%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?