From b120b8a972e81a7e59a8aec320143ddde01c2fe1 Mon Sep 17 00:00:00 2001 From: Sergei Winitzki Date: Wed, 4 Sep 2024 11:46:53 +0200 Subject: [PATCH] fix the open problem solved by Hew Wolff (#108) * fix the open problem solved by Hew Wolff * wip * clean everything with clean.sh * add files with embedded fonts * fix font size for back cover * fix back cover size * fix barcode position --- sofp-src/cover/sofp-back-cover-no-bg.tex.src | 5 +- sofp-src/cover/sofp-back-cover.tex | 1 + .../vol1_isbn_barcode_embedded_fonts.pdf | Bin 0 -> 4061 bytes .../vol2_isbn_barcode_embedded_fonts.pdf | Bin 0 -> 4200 bytes .../vol3_isbn_barcode_embedded_fonts.pdf | Bin 0 -> 4243 bytes sofp-src/lyx/sofp-applicative.lyx | 12 +- sofp-src/lyx/sofp-summary.lyx | 157 ++++++++---------- sofp-src/scripts/clean.sh | 2 +- sofp-src/scripts/prepare_volume.sh | 8 +- sofp-src/tex/chapter3-picture.pdf | Bin 3740 -> 6720 bytes sofp-src/tex/sofp-applicative.tex | 2 +- sofp-src/tex/sofp-back-cover-no-bg.tex | 7 +- sofp-src/tex/sofp-filterable.tex | 6 +- sofp-src/tex/sofp-summary.tex | 21 ++- sofp-src/tex/sofp-typeclasses.tex | 2 +- sofp-src/tex/sofp.tex | 10 +- 16 files changed, 109 insertions(+), 124 deletions(-) create mode 100644 sofp-src/cover/vol1_isbn_barcode_embedded_fonts.pdf create mode 100644 sofp-src/cover/vol2_isbn_barcode_embedded_fonts.pdf create mode 100644 sofp-src/cover/vol3_isbn_barcode_embedded_fonts.pdf diff --git a/sofp-src/cover/sofp-back-cover-no-bg.tex.src b/sofp-src/cover/sofp-back-cover-no-bg.tex.src index 939a73161..1670bd643 100644 --- a/sofp-src/cover/sofp-back-cover-no-bg.tex.src +++ b/sofp-src/cover/sofp-back-cover-no-bg.tex.src @@ -1,6 +1,6 @@ \onecolumn \thispagestyle{empty} -\newgeometry{top=2cm, left=2.5cm, right=3.9cm,bottom=1cm} +\newgeometry{top=2.5cm, left=2.5cm, right=3.9cm, bottom=1cm} \begin{wrapfigure}{l}{0.4\columnwidth} \includegraphics[width=0.4\columnwidth]{monads_evil_face} @@ -53,4 +53,5 @@ matrices or simplifying the expressions: The author received a Ph.D. in theoretical physics. After a career in academic research, he works as a software engineer. -%\vspace{0.2cm}\hspace*{\fill}\includegraphics[scale=1.0]{barcode} + +%\vspace{3.0cm}\hspace*{\fill}\colorbox{white}{\includegraphics[scale=1.0,width=50.8mm,height=30.5mm]{barcode}} diff --git a/sofp-src/cover/sofp-back-cover.tex b/sofp-src/cover/sofp-back-cover.tex index 3ee550b1d..19e7d2991 100644 --- a/sofp-src/cover/sofp-back-cover.tex +++ b/sofp-src/cover/sofp-back-cover.tex @@ -5,6 +5,7 @@ \usepackage{graphicx} \usepackage{pagecolor} \usepackage{changepage} +\usepackage{relsize} \geometry{ paperwidth=\CoverWidth in,% diff --git a/sofp-src/cover/vol1_isbn_barcode_embedded_fonts.pdf b/sofp-src/cover/vol1_isbn_barcode_embedded_fonts.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f9fa5bd0b914c70b94594386513e1ca02414fbd9 GIT binary patch literal 4061 zcmb_f4RjM#7WN#(#SvkltbnLI3nlGBGBf#Wl5JAbB>jN~+NRiIL7XHn>Cj{*%uHxn z4lIilK^LWfECLEe3c^xW6a<&UpDwa4AOfo>3kruHcLBwpMPNnU`=)6d3a*?zPLt-n z`|iE-z5Dm>%P4W@Ygt`3m9h8Yvn#2Lj3QyO7~m9M6l^FgBkd%l4UQUJ;vD1iz$njI z?ka>|kn(xT%Zo-8`0R8{!tjxSS$2CKDRO!2v0$iH;uQ>((QzdfSMvD?w&$W;%7hps z`X^F3Idm}=!b&wV1Eq`x1_euq&W~^kcH@8;#101~D-!0SRAO0lzWtszhj*WK<@!?t zs+yJ@FOauT>08GNX`0eCJ>p+pnsS*+pZdQP@gW?Zv5j*kP>lx)`QQxG<)@ILLE(Vggk$u*@=MWMalsuqI(a zK?Y(?iY~*l7?%QA20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`6pLu6Zm-JruHKhN$?;GPsjv!_A#Ru4PEztUUW z7W=Hxz_bT{PHrN`1!}N@{5Z@DcFm=2J2i+8+BFp>FXN55a5Z08FJWK(sPaI4O~4w| zi$YmOiD*QSZ3(+Z6|upXkZBE4 zS(F;PrqWx26j6-S@CwrFtU6Z98it{e1VyY?lxh&GGiyMl6b#wQ;P`1(2s68;T2W#) zny#&_)zunwq7Qb8>4numE}tpeF~0HaItf@c@<_1trC(pjwob)}sW< zn2v!@4t)a`r3#J2b+GTC>}XwWpHewAfsz6(X_XYpt-yjOZVeXPm)vv?@YuX?42A04 z&^$TxjNYhatXjrc&ayTJKGva(-o^mnPMqLs5OqP11wGeoh^BC+h>B7<1c0Lq$3#gf z=KP5C8O6L`;-osHMa03-Ai`RN^AmTq!ccW3MgL#ha51mm)zG)+reL5QM=UNy)Nl?4 zXdJ=hl`?pW1t7tIEhI`&PJx7q#o!QD`)m?M5OT1n@Ja+b)MRl+l-5CnCt+)ga6;Iw zNoa#O#Kj{D@T>6@;gbWEpYG5BqX6-%D7C8b;Yn@!9GoBubx|=cchaHq5FPE3Fb*ag zC`hK;L>3q17!L3u9tS(UpdI85N^g-EDhcWZ7@uyhMh*)7OwZ4!sG|f!VYh2)NrAno z#OphnzP6f@`6D$Y3tBhgHn28H$V|75WHV!Bj4aErY9ebGMgwe+@IS#(PNFFjSe
Fl6Q99)v#i+)H-}DqmTb6cbfTHf zH(_B}<4t_5RS(yeHd#gDpwX4!c8h2qUys2Ch%OUFxEPVn7tuvRNJJza;Eq=0MpZd^ zPK&`}_IUEFR`_Q!T0Jha$70O$SUpy^L2q*WG{<;y=aLmpQdGkm06E;_J)`rf{{rg+ BZ7%=- literal 0 HcmV?d00001 diff --git a/sofp-src/cover/vol2_isbn_barcode_embedded_fonts.pdf b/sofp-src/cover/vol2_isbn_barcode_embedded_fonts.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c47ce1f32ff7d15d604f10e5a13303fc50b9a788 GIT binary patch literal 4200 zc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NSSDBJ5V>R7*HztN_;W_mS0%2*_it3A`@y!=(Uac;Ng+bheWJ}g`l znDN)L*sCubS#sDOJ7v=P4X<=}o3`h#d{7s6)V6x{+N$xFlu5U@IN3f= z@%)op4%QCey|t_%m3Sa;%7ya$wUZm3Sk-W4MO|FesfWAPDZd!``C7#z>#a-63%cSL zwf}Hp$o4(WhrhJH9irCC_M>ZT{NlClK^-SC%76! z6QDDMPVp{82XGD$<#-zefGLylalB}u?KofXgZ5@vX1uNpyCvpzI2kz~(M5D~_XPtV7+OE}-+E_WQuxsTM<)Y;zeB>^z z(ynzlV|5IvlM#34Ca0qhhtJQurEqpS2*%BzEd}rt1wfn*y^G^LvpBqd9{TkILQSroQiHmtY$_pbh#!-lFsli6N1o zUV!n5zG`H`@Zah4`zh)#!BE(ZvH&Wux0QHBf1lc0QzHLMO^JeT6S)nnjS@04QIE2j z)RD0iMN(2C%SciNY>@E3!C^zu6bY>HezB0_Bm3MABuh?!tR%YIti&OSrd}rc|T$6@B_?q$(C3Cxd9Q z(6SGvQ52YY5T8-g2l<$B8tri^EYoz_T(f5zjLuYRo!HtxJUMNTt%ORK%MpUA#`4tkF`* eN>#Gyw>k3BGf@y}UX%>4)T&7M??Y00GWH*|@Wa0V literal 0 HcmV?d00001 diff --git a/sofp-src/lyx/sofp-applicative.lyx b/sofp-src/lyx/sofp-applicative.lyx index 8ca3a7d24..42f4fa44a 100644 --- a/sofp-src/lyx/sofp-applicative.lyx +++ b/sofp-src/lyx/sofp-applicative.lyx @@ -28713,21 +28713,11 @@ status open \begin_layout Plain Layout It is unknown how to characterize or enumerate all polynomial functors that - are monads (see Problems + are monads (see Problem \begin_inset space ~ \end_inset -\begin_inset CommandInset ref -LatexCommand ref -reference "par:Problem-monads-1" -plural "false" -caps "false" -noprefix "false" - -\end_inset - -– \begin_inset CommandInset ref LatexCommand ref reference "par:Problem-monads" diff --git a/sofp-src/lyx/sofp-summary.lyx b/sofp-src/lyx/sofp-summary.lyx index 7e9af90a8..c110b6b6c 100644 --- a/sofp-src/lyx/sofp-summary.lyx +++ b/sofp-src/lyx/sofp-summary.lyx @@ -3045,7 +3045,7 @@ do not store . \begin_inset Note Note -status open +status collapsed \begin_layout Plain Layout By Yoneda we have @@ -3181,14 +3181,56 @@ If Exercise \begin_inset CommandInset label LatexCommand label -name "par:Exercise-additional-13" +name "par:Problem-monads-1" \end_inset \begin_inset CommandInset ref LatexCommand ref -reference "par:Exercise-additional-13" +reference "par:Problem-monads-1" +plural "false" +caps "false" +noprefix "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Foot +status open + +\begin_layout Plain Layout +This was an open problem but it was solved by Hew Wolff. +\end_layout + +\end_inset + + Prove that +\begin_inset Formula $L^{A}\triangleq\bbnum 1+\underbrace{A\times A\times...\times A}_{n\text{ times}}$ +\end_inset + + cannot be made into a monad if +\begin_inset Formula $n\ge2$ +\end_inset + +. +\end_layout + +\begin_layout Subsubsection +Exercise +\begin_inset CommandInset label +LatexCommand label +name "par:Exercise-additional-13-1" + +\end_inset + + +\begin_inset CommandInset ref +LatexCommand ref +reference "par:Exercise-additional-13-1" plural "false" caps "false" noprefix "false" @@ -4541,87 +4583,7 @@ open problems \begin_layout Standard The author of this book does not know how to answer the following questions and also could not find any answers in existing books or papers. -\end_layout - -\begin_layout Subsubsection -Problem -\begin_inset CommandInset label -LatexCommand label -name "par:Problem-monads-1" - -\end_inset - - -\begin_inset CommandInset ref -LatexCommand ref -reference "par:Problem-monads-1" -plural "false" -caps "false" -noprefix "false" - -\end_inset - - -\end_layout - -\begin_layout Standard -Do all polynomial functors of the form -\begin_inset Formula $P_{n}^{A}\triangleq\bbnum 1+\overbrace{A\times A\times...\times A}^{n\text{ times, }n\ge2}$ -\end_inset - - fail to be monads? An example is the functor -\begin_inset Formula $P_{2}^{A}\triangleq\bbnum 1+A\times A$ -\end_inset - -, which is not a monad because all possible implementations of -\begin_inset listings -inline true -status open - -\begin_layout Plain Layout - -pure -\end_layout - -\end_inset - - and -\begin_inset listings -inline true -status open - -\begin_layout Plain Layout - -flatMap -\end_layout - -\end_inset - - methods for -\begin_inset Formula $P_{2}$ -\end_inset - - fail the monad laws. -\begin_inset Foot -status open - -\begin_layout Plain Layout -See discussion here: -\family typewriter - -\begin_inset CommandInset href -LatexCommand href -target "https://stackoverflow.com/questions/49742377" -literal "false" - -\end_inset - - -\end_layout - -\end_inset - - + \end_layout \begin_layout Subsubsection @@ -4737,6 +4699,33 @@ not obtained by a chain of these constructions? \end_layout +\begin_layout Standard +For example, functors of the form +\begin_inset Formula $L^{A}\triangleq\bbnum 1+A\times A$ +\end_inset + +, +\begin_inset Formula $L^{A}\triangleq\bbnum 1+A\times A\times A$ +\end_inset + +, etc., cannot be obtained via these constructions. + All those functors are not monads (see Exercise +\begin_inset space ~ +\end_inset + + +\begin_inset CommandInset ref +LatexCommand ref +reference "par:Problem-monads-1" +plural "false" +caps "false" +noprefix "false" + +\end_inset + +). +\end_layout + \begin_layout Subsubsection Problem \begin_inset CommandInset label diff --git a/sofp-src/scripts/clean.sh b/sofp-src/scripts/clean.sh index 61fc5a92e..4cf095bda 100644 --- a/sofp-src/scripts/clean.sh +++ b/sofp-src/scripts/clean.sh @@ -1 +1 @@ -rm -rf build vol1 vol2 vol3 pdf* mdoc sofp-*.pdf +rm -rf build tex vol1 vol2 vol3 pdf* mdoc sofp-*.pdf sofp.pdf diff --git a/sofp-src/scripts/prepare_volume.sh b/sofp-src/scripts/prepare_volume.sh index e0dcceb53..742380bd1 100644 --- a/sofp-src/scripts/prepare_volume.sh +++ b/sofp-src/scripts/prepare_volume.sh @@ -9,15 +9,15 @@ function pdfPages { } vol1_ISBN="ISBN (vol.~1): 978-1-4710-4004-7" -vol1_ISBN_barcode="vol1_isbn_barcode.pdf" +vol1_ISBN_barcode="vol1_isbn_barcode_embedded_fonts.pdf" vol1_url="https://www.lulu.com/shop/sergei-winitzki/the-science-of-functional-programming-part-i/paperback/product-dyyq2zm.html" vol2_ISBN="ISBN (vol.~2): 978-1-4461-9146-0" -vol2_ISBN_barcode="vol2_isbn_barcode.pdf" +vol2_ISBN_barcode="vol2_isbn_barcode_embedded_fonts.pdf" vol2_url="https://www.lulu.com/shop/sergei-winitzki/the-science-of-functional-programming-part-ii/paperback/product-655e7wm.html" vol3_ISBN="ISBN (vol.~3): 978-1-4461-9136-1" -vol3_ISBN_barcode="vol3_isbn_barcode.pdf" +vol3_ISBN_barcode="vol3_isbn_barcode_embedded_fonts.pdf" vol3_url="https://www.lulu.com/shop/sergei-winitzki/the-science-of-functional-programming-part-ii/paperback/product-p668z4q.html" v=$1 @@ -124,7 +124,7 @@ esac echo "Using volume $v ISBN '$isbn'" sed -i.bak -e 's|\({\\footnotesize{}\)ISBN: [^}]*\(}\\\\\)|\1'"$isbn"'\2|;' $dir/$name.tex # Add barcode to back cover. - sed -i.bak -e 's|%\(.*\){barcode}.*|\1{'"$barcode"'}|' $dir/sofp-back-cover-no-bg.tex + sed -i.bak -e 's|%\(.*\){barcode}\(.*\)$|\1{'"$barcode"'}\2|' $dir/sofp-back-cover-no-bg.tex mv $dir/$name.tex $dir/sofp.tex diff --git a/sofp-src/tex/chapter3-picture.pdf b/sofp-src/tex/chapter3-picture.pdf index db01aecb8851feb9e28f4627c88a8a2299d1eb25..edd70840f3860127088ae8893533ec8cb1bc6673 100644 GIT binary patch delta 4254 zcmai12|QG5*pIA(vSzDkWal#HoY{;}X2vqIn<62DvDGlfSd%GxDWxgWjj}H-t}VGj zi|n$ND1@R-Wr^I#H+1j)y7m2j-}#;Qcb@nEJn#Q~&Uw%CzRz=c+gLhqoJYfyZ09zT zO49W2Pp0Lht&}C6Ckh1;tYh+o{jruMKo)IbPk~TV-dP7yz=4M)0vV9^^fP*kbXnHr z=9qnlYm7b?3Pfl7@C6es`I+p-oP6BHTPatBI;JvbSSzV9^e+klF4OcPts<}89dYq4 z)2Eacaxb~kWt!UZJr~sFihXq|-r++lO;@hM8Cn5PyRy4Qkf3^!X3c- z`#th8{&FG}vW#l!1Tf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qi$06;MU!@UsTjv(%=Y`u~Gpn{oL0)Mz6c>;iD%-;m;jpG;&>)^MH#7KCy1RLHm z3aRwJ-``iNa_!!LvsKmV_E~Mwsn@Js6TuIUMhc2TQ#XTuuN~PT@fai6KOww?B|e laez|6ft2k36`N*mPr6B+X39v@>L3i05|BU;6log_{Rgn@7_I;S diff --git a/sofp-src/tex/sofp-applicative.tex b/sofp-src/tex/sofp-applicative.tex index 68ffd70a0..9e0ec2100 100644 --- a/sofp-src/tex/sofp-applicative.tex +++ b/sofp-src/tex/sofp-applicative.tex @@ -4711,7 +4711,7 @@ \subsection{Relationship between monads and applicative functors} functors with monoidal fixed types. (All our examples of non-applicative functors involve non-polynomial functors.) But we have seen that not all polynomial functors are monads.\footnote{It is unknown how to characterize or enumerate all polynomial functors -that are monads (see Problems~\ref{par:Problem-monads-1}\textendash \ref{par:Problem-monads}).} Example~\ref{subsec:Example-applicative-not-monad} shows a simple +that are monads (see Problem~\ref{par:Problem-monads}).} Example~\ref{subsec:Example-applicative-not-monad} shows a simple applicative functor\index{applicative functor!not a monad} ($L^{A}\triangleq\bbnum 1+A\times A$) that does \emph{not} have a lawful monad implementation (Exercise~\ref{subsec:Exercise-1-monads-7-not-a-monad}). diff --git a/sofp-src/tex/sofp-back-cover-no-bg.tex b/sofp-src/tex/sofp-back-cover-no-bg.tex index 5d96f2625..8ae27bc00 100644 --- a/sofp-src/tex/sofp-back-cover-no-bg.tex +++ b/sofp-src/tex/sofp-back-cover-no-bg.tex @@ -1,6 +1,6 @@ \onecolumn \thispagestyle{empty} -\newgeometry{top=2cm, left=2.5cm, right=3.9cm,bottom=1cm} +\newgeometry{top=2.5cm, left=2.5cm, right=3.9cm, bottom=1cm} \begin{wrapfigure}{l}{0.4\columnwidth} \includegraphics[width=0.4\columnwidth]{monads_evil_face} @@ -28,7 +28,7 @@ developed in excruciating detail through 1906 Scala code snippets, 192 statements with step-by-step derivations, 104 diagrams, 223 examples -with tested Scala code, and 309 exercises. Discussions +with tested Scala code, and 310 exercises. Discussions build upon each chapter\textsf{'}s material further. Beginners in FP will find tutorials about the \texttt{map}/\texttt{reduce} @@ -53,4 +53,5 @@ The author received a Ph.D. in theoretical physics. After a career in academic research, he works as a software engineer. -%\vspace{0.2cm}\hspace*{\fill}\includegraphics[scale=1.0]{barcode} + +%\vspace{3.0cm}\hspace*{\fill}\colorbox{white}{\includegraphics[scale=1.0,width=50.8mm,height=30.5mm]{barcode}} diff --git a/sofp-src/tex/sofp-filterable.tex b/sofp-src/tex/sofp-filterable.tex index 958f64ff8..126a13533 100644 --- a/sofp-src/tex/sofp-filterable.tex +++ b/sofp-src/tex/sofp-filterable.tex @@ -3628,7 +3628,7 @@ \subsubsection{Statement \label{subsec:Statement-recursive-filterable-contrafunc } \end{lstlisting} \[ -\xymatrix{S^{B,F^{B}}\ar[r]\sp(0.525){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[rd]\sb(0.45){\text{liftOpt}_{F}(f)\triangleq~~~} & S^{A,F^{B}}\ar[d]\sp(0.45){\big(\overline{\text{liftOpt}_{F}}(f)\big)^{\uparrow S^{A,\bullet}}}\\ +\xymatrix{S^{B,F^{B}}\ar[r]\sp(0.525){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[rd]\sb(0.45){\text{liftOpt}_{F}(f)\triangleq~~~} & S^{A,F^{B}}\ar[d]\sp(0.4){\big(\overline{\text{liftOpt}_{F}}(f)\big)^{\uparrow S^{A,\bullet}}}\\ \xyScaleY{1.8pc}\xyScaleX{6pc} & S^{A,F^{A}} } \] @@ -3674,7 +3674,7 @@ \subsubsection{Statement \label{subsec:Statement-recursive-filterable-contrafunc with respect to lifting in the type parameter $A$ of $S^{A,R}$. That law is: \[ -\xymatrix{S^{B,R}\ar[r]\sp(0.5){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[d]\sb(0.55){(h^{:R\rightarrow R^{\prime}})^{\uparrow S^{B,\bullet}}} & S^{A,R}\ar[d]\sp(0.55){h^{\uparrow S^{A,\bullet}}}\\ +\xymatrix{S^{B,R}\ar[r]\sp(0.5){\text{liftOpt}_{S}(f^{:A\rightarrow\bbnum 1+B})}\ar[d]\sb(0.5){(h^{:R\rightarrow R^{\prime}})^{\uparrow S^{B,\bullet}}} & S^{A,R}\ar[d]\sp(0.4){h^{\uparrow S^{A,\bullet}}}\\ \xyScaleY{1.8pc}\xyScaleX{6.0pc}S^{B,R^{\prime}}\ar[r]\sp(0.45){\text{liftOpt}_{S}(f)} & S^{A,R^{\prime}} } \] @@ -4332,7 +4332,7 @@ \subsection{Naturality laws and natural transformations\label{subsec:Naturality- that requirement as an equation called the \textbf{naturality law}\index{naturality law!of headOption@of \texttt{headOption}} of \lstinline!headOption!: \[ -\xymatrix{\text{List}^{A}\ar[r]\sp(0.55){\text{headOpt}^{A}}\ar[d]\sb(0.5){(f^{:A\rightarrow B})^{\uparrow\text{List}}} & \text{Opt}^{A}\ar[d]\sb(0.4){f^{\uparrow\text{Opt}}}\\ +\xymatrix{\text{List}^{A}\ar[r]\sp(0.55){\text{headOpt}^{A}}\ar[d]\sb(0.5){(f^{:A\rightarrow B})^{\uparrow\text{List}}} & \text{Opt}^{A}\ar[d]\sp(0.45){f^{\uparrow\text{Opt}}}\\ \xyScaleY{1.6pc}\xyScaleX{4.5pc}\text{List}^{B}\ar[r]\sp(0.55){\text{headOpt}^{B}} & \text{Opt}^{B} } \] diff --git a/sofp-src/tex/sofp-summary.tex b/sofp-src/tex/sofp-summary.tex index 172ebc691..a13fe14fa 100644 --- a/sofp-src/tex/sofp-summary.tex +++ b/sofp-src/tex/sofp-summary.tex @@ -457,7 +457,13 @@ \subsubsection{Exercise \label{par:Exercise-additional-12}\ref{par:Exercise-addi If $M$ is a commutative monad then $M\circ M$ is also a lawful commutative monad. -\subsubsection{Exercise \label{par:Exercise-additional-13}\ref{par:Exercise-additional-13}} +\subsubsection{Exercise \label{par:Problem-monads-1}\ref{par:Problem-monads-1}} + +\footnote{This was an open problem but it was solved by Hew Wolff.} +Prove that $L^{A}\triangleq\bbnum 1+\underbrace{A\times A\times...\times A}_{n\text{ times}}$ +cannot be made into a monad if $n\ge2$. + +\subsubsection{Exercise \label{par:Exercise-additional-13-1}\ref{par:Exercise-additional-13-1}} If $M$ is a commutative monad and $W$ is a commutative monoid then the monoid $M^{W}$ is commutative. @@ -632,14 +638,7 @@ \subsection{Open problems\index{open problems}} The author of this book does not know how to answer the following questions and also could not find any answers in existing books or -papers. - -\subsubsection{Problem \label{par:Problem-monads-1}\ref{par:Problem-monads-1}} - -Do all polynomial functors of the form $P_{n}^{A}\triangleq\bbnum 1+\overbrace{A\times A\times...\times A}^{n\text{ times, }n\ge2}$ -fail to be monads? An example is the functor $P_{2}^{A}\triangleq\bbnum 1+A\times A$, -which is not a monad because all possible implementations of \lstinline!pure! -and \lstinline!flatMap! methods for $P_{2}$ fail the monad laws.\footnote{See discussion here: \texttt{\href{https://stackoverflow.com/questions/49742377}{https://stackoverflow.com/questions/49742377}}} +papers. \subsubsection{Problem \label{par:Problem-monads}\ref{par:Problem-monads}} @@ -660,6 +659,10 @@ \subsubsection{Problem \label{par:Problem-monads}\ref{par:Problem-monads}} there any polynomial monads \emph{not} obtained by a chain of these constructions? +For example, functors of the form $L^{A}\triangleq\bbnum 1+A\times A$, +$L^{A}\triangleq\bbnum 1+A\times A\times A$, etc., cannot be obtained +via these constructions. All those functors are not monads (see Exercise~\ref{par:Problem-monads-1}). + \subsubsection{Problem \label{subsec:Problem-co-pointed-applicative}\ref{subsec:Problem-co-pointed-applicative}} By Statement~\ref{subsec:Statement-co-pointed-applicative-example}, diff --git a/sofp-src/tex/sofp-typeclasses.tex b/sofp-src/tex/sofp-typeclasses.tex index 6f5682a44..a82f35937 100644 --- a/sofp-src/tex/sofp-typeclasses.tex +++ b/sofp-src/tex/sofp-typeclasses.tex @@ -2889,7 +2889,7 @@ \subsection{Pointed functors: motivation and laws\label{subsec:Pointed-functors- Since both sides of the law are functions applied to an arbitrary value $x^{:A}$, we can omit $x$ and rewrite the law as: \begin{equation} -\text{for any }f^{:A\rightarrow B}:\quad\quad\text{pu}_{F}\bef f^{\uparrow F}=f\bef\text{pu}_{F}\quad.\label{eq:naturality-law-of-pure} +\text{for any }f^{:A\rightarrow B}:\quad\text{pu}_{F}\bef f^{\uparrow F}=f\bef\text{pu}_{F}\quad.\label{eq:naturality-law-of-pure} \end{equation} \[ \xymatrix{\xyScaleY{2.0pc}\xyScaleX{4.0pc}A\ar[r]\sp(0.5){\text{pu}_{F}}\ar[d]\sb(0.45){f} & F^{A}\ar[d]\sp(0.45){f^{\uparrow F}}\\ diff --git a/sofp-src/tex/sofp.tex b/sofp-src/tex/sofp.tex index 031daa1d3..d25c90a53 100644 --- a/sofp-src/tex/sofp.tex +++ b/sofp-src/tex/sofp.tex @@ -1,4 +1,4 @@ -%% LyX 2.3.6.2 created this file. For more info, see http://www.lyx.org/. +%% LyX 2.3.7 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[10pt,russian,english,openright,numbers=noenddot,index=totoc,bibliography=totoc,listof=totoc,fontsize=12pt]{scrbook} \usepackage{amsmath} @@ -336,9 +336,9 @@ {\footnotesize{}ISBN (e-book): 978-0-359-76877-6}\\ {\footnotesize{}ISBN: 978-0-359-76877-6}\\ \\ -{\scriptsize{}Source hash (sha256): 3c11991097dc72ed4cac251fc86e6ababb7ee20fe75421517a164b6032c7b24a}\\ -{\scriptsize{}Git commit: 5bf853f262fadf3c192f9ab6be13ca4deb99b43d}\\ -{\scriptsize{}PDF file built on Thu, 22 Aug 2024 21:37:50 +0200 by pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) on Darwin}\\ +{\scriptsize{}Source hash (sha256): cc147a546a04a29eaca33d732eae46d8a4e2b52b357f6bd30f4f99f07d1e6863}\\ +{\scriptsize{}Git commit: 8af5847655dd43ee6c73a1e5f969665bfaf3e908}\\ +{\scriptsize{}PDF file built on Wed, 04 Sep 2024 11:42:44 +0200 by pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023) on Darwin}\\ ~\\ {\scriptsize{}Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -376,7 +376,7 @@ developed in excruciating detail through 1906 Scala code snippets, 192 statements with step-by-step derivations, 104 diagrams, 223 examples with tested Scala -code, and 309 exercises. Discussions build upon each +code, and 310 exercises. Discussions build upon each chapter's material further.}\\ {\scriptsize{}}\\ {\scriptsize{}Beginners in FP will find tutorials about the map/reduce