<?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%2FUniverses_and_Prop</id>
	<title>Lean theorem prover/Foundations/Universes and Prop - 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%2FUniverses_and_Prop"/>
	<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/Foundations/Universes_and_Prop&amp;action=history"/>
	<updated>2026-10-21T06:37:07Z</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/Universes_and_Prop&amp;diff=6776&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/Universes_and_Prop&amp;diff=6776&amp;oldid=prev"/>
		<updated>2026-10-15T19:34:49Z</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:Universes and Prop}}&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:Universes and Prop}}&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/Why there is no type of all types}}&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/Why there is no type of all types}}&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;In Lean every type is itself a term, so every type has a type. The types of types are called&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;In Lean every type is itself a term, so every type has a type. The types of types are called&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/Universes_and_Prop&amp;diff=6569&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/Universes_and_Prop&amp;diff=6569&amp;oldid=prev"/>
		<updated>2026-10-14T18:00:58Z</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:Universes and Prop}}&lt;br /&gt;
{{Plebeian|Lean theorem prover/Explainers/Why there is no type of all types}}&lt;br /&gt;
&lt;br /&gt;
In Lean every type is itself a term, so every type has a type. The types of types are called&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;universes&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;sorts&amp;#039;&amp;#039;&amp;#039;. They form a hierarchy: &amp;lt;code&amp;gt;Sort 0&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;code&amp;gt;Sort 1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Sort 2&amp;lt;/code&amp;gt; and so on, each a member of the next, with no top.&lt;br /&gt;
The bottom level, &amp;lt;code&amp;gt;Sort 0&amp;lt;/code&amp;gt;, is &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt;, the universe of propositions,&lt;br /&gt;
and it obeys different rules from the levels above it. This page sets out the hierarchy, the&lt;br /&gt;
rule that assigns a universe to a function type, the operation &amp;lt;math&amp;gt;\mathrm{imax}&amp;lt;/math&amp;gt; that&lt;br /&gt;
rule needs, universe polymorphism, and the paradox that makes a hierarchy necessary.&lt;br /&gt;
&lt;br /&gt;
== Sorts and their names ==&lt;br /&gt;
&lt;br /&gt;
Each universe has a &amp;#039;&amp;#039;&amp;#039;level&amp;#039;&amp;#039;&amp;#039;, and &amp;lt;code&amp;gt;Sort u&amp;lt;/code&amp;gt; is the universe at level&lt;br /&gt;
&amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt;. Two abbreviations name the cases that matter in practice:&lt;br /&gt;
&amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;Sort 0&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Type u&amp;lt;/code&amp;gt; is&lt;br /&gt;
&amp;lt;code&amp;gt;Sort (u + 1)&amp;lt;/code&amp;gt;, with &amp;lt;code&amp;gt;Type&amp;lt;/code&amp;gt; alone meaning &amp;lt;code&amp;gt;Type 0&amp;lt;/code&amp;gt;, that is,&lt;br /&gt;
&amp;lt;code&amp;gt;Sort 1&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;refman-univ&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039;, for Lean&lt;br /&gt;
4.34.0, lean-lang.org, 2026, section 4.3, &amp;quot;Universes&amp;quot;.&lt;br /&gt;
https://lean-lang.org/doc/reference/4.34.0/The-Type-System/Universes/&amp;lt;/ref&amp;gt;&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;
#check Prop&lt;br /&gt;
#check Type&lt;br /&gt;
#check Type 3&lt;br /&gt;
#check Sort 0&lt;br /&gt;
example : Sort 0 = Prop := rfl&lt;br /&gt;
example : Sort 1 = Type := rfl&lt;br /&gt;
example : Sort (3 + 1) = Type 3 := rfl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean prints &amp;lt;code&amp;gt;Prop : Type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Type : Type 1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;code&amp;gt;Type 3 : Type 4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Prop : Type&amp;lt;/code&amp;gt;, and accepts the three equations&lt;br /&gt;
by &amp;lt;code&amp;gt;rfl&amp;lt;/code&amp;gt;: the names are notation for the same terms. The typing rule behind the&lt;br /&gt;
first four lines is the sort rule of&lt;br /&gt;
[[Lean theorem prover/Foundations/Terms, types and judgments|Terms, types and judgments]],&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{}{\Gamma \vdash \mathrm{Sort}\,u : \mathrm{Sort}\,(u+1)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and nothing else gives a universe a type. In particular no universe is a member of itself:&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;
example : Type := Type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean 4.34.1 rejects it:&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;
Type mismatch&lt;br /&gt;
  Type&lt;br /&gt;
has type&lt;br /&gt;
  Type 1&lt;br /&gt;
of sort `Type 2` but is expected to have type&lt;br /&gt;
  Type&lt;br /&gt;
of sort `Type 1`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean&amp;#039;s universes are also &amp;#039;&amp;#039;&amp;#039;not cumulative&amp;#039;&amp;#039;&amp;#039;: a type in &amp;lt;code&amp;gt;Type 0&amp;lt;/code&amp;gt; is not&lt;br /&gt;
thereby in &amp;lt;code&amp;gt;Type 1&amp;lt;/code&amp;gt;, and each type has exactly one universe.&amp;lt;ref name=&amp;quot;refman-univ&amp;quot; /&amp;gt;&lt;br /&gt;
A type is moved up explicitly, by wrapping it:&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;
example : Type 1 := Nat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
fails with &amp;lt;code&amp;gt;Type mismatch&amp;lt;/code&amp;gt;, reporting that &amp;lt;code&amp;gt;Nat&amp;lt;/code&amp;gt; has type&lt;br /&gt;
&amp;lt;code&amp;gt;Type&amp;lt;/code&amp;gt; but is expected to have type &amp;lt;code&amp;gt;Type 1&amp;lt;/code&amp;gt;. The standard wrapper is&lt;br /&gt;
&amp;lt;code&amp;gt;ULift&amp;lt;/code&amp;gt;, a structure with one field, &amp;lt;code&amp;gt;down&amp;lt;/code&amp;gt;, whose universe parameter&lt;br /&gt;
says how far to lift:&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;
#check (ULift.{1} Nat)&lt;br /&gt;
example : Type 1 := ULift.{1} Nat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean prints &amp;lt;code&amp;gt;ULift Nat : Type 1&amp;lt;/code&amp;gt; and accepts the example. Coq, by contrast, has cumulative universes; Carneiro notes that&lt;br /&gt;
cumulativity breaks the unique-typing theorem his analysis of Lean relies on.&amp;lt;ref name=&amp;quot;carneiro2019&amp;quot;&amp;gt;Mario&lt;br /&gt;
Carneiro, &amp;#039;&amp;#039;The Type Theory of Lean&amp;#039;&amp;#039;, MSc thesis, Carnegie Mellon University, 2019.&lt;br /&gt;
https://github.com/digama0/lean-type-theory/releases/tag/v1.0&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The universe of a function type ==&lt;br /&gt;
&lt;br /&gt;
A dependent function type &amp;lt;code&amp;gt;(x : A) → B&amp;lt;/code&amp;gt; is a type, so it lives in some universe.&lt;br /&gt;
The formation rule decides which:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\Gamma \vdash A : \mathrm{Sort}\,u \qquad \Gamma, x : A \vdash B : \mathrm{Sort}\,v}{\Gamma \vdash (x : A) \to B : \mathrm{Sort}\,(\mathrm{imax}\,u\,v)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mathrm{imax}\,u\,v = \begin{cases} 0 &amp;amp; \text{if } v = 0 \\ \max(u, v) &amp;amp; \text{otherwise.} \end{cases}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two cases.&amp;lt;ref name=&amp;quot;refman-univ&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;carneiro2019&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;The codomain is data&amp;#039;&amp;#039;&amp;#039; (&amp;lt;math&amp;gt;v \geq 1&amp;lt;/math&amp;gt;). The function type lives in the larger of the two universes. A type in &amp;lt;code&amp;gt;Type u&amp;lt;/code&amp;gt; may only quantify over types in universes no larger than its own; this is &amp;#039;&amp;#039;&amp;#039;predicativity&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;The codomain is a proposition&amp;#039;&amp;#039;&amp;#039; (&amp;lt;math&amp;gt;v = 0&amp;lt;/math&amp;gt;). The function type is a proposition, whatever the domain. A proposition may quantify over all propositions, or over all types at any level, and still be a proposition; this is &amp;#039;&amp;#039;&amp;#039;impredicativity&amp;#039;&amp;#039;&amp;#039;.&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;
#check ∀ (p : Prop), p → p&lt;br /&gt;
#check (α : Type) → α → α&lt;br /&gt;
#check (α : Type 2) → Prop&lt;br /&gt;
#check (n : Nat) → n = n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output is&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;
∀ (p : Prop), p → p : Prop&lt;br /&gt;
(α : Type) → α → α : Type 1&lt;br /&gt;
Type 2 → Prop : Type 3&lt;br /&gt;
∀ (n : Nat), n = n : Prop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first statement quantifies over every proposition, including itself, and is a&lt;br /&gt;
proposition. The second, the type of the polymorphic identity function on&lt;br /&gt;
&amp;lt;code&amp;gt;Type&amp;lt;/code&amp;gt;, quantifies over &amp;lt;code&amp;gt;Type&amp;lt;/code&amp;gt; and so lands one level up, in&lt;br /&gt;
&amp;lt;code&amp;gt;Type 1&amp;lt;/code&amp;gt;. The third is a function type into &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt;, not a function type&lt;br /&gt;
whose values are proofs, so it is data: its codomain &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; lives in&lt;br /&gt;
&amp;lt;code&amp;gt;Sort 1&amp;lt;/code&amp;gt;, and the result is in &amp;lt;math&amp;gt;\mathrm{Sort}\,(\max(4, 1)) =&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Type 3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Why imax ==&lt;br /&gt;
&lt;br /&gt;
The two cases could be stated as two rules. A single operation on levels is needed because of&lt;br /&gt;
universe polymorphism. A definition may be stated for an arbitrary level variable&lt;br /&gt;
&amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt;, and the rule must give the function type a universe without knowing whether&lt;br /&gt;
&amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; will later be 0. With &amp;lt;math&amp;gt;\max&amp;lt;/math&amp;gt; alone that is impossible. The obvious&lt;br /&gt;
candidate, &amp;lt;math&amp;gt;\max\,u\,v&amp;lt;/math&amp;gt;, goes wrong when &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; is set to 0: a&lt;br /&gt;
proposition that quantifies over a type in &amp;lt;code&amp;gt;Sort u&amp;lt;/code&amp;gt; would land in&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{Sort}\,(\max(u, 0)) = \mathrm{Sort}\,u&amp;lt;/math&amp;gt; instead of in&lt;br /&gt;
&amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; would not be impredicative. No other expression&lt;br /&gt;
built from &amp;lt;math&amp;gt;\max&amp;lt;/math&amp;gt; and successor does better: one that mentions &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt; is&lt;br /&gt;
never below &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt;, so it is not 0 when &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; is 0 and &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt; is&lt;br /&gt;
not, and one that does not mention &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt; cannot equal &amp;lt;math&amp;gt;\max(u, v)&amp;lt;/math&amp;gt;&lt;br /&gt;
for every &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt;. &amp;lt;math&amp;gt;\mathrm{imax}&amp;lt;/math&amp;gt; is the level expression that reduces&lt;br /&gt;
to the right case once &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; is known.&amp;lt;ref name=&amp;quot;refman-univ&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Level expressions are built from numerals, variables, successor, &amp;lt;math&amp;gt;\max&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{imax}&amp;lt;/math&amp;gt;, and two levels are equal when they denote the same number under&lt;br /&gt;
every assignment of numbers to their variables.&amp;lt;ref name=&amp;quot;carneiro2019&amp;quot; /&amp;gt; Lean will not&lt;br /&gt;
treat &amp;lt;math&amp;gt;\mathrm{imax}\,u\,v&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;\max\,u\,v&amp;lt;/math&amp;gt;, because the two differ&lt;br /&gt;
when &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; is 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;
universe u v&lt;br /&gt;
&lt;br /&gt;
def Fn (α : Sort u) (β : Sort v) : Sort (imax u v) := α → β&lt;br /&gt;
&lt;br /&gt;
#check Fn.{1, 0}&lt;br /&gt;
#check Fn.{1, 1}&lt;br /&gt;
#check Fn.{0, 2}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three instances print as &amp;lt;code&amp;gt;Fn : Type → Prop → Prop&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;code&amp;gt;Fn : Type → Type → Type&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Fn : Prop → Type 1 → Type 1&amp;lt;/code&amp;gt;: the&lt;br /&gt;
same definition gives a proposition-valued result in the first case and data in the other&lt;br /&gt;
two. Stating the result universe as &amp;lt;code&amp;gt;Sort (max u v)&amp;lt;/code&amp;gt; instead is rejected:&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;
universe u v&lt;br /&gt;
&lt;br /&gt;
def Fn2 (α : Sort u) (β : Sort v) : Sort (max u v) := α → β&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
Type mismatch&lt;br /&gt;
  α → β&lt;br /&gt;
has type&lt;br /&gt;
  Sort (imax u v)&lt;br /&gt;
of sort `Type (imax u v)` but is expected to have type&lt;br /&gt;
  Sort (max u v)&lt;br /&gt;
of sort `Type (max u v)`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Universe polymorphism ==&lt;br /&gt;
&lt;br /&gt;
A definition may take &amp;#039;&amp;#039;&amp;#039;universe parameters&amp;#039;&amp;#039;&amp;#039;, written after its name as&lt;br /&gt;
&amp;lt;code&amp;gt;.{u, v}&amp;lt;/code&amp;gt;. It is then a schema: each use instantiates the parameters with level&lt;br /&gt;
expressions, and instantiations at different levels need not be definitionally&lt;br /&gt;
equal.&amp;lt;ref name=&amp;quot;refman-univ&amp;quot; /&amp;gt;&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 pp.universes true in&lt;br /&gt;
#check @id&lt;br /&gt;
#check @id.{0}&lt;br /&gt;
#check List.{0}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lean prints &amp;lt;code&amp;gt;@id.{u_1} : {α : Sort u_1} → α → α&amp;lt;/code&amp;gt;, then&lt;br /&gt;
&amp;lt;code&amp;gt;@id : ∀ {α : Prop}, α → α&amp;lt;/code&amp;gt; for the instance at level 0, where the identity&lt;br /&gt;
function on proofs is itself a proof of a proposition, and &amp;lt;code&amp;gt;List : Type → Type&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is what lets one identity function, one list type and one equality serve at every&lt;br /&gt;
level. Without it each would have to be defined once per universe.&lt;br /&gt;
&lt;br /&gt;
== Prop ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; is the universe of propositions. Besides impredicativity, it has&lt;br /&gt;
properties that the levels above it lack:&amp;lt;ref name=&amp;quot;refman-props&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language&lt;br /&gt;
Reference&amp;#039;&amp;#039;, for Lean 4.34.0, lean-lang.org, 2026, section 4.2, &amp;quot;Propositions&amp;quot;.&lt;br /&gt;
https://lean-lang.org/doc/reference/4.34.0/The-Type-System/Propositions/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Definitional proof irrelevance&amp;#039;&amp;#039;&amp;#039;: any two proofs of the same proposition are definitionally equal.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Run-time irrelevance&amp;#039;&amp;#039;&amp;#039;: proofs are erased from compiled code.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Restricted elimination&amp;#039;&amp;#039;&amp;#039;: except for a class of propositions with at most one proof, a proof cannot be used to produce data, only other proofs.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Extensionality&amp;#039;&amp;#039;&amp;#039;: logically equivalent propositions are equal, by the axiom &amp;lt;code&amp;gt;propext&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
An impredicative universe of propositions is a feature of the Calculus of Constructions of&lt;br /&gt;
Coquand and Huet, and the theory implemented by Lean&amp;#039;s kernel is a version of that&lt;br /&gt;
calculus.&amp;lt;ref name=&amp;quot;refman-elab&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039;, for Lean 4.34.0,&lt;br /&gt;
lean-lang.org, 2026, section 2.3, &amp;quot;The Kernel&amp;quot;.&lt;br /&gt;
https://lean-lang.org/doc/reference/4.34.0/Elaboration-and-Compilation/&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;coc&amp;quot;&amp;gt;Thierry Coquand and Gérard Huet, &amp;quot;The calculus of&lt;br /&gt;
constructions&amp;quot;, &amp;#039;&amp;#039;Information and Computation&amp;#039;&amp;#039; 76(2–3), 1988, pp. 95–120.&lt;br /&gt;
https://doi.org/10.1016/0890-5401(88)90005-3&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;abelcoquand&amp;quot;&amp;gt;Andreas Abel and&lt;br /&gt;
Thierry Coquand, &amp;quot;Failure of Normalization in Impredicative Type Theory with Proof-Irrelevant&lt;br /&gt;
Propositional Equality&amp;quot;, &amp;#039;&amp;#039;Logical Methods in Computer Science&amp;#039;&amp;#039; 16(2), 2020.&lt;br /&gt;
https://doi.org/10.23638/LMCS-16(2:14)2020&amp;lt;/ref&amp;gt; Its strength is real: Carneiro observes that&lt;br /&gt;
impredicativity corresponds, in a set-theoretic model, to having full power sets.&amp;lt;ref name=&amp;quot;carneiro2019&amp;quot; /&amp;gt;&lt;br /&gt;
The restriction on elimination is how the rules ensure that no computation can tell which&lt;br /&gt;
proof of a proposition it has received, as proof irrelevance&lt;br /&gt;
requires;&amp;lt;ref name=&amp;quot;refman-subsing&amp;quot;&amp;gt;&amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039;, for Lean 4.34.0,&lt;br /&gt;
lean-lang.org, 2026, section 4.4.3.1.1.1, &amp;quot;Subsingleton Elimination&amp;quot;.&lt;br /&gt;
https://lean-lang.org/doc/reference/4.34.0/The-Type-System/Inductive-Types/&amp;lt;/ref&amp;gt; it is&lt;br /&gt;
treated on [[Lean theorem prover/Foundations/Proof irrelevance and subsingleton elimination|Proof irrelevance and subsingleton elimination]].&lt;br /&gt;
&lt;br /&gt;
== Why there is a hierarchy ==&lt;br /&gt;
&lt;br /&gt;
The simplest design would be a single universe containing every type, itself included:&lt;br /&gt;
&amp;lt;code&amp;gt;Type : Type&amp;lt;/code&amp;gt;. That design is inconsistent. In 1972 Girard derived a&lt;br /&gt;
contradiction in a type system called System U, by formalising a paradox in the style of&lt;br /&gt;
Burali-Forti&amp;#039;s paradox of the largest ordinal. The same argument shows that the first version&lt;br /&gt;
of Martin-Löf&amp;#039;s type theory, which had &amp;lt;code&amp;gt;Type : Type&amp;lt;/code&amp;gt;, proves falsity; in type&lt;br /&gt;
theory the argument is known as &amp;#039;&amp;#039;&amp;#039;Girard&amp;#039;s paradox&amp;#039;&amp;#039;&amp;#039;.&amp;lt;ref name=&amp;quot;nlab&amp;quot;&amp;gt;nLab, &amp;quot;Burali-Forti&amp;#039;s paradox&amp;quot;, section &amp;quot;In type theory: Girard&amp;#039;s&lt;br /&gt;
paradox&amp;quot;, revision of 24 November 2023. https://ncatlab.org/nlab/show/Girard%27s+paradox&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;hurkens&amp;quot;&amp;gt;Antonius&lt;br /&gt;
J. C. Hurkens, &amp;quot;A simplification of Girard&amp;#039;s paradox&amp;quot;, in &amp;#039;&amp;#039;Typed Lambda Calculi and&lt;br /&gt;
Applications&amp;#039;&amp;#039; (TLCA 1995), Lecture Notes in Computer Science 902, Springer, 1995,&lt;br /&gt;
pp. 266–278. https://doi.org/10.1007/BFb0014058&amp;lt;/ref&amp;gt; The &amp;#039;&amp;#039;Homotopy Type Theory&amp;#039;&amp;#039; book makes&lt;br /&gt;
the same point for a universe that contains itself: every type, including the empty one,&lt;br /&gt;
becomes inhabited.&amp;lt;ref name=&amp;quot;hott&amp;quot;&amp;gt;The Univalent Foundations Program, &amp;#039;&amp;#039;Homotopy Type&lt;br /&gt;
Theory: Univalent Foundations of Mathematics&amp;#039;&amp;#039;, Institute for Advanced Study, 2013,&lt;br /&gt;
section 1.3, &amp;quot;Universes and families&amp;quot;. https://homotopytypetheory.org/book/&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hurkens&amp;#039;s paper locates the problem precisely. Higher-order logic, in which propositions may&lt;br /&gt;
quantify over all propositions, is consistent. Adding a single rule, which lets a type be&lt;br /&gt;
formed by quantifying over the sort of all types, gives the system called&lt;br /&gt;
&amp;lt;math&amp;gt;\lambda U^-&amp;lt;/math&amp;gt;, which Coquand had already shown inconsistent; Hurkens gives a short&lt;br /&gt;
term in it whose type is falsity.&amp;lt;ref name=&amp;quot;hurkens&amp;quot; /&amp;gt; Impredicativity for propositions&lt;br /&gt;
alone is therefore consistent, and adding it for types as well is not. Lean&amp;#039;s design&lt;br /&gt;
follows the line exactly: &amp;lt;code&amp;gt;Prop&amp;lt;/code&amp;gt; is impredicative, and every universe above it is&lt;br /&gt;
predicative and contained in the next. The plain-language account is&lt;br /&gt;
[[Lean theorem prover/Explainers/Why there is no type of all types|Why there is no type of all types]].&lt;br /&gt;
&lt;br /&gt;
How strong the resulting hierarchy is, measured against set theory, is the subject of&lt;br /&gt;
[[Lean theorem prover/Foundations/Consistency and the metatheory|Consistency and the metatheory]].&lt;br /&gt;
&lt;br /&gt;
== Next ==&lt;br /&gt;
&lt;br /&gt;
[[Lean theorem prover/Foundations/Inductive types and recursors|Inductive types and recursors]] shows how every type other than universes and function types is introduced, and&lt;br /&gt;
how the universe rules constrain it.&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>