You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trust was previously discussed in an informal way.
Trust is now defined along three axes: proof authors, verification software, and correctness of statement.
The trust definition is also referred to in "Elaboration and Compilation".
Copy file name to clipboardExpand all lines: Manual/Elaboration.lean
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,7 @@ where
76
76
77
77
#doc (Manual) "Elaboration and Compilation" =>
78
78
%%%
79
+
tag := "elaboration-compilation"
79
80
htmlSplit := .never
80
81
%%%
81
82
@@ -94,12 +95,12 @@ Roughly speaking, Lean's processing of a source file can be divided into the fol
94
95
: Elaboration
95
96
96
97
{deftech (key := "Lean elaborator") -normalize}[Elaboration] is the process of transforming Lean's user-facing syntax into its core type theory.
97
-
This core theory is much simpler, enabling the trusted kernel to be very small.
98
+
This core theory is much simpler, enabling the {tech (key := "trust")}[trusted] kernel to be very small.
98
99
Elaboration additionally produces metadata, such as proof states or the types of expressions, used for Lean's interactive features, storing them in a side table.
99
100
100
101
: Kernel Checking
101
102
102
-
Lean's trusted kernel checks the output of the elaborator to ensure that it follows the rules of the type theory.
103
+
Lean's {tech (key := "trust")}[trusted] kernel checks the output of the elaborator to ensure that it follows the rules of the type theory.
Copy file name to clipboardExpand all lines: Manual/ValidatingProofs.lean
+22-11Lines changed: 22 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -29,19 +29,30 @@ htmlSplit := .never
29
29
30
30
This section discusses how to validate a proof expressed in Lean.
31
31
32
-
Depending on the circumstances, additional steps may be recommended to rule out misleading proofs.
33
-
In particular, it matters a lot whether one is dealing with an {tech}[honest] proof attempt, and needs protection against only benign mistakes, or a possibly-{tech}[malicious] proof attempt that actively tries to mislead.
32
+
The steps needed to rule out a misleading proof depend on the author's {deftech}[trust] assumptions towards the _proof author_ (including authors that proved depended-upon theorems), the _verification software_, and the _correctness of the statement_.
34
33
35
-
In particular, we use {deftech}_honest_ when the goal is to create a valid proof.
36
-
This allows for mistakes and bugs in proofs and meta-code (tactics, attributes, commands, etc.), but not for code that clearly only serves to circumvent the system (such as using the {option}`debug.skipKernelTC`).
37
-
Note that the {keyword}`unsafe` marker on API functions is unrelated to whether this API can be used in an dishonest way.
34
+
* Regarding the _proof author_, it matters a lot whether one is dealing with an {tech}[honest] proof attempt, and needs protection against only benign mistakes, or a possibly-{tech}[malicious] proof attempt that actively tries to mislead.
38
35
39
-
In contrast, we use {deftech}_malicious_ to describe code that goes out of its way to trick or mislead the user, exploit bugs or compromise the system.
40
-
This includes un-reviewed AI-generated proofs and programs.
36
+
In particular, we use {deftech}_honest_ when the goal is to create a valid proof.
37
+
This allows for mistakes and bugs in proofs and meta-code (tactics, attributes, commands, etc.), but not for code that clearly only serves to circumvent the system (such as using the {option}`debug.skipKernelTC`).
38
+
Note that the {keyword}`unsafe` marker on API functions is unrelated to whether this API can be used in an dishonest way.
41
39
42
-
Furthermore it is important to distinguish the question “does the theoremhaveavalidproof”from “whatdoesthetheoremstatementmean”.
40
+
In contrast, we use {deftech}_malicious_ to describe code that goes out of its way to trick or mislead the user, exploit bugs or compromise the system.
41
+
This includes un-reviewed AI-generated proofs and programs.
42
+
43
+
* Regarding the verification software, Lean takes {ref "elaboration-compilation"}[a number of steps] to process a theoremanditsproof.
Ataminimum,theLeankerneloranalternativekernelsuchas [`nanoda`](https://github.com/ammkrn/nanoda_lib) has to be trusted.
46
+
47
+
* Regarding the correctness of the statement, it is important to distinguish the question “does the theoremhaveavalidproof”from “whatdoesthetheoremstatementmean”.
48
+
Nomatterwhatsoftwareisusedandhowtrustedtheenvironmentis,atheoremismeaningfulonlyifitsauthor(s) and user(s) are certain that its statement mathematically expresses its intended informal meaning.
49
+
50
+
As written, the statement is {tech (key := "Lean elaborator")}[elaborated] before being passed to the kernel.
51
+
To avoid trusting the {tech (key := "Lean elaborator")}[elaborator], one has to {keywordOf Lean.Parser.Command.print}`#print` the statement to get the elaborated type and manually verify that it indeed expresses the desired statement.
52
+
This brings {keywordOf Lean.Parser.Command.print}`#print` into the trusted base, which is less than 1000 lines of code.
43
53
44
54
Below, an escalating sequence of checks are presented, with instructions on how to perform them, an explanation of what they entail and the mistakes or attacks they guard against.
55
+
To avoid repetition, we will not discuss trust towards the correctness of the statement every time.
45
56
46
57
# The Blue Double Check Marks
47
58
%%%
@@ -64,7 +75,7 @@ The blue ticks indicate that the theorem statement has been successfully elabora
64
75
65
76
## Trust
66
77
67
-
Thischeckismeaningfulifonebelievestheformaltheoremstatementcorrespondstoitsintendedinformalmeaningsandtruststheauthorsoftheimportedlibrariestobe {tech}[honest], that they checked that the theorems in their libraries express their intended informal meanings, and that no unsound axioms have been declared and used.
78
+
Thischeckismeaningfulifonetruststheauthorsoftheimportedlibrariestobe {tech}[honest], that they checked that the theorems in their libraries express their intended informal meanings, and that no unsound axioms have been declared and used.
68
79
69
80
## Protection
70
81
@@ -115,7 +126,7 @@ The three axioms above are standard axioms of Lean's logic, and benign.
@@ -145,7 +156,7 @@ It trusts that the {tech}[`.olean` files] are structurally correct.
145
156
146
157
## Trust
147
158
148
-
This check is meaningful if one believes the formal theoremstatementcorrespondstoitsintendedinformalmeaningsandbelievestheauthorsoftheimportedlibrariestonotbeverycunningly {tech}[malicious], and to neither compromise the user’s system nor use Lean’s extensibility to change the interpretation of the theoremstatement.
159
+
This check is meaningful if one believes the authors of the imported libraries to not be very cunningly {tech}[malicious], and to neither compromise the user’s system nor use Lean’s extensibility to change the interpretation of the theoremstatement.
0 commit comments