leanwarp 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {leanwarp-0.2.3 → leanwarp-0.2.4}/PKG-INFO +30 -18
- {leanwarp-0.2.3 → leanwarp-0.2.4}/README.md +27 -15
- {leanwarp-0.2.3 → leanwarp-0.2.4}/docs/agents.md +2 -2
- leanwarp-0.2.4/docs/assets/leanwarp-banner.svg +15 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/docs/getting-started.md +14 -6
- {leanwarp-0.2.3 → leanwarp-0.2.4}/docs/http-api.md +4 -3
- {leanwarp-0.2.3/examples/lean-4.26 → leanwarp-0.2.4/examples/lean-4.35}/README.md +2 -2
- leanwarp-0.2.4/examples/lean-4.35/lake-manifest.json +96 -0
- {leanwarp-0.2.3/examples/lean-4.34 → leanwarp-0.2.4/examples/lean-4.35}/lakefile.toml +1 -1
- leanwarp-0.2.4/examples/lean-4.35/lean-toolchain +1 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/pyproject.toml +3 -3
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/cli.py +60 -1
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/client.py +37 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/mcp_server.py +24 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/outcome.py +2 -2
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/project.py +26 -36
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/session.py +3 -1
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/skills/leanwarp/SKILL.md +6 -3
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/skills/leanwarp/references/usage.md +21 -9
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_client.py +27 -1
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_project.py +82 -7
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_tools.py +91 -3
- leanwarp-0.2.3/docs/assets/leanwarp-banner.svg +0 -7
- leanwarp-0.2.3/examples/lean-4.26/lakefile.toml +0 -8
- leanwarp-0.2.3/examples/lean-4.26/lean-toolchain +0 -1
- leanwarp-0.2.3/examples/lean-4.34/.gitignore +0 -2
- leanwarp-0.2.3/examples/lean-4.34/LeanWarpExample.lean +0 -2
- leanwarp-0.2.3/examples/lean-4.34/README.md +0 -35
- leanwarp-0.2.3/examples/lean-4.34/lean-toolchain +0 -1
- {leanwarp-0.2.3 → leanwarp-0.2.4}/.gitignore +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/LICENSE +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/docs/README.md +0 -0
- {leanwarp-0.2.3/examples/lean-4.26 → leanwarp-0.2.4/examples/lean-4.35}/.gitignore +0 -0
- {leanwarp-0.2.3/examples/lean-4.26 → leanwarp-0.2.4/examples/lean-4.35}/LeanWarpExample.lean +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/__init__.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/_version.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/agents.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/amounts.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/config.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/edits.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/endpoints.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/py.typed +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/resources.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/transport.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/src/leanwarp_cloud/updates.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/__init__.py +0 -0
- /leanwarp-0.2.3/examples/lean-4.26/lake-manifest.json → /leanwarp-0.2.4/tests/fixtures/lake-manifest-1.1.0.json +0 -0
- /leanwarp-0.2.3/examples/lean-4.34/lake-manifest.json → /leanwarp-0.2.4/tests/fixtures/lake-manifest-1.2.0.json +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_amounts.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_config.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_deadline_transport.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_environment_compatibility.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_feedback.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_install.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_resources.py +0 -0
- {leanwarp-0.2.3 → leanwarp-0.2.4}/tests/test_session.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: leanwarp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Check and verify Lean proofs on LeanWarp from the command line, MCP or Python
|
|
5
5
|
Project-URL: Repository, https://github.com/Isagoge-Labs/LeanWarp-SDK
|
|
6
|
-
Project-URL: Homepage, https://isagoge.in
|
|
7
|
-
Project-URL: Documentation, https://
|
|
6
|
+
Project-URL: Homepage, https://isagoge.in/leanwarp
|
|
7
|
+
Project-URL: Documentation, https://isagoge.in/docs
|
|
8
8
|
Project-URL: Issues, https://github.com/Isagoge-Labs/LeanWarp-SDK/issues
|
|
9
9
|
Project-URL: Changelog, https://github.com/Isagoge-Labs/LeanWarp-SDK/releases
|
|
10
10
|
License-Expression: MIT
|
|
@@ -30,15 +30,16 @@ Provides-Extra: test
|
|
|
30
30
|
Requires-Dist: pytest<10,>=8.4; extra == 'test'
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
|
-
<h1><img src="https://raw.githubusercontent.com/Isagoge-Labs/LeanWarp-SDK/main/docs/assets/leanwarp-banner.svg" alt="LeanWarp" width="960"></h1>
|
|
33
|
+
<h1><img src="https://raw.githubusercontent.com/Isagoge-Labs/LeanWarp-SDK/main/docs/assets/leanwarp-banner.svg" alt="LeanWarp by Isagoge Labs" width="960"></h1>
|
|
34
34
|
|
|
35
|
-
LeanWarp
|
|
36
|
-
|
|
35
|
+
LeanWarp is hosted Lean 4 for formal verification. It checks and verifies proofs
|
|
36
|
+
on workers that stay warm between edits, against a Lean release and the libraries
|
|
37
|
+
your project pins. This SDK is how you and your agents use it: the `leanwarp`
|
|
37
38
|
command, an MCP server and a Python library.
|
|
38
39
|
|
|
39
|
-
**[Get started](https://
|
|
40
|
-
[Reference](https://
|
|
41
|
-
[
|
|
40
|
+
**[Get started](https://isagoge.in/docs/getting-started)** · [Agent setup](https://isagoge.in/docs/agents) ·
|
|
41
|
+
[Reference](https://isagoge.in/docs/reference) · [HTTP API](https://isagoge.in/docs/http-api) ·
|
|
42
|
+
[Documentation](https://isagoge.in/docs) · [Website](https://isagoge.in/leanwarp)
|
|
42
43
|
|
|
43
44
|
## What it does
|
|
44
45
|
|
|
@@ -53,8 +54,9 @@ command, an MCP server and a Python library.
|
|
|
53
54
|
| Sorry to lemma | The proof of each theorem that still has a `sorry` moved into a new named lemma the theorem then uses; the lemma keeps its `sorry`. `apply` writes it. | `leanwarp sorry2lemma` |
|
|
54
55
|
| Declarations | The declarations a file adds, with their types and dependencies. | `leanwarp declarations` |
|
|
55
56
|
| Check files | Up to 64 files checked in one operation. | `leanwarp check-files` |
|
|
57
|
+
| Verify batch | Up to 64 inline proofs checked in one operation, without uploading them as files; each result keeps its `custom_id`. | `leanwarp verify-batch` |
|
|
56
58
|
|
|
57
|
-
The [reference](https://
|
|
59
|
+
The [reference](https://isagoge.in/docs/reference#commands)
|
|
58
60
|
lists every command and option; `leanwarp skill --reference` prints it.
|
|
59
61
|
|
|
60
62
|
### Coming soon
|
|
@@ -139,14 +141,14 @@ Give your agent the project directory and this instruction:
|
|
|
139
141
|
|
|
140
142
|
For MCP clients, add the server `leanwarp --project /absolute/path/to/project mcp`,
|
|
141
143
|
or `uvx leanwarp --project /absolute/path/to/project mcp`
|
|
142
|
-
without installing. It uses the same key and project state as the CLI. See [agent setup](https://
|
|
144
|
+
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/docs/agents).
|
|
143
145
|
Keep API keys out of prompts, source files and tool arguments.
|
|
144
146
|
|
|
145
147
|
## Your project and its environment
|
|
146
148
|
|
|
147
149
|
LeanWarp uploads only your `.lean` files. Lean, Mathlib and every other
|
|
148
|
-
dependency come from an **environment**: a Lean release with
|
|
149
|
-
built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
150
|
+
dependency come from an **environment**: a Lean release with pinned libraries,
|
|
151
|
+
already built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
150
152
|
`leanwarp files` lists what would upload; patterns in `.gitignore` and
|
|
151
153
|
`.leanwarpignore` leave files out.
|
|
152
154
|
|
|
@@ -163,6 +165,16 @@ built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
|
163
165
|
To start a new project, copy one of the [examples](https://github.com/Isagoge-Labs/LeanWarp-SDK/tree/main/examples), which match the
|
|
164
166
|
environments LeanWarp serves.
|
|
165
167
|
|
|
168
|
+
### Lean versions and libraries
|
|
169
|
+
|
|
170
|
+
The LeanWarp engine supports every stable Lean 4 release from 4.26.0, with the
|
|
171
|
+
Lake libraries a project locks. The hosted service runs it in the environments
|
|
172
|
+
[listed on the website](https://isagoge.in/docs/environments), which today pair
|
|
173
|
+
Lean with Mathlib. Each one is built and tested before it is served, so your first
|
|
174
|
+
check starts from compiled libraries. If your project needs another Lean release
|
|
175
|
+
or library, [open an issue](https://github.com/Isagoge-Labs/LeanWarp-SDK/issues) with its `lean-toolchain` and
|
|
176
|
+
`lake-manifest.json`.
|
|
177
|
+
|
|
166
178
|
## Billing
|
|
167
179
|
|
|
168
180
|
You pay from prepaid credit, billed by the second while a worker runs. Run
|
|
@@ -189,7 +201,7 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
189
201
|
|
|
190
202
|
| Term | Meaning |
|
|
191
203
|
| --- | --- |
|
|
192
|
-
| Environment | A Lean release with
|
|
204
|
+
| Environment | A Lean release with pinned libraries, prebuilt on LeanWarp, such as `lean-4.35-mathlib`. |
|
|
193
205
|
| Workspace | Your project's files on LeanWarp. One per project; creating it starts no compute. |
|
|
194
206
|
| Worker | The machine that runs Lean for a workspace. It starts on demand and stays warm. |
|
|
195
207
|
| Operation | One request, such as a check or a verification, and its result. |
|
|
@@ -200,10 +212,10 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
200
212
|
|
|
201
213
|
| Start here | Reference |
|
|
202
214
|
| --- | --- |
|
|
203
|
-
| [Verify your first proof](https://
|
|
204
|
-
| [Set up an agent with the CLI or MCP](https://
|
|
205
|
-
| [Use the Python library](https://
|
|
206
|
-
| [Call the HTTP API directly](https://
|
|
215
|
+
| [Verify your first proof](https://isagoge.in/docs/getting-started) | [Commands](https://isagoge.in/docs/reference#commands) |
|
|
216
|
+
| [Set up an agent with the CLI or MCP](https://isagoge.in/docs/agents) | [Results and exit codes](https://isagoge.in/docs/reference#results) |
|
|
217
|
+
| [Use the Python library](https://isagoge.in/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/docs/reference#recovery) |
|
|
218
|
+
| [Call the HTTP API directly](https://isagoge.in/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/docs/reference#credentials-credit-and-limits) |
|
|
207
219
|
|
|
208
220
|
The agent instructions ship with the package: `leanwarp skill` prints the
|
|
209
221
|
workflow and `leanwarp skill --reference` the full reference. Run
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
<h1><img src="https://raw.githubusercontent.com/Isagoge-Labs/LeanWarp-SDK/main/docs/assets/leanwarp-banner.svg" alt="LeanWarp" width="960"></h1>
|
|
1
|
+
<h1><img src="https://raw.githubusercontent.com/Isagoge-Labs/LeanWarp-SDK/main/docs/assets/leanwarp-banner.svg" alt="LeanWarp by Isagoge Labs" width="960"></h1>
|
|
2
2
|
|
|
3
|
-
LeanWarp
|
|
4
|
-
|
|
3
|
+
LeanWarp is hosted Lean 4 for formal verification. It checks and verifies proofs
|
|
4
|
+
on workers that stay warm between edits, against a Lean release and the libraries
|
|
5
|
+
your project pins. This SDK is how you and your agents use it: the `leanwarp`
|
|
5
6
|
command, an MCP server and a Python library.
|
|
6
7
|
|
|
7
|
-
**[Get started](https://
|
|
8
|
-
[Reference](https://
|
|
9
|
-
[
|
|
8
|
+
**[Get started](https://isagoge.in/docs/getting-started)** · [Agent setup](https://isagoge.in/docs/agents) ·
|
|
9
|
+
[Reference](https://isagoge.in/docs/reference) · [HTTP API](https://isagoge.in/docs/http-api) ·
|
|
10
|
+
[Documentation](https://isagoge.in/docs) · [Website](https://isagoge.in/leanwarp)
|
|
10
11
|
|
|
11
12
|
## What it does
|
|
12
13
|
|
|
@@ -21,8 +22,9 @@ command, an MCP server and a Python library.
|
|
|
21
22
|
| Sorry to lemma | The proof of each theorem that still has a `sorry` moved into a new named lemma the theorem then uses; the lemma keeps its `sorry`. `apply` writes it. | `leanwarp sorry2lemma` |
|
|
22
23
|
| Declarations | The declarations a file adds, with their types and dependencies. | `leanwarp declarations` |
|
|
23
24
|
| Check files | Up to 64 files checked in one operation. | `leanwarp check-files` |
|
|
25
|
+
| Verify batch | Up to 64 inline proofs checked in one operation, without uploading them as files; each result keeps its `custom_id`. | `leanwarp verify-batch` |
|
|
24
26
|
|
|
25
|
-
The [reference](https://
|
|
27
|
+
The [reference](https://isagoge.in/docs/reference#commands)
|
|
26
28
|
lists every command and option; `leanwarp skill --reference` prints it.
|
|
27
29
|
|
|
28
30
|
### Coming soon
|
|
@@ -107,14 +109,14 @@ Give your agent the project directory and this instruction:
|
|
|
107
109
|
|
|
108
110
|
For MCP clients, add the server `leanwarp --project /absolute/path/to/project mcp`,
|
|
109
111
|
or `uvx leanwarp --project /absolute/path/to/project mcp`
|
|
110
|
-
without installing. It uses the same key and project state as the CLI. See [agent setup](https://
|
|
112
|
+
without installing. It uses the same key and project state as the CLI. See [agent setup](https://isagoge.in/docs/agents).
|
|
111
113
|
Keep API keys out of prompts, source files and tool arguments.
|
|
112
114
|
|
|
113
115
|
## Your project and its environment
|
|
114
116
|
|
|
115
117
|
LeanWarp uploads only your `.lean` files. Lean, Mathlib and every other
|
|
116
|
-
dependency come from an **environment**: a Lean release with
|
|
117
|
-
built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
118
|
+
dependency come from an **environment**: a Lean release with pinned libraries,
|
|
119
|
+
already built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
118
120
|
`leanwarp files` lists what would upload; patterns in `.gitignore` and
|
|
119
121
|
`.leanwarpignore` leave files out.
|
|
120
122
|
|
|
@@ -131,6 +133,16 @@ built on LeanWarp's workers. Run `leanwarp environments` to list them.
|
|
|
131
133
|
To start a new project, copy one of the [examples](https://github.com/Isagoge-Labs/LeanWarp-SDK/tree/main/examples), which match the
|
|
132
134
|
environments LeanWarp serves.
|
|
133
135
|
|
|
136
|
+
### Lean versions and libraries
|
|
137
|
+
|
|
138
|
+
The LeanWarp engine supports every stable Lean 4 release from 4.26.0, with the
|
|
139
|
+
Lake libraries a project locks. The hosted service runs it in the environments
|
|
140
|
+
[listed on the website](https://isagoge.in/docs/environments), which today pair
|
|
141
|
+
Lean with Mathlib. Each one is built and tested before it is served, so your first
|
|
142
|
+
check starts from compiled libraries. If your project needs another Lean release
|
|
143
|
+
or library, [open an issue](https://github.com/Isagoge-Labs/LeanWarp-SDK/issues) with its `lean-toolchain` and
|
|
144
|
+
`lake-manifest.json`.
|
|
145
|
+
|
|
134
146
|
## Billing
|
|
135
147
|
|
|
136
148
|
You pay from prepaid credit, billed by the second while a worker runs. Run
|
|
@@ -157,7 +169,7 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
157
169
|
|
|
158
170
|
| Term | Meaning |
|
|
159
171
|
| --- | --- |
|
|
160
|
-
| Environment | A Lean release with
|
|
172
|
+
| Environment | A Lean release with pinned libraries, prebuilt on LeanWarp, such as `lean-4.35-mathlib`. |
|
|
161
173
|
| Workspace | Your project's files on LeanWarp. One per project; creating it starts no compute. |
|
|
162
174
|
| Worker | The machine that runs Lean for a workspace. It starts on demand and stays warm. |
|
|
163
175
|
| Operation | One request, such as a check or a verification, and its result. |
|
|
@@ -168,10 +180,10 @@ for each workspace in the [dashboard](https://isagoge.in/dashboard).
|
|
|
168
180
|
|
|
169
181
|
| Start here | Reference |
|
|
170
182
|
| --- | --- |
|
|
171
|
-
| [Verify your first proof](https://
|
|
172
|
-
| [Set up an agent with the CLI or MCP](https://
|
|
173
|
-
| [Use the Python library](https://
|
|
174
|
-
| [Call the HTTP API directly](https://
|
|
183
|
+
| [Verify your first proof](https://isagoge.in/docs/getting-started) | [Commands](https://isagoge.in/docs/reference#commands) |
|
|
184
|
+
| [Set up an agent with the CLI or MCP](https://isagoge.in/docs/agents) | [Results and exit codes](https://isagoge.in/docs/reference#results) |
|
|
185
|
+
| [Use the Python library](https://isagoge.in/docs/reference#python) | [Recover an interrupted request](https://isagoge.in/docs/reference#recovery) |
|
|
186
|
+
| [Call the HTTP API directly](https://isagoge.in/docs/http-api) | [Credentials, credit and limits](https://isagoge.in/docs/reference#credentials-credit-and-limits) |
|
|
175
187
|
|
|
176
188
|
The agent instructions ship with the package: `leanwarp skill` prints the
|
|
177
189
|
workflow and `leanwarp skill --reference` the full reference. Run
|
|
@@ -90,8 +90,8 @@ The agent should read the resources `leanwarp://guide` and `leanwarp://reference
|
|
|
90
90
|
first. The tools mirror the CLI commands: setup (`doctor`, `files`,
|
|
91
91
|
`environments`, `connect`), proof operations (`check`, `inspect`, `try_tactics`,
|
|
92
92
|
`verify_target`, `holes`, `suggest`, `sorry2lemma`, `extract_decls`,
|
|
93
|
-
`check_files`, and `apply` to write a result into its file),
|
|
94
|
-
(`wait`, `status`, `cancel`, `stop`, `recover`), and workspace and account
|
|
93
|
+
`check_files`, `verify_batch`, and `apply` to write a result into its file),
|
|
94
|
+
operation control (`wait`, `status`, `cancel`, `stop`, `recover`), and workspace and account
|
|
95
95
|
management. The [MCP reference](../src/leanwarp_cloud/skills/leanwarp/references/usage.md#mcp)
|
|
96
96
|
lists the tools and their arguments. Operation tools wait up to 20 seconds for
|
|
97
97
|
their result by default (`wait_seconds`, at most 40).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="264" viewBox="0 0 960 264" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">LeanWarp by Isagoge Labs</title>
|
|
3
|
+
<desc id="desc">Hosted Lean 4 for proof agents</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<mask id="isagoge-mark" maskUnits="userSpaceOnUse" x="0" y="0" width="960" height="264">
|
|
6
|
+
<image x="413" y="207" width="19.06" height="20" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAACACAQAAABuWbUQAAAJEUlEQVR42u2deWxURRzH90+Q0sY/CJUzclmRgFEuD6wihkDUGOTScgRIQIGAcqSAFeUQFCRBiaQil8opIRIQhJiuCshpEEWxlVAx0gvakghsobDzdV63Zd/bnXlvZnfm7esuM+lfO+/NfN5v5je/+c1vpj74HPJgLMBOFIJATyrGFkxCM8d2mPNQrGe2qBwFWIIRaGX/vN2Pj+EzVNNX68INJ4IAFqGpAO49mEPR7NpE6vIOjJSH7oMDruCaG3sK3R2Q++G8cJsIiqjMhaEzsdVV3HCqtMV+B7ekP+QJ9BSBzkZZgpBD2Bkc5GUxtqoG05ygRyOIRCaCH5nIE+MQBMFaO+hEI4eaOCQKuQ1VqPG981uksaG9gGykw1HQe+MecASbWdA9PIIM2o5OFuRHlbSMYH4kdBr+hVcSocaKGTpf2Xv7W6FXJ1BjR6c1FugSZe8tQnoYuqdnunYofWNC7qZQHAS5YegDgGehRyrtg5WGFjde285jcrZCz1AKTTA3BO2t8Wwk0/SCmYpbdyEEXeox5PqRV583Kp8Q+xoLSK/JOUjbFIbervyTLvUhz3PQVy0r6wrl7/f7sBxeS+tMyJ01iKTQB7/nRvQLJuhxGqCJju4TXzprsca266jC5zk5Tzch30uNiRSALrTIeZIeJevzmJwHWKD/0FONz1PI2yzIw3VNpl6CLkNLi4e7SFdFPtz2jJyfssj5LX1Gk1fmaYJ5FuRWqNJXlw/rPYG8K8IVuEajcXxe27QghXyMjmAr9HWN9RUYmziBBEOfitrVyNYoCIJROlascqmKsZEzQSP0pQZ3USCByD0YmzgPaXNgEbze4BhckKBxfQuDOdt1+7S0iOAHNAn7vU8mAJtgEXdbNh2HlLeINGiPhkpaJ8BT9p3DFvwQfE1NJ6Ia2byXleUy9nW0FQi3aIWp1BwNKkD+PqwwzRVk4WfXOjnBmxKBNU9jOx3/JOa6yjGLvz+djo9dwj4rGU9kzDGfUokTSVyCCiyMrCv65f1xTjs4QQ4Dqzc39CIMLrJTTejHCaKGKufleFE8uugVOo50xhaVRpidbfElnbGNGouxE6OolcgHH8CJaTOevo7T2IopeJwO1ZjiyJ7HFtzQgk6w2FJTL2olWX+/TdVOTpQ9bl521t5pl9HCy9iNXDwhOlTsf06n08YHVC5q0YMWvZ2Bi5xPcwlLuTJvgzeocvNjP12SviypHXxixbLotz2rDP2M5d2LbaP/qrHSRuIxZpnCvfEJ1YXxh7yY3QVNcd6xfBldgCQM2sjN6ViLbzYPWsbeMKF3EayjNccC+Ai6xA8dyi/haMzgt9DC9Ka1EkZkE+H2PYA8qsUL6+Z1YwI7Qu265mzoJuiK12jxPNoBs22nDSMPpM2IBfyc5S0VEsNitgBuS7qIOcbQPoaRMjkSuimd3UrvWDyh73OFdqphtpbTIPwlDf6VZd0s83SBA3A3bLY1Vgm16UzQGTjMKUyo0ZBPVRh/jC+Wis2ti/kwuYVklhL7bYEPCBip9djGA83wq21xQ+5HaHfmx4YfF5ZY0PBc3MnzJCRN6MzMrj8Tm4Q/HsH4EHSeoAb9hRU7XT84vhBsPrGEVuyQQObJeQa1smUGSSmaGB20RmK6WRWKuWPkyUKRusQcjUv7j2i9S5i6+yE6zom0nTBGNpLaGOO8jt6DmhFO6bjliStCNZbSBQR7WXQjpknT78PnMdhUH3FMww644PDkCssUGRSo6yBz8kynKilWS6Eqtr0sQq2yzlxsu0njSVPZvo7QhK6IWbV0llCdjLf6YnzYsIifZTboPvzGfeofS8lpDnUHMJZZQ/d4w7Tj2Z++gdFSnZzQtZq5XIGD43AgR3PEd7QB8W7KE44s2NjnIzSBndorQT/mm8fGjxx/JAIPu1tUXFB1xAbOUJvOfZEuGdjISlb08Ydf8Jy5HbC7/gggqTt41D7i9w1cgGscZGWnTFTEnPCkbXhcZmEB/WvPsNl5Fns1c0tPyVhWCW2HzctzuQucbGb5LihX56RTFV1kjeh0ymmcSEASfUSw3hT5U6U7Vl1IVQ13ORKd8zme662c8jvVOqJVxpGVO+5QNJwNYiMUcxwWE1X73lVCExwVgv6d+fRtOs2xj67fVL3boDZikGClI/JsTtdeyCl/Vv2ukuowScINqGjYb2bL7QTH1/mejh019bGhVXTJwYeezIQIcrxwffUEceoIiN1rA72H2TvWcEofBRoLNKH6lgfN8nNXcFxQOY0r9Lma28XLGJ8ol2PAlAONCZpgHwd6P0PO7Nl5ps7QZ2jCHsREmRKBQjCHWS4jYqO+UUAbB7TZU1atpdRljpwX6Yx70QfNW2evMuFEBmKEjzJoPS2m8wxHJVMrZ5iAyjjW+hS98U06oXmmZde6SNQgHQA93TM93YI2rLMWHKyHOY4/Iz+nO45NLzTB2zHEOWg/VaL7XFaJNHJmhH5vhNCRF7U459H6o1P1n8A7LAl9SHuLXIAm6CWBnK7eT5IY6JUS0DluhF67ccC0QgJ6swvtcQU6iGeEoa8kCzTBh4LI3d05V+DO+ekiQeiZyQQdREch6HWutMYlaIIxQtAnkwka2CS0rUeSC/qUAHSvZIMOCkBPcOsyOLegCSe+wJznu9QWF6HHe0V3uwk9wxHan2zQQL4jdGnyQW90hP4v+aD3pSK03wG5tXu3l3oHutNd6LvQd6GVQFemIrQ/5aCJD9tSDjrgw0KXVrHegf5J9Nh28kATrDZi7AMpBv2qUd2ulIIOhE7VDnalg3sFem3DofGSlIEmRpxLqMJZLsjaC9AEe8x3IhSmBHQt+pihB2iXdeKhCZZFXvmxQjN24qGLoq/bS9MVUu4R6AAeZF3ucj/+1ijtgoRCB8xnS6wV68Te5ugYvOoOcvTdRZk4qOma0kkJC6a6FHmCiLVh+r4G7GsCp/OGa7nlriD66j3eZUyFiv9h03yhTfkzimutZW8m8RswnRqnRFHlGwRjTrKUnZEmuIlVaB3LJWwj6QosENc1e8bXXioRR9YRp+P61KFz+Scx1e5InMhdc8OQS3WvH8XSCsSPd9FOOg54BO0ZfukJrLrumsUlGOd83e7/xArF2kDaRgwAAAAASUVORK5CYII="/>
|
|
7
|
+
</mask>
|
|
8
|
+
</defs>
|
|
9
|
+
<rect width="960" height="264" rx="12" fill="#080f14"/>
|
|
10
|
+
<text x="480" y="108" text-anchor="middle" fill="#f1f6fa" font-family="ui-sans-serif,system-ui,sans-serif" font-size="52" font-weight="650" letter-spacing="-1.5">LeanWarp</text>
|
|
11
|
+
<text x="480" y="146" text-anchor="middle" fill="#b0c3cf" font-family="ui-sans-serif,system-ui,sans-serif" font-size="20">Hosted Lean 4 for proof agents</text>
|
|
12
|
+
<path d="M420 184H540" stroke="#1d2b34" stroke-linecap="round"/>
|
|
13
|
+
<rect x="413" y="207" width="19.06" height="20" fill="#dbe6ec" mask="url(#isagoge-mark)"/>
|
|
14
|
+
<text x="440" y="222" fill="#8299a7" font-family="ui-sans-serif,system-ui,sans-serif" font-size="15" textLength="107" lengthAdjust="spacing">by <tspan fill="#dbe6ec" font-weight="600">Isagoge Labs</tspan></text>
|
|
15
|
+
</svg>
|
|
@@ -30,7 +30,8 @@ Running operations uses prepaid credit, which you add in the dashboard.
|
|
|
30
30
|
## 2. Choose a project
|
|
31
31
|
|
|
32
32
|
LeanWarp uploads only your `.lean` files and runs them in an **environment**: a
|
|
33
|
-
Lean release with Mathlib, already built on LeanWarp's
|
|
33
|
+
Lean release with pinned libraries such as Mathlib, already built on LeanWarp's
|
|
34
|
+
workers. List them with:
|
|
34
35
|
|
|
35
36
|
```sh
|
|
36
37
|
leanwarp environments
|
|
@@ -41,7 +42,7 @@ the [examples](../examples) and work inside it:
|
|
|
41
42
|
|
|
42
43
|
```sh
|
|
43
44
|
git clone https://github.com/Isagoge-Labs/LeanWarp-SDK.git
|
|
44
|
-
cd LeanWarp-SDK/examples/lean-4.
|
|
45
|
+
cd LeanWarp-SDK/examples/lean-4.35
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
For your own project, run `leanwarp doctor` from its root. It reports the
|
|
@@ -52,12 +53,19 @@ environment the project will use, without starting compute:
|
|
|
52
53
|
- a folder of `.lean` files with neither file uses the only served environment, or the newest served stable Lean release when there are several;
|
|
53
54
|
- a project that matches none is told which environments exist. Pass
|
|
54
55
|
`--environment NAME` to `doctor` and `connect` to use one anyway; your files then
|
|
55
|
-
compile against that environment's Lean and Mathlib.
|
|
56
|
+
compile against that environment's Lean and Mathlib. For a mismatch, `doctor`
|
|
57
|
+
reports `matches_project: false` in its environment selection.
|
|
56
58
|
|
|
57
59
|
When several environments share the newest stable Lean release, choose one
|
|
58
|
-
explicitly.
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
explicitly. `doctor` reports the saved environment of an already connected
|
|
61
|
+
project, even when the default later changes.
|
|
62
|
+
|
|
63
|
+
The SDK accepts newer Lake manifest versions and both Git and local path
|
|
64
|
+
dependency records. Git dependencies must be pinned to full commit hashes.
|
|
65
|
+
Reading a path record does not upload or build its dependency directory: the
|
|
66
|
+
selected environment must already supply the dependencies your files need.
|
|
67
|
+
Accepting a manifest does not add a hosted Lean version or library; use
|
|
68
|
+
`leanwarp environments` and `leanwarp doctor` to check for an exact match.
|
|
61
69
|
|
|
62
70
|
Then create the project's workspace. This starts no compute:
|
|
63
71
|
|
|
@@ -82,10 +82,11 @@ its files. `file` is a project-relative `.lean` path; lines and columns start at
|
|
|
82
82
|
| `extract_decls` | `file`. |
|
|
83
83
|
| `sorry2lemma` | `file`, `max_extractions` (1 to 256, default 64), optional `name_prefix`, `strict_final_check` (default `false`). |
|
|
84
84
|
| `check_files` | `files` (1 to 64 distinct paths), `strict` (default `true`), optional `timeout` seconds per file (1 to 300). |
|
|
85
|
+
| `verify_batch` | `codes` (1 to 64 objects `{"custom_id", "proof"}`; each `custom_id` unique, 1 to 128 characters without control characters; proofs nonblank; the payload at most 256 KiB of UTF-8), `strict` (default `true`), optional `timeout` seconds per proof (1 to 300). The proofs run in the workspace's environment and may import its packages, such as Mathlib, but not the workspace's own modules; such a proof is refused with `error.code` `unsupported_import`. |
|
|
85
86
|
|
|
86
|
-
`suggest` and `
|
|
87
|
-
default `timeout_seconds` is 600, enough for the work then in
|
|
88
|
-
`timeout_seconds` ends the operation when it expires.
|
|
87
|
+
`suggest`, `check_files` and `verify_batch` stop starting new work after four
|
|
88
|
+
minutes; their default `timeout_seconds` is 600, enough for the work then in
|
|
89
|
+
flight. A lower `timeout_seconds` ends the operation when it expires.
|
|
89
90
|
|
|
90
91
|
### Applying an edit
|
|
91
92
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Lean 4.
|
|
1
|
+
# Lean 4.35 example
|
|
2
2
|
|
|
3
3
|
A small Lean project whose toolchain and lockfile match LeanWarp's
|
|
4
|
-
`lean-4.
|
|
4
|
+
`lean-4.35-mathlib` environment. Run `leanwarp environments` to check that
|
|
5
5
|
LeanWarp serves it. From this directory, after `leanwarp auth login`:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{"version": "1.3.0",
|
|
2
|
+
"packagesDir": ".lake/packages",
|
|
3
|
+
"packages":
|
|
4
|
+
[{"url": "https://github.com/leanprover-community/mathlib4.git",
|
|
5
|
+
"type": "git",
|
|
6
|
+
"subDir": null,
|
|
7
|
+
"scope": "",
|
|
8
|
+
"rev": "56a005855ea17e0b0958f73ec801ae140b0a1679",
|
|
9
|
+
"name": "mathlib",
|
|
10
|
+
"manifestFile": "lake-manifest.json",
|
|
11
|
+
"inputRev": "v4.35.0",
|
|
12
|
+
"inherited": false,
|
|
13
|
+
"configFile": "lakefile.lean"},
|
|
14
|
+
{"url": "https://github.com/leanprover-community/plausible",
|
|
15
|
+
"type": "git",
|
|
16
|
+
"subDir": null,
|
|
17
|
+
"scope": "leanprover-community",
|
|
18
|
+
"rev": "dfa4f38190d07c37e315953e08b90fe2d95b3c24",
|
|
19
|
+
"name": "plausible",
|
|
20
|
+
"manifestFile": "lake-manifest.json",
|
|
21
|
+
"inputRev": "main",
|
|
22
|
+
"inherited": true,
|
|
23
|
+
"configFile": "lakefile.toml"},
|
|
24
|
+
{"url": "https://github.com/leanprover-community/LeanSearchClient",
|
|
25
|
+
"type": "git",
|
|
26
|
+
"subDir": null,
|
|
27
|
+
"scope": "leanprover-community",
|
|
28
|
+
"rev": "d6b4c7be5be75ec4917c873ac50c756dc1436372",
|
|
29
|
+
"name": "LeanSearchClient",
|
|
30
|
+
"manifestFile": "lake-manifest.json",
|
|
31
|
+
"inputRev": "main",
|
|
32
|
+
"inherited": true,
|
|
33
|
+
"configFile": "lakefile.toml"},
|
|
34
|
+
{"url": "https://github.com/leanprover-community/import-graph",
|
|
35
|
+
"type": "git",
|
|
36
|
+
"subDir": null,
|
|
37
|
+
"scope": "leanprover-community",
|
|
38
|
+
"rev": "a41f0e9a4dea23188ea9cc1c41ac9f8bbafe0b93",
|
|
39
|
+
"name": "importGraph",
|
|
40
|
+
"manifestFile": "lake-manifest.json",
|
|
41
|
+
"inputRev": "main",
|
|
42
|
+
"inherited": true,
|
|
43
|
+
"configFile": "lakefile.toml"},
|
|
44
|
+
{"url": "https://github.com/leanprover-community/ProofWidgets4",
|
|
45
|
+
"type": "git",
|
|
46
|
+
"subDir": null,
|
|
47
|
+
"scope": "leanprover-community",
|
|
48
|
+
"rev": "df72b022e558978a1c50264cfc4d7fec86fa8e04",
|
|
49
|
+
"name": "proofwidgets",
|
|
50
|
+
"manifestFile": "lake-manifest.json",
|
|
51
|
+
"inputRev": "main",
|
|
52
|
+
"inherited": true,
|
|
53
|
+
"configFile": "lakefile.lean"},
|
|
54
|
+
{"url": "https://github.com/leanprover-community/aesop",
|
|
55
|
+
"type": "git",
|
|
56
|
+
"subDir": null,
|
|
57
|
+
"scope": "leanprover-community",
|
|
58
|
+
"rev": "4a174c490d8707121c4a9290800489f105d85e07",
|
|
59
|
+
"name": "aesop",
|
|
60
|
+
"manifestFile": "lake-manifest.json",
|
|
61
|
+
"inputRev": "master",
|
|
62
|
+
"inherited": true,
|
|
63
|
+
"configFile": "lakefile.toml"},
|
|
64
|
+
{"url": "https://github.com/leanprover-community/quote4",
|
|
65
|
+
"type": "git",
|
|
66
|
+
"subDir": null,
|
|
67
|
+
"scope": "leanprover-community",
|
|
68
|
+
"rev": "dce0ad79c486cb1fb504af04f953c3466b0c6db8",
|
|
69
|
+
"name": "Qq",
|
|
70
|
+
"manifestFile": "lake-manifest.json",
|
|
71
|
+
"inputRev": "master",
|
|
72
|
+
"inherited": true,
|
|
73
|
+
"configFile": "lakefile.toml"},
|
|
74
|
+
{"url": "https://github.com/leanprover-community/batteries",
|
|
75
|
+
"type": "git",
|
|
76
|
+
"subDir": null,
|
|
77
|
+
"scope": "leanprover-community",
|
|
78
|
+
"rev": "66e469188fe07963e5cf666c7d4433f45b8131c5",
|
|
79
|
+
"name": "batteries",
|
|
80
|
+
"manifestFile": "lake-manifest.json",
|
|
81
|
+
"inputRev": "main",
|
|
82
|
+
"inherited": true,
|
|
83
|
+
"configFile": "lakefile.toml"},
|
|
84
|
+
{"url": "https://github.com/leanprover/lean4-cli",
|
|
85
|
+
"type": "git",
|
|
86
|
+
"subDir": null,
|
|
87
|
+
"scope": "leanprover",
|
|
88
|
+
"rev": "c24fe6078c630e89b489bffe59b3e20ac30d12c8",
|
|
89
|
+
"name": "Cli",
|
|
90
|
+
"manifestFile": "lake-manifest.json",
|
|
91
|
+
"inputRev": "v4.35.0",
|
|
92
|
+
"inherited": true,
|
|
93
|
+
"configFile": "lakefile.toml"}],
|
|
94
|
+
"name": "leanwarp_project",
|
|
95
|
+
"lakeDir": ".lake",
|
|
96
|
+
"fixedToolchain": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
leanprover/lean4:v4.35.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "leanwarp"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "Check and verify Lean proofs on LeanWarp from the command line, MCP or Python"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -29,8 +29,8 @@ leanwarp = "leanwarp_cloud.cli:main"
|
|
|
29
29
|
|
|
30
30
|
[project.urls]
|
|
31
31
|
Repository = "https://github.com/Isagoge-Labs/LeanWarp-SDK"
|
|
32
|
-
Homepage = "https://isagoge.in"
|
|
33
|
-
Documentation = "https://
|
|
32
|
+
Homepage = "https://isagoge.in/leanwarp"
|
|
33
|
+
Documentation = "https://isagoge.in/docs"
|
|
34
34
|
Issues = "https://github.com/Isagoge-Labs/LeanWarp-SDK/issues"
|
|
35
35
|
Changelog = "https://github.com/Isagoge-Labs/LeanWarp-SDK/releases"
|
|
36
36
|
|
|
@@ -16,6 +16,7 @@ from . import __version__
|
|
|
16
16
|
from .agents import AGENTS, setup
|
|
17
17
|
from .amounts import usd_spending_cap
|
|
18
18
|
from .client import (
|
|
19
|
+
MAX_BATCH_PROOFS,
|
|
19
20
|
FeedbackKind,
|
|
20
21
|
FeedbackSeverity,
|
|
21
22
|
LeanWarpCloud,
|
|
@@ -37,6 +38,8 @@ from .session import (
|
|
|
37
38
|
from .updates import noted, update
|
|
38
39
|
|
|
39
40
|
DEFAULT_WAIT_SECONDS = 30.0
|
|
41
|
+
# Comfortably above the service's 256 KiB of proofs, even with escaped text.
|
|
42
|
+
_MAX_JSONL_BYTES = 2 * 1024 * 1024
|
|
40
43
|
#: Where an account creates API keys.
|
|
41
44
|
KEYS_URL = "https://isagoge.in/dashboard?section=keys"
|
|
42
45
|
|
|
@@ -284,6 +287,24 @@ def parser() -> argparse.ArgumentParser:
|
|
|
284
287
|
"--file-timeout", type=int, metavar="SECONDS", help="Lean time per file, 1 to 300"
|
|
285
288
|
)
|
|
286
289
|
|
|
290
|
+
proofs = commands.add_parser(
|
|
291
|
+
"verify-batch",
|
|
292
|
+
help="check inline proofs in the workspace's environment in one operation (up to 64)",
|
|
293
|
+
)
|
|
294
|
+
proofs.add_argument(
|
|
295
|
+
"codes",
|
|
296
|
+
metavar="FILE.jsonl",
|
|
297
|
+
help='one {"custom_id": ..., "proof": ...} object per line; - reads standard input',
|
|
298
|
+
)
|
|
299
|
+
proofs.add_argument(
|
|
300
|
+
"--draft",
|
|
301
|
+
action="store_true",
|
|
302
|
+
help="accept proofs that compile, even with sorry; strict by default",
|
|
303
|
+
)
|
|
304
|
+
proofs.add_argument(
|
|
305
|
+
"--proof-timeout", type=int, metavar="SECONDS", help="Lean time per proof, 1 to 300"
|
|
306
|
+
)
|
|
307
|
+
|
|
287
308
|
commands.add_parser(
|
|
288
309
|
"apply",
|
|
289
310
|
help="write the latest suggest or sorry2lemma result into its file and upload it",
|
|
@@ -299,6 +320,7 @@ def parser() -> argparse.ArgumentParser:
|
|
|
299
320
|
declarations,
|
|
300
321
|
obligations,
|
|
301
322
|
batch,
|
|
323
|
+
proofs,
|
|
302
324
|
):
|
|
303
325
|
operation.add_argument(
|
|
304
326
|
"--wait",
|
|
@@ -476,9 +498,42 @@ def _check_before_sign_in(root: str, environment: str | None) -> int:
|
|
|
476
498
|
return 0 if report["compatible"] else 1
|
|
477
499
|
|
|
478
500
|
|
|
501
|
+
def _codes(source: str) -> list[dict[str, str]]:
|
|
502
|
+
"""Read verify-batch's JSONL: one custom_id and proof per line; blank lines are skipped."""
|
|
503
|
+
if source == "-":
|
|
504
|
+
raw = sys.stdin.buffer.read(_MAX_JSONL_BYTES + 1)
|
|
505
|
+
else:
|
|
506
|
+
with Path(source).open("rb") as stream:
|
|
507
|
+
raw = stream.read(_MAX_JSONL_BYTES + 1)
|
|
508
|
+
if len(raw) > _MAX_JSONL_BYTES:
|
|
509
|
+
raise UsageError(f"{source} is larger than 2 MiB")
|
|
510
|
+
codes: list[dict[str, str]] = []
|
|
511
|
+
for number, line in enumerate(raw.decode("utf-8").splitlines(), start=1):
|
|
512
|
+
if not line.strip():
|
|
513
|
+
continue
|
|
514
|
+
try:
|
|
515
|
+
code = json.loads(line)
|
|
516
|
+
except ValueError:
|
|
517
|
+
raise UsageError(f"line {number} of {source} is not JSON") from None
|
|
518
|
+
if (
|
|
519
|
+
not isinstance(code, dict)
|
|
520
|
+
or set(code) != {"custom_id", "proof"}
|
|
521
|
+
or not all(isinstance(value, str) for value in code.values())
|
|
522
|
+
):
|
|
523
|
+
raise UsageError(
|
|
524
|
+
f'line {number} of {source} must be {{"custom_id": "...", "proof": "..."}}'
|
|
525
|
+
)
|
|
526
|
+
codes.append(code)
|
|
527
|
+
if not 1 <= len(codes) <= MAX_BATCH_PROOFS:
|
|
528
|
+
raise UsageError(
|
|
529
|
+
f"verify-batch takes 1 to {MAX_BATCH_PROOFS} proofs; {source} has {len(codes)}"
|
|
530
|
+
)
|
|
531
|
+
return codes
|
|
532
|
+
|
|
533
|
+
|
|
479
534
|
def _operation(project: ProjectSession, args: argparse.Namespace) -> dict[str, Any]:
|
|
480
535
|
kind = {"declarations": "extract_decls"}.get(args.command, args.command.replace("-", "_"))
|
|
481
|
-
payload: dict[str, Any] = {} if kind
|
|
536
|
+
payload: dict[str, Any] = {} if kind in {"check_files", "verify_batch"} else {"file": args.file}
|
|
482
537
|
if kind == "suggest":
|
|
483
538
|
payload.update(line=args.line, column=args.column)
|
|
484
539
|
if args.tactic:
|
|
@@ -497,6 +552,10 @@ def _operation(project: ProjectSession, args: argparse.Namespace) -> dict[str, A
|
|
|
497
552
|
payload.update(files=args.files, strict=not args.draft)
|
|
498
553
|
if args.file_timeout is not None:
|
|
499
554
|
payload["timeout"] = args.file_timeout
|
|
555
|
+
elif kind == "verify_batch":
|
|
556
|
+
payload.update(codes=_codes(args.codes), strict=not args.draft)
|
|
557
|
+
if args.proof_timeout is not None:
|
|
558
|
+
payload["timeout"] = args.proof_timeout
|
|
500
559
|
elif kind == "check":
|
|
501
560
|
payload["strict"] = not args.draft
|
|
502
561
|
elif kind in {"inspect", "try_tactics"}:
|
|
@@ -38,10 +38,13 @@ OperationKind = Literal[
|
|
|
38
38
|
"extract_decls",
|
|
39
39
|
"sorry2lemma",
|
|
40
40
|
"check_files",
|
|
41
|
+
"verify_batch",
|
|
41
42
|
]
|
|
42
43
|
OPERATION_KINDS: frozenset[str] = frozenset(get_args(OperationKind))
|
|
43
44
|
#: The most files one check_files operation checks.
|
|
44
45
|
MAX_BATCH_FILES = 64
|
|
46
|
+
#: The most proofs one verify_batch operation checks.
|
|
47
|
+
MAX_BATCH_PROOFS = 64
|
|
45
48
|
#: What a feedback report is about, and how much it got in the way.
|
|
46
49
|
FeedbackKind = Literal["bug", "missing_feature", "confusing_result", "docs", "performance", "other"]
|
|
47
50
|
FeedbackSeverity = Literal["blocking", "worked_around", "minor"]
|
|
@@ -526,6 +529,40 @@ class LeanWarpCloud:
|
|
|
526
529
|
idempotency_key=idempotency_key,
|
|
527
530
|
)
|
|
528
531
|
|
|
532
|
+
def verify_batch(
|
|
533
|
+
self,
|
|
534
|
+
workspace_id: str,
|
|
535
|
+
codes: list[dict[str, str]],
|
|
536
|
+
*,
|
|
537
|
+
expected_revision: int,
|
|
538
|
+
strict: bool = True,
|
|
539
|
+
timeout: int | None = None,
|
|
540
|
+
timeout_seconds: int | None = None,
|
|
541
|
+
idempotency_key: str | None = None,
|
|
542
|
+
) -> dict[str, Any]:
|
|
543
|
+
"""Check up to 64 inline proofs in the workspace's environment in one operation.
|
|
544
|
+
|
|
545
|
+
Each code is ``{"custom_id": ..., "proof": ...}`` with a unique custom_id.
|
|
546
|
+
Proofs may import the environment's packages, such as Mathlib, but not the
|
|
547
|
+
workspace's own modules. timeout bounds each proof in seconds.
|
|
548
|
+
"""
|
|
549
|
+
if not 1 <= len(codes) <= MAX_BATCH_PROOFS:
|
|
550
|
+
raise ValueError(f"verify_batch takes 1 to {MAX_BATCH_PROOFS} proofs")
|
|
551
|
+
payload: dict[str, Any] = {
|
|
552
|
+
"codes": [{"custom_id": code["custom_id"], "proof": code["proof"]} for code in codes],
|
|
553
|
+
"strict": strict,
|
|
554
|
+
}
|
|
555
|
+
if timeout is not None:
|
|
556
|
+
payload["timeout"] = timeout
|
|
557
|
+
return self.submit(
|
|
558
|
+
workspace_id,
|
|
559
|
+
"verify_batch",
|
|
560
|
+
expected_revision=expected_revision,
|
|
561
|
+
payload=payload,
|
|
562
|
+
timeout_seconds=timeout_seconds,
|
|
563
|
+
idempotency_key=idempotency_key,
|
|
564
|
+
)
|
|
565
|
+
|
|
529
566
|
def wait(
|
|
530
567
|
self, operation_id: str, *, timeout: float = 300, poll_interval: float = 1
|
|
531
568
|
) -> dict[str, Any]:
|
|
@@ -400,6 +400,30 @@ def create_server(cloud: LeanWarpCloud | Callable[[], LeanWarpCloud], root: str)
|
|
|
400
400
|
session().submit_and_wait("check_files", payload, wait_seconds=wait_seconds)
|
|
401
401
|
)
|
|
402
402
|
|
|
403
|
+
@server.tool(annotations=write)
|
|
404
|
+
@_safe_tool
|
|
405
|
+
def verify_batch(
|
|
406
|
+
codes: list[dict[str, str]],
|
|
407
|
+
draft: bool = False,
|
|
408
|
+
timeout: int | None = None,
|
|
409
|
+
wait_seconds: float = DEFAULT_WAIT_SECONDS,
|
|
410
|
+
) -> dict[str, Any]:
|
|
411
|
+
"""Check up to 64 inline proofs in one operation; success is true only if all passed.
|
|
412
|
+
|
|
413
|
+
Each code is {"custom_id": ..., "proof": ...} with a unique custom_id; no
|
|
414
|
+
file is uploaded. Proofs may import the environment's packages, such as
|
|
415
|
+
Mathlib, but not this project's modules (use check_files for those).
|
|
416
|
+
Strict by default; draft accepts proofs that compile. timeout bounds each
|
|
417
|
+
proof in seconds. A proof the batch's time did not reach is not_checked.
|
|
418
|
+
May use credit.
|
|
419
|
+
"""
|
|
420
|
+
payload: dict[str, Any] = {"codes": codes, "strict": not draft}
|
|
421
|
+
if timeout is not None:
|
|
422
|
+
payload["timeout"] = timeout
|
|
423
|
+
return reported(
|
|
424
|
+
session().submit_and_wait("verify_batch", payload, wait_seconds=wait_seconds)
|
|
425
|
+
)
|
|
426
|
+
|
|
403
427
|
# It rewrites one of the user's source files, so clients should confirm it.
|
|
404
428
|
@server.tool(
|
|
405
429
|
annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=True, openWorldHint=True)
|