<?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%2FFoundations%2FConsistency_and_the_metatheory</id>
	<title>Lean theorem prover/Foundations/Consistency and the metatheory - 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%2FFoundations%2FConsistency_and_the_metatheory"/>
	<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/Foundations/Consistency_and_the_metatheory&amp;action=history"/>
	<updated>2026-10-21T07:35:04Z</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/Foundations/Consistency_and_the_metatheory&amp;diff=6785&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/Foundations/Consistency_and_the_metatheory&amp;diff=6785&amp;oldid=prev"/>
		<updated>2026-10-15T19:35:02Z</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:35, 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:Consistency and the metatheory}}&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:Consistency and the metatheory}}&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;{{Plebeian|Lean theorem prover/Explainers/What has to be trusted}}&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;{{Plebeian|Lean theorem prover/Explainers/What has to be trusted}}&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;The &amp;#039;&amp;#039;&amp;#039;metatheory&amp;#039;&amp;#039;&amp;#039; of Lean is what can be proved &amp;#039;&amp;#039;about&amp;#039;&amp;#039; its type theory rather than&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;The &amp;#039;&amp;#039;&amp;#039;metatheory&amp;#039;&amp;#039;&amp;#039; of Lean is what can be proved &amp;#039;&amp;#039;about&amp;#039;&amp;#039; its type theory rather than&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/Foundations/Consistency_and_the_metatheory&amp;diff=6578&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/Foundations/Consistency_and_the_metatheory&amp;diff=6578&amp;oldid=prev"/>
		<updated>2026-10-14T18:01:04Z</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:Consistency and the metatheory}}&lt;br /&gt;
{{Plebeian|Lean theorem prover/Explainers/What has to be trusted}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;metatheory&amp;#039;&amp;#039;&amp;#039; of Lean is what can be proved &amp;#039;&amp;#039;about&amp;#039;&amp;#039; its type theory rather than&lt;br /&gt;
&amp;#039;&amp;#039;in&amp;#039;&amp;#039; it. The central question is consistency: whether a closed proof of&lt;br /&gt;
&amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; can ever pass Lean&amp;#039;s kernel. The answer known today is relative, and it was proved for the type&lt;br /&gt;
theory of Lean 3. That theory, with its three axioms, can be interpreted in Zermelo–Fraenkel&lt;br /&gt;
set theory with choice (ZFC) extended by inaccessible cardinals, one axiom &amp;quot;there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; inaccessible&lt;br /&gt;
cardinals&amp;quot; for each natural number &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, so it is consistent if that set theory&lt;br /&gt;
is. Several properties one might expect of a type theory fail for Lean, among them&lt;br /&gt;
decidability of definitional equality and normalisation, and none of these failures makes&lt;br /&gt;
the checker unsound. If Lean is consistent, it cannot prove its own consistency. This page sets&lt;br /&gt;
out each of these points and its source.&lt;br /&gt;
&lt;br /&gt;
== The consistency theorem ==&lt;br /&gt;
&lt;br /&gt;
Carneiro&amp;#039;s thesis of 2019 writes down the type theory of Lean 3&amp;lt;ref name=&amp;quot;lean4lean&amp;quot; /&amp;gt; in&lt;br /&gt;
full, including [[Lean theorem prover/Foundations/The three axioms|the three axioms]], and constructs a&lt;br /&gt;
set-theoretic model of it. Its conclusion, Corollary 6.8, is that Lean is consistent if ZFC&lt;br /&gt;
together with the axioms &amp;quot;there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; inaccessible cardinals&amp;quot;, for every&lt;br /&gt;
natural number &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, is consistent: there is no proof of &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; that&lt;br /&gt;
the Lean kernel verifies.&amp;lt;ref name=&amp;quot;carneiro&amp;quot;&amp;gt;Mario Carneiro, &amp;#039;&amp;#039;The Type Theory of Lean&amp;#039;&amp;#039;, Master&amp;#039;s thesis, Carnegie Mellon University, 2019; abstract, §1.2 (pp. 4–5), §3 (pp. 15–19), Theorem 4.1 (p. 19), Theorem 6.7 (p. 37) and Corollary 6.8 (p. 41). https://github.com/digama0/lean-type-theory/releases/tag/v1.0&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathrm{Con}\bigl(\mathrm{ZFC} + \{\exists\, n \text{ inaccessible cardinals} : n &amp;lt; \omega\}\bigr) \;\Rightarrow\; \mathrm{Con}(\mathrm{Lean})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The model is the expected one. Types are sets and terms are their elements.&lt;br /&gt;
&amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; is a two-element set whose members are the empty set and a one-element&lt;br /&gt;
set, so every proposition is interpreted as empty or as a one-element set, which validates&lt;br /&gt;
proof irrelevance. Each higher universe is interpreted inside a level of the cumulative hierarchy&lt;br /&gt;
cut off at an inaccessible cardinal, because universes are closed under function types and&lt;br /&gt;
inductive types, which makes them Grothendieck universes. Lean has a universe for every&lt;br /&gt;
natural number, so the full hierarchy calls for an inaccessible for each of them; a single&lt;br /&gt;
proof mentions only finitely many universes, which is why the hypothesis is stated one&lt;br /&gt;
&amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; at a time. The impredicativity of &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; corresponds to full power&lt;br /&gt;
sets in ZFC.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Carneiro calls the assumption optimal, for the following reason. Inside Lean one can build a&lt;br /&gt;
model of ZFC in each universe above the lowest, and define inaccessible cardinals in the&lt;br /&gt;
larger ones, so Lean proves the consistency of ZFC with any given finite number of&lt;br /&gt;
inaccessibles.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Relative consistency and Werner&amp;#039;s theorem ==&lt;br /&gt;
&lt;br /&gt;
The two directions were matched for the Calculus of Inductive Constructions, the theory&lt;br /&gt;
behind Coq, by Werner in 1997.&amp;lt;ref name=&amp;quot;werner&amp;quot;&amp;gt;Benjamin Werner, &amp;quot;Sets in types, types in sets&amp;quot;, in Martín Abadi and Takayasu Ito (eds.), &amp;#039;&amp;#039;Theoretical Aspects of Computer Software (TACS 1997)&amp;#039;&amp;#039;, Lecture Notes in Computer Science 1281, Springer, 1997, pp. 530–546. https://doi.org/10.1007/BFb0014566&amp;lt;/ref&amp;gt; Writing &amp;lt;math&amp;gt;\mathrm{ZFC}_n&amp;lt;/math&amp;gt;&lt;br /&gt;
for ZFC with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; inaccessibles and &amp;lt;math&amp;gt;\mathrm{CIC}_n&amp;lt;/math&amp;gt; for the calculus&lt;br /&gt;
with &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; universes, Carneiro summarises Werner&amp;#039;s result as&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathrm{ZFC}_n \vdash \mathrm{Con}(\mathrm{CIC}_{n+1}) \qquad\qquad \mathrm{CIC}_{n+2} \vdash \mathrm{Con}(\mathrm{ZFC}_n)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so that the unions over all &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are equiconsistent. Werner&amp;#039;s encoding of set theory in&lt;br /&gt;
the calculus also assumes excluded middle and a type-theoretic axiom of choice.&amp;lt;ref name=&amp;quot;werner&amp;quot; /&amp;gt; Werner&amp;#039;s construction of&lt;br /&gt;
set theory inside type theory has been replicated in Lean with minor changes, which gives&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{Lean}_{n+2} \vdash \mathrm{Con}(\mathrm{ZFC}_n)&amp;lt;/math&amp;gt;. Carneiro&amp;#039;s model&lt;br /&gt;
supplies the other direction, &amp;lt;math&amp;gt;\mathrm{ZFC}_{n+1} \vdash \mathrm{Con}(\mathrm{Lean}_{n+1})&amp;lt;/math&amp;gt;,&lt;br /&gt;
so Lean with all its universes is equiconsistent with both. He does not attempt sharp&lt;br /&gt;
universe bounds, and notes that matching Werner&amp;#039;s exactly would require global choice, a&lt;br /&gt;
choice function on the whole set-theoretic universe, to interpret Lean&amp;#039;s choice&lt;br /&gt;
axiom.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt; Lean&amp;#039;s consistency strength is thus that of the union of the&lt;br /&gt;
theories &amp;lt;math&amp;gt;\mathrm{ZFC}_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== What fails ==&lt;br /&gt;
&lt;br /&gt;
The same thesis records negative results, and later work adds one more.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definitional equality is undecidable, and so is type checking.&amp;#039;&amp;#039;&amp;#039; The accessibility&lt;br /&gt;
predicate, together with proof irrelevance, lets a definitional-equality question encode&lt;br /&gt;
the halting problem. The argument is on&lt;br /&gt;
[[Lean theorem prover/Foundations/Proof irrelevance and subsingleton elimination|proof irrelevance and subsingleton elimination]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;The checker&amp;#039;s equality is weaker than the theory&amp;#039;s.&amp;#039;&amp;#039;&amp;#039; Lean&amp;#039;s kernel implements a&lt;br /&gt;
decidable approximation, algorithmic equality, which is not transitive. Typing measured by&lt;br /&gt;
it fails subject reduction, and the reduction relation is not confluent (the Church–Rosser&lt;br /&gt;
property fails), so reducing both sides to normal form is not a decision procedure. A&lt;br /&gt;
modified reduction restores confluence at the cost of termination, enough to prove that&lt;br /&gt;
every term has a unique type up to definitional equality.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Normalisation fails.&amp;#039;&amp;#039;&amp;#039; Abel and Coquand showed that a type theory with an impredicative&lt;br /&gt;
&amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; and a proof-irrelevant equality loses normalisation. One of their&lt;br /&gt;
counterexamples uses only &amp;lt;code&amp;gt;propext&amp;lt;/code&amp;gt;, one of Lean&amp;#039;s standard axioms, and gives a&lt;br /&gt;
closed proof with no weak head normal form; they note that it replays directly in Lean 3.4.2.&amp;lt;ref name=&amp;quot;abel-coquand&amp;quot;&amp;gt;Andreas Abel and Thierry Coquand, &amp;quot;Failure of normalization in impredicative type theory with proof-irrelevant propositional equality&amp;quot;, &amp;#039;&amp;#039;Logical Methods in Computer Science&amp;#039;&amp;#039; 16(2) (2020), paper 14. https://doi.org/10.23638/LMCS-16(2:14)2020&amp;lt;/ref&amp;gt; It&lt;br /&gt;
transcribes directly into Lean 4.34.1:&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;
set_option linter.defProp false&lt;br /&gt;
&lt;br /&gt;
def T : Prop := ∀ A : Prop, A → A&lt;br /&gt;
&lt;br /&gt;
def delta : T → T := fun z =&amp;gt; z (T → T) id z&lt;br /&gt;
&lt;br /&gt;
def omega : T := fun A a =&amp;gt; cast (propext ⟨fun _ =&amp;gt; a, fun _ =&amp;gt; id⟩ : (T → T) = A) delta&lt;br /&gt;
&lt;br /&gt;
def Omega : T := delta omega&lt;br /&gt;
&lt;br /&gt;
#print axioms Omega&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prints &amp;lt;code&amp;gt;&amp;#039;Omega&amp;#039; depends on axioms: [propext]&amp;lt;/code&amp;gt;. The type &amp;lt;code&amp;gt;T&amp;lt;/code&amp;gt;&lt;br /&gt;
quantifies over all propositions, which is possible only because &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; is&lt;br /&gt;
impredicative. Given any proposition &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; and a proof &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; of it,&lt;br /&gt;
&amp;lt;code&amp;gt;propext&amp;lt;/code&amp;gt; makes &amp;lt;code&amp;gt;T → T&amp;lt;/code&amp;gt; equal to &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt;, because both are&lt;br /&gt;
true; &amp;lt;code&amp;gt;omega&amp;lt;/code&amp;gt; casts &amp;lt;code&amp;gt;delta&amp;lt;/code&amp;gt; along that equation. When the cast is&lt;br /&gt;
used at &amp;lt;code&amp;gt;A = T → T&amp;lt;/code&amp;gt; itself the two sides of the equation coincide, the cast&lt;br /&gt;
reduces away, and &amp;lt;code&amp;gt;delta omega&amp;lt;/code&amp;gt; unfolds back to &amp;lt;code&amp;gt;delta omega&amp;lt;/code&amp;gt;. Asked&lt;br /&gt;
to normalise the proof, Lean gives up, even with its recursion limit raised to 20,000:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean lean-cont 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;
set_option maxRecDepth 20000 in&lt;br /&gt;
#reduce (proofs := true) Omega&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is &amp;lt;code&amp;gt;maximum recursion depth has been reached&amp;lt;/code&amp;gt;. The failure reaches&lt;br /&gt;
beyond proofs. Carneiro&amp;#039;s later paper on an&lt;br /&gt;
independent checker gives a variant in which a natural number defined by eliminating a&lt;br /&gt;
proof built from &amp;lt;code&amp;gt;Omega&amp;lt;/code&amp;gt; sends a definitional-equality check into the same&lt;br /&gt;
loop:&amp;lt;ref name=&amp;quot;lean4lean&amp;quot;&amp;gt;Mario Carneiro, &amp;quot;Lean4Lean: Verifying a typechecker for Lean, in Lean&amp;quot;, arXiv:2403.14064, version 3, 14 September 2025; abstract, §1, §3.2.1, §4.1 and §9. https://arxiv.org/abs/2403.14064&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;lean lean-cont 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;
inductive Foo : Prop&lt;br /&gt;
  | mk : T → Foo&lt;br /&gt;
&lt;br /&gt;
def foo : Foo := Omega Foo (Foo.mk fun _ =&amp;gt; id)&lt;br /&gt;
&lt;br /&gt;
example : foo.recOn (motive := fun _ =&amp;gt; Nat) (fun _ =&amp;gt; 1) = 1 := by&lt;br /&gt;
  rfl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean again reports &amp;lt;code&amp;gt;maximum recursion depth has been reached&amp;lt;/code&amp;gt;. Abel and Coquand&lt;br /&gt;
stress what is not at stake: consistency and canonicity are unaffected, and they compare the&lt;br /&gt;
situation to extensional type theory, which has an equality reflection rule.&amp;lt;ref name=&amp;quot;abel-coquand&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Why the checker is still sound ==&lt;br /&gt;
&lt;br /&gt;
Carneiro&amp;#039;s argument needs one thing: whatever the checker accepts must be derivable in a&lt;br /&gt;
theory that has a model. He proves that algorithmic equality implies the ideal definitional&lt;br /&gt;
equality for well-typed terms. So if a term of type &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; passed the algorithmic&lt;br /&gt;
typing judgment, his description of what Lean&amp;#039;s kernel checks, that term would have type&lt;br /&gt;
&amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; in the ideal system, and the model would then contain&lt;br /&gt;
an element of the empty set. This is precisely the proof of Corollary 6.8.&amp;lt;ref name=&amp;quot;carneiro&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The failures above are therefore failures of completeness and of termination, not of&lt;br /&gt;
soundness. A checker that is incomplete rejects some correct terms. A checker that may not&lt;br /&gt;
terminate either loops or, as Lean does in the examples above, stops at a resource limit&lt;br /&gt;
and reports an error. Neither outcome accepts a false statement. Carneiro observes that the soundness proof of his&lt;br /&gt;
thesis, unlike MetaRocq&amp;#039;s, does not depend on termination.&amp;lt;ref name=&amp;quot;lean4lean&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proving consistency inside Lean ==&lt;br /&gt;
&lt;br /&gt;
Gödel&amp;#039;s second incompleteness theorem sets the limit. A consistent formal system in which a&lt;br /&gt;
modest amount of arithmetic can be carried out cannot prove its own&lt;br /&gt;
consistency.&amp;lt;ref name=&amp;quot;godel&amp;quot;&amp;gt;Kurt Gödel, &amp;quot;Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme I&amp;quot;, &amp;#039;&amp;#039;Monatshefte für Mathematik und Physik&amp;#039;&amp;#039; 38 (1931), 173–198. https://doi.org/10.1007/BF01700692&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;sep-godel&amp;quot;&amp;gt;Panu Raatikainen, &amp;quot;Gödel&amp;#039;s Incompleteness Theorems&amp;quot;, &amp;#039;&amp;#039;Stanford Encyclopedia of Philosophy&amp;#039;&amp;#039;, substantive revision of 8 October 2025, §1 and §3. https://plato.stanford.edu/entries/goedel-incompleteness/&amp;lt;/ref&amp;gt; Lean formalises far more than&lt;br /&gt;
that arithmetic, so if Lean is consistent, no Lean proof of &amp;quot;Lean is consistent&amp;quot; exists.&lt;br /&gt;
Carneiro&amp;#039;s theorem respects the limit in the usual way: it is a proof in a different&lt;br /&gt;
system, ZFC with inaccessibles, and its conclusion is relative to that system&amp;#039;s&lt;br /&gt;
consistency. The independent-checker project names Gödel&amp;#039;s theorem as the reason&lt;br /&gt;
that nothing implying the unconditional soundness of Lean will be directly provable in Lean,&lt;br /&gt;
and plans to formalise Carneiro&amp;#039;s relative consistency proof, which assumes large&lt;br /&gt;
cardinals.&amp;lt;ref name=&amp;quot;lean4lean&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The theory and the implementation ==&lt;br /&gt;
&lt;br /&gt;
A consistency proof covers a mathematical description of the theory, not the program that&lt;br /&gt;
checks it. The Lean 4 kernel extended the theory Carneiro analysed with features such as&lt;br /&gt;
nested inductive types and η for structures. Carneiro writes that these change the theory&lt;br /&gt;
enough that the 2019 proof no longer applies directly, pointing to later work that covers&lt;br /&gt;
some of the changes, and that some soundness bugs entered Lean&amp;#039;s kernel during the move to&lt;br /&gt;
Lean 4.&amp;lt;ref name=&amp;quot;lean4lean&amp;quot; /&amp;gt; One response is independent checking: a&lt;br /&gt;
second complete type checker written in Lean, able to check all of Mathlib, with part of it&lt;br /&gt;
formally verified against a formalisation of the type theory. That work has already found and&lt;br /&gt;
reported one soundness bug in Lean&amp;#039;s kernel, since fixed.&amp;lt;ref name=&amp;quot;lean4lean&amp;quot; /&amp;gt; The reference&lt;br /&gt;
manual&amp;#039;s guide to validating proofs lists the soundness of Lean&amp;#039;s logic among the&lt;br /&gt;
assumptions that remain even after the strictest checks.&amp;lt;ref name=&amp;quot;refman-validating&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039;, version 4.34.0, &amp;quot;Validating a Lean Proof&amp;quot;, section &amp;quot;Remaining Issues&amp;quot;. https://lean-lang.org/doc/reference/4.34.0/ValidatingProofs/&amp;lt;/ref&amp;gt;&lt;br /&gt;
The checkers themselves are the subject of&lt;br /&gt;
[[Lean theorem prover/System/Proof export and independent checkers|proof export and independent checkers]].&lt;br /&gt;
&lt;br /&gt;
== Next ==&lt;br /&gt;
&lt;br /&gt;
[[Lean theorem prover/System/Elaboration|Elaboration]] begins the pages on how Lean works,&lt;br /&gt;
from the text a person types to the term the Lean kernel checks.&lt;br /&gt;
[[Lean theorem prover/System/The Lean kernel|The Lean kernel]] describes the program whose&lt;br /&gt;
soundness this page has been 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>