The Universe of Discourse
https://blog.plover.com
The Universe of Discourse (Mark Dominus Blog)enOn having the right theorem
https://blog.plover.com/2021/09/01#dilworth
<p>A recent Math StackExchange question asks
<a href="https://math.stackexchange.com/q/4237984/25554">“Prove every permutation of the alphabet contains a subset of six letters in order”</a>.
That is, you take a string of length 26 that contains each letter
once; you can find a subsequence of six letters that is either
increasing or decreasing.</p>
<p>Choosing a permutation at random, suppose we have:</p>
<pre><code> q y x u l i n g w o c k j d r p f v t s h e a z b m
</code></pre>
<p>Then the sequence <code>x w v t s e b</code> has length 7 and is in descending
order. Or:</p>
<pre><code> t h e q u i c k b r o w n f x j m p s v r l z y d g
</code></pre>
<p>This contains the ascending sequence <code>h q r s v y</code>. Also the
descending sequence <code>t q o n m l d</code>.</p>
<p>I thought about this for a while but couldn't make any progress.
But OP had said “I know I have to construct a partially ordered set and
possibly use Dilworth's Theorem…” so I looked up Dilworth's theorem.</p>
<p>It turns out I did actually know Dilworth's theorem. It is about
partially-ordered sets. Dilworth's theorem says that if you partition
a partially-ordered set into totally-ordered subsets, called ‘chains’,
then the number of such chains is at least as big as the size of the
largest “antichain”. An antichain is a subset in which no two elements
are comparable.</p>
<p>This was enough of a hint, and I found the solution pretty quickly
after that. Say that <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%5bi%5d%24"> is the position of letter <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24i%24"> in the
string <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24">. Define the partial order <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cprec%24">: $$ i\prec j \qquad \equiv
\qquad i < j \text{ and } S[i] < S[j] $$</p>
<p>That is, <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24i%5cprec%20j%24"> means that <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24i%24"> is alphabetically earlier than
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24j%24"> <em>and</em> its position in <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> is to the left of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24j%24">. This is
obviously a partial ordering of the letters of the alphabet. Chains
under <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cprec%24"> are, by definition, ascending sequences of letters
from <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24">. It's easy to show that antichains are descending
sequences.</p>
<p>Partition <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> into chains. If any chain has length <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%24"> or more, that
is an ascending sequence of letters and we win.</p>
<p>If not, then no chain has more than 5 letters, and so there must be at
least <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%24"> chains, because <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%245%c2%b75%3d25%24"> and there are <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2426%24"> letters.
Since there are at least <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%24"> chains, Dilworth's theorem tells us
there is an antichain of at least <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%24"> letters, and hence a
descending sequence of that length, and we win.</p>
<p>Once you have the idea to use Dilworth's theorem, the problem
collapses. (You also have to invent the right <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cprec%24"> relation, but
there's really only one possible choice.)</p>
<p>Maybe I'll write a followup article about how just having a theorem
doesn't necessarily mean you have an algorithm. Mathematicians will
say “partition <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> into chains,” but actually programming something
like that might be nontrivial. Then finding the antichain among the
chains might also be nontrivial.</p>
Mo in an alternate universe
https://blog.plover.com/2021/08/28#mo
<p>In a transparent attempt to capitalize on the runaway success of <em>The
Wonderful Wizard of Oz</em>, the publishers of L. Frank Baum's earlier
book <em>A New Wonderland</em> re-released it under the title <em>The Magical
Monarch of Mo</em>. What if this ploy had actually worked? Would the
book have inspired a movie?</p>
<blockquote>
<p>We're off to see the Monarch, <br />
The Marvelous Monarch of Mo…</p>
</blockquote>
<p>Naah, it kinda falls apart after that.</p>
How to fix hiring?
https://blog.plover.com/2021/08/28#job-interview.idea
<p>On Twitter, <a href="https://twitter.com/mscccc/status/1430986038252654600">Mike Coutermarsh suggested</a>:</p>
<blockquote>
<p>Job interview: “algorithms”</p>
<p>Reality: “Turn a 127 message deep slack thread between 5 engineers
into a decision”</p>
</blockquote>
<p>I suppose this was meant facetiously but I think it might contain the
germ of a good idea.</p>
<p>Applicants are usually given timed a programming quiz. What if
instead, the candidate was supplied with the 127-message Slack thread
and given 24 hours to write up a proposal document? I honestly think
this might produce good results.</p>
<p>Such a submission would be extremely probative of the candidate's
talents and abilities, including:</p>
<ul>
<li>reading and understanding technical arguments</li>
<li>balancing engineering tradeoffs</li>
<li>foreseeing potential issues</li>
<li>writing clear English</li>
<li>planning</li>
<li>seriousness</li>
<li>writing coherent, well-organized, and persuasive documents</li>
</ul>
<p>It is much more difficult to cheat on this task than on a typical
programming exercise. The candidate certainly can't submit a
prewritten essay that they found somewhere; that would be easy to
detect. A candidate who can take someone else's prewritten essay and
quickly rewrite it to plausibly appear original is probably quite
well-qualified on many of the important metrics! (Plus an additional
important one: the ability to do research. They had to locate,
recognize, and read the essay they rewrote.)</p>
<p>It shouldn't be hard to change up the essay topic periodically, since
the engineers will be producing several of those 127-message Slack
threads every month. This also tends to impede cheating.</p>
<p>When a good candidate comes for an in-person interview, you have a
ready-made topic of conversation. Instead of coding at the
whiteboard, you can ask them to discuss their proposal.</p>
<p>Complaints that this would discriminate against candidates with poor
command of English do not hold water. Good command of English is one
of the job requirements, and the whole point of a job interview is to
discriminate against unqualified candidates. Besides, if the hiring
process encourages candidates to improve their English writing
abilities, rather than cramming a bunch of red-black-tree algorithms,
language trivia, or irrelevant brainteasters, so much the better for
everyone.</p>
Why is the S combinator an S?
https://blog.plover.com/2021/08/28#combinator-s
<p>The most important combinator in
<a href="https://en.wikipedia.org/wiki/combinatory_logic">combinatory logic</a> is the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> combinator,
defined simply:</p>
<p>$$
S x y z ⇒ (x z)(y z)
$$</p>
<p>or in <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5clambda%24">-calculus terms:</p>
<p>$$
S = \lambda x y z. (x z)(y z).
$$</p>
<p><a href="https://en.wikipedia.org/wiki/SKI_combinator_calculus">A wonderful theorem</a> states that any
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5clambda%24">-expression with no free variables can be converted into a
combinator expression that contains only the combinators <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%2c%20K%2c%24"> and
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%24">, where <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> is really the only interesting one of the three,
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%24"> being merely the identity function, and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24"> a constructor of
constant functions:</p>
<p>$$
\begin{align}
I x & = x \\
K x y & = x \\
\end{align}
$$</p>
<p>In fact one can get along without <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%24"> since <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%20K%20K%20%3d%20I%24">.</p>
<p>A not-too-infrequently-asked question is why the three combinators are
named as they are. The <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%24"> is an identity function and pretty obvious
stands for “identity”.</p>
<p>Similarly the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24"> constructs constant functions: <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%20x%24"> is the combinator which
ignores its argument and yields <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24x%24">. So it's not hard to imagine that
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24"> is short for <em>Konstant</em>, which is German for “constant”; no
mystery there.</p>
<p>But why <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24">? People typically guess that it stands for
“substitution”, the idea being that if you have some application
$$A\,B$$
then <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> allows one to <strong>substitute</strong> some term <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24T%24"> for a free variable
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24v%24"> in both <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24A%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24B%24"> prior to the application:</p>
<p>$$
S\, A\, B\, T = A[v/T]\, B[v/T].
$$</p>
<p>Although this seems plausible, it's not correct.</p>
<p>Combinatory logic was introduced in a 1924 paper of Moses Schönfinkel. In it,
he defines a family of combinators including the standard <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24">, <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24">,
and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%24">; he shows that only <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24"> are required. His
initial set of combinators comprises the following:</p>
<p>$$
\begin{array}{cllrl}
I & \textit{Identitätsfunktion} & \text{“identity function”}& I\,x =& x \\
C & \textit{Konstanzfunktion} & \text{“constancy function”} & C\,x\,y =& x \\
T & \textit{Vertauschungsfunktion} & \text{“swap function”} & T\,x\,y\,z=& x\,z\,y \\
Z & \textit{Zusammensetzungsfunktion} & \text{“composition function”} & Z\,x\,y\,z=& x\,(y\,z) \\
S & \textit{Verschmelzungsfunktion} & \text{“fusion function”} & S\,x\,y\,z=& x\,z\,(y\,z)
\end{array}
$$</p>
<p>(Schönfinkel also had combinators representing logical operations (one
corresponding to the <a href="https://en.wikipedia.org/wiki/Sheffer_stroke">Sheffer stroke</a>, which had
been discovered in 1913), and to quantification, but those don't
concern us right now.)</p>
<p><img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24T%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24Z%24"> are now usually called <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24C%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24B%24">. These names
probably originated in Curry's <em>Grundlagen der kombinatorischen Logik</em>
(1930). Curry 1930 is probably also the origin of the change from
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24C%24"> to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24">. I have no idea why Schönfinkel chose to abbreviate
<em>Konstanzfunktion</em> as <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24C%24"> instead of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24K%24">. Curry notes that for
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%2c%20K%2c%20B%2c%20C%2c%20S%24"> Schönfinkel has <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24I%2c%20C%2c%20Z%2c%20T%2c%20S%24">, but does not explain his
changes. In Curry and Feys’ influential 1958 book on combinatory
logic, the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24B%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24C%24"> combinators given names that are are
literal translations of Schönfinkel's: “elementary permutator” and
“elementary compositor”.</p>
<p>Returning to the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> combinator, one sees that its German name in
Schönfinkel's paper, <em>Verschmelzungsfunktion</em>, begins with the letter V, but
so does <em>Vertauschungsfunktion</em>, so abbreviating either with V would
have been ambiguous. Schönfinkel instead chose to abbreviate
<em>Verschmelzungsfunktion</em> with S for its root <em>schmelzen</em>, “fusion”,
and <em>Vertauschungsfunktion</em> with T for its root <em>tauschen</em>, “swap”.
The word <em>schmelzen</em> is akin to English words “melt” and “smelt”.</p>
<p>The “swap” is straightforward: the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24T%24"> combinator swaps the order of
the arguments to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24x%24"> in <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24x%5c%2cy%5c%2cz%24">: $$T\,x\,y\,z = x\,z\,y$$ but
does not otherwise alter the structure of the expression.</p>
<p>But why is <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> the “melting” or “fusion” combinator? It's because
Schönfinkel was interested in reducing abitrary mathematical expressions to
combinators. He will sometimes have an application <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%28f%5c%2c%20x%29%28g%5c%2c%20x%29%24">
and he wants to ‘fuse’ the two occurrences of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24x%24">. He can do this
by rewriting the expression as <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%5c%2c%20f%5c%2c%20g%5c%2c%20x%24">. Schönfinkel says:</p>
<blockquote>
<p>Der praktische Nutzen der Function <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> besteht ersichtlich darin,
daß sie es ermöglicht, mehrmals auftresnde Veränderliche — und bis
zu einem gewissen Grade auch individuelle Functionen — nur einmal
auftreten zu lassen.</p>
<p>Clearly, the practical use of the function <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> will be to enable
us to reduce the number of occurrences of a variable — and to some
extent also of a particular function — from several to a single one.</p>
</blockquote>
<p>(Translation from van Heijenoort, p. 362.)</p>
<p>So there you have it: the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24S%24"> combinator is so-named not for
substitution, but because S is the first letter of <em>schmelzen</em>, ‘to
fuse’.</p>
<h2>References</h2>
<ul>
<li><p>Schönfinkel, M. “Über die Bausteine der mathematischen Logik” (“On the building-blocks
of mathematical logic”), <em>Mathematische Annalen</em> (1969), p. 305–316; Berlin,
Göttingen, Heidelberg.</p>
<p>English translation in Van Heijenoort, Jean (ed.) <em>From Frege to
Gödel: a Source Book in Mathematical Logic, 1879–1931</em> (1967)
pp. 355–366 Harvard University Press; Cambridge and London.</p></li>
<li><p>Curry, H.B.
“<a href="https://doi.org/10.2307/2370619">Grundlagen der kombinatorischen Logik</a>”
(“Fundamentals of combinatory logic”), _American Journal of
Mathematics Vol. 52, No. 3 (Jul., 1930), pp. 509-536.</p></li>
<li><p>Curry, H.B. and Robert Feys <em>Combinatory Logic</em> (1958) p. 152
North-Holland Publishing Company, Amsterdam.</p></li>
</ul>
The convergents of 2x
https://blog.plover.com/2021/07/22#double-convergents
<p>Take some real number <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5calpha%24"> and let its convergents be <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24c_0%2c%0ac_1%2c%20c_2%2c%20%5cldots%24">. Now consider the convergents of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%242%5calpha%24">.
Sometimes they will include <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%242c_0%2c%202c_1%2c%202c_2%2c%20%5cldots%24">, sometimes only
some of these.</p>
<p>For example, the convergents of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cpi%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%242%5cpi%24"> are</p>
<p>$$ \begin{array}{rlc}
\pi & \approx &
\color{darkblue}{3},&&& \color{darkblue}{\frac{22}{7}}, &
\color{darkblue}{\frac{333}{106}}, && \color{darkblue}{\frac{355}{113}}, &
\color{darkblue}{\frac{103993}{33102}}, &&
\frac{104348}{33215}, &
\color{darkblue}{\frac{208341}{66317}}, &
\ldots \\
2\pi & \approx &
\color{darkblue}{6}, & \frac{19}{3}, & \frac{25}{4}, & \color{darkblue}{\frac{44}{7}}, &
\color{darkblue}{\frac{333}{53}}, &
\frac{377}{60}, &
\color{darkblue}{\frac{710}{113}}, &
\color{darkblue}{\frac{103393}{16551}}, &
\frac{312689}{49766}, &&
\color{darkblue}{\frac{416682}{66317}}, &
\ldots
\end{array} <br />
$$ </p>
<p>Here are the analogous lists for <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%7b1%2b%5csqrt%7b5%7d%7d2%24"> and
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%241%2b%5csqrt5%24">:</p>
<p>$$
\begin{array}{rlc}
\frac12{1+\sqrt{5}}& \approx &
1, & 2, & \color{darkblue}{\frac32}, & \frac53, & \frac85, & \color{darkblue}{\frac{13}8}, & \frac{21}{13}, &
\frac{34}{21}, & \color{darkblue}{\frac{55}{34}}, & \frac{89}{55}, & \frac{144}{89}, & \color{darkblue}{\frac{233}{144}}, & \frac{377}{233}, &\frac{610}{377} , & \color{darkblue}{\frac{987}{610} }, & \ldots
\\
1+\sqrt{5} & \approx &
& & \color{darkblue}{3}, &&& \color{darkblue}{\frac{13}4}, &&& \color{darkblue}{\frac{55}{17}}, &&& \color{darkblue}{\frac{233}{72}}, &&& \color{darkblue}{\frac{987}{305}}, & \ldots
\end{array}
$$</p>
<p>This time all the convergents in the second list are matched by
convergents in the first list. The number <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%7b1%2b%5csqrt5%7d%7b2%7d%24"> is
notorious because it's the real number whose convergents converge the
most slowly. I'm surprised that <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%241%2b%5csqrt5%24"> converges so much more
quickly; I would not have expected the factor of 2 to change the
situation so drastically.</p>
<p>I haven't thought about this at all yet, but it seems to me that a
promising avenue would be to look at what Gosper's algorithm would do
for the case <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24x%5cmapsto%202x%24"> and see what simplifications can be
done. This would probably produce some insight, and maybe a method for
constructing a number <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5calpha%24"> so that <em>all</em> the convergents of
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%242%5calpha%24"> are twice those of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5calpha%24">.</p>
“Forensic” doesn't mean what I thought it did
https://blog.plover.com/2021/07/09#forensic
<p>Last week at work we released bad code, which had somehow survived
multiple reviews. I was very interested in finding out how this
happened, dug into the Git history to find out, and wrote a report.
Originally I titled the report something like “Forensic analysis of
Git history” (and one of my co-workers independently referred to the
investigation as forensic) but then I realized I wasn't sure what
“forensic” meant. I looked it up, and learned it was the wrong word.</p>
<p>A forensic analysis is one performed in the service of a court or
court case. “Forensic” itself is from Latin <em>forum</em>, which is
<a href="https://en.wikipedia.org/wiki/Forum_%28Roman%29">a public assembly place</a> where markets were held
and court cases were heard.</p>
<p>Forensic <em>medicine</em> is medicine in service of a court case, for
example to determine a cause of death. For this reason it often
refers to a postmortem examination, and I thought that “forensic”
meant a postmortem or other retrospective analysis. That was the sense
I intended it. But no. I had written a postmortem analysis, but not
a forensic one.</p>
A simple dice-throwing game that seems hard to play
https://blog.plover.com/2021/07/08#dice-game
<p>I ran into a fun math problem yesterday, easy to ask, easy to
understand, but somewhat open-ended and seems to produce fairly
complex behavior. It might be a good problem for a bright high school
student to tinker with.</p>
<p>Consider the following one-player game. You start with a total of <em>n</em>
points. On each turn, you choose to throw either a four-, six-, or
eight-sided die, and then subtract the number thrown from your point
total. The game continues until your total reaches zero (and you win)
or goes below zero (and you lose).</p>
<p>This game seems surprisingly difficult to analyze. The computer
analysis is quite easy, but what I mean is, if someone comes to you
offering to pay you a dollar if you can win starting with <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d9%24">
points, and it would be spoilsportish to say “just wait here for half
an hour while I write this computer program”, what's your good move?</p>
<p>Is there even a way to make an educated guess, short of doing a full
analysis? The <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%e2%89%a44%24"> strategy is obvious, but even for <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d5%24"> you need
to start calculating: rolling the d4 is safe. Rolling the d6 gives
you a chance of wiping out, but also a chance of winning instantly; is
that an improvement? (Spoiler: it is, quite substantially so! Your
chance of winning increases from <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2436%5c%25%24"> to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2440%2e7%5c%25%24">.)</p>
<p>With the game as described, and optimal play, the probability of
winning approaches <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2445%2e66%5c%25%24"> as the number of points increases, and the
strategy is not simple: the best strategy for <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%e2%89%a420%24"> uses the d4 in 13
cases, the d6 in 4 cases, and the d8 in 3 cases:</p>
<p>$$\begin{array}{rcl}
n & \text{Best play} & \text{Win %} \\ \hline
1 & 4\quad & 25.00\% \\
2 & 4\quad & 31.25 \\
3 & 4\quad & 39.06 \\
4 & 4\quad & 48.83 \\ \hline
5 & 6 & 40.69\% \\
6 & 6 & 47.47 \\
7 & 4\quad & 44.01 \\
8 & \quad8 & 47.04 \\ \hline
9 & 4\quad & 44.80\% \\
10 & 4\quad & 45.83 \\
11 & 4\quad & 45.42 \\
12 & 4\quad & 45.77 \\ \hline
13 & 6 & 45.48 \% \\
14 & \quad8 & 45.73 \\
15 & 4\quad & 45.60 \\
16 & \quad8 & 45.71 \\ \hline
17 & 4\quad & 45.63 \% \\
18 & 4\quad & 45.67 \\
19 & 4\quad & 45.65 \\
20 & 6 & 45.67
\end{array}
$$</p>
<p>It seems fairly clear (and not hard to prove) that when the die with
fewest sides has <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24"> sides, the good numbers of points are
multiples of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24">, with <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24kd%2b1%24"> somewhat worse, and then <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24kd%2b2%2c%0akd%2b3%2c%20%5cldots%24"> generally better and better to the next peak at
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24kd%2bd%24">. But there are exceptions: even if <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24"> is not the smallest
die, if you have a <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24">-sided die, it is good to have <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24"> points,
and when you do you should roll the <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24d%24">-sided die.</p>
<p>I did get a little more insight after making the chart above and
seeing the 4-periodicity. In a
comment on
<a href="https://math.stackexchange.com/q/4192238/25554">my Math SE post</a> I
observed:</p>
<blockquote>
<p>There is a way to see quickly that the d4 is better for
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d7%24">. <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d1%24"> is the worst possible position. <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d2%2c3%2c%24"> and
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%244%24"> are increasingly good; <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%244%24"> is best because you can't lose
and you might win outright. After that <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%245%24"> is bad again, but not
as bad as <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%241%24">, with <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%2c7%2c8%24"> increasingly good. The pattern
continues this way, with <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%244k%e2%88%923%2c4k%e2%88%922%2c4k%e2%88%921%2c4k%24"> being increasingly
good, and then <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%244k%2b1%24"> being worse again but better than
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%244k%e2%88%923%24">. For <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d7%24">, the d6 allows one to land on
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5c%5c%7b1%2c2%2c3%2c4%2c5%2c6%5c%5c%7d%24">, and the d4 on <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5c%5c%7b3%2c4%2c5%2c6%5c%5c%7d%24">. But <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%241%24"> is
worse than <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%245%24"> and <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%242%24"> is worse than <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%246%24">, so prefer the d4.</p>
</blockquote>
<p>The d4-d6-d8 case is unusually confusing, because for example it's not
clear whether from 12 points you should throw d4, hoping to land on 8,
or d6, hoping to land on 6. (I haven't checked but I imagine the two
strategies perform almost equally well; similarly it probably doesn't
matter much if you throw the d4 or the d6 first from <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d10%24">.)</p>
<p>That the d6 is best for <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%3d13%24"> is very surprising to me.</p>
<p>Why <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2445%2e66%5c%25%24">? I don't know. With only one die, the winning probability
for large <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%24"> converges to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac2%7bn%2b1%7d%24"> which I imagine is a fairly
straightforward calculation (but I have not done it). For more than
one die, it seems much harder.</p>
<p>Is there a way to estimate the winning probability for large <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24n%24">,
given the list of dice? Actually yes, a little bit: the probability of
winning with just a d4 is <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%2025%24">, and the d6 and d8 can't hurt,
so we know the chance of winning with all three dice available will be
somewhat more than <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2440%5c%25%24">, as it is. The value of larger dice falls
off rapidly with the number of sides, so for example with d4+d6 the
chance of winning increases from <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2440%5c%25%24"> to almost <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2445%5c%25%24">, and
adding the d8 only nudges this up to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2445%2e66%5c%25%24">.</p>
<p>The probability of winning with a d2 is <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%2023%24">, and if you have
a d3 also the probability goes up to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%2034%24">, which seems simple
enough, but if you add a d4 instead of the d3 instead it goes to
<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2468%2e965%5c%25%24">, whatever that is. And Dfan Schmidt tells me that d3 + d4
converges to <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%7b512%7d%7b891%7d%24">.</p>
<p>I wrote it up for
<a href="https://math.stackexchange.com/q/4192238/25554">Math StackExchange</a>
but nobody has replied yet.</p>
<p><a href="https://pic.blog.plover.com/math/dice-game/dice-game.py.txt">Here's Python code to calculate the values</a>. Enjoy.</p>
<p>[ Addendum: <a href="https://math.stackexchange.com/questions/4192238/convergence-of-a-recursively-defined-sequence-that-arises-in-a-dice-throwing-gam?noredirect=1#comment8697921_4192238">Michael Lugo points out</a> that the d2+d4 probability
(“<img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%2468%2e965%5c%25%24">, whatever that is”)
is simply <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%7b20%7d%7b29%7d%24">, and gives some other similar results.
One is that d3+d4+d5 has a winning probability of <img src="https://chart.apis.google.com/chart?chf=bg,s,00000000&cht=tx&chl=%24%5cfrac%7b16%7d%7b27%7d%24">;
the small denominator is surprising. ]</p>
Examples of dummy pronouns
https://blog.plover.com/2021/07/07#dummy-prononus
<p>Katara is interested in linguistics. When school was over for the
year and she had time to think about things, I gave her all my old
linguistics books. The other day for some reason I mentioned to her
that I had known people who were engaged in formal research on the
problem of how to get a computer to know what a pronoun referred to,
and that this is very difficult.</p>
<p>(I once had a co-worker who claimed that it was simple: the pronoun
always refers back to the nearest noun. It wasn't hard to go back in
his Slack history and find a counterexample he had uttered a few
minutes before.)</p>
<p>Today I wanted to tell Katara about
<a href="https://en.wikipedia.org/wiki/Dummy_pronoun">dummy pronouns</a>, which
refer to nothing at all. I intended to send her the example from
Wiktionary:</p>
<blockquote>
<p>it is good to know that you are okay</p>
</blockquote>
<p>I started my message:</p>
<blockquote>
<p>Here's an interesting example of how hard it can be to find what a
pronoun refers to</p>
</blockquote>
<p>Then I realized I no longer needed the example.</p>
Duckface in German
https://blog.plover.com/2021/07/05#duckface
<p>In English, this is called <a href="https://en.wikipedia.org/wiki/duckface"><em>duckface</em></a>:</p>
<p><img src="https://pic.blog.plover.com/lang/etym/duckface/duckface.jpg" alt="Ariana Grande looking over her
shoulder with her lips abnormally everted" class="center" /></p>
<p>In German, I've learned, it's <em>Schlauchbootlippen</em>.</p>
<p><em>Schlauch</em> is “tube”. A <em>Schlauchboot</em> is a tube-boat — an inflatable
rubber dingy. <em>Schlauchbootlippen</em> means dinghy-lips.</p>
Dogs that look like board games
https://blog.plover.com/2021/06/27#badugi
<p>In Korean, “바둑이” (/badugi/) is a common name for a spotted dog,
especially a black-spotted dog. This is because “바둑” (/baduk/) is
the native Korean name for the game of <a href="https://en.wikipedia.org/wiki/Go_%28game%29">go</a>, in which
round black and white stones are placed on a board.</p>
<p>In English, black-and-white spotted dogs are sometimes named
<a href="https://en.wikipedia.org/wiki/Checkers_speech">“Checkers”</a> for essentially the same reason.</p>
Odd translation choices
https://blog.plover.com/2021/04/19#beep-beep
<p>Recently I've been complaining about unforced translation
errors.
([<a href="https://blog.plover.com/book/pie-muncher.html">1</a>]
[<a href="https://blog.plover.com/lang/broth-guzzler.html">2</a>])
<a href="https://chestervelt.tumblr.com/post/180032418365/translate-this-meme-for-me-please">Here's one I saw today</a>:</p>
<p><img class="center" border=0 src="https://pic.blog.plover.com/lang/beep-beep/beep-beep.jpg" alt="A
picture of two cows in a field. One has a child-sized toy plastic car
on its head. The cow with the car on its head is saying: “БИП-БИП ВАШ
УБЕР ПРИБЫЛ" The other cow replies: “Что за херня, Олег?” /></p>
<p>The translation was given as:</p>
<blockquote>
<p>“honk honk, your Uber has arrived”</p>
<p>“Oleg, what the fuck”</p>
</blockquote>
<p>Now, the Russian text clearly says “beep-beep” (“бип-бип”), not “honk
honk”. I could understand translating this as "honk honk" if "beep
beep" were not a standard car sound in English. But English-speaking
cars <em>do</em> say “beep beep”, so why change the original?</p>
<p>(Also, a much smaller point: I have no objection to translating “Что
за херня” as “what the fuck”. But why translate “Что за херня, Олег?”
as “Oleg, what the fuck” instead of “What the fuck, Oleg”?)</p>
<p>[ Addendum 20210420: Katara suggested that perhaps the original translator
was simply unaware that Anglophone cars also “beep beep”. ]</p>
More soup-guzzling
https://blog.plover.com/2021/04/14#broth-guzzler
<p>A couple of days ago
<a href="https://blog.plover.com/book/pie-muncher.html">I discussed the epithet “soup-guzzling pie-muncher”</a>,
which in the original Medieval Italian was <em>brodaiuolo manicator di
torte</em>. I had compained that where most translations rendered the
delightful word <em>brodaiuolo</em> as something like “soup-guzzler” or
“broth-swiller”, Richard Aldington used the much less vivid “glutton”.</p>
<p>A form of the word <em>brodaiuolo</em> appears in one other place in the <em>Decameron</em>, in
<a href="https://www.brown.edu/Departments/Italian_Studies/dweb/texts/DecShowText.php?myID=nov0106&expand=&lang=eng&highlight=020#020">the sixth story on the first day</a>,
also told by Emilia, who as you remember has nothing good to say about
the clergy:</p>
<blockquote>
<p>… lo 'nquisitore sentendo trafiggere la lor <strong>brodaiuola</strong> ipocrisia
tutto si turbò…</p>
</blockquote>
<p>J. M. Rigg (1903), who had elsewhere translated <em>brodaiuolo</em> as
“broth-guzzling”, this time went with “gluttony”:</p>
<blockquote>
<p>…the inquisitor, feeling that their gluttony and hypocrisy had
received a home-thrust…</p>
</blockquote>
<p>G. H. McWilliam (1972) does at least imply the broth:</p>
<blockquote>
<p>…the inquisitor himself, on hearing their guzzling hypocrisy exposed…</p>
</blockquote>
<p>John Payne (1886):</p>
<blockquote>
<p>the latter, feeling the hit at the broth-swilling hypocrisy of
himself and his brethren…</p>
</blockquote>
<p>Cormac Ó Cuilleanáin's revision of Payne (2004):</p>
<blockquote>
<p>…the inquisitor himself, feeling that the broth-swilling hypocrisy
of himself and his brethren had been punctured…</p>
</blockquote>
<p>And what about Aldington (1930), who dropped the ball the other time and
rendered <em>brodaiuolo</em> merely as “glutton”? Here he says:</p>
<blockquote>
<p>… he felt it was a stab at their thick-soup hypocrisy…</p>
</blockquote>
<p>Oh, Richard.</p>
<p>I think you should have tried harder.</p>