Skip to content

Commit 367579a

Browse files
chore: bump to 2026-08-31 (#932)
1 parent 6698db1 commit 367579a

9 files changed

Lines changed: 194 additions & 48 deletions

File tree

.vale/styles/config/ignore/terms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ invalidField
102102
iterator
103103
iterator's
104104
iterators
105+
Landlock
105106
letterlike
106107
linearization
107108
linearize

Manual/Axioms.lean

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Because they occur only in a proof, the compiler has no problem generating code:
181181
tag := "standard-axioms"
182182
%%%
183183

184-
There are seven standard axioms in Lean. The first three axioms are important parts of how mathematics is done in Lean:
184+
There are four standard axioms in Lean. The first three axioms are important parts of how mathematics is done in Lean:
185185
* ```signature
186186
Classical.choice.{u} {α : Sort u} : Nonempty α → α
187187
```
@@ -202,40 +202,11 @@ Uses of this axiom are not intended to occur in finished proofs, as it can be us
202202
sorryAx {α : Sort u} (synthetic := true) : α
203203
```
204204

205-
Three final axioms do not truly exist for their _mathematical_ content; from a mathematical perspective they prove trivial statements:
206-
207-
* ```signature
208-
Lean.trustCompiler : True
209-
```
210-
211-
* ```signature
212-
Lean.ofReduceBool (a b : Bool) : Lean.reduceBool a = b → a = b
213-
```
214-
* ```signature
215-
Lean.ofReduceNat (a b : Nat) : Lean.reduceNat a = b → a = b
216-
```
217-
218-
These axioms instead track proofs that depend on the correctness of the entire compiler, and not just on the much smaller {tech}`kernel`.
219-
220-
:::example "Creating and Tracking Proofs That Trust the Compiler"
221-
The functions {name}`Lean.reduceBool` and {name}`Lean.reduceNat` can be invoked to have the compiler perform a calculation; this can greatly improve performance of implementations of proof by reflection.
222-
223-
```lean
224-
def largeNumber : Nat := Lean.reduceNat (230_000 + 4_500 + 1_000_067)
225-
```
226-
227-
The resulting term depends on the axiom {name}`Lean.trustCompiler` in order to track the fact that this calculation depends on the correctness of the compiler.
228-
229-
```lean (name := printAxExC1)
230-
#print axioms largeNumber
231-
```
232-
```leanOutput printAxExC1
233-
'largeNumber' depends on axioms: [Lean.trustCompiler]
234-
```
235-
:::
205+
In addition to the standard axioms, proofs by native evaluation introduce a dedicated axiom for each computation that is asserted by the compiled code.
206+
These axioms track proofs that depend on the correctness of the entire compiler, and not just on the much smaller {tech}`kernel`.
236207

237208
:::example "Axioms and the `native_decide` Tactic"
238-
Instead of appealing to {name}`Lean.trustCompiler`, the {tactic}`native_decide` tactic creates a bespoke axiom for each invocation.
209+
The {tactic}`native_decide` tactic creates a bespoke axiom for each invocation.
239210
This allows each axiom to be audited for the precise statement that it proves.
240211

241212
```lean (name := printAxExC2)

Manual/BasicTypes/BitVec.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ tag := "BitVec-automation"
166166
%%%
167167

168168
In addition to the full suite of automation and tools provided by Lean for every type, the {tactic}`bv_decide` tactic can solve many bitvector-related problems.
169-
This tactic invokes an external automated theorem prover (`cadical`) and reconstructs the proof that it provides in Lean's own logic.
170-
The resulting proofs rely only on the axiom {name}`Lean.ofReduceBool`; the external prover is not part of the trusted code base.
169+
This tactic invokes an external automated theorem prover (`cadical`) and validates the certificate returned by the prover with a checker that's written in Lean and proved sound.
170+
This verified checker is run as native code because reducing it in the kernel is not feasible for performance reasons.
171+
Because the kernel does not execute native code, the resulting proof relies on a dedicated axiom that asserts the outcome of the native computation; the external prover is not part of the trusted code base.
171172

172173
:::example "Popcount"
173174

Manual/BasicTypes/Float.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ Floating-point numbers fall into one of three categories:
359359
### Inequalities
360360

361361
The decision procedures for inequalities are opaque constants in the logic.
362-
They can only be used via the {name}`Lean.ofReduceBool` axiom, e.g. via the {tactic}`native_decide` tactic.
362+
They can only be used via native evaluation, e.g. via the {tactic}`native_decide` tactic.
363363

364364
{docstring Float.le}
365365

Manual/BuildTools/Lake/CLI.lean

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ COMMANDS:
4242
check-lint check if there is a properly configured lint driver
4343
clean remove build outputs
4444
shake minimize imports in source files
45+
challenge judge a solution against a challenge
4546
env <cmd> <args>... execute a command in Lake's environment
4647
lean <file> elaborate a Lean file in Lake's context
4748
update update dependencies and save them to the manifest
@@ -821,6 +822,176 @@ The {lakeMeta}`options` may be:
821822

822823
::::
823824

825+
# Challenges and External Checkers
826+
%%%
827+
tag := "lake-challenge"
828+
%%%
829+
830+
Lake supports invoking {ref "validating-comparator"}[`comparator`] to validate a proof against a challenge, including the use of external checkers.
831+
This should only be necessary in high-risk scenarios, such as proof marketplaces, high-reward competitions, or when dealing with potentially unaligned AI systems.
832+
833+
```lakeHelp challenge
834+
Judge a solution against a challenge
835+
836+
USAGE:
837+
lake challenge --config <FILE>
838+
839+
Establishes that every named theorem in the solution proves the same statement
840+
as the challenge, uses no axiom outside the permitted list, and is accepted by
841+
the kernel.
842+
843+
The project is untrusted input: its configuration is evaluated, and its code
844+
built and exported, inside a `landrun` sandbox, and none of its `.olean` files
845+
is ever loaded into Lake's own address space. `landrun` is required; there is
846+
no unsandboxed mode, so this command is available on Linux only.
847+
848+
The project has to carry a `lake-manifest.json`, because dependencies are
849+
resolved inside the sandbox and it cannot write to the project directory.
850+
Building the project once, before distributing it, is enough to write one.
851+
852+
OPTIONS:
853+
--config=<file> JSON file describing the challenge (see below)
854+
855+
CONFIGURATION:
856+
The challenge author writes the file and distributes it with the project, so
857+
that a solver need only point `lake challenge` at it:
858+
859+
{
860+
"challenge_module": "Challenge",
861+
"solution_module": "Solution",
862+
"theorem_names": ["imo2024_p1"],
863+
"definition_names": [],
864+
"permitted_axioms": ["propext", "Quot.sound", "Classical.choice"],
865+
"external_kernels": {"nanoda": ["nanoda_bin"]}
866+
}
867+
868+
`challenge_module`, `solution_module`, `theorem_names` and
869+
`permitted_axioms` are required; the rest may be omitted.
870+
`definition_names` lists the challenge's definition holes.
871+
`permitted_axioms` is deliberately not defaulted: it is what the verdict
872+
means, so the challenge author states it. The three above are the ones
873+
`#print axioms` treats as a clean proof.
874+
875+
`external_kernels` names additional checkers to run over the export, each as
876+
the command to execute; the solution must satisfy every one of them as well
877+
as Lean's own kernel. `enable_nanoda: true` is still accepted and is
878+
equivalent to a "nanoda" entry of ["nanoda_bin"]; name the command in
879+
`external_kernels` instead to run it from elsewhere.
880+
881+
EXIT CODES:
882+
0 accepted
883+
1 rejected: statement mismatch, forbidden axiom, kernel
884+
rejection, or a build that did not succeed
885+
2 could not start: `landrun` or the manifest is missing,
886+
or the configuration is missing, unreadable or
887+
malformed
888+
889+
ENVIRONMENT:
890+
COMPARATOR_LANDRUN sandbox executable (default: `landrun` on PATH)
891+
892+
The exporter is always the `leanexport` of this toolchain, and deliberately
893+
not configurable: the export format has to match the compiler that produced
894+
the `.olean` files being exported.
895+
896+
HARDENING:
897+
The sandbox bounds writes and TCP connections: only `.lake` is writable, and
898+
only dependency resolution may connect, on the ports git's transports use.
899+
It does not bound reads, execution, or non-TCP traffic.
900+
901+
Until the Landlock fix released in Linux 7.1 is widely available, `landrun`
902+
can be escaped through an `AF_UNIX` socket. Where that matters, run the
903+
command under a wrapper that removes the capability:
904+
905+
systemd-run --user --pty --property=RestrictAddressFamilies=~AF_UNIX \
906+
lake challenge --config challenge.json
907+
```
908+
909+
::::lake challenge "\"--config\" file"
910+
911+
Judges a solution against a {deftech}_challenge_: a trusted configuration that states which theorems must be proved and which axioms are permitted.
912+
{lake}`challenge` establishes that every named theorem in the solution proves the same statement as the challenge, that the solution uses only permitted axioms, and that it is accepted by Lean's kernel as well as by every configured external kernel.
913+
914+
The current Lake workspace is considered to be the {deftech}_solution_ project: it should satisfy the specification provided by the challenge.
915+
The solution is considered untrusted input.
916+
Its configuration is evaluated, and its code built and exported, inside a [`landrun`](https://github.com/Zouuup/landrun) sandbox, and its {tech}[`.olean` files] are kept out of Lake's own address space.
917+
Because `landrun` is required, the command is only available on Linux.
918+
The `landrun` executable name is determined by the {envVar +def}`COMPARATOR_LANDRUN` environment variable, defaulting to `landrun` if this is not set.
919+
The executable is resolved via the {envVar}`PATH`.
920+
The export is produced by the toolchain's own `leanexport` executable, so the export format matches the compiler that produced the {tech}[`.olean` files].
921+
922+
The challenge author writes the {ref "lake-challenge-config"}[configuration file] in JSON format and distributes it with the challenge.
923+
Solutions are checked by using {lake}`challenge` with {lakeOptDef option}`--config=FILE`.
924+
925+
The exit code distinguishes an accepted solution (`0`) and a rejected one (`1`) from an environment in which the judgment could not run at all (`2`).
926+
927+
This command is a frontend to the [`comparator`](https://github.com/leanprover/comparator) proof-checking pipeline; {ref "validating-comparator"}[the section on validating proofs] describes the security model and the assumptions that remain.
928+
::::
929+
930+
## Configuration
931+
%%%
932+
tag := "lake-challenge-config"
933+
%%%
934+
935+
:::paragraph
936+
The challenge configuration is a JSON file that contains an object with the following keys:
937+
938+
: `challenge_module` (required)
939+
940+
The name of the {tech}[challenge] module.
941+
942+
: `solution_module` (required)
943+
944+
The name of the {tech}[solution] module to be checked.
945+
946+
: `theorem_names` (required)
947+
948+
An array of theorem names.
949+
These theorems should be complete in the solution, but {lean}`sorry` in the challenge.
950+
951+
: `permitted_axioms` (required)
952+
953+
An array of axiom names that are permitted in the solution.
954+
955+
: `definition_names`
956+
957+
An array of names of definitions that should be filled out in the solution.
958+
959+
: `external_kernels`
960+
961+
An object in which each key names an external checker.
962+
The value associated with the key is the command to be run, and must be a non-empty array of strings.
963+
The first element in the array is the executable (found via {envVar}`PATH`), and the remaining elements are its arguments.
964+
965+
Each checker runs in the sandbox with one further argument appended to its command.
966+
A checker whose name contains `noda` receives the path to a generated `nanoda`-style configuration file that specifies the export file and the permitted axioms, while every other checker receives the path to a file that contains the {tech}[solution]'s export.
967+
A checker signals acceptance by exiting successfully, and the solution must be accepted by every configured checker in addition to Lean's kernel.
968+
969+
: `enable_nanoda`
970+
971+
A Boolean for which `true` is equivalent to an `external_kernels` entry that maps `"nanoda"` to `["nanoda_bin"]`.
972+
It may be `true` only when `external_kernels` is empty or omitted.
973+
974+
:::
975+
976+
## Sandbox
977+
978+
:::paragraph
979+
The sandbox restricts only filesystem writes and outbound TCP connections:
980+
981+
* Writes are confined to the project's `.lake` directory.
982+
* Only dependency resolution may open connections, on ports 443 and 22, the ports used by git's `https` and `ssh` transports.
983+
984+
Reads, execution, and network traffic other than TCP are unrestricted.
985+
:::
986+
987+
On Linux kernels that predate the Landlock fix released in Linux 7.1, `landrun` can be escaped through an `AF_UNIX` socket.
988+
Where that matters, run the command under a wrapper that removes the capability:
989+
990+
```
991+
systemd-run --user --pty --property=RestrictAddressFamilies=~AF_UNIX \
992+
lake challenge --config challenge.json
993+
```
994+
824995
# Development Tools
825996

826997
Lake includes support for specifying standard development tools and workflows.

Manual/Tactics/Reference.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ tag := "tactic-ref-rw"
302302
:::tactic "erw"
303303
:::
304304

305-
:::tactic Lean.Parser.Tactic.tacticRwa__
305+
:::tactic Lean.Parser.Tactic.rwa
306306
:::
307307

308308
{docstring Lean.Meta.Rewrite.Config +allowMissing}

Manual/ValidatingProofs.lean

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ This command prints the set of axioms used by the theorem and the theorems it de
110110
The three axioms above are standard axioms of Lean's logic, and benign.
111111

112112
* If {name}`sorryAx` is reported, then this theorem or one of its dependencies uses {lean}`sorry` or is otherwise incomplete.
113-
* If {name}`Lean.trustCompiler` is reported, then native evaluation is used; see below for a discussion.
113+
* If axioms with {lit}`_native` in their names are reported, then {ref "validating-trustCompiler"}[native evaluation] is used.
114114
* Any other axiom means that a custom axiom was declared and used, and the theorem is only valid relative to the soundness of these axioms.
115115

116116
## Trust
@@ -178,7 +178,8 @@ This should only be necessary for high risk scenarios (proof marketplaces, high-
178178

179179
## Instructions
180180

181-
In a trusted environment, write the theorem *statement* (the “challenge”), and then feed the challenge as well as the proposed proof to the [`comparator`](https://github.com/leanprover/comparator) tool, with external checkers enabled, as documented there.
181+
In a trusted environment, write the theorem *statement* (the “challenge”), and then judge the proposed proof against it with {ref "lake-challenge"}[`lake challenge`], with external checkers enabled.
182+
This command is a frontend to the [`comparator`](https://github.com/leanprover/comparator) tool.
182183

183184
## Significance
184185

@@ -227,11 +228,12 @@ This is used by the {tactic}`decide`{keywordOf Lean.Parser.Tactic.decide}` +nati
227228
Specific uses wrapped in {tech}[honest] tactics (e.g. {tactic}`bv_decide`) are generally trustworthy.
228229
The trusted code base is larger (it includes Lean's compilation toolchain and library annotations in the standard library), but still fixed and vetted.
229230

230-
General use ({tactic}`decide`{keywordOf Lean.Parser.Tactic.decide}` +native` or direct use of {name}`Lean.ofReduceBool`) can be used to create invalid proofs whenever the native evaluation of a term disagrees with the kernel's evaluation.
231+
In general, native computation ({tactic}`decide`{keywordOf Lean.Parser.Tactic.decide}` +native` or direct use of {lit}`Lean.ofReduceBool`) can be used to create invalid proofs whenever the native evaluation of a term disagrees with the kernel's evaluation.
231232
In particular, for every {attr}`implemented_by`/{attr}`extern` attribute in libraries it becomes part of the trusted code base that the replacement is semantically equivalent.
232233

233-
All these uses show up as an axiom {name}`Lean.trustCompiler` in {keywordOf Lean.Parser.Command.printAxioms}`#print axioms`.
234+
All these uses show up as an axiom {lit}`Lean.trustCompiler` in {keywordOf Lean.Parser.Command.printAxioms}`#print axioms`.
234235
External checkers (`lean4checker`, `comparator`) cannot check such proofs, as they do not have access to the Lean compiler.
235236
When that level of checking is needed, proofs have to avoid using native evaluation.
236237

237-
Since Lean 4.29.0, the {tactic}`decide`{keywordOf Lean.Parser.Tactic.decide}` +native` and {tactic}`bv_decide` tactics no longer use {name}`Lean.trustCompiler`, but instead introduce one dedicated axiom for each computation that is asserted by native computation. The {name}`Lean.trustCompiler` machinery is deprecated and will eventually be removed.
238+
Since Lean 4.29.0, the {tactic}`decide`{keywordOf Lean.Parser.Tactic.decide}` +native` and {tactic}`bv_decide` tactics introduce one dedicated axiom for each computation that is asserted by native computation.
239+
The {lit}`Lean.trustCompiler` machinery was removed from Lean in version 4.35.0.

lake-manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "git",
66
"subDir": null,
77
"scope": "",
8-
"rev": "e9135801a2aeabf99ce43eb58e6331bd3afa1adc",
8+
"rev": "796cfdb6eb682e191fb0ccc7da9de4b018dd7f0d",
99
"name": "verso",
1010
"manifestFile": "lake-manifest.json",
1111
"inputRev": "nightly-testing",
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "76f052847294d189dc9924a33466b4b677f47e67",
18+
"rev": "6e558472c981dbee8cb9fcde92fa9593daf04228",
1919
"name": "illuminate",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": "main",
@@ -25,7 +25,7 @@
2525
"type": "git",
2626
"subDir": null,
2727
"scope": "",
28-
"rev": "c271f30a1bf40c7292e1a82c9d5e6f3e389c23b3",
28+
"rev": "3094dd5215be009cacc296f17356b395dc44d0f8",
2929
"name": "versowebcomponents",
3030
"manifestFile": "lake-manifest.json",
3131
"inputRev": "main",
@@ -35,7 +35,7 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "",
38-
"rev": "38e9c3ce15cbb63c92e90bb9a92e4eb82131f669",
38+
"rev": "d9598f07b1bc701f1e3aae163d2681c1fd978793",
3939
"name": "plausible",
4040
"manifestFile": "lake-manifest.json",
4141
"inputRev": "main",
@@ -55,7 +55,7 @@
5555
"type": "git",
5656
"subDir": null,
5757
"scope": "",
58-
"rev": "847084e80500726e4331dded5f17007ddaf89c31",
58+
"rev": "fda188f7329fa18ce4b2e8cc96c9b0a8f0c78c46",
5959
"name": "subverso",
6060
"manifestFile": "lake-manifest.json",
6161
"inputRev": "main",

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:nightly-2026-08-27
1+
leanprover/lean4:nightly-2026-08-31

0 commit comments

Comments
 (0)