Main derivation
S01 · definition
Before
s,\ E
After
E=(V,I,N,\Gamma),\quad \Gamma=\varnothing
Conditions: \text{Lean not run (G2)}
Rule: def_intro · Uses: G1, G2
Leaf basis: def_intro + mko_lean_formal_statement_def
First write the environment as a 4-tuple and name it. MKO assumption a1 says that version, imports, declared names and local context all belong to statement identity, so every judgement about s must carry E. G2 records that this tuple is fixed on paper only and no toolchain was invoked.
S02 · definition
Before
s
After
\mathsf{Parse}(s)\ ;\ \mathsf{Elab}(s)=S\ ;\ \Gamma\vdash S:\mathrm{Prop}\ ;\ \Gamma\vdash p:S\ ;\ \mathsf{Kernel}(p,S)Conditions: none
Rule: lean_stages · Uses: S01, G3
Leaf basis: lean_stages + def_intro
Name five states: s is parsed; s elaborates to a core term S; S has type Prop; a proof term p:S exists; p passes the kernel check. Each later state presupposes the earlier ones, but no earlier state implies a later one. The misconception identified in the MKO is merging these states into one. At the start of this guide all five are 'not executed'.
S03 · implies
Before
s=\texttt{∀ (a b : Nat), a ≤ b → a < b + 1}After
\forall a:\mathrm{Nat},\ \forall b:\mathrm{Nat},\ \bigl((a\le b)\to(a<(b+1))\bigr)Conditions: \text{notation and precedence of E as cited}
Rule: lean_core_notation · Uses: S02, G3
Leaf basis: lean_core_notation
Read the structure by hand using the cited notation and precedence conventions: (a b : Nat) is two nested universal binders; the ∀ extends to the end of the string; + binds more tightly than <, so a < b + 1 is a<(b+1); ≤ and < bind more tightly than →, so the two sides of → are a≤b and a<b+1. The reading: for all natural numbers a and b, if a≤b then a<b+1. This is a manual reading according to the conventions, not the output of running the parser (G2).
S04 · implies
Before
\forall a\,b:\mathrm{Nat},\ a\le b\to a<b+1After
S=\forall a\,b:\mathrm{Nat},\ \mathrm{LE.le}\,a\,b\to\mathrm{LT.lt}\,a\,(\mathrm{HAdd.hAdd}\,b\,(\mathrm{OfNat.ofNat}\,1))Conditions: \mathsf{Elab}(s)\ \text{succeeds (not run)}
Rule: lean_core_notation · Uses: S03
Leaf basis: lean_core_notation + lean_stages
Describe what elaboration must produce if it succeeds: replace each notation by its constant and fill in the implicit type argument Nat and the instance arguments (LE Nat, LT Nat, HAdd Nat Nat Nat, OfNat Nat 1); the displayed term omits these implicit arguments. This describes elaboration's task; whether it succeeds, and the exact instance names, are not checked here.
S05 · theorem_application
Before
S
After
\Gamma\vdash S:\mathrm{Prop}\quad(\text{conditional on}\ \mathsf{Elab}(s)=S)Conditions: \mathsf{Elab}(s)=S
Rule: prop_formation · Uses: S04
Leaf basis: prop_formation + lean_core_notation
Given the shape from S04, the typing rules show layer by layer that S has type Prop: first the two atomic propositions (S05.1), then the implication (S05.2), finally the two universal quantifiers (S05.3). This is a hand type analysis, not the output of the type checker.
S06 · implies
Before
\mathsf{Elab}(s)=S\ \wedge\ \Gamma\vdash S:\mathrm{Prop}After
s\ \text{expresses a formal statement in}\ EConditions: \mathsf{Elab}(s)=S\ \text{(not run)}
Rule: mko_lean_formal_statement_def · Uses: S05, S02
Leaf basis: mko_lean_formal_statement_def + lean_stages
Apply the MKO definition as a conditional: if s elaborates in E to S with Γ⊢S:Prop, then s expresses a formal statement in E. The typing half of the antecedent was obtained by hand in S05, assuming elaboration succeeds; elaboration itself was not run (G2). The recorded status is therefore 'expected to express a formal statement in E; elaboration receipt missing'.
S07 · definition
Before
\Gamma\vdash p:S
After
p=\lambda (a\,b:\mathrm{Nat})\,(h:a\le b).\ q,\quad a,b:\mathrm{Nat},\ h:a\le b\ \vdash\ q:a<b+1Conditions: none
Rule: curry_howard · Uses: S04
Leaf basis: curry_howard
By propositions as types, a proof term of S is a function: it takes arbitrary a, b : Nat and a proof h of the hypothesis a≤b, and returns a proof q of a<b+1. The bound variables a and b are data and h is the hypothesis; the obligation is to produce, for arbitrary a, b and h, a proof of a<b+1. This is exactly the shape of the informal proof in S09.
S08 · implies
Before
\forall a\,b,\ a\le b\to a<b+1
After
(a,b)=(3,3):\ 3\le 3\to 3<4;\quad (a,b)=(5,2):\ 5\le 2\to 5<3
Conditions: none
Rule: forall_elim · Uses: S03
Leaf basis: forall_elim + numeric_evaluation
Use two instances to see what the statement says. For a=b=3 the hypothesis 3≤3 holds and the conclusion 3<4 holds too. For a=5, b=2 the hypothesis 5≤2 fails, and the statement demands nothing about 5<3 for this pair (in the classical reading the implication is vacuously true). The hypothesis restricts which pairs the conclusion is claimed for.
S09 · theorem_application
Before
\forall a,b\in\mathbb{N},\ a\le b\Rightarrow a<b+1After
\text{true in}\ \mathbb{N}\ \text{(informal proof)}Conditions: none
Rule: L_main · Uses: S03
Leaf basis: order_basics + forall_intro + imp_intro
Apply Lemma L_main (proved in S09.1 and S09.2): in the standard natural numbers the mathematical content of the statement holds. This is an informal mathematical proof and corresponds to the plan for constructing q in S07.
S10 · implies
Before
\text{informal proof of the content of}\ SAfter
\mathsf{Parse},\ \mathsf{Elab},\ \mathsf{Kernel}:\ \text{not run};\ p:\ \text{not constructed}Conditions: none
Rule: mko_lean_formal_statement_def · Uses: S06, S07, S09
Leaf basis: mko_lean_formal_statement_def + lean_stages + mko_proposition_def
Collect the states. S09 proved that the mathematical content of the statement is true in standard ℕ and gave the plan for q in S07; but it is not a Lean proof term and nothing passed a kernel check. So the status table is: parsing not run; elaboration not run; Prop typing by hand analysis only (S05, conditional on elaboration); proof term not constructed; kernel check not run. By the MKO, a formal statement and its checked proof term are separate states, and this guide advances only the conceptual analysis of the former.
S11 · implies
Before
s'=\texttt{∀ (a : Nat), a - 1 < a}After
\Gamma\vdash S':\mathrm{Prop}\quad(\text{conditional on}\ \mathsf{Elab}(s'))Conditions: \mathsf{Elab}(s')\ \text{succeeds (not run)}
Rule: prop_formation · Uses: G4, S05
Leaf basis: prop_formation + lean_core_notation
Redo the type analysis of S05 for s′: a−1 is a value of HSub Nat Nat Nat with type Nat; LT.lt (a−1) a : Prop; quantifying over a : Nat still gives a Prop. So if s′ elaborates, it too expresses a formal statement.
S12 · implies
Before
\forall a:\mathrm{Nat},\ a-1<aAfter
a=0:\ 0-1=0,\ \neg(0<0)\ \Rightarrow\ \neg\forall a,\ a-1<a
Conditions: \text{truncated subtraction on Nat}
Rule: quantifier_negation · Uses: S11
Leaf basis: nat_trunc_sub + quantifier_negation + order_basics
Under truncated subtraction on Nat, a=0 gives 0−1=0 (S12.1), and 0<0 fails (S12.2). A counterexample exists, so by quantifier negation the content of S′ is false in the standard reading. S′ is a Prop (S11) but not a true one: being a proposition does not mean being proved true (mko_proposition_def).
S13 · implies
Before
s''=\texttt{∀ (a : Int), a - 1 < a}After
\forall a\in\mathbb{Z},\ a-1<a\ \text{(true)};\quad S''\ne S'Conditions: \text{ring subtraction on Int}
Rule: order_basics · Uses: G4, S12
Leaf basis: order_basics + nat_trunc_sub
On Int subtraction is the usual ring subtraction. For every integer a, −1<0, and adding a to both sides gives a−1<a, so the content of S″ is true. s′ and s″ differ only in one type name, but the bound variable's type and the subtraction differ, so they are different core terms with different truth values. Types and environment are part of statement identity (MKO assumption a1).
S14 · implies
Before
t_0=\texttt{a ≤ b → a < b + 1}After
\text{meaning of}\ t_0\ \text{depends on}\ \Gamma\ \text{and elaborator options}Conditions: none
Rule: mko_lean_formal_statement_def · Uses: S01, S03
Leaf basis: mko_lean_formal_statement_def + lean_stages
Take the text t0 without binders. If the local context is Γ′=(a b : Nat), t0 would be read as a statement about those two local variables; in E's empty Γ, a and b are not declared names, so elaboration may fail or may treat them differently depending on elaborator options (such as automatic implicit binding), and this guide does not predict which. So a receipt must record Γ and the options; the same text in different contexts is not the same statement.
Substeps and lemmas
S05.1 · implies
Before
\Gamma_1=(a:\mathrm{Nat},\ b:\mathrm{Nat})After
\Gamma_1\vdash b+1:\mathrm{Nat},\ \Gamma_1\vdash a\le b:\mathrm{Prop},\ \Gamma_1\vdash a<b+1:\mathrm{Prop}Conditions: none
Rule: lean_core_notation · Uses: S04
Leaf basis: lean_core_notation
In the context Γ1 obtained by adding the two bound variables: the output type of HAdd Nat Nat Nat is Nat, so b+1 : Nat; LE.le and LT.lt have type Nat → Nat → Prop, and applying them to two Nat terms gives a Prop.
S05.2 · implies
Before
\Gamma_1\vdash a\le b:\mathrm{Prop},\ \Gamma_1\vdash a<b+1:\mathrm{Prop}After
\Gamma_1\vdash (a\le b\to a<b+1):\mathrm{Prop}Conditions: none
Rule: prop_formation · Uses: S05.1
Leaf basis: prop_formation
By rule (i): an implication between two Props is a Prop.
S05.3 · implies
Before
\Gamma_1\vdash (a\le b\to a<b+1):\mathrm{Prop}After
\Gamma\vdash \forall a:\mathrm{Nat},\ \forall b:\mathrm{Nat},\ (a\le b\to a<b+1):\mathrm{Prop}Conditions: \mathrm{Nat}:\mathrm{Type}=\mathrm{Sort}\ 1
Rule: prop_formation · Uses: S05.2
Leaf basis: prop_formation
Apply rule (ii) twice: first bind b in the context (a:Nat), giving ∀b:Nat, (a≤b → a<b+1) : Prop; then bind a in the empty context Γ. Since Nat : Type and Prop is impredicative, quantifying a Prop over any type gives a Prop. The three sub-steps together give the conclusion of S05.
S09.1 · implies
Before
0<1
After
b<b+1
Conditions: b\in\mathbb{N}
Rule: order_basics · Uses: order_basics
Leaf basis: order_basics
From 0<1, add b to both sides (order is preserved by addition) to get b<b+1. View ℕ inside ℝ with the same order.
S09.2 · implies
Before
a\le b,\ b<b+1
After
a<b+1
Conditions: a\le b
Rule: case_analysis · Uses: S09.1, order_basics
Leaf basis: case_analysis + order_basics + eq_replace + imp_intro + forall_intro
a≤b means a<b or a=b. If a<b, transitivity with b<b+1 gives a<b+1; if a=b, replacing b by a in b<b+1 gives a<b+1 directly. Both cases reach the conclusion; since a and b were arbitrary, discharging the hypothesis and generalizing proves L_main.
S12.1 · implies
Before
0-1\ \text{in Nat}After
0-1=0
Conditions: 0\le 1
Rule: nat_trunc_sub · Uses: nat_trunc_sub
Leaf basis: nat_trunc_sub
Since 0≤1, truncated subtraction gives 0−1=0, not −1; −1 is not a natural number.
S12.2 · equivalent
Before
0-1<0
After
0<0,\ \text{which is false}Conditions: none
Rule: eq_replace · Uses: S12.1, order_basics
Leaf basis: eq_replace + order_basics
Replacing 0−1 by 0, the claim 0−1<0 is equivalent to 0<0; by trichotomy, 0=0 rules out 0<0.