machinechecked 0.1.24__tar.gz → 0.1.25__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.24 → machinechecked-0.1.25}/PKG-INFO +1 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/SOURCES.txt +4 -2
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/assess.py +128 -45
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/audit.py +17 -6
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/cli.py +11 -3
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/config.py +2 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/content.py +5 -4
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/ProofLensProbe.lean +496 -73
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/deps.py +5 -3
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/estimates.py +2 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/export.py +20 -7
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/facts.py +2 -1
- machinechecked-0.1.25/engine/python/prooflens/layout.py +154 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/moddocs.py +2 -1
- machinechecked-0.1.25/engine/python/prooflens/notation_plan.py +186 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/numbering.py +14 -8
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/probe.py +2 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/proof_facts.py +2 -1
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/rebound.py +11 -4
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/review_citations.py +148 -12
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/simple.py +13 -17
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/source_names.py +27 -9
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/source_regions.py +196 -18
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/targets.py +2 -1
- machinechecked-0.1.24/engine/python/prooflens/web/assets/index-CiqXTIbk.css → machinechecked-0.1.25/engine/python/prooflens/web/assets/index-AZS58fGU.css +1 -1
- machinechecked-0.1.25/engine/python/prooflens/web/assets/index-D9PVfZb1.js +289 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/index.html +2 -2
- {machinechecked-0.1.24 → machinechecked-0.1.25}/pyproject.toml +1 -1
- machinechecked-0.1.24/engine/python/prooflens/web/assets/index-BecdhdKZ.js +0 -289
- {machinechecked-0.1.24 → machinechecked-0.1.25}/LICENSE +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/README.md +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/authoring.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/bundle.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/cache.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/changes.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/compare.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/composition.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/connections.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/schema/manifest-index.schema.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/schema/published-work.schema.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/semantic.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/data/statuses.json +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/dependencies.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/excerpt.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/expressions.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/impact.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/manifest.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/objects.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/paper.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/pdfclaims.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/pipeline.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/promote.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/published.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/published_work.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/readable.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/reopen.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/repin.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/replay.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/requirements.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/retire.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/retrieval.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/review_cli.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/review_queue.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/review_sources.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/reviews.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/semantic.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/status.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/steps.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/symbols.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/uses.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/version_map.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/versions.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/web/theme.css +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/engine/python/prooflens/workspace.py +0 -0
- {machinechecked-0.1.24 → machinechecked-0.1.25}/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.25
|
|
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.24 → machinechecked-0.1.25}/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.25
|
|
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.24 → machinechecked-0.1.25}/engine/python/machinechecked.egg-info/SOURCES.txt
RENAMED
|
@@ -31,8 +31,10 @@ engine/python/prooflens/expressions.py
|
|
|
31
31
|
engine/python/prooflens/facts.py
|
|
32
32
|
engine/python/prooflens/formalization.py
|
|
33
33
|
engine/python/prooflens/impact.py
|
|
34
|
+
engine/python/prooflens/layout.py
|
|
34
35
|
engine/python/prooflens/manifest.py
|
|
35
36
|
engine/python/prooflens/moddocs.py
|
|
37
|
+
engine/python/prooflens/notation_plan.py
|
|
36
38
|
engine/python/prooflens/numbering.py
|
|
37
39
|
engine/python/prooflens/objects.py
|
|
38
40
|
engine/python/prooflens/paper.py
|
|
@@ -104,6 +106,6 @@ engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
|
|
|
104
106
|
engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
|
|
105
107
|
engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
|
|
106
108
|
engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg
|
|
107
|
-
engine/python/prooflens/web/assets/index-
|
|
108
|
-
engine/python/prooflens/web/assets/index-
|
|
109
|
+
engine/python/prooflens/web/assets/index-AZS58fGU.css
|
|
110
|
+
engine/python/prooflens/web/assets/index-D9PVfZb1.js
|
|
109
111
|
engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
|
|
@@ -233,15 +233,51 @@ def _rule(c: str, o: dict) -> tuple[str, str | None]:
|
|
|
233
233
|
return "applies", TOTALISED[c]
|
|
234
234
|
|
|
235
235
|
|
|
236
|
+
def _binder_names(srec: dict) -> dict[str, str]:
|
|
237
|
+
"""The name the statement record gives each of its binders, by the binder's identity: those
|
|
238
|
+
that open it (an unnamed hypothesis is `h1`, `h2`, …) and those inside its tree."""
|
|
239
|
+
out: dict[str, str] = {}
|
|
240
|
+
|
|
241
|
+
def walk(n):
|
|
242
|
+
if not isinstance(n, dict):
|
|
243
|
+
return
|
|
244
|
+
if n.get("id") is not None and n.get("name"):
|
|
245
|
+
out.setdefault(n["id"], n["name"])
|
|
246
|
+
walk(n.get("logic"))
|
|
247
|
+
for a in n.get("args") or []:
|
|
248
|
+
walk(a)
|
|
249
|
+
for b in srec.get("binders") or []:
|
|
250
|
+
if b.get("id") is not None and b.get("name"):
|
|
251
|
+
out[b["id"]] = b["name"]
|
|
252
|
+
walk(srec.get("tree"))
|
|
253
|
+
return out
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def _subterms(o: dict, names: dict[str, str]) -> list[dict]:
|
|
257
|
+
"""The sub-term at each position of one recorded application (`at`, and `text` when the
|
|
258
|
+
probe printed it), with the binder or hypothesis around it (`within`), named as the
|
|
259
|
+
statement names it."""
|
|
260
|
+
out = []
|
|
261
|
+
for s in o.get("subterms") or []:
|
|
262
|
+
rec = {"at": s.get("at"), "text": s.get("text")}
|
|
263
|
+
w = s.get("within")
|
|
264
|
+
if isinstance(w, dict):
|
|
265
|
+
rec["within"] = {**w, "name": names.get(w.get("id")) or w.get("name")}
|
|
266
|
+
out.append(rec)
|
|
267
|
+
return out
|
|
268
|
+
|
|
269
|
+
|
|
236
270
|
def occurrences(srec: dict, c: str) -> list[dict] | None:
|
|
237
271
|
"""The applications of the totalised operation `c` that the probe read in a statement, each
|
|
238
272
|
with its type (`type`, its head constant `type_head`), the structure on it that decides the
|
|
239
|
-
rule (`structure`), the state of the rule there and the rule itself,
|
|
240
|
-
|
|
241
|
-
|
|
273
|
+
rule (`structure`), the state of the rule there and the rule itself, the positions of the
|
|
274
|
+
application in the proposition (`at`), and the sub-term at each with the binder or
|
|
275
|
+
hypothesis around it (`subterms`, when the probe printed them). None for an operation the
|
|
276
|
+
probe does not read by type, and for a record from before it read them."""
|
|
242
277
|
ops = srec.get("order_ops")
|
|
243
278
|
if not isinstance(ops, dict) or c not in READ_BY_TYPE:
|
|
244
279
|
return None
|
|
280
|
+
names = _binder_names(srec)
|
|
245
281
|
out = []
|
|
246
282
|
for o in _occurrences(c, ops):
|
|
247
283
|
state, rule = _rule(c, o)
|
|
@@ -250,6 +286,8 @@ def occurrences(srec: dict, c: str) -> list[dict] | None:
|
|
|
250
286
|
rec = {"operation": c, "type": o.get("carrier") or None,
|
|
251
287
|
"type_head": o.get("carrier_head") or None, "structure": structure,
|
|
252
288
|
"state": state, "rule": rule, "at": list(o.get("at") or [])}
|
|
289
|
+
if o.get("subterms"):
|
|
290
|
+
rec["subterms"] = _subterms(o, names)
|
|
253
291
|
if state == "applies" and o.get("conditions"):
|
|
254
292
|
conds = [{k: d[k] for k in ("condition", "state", "by", "premise", "statement")
|
|
255
293
|
if k in d} for d in o["conditions"]]
|
|
@@ -1046,8 +1084,10 @@ class Assessor:
|
|
|
1046
1084
|
(with the statement's as `statement_fingerprint`), and its id ends in `@` and that
|
|
1047
1085
|
position. A dismissal naming `at` and an application's fingerprint dismisses that
|
|
1048
1086
|
application only: the one at `at` when its fingerprint matches, otherwise the one
|
|
1049
|
-
application with that fingerprint (it moved)
|
|
1050
|
-
changes
|
|
1087
|
+
application with that fingerprint (it moved). It lapses when the application at `at`
|
|
1088
|
+
changes and it follows no application, and the warning at `at` is then marked
|
|
1089
|
+
`dismissal_stale` unless a dismissal of its own matches it. A dismissal without `at`
|
|
1090
|
+
(the form before applications were read one by one)
|
|
1051
1091
|
dismisses every warning of its operation in the statement while the statement's
|
|
1052
1092
|
fingerprint matches, and says so (`dismissed.form`: `statement`)."""
|
|
1053
1093
|
fp = srec.get("fingerprint")
|
|
@@ -1063,7 +1103,11 @@ class Assessor:
|
|
|
1063
1103
|
if d["at"] in same:
|
|
1064
1104
|
targets[(d["trigger"], d["at"])] = ("dismissed", d)
|
|
1065
1105
|
elif len(same) == 1:
|
|
1066
|
-
|
|
1106
|
+
# It follows its application, which moved there: a lapsed dismissal given at that
|
|
1107
|
+
# position does not override it, and its own old position is not marked stale.
|
|
1108
|
+
if targets.get((d["trigger"], same[0]), ("stale",))[0] == "stale":
|
|
1109
|
+
targets[(d["trigger"], same[0])] = ("dismissed", d)
|
|
1110
|
+
continue
|
|
1067
1111
|
if d["at"] not in same and any(a == d["at"] for a, _ in here):
|
|
1068
1112
|
targets.setdefault((d["trigger"], d["at"]), ("stale", d))
|
|
1069
1113
|
for i in items:
|
|
@@ -1094,27 +1138,32 @@ class Assessor:
|
|
|
1094
1138
|
f["dismissal_stale"] = True
|
|
1095
1139
|
|
|
1096
1140
|
def add_warning(self, code, subj, name, rec, message, trigger, fingerprint=None,
|
|
1097
|
-
legacy_only=False, **extra):
|
|
1141
|
+
legacy_only=False, reported=(), **extra):
|
|
1098
1142
|
"""A warning, dismissed by a dismissal of its code, subject (`name`) and trigger whose
|
|
1099
|
-
fingerprint is the subject's current one (`rec`'s)
|
|
1100
|
-
such a dismissal
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1143
|
+
fingerprint is the subject's current one (`rec`'s). A warning no dismissal matches is
|
|
1144
|
+
marked `dismissal_stale` when such a dismissal has another fingerprint that is not in
|
|
1145
|
+
`reported`, the fingerprints of the other warnings of this code, subject and trigger
|
|
1146
|
+
that the assessment reports: a dismissal of one of those is that warning's, not a
|
|
1147
|
+
lapsed dismissal of this one. The finding records `fingerprint` when given (what a
|
|
1148
|
+
dismissal of it records) and `rec`'s otherwise. With `legacy_only`, only dismissals
|
|
1149
|
+
without `at` are considered here, and one that applies is marked as naming the whole
|
|
1150
|
+
statement (`form`: `statement`)."""
|
|
1104
1151
|
fp = rec.get("fingerprint")
|
|
1105
1152
|
f = _finding("warning", code, subj, message, trigger=trigger,
|
|
1106
1153
|
fingerprint=fingerprint or fp,
|
|
1107
1154
|
signal="low" if trigger in LOW_SIGNAL else "normal", **extra)
|
|
1108
|
-
for d in self.dismissals
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1155
|
+
same = [d for d in self.dismissals
|
|
1156
|
+
if d.get("code") == code and d.get("subject") == name
|
|
1157
|
+
and d.get("trigger") == trigger
|
|
1158
|
+
and not ("at" in d and (legacy_only or code == "totalised"))]
|
|
1159
|
+
hits = [d for d in same if d.get("fingerprint") == fp]
|
|
1160
|
+
if hits:
|
|
1161
|
+
f["dismissed"] = {"rationale": hits[-1].get("rationale", ""),
|
|
1162
|
+
"by": hits[-1].get("by", "")}
|
|
1163
|
+
if legacy_only:
|
|
1164
|
+
f["dismissed"]["form"] = "statement"
|
|
1165
|
+
elif any(d.get("fingerprint") not in reported for d in same):
|
|
1166
|
+
f["dismissal_stale"] = True
|
|
1118
1167
|
self.findings.append(f)
|
|
1119
1168
|
|
|
1120
1169
|
# -- claims ---------------------------------------------------------------------------
|
|
@@ -1342,39 +1391,46 @@ class Assessor:
|
|
|
1342
1391
|
plain = [d for d in docs if d.get("kind", "none") == "none"]
|
|
1343
1392
|
found = {id(d) for d in plain} - {id(d) for d in undeclared_doc_names(plain, lean_root)}
|
|
1344
1393
|
docs = [d for d in docs if id(d) not in found]
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1394
|
+
# A name under two headings of one docstring is two warnings with two fingerprints; a
|
|
1395
|
+
# dismissal of one is not a lapsed dismissal of the other.
|
|
1396
|
+
fps = [stale_doc_fingerprint(d) for d in docs]
|
|
1397
|
+
for d, fp in zip(docs, fps):
|
|
1398
|
+
reported = {g for e, g in zip(docs, fps)
|
|
1399
|
+
if (e["module"], e["name"]) == (d["module"], d["name"])}
|
|
1400
|
+
self.add_warning("module-doc-name", d["module"], d["module"], {"fingerprint": fp},
|
|
1401
|
+
stale_doc_message(d), d["name"], reported=reported)
|
|
1349
1402
|
self.findings[-1].update(file=d["file"], line=d["line"])
|
|
1350
1403
|
|
|
1351
1404
|
def review_citation_checks(self):
|
|
1352
1405
|
"""A warning for each name or path cited in backticks by the review files that nothing
|
|
1353
|
-
resolves (`review_citations.py`),
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
token as trigger
|
|
1406
|
+
resolves (`review_citations.py`), one for each block of review text that cites it,
|
|
1407
|
+
with its file and lines; a violation when the configuration says
|
|
1408
|
+
`review_citations_strict`. The warning never changes a status, and an auditor can
|
|
1409
|
+
dismiss it (code `review-citation`, the review file as subject, the token as trigger,
|
|
1410
|
+
the block as `at`); a dismissal covers its block only (`review_citations.dismiss`)."""
|
|
1357
1411
|
from . import review_citations as rc
|
|
1358
1412
|
files = getattr(self.cfg, "reviews", None)
|
|
1359
1413
|
root = getattr(self.cfg, "root", None)
|
|
1360
1414
|
if not files or root is None:
|
|
1361
1415
|
return
|
|
1362
|
-
|
|
1416
|
+
ignore = getattr(self.cfg, "review_citations_ignore", None)
|
|
1417
|
+
cites = rc.citations(files, root, ignore)
|
|
1363
1418
|
lean_root = getattr(self.cfg, "lean_root", None) or root
|
|
1364
1419
|
bases = [root] + ([lean_root] if not lean_root.is_relative_to(root) else [])
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1420
|
+
strict = getattr(self.cfg, "review_citations_strict", False)
|
|
1421
|
+
warnings = []
|
|
1422
|
+
for w in rc.blocks(rc.unresolved(cites, self.lean.get("names"), bases)):
|
|
1423
|
+
f = _finding("violation" if strict else "warning", "review-citation", w["file"],
|
|
1424
|
+
rc.message(w) + rc.replaced_default(w["token"], ignore),
|
|
1425
|
+
trigger=w["token"], file=w["file"], line=w["line"],
|
|
1426
|
+
lines=w["lines"], at=w["at"])
|
|
1427
|
+
f["id"] += "@" + w["at"]
|
|
1428
|
+
if not strict:
|
|
1429
|
+
f.update(fingerprint=w["fingerprint"],
|
|
1430
|
+
signal="low" if w["token"] in LOW_SIGNAL else "normal")
|
|
1431
|
+
warnings.append(f)
|
|
1432
|
+
self.findings.append(f)
|
|
1433
|
+
rc.dismiss(warnings, self.dismissals)
|
|
1378
1434
|
|
|
1379
1435
|
# -- gates ----------------------------------------------------------------------------
|
|
1380
1436
|
|
|
@@ -1501,8 +1557,11 @@ class Assessor:
|
|
|
1501
1557
|
f"the source region at {c['location']} uses macros defined outside "
|
|
1502
1558
|
f"it ({where}); a change to those definitions does not change the "
|
|
1503
1559
|
"pin. Pin the definitions whose values are part of the claim "
|
|
1504
|
-
"(machinechecked inventory rebound --macro NAME)
|
|
1560
|
+
"(machinechecked inventory rebound --macro NAME). Listing a macro "
|
|
1561
|
+
"as notation reopens the readings of the passages that use it "
|
|
1562
|
+
"(machinechecked inventory notation --add NAME lists them); list the "
|
|
1505
1563
|
"notation in notation_macros", names)
|
|
1564
|
+
self.macros_pinned_elsewhere(c, region.get("pinned_elsewhere") or [])
|
|
1506
1565
|
continue
|
|
1507
1566
|
a = match_anchor(c, anchors)
|
|
1508
1567
|
if a is None:
|
|
@@ -1538,6 +1597,30 @@ class Assessor:
|
|
|
1538
1597
|
if a.get("suggested"):
|
|
1539
1598
|
self.findings[-1]["suggested"] = a["suggested"]
|
|
1540
1599
|
|
|
1600
|
+
def macros_pinned_elsewhere(self, claim: dict, macros: list[dict]):
|
|
1601
|
+
"""One warning per passage that uses macros whose definitions another claim's pin holds
|
|
1602
|
+
(`source_regions.pinned_elsewhere`): a change to such a definition fails that claim's
|
|
1603
|
+
source check, and reopens no reading of this passage. Its trigger is the set of macros;
|
|
1604
|
+
its fingerprint covers the passage's pin and the digests of the definitions, so a
|
|
1605
|
+
dismissal lapses when either changes."""
|
|
1606
|
+
if not macros:
|
|
1607
|
+
return
|
|
1608
|
+
import hashlib
|
|
1609
|
+
names = " ".join(m["macro"] for m in macros)
|
|
1610
|
+
where = "; ".join(f"{m['macro']} at {', '.join(m['defined'])}, pinned by "
|
|
1611
|
+
f"{', '.join(m['claims'])}" for m in macros)
|
|
1612
|
+
fingerprint = hashlib.sha256("".join(
|
|
1613
|
+
[f"passage {claim.get('source_sha256')}\n"]
|
|
1614
|
+
+ [f"macro {m['macro']} {m['sha256']}\n" for m in macros]).encode()).hexdigest()
|
|
1615
|
+
self.add_warning(
|
|
1616
|
+
"source-macro-pinned-elsewhere", claim["id"], claim["id"],
|
|
1617
|
+
{"fingerprint": fingerprint},
|
|
1618
|
+
f"the source region at {claim['location']} uses macros whose definitions another "
|
|
1619
|
+
f"claim pins ({where}); a change to those definitions fails that claim's source "
|
|
1620
|
+
"check but reopens no reading of this passage. Pin them in this claim too "
|
|
1621
|
+
"(machinechecked inventory rebound --macro NAME) for its readings to depend on "
|
|
1622
|
+
"them", names)
|
|
1623
|
+
|
|
1541
1624
|
|
|
1542
1625
|
def unpinned_passages(inventory: dict, tex: dict | None) -> dict[str, str]:
|
|
1543
1626
|
"""The claims whose passage in the manuscript no longer matches their pin, each with the
|
|
@@ -125,8 +125,9 @@ def source_path(lean_root: Path, module: str | None) -> str | None:
|
|
|
125
125
|
project rather than in a dependency."""
|
|
126
126
|
if not module or not re.fullmatch(r"[\w.']+", module):
|
|
127
127
|
return None
|
|
128
|
+
from .layout import module_file
|
|
128
129
|
sr = source_root(lean_root)
|
|
129
|
-
rel =
|
|
130
|
+
rel = module_file(lean_root, module)
|
|
130
131
|
if sr is None or not (lean_root / rel).is_file():
|
|
131
132
|
return None
|
|
132
133
|
return sr[1] + rel
|
|
@@ -136,13 +137,23 @@ def source_info(lean_root: Path | None, roots: list[str], repository: str | None
|
|
|
136
137
|
private: bool = False) -> dict:
|
|
137
138
|
"""Where the reader's Lean source links point: the GitHub repository (given, else the
|
|
138
139
|
project's `origin` remote), whether it is private (the reader then does not show its name;
|
|
139
|
-
the links still name it), the
|
|
140
|
-
|
|
140
|
+
the links still name it), the path inside it of the folder that holds the modules
|
|
141
|
+
(`source_prefix`: the project's path joined with its libraries' source folder), and the
|
|
142
|
+
top-level module names whose files are the project's own and in that folder. When the
|
|
143
|
+
libraries keep their sources in different folders, the folder most of them use is given,
|
|
144
|
+
and the roots in the others get no source link."""
|
|
145
|
+
from collections import Counter
|
|
146
|
+
from .layout import library_dir
|
|
141
147
|
if lean_root is None:
|
|
142
148
|
return {}
|
|
143
149
|
sr = source_root(lean_root)
|
|
150
|
+
dirs = {r: library_dir(lean_root, r.split(".")[0]) for r in roots}
|
|
151
|
+
present = {r: d for r, d in dirs.items()
|
|
152
|
+
if (lean_root / d / r).is_dir() or (lean_root / d / f"{r}.lean").is_file()}
|
|
153
|
+
counts = Counter(present.values())
|
|
154
|
+
common = min(counts, key=lambda d: (-counts[d], d != ".", d)) if counts else "."
|
|
155
|
+
prefix = None if sr is None else sr[1] + ("" if common == "." else common + "/")
|
|
144
156
|
return {"repository": repository or github_repository(lean_root),
|
|
145
157
|
"repository_private": bool(private),
|
|
146
|
-
"source_prefix":
|
|
147
|
-
"source_roots": sorted(r for r in
|
|
148
|
-
or (lean_root / f"{r}.lean").is_file())}
|
|
158
|
+
"source_prefix": prefix,
|
|
159
|
+
"source_roots": sorted(r for r, d in present.items() if d == common)}
|
|
@@ -931,7 +931,7 @@ NO_MODULES = ("--fix-modules: only a project with a machinechecked.toml lists `m
|
|
|
931
931
|
"zero configuration reads every built module")
|
|
932
932
|
|
|
933
933
|
|
|
934
|
-
FINDING_KEYS = ("id", "tier", "code", "subject", "message", "trigger", "file", "line",
|
|
934
|
+
FINDING_KEYS = ("id", "tier", "code", "subject", "message", "trigger", "file", "line", "lines",
|
|
935
935
|
"fingerprint", "at", "dismissed", "dismissal_stale", "resolved", "occurrences",
|
|
936
936
|
"occurrences_complete")
|
|
937
937
|
|
|
@@ -1167,6 +1167,13 @@ def _build_full(a, site: str | None = None, refresh: bool = False, fix_modules:
|
|
|
1167
1167
|
print(f"note: {len(whole)} totalisation warning(s) are dismissed by a dismissal of the "
|
|
1168
1168
|
"operation in the whole statement, which holds until the statement changes; a "
|
|
1169
1169
|
"dismissal with the warning's `at` and `fingerprint` names one application")
|
|
1170
|
+
by_file = [f for f in details if f["code"] == "review-citation"
|
|
1171
|
+
and (f.get("dismissed") or {}).get("form") == "file"]
|
|
1172
|
+
if by_file:
|
|
1173
|
+
print(f"note: {len(by_file)} review-citation warning(s) are dismissed by a dismissal "
|
|
1174
|
+
"without `at`, which covers the first block of review text citing the token in "
|
|
1175
|
+
"its file and no other; a dismissal with the warning's `at` and `fingerprint` "
|
|
1176
|
+
"names one block")
|
|
1170
1177
|
rg = _replay_guard(cfg, res["evidence"])
|
|
1171
1178
|
if rg and rg["message"]:
|
|
1172
1179
|
print(f"note: independent replay: {rg['message']}")
|
|
@@ -1789,7 +1796,7 @@ def cmd_review_promote(a):
|
|
|
1789
1796
|
|
|
1790
1797
|
|
|
1791
1798
|
INVENTORY = {"regions": "source_regions", "repin": "repin", "rebound": "rebound",
|
|
1792
|
-
"retire": "retire"}
|
|
1799
|
+
"retire": "retire", "notation": "notation_plan"}
|
|
1793
1800
|
|
|
1794
1801
|
|
|
1795
1802
|
def cmd_inventory(a):
|
|
@@ -2184,7 +2191,8 @@ def _add_inventory(sub) -> None:
|
|
|
2184
2191
|
description="regions: hash line pins as regions at the revision they were pinned at "
|
|
2185
2192
|
"(docs/SOURCE_REGIONS.md); rebound: change the bounds of claims' regions there; repin: "
|
|
2186
2193
|
"move the claims to a new revision of the paper; retire: remove the readings review markers "
|
|
2187
|
-
"record of passages that no longer use their declaration
|
|
2194
|
+
"record of passages that no longer use their declaration; notation: report the readings "
|
|
2195
|
+
"a change to notation_macros would reopen (it writes nothing). "
|
|
2188
2196
|
"Each prints a plan, and changes files only with --write; pass --help after the action "
|
|
2189
2197
|
"for its options.")
|
|
2190
2198
|
iv.add_argument("action", choices=sorted(INVENTORY))
|
|
@@ -81,7 +81,8 @@ class Config:
|
|
|
81
81
|
repository: str | None = None # "owner/repo" of the Lean source, if not the git remote
|
|
82
82
|
repository_private: bool = False # the reader does not show the repository's name
|
|
83
83
|
# Citations in review text (`review_citations.py`): patterns of backticked tokens that are
|
|
84
|
-
# notation, not names
|
|
84
|
+
# notation, not names, which replace the default ones (None: the defaults,
|
|
85
|
+
# `review_citations.DEFAULT_IGNORE`), and whether an unresolved one is a violation.
|
|
85
86
|
review_citations_ignore: list[str] | None = None
|
|
86
87
|
review_citations_strict: bool = False
|
|
87
88
|
# Reviewers whose review markers count without review text before them (`assess.py`).
|
|
@@ -75,14 +75,14 @@ def claim_declarations(c: dict, defs: bool = True) -> set[str]:
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def several(papers, tex: dict, inv_claims: list[dict], auxes: dict, full: list[dict],
|
|
78
|
-
blocks: list[dict], fy, retrieval, notes: list[str]) -> dict:
|
|
78
|
+
blocks: list[dict], fy, retrieval, notes: list[str], root=None) -> dict:
|
|
79
79
|
"""The Lean's references to the numbers of a configuration's several papers: each is
|
|
80
80
|
attributed to one paper (`numbering.attribute`) and checked against that paper's numbering;
|
|
81
81
|
one that cannot be attributed stays unchecked, with the reason."""
|
|
82
82
|
from . import formalization as fz
|
|
83
83
|
from . import numbering as nb
|
|
84
84
|
from .simple import claim_text
|
|
85
|
-
refs = nb.find_references(full, blocks)
|
|
85
|
+
refs = nb.find_references(full, blocks, root=root)
|
|
86
86
|
def named(pid, defs):
|
|
87
87
|
return set().union(set(), *(claim_declarations(c, defs) for c in inv_claims
|
|
88
88
|
if c.get("paper") == pid))
|
|
@@ -160,14 +160,15 @@ def build(cfg, tex: dict, inv_claims: list[dict], auxes: dict, lake: str = "lake
|
|
|
160
160
|
paper = cfg.papers[0]
|
|
161
161
|
claims, inv = paper_inventory(paper.id, tex, inv_claims, auxes)
|
|
162
162
|
foreign = fz.foreign_roots(fy, paper.title) if fy and "error" not in fy else set()
|
|
163
|
-
numbering = nb.analyse(full, claims, inv, blocks, foreign, retrieval, claim_text
|
|
163
|
+
numbering = nb.analyse(full, claims, inv, blocks, foreign, retrieval, claim_text,
|
|
164
|
+
root=root)
|
|
164
165
|
note = nb.drift_note(numbering["pattern"], numbering["references"],
|
|
165
166
|
suggestions=False)
|
|
166
167
|
if note:
|
|
167
168
|
notes.append(note)
|
|
168
169
|
else:
|
|
169
170
|
numbering = several(cfg.papers, tex, inv_claims, auxes, full, blocks, fy, retrieval,
|
|
170
|
-
notes)
|
|
171
|
+
notes, root)
|
|
171
172
|
return {"schema": SCHEMA, "retrieval": retrieval.export(), "numbering": numbering,
|
|
172
173
|
"notes": notes, "modules": {"indexed": len(built) - len(failed),
|
|
173
174
|
"failed": len(failed), "unbuilt": len(unbuilt)}}
|