<?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%2FSystem%2FLake_and_Lean_projects</id>
	<title>Lean theorem prover/System/Lake and Lean projects - 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%2FSystem%2FLake_and_Lean_projects"/>
	<link rel="alternate" type="text/html" href="https://invarians.org/index.php?title=Lean_theorem_prover/System/Lake_and_Lean_projects&amp;action=history"/>
	<updated>2026-10-21T10:22:23Z</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/System/Lake_and_Lean_projects&amp;diff=6795&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/System/Lake_and_Lean_projects&amp;diff=6795&amp;oldid=prev"/>
		<updated>2026-10-15T19:35:19Z</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:Lake and Lean projects}}&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:Lake and Lean projects}}&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/A library of mathematics}}&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/A library of mathematics}}&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;A single Lean source file can be checked with the command &amp;lt;code&amp;gt;lean&amp;lt;/code&amp;gt;. Anything larger,&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;A single Lean source file can be checked with the command &amp;lt;code&amp;gt;lean&amp;lt;/code&amp;gt;. Anything larger,&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/System/Lake_and_Lean_projects&amp;diff=6588&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/System/Lake_and_Lean_projects&amp;diff=6588&amp;oldid=prev"/>
		<updated>2026-10-14T18:01:09Z</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:Lake and Lean projects}}&lt;br /&gt;
{{Plebeian|Lean theorem prover/Explainers/A library of mathematics}}&lt;br /&gt;
&lt;br /&gt;
A single Lean source file can be checked with the command &amp;lt;code&amp;gt;lean&amp;lt;/code&amp;gt;. Anything larger,&lt;br /&gt;
a library of hundreds of files or a program with dependencies, is organised as a &amp;#039;&amp;#039;&amp;#039;Lake&lt;br /&gt;
package&amp;#039;&amp;#039;&amp;#039; and compiled by &amp;#039;&amp;#039;&amp;#039;Lake&amp;#039;&amp;#039;&amp;#039;, Lean&amp;#039;s build tool, which ships with every version of&lt;br /&gt;
Lean. Which version of Lean a project uses is fixed by a one-line file and enforced by&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;elan&amp;#039;&amp;#039;&amp;#039;, the toolchain manager. This page shows a minimal project as files, the commands&lt;br /&gt;
that compile and test it, and how dependencies are pinned, all with Lean 4.34.1 and the Lake&lt;br /&gt;
that comes with it.&lt;br /&gt;
&lt;br /&gt;
== The toolchain ==&lt;br /&gt;
&lt;br /&gt;
A Lean &amp;#039;&amp;#039;&amp;#039;toolchain&amp;#039;&amp;#039;&amp;#039; is the set of programs and files for one version of Lean, among them&lt;br /&gt;
&amp;lt;code&amp;gt;lean&amp;lt;/code&amp;gt; itself, &amp;lt;code&amp;gt;lake&amp;lt;/code&amp;gt;, a C compiler (&amp;lt;code&amp;gt;leanc&amp;lt;/code&amp;gt;, a version of Clang), the&lt;br /&gt;
program &amp;lt;code&amp;gt;leanchecker&amp;lt;/code&amp;gt;, and the compiled standard library and runtime. Toolchains&lt;br /&gt;
are installed and selected by elan.&amp;lt;ref name=&amp;quot;rm-bt&amp;quot;&amp;gt;&amp;quot;Build Tools and Distribution&amp;quot;, a chapter of &amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039; (edition covering Lean 4.34.0). [https://lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/ lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;lean&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lake&amp;lt;/code&amp;gt; commands a user types are small proxies installed&lt;br /&gt;
by elan. Each looks for a file named &amp;lt;code&amp;gt;lean-toolchain&amp;lt;/code&amp;gt; in the current directory and&lt;br /&gt;
its parents, reads the toolchain named there, installs it if it is missing, and runs the&lt;br /&gt;
program from that toolchain. A command can also name a toolchain directly, as in&lt;br /&gt;
&amp;lt;code&amp;gt;lake +leanprover/lean4:v4.34.1 new greeting&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;rm-elan&amp;quot;&amp;gt;&amp;quot;Managing Toolchains with Elan&amp;quot;, section 24.2 of &amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039; (edition covering Lean 4.34.0). [https://lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/Managing-Toolchains-with-Elan/ lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/Managing-Toolchains-with-Elan/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file holds one line:&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;leanprover/lean4:v4.34.1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part before the colon names where toolchains come from, and the part after it the&lt;br /&gt;
version. A project&amp;#039;s file should name an exact version, not a channel such as&lt;br /&gt;
&amp;lt;code&amp;gt;stable&amp;lt;/code&amp;gt;, so that everyone working on it uses the same Lean. Changing the version&lt;br /&gt;
is a one-line edit; the new toolchain is downloaded the next time it is&lt;br /&gt;
needed.&amp;lt;ref name=&amp;quot;rm-elan&amp;quot; /&amp;gt; This matters more for a proof assistant than for most&lt;br /&gt;
languages. The elaborator, the tactics and the library change from one version of Lean to&lt;br /&gt;
the next, and a proof that is accepted under one version may fail under another. The&lt;br /&gt;
toolchain file records under which version a body of proofs was checked.&lt;br /&gt;
&lt;br /&gt;
== A minimal Lake package ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lake new greeting&amp;lt;/code&amp;gt; creates a directory with a library, an executable and a&lt;br /&gt;
configuration file. With Lean 4.34.1 the configuration it writes, &amp;lt;code&amp;gt;lakefile.toml&amp;lt;/code&amp;gt;,&lt;br /&gt;
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;name = &amp;quot;greeting&amp;quot;&lt;br /&gt;
version = &amp;quot;0.1.0&amp;quot;&lt;br /&gt;
defaultTargets = [&amp;quot;greeting&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
[[lean_lib]]&lt;br /&gt;
name = &amp;quot;Greeting&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[lean_exe]]&lt;br /&gt;
name = &amp;quot;greeting&amp;quot;&lt;br /&gt;
root = &amp;quot;Main&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first lines describe the Lake package itself. Each &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[lean_lib]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; table&lt;br /&gt;
declares a &amp;#039;&amp;#039;&amp;#039;library&amp;#039;&amp;#039;&amp;#039;, a collection of Lean modules under a root name, here&lt;br /&gt;
&amp;lt;code&amp;gt;Greeting&amp;lt;/code&amp;gt;; each &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[lean_exe]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; declares an &amp;#039;&amp;#039;&amp;#039;executable&amp;#039;&amp;#039;&amp;#039;, a&lt;br /&gt;
program whose Lean module defines &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot;&amp;gt;&amp;quot;Lake&amp;quot;, section 24.1 of &amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039; (edition covering Lean 4.34.0), including 24.1.1 &amp;quot;Concepts and Terminology&amp;quot;, 24.1.1.2 &amp;quot;Builds&amp;quot;, 24.1.1.5 &amp;quot;Test and Lint Drivers&amp;quot; and the TOML configuration reference. [https://lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/Lake/ lean-lang.org/doc/reference/4.34.0/Build-Tools-and-Distribution/Lake/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
The source files follow the names. &amp;lt;code&amp;gt;Greeting.lean&amp;lt;/code&amp;gt; is the root of the library and&lt;br /&gt;
imports its parts:&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;-- This module serves as the root of the `Greeting` library.&lt;br /&gt;
-- Import modules here that should be built as part of the library.&lt;br /&gt;
import Greeting.Basic&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Greeting/Basic.lean&amp;lt;/code&amp;gt; holds the one definition:&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;def hello := &amp;quot;world&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and &amp;lt;code&amp;gt;Main.lean&amp;lt;/code&amp;gt; is the program:&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;import Greeting&lt;br /&gt;
&lt;br /&gt;
def main : IO Unit :=&lt;br /&gt;
  IO.println s!&amp;quot;Hello, {hello}!&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A Lean module&amp;#039;s name is its path: &amp;lt;code&amp;gt;Greeting/Basic.lean&amp;lt;/code&amp;gt; is the Lean module&lt;br /&gt;
&amp;lt;code&amp;gt;Greeting.Basic&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;import Greeting.Basic&amp;lt;/code&amp;gt; refers to it. Lake reads&lt;br /&gt;
the imports to work out the order in which the Lean modules must be compiled.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The configuration can also be written in Lean, as &amp;lt;code&amp;gt;lakefile.lean&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;lake new&lt;br /&gt;
greet2 std.lean&amp;lt;/code&amp;gt; writes:&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;import Lake&lt;br /&gt;
open Lake DSL&lt;br /&gt;
&lt;br /&gt;
package &amp;quot;greet2&amp;quot; where&lt;br /&gt;
  version := v!&amp;quot;0.1.0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
lean_lib «Greet2» where&lt;br /&gt;
  -- add library configuration options here&lt;br /&gt;
&lt;br /&gt;
@[default_target]&lt;br /&gt;
lean_exe &amp;quot;greet2&amp;quot; where&lt;br /&gt;
  root := `Main&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The TOML form is purely declarative. The Lean form is a Lean program and can compute its&lt;br /&gt;
configuration or define new kinds of target.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compiling ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lake build&amp;lt;/code&amp;gt; compiles the default targets and everything they need. In the new&lt;br /&gt;
directory it reports:&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;info: greeting: no previous manifest, creating one from scratch&lt;br /&gt;
info: toolchain not updated; already up-to-date&lt;br /&gt;
✔ [2/8] Built Greeting.Basic (277ms)&lt;br /&gt;
✔ [3/8] Built Greeting.Basic:c.o (58ms)&lt;br /&gt;
✔ [4/8] Built Greeting (225ms)&lt;br /&gt;
✔ [5/8] Built Greeting:c.o (66ms)&lt;br /&gt;
✔ [6/8] Built Main (244ms)&lt;br /&gt;
✔ [7/8] Built Main:c.o (69ms)&lt;br /&gt;
✔ [8/8] Built greeting:exe (289ms)&lt;br /&gt;
Build completed successfully (8 jobs).&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first two lines appear on the first run only, and the times in brackets vary from run&lt;br /&gt;
to run. Each Lean module is elaborated, which produces an &amp;lt;code&amp;gt;.olean&amp;lt;/code&amp;gt; file holding&lt;br /&gt;
its definitions and theorems in compiled form, and C code, which is compiled to an object file (&amp;lt;code&amp;gt;:c.o&amp;lt;/code&amp;gt;); the&lt;br /&gt;
object files are linked into the executable. &amp;lt;code&amp;gt;lake exe greeting&amp;lt;/code&amp;gt; then prints&lt;br /&gt;
&amp;lt;code&amp;gt;Hello, world!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Elaboration includes the Lean kernel&amp;#039;s check of every definition and theorem, so a&lt;br /&gt;
Lake build of a Lean module that finishes without errors or warnings gives the same assurance&lt;br /&gt;
as opening it in an editor and seeing it accepted: every theorem in it, and in everything it&lt;br /&gt;
imports, has been checked. The reference manual makes the comparison explicitly.&amp;lt;ref name=&amp;quot;rm-validating&amp;quot;&amp;gt;&amp;quot;Validating a Lean Proof&amp;quot;, a chapter of &amp;#039;&amp;#039;The Lean Language Reference&amp;#039;&amp;#039; (edition covering Lean 4.34.0), section &amp;quot;The Blue Double Check Marks&amp;quot;. [https://lean-lang.org/doc/reference/4.34.0/ValidatingProofs/ lean-lang.org/doc/reference/4.34.0/ValidatingProofs/]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;lake build&amp;lt;/code&amp;gt; again with nothing changed prints only &amp;lt;code&amp;gt;Build completed&lt;br /&gt;
successfully (8 jobs).&amp;lt;/code&amp;gt; Lake keeps a &amp;#039;&amp;#039;&amp;#039;trace&amp;#039;&amp;#039;&amp;#039; for every output, recording a digest of&lt;br /&gt;
each input from which it was made; when no input has changed, the output is reused and its&lt;br /&gt;
saved messages are replayed instead of being produced again.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt; Lake keeps its&lt;br /&gt;
working state under the directory &amp;lt;code&amp;gt;.lake/&amp;lt;/code&amp;gt;: compiled outputs in&lt;br /&gt;
&amp;lt;code&amp;gt;.lake/build/&amp;lt;/code&amp;gt; and the sources of dependencies in&lt;br /&gt;
&amp;lt;code&amp;gt;.lake/packages/&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lake test&amp;lt;/code&amp;gt; runs the Lake package&amp;#039;s &amp;#039;&amp;#039;&amp;#039;test driver&amp;#039;&amp;#039;&amp;#039;, a target named in the&lt;br /&gt;
configuration. Lake is not a test framework: it finds the driver, compiles it, and, for an&lt;br /&gt;
executable, runs it and treats a non-zero exit code as failure. A library can serve as the&lt;br /&gt;
driver, and then any elaboration error counts as a failure, including a failed&lt;br /&gt;
&amp;lt;code&amp;gt;#guard&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt; Adding &amp;lt;code&amp;gt;testDriver = &amp;quot;GreetingTest&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
and a second library to the configuration,&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;[[lean_lib]]&lt;br /&gt;
name = &amp;quot;GreetingTest&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the file &amp;lt;code&amp;gt;GreetingTest.lean&amp;lt;/code&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;import Greeting&lt;br /&gt;
&lt;br /&gt;
#guard hello == &amp;quot;world&amp;quot;&lt;br /&gt;
#guard hello.length == 5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
makes &amp;lt;code&amp;gt;lake test&amp;lt;/code&amp;gt; succeed. Changing the last line to claim a length of 6 makes it&lt;br /&gt;
fail, with this among its messages:&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;error: GreetingTest.lean:4:0: Expression&lt;br /&gt;
  hello.length == 6&lt;br /&gt;
did not evaluate to `true`&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a library of proofs the distinction between compiling and testing is thin. A theorem&lt;br /&gt;
that is false, or whose proof is broken, does not compile.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
A Lake package may require others. In &amp;lt;code&amp;gt;lakefile.toml&amp;lt;/code&amp;gt; each dependency is a&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[require]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; table. A dependency can come from Reservoir, an online index of Lake&lt;br /&gt;
packages, from a Git repository at a given revision, or from a local&lt;br /&gt;
path.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt; The reference manual&amp;#039;s example of a dependency taken from&lt;br /&gt;
Reservoir 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;[[require]]&lt;br /&gt;
name = &amp;quot;example&amp;quot;&lt;br /&gt;
version = &amp;quot;≥2.12.0&amp;quot;&lt;br /&gt;
scope = &amp;quot;exampleDev&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The configuration says which dependencies are wanted. The file&lt;br /&gt;
&amp;lt;code&amp;gt;lake-manifest.json&amp;lt;/code&amp;gt; says exactly which versions are in use: for each dependency&lt;br /&gt;
it records the source and the precise revision. Lake brings each dependency&amp;#039;s local copy into&lt;br /&gt;
line with lake-manifest.json before compiling, and creates the file if it is missing;&lt;br /&gt;
&amp;lt;code&amp;gt;lake update&amp;lt;/code&amp;gt; moves the recorded revisions forward. The file is meant to be kept&lt;br /&gt;
with the source.&amp;lt;ref name=&amp;quot;rm-lake&amp;quot; /&amp;gt; For the minimal project, which has no dependencies,&lt;br /&gt;
Lake wrote:&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;{&amp;quot;version&amp;quot;: &amp;quot;1.2.0&amp;quot;,&lt;br /&gt;
 &amp;quot;packagesDir&amp;quot;: &amp;quot;.lake/packages&amp;quot;,&lt;br /&gt;
 &amp;quot;packages&amp;quot;: [],&lt;br /&gt;
 &amp;quot;name&amp;quot;: &amp;quot;greeting&amp;quot;,&lt;br /&gt;
 &amp;quot;lakeDir&amp;quot;: &amp;quot;.lake&amp;quot;,&lt;br /&gt;
 &amp;quot;fixedToolchain&amp;quot;: false}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Together, &amp;lt;code&amp;gt;lean-toolchain&amp;lt;/code&amp;gt;, the configuration file and lake-manifest.json fix the&lt;br /&gt;
version of Lean and the exact source of every dependency. That is what makes a Lean project&lt;br /&gt;
reproducible: another person, or the same person years later, can obtain the same toolchain&lt;br /&gt;
and the same dependencies and have every proof checked again. The large mathematical&lt;br /&gt;
libraries described in [[Lean theorem prover/Explainers/A library of mathematics|a library&lt;br /&gt;
of mathematics]] are distributed in this form.&lt;br /&gt;
&lt;br /&gt;
== Next ==&lt;br /&gt;
&lt;br /&gt;
[[Lean theorem prover/System/Proof export and independent checkers|Proof export and independent checkers]]&lt;br /&gt;
describes how the results of a Lake build can be checked again outside the program that&lt;br /&gt;
produced them.&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>