lean-interact 0.9.1__tar.gz → 0.9.2__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.9.1 → lean_interact-0.9.2}/PKG-INFO +2 -2
- {lean_interact-0.9.1 → lean_interact-0.9.2}/README.md +1 -1
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/interface.md +1 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/index.md +1 -1
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/data-extraction.md +3 -3
- {lean_interact-0.9.1 → lean_interact-0.9.2}/pyproject.toml +1 -1
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/interface.py +18 -1
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/utils.py +1 -1
- {lean_interact-0.9.1 → lean_interact-0.9.2}/tests/test_server.py +9 -5
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.devcontainer/devcontainer.json +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.github/copilot-instructions.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.github/workflows/ci.yml +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.github/workflows/docs.yml +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/.gitignore +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/LICENSE +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/.nojekyll +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/config.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/project.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/server.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/sessioncache.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/api/utils.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/contributing.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/generate_changelog.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/theme/main.html +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/basic-usage.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/custom-lean-configuration.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/examples.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/getting-started.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/installation.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/performance.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/set-options.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/tactic-mode.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/docs/user-guide/troubleshooting.md +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/examples/beq_plus.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/examples/extract_mathlib_decls.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/examples/multi_processing.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/examples/proof_generation_and_autoformalization.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/examples/type_check.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/mkdocs.yml +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/__init__.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/config.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/project.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/py.typed +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/server.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/src/lean_interact/sessioncache.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/tests/test_concurrency.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/tests/test_git_functionality.py +0 -0
- {lean_interact-0.9.1 → lean_interact-0.9.2}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lean-interact
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
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
|
|
@@ -53,7 +53,7 @@ Check the [documentation](https://augustepoiroux.github.io/LeanInteract/) for de
|
|
|
53
53
|
- **🔗 Interactivity**: Execute Lean code and files directly from Python.
|
|
54
54
|
- **🚀 Ease of Use**: LeanInteract abstracts the complexities of Lean setup and interaction.
|
|
55
55
|
- **💻 Cross-platform**: Works on Windows, macOS, and Linux operating systems.
|
|
56
|
-
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.
|
|
56
|
+
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.25.0-rc2`.
|
|
57
57
|
- We backport the latest features of Lean REPL to older versions of Lean (see [fork](https://github.com/augustepoiroux/repl)).
|
|
58
58
|
- **📦 Temporary Projects**: Easily instantiate temporary Lean environments.
|
|
59
59
|
- 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).
|
|
@@ -15,7 +15,7 @@ Check the [documentation](https://augustepoiroux.github.io/LeanInteract/) for de
|
|
|
15
15
|
- **🔗 Interactivity**: Execute Lean code and files directly from Python.
|
|
16
16
|
- **🚀 Ease of Use**: LeanInteract abstracts the complexities of Lean setup and interaction.
|
|
17
17
|
- **💻 Cross-platform**: Works on Windows, macOS, and Linux operating systems.
|
|
18
|
-
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.
|
|
18
|
+
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.25.0-rc2`.
|
|
19
19
|
- We backport the latest features of Lean REPL to older versions of Lean (see [fork](https://github.com/augustepoiroux/repl)).
|
|
20
20
|
- **📦 Temporary Projects**: Easily instantiate temporary Lean environments.
|
|
21
21
|
- 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).
|
|
@@ -17,7 +17,7 @@ hide:
|
|
|
17
17
|
- **🔗 Interactivity**: Execute Lean code and files directly from Python
|
|
18
18
|
- **🚀 Ease of Use**: LeanInteract abstracts the complexities of Lean setup and interaction
|
|
19
19
|
- **💻 Cross-platform**: Works on Windows, macOS, and Linux operating systems
|
|
20
|
-
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.
|
|
20
|
+
- **🔧 Compatibility**: Supports all Lean versions between `v4.8.0-rc1` and `v4.25.0-rc2`
|
|
21
21
|
- We backport the latest features of Lean REPL to older versions of Lean (see [fork](https://github.com/augustepoiroux/repl)).
|
|
22
22
|
- **📦 Temporary Projects**: Easily instantiate temporary Lean environments
|
|
23
23
|
- 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)
|
|
@@ -48,12 +48,12 @@ for t in resp.tactics:
|
|
|
48
48
|
|
|
49
49
|
## InfoTrees
|
|
50
50
|
|
|
51
|
-
Request `infotree` to obtain structured elaboration information. Accepted values include `"full"`, `"tactics"`, `"original"`, and `"substantive"`.
|
|
51
|
+
Request `infotree` to obtain structured elaboration information. Accepted values include `"full"`, `"tactics"`, `"original"`, and `"substantive"`. See [InfoTreeOptions](../api/interface.md#lean_interact.interface.InfoTreeOptions) for details.
|
|
52
52
|
|
|
53
53
|
```python exec="on" source="above" session="extraction" result="python"
|
|
54
|
-
from lean_interact.interface import InfoTree
|
|
54
|
+
from lean_interact.interface import InfoTree, InfoTreeOptions
|
|
55
55
|
|
|
56
|
-
res = server.run(Command(cmd=code, infotree=
|
|
56
|
+
res = server.run(Command(cmd=code, infotree=InfoTreeOptions.full))
|
|
57
57
|
trees: list[InfoTree] = res.infotree or []
|
|
58
58
|
|
|
59
59
|
# Example: iterate over all command-level nodes and print their kind
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "lean-interact"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.2"
|
|
4
4
|
description = "LeanInteract is a Python package that allows you to interact with the Lean theorem prover."
|
|
5
5
|
keywords = ["Lean", "theorem proving", "autoformalization", "REPL"]
|
|
6
6
|
license = { file = "LICENSE" }
|
|
@@ -7,6 +7,7 @@ These are aligned with the [Lean REPL's API](https://github.com/leanprover-commu
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
from collections import deque
|
|
10
|
+
from enum import Enum
|
|
10
11
|
from typing import Annotated, Generator, Literal
|
|
11
12
|
|
|
12
13
|
from pydantic import BaseModel, ConfigDict, Field
|
|
@@ -42,6 +43,22 @@ DataValue = bool | int | str | Name
|
|
|
42
43
|
Options = list[tuple[Name, DataValue]]
|
|
43
44
|
|
|
44
45
|
|
|
46
|
+
class InfoTreeOptions(str, Enum):
|
|
47
|
+
"""Options for InfoTree detail levels."""
|
|
48
|
+
|
|
49
|
+
full = "full"
|
|
50
|
+
"""No filtering: include the entire InfoTree (tactic information, term / elaboration information, messages, goal states, traces, etc.)."""
|
|
51
|
+
|
|
52
|
+
tactics = "tactics"
|
|
53
|
+
"""Keep only the nodes produced by tactics. Drops unrelated term / elaboration / non-tactic bookkeeping nodes."""
|
|
54
|
+
|
|
55
|
+
original = "original"
|
|
56
|
+
"""First keep the tactic-related nodes, then further restrict to the "original" sub‑parts of those tactic nodes (i.e. non-synthetic nodes)."""
|
|
57
|
+
|
|
58
|
+
substantive = "substantive"
|
|
59
|
+
"""Keep only the substantive content coming from tactic nodes, removing nodes that are merely a tactic combinator (e.g. `by`, `;`, multiline, parentheses)."""
|
|
60
|
+
|
|
61
|
+
|
|
45
62
|
class CommandOptions(REPLBaseModel):
|
|
46
63
|
"""Common options for `Command` and `FileCommand`."""
|
|
47
64
|
|
|
@@ -54,7 +71,7 @@ class CommandOptions(REPLBaseModel):
|
|
|
54
71
|
root_goals: Annotated[bool | None, Field(alias="rootGoals")] = None
|
|
55
72
|
"""If true, return root goals, i.e. initial goals of all declarations in the command, even if they already have a proof."""
|
|
56
73
|
|
|
57
|
-
infotree: str | None = None
|
|
74
|
+
infotree: InfoTreeOptions | str | None = None
|
|
58
75
|
"""Return syntax information. Should be "full", "tactics", "original", or "substantive". Anything else is ignored."""
|
|
59
76
|
|
|
60
77
|
incrementality: bool | None = None
|
|
@@ -22,7 +22,7 @@ logger.addHandler(handler)
|
|
|
22
22
|
ROOT_DIR = Path(__file__).resolve().parent
|
|
23
23
|
DEFAULT_CACHE_DIR = ROOT_DIR / "cache"
|
|
24
24
|
DEFAULT_REPL_GIT_URL = "https://github.com/augustepoiroux/repl"
|
|
25
|
-
DEFAULT_REPL_VERSION = "v1.3.
|
|
25
|
+
DEFAULT_REPL_VERSION = "v1.3.6"
|
|
26
26
|
|
|
27
27
|
os.makedirs(DEFAULT_CACHE_DIR, exist_ok=True)
|
|
28
28
|
|
|
@@ -25,6 +25,7 @@ from lean_interact.interface import (
|
|
|
25
25
|
DeclType,
|
|
26
26
|
DeclValue,
|
|
27
27
|
FileCommand,
|
|
28
|
+
InfoTreeOptions,
|
|
28
29
|
LeanError,
|
|
29
30
|
Message,
|
|
30
31
|
PickleEnvironment,
|
|
@@ -144,10 +145,10 @@ class TestLeanServer(unittest.TestCase):
|
|
|
144
145
|
|
|
145
146
|
def test_init_with_official_repl(self):
|
|
146
147
|
config = LeanREPLConfig(
|
|
147
|
-
repl_rev="v4.
|
|
148
|
+
repl_rev="v4.25.0-rc2", repl_git="https://github.com/leanprover-community/repl", verbose=True
|
|
148
149
|
)
|
|
149
150
|
server = AutoLeanServer(config=config)
|
|
150
|
-
self.assertEqual(server.lean_version, "v4.
|
|
151
|
+
self.assertEqual(server.lean_version, "v4.25.0-rc2")
|
|
151
152
|
response = server.run(Command(cmd="#eval Lean.versionString"), verbose=True)
|
|
152
153
|
self.assertIsInstance(response, CommandResponse)
|
|
153
154
|
self.assertEqual(
|
|
@@ -158,7 +159,7 @@ class TestLeanServer(unittest.TestCase):
|
|
|
158
159
|
start_pos=Pos(line=1, column=0),
|
|
159
160
|
end_pos=Pos(line=1, column=5),
|
|
160
161
|
severity="info",
|
|
161
|
-
data='"4.
|
|
162
|
+
data='"4.25.0-rc2"',
|
|
162
163
|
)
|
|
163
164
|
],
|
|
164
165
|
env=0,
|
|
@@ -674,7 +675,7 @@ lean_exe "dummy" where
|
|
|
674
675
|
server = AutoLeanServer(config=LeanREPLConfig(verbose=True))
|
|
675
676
|
|
|
676
677
|
# Test infotree with all possible values
|
|
677
|
-
for infotree_value in
|
|
678
|
+
for infotree_value in InfoTreeOptions:
|
|
678
679
|
result = server.run(Command(cmd="theorem infotree_test : 0 = 0 := by rfl", infotree=infotree_value))
|
|
679
680
|
self.assertIsInstance(result, CommandResponse)
|
|
680
681
|
assert isinstance(result, CommandResponse)
|
|
@@ -703,7 +704,10 @@ lean_exe "dummy" where
|
|
|
703
704
|
server = AutoLeanServer(config=LeanREPLConfig(verbose=True))
|
|
704
705
|
|
|
705
706
|
result = server.run(
|
|
706
|
-
Command(
|
|
707
|
+
Command(
|
|
708
|
+
cmd="variable (p : Prop)\ntheorem infotree_test (h : p) : 0 = 0 := by rfl",
|
|
709
|
+
infotree=InfoTreeOptions.full,
|
|
710
|
+
)
|
|
707
711
|
)
|
|
708
712
|
self.assertIsInstance(result, CommandResponse)
|
|
709
713
|
assert isinstance(result, CommandResponse)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lean_interact-0.9.1 → lean_interact-0.9.2}/examples/proof_generation_and_autoformalization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|