machinechecked 0.1.19__tar.gz → 0.1.20__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.
- {machinechecked-0.1.19 → machinechecked-0.1.20}/PKG-INFO +1 -1
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/SOURCES.txt +1 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/assess.py +10 -3
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/review_citations.py +10 -3
- machinechecked-0.1.20/engine/python/prooflens/source_names.py +176 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/pyproject.toml +1 -1
- {machinechecked-0.1.19 → machinechecked-0.1.20}/LICENSE +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/README.md +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/audit.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/authoring.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/bundle.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/cache.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/changes.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/cli.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/compare.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/composition.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/config.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/ProofLensProbe.lean +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/schema/manifest-index.schema.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/schema/published-work.schema.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/statuses.json +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/deps.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/estimates.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/excerpt.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/export.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/facts.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/manifest.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/moddocs.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/numbering.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/paper.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/pdfclaims.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/pipeline.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/probe.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/promote.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/proof_facts.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/published.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/published_work.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/rebound.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/repin.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/replay.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/requirements.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/retrieval.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/review_cli.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/review_queue.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/review_sources.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/reviews.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/simple.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/source_regions.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/status.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/steps.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/symbols.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/targets.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/uses.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/versions.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/index-CwFwjzOl.js +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/index-DSx7JAZ4.css +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/index.html +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/theme.css +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/workspace.py +0 -0
- {machinechecked-0.1.19 → machinechecked-0.1.20}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: machinechecked
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: Read a mathematical paper beside its Lean formalisation, and see claim by claim what Lean establishes.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://machinechecked.org
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: machinechecked
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.20
|
|
4
4
|
Summary: Read a mathematical paper beside its Lean formalisation, and see claim by claim what Lean establishes.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://machinechecked.org
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/SOURCES.txt
RENAMED
|
@@ -50,6 +50,7 @@ engine/python/prooflens/reviews.py
|
|
|
50
50
|
engine/python/prooflens/schemas.py
|
|
51
51
|
engine/python/prooflens/server.py
|
|
52
52
|
engine/python/prooflens/simple.py
|
|
53
|
+
engine/python/prooflens/source_names.py
|
|
53
54
|
engine/python/prooflens/source_regions.py
|
|
54
55
|
engine/python/prooflens/sources.py
|
|
55
56
|
engine/python/prooflens/status.py
|
|
@@ -833,12 +833,19 @@ class Assessor:
|
|
|
833
833
|
"reading: no review text precedes it", file=r.file, line=r.line))
|
|
834
834
|
|
|
835
835
|
def module_doc_checks(self):
|
|
836
|
-
"""A warning for each name a module docstring lists that nothing
|
|
837
|
-
advertises a result the project does not contain.
|
|
836
|
+
"""A warning for each name a module docstring of the project lists that nothing
|
|
837
|
+
declares: prose that advertises a result the project does not contain. A name of a
|
|
838
|
+
module the probe did not load is looked up in the sources (`undeclared_doc_names`), and
|
|
839
|
+
a dependency's docstrings are its own audit's. It never changes a status, and an
|
|
838
840
|
auditor can dismiss it (code `module-doc-name`, the module as subject, the name as
|
|
839
841
|
trigger)."""
|
|
840
842
|
from .moddocs import stale_doc_fingerprint, stale_doc_message, stale_doc_names
|
|
841
|
-
|
|
843
|
+
from .source_names import undeclared_doc_names
|
|
844
|
+
docs = stale_doc_names(self.lean.get("moddocs", []))
|
|
845
|
+
lean_root = getattr(self.cfg, "lean_root", None)
|
|
846
|
+
if lean_root is not None:
|
|
847
|
+
docs = undeclared_doc_names(docs, lean_root)
|
|
848
|
+
for d in docs:
|
|
842
849
|
self.add_warning("module-doc-name", d["module"], d["module"],
|
|
843
850
|
{"fingerprint": stale_doc_fingerprint(d)},
|
|
844
851
|
stale_doc_message(d), d["name"])
|
|
@@ -4,9 +4,10 @@ A review often justifies its reading by citing a lemma (`Foo.bar_eq_span`) or a
|
|
|
4
4
|
backticked token of a review file that looks like a Lean name (no spaces, and an `_` or a `.`)
|
|
5
5
|
is resolved by the probe against the environment: the project, its dependencies and Lean's own
|
|
6
6
|
library (`names` request). A name resolves when a declaration, namespace or module has it, or
|
|
7
|
-
has it as its last components
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
has it as its last components; one the environment lacks is looked up in the Lean sources of the
|
|
8
|
+
project and its Lake packages, which hold the modules the probe did not load (#221). A
|
|
9
|
+
backticked token that looks like a path (one with a file extension, or a folder ending in `/`)
|
|
10
|
+
resolves when a file or folder of the project or of its Lake packages ends with it. What does not resolve is a finding of the `warning` tier (code
|
|
10
11
|
`review-citation`), with its file and line; `review_citations_strict = true` makes it a
|
|
11
12
|
violation. Fenced code blocks, the `Review by` lines promotion writes, reviewers' names and
|
|
12
13
|
tokens matching `review_citations_ignore` (mathematical notation such as `x_i`) are skipped.
|
|
@@ -20,6 +21,7 @@ import re
|
|
|
20
21
|
from pathlib import Path
|
|
21
22
|
|
|
22
23
|
from .reviews import MARKER, PROMOTED, review_files
|
|
24
|
+
from .source_names import SourceNames, last
|
|
23
25
|
|
|
24
26
|
# Mathematical notation written in code spans: a symbol of one letter (perhaps primed) with a
|
|
25
27
|
# subscript or a field (`x_i`, `C_rel`, `X'_T`, `μ.law`), or of two letters with a short
|
|
@@ -126,6 +128,11 @@ def unresolved(cites: list[dict], names: dict | None, roots: list[Path]) -> list
|
|
|
126
128
|
out.append(c)
|
|
127
129
|
elif not path_exists(c["token"], paths):
|
|
128
130
|
out.append(c)
|
|
131
|
+
# A name the probe's environment lacks may be declared by a module it did not load (#221).
|
|
132
|
+
missing_names = {c["token"] for c in out if c["kind"] == "name"}
|
|
133
|
+
if missing_names:
|
|
134
|
+
src = SourceNames(roots, {last(t) for t in missing_names})
|
|
135
|
+
out = [c for c in out if c["kind"] != "name" or not src.known_suffix(c["token"])]
|
|
129
136
|
return out
|
|
130
137
|
|
|
131
138
|
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Declarations read from the Lean sources of the project and its Lake packages (#213).
|
|
2
|
+
|
|
3
|
+
The probe resolves names against the environment it loads: the import closure of the audited
|
|
4
|
+
modules. A module docstring or a review can name a declaration of a module that closure leaves
|
|
5
|
+
out (another module of the same library, or of a dependency). Before such a name is reported as
|
|
6
|
+
undeclared, it is looked up here, in the source files: the declarations they make (with the
|
|
7
|
+
namespaces they are made in), the namespaces those form, and the modules the files are.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
SKIP = {".git", ".machinechecked", ".prooflens", "build", "node_modules", "__pycache__"}
|
|
17
|
+
|
|
18
|
+
DECL = re.compile(
|
|
19
|
+
r"(?:@\[[^\]]*\]\s*)*"
|
|
20
|
+
r"(?:(?:private|protected|noncomputable|partial|unsafe|nonrec|scoped|public)\s+)*"
|
|
21
|
+
r"(?:theorem|lemma|def|abbrev|instance|structure|class(?:\s+inductive)?|inductive|opaque"
|
|
22
|
+
r"|axiom|irreducible_def)\s+"
|
|
23
|
+
r"(?:\([^)]*\)\s+)?" # an instance's priority
|
|
24
|
+
r"([^\s:({\[⦃]+)")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def strip_comments(text: str) -> str:
|
|
28
|
+
"""`text` with its comments (`--`, and nested `/- … -/`, docstrings included) blanked, its
|
|
29
|
+
newlines kept."""
|
|
30
|
+
out, depth, i, n = [], 0, 0, len(text)
|
|
31
|
+
while i < n:
|
|
32
|
+
two = text[i:i + 2]
|
|
33
|
+
if depth:
|
|
34
|
+
if two == "/-":
|
|
35
|
+
depth, i = depth + 1, i + 2
|
|
36
|
+
elif two == "-/":
|
|
37
|
+
depth, i = depth - 1, i + 2
|
|
38
|
+
else:
|
|
39
|
+
out.append("\n" if text[i] == "\n" else "")
|
|
40
|
+
i += 1
|
|
41
|
+
elif two == "/-":
|
|
42
|
+
depth, i = 1, i + 2
|
|
43
|
+
elif two == "--":
|
|
44
|
+
j = text.find("\n", i)
|
|
45
|
+
i = n if j < 0 else j
|
|
46
|
+
else:
|
|
47
|
+
out.append(text[i])
|
|
48
|
+
i += 1
|
|
49
|
+
return "".join(out)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def declarations(text: str) -> tuple[set[str], set[str], set[str]]:
|
|
53
|
+
"""The full names a Lean file declares, the namespaces it enters, tracking `namespace`,
|
|
54
|
+
`section`, `mutual` and `end`, and the namespaces its `open` commands name (an `open … in`,
|
|
55
|
+
which opens for one command, left out)."""
|
|
56
|
+
names: set[str] = set()
|
|
57
|
+
entered: set[str] = set()
|
|
58
|
+
opened: set[str] = set()
|
|
59
|
+
stack: list[list[str]] = []
|
|
60
|
+
for line in strip_comments(text).splitlines():
|
|
61
|
+
s = line.strip()
|
|
62
|
+
words = s.split()
|
|
63
|
+
if not words:
|
|
64
|
+
continue
|
|
65
|
+
if words[0] == "namespace" and len(words) > 1:
|
|
66
|
+
for part in words[1].split("."):
|
|
67
|
+
stack.append([part])
|
|
68
|
+
entered.add(".".join(p for e in stack for p in e))
|
|
69
|
+
continue
|
|
70
|
+
if words[0] == "open" and "in" not in words:
|
|
71
|
+
for w in words[1:]:
|
|
72
|
+
if w in ("hiding", "renaming") or w.startswith("("):
|
|
73
|
+
break
|
|
74
|
+
if w != "scoped":
|
|
75
|
+
opened.add(w)
|
|
76
|
+
continue
|
|
77
|
+
if words[0] in ("section", "mutual") or words[:2] == ["noncomputable", "section"]:
|
|
78
|
+
stack.append([])
|
|
79
|
+
continue
|
|
80
|
+
if words[0] == "end":
|
|
81
|
+
k = len(words[1].split(".")) if len(words) > 1 else 1
|
|
82
|
+
del stack[len(stack) - min(k, len(stack)):]
|
|
83
|
+
continue
|
|
84
|
+
m = DECL.match(s)
|
|
85
|
+
if not m:
|
|
86
|
+
continue
|
|
87
|
+
name = m.group(1)
|
|
88
|
+
if name.startswith("_root_."):
|
|
89
|
+
names.add(name[len("_root_."):])
|
|
90
|
+
else:
|
|
91
|
+
ns = ".".join(p for e in stack for p in e)
|
|
92
|
+
names.add(f"{ns}.{name}" if ns else name)
|
|
93
|
+
return names, entered, opened
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def lean_files(roots: list[Path]):
|
|
97
|
+
"""Every `.lean` file under `roots` (the project, and the Lake packages it depends on),
|
|
98
|
+
without version control and build output, with the module it is: its path relative to the
|
|
99
|
+
root or to its package's folder (`.lake/packages/<package>`)."""
|
|
100
|
+
for root in roots:
|
|
101
|
+
if not root.is_dir():
|
|
102
|
+
continue
|
|
103
|
+
for dirpath, dirs, files in os.walk(root):
|
|
104
|
+
dirs[:] = [d for d in dirs if d not in SKIP]
|
|
105
|
+
for f in files:
|
|
106
|
+
if f.endswith(".lean"):
|
|
107
|
+
path = Path(dirpath) / f
|
|
108
|
+
parts = path.relative_to(root).with_suffix("").parts
|
|
109
|
+
if parts[:2] == (".lake", "packages"):
|
|
110
|
+
parts = parts[3:]
|
|
111
|
+
yield path, ".".join(parts)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class SourceNames:
|
|
115
|
+
"""The declarations, namespaces and modules of the Lean sources under `roots`, read from the
|
|
116
|
+
files that mention one of `lasts` (the last components of the names to look up)."""
|
|
117
|
+
|
|
118
|
+
def __init__(self, roots: list[Path], lasts: set[str]):
|
|
119
|
+
self.names: set[str] = set()
|
|
120
|
+
self.modules: set[str] = set()
|
|
121
|
+
for path, module in lean_files(roots):
|
|
122
|
+
self.modules.add(module)
|
|
123
|
+
if not lasts:
|
|
124
|
+
continue
|
|
125
|
+
try:
|
|
126
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
127
|
+
except OSError:
|
|
128
|
+
continue
|
|
129
|
+
if any(t in text for t in lasts):
|
|
130
|
+
self.names |= declarations(text)[0]
|
|
131
|
+
self.spaces = {n.rsplit(".", 1)[0] for n in self.names if "." in n}
|
|
132
|
+
self.spaces |= {s for n in set(self.spaces) for s in prefixes(n)}
|
|
133
|
+
|
|
134
|
+
def known(self, name: str) -> bool:
|
|
135
|
+
"""Whether a declaration, a namespace or a module has the full name `name`."""
|
|
136
|
+
return name in self.names or name in self.spaces or name in self.modules
|
|
137
|
+
|
|
138
|
+
def known_suffix(self, name: str) -> bool:
|
|
139
|
+
"""Whether `name` is a declaration, namespace or module, or the last components of a
|
|
140
|
+
declaration's name."""
|
|
141
|
+
return self.known(name) or any(n.endswith("." + name) for n in self.names)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def undeclared_doc_names(docs: list[dict], lean_root: Path) -> list[dict]:
|
|
145
|
+
"""Of the names module docstrings list that the probe found undeclared
|
|
146
|
+
(`moddocs.stale_doc_names`), those of the project's own modules that its sources and its
|
|
147
|
+
packages' do not declare either. A module whose file is not in the project is a
|
|
148
|
+
dependency's, whose own audit checks its docstrings. A name is tried as written and inside
|
|
149
|
+
each namespace the docstring's file enters, as the probe tries it in the namespaces the
|
|
150
|
+
module declares into, and inside each namespace it opens, as Lean resolves the name in the
|
|
151
|
+
file (#198)."""
|
|
152
|
+
own = [d for d in docs if (lean_root / d["file"]).is_file()]
|
|
153
|
+
if not own:
|
|
154
|
+
return []
|
|
155
|
+
src = SourceNames([lean_root], {last(d["name"]) for d in own})
|
|
156
|
+
scopes: dict[str, set[str]] = {}
|
|
157
|
+
out = []
|
|
158
|
+
for d in own:
|
|
159
|
+
if d["file"] not in scopes:
|
|
160
|
+
text = (lean_root / d["file"]).read_text(encoding="utf-8", errors="replace")
|
|
161
|
+
_, entered, opened = declarations(text)
|
|
162
|
+
scopes[d["file"]] = {""} | entered | opened | {
|
|
163
|
+
f"{e}.{o}" for e in entered for o in opened}
|
|
164
|
+
if not any(src.known(f"{ns}.{d['name']}" if ns else d["name"])
|
|
165
|
+
for ns in scopes[d["file"]]):
|
|
166
|
+
out.append(d)
|
|
167
|
+
return out
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def prefixes(name: str) -> list[str]:
|
|
171
|
+
parts = name.split(".")
|
|
172
|
+
return [".".join(parts[:i]) for i in range(1, len(parts))]
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def last(name: str) -> str:
|
|
176
|
+
return name.rsplit(".", 1)[-1]
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "machinechecked"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.20"
|
|
8
8
|
description = "Read a mathematical paper beside its Lean formalisation, and see claim by claim what Lean establishes."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/requires.txt
RENAMED
|
File without changes
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/machinechecked.egg-info/top_level.txt
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
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/data/ProofLensProbe.lean
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
|
|
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
|
|
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
|
{machinechecked-0.1.19 → machinechecked-0.1.20}/engine/python/prooflens/web/assets/index-CwFwjzOl.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|