machinechecked 0.1.20__tar.gz → 0.1.21__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.20 → machinechecked-0.1.21}/PKG-INFO +1 -1
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/SOURCES.txt +5 -2
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/assess.py +133 -9
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/bundle.py +22 -4
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/changes.py +59 -9
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/cli.py +161 -37
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/compare.py +155 -23
- machinechecked-0.1.21/engine/python/prooflens/content.py +170 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/ProofLensProbe.lean +236 -9
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/export.py +16 -4
- machinechecked-0.1.21/engine/python/prooflens/impact.py +475 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/manifest.py +3 -1
- machinechecked-0.1.21/engine/python/prooflens/moddocs.py +76 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/numbering.py +5 -3
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/paper.py +100 -3
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/pipeline.py +30 -9
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/probe.py +2 -1
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/repin.py +241 -4
- machinechecked-0.1.21/engine/python/prooflens/retire.py +150 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/review_citations.py +4 -4
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/review_cli.py +145 -28
- machinechecked-0.1.21/engine/python/prooflens/review_queue.py +656 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/review_sources.py +8 -2
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/reviews.py +19 -8
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/simple.py +290 -56
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/source_names.py +23 -3
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/uses.py +23 -0
- machinechecked-0.1.20/engine/python/prooflens/web/assets/index-DSx7JAZ4.css → machinechecked-0.1.21/engine/python/prooflens/web/assets/index-B9PTmHiv.css +1 -1
- machinechecked-0.1.21/engine/python/prooflens/web/assets/index-DzCRuae0.js +279 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/index.html +2 -2
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/workspace.py +38 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/pyproject.toml +1 -1
- machinechecked-0.1.20/engine/python/prooflens/moddocs.py +0 -45
- machinechecked-0.1.20/engine/python/prooflens/review_queue.py +0 -246
- machinechecked-0.1.20/engine/python/prooflens/web/assets/index-CwFwjzOl.js +0 -279
- {machinechecked-0.1.20 → machinechecked-0.1.21}/LICENSE +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/README.md +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/audit.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/authoring.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/cache.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/composition.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/config.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/schema/manifest-index.schema.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/schema/published-work.schema.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/data/statuses.json +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/deps.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/estimates.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/excerpt.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/facts.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/pdfclaims.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/promote.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/proof_facts.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/published.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/published_work.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/rebound.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/replay.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/requirements.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/retrieval.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/source_regions.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/status.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/steps.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/symbols.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/targets.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/versions.py +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/engine/python/prooflens/web/theme.css +0 -0
- {machinechecked-0.1.20 → machinechecked-0.1.21}/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.21
|
|
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.20 → machinechecked-0.1.21}/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.21
|
|
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.20 → machinechecked-0.1.21}/engine/python/machinechecked.egg-info/SOURCES.txt
RENAMED
|
@@ -19,6 +19,7 @@ engine/python/prooflens/cli.py
|
|
|
19
19
|
engine/python/prooflens/compare.py
|
|
20
20
|
engine/python/prooflens/composition.py
|
|
21
21
|
engine/python/prooflens/config.py
|
|
22
|
+
engine/python/prooflens/content.py
|
|
22
23
|
engine/python/prooflens/deps.py
|
|
23
24
|
engine/python/prooflens/estimates.py
|
|
24
25
|
engine/python/prooflens/evidence.py
|
|
@@ -26,6 +27,7 @@ engine/python/prooflens/excerpt.py
|
|
|
26
27
|
engine/python/prooflens/export.py
|
|
27
28
|
engine/python/prooflens/facts.py
|
|
28
29
|
engine/python/prooflens/formalization.py
|
|
30
|
+
engine/python/prooflens/impact.py
|
|
29
31
|
engine/python/prooflens/manifest.py
|
|
30
32
|
engine/python/prooflens/moddocs.py
|
|
31
33
|
engine/python/prooflens/numbering.py
|
|
@@ -41,6 +43,7 @@ engine/python/prooflens/rebound.py
|
|
|
41
43
|
engine/python/prooflens/repin.py
|
|
42
44
|
engine/python/prooflens/replay.py
|
|
43
45
|
engine/python/prooflens/requirements.py
|
|
46
|
+
engine/python/prooflens/retire.py
|
|
44
47
|
engine/python/prooflens/retrieval.py
|
|
45
48
|
engine/python/prooflens/review_citations.py
|
|
46
49
|
engine/python/prooflens/review_cli.py
|
|
@@ -92,6 +95,6 @@ engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
|
|
|
92
95
|
engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
|
|
93
96
|
engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
|
|
94
97
|
engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg
|
|
95
|
-
engine/python/prooflens/web/assets/index-
|
|
96
|
-
engine/python/prooflens/web/assets/index-
|
|
98
|
+
engine/python/prooflens/web/assets/index-B9PTmHiv.css
|
|
99
|
+
engine/python/prooflens/web/assets/index-DzCRuae0.js
|
|
97
100
|
engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
|
|
@@ -23,6 +23,8 @@ valid, and a Comparator replay of every proof).
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import re
|
|
27
|
+
|
|
26
28
|
from .status import fields
|
|
27
29
|
|
|
28
30
|
from . import review_sources
|
|
@@ -54,8 +56,69 @@ TOTALISED = {
|
|
|
54
56
|
"MeasureTheory.condExp": "the conditional expectation is 0 for a non-integrable function",
|
|
55
57
|
"ENNReal.toReal": "∞.toReal = 0",
|
|
56
58
|
"ENNReal.toNNReal": "∞.toNNReal = 0",
|
|
59
|
+
"SupSet.sSup": "a supremum in ℝ is 0 when the set is unbounded or empty",
|
|
60
|
+
"InfSet.sInf": "an infimum in ℝ is 0 when the set is unbounded below or empty",
|
|
57
61
|
}
|
|
58
62
|
|
|
63
|
+
# Suprema and infima: a family with none gets a default value only in a type where it need not
|
|
64
|
+
# exist. The probe records each application's type (`order_ops`), and the warning names it.
|
|
65
|
+
ORDER_OPS = {"iSup": "supremum", "sSup": "supremum", "SupSet.sSup": "supremum",
|
|
66
|
+
"iInf": "infimum", "sInf": "infimum", "InfSet.sInf": "infimum"}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _order_warning(c: str, spec: str, ops) -> str | None:
|
|
70
|
+
"""The warning for the order operation `c` in `spec`, from the types of its applications
|
|
71
|
+
there: none when each is taken in a complete lattice (every family has one), the real-number
|
|
72
|
+
rule for the reals, a default value in another conditionally complete type, and an
|
|
73
|
+
unresolved type otherwise. A record without `order_ops` (an older probe) leaves the type
|
|
74
|
+
unresolved."""
|
|
75
|
+
what = ORDER_OPS[c]
|
|
76
|
+
side = "above" if what == "supremum" else "below"
|
|
77
|
+
occ = [o for o in (ops or {}).get("occurrences") or [] if o.get("const") == c]
|
|
78
|
+
if not isinstance(ops, dict):
|
|
79
|
+
return (f"the type of this {what} is not recorded (the evidence predates the record), so "
|
|
80
|
+
f"whether it can take a default value is unresolved ({c} occurs in {spec})")
|
|
81
|
+
real = [o for o in occ if o.get("carrier_head") == "Real"]
|
|
82
|
+
other = sorted({o.get("carrier") or o.get("carrier_head") or "?" for o in occ
|
|
83
|
+
if o.get("lattice") == "conditional" and o.get("carrier_head") != "Real"})
|
|
84
|
+
unknown = sorted({o.get("carrier") or "?" for o in occ
|
|
85
|
+
if o.get("carrier_head") != "Real"
|
|
86
|
+
and o.get("lattice") not in ("complete", "conditional")})
|
|
87
|
+
walked = ops.get("complete", True)
|
|
88
|
+
if not occ and walked:
|
|
89
|
+
unknown = ["not read: it is used without its type"]
|
|
90
|
+
parts = []
|
|
91
|
+
if not walked:
|
|
92
|
+
# The walk stopped early: an application it did not reach may be in any type.
|
|
93
|
+
parts.append(f"the statement is too large to read the type of every {what}, so whether "
|
|
94
|
+
"one can take a default value is unresolved")
|
|
95
|
+
if real:
|
|
96
|
+
parts.append(TOTALISED[c])
|
|
97
|
+
if other:
|
|
98
|
+
parts.append(f"a {what} in {', '.join(other)} is a default value when the family is "
|
|
99
|
+
f"empty or not bounded {side}")
|
|
100
|
+
if unknown:
|
|
101
|
+
parts.append(f"Lean finds no lattice structure on the type of a {what} "
|
|
102
|
+
f"({', '.join(unknown)}), so whether it can take a default value is "
|
|
103
|
+
"unresolved")
|
|
104
|
+
if not parts:
|
|
105
|
+
return None
|
|
106
|
+
return "; ".join(parts) + f" ({c} occurs in {spec})"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def totalised(srec: dict, spec: str) -> list[tuple[str, str]]:
|
|
110
|
+
"""The totalised operations `spec` uses, each with its warning (`TOTALISED`): the operation
|
|
111
|
+
is the trigger. Suprema and infima are judged by the types they are taken in."""
|
|
112
|
+
out = []
|
|
113
|
+
for c in srec.get("consts", []):
|
|
114
|
+
if c not in TOTALISED:
|
|
115
|
+
continue
|
|
116
|
+
msg = (_order_warning(c, spec, srec.get("order_ops")) if c in ORDER_OPS
|
|
117
|
+
else f"{TOTALISED[c]} ({c} occurs in {spec})")
|
|
118
|
+
if msg:
|
|
119
|
+
out.append((c, msg))
|
|
120
|
+
return out
|
|
121
|
+
|
|
59
122
|
|
|
60
123
|
# Totalised operations so common in analysis that a warning about them is rarely informative,
|
|
61
124
|
# and propositions whose only hypotheses are instances of inhabited classes.
|
|
@@ -203,7 +266,7 @@ class Assessor:
|
|
|
203
266
|
last = hist[-1] if hist else None
|
|
204
267
|
readers = review_sources.digests(self.inv, target, name, self.tex)
|
|
205
268
|
need = {claim: readers[claim]} if claim in readers else readers
|
|
206
|
-
why = source_claim = bare = None
|
|
269
|
+
why = source_claim = bare = split = None
|
|
207
270
|
record = last
|
|
208
271
|
if last is None:
|
|
209
272
|
state = "pending"
|
|
@@ -218,20 +281,70 @@ class Assessor:
|
|
|
218
281
|
elif record is None:
|
|
219
282
|
why, source_claim = self._unread(last, need)
|
|
220
283
|
state = "stale"
|
|
284
|
+
split = self._split(at, need)
|
|
221
285
|
else:
|
|
222
286
|
state = "author-reviewed" if record.by in self.authors else "reviewed"
|
|
223
|
-
|
|
224
|
-
|
|
287
|
+
current = state in ("reviewed", "author-reviewed")
|
|
288
|
+
out = {"state": state, "current": [record.to_json()] if current else [],
|
|
225
289
|
"stale": [r.to_json() for r in hist if r is not record or state == "stale"],
|
|
226
290
|
"source_sha256": readers}
|
|
291
|
+
if current:
|
|
292
|
+
# The marker the state rests on, and the passages whose reading it counts for here.
|
|
293
|
+
out["rests_on"] = {"file": record.file, "line": record.line, "by": record.by,
|
|
294
|
+
"passages": sorted(need)}
|
|
227
295
|
if why:
|
|
228
296
|
out["why"] = why
|
|
229
297
|
if source_claim:
|
|
230
298
|
out["source_claim"] = source_claim
|
|
231
299
|
if bare is not None:
|
|
232
300
|
out["marker"] = {"file": bare.file, "line": bare.line}
|
|
301
|
+
if split:
|
|
302
|
+
out["split"] = split
|
|
233
303
|
return out
|
|
234
304
|
|
|
305
|
+
@staticmethod
|
|
306
|
+
def _mentions(text: str, claim: dict) -> bool:
|
|
307
|
+
"""Whether review text names a claim, by its id or its printed number."""
|
|
308
|
+
if claim["id"] in text:
|
|
309
|
+
return True
|
|
310
|
+
num = claim.get("number")
|
|
311
|
+
return bool(num) and re.search(r"(?<![\w.])" + re.escape(num) + r"(?![\w]|\.\d)",
|
|
312
|
+
text) is not None
|
|
313
|
+
|
|
314
|
+
def _warn_other_section(self, claim: dict, subj: str, name: str, r: dict, rec: dict):
|
|
315
|
+
"""A warning when the definition claim `claim` is reviewed through a marker whose review
|
|
316
|
+
text names another claim that names `name`, and not this one: the reading may have been
|
|
317
|
+
written against the other passage."""
|
|
318
|
+
if not r.get("current"):
|
|
319
|
+
return
|
|
320
|
+
text = r["current"][0].get("text") or ""
|
|
321
|
+
if self._mentions(text, claim):
|
|
322
|
+
return
|
|
323
|
+
others = [c for c in review_sources.reading_claims(self.inv, "def", name)
|
|
324
|
+
if c["id"] != claim["id"] and self._mentions(text, c)]
|
|
325
|
+
if others:
|
|
326
|
+
m = r["current"][0]
|
|
327
|
+
self.add_warning(
|
|
328
|
+
"def-review-other-claim", subj, name,
|
|
329
|
+
{"fingerprint": rec.get("fingerprint") or rec.get("legacy_hash")},
|
|
330
|
+
f"{self._claim_label(claim['id'])} is reviewed through the review of {name} at "
|
|
331
|
+
f"{m['file']}:{m['line']}, whose text names "
|
|
332
|
+
+ ", ".join(self._claim_label(c["id"]) for c in others)
|
|
333
|
+
+ " and not this claim: check that it read this claim's passage",
|
|
334
|
+
f"{m['file']}:{m['line']}")
|
|
335
|
+
|
|
336
|
+
def _split(self, at: list[Review], need: dict[str, str]) -> dict | None:
|
|
337
|
+
"""When every passage in `need` has a current reading, but no one marker read them all:
|
|
338
|
+
for each passage, the markers at the declaration's current hash that read it. A review
|
|
339
|
+
must read together every passage it is asked for (a definition in a statement's closure:
|
|
340
|
+
every passage that names it), so such readings do not combine."""
|
|
341
|
+
if len(need) < 2:
|
|
342
|
+
return None
|
|
343
|
+
parts = {cid: [{"file": r.file, "line": r.line, "by": r.by} for r in at
|
|
344
|
+
if self.has_reading(r) and self._read_one(r, cid, sha) == "current"]
|
|
345
|
+
for cid, sha in sorted(need.items())}
|
|
346
|
+
return parts if all(parts.values()) else None
|
|
347
|
+
|
|
235
348
|
def has_reading(self, review: Review) -> bool:
|
|
236
349
|
"""Whether a marker records a reading: review text precedes it (its section, or the
|
|
237
350
|
`Review by` line promotion wrote), or its reviewer is allowed bare markers."""
|
|
@@ -305,6 +418,12 @@ class Assessor:
|
|
|
305
418
|
if why == "source-unpinned":
|
|
306
419
|
return (f" ({self.unpinned_note(r.get('source_claim'))}; pin the passage again and "
|
|
307
420
|
"record a reading of the new text)")
|
|
421
|
+
if why == "source-unread" and r.get("split"):
|
|
422
|
+
return (" (no single review read all the passages that name it, and a review must "
|
|
423
|
+
"read them together: " + "; ".join(
|
|
424
|
+
f"{self._claim_label(cid)} read at "
|
|
425
|
+
+ ", ".join(f"{m['file']}:{m['line']}" for m in ms)
|
|
426
|
+
for cid, ms in r["split"].items()) + ")")
|
|
308
427
|
if why == "source-unread":
|
|
309
428
|
return (f" (its last review did not read the passage of "
|
|
310
429
|
f"{self._claim_label(r.get('source_claim'))})")
|
|
@@ -528,6 +647,9 @@ class Assessor:
|
|
|
528
647
|
if cl.get("defs") and not spec:
|
|
529
648
|
res["witness_candidates"] = self.witness_candidates(cl["defs"])
|
|
530
649
|
res["def_reviews"] = dr
|
|
650
|
+
if not spec:
|
|
651
|
+
for n in names:
|
|
652
|
+
self._warn_other_section(claim, subj, n, dr[n], lean["decls"].get(n) or {})
|
|
531
653
|
for n, d in dr.items():
|
|
532
654
|
if d["state"] in ("pending", "stale"):
|
|
533
655
|
self.findings.append(_finding(
|
|
@@ -570,10 +692,8 @@ class Assessor:
|
|
|
570
692
|
# S's hypotheses (were they never met, S would hold vacuously and not be refutable).
|
|
571
693
|
if not cl.get("witness") and not res.get("refute_ok"):
|
|
572
694
|
self.witness_check(subj, spec, srec)
|
|
573
|
-
for c in srec
|
|
574
|
-
|
|
575
|
-
self.add_warning("totalised", subj, spec, srec,
|
|
576
|
-
f"{TOTALISED[c]} ({c} occurs in {spec})", c)
|
|
695
|
+
for c, msg in totalised(srec, spec):
|
|
696
|
+
self.add_warning("totalised", subj, spec, srec, msg, c)
|
|
577
697
|
regs = []
|
|
578
698
|
for r in cl.get("regimes", []):
|
|
579
699
|
w = r.get("witness")
|
|
@@ -841,10 +961,14 @@ class Assessor:
|
|
|
841
961
|
trigger)."""
|
|
842
962
|
from .moddocs import stale_doc_fingerprint, stale_doc_message, stale_doc_names
|
|
843
963
|
from .source_names import undeclared_doc_names
|
|
844
|
-
docs = stale_doc_names(self.lean.get("moddocs", []))
|
|
845
964
|
lean_root = getattr(self.cfg, "lean_root", None)
|
|
965
|
+
docs = stale_doc_names(self.lean.get("moddocs", []), lean_root)
|
|
846
966
|
if lean_root is not None:
|
|
847
|
-
|
|
967
|
+
# The sources are searched only for names that resolve to nothing; a short name
|
|
968
|
+
# that reaches a module or a namespace stays reported.
|
|
969
|
+
plain = [d for d in docs if d.get("kind", "none") == "none"]
|
|
970
|
+
found = {id(d) for d in plain} - {id(d) for d in undeclared_doc_names(plain, lean_root)}
|
|
971
|
+
docs = [d for d in docs if id(d) not in found]
|
|
848
972
|
for d in docs:
|
|
849
973
|
self.add_warning("module-doc-name", d["module"], d["module"],
|
|
850
974
|
{"fingerprint": stale_doc_fingerprint(d)},
|
|
@@ -5,6 +5,10 @@ the app's script and styles (fonts as data URIs, WOFF2 only), the pdf.js worker'
|
|
|
5
5
|
data file of the site in `window.__PROOFLENS__` (keyed by the path the app would fetch), and the
|
|
6
6
|
PDFs, base64, in `window.__PROOFLENS_PDF__`. The data scripts come first, so they are defined
|
|
7
7
|
before the app (a deferred module) runs.
|
|
8
|
+
|
|
9
|
+
The content index of every project declaration (`data/retrieval.json`) is carried only up to
|
|
10
|
+
`CONTENT_LIMIT` bytes: a larger one would make the file slow to open, so the bundle leaves it
|
|
11
|
+
out, its reader searches by name, and the result says so (`omitted`).
|
|
8
12
|
"""
|
|
9
13
|
|
|
10
14
|
from __future__ import annotations
|
|
@@ -33,7 +37,11 @@ def _inline_css(css: str, assets: Path) -> str:
|
|
|
33
37
|
return re.sub(r'url\((?:\./)?(?:assets/)?([^)]+\.woff2)\)\s*format\("woff2"\)', font, css)
|
|
34
38
|
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
CONTENT_LIMIT = 8_000_000
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def bundle(site: Path, out: Path, title: str | None = None,
|
|
44
|
+
content_limit: int = CONTENT_LIMIT) -> dict:
|
|
37
45
|
html = (site / "index.html").read_text(encoding="utf-8")
|
|
38
46
|
assets = site / "assets"
|
|
39
47
|
js_src = re.search(r'<script type="module"[^>]*src="\./(assets/[^"]+\.js)"[^>]*></script>', html)
|
|
@@ -44,9 +52,18 @@ def bundle(site: Path, out: Path, title: str | None = None) -> dict:
|
|
|
44
52
|
css = _inline_css((site / css_href.group(1)).read_text(encoding="utf-8"), assets)
|
|
45
53
|
worker = next(assets.glob("pdf.worker*.mjs"), None)
|
|
46
54
|
|
|
47
|
-
data = {}
|
|
55
|
+
data, omitted = {}, []
|
|
48
56
|
for f in sorted((site / "data").rglob("*.json")):
|
|
49
|
-
|
|
57
|
+
key = str(f.relative_to(site))
|
|
58
|
+
if key == "data/retrieval.json" and f.stat().st_size > content_limit:
|
|
59
|
+
omitted.append(f"the content index ({f.stat().st_size / 1e6:.1f} MB, over the "
|
|
60
|
+
f"bundle's limit of {content_limit / 1e6:.0f} MB): the bundle's "
|
|
61
|
+
"search finds claims and declarations by name")
|
|
62
|
+
continue
|
|
63
|
+
data[key] = json.loads(f.read_text(encoding="utf-8"))
|
|
64
|
+
if omitted and isinstance(data.get("data/index.json"), dict):
|
|
65
|
+
data["data/index.json"] = {k: v for k, v in data["data/index.json"].items()
|
|
66
|
+
if k != "retrieval"}
|
|
50
67
|
pdfs = {str(f.relative_to(site)): base64.b64encode(f.read_bytes()).decode()
|
|
51
68
|
for f in sorted((site / "data").rglob("*.pdf"))}
|
|
52
69
|
|
|
@@ -67,4 +84,5 @@ def bundle(site: Path, out: Path, title: str | None = None) -> dict:
|
|
|
67
84
|
html = re.sub(r"<title>.*?</title>", f"<title>{title}</title>", html, count=1)
|
|
68
85
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
69
86
|
out.write_text(html, encoding="utf-8")
|
|
70
|
-
return {"out": out, "size": out.stat().st_size, "files": len(data), "pdfs": len(pdfs)
|
|
87
|
+
return {"out": out, "size": out.stat().st_size, "files": len(data), "pdfs": len(pdfs),
|
|
88
|
+
"omitted": omitted}
|
|
@@ -625,21 +625,36 @@ def _declaration_changes(old: Version, new: Version) -> list[dict]:
|
|
|
625
625
|
def workspace_due(view: dict, wid: str) -> dict:
|
|
626
626
|
"""The records of a workspace (`workspace.view` against the later release's site) that are
|
|
627
627
|
not current: `stale`, with the changes their currency names, or `unchecked`, which the build
|
|
628
|
-
cannot check and are never taken as current.
|
|
629
|
-
|
|
628
|
+
cannot check and are never taken as current. Every kind is listed: evidence, findings,
|
|
629
|
+
questions, counterexamples, compositions, and the claim's reading (requirements, the
|
|
630
|
+
fragments of the paper that govern them or are proposed for them, and alignments). A
|
|
631
|
+
superseded finding and a removed fragment stay as they were and are not listed."""
|
|
630
632
|
rows = []
|
|
633
|
+
|
|
634
|
+
def add(r, cid):
|
|
635
|
+
cur = r.get("currency") or {"state": "unchecked", "changes": []}
|
|
636
|
+
if cur.get("state") == "current":
|
|
637
|
+
return
|
|
638
|
+
rows.append({"id": r["id"], "kind": r["kind"], "claim": cid,
|
|
639
|
+
"state": cur.get("state"), "changes": cur.get("changes") or [],
|
|
640
|
+
"pinned_release": (r.get("pins") or {}).get("release"),
|
|
641
|
+
**({"submitted": True} if r.get("state") == "submitted" else {}),
|
|
642
|
+
**({"proposed": True} if r.get("state") == "proposed" else {})})
|
|
643
|
+
|
|
631
644
|
for cid, c in sorted((view.get("claims") or {}).items()):
|
|
632
645
|
for group in ("evidence", "findings", "questions", "counterexamples"):
|
|
633
646
|
for r in c.get(group) or []:
|
|
634
647
|
if group == "findings" and not r.get("in_force", True):
|
|
635
648
|
continue
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
649
|
+
add(r, cid)
|
|
650
|
+
rd = c.get("reading") or {}
|
|
651
|
+
for req in rd.get("requirements") or []:
|
|
652
|
+
add(req, cid)
|
|
653
|
+
for part in ("governing", "later_uses", "proposed"):
|
|
654
|
+
for f in (req.get("fragments") or {}).get(part) or []:
|
|
655
|
+
add(f, cid)
|
|
656
|
+
for al in rd.get("alignments") or []:
|
|
657
|
+
add(al, cid)
|
|
643
658
|
for comp in c.get("compositions") or []:
|
|
644
659
|
cur = comp.get("currency") or {}
|
|
645
660
|
if cur.get("state") and cur.get("state") != "current":
|
|
@@ -875,11 +890,46 @@ def text(doc: dict, everything: bool = False) -> str:
|
|
|
875
890
|
lines.append(f" note: {e['caveat']}")
|
|
876
891
|
for t in e.get("kept_through") or []:
|
|
877
892
|
lines.append(f" stands through a change of {t}, which it does not read")
|
|
893
|
+
if doc.get("workspace"):
|
|
894
|
+
lines.append("")
|
|
895
|
+
lines += workspace_lines(doc["workspace"])
|
|
878
896
|
lines.append("")
|
|
879
897
|
lines.append(doc["note"])
|
|
880
898
|
return "\n".join(lines)
|
|
881
899
|
|
|
882
900
|
|
|
901
|
+
def workspace_lines(due: dict) -> list[str]:
|
|
902
|
+
"""The records of a workspace that are not current (`workspace_due`), for a terminal."""
|
|
903
|
+
rows = due.get("records") or []
|
|
904
|
+
out = [f"workspace {due['workspace']}: "
|
|
905
|
+
+ (f"{len(rows)} record(s) not current" if rows else "every record is current")]
|
|
906
|
+
for r in rows:
|
|
907
|
+
out.append(f" {r['kind']} {r['id']} ({r['claim']}): {r['state']}"
|
|
908
|
+
+ (", submitted" if r.get("submitted") else "")
|
|
909
|
+
+ (", proposed" if r.get("proposed") else ""))
|
|
910
|
+
for words in dict.fromkeys(_record_change_words(ch) for ch in r.get("changes") or []):
|
|
911
|
+
out.append(" because: " + words)
|
|
912
|
+
if rows:
|
|
913
|
+
out.append(" " + due["note"])
|
|
914
|
+
return out
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
def _record_change_words(ch: dict) -> str:
|
|
918
|
+
"""One change a workspace record's currency names (`workspace.currency`), in words."""
|
|
919
|
+
if ch.get("reason"):
|
|
920
|
+
return ch["reason"]
|
|
921
|
+
if ch.get("decl"):
|
|
922
|
+
return f"{ch['decl']} changed" if ch.get("now") else f"{ch['decl']} is not in the build"
|
|
923
|
+
if ch.get("region"):
|
|
924
|
+
return f"the paper's text at {ch['region']} changed" if ch.get("now") else \
|
|
925
|
+
f"the paper has no text at {ch['region']}"
|
|
926
|
+
what = ch.get("passage") or ch.get("claim")
|
|
927
|
+
if what:
|
|
928
|
+
return f"the passage of {what} changed" if ch.get("now") else \
|
|
929
|
+
f"{what} is not in the build"
|
|
930
|
+
return "changed since it was recorded"
|
|
931
|
+
|
|
932
|
+
|
|
883
933
|
def shown_texts(p: dict) -> list[tuple[str, str, str]]:
|
|
884
934
|
"""The texts that show a passage change, as (`earlier`/`later`, what, text): for a change of
|
|
885
935
|
context, the further passages that changed; otherwise the claim's own passage."""
|