machinechecked 0.1.23__tar.gz → 0.1.24__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.23 → machinechecked-0.1.24}/PKG-INFO +1 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/SOURCES.txt +4 -2
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/cli.py +67 -33
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/compare.py +104 -25
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/composition.py +50 -9
- machinechecked-0.1.24/engine/python/prooflens/connections.py +756 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/ProofLensProbe.lean +108 -29
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/schema/published-work.schema.json +300 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/dependencies.py +69 -12
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/estimates.py +769 -41
- machinechecked-0.1.24/engine/python/prooflens/expressions.py +592 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/impact.py +252 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/proof_facts.py +75 -12
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/published_work.py +71 -12
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/requirements.py +80 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/review_queue.py +18 -7
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/semantic.py +7 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/symbols.py +108 -0
- machinechecked-0.1.24/engine/python/prooflens/web/assets/index-BecdhdKZ.js +289 -0
- machinechecked-0.1.23/engine/python/prooflens/web/assets/index-I8FAYkPe.css → machinechecked-0.1.24/engine/python/prooflens/web/assets/index-CiqXTIbk.css +1 -1
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/index.html +2 -2
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/workspace.py +50 -22
- {machinechecked-0.1.23 → machinechecked-0.1.24}/pyproject.toml +1 -1
- machinechecked-0.1.23/engine/python/prooflens/web/assets/index-DC51O0h7.js +0 -289
- {machinechecked-0.1.23 → machinechecked-0.1.24}/LICENSE +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/README.md +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/assess.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/audit.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/authoring.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/bundle.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/cache.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/changes.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/config.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/content.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/schema/manifest-index.schema.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/semantic.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/data/statuses.json +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/deps.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/excerpt.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/export.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/facts.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/manifest.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/moddocs.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/numbering.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/objects.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/paper.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/pdfclaims.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/pipeline.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/probe.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/promote.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/published.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/readable.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/rebound.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/reopen.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/repin.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/replay.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/retire.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/retrieval.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/review_citations.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/review_cli.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/review_sources.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/reviews.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/simple.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/source_names.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/source_regions.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/status.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/steps.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/targets.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/uses.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/version_map.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/versions.py +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/engine/python/prooflens/web/theme.css +0 -0
- {machinechecked-0.1.23 → machinechecked-0.1.24}/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.24
|
|
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.23 → machinechecked-0.1.24}/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.24
|
|
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.23 → machinechecked-0.1.24}/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/connections.py
|
|
22
23
|
engine/python/prooflens/content.py
|
|
23
24
|
engine/python/prooflens/dependencies.py
|
|
24
25
|
engine/python/prooflens/deps.py
|
|
@@ -26,6 +27,7 @@ engine/python/prooflens/estimates.py
|
|
|
26
27
|
engine/python/prooflens/evidence.py
|
|
27
28
|
engine/python/prooflens/excerpt.py
|
|
28
29
|
engine/python/prooflens/export.py
|
|
30
|
+
engine/python/prooflens/expressions.py
|
|
29
31
|
engine/python/prooflens/facts.py
|
|
30
32
|
engine/python/prooflens/formalization.py
|
|
31
33
|
engine/python/prooflens/impact.py
|
|
@@ -102,6 +104,6 @@ engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
|
|
|
102
104
|
engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
|
|
103
105
|
engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
|
|
104
106
|
engine/python/prooflens/web/assets/cursor-editorTextHighlight-kG3uUOwL.svg
|
|
105
|
-
engine/python/prooflens/web/assets/index-
|
|
106
|
-
engine/python/prooflens/web/assets/index-
|
|
107
|
+
engine/python/prooflens/web/assets/index-BecdhdKZ.js
|
|
108
|
+
engine/python/prooflens/web/assets/index-CiqXTIbk.css
|
|
107
109
|
engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
|
|
@@ -299,21 +299,36 @@ def _simple_site(root: Path, paper: Path, web: str | None, reuse_lean: bool = Fa
|
|
|
299
299
|
|
|
300
300
|
|
|
301
301
|
def _check_summary(view: dict, root: Path) -> tuple[dict, dict]:
|
|
302
|
-
"""The semantic summary `check` gives in zero configuration, and each claim's facts
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
302
|
+
"""The semantic summary `check` gives in zero configuration, and each claim's facts
|
|
303
|
+
(`_check_workspaces`)."""
|
|
304
|
+
summary, facts, _ = _check_workspaces(view, root)
|
|
305
|
+
return summary, facts
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def _check_workspaces(view: dict, root: Path) -> tuple[dict, dict, dict]:
|
|
309
|
+
"""The semantic summary `check` gives in zero configuration, each claim's facts, and each
|
|
310
|
+
claim's computed hints: the facts of the site this view would write (`semantic.of_view`),
|
|
311
|
+
with the findings in force of the working directory's workspaces checked against that
|
|
312
|
+
site's data, and the hints their alignments give there (`estimates.workspace_hints`, which
|
|
313
|
+
the summary does not count). The site is written to a temporary directory for the purpose
|
|
314
|
+
when there are any (`check` writes no site)."""
|
|
315
|
+
from . import estimates as est
|
|
306
316
|
from . import semantic
|
|
307
317
|
work = root / cfgmod.work_dir_name(root)
|
|
308
|
-
found = None
|
|
309
|
-
|
|
318
|
+
found, hints = None, {}
|
|
319
|
+
want_found, want_hints = semantic.has_findings(work), est.has_alignments(work)
|
|
320
|
+
if want_found or want_hints:
|
|
310
321
|
import tempfile
|
|
311
322
|
from .simple import write_view_site
|
|
312
323
|
with tempfile.TemporaryDirectory() as tmp:
|
|
313
324
|
site = Path(tmp) / "site"
|
|
314
325
|
write_view_site({**view, "pdf": None}, site, None, root)
|
|
315
|
-
|
|
316
|
-
|
|
326
|
+
if want_found:
|
|
327
|
+
found = semantic.workspace_findings(work, site / "data", root)
|
|
328
|
+
if want_hints:
|
|
329
|
+
hints = est.workspace_hints(work, site / "data", work / "sources")
|
|
330
|
+
summary, facts = semantic.of_view(view["body"], root, found)
|
|
331
|
+
return summary, facts, hints
|
|
317
332
|
|
|
318
333
|
|
|
319
334
|
def _print_simple(body, summary: dict | None = None):
|
|
@@ -576,6 +591,12 @@ def _print_workspace(v: dict) -> None:
|
|
|
576
591
|
+ f" [{f['currency']['state']}]" + (f" supersedes {f['supersedes']}: "
|
|
577
592
|
f"{f['reason']}" if f.get("supersedes")
|
|
578
593
|
else ""))
|
|
594
|
+
if f.get("impact"):
|
|
595
|
+
from .impact import difference_words
|
|
596
|
+
imp = f["impact"]
|
|
597
|
+
print(f" at the use {imp['use']}: {imp['outcome']}; "
|
|
598
|
+
f"{difference_words(imp.get('difference') or {})}")
|
|
599
|
+
print(f" why: {imp.get('why')}")
|
|
579
600
|
if f.get("question"):
|
|
580
601
|
print(f" question: {f['question']}")
|
|
581
602
|
if f.get("would_decide"):
|
|
@@ -979,6 +1000,18 @@ def _check_json(a):
|
|
|
979
1000
|
sys.exit(1)
|
|
980
1001
|
|
|
981
1002
|
|
|
1003
|
+
def _with_hints(claims: list[dict], hints: dict[str, dict]) -> None:
|
|
1004
|
+
"""Each claim's computed hints from the working directory's workspaces, attributed to the
|
|
1005
|
+
workspace and auditor whose alignment gives them (`hints`), and those a difference
|
|
1006
|
+
dismissed (`dismissed_hints`): present only when there are some. Pointers, not statuses."""
|
|
1007
|
+
for c in claims:
|
|
1008
|
+
h = hints.get(c["id"]) or {}
|
|
1009
|
+
if h.get("hints"):
|
|
1010
|
+
c["hints"] = h["hints"]
|
|
1011
|
+
if h.get("dismissed"):
|
|
1012
|
+
c["dismissed_hints"] = h["dismissed"]
|
|
1013
|
+
|
|
1014
|
+
|
|
982
1015
|
def _check_full_json(a) -> tuple[dict, list[dict], bool]:
|
|
983
1016
|
"""`check --json` with a machinechecked.toml: the document's fields, its claims, and whether
|
|
984
1017
|
the assessment found a violation."""
|
|
@@ -994,6 +1027,8 @@ def _check_full_json(a) -> tuple[dict, list[dict], bool]:
|
|
|
994
1027
|
facts = {c["id"]: c.get("semantic") for c in idx["claims"]}
|
|
995
1028
|
for c in claims:
|
|
996
1029
|
c["semantic"] = facts.get(c["id"])
|
|
1030
|
+
from .estimates import workspace_hints
|
|
1031
|
+
_with_hints(claims, workspace_hints(cfg.out_dir, res["site"] / "data"))
|
|
997
1032
|
out = {"mode": "full", "release": idx["release"],
|
|
998
1033
|
"project": idx.get("project", {}).get("commit"),
|
|
999
1034
|
"semantic": idx.get("semantic"),
|
|
@@ -1040,9 +1075,10 @@ def _check_simple_json(a) -> tuple[dict, list[dict], bool]:
|
|
|
1040
1075
|
"unit": c.get("unit", "statement"), "parent": c.get("parent"),
|
|
1041
1076
|
**(_step_json(c) if c.get("unit") else {})}
|
|
1042
1077
|
for c in body["claims"]]
|
|
1043
|
-
summary, facts =
|
|
1078
|
+
summary, facts, hints = _check_workspaces(view, root)
|
|
1044
1079
|
for c in claims:
|
|
1045
1080
|
c["semantic"] = facts.get(c["id"])
|
|
1081
|
+
_with_hints(claims, hints)
|
|
1046
1082
|
num = body.get("numbering") or {"references": [], "pattern": None}
|
|
1047
1083
|
out = {"mode": "simple", "paper": body["paper"], "title": body["title"],
|
|
1048
1084
|
"release": view_release(body), "commit": body.get("commit"),
|
|
@@ -1552,6 +1588,14 @@ def cmd_compare(a):
|
|
|
1552
1588
|
if not out["results"]:
|
|
1553
1589
|
print(f"no composition is recorded for {out['subject']['claim']}")
|
|
1554
1590
|
return
|
|
1591
|
+
if op == "connections":
|
|
1592
|
+
from .connections import lines as connection_lines
|
|
1593
|
+
for c in out["results"]:
|
|
1594
|
+
print(f"{c['workspace']} ({c['mode']}), {c['reviewer']}:")
|
|
1595
|
+
print("\n".join(connection_lines(c)))
|
|
1596
|
+
if not out["results"]:
|
|
1597
|
+
print(f"no connection is recorded for {out['subject']['claim']}")
|
|
1598
|
+
return
|
|
1555
1599
|
for r in out["results"]:
|
|
1556
1600
|
print("\n".join(cmp.statement_lines(r)) if "statement" not in r
|
|
1557
1601
|
or isinstance(r.get("statement"), dict) else
|
|
@@ -1561,23 +1605,8 @@ def cmd_compare(a):
|
|
|
1561
1605
|
return
|
|
1562
1606
|
if not a.claim:
|
|
1563
1607
|
sys.exit("name a claim (its id, key or number), or give --query OP TARGET")
|
|
1564
|
-
reading =
|
|
1565
|
-
|
|
1566
|
-
from . import workspace as wsp
|
|
1567
|
-
from .targets import Snapshot
|
|
1568
|
-
cid = site.resolve_claim(a.claim)
|
|
1569
|
-
try:
|
|
1570
|
-
ws = wsp.read(wsp.find(work, a.workspace))
|
|
1571
|
-
except wsp.WorkspaceError as e:
|
|
1572
|
-
raise cmp.CompareError(str(e), "unknown-workspace") from None
|
|
1573
|
-
v = wsp.view(ws, Snapshot(work / "site" / "data"), cid, root)
|
|
1574
|
-
from .objects import derivations
|
|
1575
|
-
reading = {"workspace": ws["id"], "reviewer": v["reviewer"], "mode": v["mode"],
|
|
1576
|
-
**((v["claims"].get(cid) or {}).get("reading")
|
|
1577
|
-
or {"requirements": [], "witnesses": [], "alignments": [],
|
|
1578
|
-
"questions": []}),
|
|
1579
|
-
"compositions": (v["claims"].get(cid) or {}).get("compositions") or [],
|
|
1580
|
-
"derivations": derivations((v["claims"].get(cid) or {}).get("evidence"))}
|
|
1608
|
+
reading = cmp.workspace_reading(site, work, a.workspace, a.claim, root) \
|
|
1609
|
+
if a.workspace else None
|
|
1581
1610
|
out = cmp.claim_packet(site, a.claim, a.stage, a.limit, a.after, reading)
|
|
1582
1611
|
except cmp.CompareError as e:
|
|
1583
1612
|
if e.kind in ("no-build", "no-project") and not a.json:
|
|
@@ -2055,25 +2084,30 @@ def _add_compare(sub) -> None:
|
|
|
2055
2084
|
"search CLAIM-OR-TEXT (the project's declarations by statement content), "
|
|
2056
2085
|
"proof-facts NAME (the facts inside its proof), uses NAME (where it is "
|
|
2057
2086
|
"applied, with the source of each premise), composition CLAIM (the "
|
|
2058
|
-
"auditors' compositions for it, with --workspace for one workspace),
|
|
2087
|
+
"auditors' compositions for it, with --workspace for one workspace), "
|
|
2088
|
+
"connections CLAIM (the auditors' connections between objects), impact "
|
|
2059
2089
|
"NAME (how each main result uses it, and which claims' Lean uses it), "
|
|
2060
2090
|
"expansion KEY (a definition at the arguments of one application, by the "
|
|
2061
2091
|
"key a statement gives it)")
|
|
2062
2092
|
co.add_argument("--in", dest="within", metavar="CALLER",
|
|
2063
2093
|
help="with uses: only the applications inside this declaration, or the one "
|
|
2064
2094
|
"application with this id (app:CALLER:N), each with every local of its "
|
|
2065
|
-
"context"
|
|
2095
|
+
"context; with proof-facts: only the facts at or inside this position of "
|
|
2096
|
+
"the proof (a fact's `at`, such as an application's)")
|
|
2066
2097
|
co.add_argument("--match", metavar="TEXT",
|
|
2067
2098
|
help="with proof-facts: rank the facts by the symbols they share with TEXT")
|
|
2068
2099
|
co.add_argument("--main", action="append", metavar="NAME",
|
|
2069
2100
|
help="with impact: a main result to trace from, a declaration or a claim "
|
|
2070
2101
|
"(its linked Lean); repeat for several (default: those `workspace main` "
|
|
2071
2102
|
"saved, else the declarations linked to the paper's theorems)")
|
|
2072
|
-
co.add_argument("--limit", type=int, help="return at most this many definitions or results"
|
|
2073
|
-
|
|
2074
|
-
co.add_argument("--
|
|
2075
|
-
"
|
|
2076
|
-
|
|
2103
|
+
co.add_argument("--limit", type=int, help="return at most this many definitions or results "
|
|
2104
|
+
"(with proof-facts: the facts of one page, 200 by default)")
|
|
2105
|
+
co.add_argument("--after", metavar="ID", help="continue a list after this item (with "
|
|
2106
|
+
"proof-facts: Lean reads the page after this fact)")
|
|
2107
|
+
co.add_argument("--workspace", metavar="ID", help="include this workspace's requirements, "
|
|
2108
|
+
"compositions and connections of the claim (informed stage only); with "
|
|
2109
|
+
"--query composition or connections, only this workspace's; with --query "
|
|
2110
|
+
"impact, the main results it saves")
|
|
2077
2111
|
co.add_argument("--all-libraries", action="store_true",
|
|
2078
2112
|
help="with --query search: search every library of the project, also those "
|
|
2079
2113
|
"the paper's build leaves out because formalization.yaml maps them only to "
|
|
@@ -535,8 +535,8 @@ def _withheld(stage: str) -> list[dict]:
|
|
|
535
535
|
out.append({"section": "lean", "reason": "the Lean is shown after the reading is locked"})
|
|
536
536
|
if stage in ("read", "compare"):
|
|
537
537
|
out.append({"section": "interpretations", "reason": "correspondence notes, reviews, "
|
|
538
|
-
"symbol links, statuses
|
|
539
|
-
"verdict"})
|
|
538
|
+
"symbol links, statuses, recorded requirements and connections between "
|
|
539
|
+
"objects are shown after the verdict"})
|
|
540
540
|
return out
|
|
541
541
|
|
|
542
542
|
|
|
@@ -571,7 +571,8 @@ def claim_packet(site: Site, claim: str, stage: str = "informed", limit: int | N
|
|
|
571
571
|
"""The comparison packet of one claim: its passage, its linked declarations (and, from
|
|
572
572
|
the compare stage, unconfirmed suggestions as candidates) and the definitions they use.
|
|
573
573
|
`reading` is a workspace's reading of the claim (`requirements.reading`, with that
|
|
574
|
-
workspace's `compositions`), included at the informed
|
|
574
|
+
workspace's `compositions` and `connections`, `workspace_reading`), included at the informed
|
|
575
|
+
stage only."""
|
|
575
576
|
cid = site.resolve_claim(claim)
|
|
576
577
|
ch = site.chunk(cid)
|
|
577
578
|
if ch is None:
|
|
@@ -608,6 +609,7 @@ def claim_packet(site: Site, claim: str, stage: str = "informed", limit: int | N
|
|
|
608
609
|
if reading is not None:
|
|
609
610
|
reading = dict(reading)
|
|
610
611
|
out["interpretations"]["compositions"] = reading.pop("compositions", [])
|
|
612
|
+
out["interpretations"]["connections"] = reading.pop("connections", [])
|
|
611
613
|
out["interpretations"]["derivations"] = reading.pop("derivations", [])
|
|
612
614
|
out["interpretations"]["requirements"] = reading
|
|
613
615
|
sections.append("interpretations")
|
|
@@ -615,6 +617,30 @@ def claim_packet(site: Site, claim: str, stage: str = "informed", limit: int | N
|
|
|
615
617
|
return out
|
|
616
618
|
|
|
617
619
|
|
|
620
|
+
def workspace_reading(site: Site, work: Path, wid: str, claim: str,
|
|
621
|
+
root: Path | None = None) -> dict:
|
|
622
|
+
"""A workspace's reading of a claim, as `claim_packet` takes it: its requirements, witnesses,
|
|
623
|
+
alignments and questions, its compositions, its connections between objects and the
|
|
624
|
+
results it cites for objects, each as `workspace show` gives them."""
|
|
625
|
+
from . import workspace as wsp
|
|
626
|
+
from .connections import records
|
|
627
|
+
from .objects import derivations
|
|
628
|
+
from .targets import Snapshot
|
|
629
|
+
cid = site.resolve_claim(claim)
|
|
630
|
+
try:
|
|
631
|
+
ws = wsp.read(wsp.find(work, wid))
|
|
632
|
+
except wsp.WorkspaceError as e:
|
|
633
|
+
raise CompareError(str(e), "unknown-workspace") from None
|
|
634
|
+
v = wsp.view(ws, Snapshot(work / "site" / "data"), cid, root)
|
|
635
|
+
c = v["claims"].get(cid) or {}
|
|
636
|
+
return {"workspace": ws["id"], "reviewer": v["reviewer"], "mode": v["mode"],
|
|
637
|
+
**(c.get("reading") or {"requirements": [], "witnesses": [], "alignments": [],
|
|
638
|
+
"questions": []}),
|
|
639
|
+
"compositions": c.get("compositions") or [],
|
|
640
|
+
"connections": records(c.get("evidence")),
|
|
641
|
+
"derivations": derivations(c.get("evidence"))}
|
|
642
|
+
|
|
643
|
+
|
|
618
644
|
def unit_packet(site: Site, unit: dict, stage: str) -> dict:
|
|
619
645
|
"""The packet of one review unit at a stage of the protocol: the passages of every claim
|
|
620
646
|
of the unit, and from the compare stage the unit's own Lean (a claim's confirmed links, a
|
|
@@ -752,9 +778,13 @@ QUERIES = {
|
|
|
752
778
|
"uses": "where a declaration is applied, and the source of each premise (with --in, inside "
|
|
753
779
|
"one declaration or one application, with the context of each)",
|
|
754
780
|
"proof-facts": "the typed facts inside a declaration's proof, each with its assumptions and "
|
|
755
|
-
"cases (
|
|
781
|
+
"cases, a page at a time (with --in, those at or inside one position of the "
|
|
782
|
+
"proof, such as an application's; Lean reads each page once, and it is "
|
|
783
|
+
"cached)",
|
|
756
784
|
"composition": "the auditors' compositions for a claim: the steps, the results each rests "
|
|
757
785
|
"on, substitutions, identifications, obligations and any Lean bridge",
|
|
786
|
+
"connections": "the auditors' connections between objects for a claim: each relation with "
|
|
787
|
+
"its ends, scope, conditions and support, and whether it is current",
|
|
758
788
|
"impact": "how each main result uses a declaration (the path from its proof or its "
|
|
759
789
|
"statement, and the applications at the end), and which claims' Lean uses it",
|
|
760
790
|
"expansion": "a definition at the arguments of one application, by the key a statement, a "
|
|
@@ -803,8 +833,10 @@ def query(site: Site, op: str, target: str, limit: int | None = None, after: str
|
|
|
803
833
|
operation the engine does not extract yet answers `available: false` with its owner.
|
|
804
834
|
`search` with `every_library` searches every library of the project, also those the
|
|
805
835
|
build's index leaves out.
|
|
806
|
-
`proof-facts` answers with the facts inside the target's proof (ranked against
|
|
807
|
-
given)
|
|
836
|
+
`proof-facts` answers with one page of the facts inside the target's proof (ranked against
|
|
837
|
+
`match` when given): `limit` facts (200 by default) after the fact `after`, at or inside the
|
|
838
|
+
term position `within` (`--in`) when given; `subject` holds the declaration, locals, cases,
|
|
839
|
+
source-only lines and the page.
|
|
808
840
|
`composition` answers with the compositions recorded for the target claim in the
|
|
809
841
|
workspaces of the build's working directory (or in `workspace`): prior interpretations,
|
|
810
842
|
which an independent review reads only after its verdict. `impact` traces the target from
|
|
@@ -815,8 +847,8 @@ def query(site: Site, op: str, target: str, limit: int | None = None, after: str
|
|
|
815
847
|
context."""
|
|
816
848
|
if op not in QUERIES:
|
|
817
849
|
raise CompareError(f"no query {op!r}; the queries are: {', '.join(QUERIES)}", "bad-query")
|
|
818
|
-
if within and op
|
|
819
|
-
raise CompareError("--in goes with the
|
|
850
|
+
if within and op not in ("uses", "proof-facts"):
|
|
851
|
+
raise CompareError("--in goes with the queries uses and proof-facts", "bad-query")
|
|
820
852
|
out = {"schema": QUERY_SCHEMA, "op": op, "target": target, "limit": limit, "after": after,
|
|
821
853
|
"context": site.snapshot()}
|
|
822
854
|
if op in NOT_YET:
|
|
@@ -874,21 +906,52 @@ def query(site: Site, op: str, target: str, limit: int | None = None, after: str
|
|
|
874
906
|
"no status"}
|
|
875
907
|
prov = ("the workspaces of the working directory; a bridge's check from the facts store "
|
|
876
908
|
"(`workspace show` asks Lean again)")
|
|
909
|
+
elif op == "connections":
|
|
910
|
+
from . import connections as cn
|
|
911
|
+
from .targets import Snapshot, TargetError
|
|
912
|
+
from .workspace import WorkspaceError
|
|
913
|
+
cid = site.resolve_claim(target)
|
|
914
|
+
try:
|
|
915
|
+
results = cn.query(site.data.parent.parent, Snapshot(site.data), cid, root,
|
|
916
|
+
workspace)
|
|
917
|
+
except (WorkspaceError, TargetError) as e:
|
|
918
|
+
raise CompareError(str(e), "unknown-workspace") from None
|
|
919
|
+
out["subject"] = {"claim": cid, "contains": ["prior interpretations"],
|
|
920
|
+
"note": "a connection is an auditor's record of how two objects are "
|
|
921
|
+
"related, resting on the support it names; it changes no "
|
|
922
|
+
"status"}
|
|
923
|
+
prov = ("the workspaces of the working directory; each connection checked against the "
|
|
924
|
+
"build (applications and facts from the facts store)")
|
|
877
925
|
elif op == "proof-facts":
|
|
878
926
|
if root is None:
|
|
879
927
|
raise CompareError("`proof-facts` needs the Lean project", "no-project")
|
|
880
|
-
from .proof_facts import rank
|
|
881
|
-
|
|
928
|
+
from .proof_facts import page_request, rank
|
|
929
|
+
for code, asked in (("bad-cursor", (after, None)), ("bad-position", (None, within))):
|
|
930
|
+
try:
|
|
931
|
+
page_request(*asked)
|
|
932
|
+
except ValueError as e:
|
|
933
|
+
raise CompareError(str(e), code) from None
|
|
934
|
+
if limit is not None and limit < 1:
|
|
935
|
+
raise CompareError("--limit is the number of facts a page holds: 1 or more",
|
|
936
|
+
"bad-limit")
|
|
937
|
+
doc = _proof_facts(root, target, log, limit, after, within)
|
|
882
938
|
results = rank(doc["facts"], match) if match else doc["facts"]
|
|
883
|
-
out["subject"] = {k: doc.get(k) for k in ("declaration", "proof", "
|
|
884
|
-
"source_only", "note", "cache")}
|
|
939
|
+
out["subject"] = {k: doc.get(k) for k in ("declaration", "proof", "page", "locals",
|
|
940
|
+
"scopes", "source_only", "note", "cache")}
|
|
885
941
|
if match:
|
|
886
942
|
out["match"] = {"query": match, "candidates": len(results),
|
|
887
943
|
"of": len(doc["facts"]),
|
|
888
|
-
"note": "ranked by shared symbols
|
|
889
|
-
"one bound gives another"}
|
|
890
|
-
|
|
891
|
-
|
|
944
|
+
"note": "ranked by shared symbols among the facts of this page; a "
|
|
945
|
+
"candidate is not a claim that one bound gives another"}
|
|
946
|
+
# Lean reads one page: the retrieval is the page's, whatever the ranking keeps of it.
|
|
947
|
+
pg = doc["page"]
|
|
948
|
+
return {**out, "available": True, "results": results,
|
|
949
|
+
"provenance": "Lean (the declaration's elaborated proof), kept in the facts store "
|
|
950
|
+
"until a module it was read from changes",
|
|
951
|
+
"retrieval": {"total": pg["total"], "returned": len(results),
|
|
952
|
+
"complete": not pg["more"] and not pg["before"], "after": after,
|
|
953
|
+
"within": within, "before": pg["before"], "count": pg["count"],
|
|
954
|
+
"next": pg["next"]}}
|
|
892
955
|
else:
|
|
893
956
|
if root is None:
|
|
894
957
|
raise CompareError("`dependencies` needs the Lean project", "no-project")
|
|
@@ -1033,14 +1096,17 @@ def saved_main_results(site: Site, workspace: str | None, root: Path | None) ->
|
|
|
1033
1096
|
return {**s, "problems": wsp.main_results_problems(s, Snapshot(site.data), root)}
|
|
1034
1097
|
|
|
1035
1098
|
|
|
1036
|
-
def _proof_facts(root: Path, target: str, log
|
|
1037
|
-
|
|
1038
|
-
|
|
1099
|
+
def _proof_facts(root: Path, target: str, log, limit: int | None = None,
|
|
1100
|
+
after: str | None = None, within: str | None = None) -> dict:
|
|
1101
|
+
"""A page of the facts inside `target`'s proof (`limit` facts after the fact `after`, at or
|
|
1102
|
+
inside the position `within`), or the reason there are none, as a refusal. `target` is a
|
|
1103
|
+
declaration name, optionally `Module:Name` when several modules declare the name."""
|
|
1039
1104
|
from .proof_facts import extract
|
|
1040
1105
|
from .simple import ViewError
|
|
1041
1106
|
module, _, name = target.rpartition(":") if ":" in target else (None, "", target)
|
|
1042
1107
|
try:
|
|
1043
|
-
doc = extract(root, name, module or None, log=log
|
|
1108
|
+
doc = extract(root, name, module or None, log=log,
|
|
1109
|
+
limits={"facts": limit} if limit else None, after=after, within=within)
|
|
1044
1110
|
except ViewError as e:
|
|
1045
1111
|
raise CompareError(str(e), "no-project") from None
|
|
1046
1112
|
if not doc["ok"]:
|
|
@@ -1261,10 +1327,17 @@ def proof_facts_text(q: dict) -> str:
|
|
|
1261
1327
|
out = [f"{d.get('name')} ({d.get('kind')}, {d.get('file')}" + (f":{line}" if line else "")
|
|
1262
1328
|
+ f"; {d.get('basis')})", f" statement: {_text(d.get('statement'))}"]
|
|
1263
1329
|
m = q.get("match")
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1330
|
+
page = sub.get("page") or {}
|
|
1331
|
+
total, before, count = (page.get("total", len(q["results"])), page.get("before") or 0,
|
|
1332
|
+
page.get("count", len(q["results"])))
|
|
1333
|
+
inside = f" at or inside {page['within']} of" if page.get("within") else " inside"
|
|
1334
|
+
span = (f"{total} fact(s)" if not (before or page.get("more")) else
|
|
1335
|
+
f"fact {before + 1} of {total}" if count == 1 else
|
|
1336
|
+
f"facts {before + 1}–{before + count} of {total}" if count else
|
|
1337
|
+
f"no fact after {page.get('after')} (of {total})")
|
|
1338
|
+
out.append((f" {len(q['results'])} of {span}{inside} its proof share symbols with "
|
|
1339
|
+
f"{m['query']!r}" if m else f" {span}{inside} its proof")
|
|
1340
|
+
+ ", each established inside this proof under its context:")
|
|
1268
1341
|
locals_ = {l["id"]: l for l in sub.get("locals") or []}
|
|
1269
1342
|
for f in q["results"]:
|
|
1270
1343
|
src = f.get("source") or {}
|
|
@@ -1309,7 +1382,8 @@ def proof_facts_text(q: dict) -> str:
|
|
|
1309
1382
|
out.append(" not entered: " + ", ".join(proof["auxiliary"])
|
|
1310
1383
|
+ " (lemmas Lean generated for parts of the proof; ask about each by name)")
|
|
1311
1384
|
if q["retrieval"].get("next"):
|
|
1312
|
-
out.append(f" (more: --after {q['retrieval']['next']}
|
|
1385
|
+
out.append(f" (more: --after {q['retrieval']['next']}"
|
|
1386
|
+
+ (f" --in {page['within']}" if page.get("within") else "") + ")")
|
|
1313
1387
|
out.append(f" {sub.get('note')}")
|
|
1314
1388
|
if (sub.get("cache") or {}).get("hit"):
|
|
1315
1389
|
out.append(" (from the cache: no Lean input changed)")
|
|
@@ -1329,6 +1403,11 @@ def packet_text(pk: dict) -> str:
|
|
|
1329
1403
|
from .composition import lines as composition_lines
|
|
1330
1404
|
out.append("\n".join(["Compositions recorded in that workspace"]
|
|
1331
1405
|
+ [x for c in comps for x in composition_lines(c)]))
|
|
1406
|
+
conns = (pk.get("interpretations") or {}).get("connections") or []
|
|
1407
|
+
if conns:
|
|
1408
|
+
from .connections import lines as connection_lines
|
|
1409
|
+
out.append("\n".join(["Connections between objects recorded in that workspace"]
|
|
1410
|
+
+ [x for c in conns for x in connection_lines(c)]))
|
|
1332
1411
|
if pk["paper"].get("note"):
|
|
1333
1412
|
out.insert(0, pk["paper"]["note"])
|
|
1334
1413
|
lean = pk.get("lean")
|
|
@@ -5,10 +5,15 @@ A composition is an ordered argument. Each step says what it establishes and res
|
|
|
5
5
|
records of the workspace (a declaration, an application of a declaration as `compare --query
|
|
6
6
|
uses` gives it, or a fact inside a proof) or on earlier steps; it records the substitutions it
|
|
7
7
|
makes (the actual arguments given to a result's variables) and any inference of the auditor's
|
|
8
|
-
own. Identifications say which objects of different steps are the same, and how that is known
|
|
8
|
+
own. Identifications say which objects of different steps are the same, and how that is known;
|
|
9
|
+
one can rest on connections between the objects (`connections.py`), whose relation must fit it.
|
|
9
10
|
Obligations are what the argument still needs (compatible witness choices, a local-to-global
|
|
10
11
|
step, an equality transport, a constant's allowed dependence, a genericity condition), each open
|
|
11
|
-
or discharged by named steps or evidence. Citing a declaration discharges nothing by itself.
|
|
12
|
+
or discharged by named steps or evidence. Citing a declaration discharges nothing by itself. An
|
|
13
|
+
identification of two objects as the same (or equal) through a connection that holds only on a
|
|
14
|
+
domain, along a filter or between classes leaves a `local to global` (or `equality transport`)
|
|
15
|
+
obligation naming that connection: the service adds it, open, when the auditor has not, and such
|
|
16
|
+
connections alone never discharge it.
|
|
12
17
|
|
|
13
18
|
A composition records a coverage (the links file's words). Its basis is computed, never written:
|
|
14
19
|
`reviewed_composition`, the auditor's argument, which Lean has not checked; or `checked_bridge`
|
|
@@ -78,7 +83,9 @@ def _fields(d, allowed: tuple, what: str) -> dict:
|
|
|
78
83
|
return d
|
|
79
84
|
|
|
80
85
|
|
|
81
|
-
def _support(ws: dict, claim: str, eid: str, what: str) -> None:
|
|
86
|
+
def _support(ws: dict, claim: str, eid: str, what: str, connections: bool = False) -> None:
|
|
87
|
+
"""`eid` is evidence a step (or, with `connections`, an identification or a discharge, which
|
|
88
|
+
may also rest on a connection between objects) can rest on."""
|
|
82
89
|
r = ws["records"].get(eid)
|
|
83
90
|
if not r or r.get("kind") != "evidence":
|
|
84
91
|
raise _err(f"{what}: {eid} is not an evidence record of this workspace")
|
|
@@ -86,7 +93,12 @@ def _support(ws: dict, claim: str, eid: str, what: str) -> None:
|
|
|
86
93
|
raise _err(f"{what}: {eid} is evidence for {r['claim']}, not {claim}")
|
|
87
94
|
if r.get("role") == "rejected":
|
|
88
95
|
raise _err(f"{what}: {eid} is a rejected candidate")
|
|
89
|
-
|
|
96
|
+
ref = r.get("ref") or {}
|
|
97
|
+
if "connection" in ref and not connections:
|
|
98
|
+
raise _err(f"{what}: {eid} is a connection between objects; a step rests on a "
|
|
99
|
+
"declaration, an application of one, or a fact inside a proof, and a "
|
|
100
|
+
"connection is cited by an identification")
|
|
101
|
+
if not any(k in ref for k in SUPPORT + (("connection",) if connections else ())):
|
|
90
102
|
raise _err(f"{what}: {eid} cites a passage or a source line; a step rests on a "
|
|
91
103
|
"declaration, an application of one, or a fact inside a proof")
|
|
92
104
|
|
|
@@ -138,6 +150,7 @@ def full_refusal(g: dict) -> str | None:
|
|
|
138
150
|
|
|
139
151
|
def content(out: dict, rec: dict, ws: dict, snap, root, cur: dict | None, repin: bool) -> dict:
|
|
140
152
|
"""The fields of a composition record, checked; `out` holds the common ones."""
|
|
153
|
+
from . import connections as cn
|
|
141
154
|
from . import requirements as rq
|
|
142
155
|
from . import simple
|
|
143
156
|
claim = out["claim"]
|
|
@@ -213,7 +226,7 @@ def content(out: dict, rec: dict, ws: dict, snap, root, cur: dict | None, repin:
|
|
|
213
226
|
stack.extend(after_of.get(x, ()))
|
|
214
227
|
return False
|
|
215
228
|
|
|
216
|
-
idents = []
|
|
229
|
+
idents, leaves = [], []
|
|
217
230
|
for k, it in enumerate(rec.get("identifications") or []):
|
|
218
231
|
what = f"identification {k + 1}"
|
|
219
232
|
_fields(it, ("left", "right", "relation", "how", "evidence", "note"), what)
|
|
@@ -231,7 +244,8 @@ def content(out: dict, rec: dict, ws: dict, snap, root, cur: dict | None, repin:
|
|
|
231
244
|
"how": _choice(it.get("how"), HOW, f"how {what} is known (`how`)", False)}
|
|
232
245
|
ev = _ids(it.get("evidence"), f"{what}'s `evidence`")
|
|
233
246
|
for e in ev:
|
|
234
|
-
_support(ws, claim, e, what)
|
|
247
|
+
_support(ws, claim, e, what, connections=True)
|
|
248
|
+
leaves += cn.identification(x, {e: ws["records"][e] for e in ev}, what)
|
|
235
249
|
if x["how"] == "evidence" and not ev:
|
|
236
250
|
raise _err(f"{what} is known by evidence: name it (`evidence`)")
|
|
237
251
|
if x["how"] == "retained witness" and not follows(ends[1]["step"], ends[0]["step"]):
|
|
@@ -247,7 +261,8 @@ def content(out: dict, rec: dict, ws: dict, snap, root, cur: dict | None, repin:
|
|
|
247
261
|
out["identifications"] = idents
|
|
248
262
|
obls, oids = [], set()
|
|
249
263
|
for k, o in enumerate(rec.get("obligations") or []):
|
|
250
|
-
_fields(o, ("id", "kind", "text", "state", "by", "note"
|
|
264
|
+
_fields(o, ("id", "kind", "text", "state", "by", "note", "connection"),
|
|
265
|
+
f"obligation {k + 1}")
|
|
251
266
|
oid = _text(o.get("id") or f"o{k + 1}", "an obligation's id", True).strip()
|
|
252
267
|
if not STEP_ID.fullmatch(oid) or oid in oids:
|
|
253
268
|
raise _err(f"{oid!r} is not a new obligation id")
|
|
@@ -265,16 +280,39 @@ def content(out: dict, rec: dict, ws: dict, snap, root, cur: dict | None, repin:
|
|
|
265
280
|
raise _err(f"{oid} is discharged by {s}, which is not a step")
|
|
266
281
|
ev = _ids(by.get("evidence"), f"{oid}'s `by.evidence`")
|
|
267
282
|
for e in ev:
|
|
268
|
-
_support(ws, claim, e, f"obligation {oid}")
|
|
283
|
+
_support(ws, claim, e, f"obligation {oid}", connections=True)
|
|
269
284
|
by = {**({"steps": st} if st else {}), **({"evidence": ev} if ev else {})}
|
|
270
285
|
if x["state"] == "discharged" and not by:
|
|
271
286
|
raise _err(f"obligation {oid} is discharged: name the steps or evidence that "
|
|
272
287
|
"discharge it (`by`)")
|
|
288
|
+
if o.get("connection") not in (None, ""):
|
|
289
|
+
cid = _text(o["connection"], f"the connection {oid} comes from", True).strip()
|
|
290
|
+
_support(ws, claim, cid, f"obligation {oid}", connections=True)
|
|
291
|
+
if "connection" not in (ws["records"][cid].get("ref") or {}):
|
|
292
|
+
raise _err(f"obligation {oid} comes from {cid}, which is not a connection")
|
|
293
|
+
x["connection"] = cid
|
|
294
|
+
if x["state"] == "discharged" and not (by or {}).get("steps") and \
|
|
295
|
+
cn.partial_only((by or {}).get("evidence") or [], ws["records"]):
|
|
296
|
+
raise _err(f"obligation {oid}: a connection that holds only on a domain, along a "
|
|
297
|
+
"filter or between classes does not discharge the step from there to "
|
|
298
|
+
"everywhere; name the steps or evidence that do")
|
|
273
299
|
if by:
|
|
274
300
|
x["by"] = by
|
|
275
301
|
if o.get("note") not in (None, ""):
|
|
276
302
|
x["note"] = _text(o["note"], f"{oid}'s note")
|
|
277
303
|
obls.append(x)
|
|
304
|
+
named = {(o["kind"], o.get("connection")) for o in obls}
|
|
305
|
+
for kind, cid, text in leaves:
|
|
306
|
+
# An identification that uses a partial relation outright leaves this obligation.
|
|
307
|
+
if (kind, cid) in named:
|
|
308
|
+
continue
|
|
309
|
+
n = len(obls) + 1
|
|
310
|
+
while f"o{n}" in oids:
|
|
311
|
+
n += 1
|
|
312
|
+
oids.add(f"o{n}")
|
|
313
|
+
named.add((kind, cid))
|
|
314
|
+
obls.append({"id": f"o{n}", "kind": kind, "text": text, "state": "open",
|
|
315
|
+
"connection": cid})
|
|
278
316
|
if obls:
|
|
279
317
|
out["obligations"] = obls
|
|
280
318
|
out["evidence"] = list(dict.fromkeys(
|
|
@@ -545,7 +583,10 @@ def lines(c: dict) -> list[str]:
|
|
|
545
583
|
for o in c.get("obligations") or []:
|
|
546
584
|
by = o.get("by") or {}
|
|
547
585
|
out.append(f" obligation {o['id']} ({OBLIGATION_WORDS[o['kind']]}), {o['state']}: "
|
|
548
|
-
f"{o['text']}"
|
|
586
|
+
f"{o['text']}"
|
|
587
|
+
+ (f" (left by the connection {o['connection']})" if o.get("connection")
|
|
588
|
+
else "")
|
|
589
|
+
+ (" — discharged by " + ", ".join(
|
|
549
590
|
(by.get("steps") or []) + (by.get("evidence") or [])) if by else ""))
|
|
550
591
|
g = c["gaps"]
|
|
551
592
|
if g["uncovered"]:
|