<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Mathematics on Programmer.ie: Modern AI programming</title>
		<link>http://programmer.ie/tags/mathematics/</link>
		<description>Recent content in Mathematics on Programmer.ie: Modern AI programming</description>
		<generator>Hugo</generator>
		<language>en-US</language>
		
		
		
		
			<lastBuildDate>Sat, 21 Nov 2026 10:00:00 +0000</lastBuildDate>
		
			<atom:link href="http://programmer.ie/tags/mathematics/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Eight Investigations</title>
				<link>http://programmer.ie/books/math/01-chapter/</link>
				<pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/books/math/01-chapter/</guid>
				<description>&lt;p&gt;This book begins with eight investigations. Each one is a single&#xA;mathematical question with a definite answer, and each one comes with a check&#xA;you can run.&lt;/p&gt;&#xA;&lt;p&gt;Some of the answers are famous: a prime-number conjecture refuted by one&#xA;multiplication, a proof of the four colour theorem that stood for eleven years&#xA;before a small map broke it. Some are recent: a 2024 preprint that claims to&#xA;find a contradiction in special relativity, and an AI-assisted formalization&#xA;of an olympiad problem whose main theorem turns out to be unproved. And two&#xA;are about &lt;em&gt;us&lt;/em&gt;: a chapter on how our own software credited a proof to the&#xA;wrong theorem, and a recurring discipline of saying exactly what each check&#xA;did and did not establish.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Refute Fermat&#39;s prime formula with one division</title>
				<link>http://programmer.ie/examples/math/02-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/02-chapter/</guid>
				<description>&lt;p&gt;Fermat believed every number of the form 2^(2^n) + 1 is prime. The first five&#xA;are, and he stopped there. The chapter&amp;rsquo;s claim is that a universal statement&#xA;needs only one counterexample, and that five confirming cases add nothing&#xA;beyond themselves. This program finds the counterexample Euler reported in&#xA;1732: the sixth number is divisible by 641.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;fermat.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Check the cosine-sum identity behind Abel&#39;s counterexample</title>
				<link>http://programmer.ie/examples/math/03-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/03-chapter/</guid>
				<description>&lt;p&gt;Cauchy&amp;rsquo;s 1821 textbook claimed that a convergent sum of continuous functions is&#xA;continuous; Abel&amp;rsquo;s 1826 counterexample is a series of sines whose sum jumps.&#xA;The classical proof of Abel&amp;rsquo;s example begins with a finite identity:&lt;/p&gt;&#xA;&lt;p&gt;cos t + cos 2t + … + cos Nt = sin((N + 1/2) t) / (2 sin(t/2)) − 1/2, whenever sin(t/2) ≠ 0.&lt;/p&gt;&#xA;&lt;p&gt;This program checks that first step numerically across a grid of N and t.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Find where Haraux&#39;s two collision times start</title>
				<link>http://programmer.ie/examples/math/04-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/04-chapter/</guid>
				<description>&lt;p&gt;A 2024 paper by A. Haraux derives two collision times for one scenario,&#xA;D/(c + v) and D/c, and argues that their difference is a contradiction in the&#xA;mathematics of special relativity. Two numbers that differ contradict each&#xA;other only if they answer the same question. This program computes the events&#xA;exactly, at v = 3/5 c, and asks where each time starts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;haraux_events.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Catch a correct proof of the wrong theorem</title>
				<link>http://programmer.ie/examples/math/05-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/05-chapter/</guid>
				<description>&lt;p&gt;A proof assistant checks that a declaration proves &lt;em&gt;its own&lt;/em&gt; statement. If a&#xA;tool then credits that declaration with a claim by its name alone, a proof of&#xA;something else can be reported as a proof of the claim. This file declares&#xA;&lt;code&gt;zero_add_left&lt;/code&gt; four times: the claim, the claim proved differently, &lt;code&gt;True&lt;/code&gt;,&#xA;and a weakened version. Lean accepts all four, correctly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;wrong_theorem.lean&lt;/code&gt; and run &lt;code&gt;lean wrong_theorem.lean&lt;/code&gt; with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at &lt;a href=&#34;https://live.lean-lang.org/&#34;&gt;live.lean-lang.org&lt;/a&gt;&#xA;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Read what the kernel certified about an AI proof</title>
				<link>http://programmer.ie/examples/math/06-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/06-chapter/</guid>
				<description>&lt;p&gt;A 2026 paper (Lau, arXiv:2605.20120v1) attaches a Lean artifact on IMO 2009&#xA;Problem 6, the grasshopper problem. The question is not whether the paper is&#xA;convincing but what Lean&amp;rsquo;s kernel certified, declaration by declaration. The&#xA;audit compiled five variants of the artifact; this program takes what&#xA;&lt;code&gt;#print axioms&lt;/code&gt; reported for each and re-derives the findings.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;grasshopper_axioms.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Break Kempe&#39;s four-colour step on Heawood&#39;s map</title>
				<link>http://programmer.ie/examples/math/07-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/07-chapter/</guid>
				<description>&lt;p&gt;Kempe&amp;rsquo;s 1879 proof of the four-colour theorem was accepted for eleven years,&#xA;until Heawood published a map on which one step fails: two Kempe-chain swaps&#xA;made together. The map here is the project&amp;rsquo;s transcription of Heawood&amp;rsquo;s&#xA;Fig. 18, 25 regions and 69 shared boundaries. The program checks each step of&#xA;Heawood&amp;rsquo;s account by exhaustive search.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;kempe_heawood.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>See Simpson&#39;s paradox in two published tables, exactly</title>
				<link>http://programmer.ie/examples/math/08-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/08-chapter/</guid>
				<description>&lt;p&gt;Can one treatment be better in every group and not better overall? This&#xA;program takes two published tables, Simpson&amp;rsquo;s own 1951 example and the&#xA;kidney-stone comparison of Charig et al. (1986), and compares every rate as an&#xA;exact fraction, so nothing depends on rounding.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;simpson.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Simpson&amp;#39;s paradox in two published tables, compared exactly as fractions.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Simpson (1951), Table 4: alive / total, untreated vs treated.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Charig et al. (1986), Tables I and II: success / total, percutaneous (B) vs all open&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;procedures (A); &amp;#39;small&amp;#39; is mean stone diameter under 2 cm, &amp;#39;large&amp;#39; is 2 cm or more,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;or multiple stones. Standard library only: no floating point, nothing rounded.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; fractions &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Fraction &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; F&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TABLES &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simpson 1951&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;untreated&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;treated&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                     {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;men&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;untreated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;treated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;13&lt;/span&gt;)},&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                      &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;women&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;untreated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;treated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;27&lt;/span&gt;)}}),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;kidney stones&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;B&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;A&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                      {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;small&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;B&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;234&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;270&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;A&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;81&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;87&lt;/span&gt;)},&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                       &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;large&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;B&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;55&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;A&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;192&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;263&lt;/span&gt;)}}),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;analyse&lt;/span&gt;(lo, hi, groups):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; g, c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; groups&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;items():&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;g&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;6&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;lo&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;F(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;c[lo])&lt;span style=&#34;color:#e6db74&#34;&gt;!s:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;gt;7&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;hi&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;F(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;c[hi])&lt;span style=&#34;color:#e6db74&#34;&gt;!s:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;gt;7&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;hi&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; better? &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;F(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;c[hi]) &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; F(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;c[lo])&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    total &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {arm: F(sum(c[arm][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; groups&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;values()), sum(c[arm][&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;] &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; groups&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;values()))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;             &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; arm &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (lo, hi)}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    pattern &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;equal&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; total[hi] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; total[lo] &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;reversed&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; total[hi] &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; total[lo] &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;same way&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;all&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;6&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;lo&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;total[lo]&lt;span style=&#34;color:#e6db74&#34;&gt;!s:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;gt;7&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;hi&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;total[hi]&lt;span style=&#34;color:#e6db74&#34;&gt;!s:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;gt;7&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  combined: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;pattern&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; pattern&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; name, (lo, hi, groups) &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; TABLES&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;items():&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(name)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    analyse(lo, hi, groups)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Failure control: one changed cell (7 treated survivors instead of 8) breaks the pattern.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lo, hi, groups &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; TABLES[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simpson 1951&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;changed &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt;groups, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;men&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;untreated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;treated&amp;#34;&lt;/span&gt;: (&lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;13&lt;/span&gt;)}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;control: Simpson&amp;#39;s table with 7/13 instead of 8/13&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;analyse(lo, hi, changed)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Simpson&amp;#39;s paradox in two published tables, compared exactly as fractions.&#xA;&#xA;Simpson (1951), Table 4: alive / total, untreated vs treated.&#xA;Charig et al. (1986), Tables I and II: success / total, percutaneous (B) vs all open&#xA;procedures (A); &amp;#39;small&amp;#39; is mean stone diameter under 2 cm, &amp;#39;large&amp;#39; is 2 cm or more,&#xA;or multiple stones. Standard library only: no floating point, nothing rounded.&#xA;&amp;#34;&amp;#34;&amp;#34;&#xA;from fractions import Fraction as F&#xA;&#xA;TABLES = {&#xA;    &amp;#34;Simpson 1951&amp;#34;: (&amp;#34;untreated&amp;#34;, &amp;#34;treated&amp;#34;,&#xA;                     {&amp;#34;men&amp;#34;: {&amp;#34;untreated&amp;#34;: (4, 7), &amp;#34;treated&amp;#34;: (8, 13)},&#xA;                      &amp;#34;women&amp;#34;: {&amp;#34;untreated&amp;#34;: (2, 5), &amp;#34;treated&amp;#34;: (12, 27)}}),&#xA;    &amp;#34;kidney stones&amp;#34;: (&amp;#34;B&amp;#34;, &amp;#34;A&amp;#34;,&#xA;                      {&amp;#34;small&amp;#34;: {&amp;#34;B&amp;#34;: (234, 270), &amp;#34;A&amp;#34;: (81, 87)},&#xA;                       &amp;#34;large&amp;#34;: {&amp;#34;B&amp;#34;: (55, 80), &amp;#34;A&amp;#34;: (192, 263)}}),&#xA;}&#xA;&#xA;&#xA;def analyse(lo, hi, groups):&#xA;    for g, c in groups.items():&#xA;        print(f&amp;#34;  {g:6} {lo}: {F(*c[lo])!s:&amp;gt;7}  {hi}: {F(*c[hi])!s:&amp;gt;7}  {hi} better? {F(*c[hi]) &amp;gt; F(*c[lo])}&amp;#34;)&#xA;    total = {arm: F(sum(c[arm][0] for c in groups.values()), sum(c[arm][1] for c in groups.values()))&#xA;             for arm in (lo, hi)}&#xA;    pattern = &amp;#34;equal&amp;#34; if total[hi] == total[lo] else (&amp;#34;reversed&amp;#34; if total[hi] &amp;lt; total[lo] else &amp;#34;same way&amp;#34;)&#xA;    print(f&amp;#34;  {&amp;#39;all&amp;#39;:6} {lo}: {total[lo]!s:&amp;gt;7}  {hi}: {total[hi]!s:&amp;gt;7}  combined: {pattern}&amp;#34;)&#xA;    return pattern&#xA;&#xA;&#xA;for name, (lo, hi, groups) in TABLES.items():&#xA;    print(name)&#xA;    analyse(lo, hi, groups)&#xA;    print()&#xA;&#xA;# Failure control: one changed cell (7 treated survivors instead of 8) breaks the pattern.&#xA;lo, hi, groups = TABLES[&amp;#34;Simpson 1951&amp;#34;]&#xA;changed = {**groups, &amp;#34;men&amp;#34;: {&amp;#34;untreated&amp;#34;: (4, 7), &amp;#34;treated&amp;#34;: (7, 13)}}&#xA;print(&amp;#34;control: Simpson&amp;#39;s table with 7/13 instead of 8/13&amp;#34;)&#xA;analyse(lo, hi, changed)&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;h2 id=&#34;expected-outcome&#34;&gt;Expected outcome&lt;/h2&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Simpson 1951&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  men    untreated:     4/7  treated:    8/13  treated better? True&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  women  untreated:     2/5  treated:     4/9  treated better? True&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  all    untreated:     1/2  treated:     1/2  combined: equal&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kidney stones&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  small  B:   13/15  A:   27/29  A better? True&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  large  B:   11/16  A: 192/263  A better? True&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  all    B: 289/350  A:   39/50  combined: reversed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;control: Simpson&amp;#39;s table with 7/13 instead of 8/13&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  men    untreated:     4/7  treated:    7/13  treated better? False&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  women  untreated:     2/5  treated:     4/9  treated better? True&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  all    untreated:     1/2  treated:   19/40  combined: reversed&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;Simpson 1951&#xA;  men    untreated:     4/7  treated:    8/13  treated better? True&#xA;  women  untreated:     2/5  treated:     4/9  treated better? True&#xA;  all    untreated:     1/2  treated:     1/2  combined: equal&#xA;&#xA;kidney stones&#xA;  small  B:   13/15  A:   27/29  A better? True&#xA;  large  B:   11/16  A: 192/263  A better? True&#xA;  all    B: 289/350  A:   39/50  combined: reversed&#xA;&#xA;control: Simpson&amp;#39;s table with 7/13 instead of 8/13&#xA;  men    untreated:     4/7  treated:    7/13  treated better? False&#xA;  women  untreated:     2/5  treated:     4/9  treated better? True&#xA;  all    untreated:     1/2  treated:   19/40  combined: reversed&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;In both tables the second arm wins in every group. Combined, Simpson&amp;rsquo;s&#xA;association &lt;em&gt;vanishes&lt;/em&gt; (both rates are 1/2), despite its common description as&#xA;a reversal, while the kidney-stone table reverses. Changing one cell, as in the&#xA;control, destroys the pattern. These are arithmetic facts about published&#xA;counts; they say nothing about cause, significance or which table a decision&#xA;should use.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Measure Gabriel&#39;s horn: finite volume, unbounded area</title>
				<link>http://programmer.ie/examples/math/09-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/09-chapter/</guid>
				<description>&lt;p&gt;Rotate y = 1/x, for x ≥ 1, about the x-axis. The solid is infinitely long, yet&#xA;its volume is finite, while its surface area is infinite. This program&#xA;integrates both up to b = 10, 100, …, 10^6 and compares them with their exact&#xA;forms, π(1 − 1/b) and the lower bound 2π ln b.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;gabriels_horn.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Adversarial Mathematics: From First Principles</title>
				<link>http://programmer.ie/books/math/</link>
				<pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/books/math/</guid>
				<description>&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;A mathematical answer is only as trustworthy as the claim being tested, the assumptions behind it, and the evidence supporting it.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;AI can generate mathematical arguments, construct proofs, identify patterns, and propose solutions. Proof-generating agents can also search for missing steps, run proof assistants, and revise rejected attempts. But a convincing explanation is not necessarily a correct proof, and a formally verified theorem may not establish what its author intended. The same distinction applies when an agent generates thousands of proof steps: the checked theorem and its assumptions still have to match the claim under investigation.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Refute a &#39;for all&#39; claim with one exact witness</title>
				<link>http://programmer.ie/examples/math/10-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/10-chapter/</guid>
				<description>&lt;p&gt;The chapter&amp;rsquo;s claim is that a universal statement is refuted by one valid&#xA;witness, and that passing tests are weak evidence because the inputs people&#xA;try first are often degenerate. The claim under test is that the shear&#xA;t′ = t, x′ = x + vt preserves t² − x². This program tries the convenient&#xA;inputs, then a grid, then the residual itself, all in exact arithmetic.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;quantifiers.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Delete a hypothesis and watch the theorem break</title>
				<link>http://programmer.ie/examples/math/11-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/11-chapter/</guid>
				<description>&lt;p&gt;The quickest way to see what a hypothesis does is to delete it. This program&#xA;deletes the right angle from Pythagoras&amp;rsquo; theorem and the condition |v| &amp;lt; 1 from&#xA;γ = 1/√(1 − v²), then tests the four repairs the chapter discusses: narrowing&#xA;the hypotheses, correcting the conclusion, a vacuous hypothesis, and a patch&#xA;that only excludes the known counterexample.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;assumptions.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Take two limits in both orders and get two answers</title>
				<link>http://programmer.ie/examples/math/12-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/12-chapter/</guid>
				<description>&lt;p&gt;The chapter&amp;rsquo;s smallest example is xⁿ on [0, 1]: taking the limit in n first&#xA;and then x → 1 gives 0; the other order gives 1. This program shows the two&#xA;orders, measures how slowly the convergence happens near x = 1, and sums Abel&amp;rsquo;s&#xA;series near its jump.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;limits.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>See where floating point and high precision mislead</title>
				<link>http://programmer.ie/examples/math/13-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/13-chapter/</guid>
				<description>&lt;p&gt;Ordinary computer arithmetic rounds, and higher precision only rounds later.&#xA;This program shows three places where that changes an answer: 0.1 + 0.2, the&#xA;parity of the Fermat number F₆ = 2⁶⁴ + 1 once it has been converted to a&#xA;float, and e^(π√163), which looks like an integer until 40 digits. It ends&#xA;with the arithmetic behind Simpson&amp;rsquo;s paradox: a combined rate is a weighted&#xA;average of the group rates.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Walk through the hard case of the five-colour proof</title>
				<link>http://programmer.ie/examples/math/14-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/14-chapter/</guid>
				<description>&lt;p&gt;Heawood&amp;rsquo;s five-colour proof removes a vertex of degree at most five, colours&#xA;the rest, and puts the vertex back. The only hard case is five neighbours&#xA;with five different colours. The icosahedron is planar with every degree five,&#xA;so the case can be built on purpose. This program builds it and then follows&#xA;the proof: try one Kempe chain, and if it fails, use the one planarity&#xA;guarantees.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;five_colours.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Read what a Lean statement actually says</title>
				<link>http://programmer.ie/examples/math/15-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/15-chapter/</guid>
				<description>&lt;p&gt;A formal statement&amp;rsquo;s symbols mean what the library says they mean, and&#xA;those are not always what a reader brings. This core-Lean file shows four&#xA;places where that matters: natural-number subtraction, division by zero, a&#xA;hypothesis that can never hold, and a theorem whose name says one thing and&#xA;whose statement says another.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;formal_propositions.lean&lt;/code&gt; and run &lt;code&gt;lean formal_propositions.lean&lt;/code&gt; with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at &lt;a href=&#34;https://live.lean-lang.org/&#34;&gt;live.lean-lang.org&lt;/a&gt;&#xA;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Trace what a proof rests on with #print axioms</title>
				<link>http://programmer.ie/examples/math/16-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/16-chapter/</guid>
				<description>&lt;p&gt;Trust flows along the dependency graph: a result is only as well established&#xA;as everything beneath it. This core-Lean file has one unproved lemma, one&#xA;careful proof built on it, one independent result, one use of classical&#xA;logic and one false claim, and asks Lean what each rests on.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;proof_rests_on.lean&lt;/code&gt; and run &lt;code&gt;lean proof_rests_on.lean&lt;/code&gt; with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at &lt;a href=&#34;https://live.lean-lang.org/&#34;&gt;live.lean-lang.org&lt;/a&gt;&#xA;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Make two clocks each run slow, without contradiction</title>
				<link>http://programmer.ie/examples/math/17-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/17-chapter/</guid>
				<description>&lt;p&gt;At v = 3/5 c, γ = 5/4 exactly, so every event can be computed with&#xA;fractions. This program reproduces the chapter&amp;rsquo;s two clocks: each frame finds&#xA;the other&amp;rsquo;s clock slow. It then checks what every frame agrees on, shows two&#xA;events simultaneous in one frame and not the other, and measures a moving rod.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;simultaneity.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Check that the interval survives every boost, exactly</title>
				<link>http://programmer.ie/examples/math/18-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/18-chapter/</guid>
				<description>&lt;p&gt;The interval t² − x² is the quantity every inertial frame agrees on. This&#xA;program boosts four events at speeds with rational γ (3/5, 5/13, −8/17), so&#xA;nothing is rounded, and checks the interval each time. It then shows the&#xA;light-cone scaling, which events can change order, and that two boosts compose&#xA;into one.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;lorentz.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Settle Gabriel&#39;s paint: one slogan, two kinds of paint</title>
				<link>http://programmer.ie/examples/math/19-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/19-chapter/</guid>
				<description>&lt;p&gt;The chapter separates three questions: is the mathematics true under its&#xA;assumptions, does it describe what we meant, and what supports that&#xA;correspondence? &amp;ldquo;You can fill Gabriel&amp;rsquo;s horn but not paint it&amp;rdquo; mixes them. This&#xA;program puts numbers on each part of the slogan.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;gabriels_paint.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Mathematics and the world: Gabriel&amp;#39;s horn and the paint (standard library only).&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Horn: radius 1/x for x &amp;gt;= 1, rotated about the x-axis. Lengths in metres.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; math&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MOLECULE &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1e-9&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# a generous size for a paint molecule: 1 nanometre&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1. True under its assumptions: the two integrals (exact forms)&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; b &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e3&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e6&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e9&lt;/span&gt;):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  up to x = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;b&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;8.0e&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; volume pi(1 - 1/b) = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pi &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; b)&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;.9f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;   area &amp;gt; 2 pi ln b = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pi &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;log(b)&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;8.2f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;2. Painting the outside with a coat of fixed thickness d needs at least d * area:&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; d &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1e-3&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e-6&lt;/span&gt;):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; b &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1e3&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e9&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1e100&lt;/span&gt;):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  d = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;d&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;g&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; m, up to x = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;b&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;6.0e&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;: paint &amp;gt; &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;d &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pi &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;log(b)&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;.3e&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; m^3&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  As b grows without bound, so does the paint: any fixed thickness needs infinite paint.&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;3. &amp;#39;Filling it&amp;#39; coats the inside with paint whose thickness is the radius 1/x:&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;x_mol &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; MOLECULE&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  the tube is narrower than a molecule beyond x = &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;x_mol&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;.0e&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; m&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  real paint fills at most the volume up to there: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;math&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pi &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; x_mol)&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;.9f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; m^3 (&amp;lt; pi)&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  and cannot reach the rest of the horn, which is infinitely long.&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;4. Mathematical paint: a coat of thickness 1/x over the whole horn has volume pi, finite;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;   a coat of any fixed thickness has infinite volume. No contradiction: the slogan&amp;#39;s&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;   &amp;#39;paint&amp;#39; meant two different things.&amp;#34;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Mathematics and the world: Gabriel&amp;#39;s horn and the paint (standard library only).&#xA;&#xA;Horn: radius 1/x for x &amp;gt;= 1, rotated about the x-axis. Lengths in metres.&#xA;&amp;#34;&amp;#34;&amp;#34;&#xA;import math&#xA;&#xA;MOLECULE = 1e-9   # a generous size for a paint molecule: 1 nanometre&#xA;&#xA;print(&amp;#34;1. True under its assumptions: the two integrals (exact forms)&amp;#34;)&#xA;for b in (10, 1e3, 1e6, 1e9):&#xA;    print(f&amp;#34;  up to x = {b:&amp;lt;8.0e} volume pi(1 - 1/b) = {math.pi * (1 - 1 / b):.9f}   area &amp;gt; 2 pi ln b = {2 * math.pi * math.log(b):8.2f}&amp;#34;)&#xA;&#xA;print(&amp;#34;\n2. Painting the outside with a coat of fixed thickness d needs at least d * area:&amp;#34;)&#xA;for d in (1e-3, 1e-6):&#xA;    for b in (1e3, 1e9, 1e100):&#xA;        print(f&amp;#34;  d = {d:g} m, up to x = {b:&amp;lt;6.0e}: paint &amp;gt; {d * 2 * math.pi * math.log(b):.3e} m^3&amp;#34;)&#xA;print(&amp;#34;  As b grows without bound, so does the paint: any fixed thickness needs infinite paint.&amp;#34;)&#xA;&#xA;print(&amp;#34;\n3. &amp;#39;Filling it&amp;#39; coats the inside with paint whose thickness is the radius 1/x:&amp;#34;)&#xA;x_mol = 1 / MOLECULE&#xA;print(f&amp;#34;  the tube is narrower than a molecule beyond x = {x_mol:.0e} m&amp;#34;)&#xA;print(f&amp;#34;  real paint fills at most the volume up to there: {math.pi * (1 - 1 / x_mol):.9f} m^3 (&amp;lt; pi)&amp;#34;)&#xA;print(&amp;#34;  and cannot reach the rest of the horn, which is infinitely long.&amp;#34;)&#xA;&#xA;print(&amp;#34;\n4. Mathematical paint: a coat of thickness 1/x over the whole horn has volume pi, finite;&amp;#34;)&#xA;print(&amp;#34;   a coat of any fixed thickness has infinite volume. No contradiction: the slogan&amp;#39;s&amp;#34;)&#xA;print(&amp;#34;   &amp;#39;paint&amp;#39; meant two different things.&amp;#34;)&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;h2 id=&#34;expected-outcome&#34;&gt;Expected outcome&lt;/h2&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1. True under its assumptions: the two integrals (exact forms)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  up to x = 1e+01    volume pi(1 - 1/b) = 2.827433388   area &amp;gt; 2 pi ln b =    14.47&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  up to x = 1e+03    volume pi(1 - 1/b) = 3.138451061   area &amp;gt; 2 pi ln b =    43.40&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  up to x = 1e+06    volume pi(1 - 1/b) = 3.141589512   area &amp;gt; 2 pi ln b =    86.81&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  up to x = 1e+09    volume pi(1 - 1/b) = 3.141592650   area &amp;gt; 2 pi ln b =   130.21&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2. Painting the outside with a coat of fixed thickness d needs at least d * area:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 0.001 m, up to x = 1e+03 : paint &amp;gt; 4.340e-02 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 0.001 m, up to x = 1e+09 : paint &amp;gt; 1.302e-01 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 0.001 m, up to x = 1e+100: paint &amp;gt; 1.447e+00 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 1e-06 m, up to x = 1e+03 : paint &amp;gt; 4.340e-05 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 1e-06 m, up to x = 1e+09 : paint &amp;gt; 1.302e-04 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  d = 1e-06 m, up to x = 1e+100: paint &amp;gt; 1.447e-03 m^3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  As b grows without bound, so does the paint: any fixed thickness needs infinite paint.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3. &amp;#39;Filling it&amp;#39; coats the inside with paint whose thickness is the radius 1/x:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  the tube is narrower than a molecule beyond x = 1e+09 m&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  real paint fills at most the volume up to there: 3.141592650 m^3 (&amp;lt; pi)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  and cannot reach the rest of the horn, which is infinitely long.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;4. Mathematical paint: a coat of thickness 1/x over the whole horn has volume pi, finite;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   a coat of any fixed thickness has infinite volume. No contradiction: the slogan&amp;#39;s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &amp;#39;paint&amp;#39; meant two different things.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;1. True under its assumptions: the two integrals (exact forms)&#xA;  up to x = 1e&amp;#43;01    volume pi(1 - 1/b) = 2.827433388   area &amp;gt; 2 pi ln b =    14.47&#xA;  up to x = 1e&amp;#43;03    volume pi(1 - 1/b) = 3.138451061   area &amp;gt; 2 pi ln b =    43.40&#xA;  up to x = 1e&amp;#43;06    volume pi(1 - 1/b) = 3.141589512   area &amp;gt; 2 pi ln b =    86.81&#xA;  up to x = 1e&amp;#43;09    volume pi(1 - 1/b) = 3.141592650   area &amp;gt; 2 pi ln b =   130.21&#xA;&#xA;2. Painting the outside with a coat of fixed thickness d needs at least d * area:&#xA;  d = 0.001 m, up to x = 1e&amp;#43;03 : paint &amp;gt; 4.340e-02 m^3&#xA;  d = 0.001 m, up to x = 1e&amp;#43;09 : paint &amp;gt; 1.302e-01 m^3&#xA;  d = 0.001 m, up to x = 1e&amp;#43;100: paint &amp;gt; 1.447e&amp;#43;00 m^3&#xA;  d = 1e-06 m, up to x = 1e&amp;#43;03 : paint &amp;gt; 4.340e-05 m^3&#xA;  d = 1e-06 m, up to x = 1e&amp;#43;09 : paint &amp;gt; 1.302e-04 m^3&#xA;  d = 1e-06 m, up to x = 1e&amp;#43;100: paint &amp;gt; 1.447e-03 m^3&#xA;  As b grows without bound, so does the paint: any fixed thickness needs infinite paint.&#xA;&#xA;3. &amp;#39;Filling it&amp;#39; coats the inside with paint whose thickness is the radius 1/x:&#xA;  the tube is narrower than a molecule beyond x = 1e&amp;#43;09 m&#xA;  real paint fills at most the volume up to there: 3.141592650 m^3 (&amp;lt; pi)&#xA;  and cannot reach the rest of the horn, which is infinitely long.&#xA;&#xA;4. Mathematical paint: a coat of thickness 1/x over the whole horn has volume pi, finite;&#xA;   a coat of any fixed thickness has infinite volume. No contradiction: the slogan&amp;#39;s&#xA;   &amp;#39;paint&amp;#39; meant two different things.&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;The volume integral settles on π and the area grows without bound: that is&#xA;the mathematics. A coat of any fixed thickness needs at least thickness ×&#xA;area, which has no bound. &amp;ldquo;Filling&amp;rdquo; coats the inside with paint whose&#xA;thickness is the radius 1/x, which shrinks below a molecule at x = 10⁹ m.&#xA;With mathematical paint both halves hold; with real paint both fail. The&#xA;paradox is in the slogan, not the integrals.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Pin a claim by hash and watch an approval lapse</title>
				<link>http://programmer.ie/examples/math/20-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/20-chapter/</guid>
				<description>&lt;p&gt;Every investigation starts with a claim contract, &lt;code&gt;investigation.json&lt;/code&gt;, which&#xA;fixes the statements, checks and controls before anything runs. Every run&#xA;records the sha256 of the contract&amp;rsquo;s bytes, and every approval names the hash&#xA;it approves. This program builds a cut-down contract in the same shape and&#xA;shows what the hash does and does not protect.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;claim_contract.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Run an investigation in miniature, from contract to record</title>
				<link>http://programmer.ie/examples/math/21-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/21-chapter/</guid>
				<description>&lt;p&gt;&lt;code&gt;math-engine proof &amp;lt;name&amp;gt;&lt;/code&gt; reads a contract, runs its checks and controls,&#xA;decides a status and writes a record. This program does the same in&#xA;miniature with the standard library: one exact computation, one control that&#xA;must be rejected, the status rules, and a record with a manifest.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;mini_run.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Running an investigation, in miniature: contract -&amp;gt; checks -&amp;gt; controls -&amp;gt; status -&amp;gt; record.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;A standard-library model of what `math-engine proof &amp;lt;name&amp;gt;` does, for one computation&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;check. The real runner adds kernels, binding, pinned images and many more checks.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; hashlib&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; pathlib&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; tempfile&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;compute&lt;/span&gt;(divisor):                       &lt;span style=&#34;color:#75715e&#34;&gt;# the check: exact integer arithmetic&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    f5 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;refuted&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; f5 &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; divisor &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; divisor &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; f5 &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;not refuted&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;contract &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MINI-01&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;check&amp;#34;&lt;/span&gt;: {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;divisor&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;641&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;expect&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;refuted&amp;#34;&lt;/span&gt;},&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;controls&amp;#34;&lt;/span&gt;: [{&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wrong-divisor&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;divisor&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;643&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;expect&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;not refuted&amp;#34;&lt;/span&gt;}],&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;evidence_kind&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;computation&amp;#34;&lt;/span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;checks &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [{&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;compute&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;observed&amp;#34;&lt;/span&gt;: compute(contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;check&amp;#34;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;divisor&amp;#34;&lt;/span&gt;])}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;checks[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;status&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;passed&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; checks[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;observed&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;check&amp;#34;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;expect&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;failed&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;controls &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [{&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;observed&amp;#34;&lt;/span&gt;: compute(c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;divisor&amp;#34;&lt;/span&gt;])} &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;controls&amp;#34;&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c, spec &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; zip(controls, contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;controls&amp;#34;&lt;/span&gt;]):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;status&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;passed&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;observed&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; spec[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;expect&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;failed&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;status&lt;/span&gt;(checks, controls, all_systems, pinned, approvals, kind):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    prefix &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;kernel&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;kernel_checked&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;computation&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;computed&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;historical&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;historical_verified&amp;#34;&lt;/span&gt;}[kind]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; all(c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;status&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;passed&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; checks &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; controls):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;run_failed&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; all_systems:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partial_run&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; pinned:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;checked_unpinned&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;prefix&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;_correspondence_&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;approved&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; approvals &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;pending&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; c &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; checks &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; controls:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;14&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; observed &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;observed&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;!r:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;15&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;c[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; pinned &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;False&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;pinned toolchain &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;pinned&lt;span style=&#34;color:#e6db74&#34;&gt;!s:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; -&amp;gt; &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;status(checks, controls, &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, pinned, [], contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;evidence_kind&amp;#39;&lt;/span&gt;])&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;with&lt;/span&gt; tempfile&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;TemporaryDirectory() &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; d:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    out &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pathlib&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Path(d)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    result &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;investigation&amp;#34;&lt;/span&gt;: contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;checks&amp;#34;&lt;/span&gt;: checks, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;controls&amp;#34;&lt;/span&gt;: controls,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;status&amp;#34;&lt;/span&gt;: status(checks, controls, &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;, [], contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;evidence_kind&amp;#34;&lt;/span&gt;])}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (out &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;result.json&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;write_text(json&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;dumps(result, indent&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, newline&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (out &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;notebook.md&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;write_text(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;# &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;contract[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Status: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;result[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;status&amp;#39;&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, newline&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sums &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;join(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;hashlib&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;sha256(p&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;read_bytes())&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;hexdigest()&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;p&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;name&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; p &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; sorted(out&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;iterdir()))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (out &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SHA256SUMS&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;write_text(sums, newline&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;the record:&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; line &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; sums&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;splitlines():&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;line[:&lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;…  &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;line&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;split(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;  &amp;#39;&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ok &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; all(hashlib&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;sha256((out &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; n)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;read_bytes())&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;hexdigest() &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; h&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;             &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; h, n &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (l&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;split(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;  &amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; l &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; (out &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SHA256SUMS&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;read_text()&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;splitlines()))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;checking the run later (--verify): evidence intact &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;{&lt;/span&gt;ok&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;&amp;#34;&amp;#34;&amp;#34;Running an investigation, in miniature: contract -&amp;gt; checks -&amp;gt; controls -&amp;gt; status -&amp;gt; record.&#xA;&#xA;A standard-library model of what `math-engine proof &amp;lt;name&amp;gt;` does, for one computation&#xA;check. The real runner adds kernels, binding, pinned images and many more checks.&#xA;&amp;#34;&amp;#34;&amp;#34;&#xA;import hashlib&#xA;import json&#xA;import pathlib&#xA;import tempfile&#xA;&#xA;&#xA;def compute(divisor):                       # the check: exact integer arithmetic&#xA;    f5 = 2 ** 32 &amp;#43; 1&#xA;    return &amp;#34;refuted&amp;#34; if f5 % divisor == 0 and 1 &amp;lt; divisor &amp;lt; f5 else &amp;#34;not refuted&amp;#34;&#xA;&#xA;&#xA;contract = {&amp;#34;id&amp;#34;: &amp;#34;MINI-01&amp;#34;, &amp;#34;check&amp;#34;: {&amp;#34;divisor&amp;#34;: 641, &amp;#34;expect&amp;#34;: &amp;#34;refuted&amp;#34;},&#xA;            &amp;#34;controls&amp;#34;: [{&amp;#34;id&amp;#34;: &amp;#34;wrong-divisor&amp;#34;, &amp;#34;divisor&amp;#34;: 643, &amp;#34;expect&amp;#34;: &amp;#34;not refuted&amp;#34;}],&#xA;            &amp;#34;evidence_kind&amp;#34;: &amp;#34;computation&amp;#34;}&#xA;&#xA;checks = [{&amp;#34;id&amp;#34;: &amp;#34;compute&amp;#34;, &amp;#34;observed&amp;#34;: compute(contract[&amp;#34;check&amp;#34;][&amp;#34;divisor&amp;#34;])}]&#xA;checks[0][&amp;#34;status&amp;#34;] = &amp;#34;passed&amp;#34; if checks[0][&amp;#34;observed&amp;#34;] == contract[&amp;#34;check&amp;#34;][&amp;#34;expect&amp;#34;] else &amp;#34;failed&amp;#34;&#xA;controls = [{&amp;#34;id&amp;#34;: c[&amp;#34;id&amp;#34;], &amp;#34;observed&amp;#34;: compute(c[&amp;#34;divisor&amp;#34;])} for c in contract[&amp;#34;controls&amp;#34;]]&#xA;for c, spec in zip(controls, contract[&amp;#34;controls&amp;#34;]):&#xA;    c[&amp;#34;status&amp;#34;] = &amp;#34;passed&amp;#34; if c[&amp;#34;observed&amp;#34;] == spec[&amp;#34;expect&amp;#34;] else &amp;#34;failed&amp;#34;&#xA;&#xA;&#xA;def status(checks, controls, all_systems, pinned, approvals, kind):&#xA;    prefix = {&amp;#34;kernel&amp;#34;: &amp;#34;kernel_checked&amp;#34;, &amp;#34;computation&amp;#34;: &amp;#34;computed&amp;#34;, &amp;#34;historical&amp;#34;: &amp;#34;historical_verified&amp;#34;}[kind]&#xA;    if not all(c[&amp;#34;status&amp;#34;] == &amp;#34;passed&amp;#34; for c in checks &amp;#43; controls):&#xA;        return &amp;#34;run_failed&amp;#34;&#xA;    if not all_systems:&#xA;        return &amp;#34;partial_run&amp;#34;&#xA;    if not pinned:&#xA;        return &amp;#34;checked_unpinned&amp;#34;&#xA;    return f&amp;#34;{prefix}_correspondence_{&amp;#39;approved&amp;#39; if approvals else &amp;#39;pending&amp;#39;}&amp;#34;&#xA;&#xA;&#xA;for c in checks &amp;#43; controls:&#xA;    print(f&amp;#34;{c[&amp;#39;id&amp;#39;]:14} observed {c[&amp;#39;observed&amp;#39;]!r:15} {c[&amp;#39;status&amp;#39;]}&amp;#34;)&#xA;print()&#xA;for pinned in (False, True):&#xA;    print(f&amp;#34;pinned toolchain {pinned!s:5} -&amp;gt; {status(checks, controls, True, pinned, [], contract[&amp;#39;evidence_kind&amp;#39;])}&amp;#34;)&#xA;&#xA;with tempfile.TemporaryDirectory() as d:&#xA;    out = pathlib.Path(d)&#xA;    result = {&amp;#34;investigation&amp;#34;: contract[&amp;#34;id&amp;#34;], &amp;#34;checks&amp;#34;: checks, &amp;#34;controls&amp;#34;: controls,&#xA;              &amp;#34;status&amp;#34;: status(checks, controls, True, True, [], contract[&amp;#34;evidence_kind&amp;#34;])}&#xA;    (out / &amp;#34;result.json&amp;#34;).write_text(json.dumps(result, indent=2) &amp;#43; &amp;#34;\n&amp;#34;, newline=&amp;#34;\n&amp;#34;)&#xA;    (out / &amp;#34;notebook.md&amp;#34;).write_text(f&amp;#34;# {contract[&amp;#39;id&amp;#39;]}\n\nStatus: {result[&amp;#39;status&amp;#39;]}\n&amp;#34;, newline=&amp;#34;\n&amp;#34;)&#xA;    sums = &amp;#34;&amp;#34;.join(f&amp;#34;{hashlib.sha256(p.read_bytes()).hexdigest()}  {p.name}\n&amp;#34; for p in sorted(out.iterdir()))&#xA;    (out / &amp;#34;SHA256SUMS&amp;#34;).write_text(sums, newline=&amp;#34;\n&amp;#34;)&#xA;    print(&amp;#34;\nthe record:&amp;#34;)&#xA;    for line in sums.splitlines():&#xA;        print(f&amp;#34;  {line[:16]}…  {line.split(&amp;#39;  &amp;#39;)[1]}&amp;#34;)&#xA;    ok = all(hashlib.sha256((out / n).read_bytes()).hexdigest() == h&#xA;             for h, n in (l.split(&amp;#34;  &amp;#34;) for l in (out / &amp;#34;SHA256SUMS&amp;#34;).read_text().splitlines()))&#xA;    print(f&amp;#34;checking the run later (--verify): evidence intact {ok}&amp;#34;)&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;h2 id=&#34;expected-outcome&#34;&gt;Expected outcome&lt;/h2&gt;&#xA;&lt;div class=&#34;bookkit-example-code&#34; data-example-code&gt;&#xA;  &lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;compute        observed &amp;#39;refuted&amp;#39;       passed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wrong-divisor  observed &amp;#39;not refuted&amp;#39;   passed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pinned toolchain False -&amp;gt; checked_unpinned&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pinned toolchain True  -&amp;gt; computed_correspondence_pending&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;the record:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  7d51e0fcf573cd5a…  notebook.md&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  ca6f10f39fe7ee3d…  result.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;checking the run later (--verify): evidence intact True&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;  &lt;textarea data-example-source hidden readonly aria-hidden=&#34;true&#34; aria-label=&#34;Code source&#34;&gt;compute        observed &amp;#39;refuted&amp;#39;       passed&#xA;wrong-divisor  observed &amp;#39;not refuted&amp;#39;   passed&#xA;&#xA;pinned toolchain False -&amp;gt; checked_unpinned&#xA;pinned toolchain True  -&amp;gt; computed_correspondence_pending&#xA;&#xA;the record:&#xA;  7d51e0fcf573cd5a…  notebook.md&#xA;  ca6f10f39fe7ee3d…  result.json&#xA;checking the run later (--verify): evidence intact True&lt;/textarea&gt;&#xA;  &lt;button type=&#34;button&#34; data-example-copy hidden&gt;Copy code&lt;/button&gt;&lt;span role=&#34;status&#34;&gt;&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;The check and the control both behave as the contract expects, but the&#xA;status depends on where the run happened: on unpinned tools it is only a&#xA;rehearsal (&lt;code&gt;checked_unpinned&lt;/code&gt;); on the pinned toolchain, with no approval yet,&#xA;it is &lt;code&gt;computed_correspondence_pending&lt;/code&gt;. The record&amp;rsquo;s manifest lets the run be&#xA;checked later without re-running it.&lt;/p&gt;</description>
			</item>
			<item>
				<title>See which &#39;same statement&#39; the kernel accepts</title>
				<link>http://programmer.ie/examples/math/22-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/22-chapter/</guid>
				<description>&lt;p&gt;There are at least five things &amp;ldquo;these two statements are the same&amp;rdquo; could&#xA;mean, from equal text to meaning the same thing. The laboratory&amp;rsquo;s binding&#xA;check asks Lean to accept a declaration as a proof of the pinned statement:&#xA;that checks definitional equality, and nothing weaker. This core-Lean file&#xA;shows where that line falls.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;statement_identity.lean&lt;/code&gt; and run &lt;code&gt;lean statement_identity.lean&lt;/code&gt; with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at &lt;a href=&#34;https://live.lean-lang.org/&#34;&gt;live.lean-lang.org&lt;/a&gt;&#xA;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Break Euler&#39;s factorization on purpose</title>
				<link>http://programmer.ie/examples/math/23-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/23-chapter/</guid>
				<description>&lt;p&gt;A check that has never rejected anything has not shown that it can. This&#xA;program runs the chapter&amp;rsquo;s experiment on a tiny checker: three mutations of&#xA;Euler&amp;rsquo;s factorization must each be rejected, at the line that was changed.&#xA;Then it shows how a control can reassure falsely: a checker that crashes still&#xA;&amp;ldquo;fails&amp;rdquo;, and a control that only expects failure passes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;failure_controls.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Apply the status rules to seven situations</title>
				<link>http://programmer.ie/examples/math/24-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/24-chapter/</guid>
				<description>&lt;p&gt;Two questions have different answerers: did the checks pass (the machine)&#xA;and does the formal statement say what the claim means (a person). The runner&#xA;decides a status by a fixed order of rules, and counts an approval only if it&#xA;is from a human role, approves, names the right correspondence and the exact&#xA;contract hash. This program applies those rules to seven situations.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;statuses.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Tamper with a record, then forge one that verifies</title>
				<link>http://programmer.ie/examples/math/25-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/25-chapter/</guid>
				<description>&lt;p&gt;A run leaves &lt;code&gt;result.json&lt;/code&gt;, a notebook and a &lt;code&gt;SHA256SUMS&lt;/code&gt; manifest, and&#xA;&lt;code&gt;math-engine proof --verify&lt;/code&gt; checks every file against it. This program builds&#xA;a record and tries four things: verify it fresh, edit the status by hand, drop&#xA;in an extra file, and forge the status while rewriting the manifest to match.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;records.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Audit a Lean file that compiles</title>
				<link>http://programmer.ie/examples/math/26-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/26-chapter/</guid>
				<description>&lt;p&gt;A file that compiles has shown less than it seems. The chapter&amp;rsquo;s audit asks:&#xA;what does it state, what does each declaration rest on, is it bound to the&#xA;claimed statement, and does the statement mean the claim? This core-Lean file&#xA;is the kind of thing that might arrive with a paper: it compiles, with an&#xA;axiom of its own and a gap.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;audit.lean&lt;/code&gt; and run &lt;code&gt;lean audit.lean&lt;/code&gt; with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at &lt;a href=&#34;https://live.lean-lang.org/&#34;&gt;live.lean-lang.org&lt;/a&gt;&#xA;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Put every AI proposal through an exact check</title>
				<link>http://programmer.ie/examples/math/27-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/27-chapter/</guid>
				<description>&lt;p&gt;In this book, AI proposed: statements, proofs, transcriptions, prose. Nothing&#xA;it produced counted until a check that could have rejected it agreed. This&#xA;program shows the rule with a fixed list of proposals standing in for an&#xA;assistant&amp;rsquo;s: confident and wrong, confident and right, and the same text&#xA;counted three times.&lt;/p&gt;&#xA;&lt;h2 id=&#34;run-it&#34;&gt;Run it&lt;/h2&gt;&#xA;&lt;p&gt;Save this as &lt;code&gt;proposer.py&lt;/code&gt; and run it with Python 3.11 or later. It uses the standard library only.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Build the ninth investigation: 6 divides n³ − n</title>
				<link>http://programmer.ie/examples/math/28-chapter/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>http://programmer.ie/examples/math/28-chapter/</guid>
				<description>&lt;p&gt;The ninth investigation is a tutorial: choose a claim and a tempting stronger&#xA;one, write the contract first, prove it, check it independently, plan how it&#xA;should fail. The claim is that 6 divides n³ − n for every natural number n;&#xA;the tempting generalization is that k divides nᵏ − n for every k ≥ 1. This is&#xA;its pinned core-Lean file, with a few reader checks added at the end.&lt;/p&gt;</description>
			</item>
			<item>
				<title>The New Math</title>
				<link>http://programmer.ie/post/math/</link>
				<pubDate>Sat, 21 Nov 2026 10:00:00 +0000</pubDate>
				<guid>http://programmer.ie/post/math/</guid>
				<description>&lt;p&gt;&lt;em&gt;Quality Perception: The Human Skill at the Centre of AI-Assisted Research&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you work with AI systems for long enough, you start to notice a rhythm.&lt;/p&gt;&#xA;&lt;p&gt;Most interactions are ordinary. The model does roughly what you asked. Some interactions are quietly worse than they look: an answer that is fluent but slightly off, a fix that passes the test by weakening the test, an explanation that has become longer without becoming clearer. And every so often, perhaps once in a few hundred exchanges, something exceptional happens. A connection appears that you didn&amp;rsquo;t ask for. A messy problem suddenly becomes simple. A result arrives that is better than anything you expected.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
