lean-interact 0.5.3__tar.gz → 0.6.1__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.
- {lean_interact-0.5.3 → lean_interact-0.6.1}/.github/workflows/ci.yml +6 -2
- lean_interact-0.6.1/.github/workflows/docs.yml +70 -0
- lean_interact-0.6.1/.github/workflows/update-changelog.yml +33 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/.gitignore +3 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/PKG-INFO +23 -4
- {lean_interact-0.5.3 → lean_interact-0.6.1}/README.md +21 -3
- lean_interact-0.6.1/docs/.nojekyll +0 -0
- lean_interact-0.6.1/docs/api/config.md +90 -0
- lean_interact-0.6.1/docs/api/interface.md +121 -0
- lean_interact-0.6.1/docs/api/server.md +34 -0
- lean_interact-0.6.1/docs/api/sessioncache.md +52 -0
- lean_interact-0.6.1/docs/api/utils.md +98 -0
- lean_interact-0.6.1/docs/changelog.md +79 -0
- lean_interact-0.6.1/docs/contributing.md +72 -0
- lean_interact-0.6.1/docs/examples.md +87 -0
- lean_interact-0.6.1/docs/index.md +49 -0
- lean_interact-0.6.1/docs/installation.md +93 -0
- lean_interact-0.6.1/docs/troubleshooting.md +155 -0
- lean_interact-0.6.1/docs/user-guide/basic-usage.md +111 -0
- lean_interact-0.6.1/docs/user-guide/custom-lean-configuration.md +166 -0
- lean_interact-0.6.1/docs/user-guide/getting-started.md +97 -0
- lean_interact-0.6.1/docs/user-guide/tactic-mode.md +137 -0
- lean_interact-0.6.1/mkdocs.yml +129 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/pyproject.toml +11 -3
- {lean_interact-0.5.3 → lean_interact-0.6.1}/src/lean_interact/__init__.py +1 -0
- lean_interact-0.6.1/src/lean_interact/config.py +579 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/src/lean_interact/server.py +42 -117
- lean_interact-0.6.1/src/lean_interact/sessioncache.py +203 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/src/lean_interact/utils.py +14 -14
- {lean_interact-0.5.3 → lean_interact-0.6.1}/tests/test_concurrency.py +6 -5
- {lean_interact-0.5.3 → lean_interact-0.6.1}/tests/test_server.py +93 -33
- {lean_interact-0.5.3 → lean_interact-0.6.1}/uv.lock +822 -2
- lean_interact-0.5.3/src/lean_interact/config.py +0 -419
- {lean_interact-0.5.3 → lean_interact-0.6.1}/.devcontainer/devcontainer.json +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/.github/workflows/publish-to-pypi.yml +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/LICENSE +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/examples/beq_plus.py +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/examples/proof_generation_and_autoformalization.py +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/examples/type_check.py +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/src/lean_interact/interface.py +0 -0
- {lean_interact-0.5.3 → lean_interact-0.6.1}/tests/test_utils.py +0 -0
|
@@ -32,8 +32,8 @@ jobs:
|
|
|
32
32
|
|
|
33
33
|
- name: Install dependencies
|
|
34
34
|
run: |
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
pip install --upgrade pip
|
|
36
|
+
pip install . --group dev
|
|
37
37
|
|
|
38
38
|
- name: Install Lean (Linux/macOS)
|
|
39
39
|
if: runner.os != 'Windows'
|
|
@@ -60,3 +60,7 @@ jobs:
|
|
|
60
60
|
run: python -m unittest discover -s ./tests
|
|
61
61
|
env:
|
|
62
62
|
PYTHONIOENCODING: utf-8
|
|
63
|
+
|
|
64
|
+
- name: Build documentation
|
|
65
|
+
if: runner.os == 'Linux'
|
|
66
|
+
run: mkdocs build
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main # Default branch
|
|
7
|
+
- docs-test # Test branch for documentation
|
|
8
|
+
paths:
|
|
9
|
+
- 'docs/**'
|
|
10
|
+
- 'mkdocs.yml'
|
|
11
|
+
- 'src/lean_interact/**'
|
|
12
|
+
- '.github/workflows/docs.yml'
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
pages: write
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
# Allow only one concurrent deployment
|
|
22
|
+
concurrency:
|
|
23
|
+
group: 'pages'
|
|
24
|
+
cancel-in-progress: false
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
build:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Setup Python
|
|
34
|
+
uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: '3.10'
|
|
37
|
+
cache: 'pip'
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: |
|
|
41
|
+
pip install --upgrade pip
|
|
42
|
+
pip install . --group dev
|
|
43
|
+
|
|
44
|
+
- name: Install Lean
|
|
45
|
+
run: |
|
|
46
|
+
install-lean
|
|
47
|
+
echo "$HOME/.elan/bin" >> $GITHUB_PATH
|
|
48
|
+
|
|
49
|
+
- name: Build documentation
|
|
50
|
+
run: mkdocs build
|
|
51
|
+
|
|
52
|
+
- name: Setup Pages
|
|
53
|
+
uses: actions/configure-pages@v4
|
|
54
|
+
|
|
55
|
+
- name: Upload artifact
|
|
56
|
+
uses: actions/upload-pages-artifact@v3
|
|
57
|
+
with:
|
|
58
|
+
path: './site'
|
|
59
|
+
|
|
60
|
+
deploy:
|
|
61
|
+
if: github.ref == 'refs/heads/main'
|
|
62
|
+
environment:
|
|
63
|
+
name: github-pages
|
|
64
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
needs: build
|
|
67
|
+
steps:
|
|
68
|
+
- name: Deploy to GitHub Pages
|
|
69
|
+
id: deployment
|
|
70
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Update Changelog
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
update-changelog:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.10'
|
|
20
|
+
|
|
21
|
+
- name: Update Changelog
|
|
22
|
+
env:
|
|
23
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
24
|
+
run: |
|
|
25
|
+
python docs/update_changelog.py --release-tag "${{ github.event.release.tag_name }}"
|
|
26
|
+
|
|
27
|
+
- name: Commit and push changelog
|
|
28
|
+
run: |
|
|
29
|
+
git config --local user.email "action@github.com"
|
|
30
|
+
git config --local user.name "GitHub Action"
|
|
31
|
+
git add docs/changelog.md
|
|
32
|
+
git commit -m "Update changelog with ${{ github.event.release.tag_name }} release notes"
|
|
33
|
+
git push origin ${GITHUB_REF_NAME}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lean-interact
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: LeanInteract is a Python package that allows you to interact with the Lean theorem prover.
|
|
5
5
|
Author-email: Auguste Poiroux <auguste.poiroux@epfl.ch>
|
|
6
6
|
License: MIT License
|
|
@@ -29,6 +29,7 @@ Keywords: Lean,REPL,autoformalization,theorem proving
|
|
|
29
29
|
Requires-Python: >=3.10
|
|
30
30
|
Requires-Dist: filelock>=3.18.0
|
|
31
31
|
Requires-Dist: gitpython>=3.1.44
|
|
32
|
+
Requires-Dist: packaging>=24.2
|
|
32
33
|
Requires-Dist: psutil>=6.1.0
|
|
33
34
|
Requires-Dist: pydantic>=2.11.1
|
|
34
35
|
Requires-Dist: requests>=2.32.3
|
|
@@ -37,6 +38,7 @@ Description-Content-Type: text/markdown
|
|
|
37
38
|
|
|
38
39
|
# LeanInteract
|
|
39
40
|
|
|
41
|
+
[](https://augustepoiroux.github.io/LeanInteract/)
|
|
40
42
|
[](https://pypi.org/project/lean-interact/)
|
|
41
43
|
[](https://pypi.org/project/lean-interact/)
|
|
42
44
|
[](https://www.python.org/downloads/)
|
|
@@ -49,8 +51,8 @@ Description-Content-Type: text/markdown
|
|
|
49
51
|
- **🔗 Interactivity**: Execute Lean code and files directly from Python.
|
|
50
52
|
- **🚀 Ease of Use**: LeanInteract abstracts the complexities of Lean setup and interaction.
|
|
51
53
|
- **💻 Cross-platform**: Works on Windows, macOS, and Linux operating systems.
|
|
52
|
-
- **🔧 Compatibility**: Supports all Lean versions between `v4.7.0-rc1` and `v4.
|
|
53
|
-
- We backport the latest features of Lean REPL to older versions of Lean.
|
|
54
|
+
- **🔧 Compatibility**: Supports all Lean versions between `v4.7.0-rc1` and `v4.21.0-rc3`.
|
|
55
|
+
- We backport the latest features of Lean REPL to older versions of Lean (see [fork](https://github.com/augustepoiroux/repl)).
|
|
54
56
|
- **📦 Temporary Projects**: Easily instantiate temporary Lean environments.
|
|
55
57
|
- Useful for experimenting with benchmarks depending on [Mathlib](https://github.com/leanprover-community/mathlib4) like [ProofNet#](https://huggingface.co/datasets/PAug/ProofNetSharp) and [MiniF2F](https://github.com/yangky11/miniF2F-lean4).
|
|
56
58
|
|
|
@@ -109,6 +111,8 @@ In the [`examples`](examples) directory, you will find a few scripts demonstrati
|
|
|
109
111
|
|
|
110
112
|
## Usage
|
|
111
113
|
|
|
114
|
+
Full documentation is available [here](https://augustepoiroux.github.io/LeanInteract/).
|
|
115
|
+
|
|
112
116
|
### Basic example
|
|
113
117
|
|
|
114
118
|
The following code will use the default Lean version (latest available):
|
|
@@ -460,7 +464,22 @@ Two versions of Lean servers are available:
|
|
|
460
464
|
|
|
461
465
|
### Custom Lean REPL
|
|
462
466
|
|
|
463
|
-
To use a forked Lean REPL project, specify the git repository using the `repl_git` parameter in the `LeanREPLConfig
|
|
467
|
+
To use a forked Lean REPL project, specify the git repository using the `repl_git` parameter in the `LeanREPLConfig` and the target revision using the `repl_rev` parameter. For example:
|
|
468
|
+
|
|
469
|
+
```python
|
|
470
|
+
config = LeanREPLConfig(repl_rev="v4.21.0-rc3", repl_git="https://github.com/leanprover-community/repl", verbose=True)
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
> [!WARNING]
|
|
474
|
+
>
|
|
475
|
+
> Custom REPL implementations may have interfaces that are incompatible with LeanInteract's standard commands. If you encounter incompatibility issues, you can use the `run_dict` method from `LeanServer` to communicate directly with the REPL using the raw JSON protocol:
|
|
476
|
+
>
|
|
477
|
+
> ```python
|
|
478
|
+
> # Using run_dict instead of the standard commands
|
|
479
|
+
> result = server.run_dict({"cmd": "your_command_here"})
|
|
480
|
+
> ```
|
|
481
|
+
|
|
482
|
+
For assistance, feel free to contact [us](mailto:auguste.poiroux@epfl.ch).
|
|
464
483
|
|
|
465
484
|
## Similar tools
|
|
466
485
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# LeanInteract
|
|
2
2
|
|
|
3
|
+
[](https://augustepoiroux.github.io/LeanInteract/)
|
|
3
4
|
[](https://pypi.org/project/lean-interact/)
|
|
4
5
|
[](https://pypi.org/project/lean-interact/)
|
|
5
6
|
[](https://www.python.org/downloads/)
|
|
@@ -12,8 +13,8 @@
|
|
|
12
13
|
- **🔗 Interactivity**: Execute Lean code and files directly from Python.
|
|
13
14
|
- **🚀 Ease of Use**: LeanInteract abstracts the complexities of Lean setup and interaction.
|
|
14
15
|
- **💻 Cross-platform**: Works on Windows, macOS, and Linux operating systems.
|
|
15
|
-
- **🔧 Compatibility**: Supports all Lean versions between `v4.7.0-rc1` and `v4.
|
|
16
|
-
- We backport the latest features of Lean REPL to older versions of Lean.
|
|
16
|
+
- **🔧 Compatibility**: Supports all Lean versions between `v4.7.0-rc1` and `v4.21.0-rc3`.
|
|
17
|
+
- We backport the latest features of Lean REPL to older versions of Lean (see [fork](https://github.com/augustepoiroux/repl)).
|
|
17
18
|
- **📦 Temporary Projects**: Easily instantiate temporary Lean environments.
|
|
18
19
|
- Useful for experimenting with benchmarks depending on [Mathlib](https://github.com/leanprover-community/mathlib4) like [ProofNet#](https://huggingface.co/datasets/PAug/ProofNetSharp) and [MiniF2F](https://github.com/yangky11/miniF2F-lean4).
|
|
19
20
|
|
|
@@ -72,6 +73,8 @@ In the [`examples`](examples) directory, you will find a few scripts demonstrati
|
|
|
72
73
|
|
|
73
74
|
## Usage
|
|
74
75
|
|
|
76
|
+
Full documentation is available [here](https://augustepoiroux.github.io/LeanInteract/).
|
|
77
|
+
|
|
75
78
|
### Basic example
|
|
76
79
|
|
|
77
80
|
The following code will use the default Lean version (latest available):
|
|
@@ -423,7 +426,22 @@ Two versions of Lean servers are available:
|
|
|
423
426
|
|
|
424
427
|
### Custom Lean REPL
|
|
425
428
|
|
|
426
|
-
To use a forked Lean REPL project, specify the git repository using the `repl_git` parameter in the `LeanREPLConfig
|
|
429
|
+
To use a forked Lean REPL project, specify the git repository using the `repl_git` parameter in the `LeanREPLConfig` and the target revision using the `repl_rev` parameter. For example:
|
|
430
|
+
|
|
431
|
+
```python
|
|
432
|
+
config = LeanREPLConfig(repl_rev="v4.21.0-rc3", repl_git="https://github.com/leanprover-community/repl", verbose=True)
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
> [!WARNING]
|
|
436
|
+
>
|
|
437
|
+
> Custom REPL implementations may have interfaces that are incompatible with LeanInteract's standard commands. If you encounter incompatibility issues, you can use the `run_dict` method from `LeanServer` to communicate directly with the REPL using the raw JSON protocol:
|
|
438
|
+
>
|
|
439
|
+
> ```python
|
|
440
|
+
> # Using run_dict instead of the standard commands
|
|
441
|
+
> result = server.run_dict({"cmd": "your_command_here"})
|
|
442
|
+
> ```
|
|
443
|
+
|
|
444
|
+
For assistance, feel free to contact [us](mailto:auguste.poiroux@epfl.ch).
|
|
427
445
|
|
|
428
446
|
## Similar tools
|
|
429
447
|
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Configuration API
|
|
2
|
+
|
|
3
|
+
This page documents the configuration classes used to set up the Lean environment.
|
|
4
|
+
|
|
5
|
+
## LeanREPLConfig
|
|
6
|
+
|
|
7
|
+
::: lean_interact.config.LeanREPLConfig
|
|
8
|
+
options:
|
|
9
|
+
show_root_heading: true
|
|
10
|
+
show_source: true
|
|
11
|
+
heading_level: 3
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
# Basic configuration with default settings
|
|
17
|
+
config = LeanREPLConfig(verbose=True)
|
|
18
|
+
|
|
19
|
+
# Configuration with specific Lean version
|
|
20
|
+
config = LeanREPLConfig(lean_version="v4.19.0", verbose=True)
|
|
21
|
+
|
|
22
|
+
# Configuration with memory limits
|
|
23
|
+
config = LeanREPLConfig(memory_hard_limit_mb=2000)
|
|
24
|
+
|
|
25
|
+
# Configuration with custom REPL version and repository
|
|
26
|
+
config = LeanREPLConfig(
|
|
27
|
+
repl_rev="v4.21.0-rc3",
|
|
28
|
+
repl_git="https://github.com/leanprover-community/repl"
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Project Classes
|
|
33
|
+
|
|
34
|
+
### BaseProject
|
|
35
|
+
|
|
36
|
+
::: lean_interact.config.BaseProject
|
|
37
|
+
options:
|
|
38
|
+
show_root_heading: true
|
|
39
|
+
show_source: true
|
|
40
|
+
heading_level: 3
|
|
41
|
+
|
|
42
|
+
### LocalProject
|
|
43
|
+
|
|
44
|
+
::: lean_interact.config.LocalProject
|
|
45
|
+
options:
|
|
46
|
+
show_root_heading: true
|
|
47
|
+
show_source: true
|
|
48
|
+
heading_level: 3
|
|
49
|
+
|
|
50
|
+
### GitProject
|
|
51
|
+
|
|
52
|
+
::: lean_interact.config.GitProject
|
|
53
|
+
options:
|
|
54
|
+
show_root_heading: true
|
|
55
|
+
show_source: true
|
|
56
|
+
heading_level: 3
|
|
57
|
+
|
|
58
|
+
### BaseTempProject
|
|
59
|
+
|
|
60
|
+
::: lean_interact.config.BaseTempProject
|
|
61
|
+
options:
|
|
62
|
+
show_root_heading: true
|
|
63
|
+
show_source: true
|
|
64
|
+
heading_level: 3
|
|
65
|
+
|
|
66
|
+
### TemporaryProject
|
|
67
|
+
|
|
68
|
+
::: lean_interact.config.TemporaryProject
|
|
69
|
+
options:
|
|
70
|
+
show_root_heading: true
|
|
71
|
+
show_source: true
|
|
72
|
+
heading_level: 3
|
|
73
|
+
|
|
74
|
+
## Project Dependencies
|
|
75
|
+
|
|
76
|
+
### LeanRequire
|
|
77
|
+
|
|
78
|
+
::: lean_interact.config.LeanRequire
|
|
79
|
+
options:
|
|
80
|
+
show_root_heading: true
|
|
81
|
+
show_source: true
|
|
82
|
+
heading_level: 3
|
|
83
|
+
|
|
84
|
+
### TempRequireProject
|
|
85
|
+
|
|
86
|
+
::: lean_interact.config.TempRequireProject
|
|
87
|
+
options:
|
|
88
|
+
show_root_heading: true
|
|
89
|
+
show_source: true
|
|
90
|
+
heading_level: 3
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Interface API
|
|
2
|
+
|
|
3
|
+
This page documents the interface classes used to communicate with the Lean REPL.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Command
|
|
8
|
+
|
|
9
|
+
::: lean_interact.interface.Command
|
|
10
|
+
options:
|
|
11
|
+
show_root_heading: true
|
|
12
|
+
show_source: true
|
|
13
|
+
heading_level: 3
|
|
14
|
+
|
|
15
|
+
### FileCommand
|
|
16
|
+
|
|
17
|
+
::: lean_interact.interface.FileCommand
|
|
18
|
+
options:
|
|
19
|
+
show_root_heading: true
|
|
20
|
+
show_source: true
|
|
21
|
+
heading_level: 3
|
|
22
|
+
|
|
23
|
+
### ProofStep
|
|
24
|
+
|
|
25
|
+
::: lean_interact.interface.ProofStep
|
|
26
|
+
options:
|
|
27
|
+
show_root_heading: true
|
|
28
|
+
show_source: true
|
|
29
|
+
heading_level: 3
|
|
30
|
+
|
|
31
|
+
### PickleEnvironment
|
|
32
|
+
|
|
33
|
+
::: lean_interact.interface.PickleEnvironment
|
|
34
|
+
options:
|
|
35
|
+
show_root_heading: true
|
|
36
|
+
show_source: true
|
|
37
|
+
heading_level: 3
|
|
38
|
+
|
|
39
|
+
### UnpickleEnvironment
|
|
40
|
+
|
|
41
|
+
::: lean_interact.interface.UnpickleEnvironment
|
|
42
|
+
options:
|
|
43
|
+
show_root_heading: true
|
|
44
|
+
show_source: true
|
|
45
|
+
heading_level: 3
|
|
46
|
+
|
|
47
|
+
### PickleProofState
|
|
48
|
+
|
|
49
|
+
::: lean_interact.interface.PickleProofState
|
|
50
|
+
options:
|
|
51
|
+
show_root_heading: true
|
|
52
|
+
show_source: true
|
|
53
|
+
heading_level: 3
|
|
54
|
+
|
|
55
|
+
### UnpickleProofState
|
|
56
|
+
|
|
57
|
+
::: lean_interact.interface.UnpickleProofState
|
|
58
|
+
options:
|
|
59
|
+
show_root_heading: true
|
|
60
|
+
show_source: true
|
|
61
|
+
heading_level: 3
|
|
62
|
+
|
|
63
|
+
## Responses
|
|
64
|
+
|
|
65
|
+
### BaseREPLResponse
|
|
66
|
+
|
|
67
|
+
::: lean_interact.interface.BaseREPLResponse
|
|
68
|
+
options:
|
|
69
|
+
show_root_heading: true
|
|
70
|
+
show_source: true
|
|
71
|
+
heading_level: 3
|
|
72
|
+
|
|
73
|
+
### CommandResponse
|
|
74
|
+
|
|
75
|
+
::: lean_interact.interface.CommandResponse
|
|
76
|
+
options:
|
|
77
|
+
show_root_heading: true
|
|
78
|
+
show_source: true
|
|
79
|
+
heading_level: 3
|
|
80
|
+
|
|
81
|
+
### ProofStepResponse
|
|
82
|
+
|
|
83
|
+
::: lean_interact.interface.ProofStepResponse
|
|
84
|
+
options:
|
|
85
|
+
show_root_heading: true
|
|
86
|
+
show_source: true
|
|
87
|
+
heading_level: 3
|
|
88
|
+
|
|
89
|
+
## Helper Classes
|
|
90
|
+
|
|
91
|
+
### Message
|
|
92
|
+
|
|
93
|
+
::: lean_interact.interface.Message
|
|
94
|
+
options:
|
|
95
|
+
show_root_heading: true
|
|
96
|
+
show_source: true
|
|
97
|
+
heading_level: 3
|
|
98
|
+
|
|
99
|
+
### Sorry
|
|
100
|
+
|
|
101
|
+
::: lean_interact.interface.Sorry
|
|
102
|
+
options:
|
|
103
|
+
show_root_heading: true
|
|
104
|
+
show_source: true
|
|
105
|
+
heading_level: 3
|
|
106
|
+
|
|
107
|
+
### Pos
|
|
108
|
+
|
|
109
|
+
::: lean_interact.interface.Pos
|
|
110
|
+
options:
|
|
111
|
+
show_root_heading: true
|
|
112
|
+
show_source: true
|
|
113
|
+
heading_level: 3
|
|
114
|
+
|
|
115
|
+
### Tactic
|
|
116
|
+
|
|
117
|
+
::: lean_interact.interface.Tactic
|
|
118
|
+
options:
|
|
119
|
+
show_root_heading: true
|
|
120
|
+
show_source: true
|
|
121
|
+
heading_level: 3
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# LeanServer API
|
|
2
|
+
|
|
3
|
+
This page documents the server classes responsible for communicating with the Lean REPL.
|
|
4
|
+
|
|
5
|
+
## LeanServer
|
|
6
|
+
|
|
7
|
+
::: lean_interact.server.LeanServer
|
|
8
|
+
options:
|
|
9
|
+
show_root_heading: true
|
|
10
|
+
show_source: true
|
|
11
|
+
heading_level: 3
|
|
12
|
+
|
|
13
|
+
### Using `run_dict` for custom REPLs
|
|
14
|
+
|
|
15
|
+
When working with custom REPL implementations that might have incompatible interfaces with LeanInteract's standard commands, you can use the `run_dict` method to communicate directly with the REPL using the raw JSON protocol:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
# Using run_dict to send a raw command to the REPL
|
|
19
|
+
result = server.run_dict({"cmd": "your_command_here"})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This method bypasses the command-specific parsing and validation, allowing you to work with custom REPL interfaces.
|
|
23
|
+
|
|
24
|
+
## AutoLeanServer
|
|
25
|
+
|
|
26
|
+
::: lean_interact.server.AutoLeanServer
|
|
27
|
+
options:
|
|
28
|
+
show_root_heading: true
|
|
29
|
+
show_source: true
|
|
30
|
+
heading_level: 3
|
|
31
|
+
|
|
32
|
+
## Timeout Configuration
|
|
33
|
+
|
|
34
|
+
::: lean_interact.server.DEFAULT_TIMEOUT
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Session Cache API
|
|
2
|
+
|
|
3
|
+
This page documents the session cache classes responsible for storing and retrieving Lean proof states and environments.
|
|
4
|
+
Session cache is used internally by the `AutoLeanServer` class.
|
|
5
|
+
It enables efficient resumption of proofs and environments after server restarts, timeouts, and automated recover from crashes. While by default `AutoLeanServer` instantiates a fresh `PickleSessionCache` instance, you can also use a custom one. It can be useful to share a session cache between multiple `AutoLeanServer` instances, or to use a custom session cache implementation.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from lean_interact.sessioncache import PickleSessionCache
|
|
9
|
+
from lean_interact.server import AutoLeanServer
|
|
10
|
+
|
|
11
|
+
# Create a session cache
|
|
12
|
+
cache = PickleSessionCache(working_dir="./cache")
|
|
13
|
+
|
|
14
|
+
# Create a Lean server with the cache
|
|
15
|
+
server = AutoLeanServer(config=..., session_cache=cache)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Session State Classes
|
|
19
|
+
|
|
20
|
+
### SessionState
|
|
21
|
+
|
|
22
|
+
::: lean_interact.sessioncache.SessionState
|
|
23
|
+
options:
|
|
24
|
+
show_root_heading: true
|
|
25
|
+
show_source: true
|
|
26
|
+
heading_level: 3
|
|
27
|
+
|
|
28
|
+
### PickleSessionState
|
|
29
|
+
|
|
30
|
+
::: lean_interact.sessioncache.PickleSessionState
|
|
31
|
+
options:
|
|
32
|
+
show_root_heading: true
|
|
33
|
+
show_source: true
|
|
34
|
+
heading_level: 3
|
|
35
|
+
|
|
36
|
+
## Cache Implementation
|
|
37
|
+
|
|
38
|
+
### BaseSessionCache
|
|
39
|
+
|
|
40
|
+
::: lean_interact.sessioncache.BaseSessionCache
|
|
41
|
+
options:
|
|
42
|
+
show_root_heading: true
|
|
43
|
+
show_source: true
|
|
44
|
+
heading_level: 3
|
|
45
|
+
|
|
46
|
+
### PickleSessionCache
|
|
47
|
+
|
|
48
|
+
::: lean_interact.sessioncache.PickleSessionCache
|
|
49
|
+
options:
|
|
50
|
+
show_root_heading: true
|
|
51
|
+
show_source: true
|
|
52
|
+
heading_level: 3
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Utilities API
|
|
2
|
+
|
|
3
|
+
This page documents the utility functions and classes used in LeanInteract.
|
|
4
|
+
|
|
5
|
+
## Installation and Cache Management
|
|
6
|
+
|
|
7
|
+
::: lean_interact.utils.install_lean
|
|
8
|
+
options:
|
|
9
|
+
show_root_heading: true
|
|
10
|
+
show_source: true
|
|
11
|
+
|
|
12
|
+
::: lean_interact.utils.clear_cache
|
|
13
|
+
options:
|
|
14
|
+
show_root_heading: true
|
|
15
|
+
show_source: true
|
|
16
|
+
|
|
17
|
+
## Project Utilities
|
|
18
|
+
|
|
19
|
+
::: lean_interact.utils.get_project_lean_version
|
|
20
|
+
options:
|
|
21
|
+
show_root_heading: true
|
|
22
|
+
show_source: true
|
|
23
|
+
|
|
24
|
+
## Windows Path Utilities
|
|
25
|
+
|
|
26
|
+
::: lean_interact.utils.check_windows_long_paths
|
|
27
|
+
options:
|
|
28
|
+
show_root_heading: true
|
|
29
|
+
show_source: true
|
|
30
|
+
|
|
31
|
+
## Memory Management
|
|
32
|
+
|
|
33
|
+
::: lean_interact.utils.get_total_memory_usage
|
|
34
|
+
options:
|
|
35
|
+
show_root_heading: true
|
|
36
|
+
show_source: true
|
|
37
|
+
|
|
38
|
+
::: lean_interact.utils._limit_memory
|
|
39
|
+
options:
|
|
40
|
+
show_root_heading: true
|
|
41
|
+
show_source: true
|
|
42
|
+
|
|
43
|
+
## Code Processing Utilities
|
|
44
|
+
|
|
45
|
+
::: lean_interact.utils.indent_code
|
|
46
|
+
options:
|
|
47
|
+
show_root_heading: true
|
|
48
|
+
show_source: true
|
|
49
|
+
|
|
50
|
+
::: lean_interact.utils.compress_newlines
|
|
51
|
+
options:
|
|
52
|
+
show_root_heading: true
|
|
53
|
+
show_source: true
|
|
54
|
+
|
|
55
|
+
::: lean_interact.utils.lean_comments_ranges
|
|
56
|
+
options:
|
|
57
|
+
show_root_heading: true
|
|
58
|
+
show_source: true
|
|
59
|
+
|
|
60
|
+
::: lean_interact.utils.remove_lean_comments
|
|
61
|
+
options:
|
|
62
|
+
show_root_heading: true
|
|
63
|
+
show_source: true
|
|
64
|
+
|
|
65
|
+
::: lean_interact.utils.split_implementation
|
|
66
|
+
options:
|
|
67
|
+
show_root_heading: true
|
|
68
|
+
show_source: true
|
|
69
|
+
|
|
70
|
+
::: lean_interact.utils.split_conclusion
|
|
71
|
+
options:
|
|
72
|
+
show_root_heading: true
|
|
73
|
+
show_source: true
|
|
74
|
+
|
|
75
|
+
::: lean_interact.utils.clean_theorem_string
|
|
76
|
+
options:
|
|
77
|
+
show_root_heading: true
|
|
78
|
+
show_source: true
|
|
79
|
+
|
|
80
|
+
::: lean_interact.utils.extract_last_theorem
|
|
81
|
+
options:
|
|
82
|
+
show_root_heading: true
|
|
83
|
+
show_source: true
|
|
84
|
+
|
|
85
|
+
::: lean_interact.utils.clean_last_theorem_string
|
|
86
|
+
options:
|
|
87
|
+
show_root_heading: true
|
|
88
|
+
show_source: true
|
|
89
|
+
|
|
90
|
+
## Constants
|
|
91
|
+
|
|
92
|
+
::: lean_interact.utils.ROOT_DIR
|
|
93
|
+
|
|
94
|
+
::: lean_interact.utils.DEFAULT_CACHE_DIR
|
|
95
|
+
|
|
96
|
+
::: lean_interact.utils.DEFAULT_REPL_GIT_URL
|
|
97
|
+
|
|
98
|
+
::: lean_interact.utils.DEFAULT_REPL_VERSION
|