<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://invarians.org/index.php?action=history&amp;feed=atom&amp;title=Lean_theorem_prover%2FExplainers%2FStating_the_right_thing</id>
	<title>Lean theorem prover/Explainers/Stating the right thing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://invarians.org/index.php?action=history&amp;feed=atom&amp;title=Lean_theorem_prover%2FExplainers%2FStating_the_right_thing"/>
	<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/Explainers/Stating_the_right_thing&amp;action=history"/>
	<updated>2026-10-21T12:03:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://invarians.org/index.php?title=Lean_theorem_prover/Explainers/Stating_the_right_thing&amp;diff=6770&amp;oldid=prev</id>
		<title>PMA Publisher: Published from the Principia Machina source</title>
		<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/Explainers/Stating_the_right_thing&amp;diff=6770&amp;oldid=prev"/>
		<updated>2026-10-15T19:34:41Z</updated>

		<summary type="html">&lt;p&gt;Published from the Principia Machina source&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:34, 15 October 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE:Stating the right thing}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE:Stating the right thing}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Technical|Lean theorem prover/Foundations/Terms, types and judgments}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Technical|Lean theorem prover/Foundations/Terms, types and judgments}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Lean theorem prover map}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Lean checks that a proof proves the statement that was written. It cannot check that the&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Lean checks that a proof proves the statement that was written. It cannot check that the&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>PMA Publisher</name></author>
	</entry>
	<entry>
		<id>https://invarians.org/index.php?title=Lean_theorem_prover/Explainers/Stating_the_right_thing&amp;diff=6563&amp;oldid=prev</id>
		<title>PMA Publisher: Published from the Principia Machina source</title>
		<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/Explainers/Stating_the_right_thing&amp;diff=6563&amp;oldid=prev"/>
		<updated>2026-10-14T18:00:55Z</updated>

		<summary type="html">&lt;p&gt;Published from the Principia Machina source&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:Stating the right thing}}&lt;br /&gt;
{{Technical|Lean theorem prover/Foundations/Terms, types and judgments}}&lt;br /&gt;
&lt;br /&gt;
Lean checks that a proof proves the statement that was written. It cannot check that the&lt;br /&gt;
statement written is the one that was meant. This page shows, with lines Lean accepts, how the&lt;br /&gt;
two can come apart, gives a published case in which they did, and says what therefore has to be&lt;br /&gt;
read by people.&lt;br /&gt;
&lt;br /&gt;
== What the check covers ==&lt;br /&gt;
&lt;br /&gt;
Pollack divided the belief in a machine-checked proof into two questions: whether the proof is a&lt;br /&gt;
correct derivation, which a machine can settle, and whether the theorem means what is claimed,&lt;br /&gt;
which it cannot. For the second, nobody has to read the proof. What has to be read is the&lt;br /&gt;
statement, the assumptions left standing, and every definition the statement uses, and every&lt;br /&gt;
definition those use in turn.&amp;lt;ref name=&amp;quot;pollack&amp;quot;&amp;gt;R. Pollack, &amp;quot;How to believe a machine-checked proof&amp;quot;, in Giovanni Sambin and Jan M. Smith (eds), &amp;#039;&amp;#039;Twenty Five Years of Constructive Type Theory&amp;#039;&amp;#039;, Oxford University Press, 1998, chapter 11 (from p. 205); first issued as BRICS Report RS-97-18, Aarhus University, 1997. [https://doi.org/10.7146/brics.v4i18.18945 doi:10.7146/brics.v4i18.18945]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Lean&amp;#039;s own guide to validating proofs says the same of Lean: a statement and all the definitions it&lt;br /&gt;
refers to must be examined with care, especially where custom notation or type classes are&lt;br /&gt;
involved.&amp;lt;ref name=&amp;quot;refval&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039;, version for Lean 4.34.0, section &amp;quot;Validating a Lean Proof&amp;quot;. [https://lean-lang.org/doc/reference/4.34.0/ValidatingProofs/ lean-lang.org/doc/reference/4.34.0/ValidatingProofs], consulted 14 October 2026.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is usually a short text, even when the proof is long. It is also where much of the remaining&lt;br /&gt;
risk lies.&lt;br /&gt;
&lt;br /&gt;
== Numbers that are not quite school numbers ==&lt;br /&gt;
&lt;br /&gt;
In Lean every function gives an answer for every input. Subtraction of natural numbers (0, 1, 2,&lt;br /&gt;
...) therefore has to give some natural number when the result would be negative, and Lean gives&lt;br /&gt;
0. Division by zero also has to give something, and for natural numbers and integers Lean gives 0:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean&amp;quot; style=&amp;quot;background: #f8f9fa; border: 1px solid #c8ccd1; padding: 0.6em; margin: 0.3em 0; font-size: 0.85em; line-height: 1.35; overflow-x: auto; white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
#eval (3 - 5 : Nat)&lt;br /&gt;
#eval (7 / 0 : Nat)&lt;br /&gt;
#eval (7 / 0 : Int)&lt;br /&gt;
&lt;br /&gt;
example : (3 : Nat) - 5 = 0 := rfl&lt;br /&gt;
example : (7 : Nat) / 0 = 0 := rfl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean 4.34.1 prints &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; three times and accepts both examples.&lt;br /&gt;
&lt;br /&gt;
These are conventions, not contradictions. A FAQ on the subject puts it this way: such a division&lt;br /&gt;
is a function that agrees with ordinary division wherever the denominator is not zero, and its&lt;br /&gt;
value at zero is simply defined. The theorems that make division useful, such as that a number&lt;br /&gt;
divided by itself is 1, carry the hypothesis that the denominator is not zero, so an illegal&lt;br /&gt;
division still fails, at the point where one of those theorems is applied.&amp;lt;ref name=&amp;quot;xena&amp;quot;&amp;gt;The Xena Project (blog), &amp;quot;Division by zero in type theory: a FAQ&amp;quot;, 5 July 2020. [https://xenaproject.wordpress.com/2020/07/05/division-by-zero-in-type-theory-a-faq/ xenaproject.wordpress.com/2020/07/05/division-by-zero-in-type-theory-a-faq]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The convention matters when a statement is written. Someone who means &amp;quot;subtract, then add back&amp;quot;&lt;br /&gt;
may write this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean lean-fails&amp;quot; style=&amp;quot;background: #f8f9fa; border: 1px solid #c8ccd1; padding: 0.6em; margin: 0.3em 0; font-size: 0.85em; line-height: 1.35; overflow-x: auto; white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
theorem sub_then_add (a b : Nat) : a - b + b = a := by&lt;br /&gt;
  omega&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean refuses it, and the automation it was asked to use reports where the statement breaks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean-output&amp;quot; style=&amp;quot;background: #ffffff; border: 1px dashed #a2a9b1; padding: 0.6em; margin: 0.3em 0; font-size: 0.85em; line-height: 1.35; overflow-x: auto; white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
error: omega could not prove the goal:&lt;br /&gt;
a possible counterexample may satisfy the constraints&lt;br /&gt;
  d ≥ 0&lt;br /&gt;
  c ≥ 0&lt;br /&gt;
  c - d ≥ 1&lt;br /&gt;
where&lt;br /&gt;
 c := ↑b&lt;br /&gt;
 d := ↑a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is, whenever &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; is larger than &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;. Here the mistake announced itself.&lt;br /&gt;
The dangerous case is the reverse: a statement that is true only because of the convention, which&lt;br /&gt;
Lean accepts without comment.&lt;br /&gt;
&lt;br /&gt;
== Hypotheses that cannot all hold ==&lt;br /&gt;
&lt;br /&gt;
A theorem says that if its hypotheses hold, its conclusion does. If the hypotheses can never hold&lt;br /&gt;
together, the theorem is true and says nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean&amp;quot; style=&amp;quot;background: #f8f9fa; border: 1px solid #c8ccd1; padding: 0.6em; margin: 0.3em 0; font-size: 0.85em; line-height: 1.35; overflow-x: auto; white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
theorem strange (n : Nat) (h1 : n &amp;amp;lt; 2) (h2 : 5 &amp;amp;lt; n) : n = 100 := by&lt;br /&gt;
  omega&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean accepts this. No number is both below 2 and above 5, so any conclusion follows. In a long&lt;br /&gt;
statement with many hypotheses, such a clash is easy to miss, and a proof of it can look like a&lt;br /&gt;
proof of something hard.&lt;br /&gt;
&lt;br /&gt;
A milder fault is a hypothesis that is not contradictory but is not in the original problem&lt;br /&gt;
either. It makes the formal problem easier than the one it claims to state.&lt;br /&gt;
&lt;br /&gt;
== Definitions are part of the statement ==&lt;br /&gt;
&lt;br /&gt;
A statement means only what its definitions mean. Here is a definition of a prime number that&lt;br /&gt;
forgets one condition, that a prime is at least 2:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean&amp;quot; style=&amp;quot;background: #f8f9fa; border: 1px solid #c8ccd1; padding: 0.6em; margin: 0.3em 0; font-size: 0.85em; line-height: 1.35; overflow-x: auto; white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
def IsPrime (n : Nat) : Prop := ∀ d, d ∣ n → d = 1 ∨ d = n&lt;br /&gt;
&lt;br /&gt;
theorem one_is_prime : IsPrime 1 := by&lt;br /&gt;
  intro d hd&lt;br /&gt;
  left&lt;br /&gt;
  exact Nat.dvd_one.mp hd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean accepts that 1 is prime, correctly, for this definition. Every theorem stated with&lt;br /&gt;
&amp;lt;code&amp;gt;IsPrime&amp;lt;/code&amp;gt; is a theorem about this definition, not about primes. Pollack&amp;#039;s remedy is the&lt;br /&gt;
one mathematics already uses: develop shared libraries of formal definitions that are checked, read&lt;br /&gt;
and used by many people, so that their definitions come to be trusted as meaning what they&lt;br /&gt;
claim.&amp;lt;ref name=&amp;quot;pollack&amp;quot; /&amp;gt; In Lean that library is Mathlib (see&lt;br /&gt;
[[Lean theorem prover/Explainers/A library of mathematics|a library of mathematics]]).&lt;br /&gt;
&lt;br /&gt;
Notation is part of the statement too. A Lean file can define new notation and new type class&lt;br /&gt;
instances, and these change how a statement is read; Lean&amp;#039;s guide warns that they can be used to&lt;br /&gt;
change what a statement means, and notes that some independent checkers can print a statement&lt;br /&gt;
plainly, unaffected by the file&amp;#039;s notation.&amp;lt;ref name=&amp;quot;refval&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A published case ==&lt;br /&gt;
&lt;br /&gt;
miniF2F is a set of 488 problems from mathematics competitions, among them the IMO, AIME and AMC,&lt;br /&gt;
and from some textbooks, each stated formally in Lean and used to compare automated provers. A&lt;br /&gt;
review posted in 2025 found discrepancies between the formal and the informal statements in&lt;br /&gt;
more than half of its problems. In one AIME problem, the formal version carried three hypotheses&lt;br /&gt;
that certain expressions are not zero, which the original problem did not state and which made&lt;br /&gt;
the proof easier; in another problem a missing pair of brackets made the formal statement wrong&lt;br /&gt;
and unprovable. The authors corrected the statements and published a revised set.&amp;lt;ref name=&amp;quot;minif2f&amp;quot;&amp;gt;Azim Ospanov, Farzan Farnia and Roozbeh Yousefzadeh, &amp;quot;miniF2F-Lean Revisited: Reviewing Limitations and Charting a Path Forward&amp;quot;, arXiv:2511.03108, 5 November 2025. [https://arxiv.org/abs/2511.03108 arxiv.org/abs/2511.03108]&amp;lt;/ref&amp;gt;&lt;br /&gt;
Every one of those statements had been checked by Lean, in the only sense Lean can check them.&lt;br /&gt;
&lt;br /&gt;
== Who reads the statement ==&lt;br /&gt;
&lt;br /&gt;
The statement is the part a person has to read, and Lean&amp;#039;s strictest procedure is built around&lt;br /&gt;
that fact: the statement to be proved is written separately, in a trusted setting, and the proof is&lt;br /&gt;
accepted only if what it proves matches that text exactly. Even then, the guide lists human error&lt;br /&gt;
or misleading presentation in that trusted statement among the things that remain.&amp;lt;ref name=&amp;quot;refval&amp;quot; /&amp;gt;&lt;br /&gt;
The project this wiki records says the same in its own words: a proof checker is not a reviewer&lt;br /&gt;
(see [[Principia Machina/Lean transition|the move to Lean]]).&lt;br /&gt;
&lt;br /&gt;
== Next ==&lt;br /&gt;
&lt;br /&gt;
[[Lean theorem prover/Explainers/Programs and proofs in one language|Programs and proofs in one language]]&lt;br /&gt;
shows Lean as a programming language, in which the same definitions are run and reasoned about.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>PMA Publisher</name></author>
	</entry>
</feed>