machinechecked 0.1.7__tar.gz → 0.1.9__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.7 → machinechecked-0.1.9}/PKG-INFO +1 -1
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/SOURCES.txt +4 -2
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/assess.py +17 -3
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/cli.py +138 -7
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/config.py +4 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/ProofLensProbe.lean +56 -23
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/export.py +6 -1
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/manifest.py +20 -1
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/pipeline.py +38 -12
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/promote.py +25 -8
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/replay.py +23 -0
- machinechecked-0.1.9/engine/python/prooflens/review_cli.py +296 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/review_queue.py +55 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/reviews.py +7 -2
- machinechecked-0.1.9/engine/python/prooflens/symbols.py +97 -0
- machinechecked-0.1.7/engine/python/prooflens/web/assets/index-iChbHgsx.css → machinechecked-0.1.9/engine/python/prooflens/web/assets/index-CF9Ifrju.css +1 -1
- machinechecked-0.1.9/engine/python/prooflens/web/assets/index-CsVq8qV_.js +286 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/index.html +2 -2
- {machinechecked-0.1.7 → machinechecked-0.1.9}/pyproject.toml +1 -1
- machinechecked-0.1.7/engine/python/prooflens/web/assets/index-D9Pi0Gi-.js +0 -286
- {machinechecked-0.1.7 → machinechecked-0.1.9}/LICENSE +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/README.md +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/requires.txt +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/__init__.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/__main__.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/audit.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/bundle.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/cache.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/prooflens.sty +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/schema/manifest-index.schema.json +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/deps.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/evidence.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/formalization.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/paper.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/pdfclaims.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/probe.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/schemas.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/server.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/simple.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/sources.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/tex.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/util.py +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/web/theme.css +0 -0
- {machinechecked-0.1.7 → machinechecked-0.1.9}/setup.cfg +0 -0
{machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/machinechecked.egg-info/SOURCES.txt
RENAMED
|
@@ -26,12 +26,14 @@ engine/python/prooflens/pipeline.py
|
|
|
26
26
|
engine/python/prooflens/probe.py
|
|
27
27
|
engine/python/prooflens/promote.py
|
|
28
28
|
engine/python/prooflens/replay.py
|
|
29
|
+
engine/python/prooflens/review_cli.py
|
|
29
30
|
engine/python/prooflens/review_queue.py
|
|
30
31
|
engine/python/prooflens/reviews.py
|
|
31
32
|
engine/python/prooflens/schemas.py
|
|
32
33
|
engine/python/prooflens/server.py
|
|
33
34
|
engine/python/prooflens/simple.py
|
|
34
35
|
engine/python/prooflens/sources.py
|
|
36
|
+
engine/python/prooflens/symbols.py
|
|
35
37
|
engine/python/prooflens/tex.py
|
|
36
38
|
engine/python/prooflens/util.py
|
|
37
39
|
engine/python/prooflens/data/ProofLensProbe.lean
|
|
@@ -61,6 +63,6 @@ engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2
|
|
|
61
63
|
engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
|
|
62
64
|
engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
|
|
63
65
|
engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
|
|
64
|
-
engine/python/prooflens/web/assets/index-
|
|
65
|
-
engine/python/prooflens/web/assets/index-
|
|
66
|
+
engine/python/prooflens/web/assets/index-CF9Ifrju.css
|
|
67
|
+
engine/python/prooflens/web/assets/index-CsVq8qV_.js
|
|
66
68
|
engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
|
|
@@ -140,10 +140,21 @@ class Assessor:
|
|
|
140
140
|
return {"state": "not-run", "detail": "no Comparator record for this release"}
|
|
141
141
|
if "error" in rec:
|
|
142
142
|
return {"state": "unverified", "detail": rec["error"]}
|
|
143
|
-
|
|
143
|
+
since = ""
|
|
144
|
+
if not self.project_commit or not rec.get("commit"):
|
|
144
145
|
return {"state": "unverified",
|
|
145
146
|
"detail": f"the Comparator record is for commit {str(rec.get('commit'))[:12]}"
|
|
146
147
|
f", not this one"}
|
|
148
|
+
if rec["commit"] != self.project_commit:
|
|
149
|
+
# A record committed to the project names the commit before the one holding it; it
|
|
150
|
+
# counts when that commit is an ancestor and no Lean input changed since.
|
|
151
|
+
from .replay import unchanged_since
|
|
152
|
+
why = unchanged_since(self.cfg.lean_root, rec["commit"], self.project_commit)
|
|
153
|
+
if why:
|
|
154
|
+
return {"state": "unverified",
|
|
155
|
+
"detail": f"the Comparator record is for commit {rec['commit'][:12]}, not "
|
|
156
|
+
f"this one: {why}"}
|
|
157
|
+
since = f"; replayed at commit {rec['commit'][:12]}, no Lean input changed since"
|
|
147
158
|
# A record made by `machinechecked replay` also says whether the run passed, whether the
|
|
148
159
|
# tree was clean, and the environment it ran in; each must hold for the replay to count.
|
|
149
160
|
if rec.get("passed") is False:
|
|
@@ -160,7 +171,7 @@ class Assessor:
|
|
|
160
171
|
if thm not in set(rec.get("replayed", [])):
|
|
161
172
|
return {"state": "not-run", "detail": "the Comparator record does not cover this proof"}
|
|
162
173
|
return {"state": "pass", "detail": "Comparator replayed the proof in a fresh kernel ("
|
|
163
|
-
+ ", ".join(rec.get("kernels", ["lean"])) + ")"}
|
|
174
|
+
+ ", ".join(rec.get("kernels", ["lean"])) + ")" + since}
|
|
164
175
|
|
|
165
176
|
def _environment(self) -> dict:
|
|
166
177
|
"""The audited project's Lean version and Lake manifest hash."""
|
|
@@ -252,7 +263,10 @@ class Assessor:
|
|
|
252
263
|
|
|
253
264
|
if srec:
|
|
254
265
|
roles = [b["role"] for b in srec.get("binders", [])]
|
|
255
|
-
|
|
266
|
+
# A checked refutation needs no witness: a proof of ¬S exhibits an instance meeting
|
|
267
|
+
# S's hypotheses (were they never met, S would hold vacuously and not be refutable).
|
|
268
|
+
if ("hypothesis" in roles or "instance" in roles) and not cl.get("witness") \
|
|
269
|
+
and not res.get("refute_ok"):
|
|
256
270
|
self.findings.append(_finding(
|
|
257
271
|
"obligation", "witness", subj,
|
|
258
272
|
f"{spec} has hypotheses but no witness that they can be met"))
|
|
@@ -22,6 +22,7 @@ import functools
|
|
|
22
22
|
import http.server
|
|
23
23
|
import json
|
|
24
24
|
import re
|
|
25
|
+
import os
|
|
25
26
|
import sys
|
|
26
27
|
from pathlib import Path
|
|
27
28
|
|
|
@@ -245,6 +246,17 @@ def cmd_view(a):
|
|
|
245
246
|
serve(site, a.port, on_link, not a.no_browser)
|
|
246
247
|
|
|
247
248
|
|
|
249
|
+
def _site_dest(site: str, root: Path) -> Path:
|
|
250
|
+
"""The directory `--site` names, refused when it is the project (or holds it), or when it
|
|
251
|
+
has other content than a previous site: writing the site replaces it."""
|
|
252
|
+
dest = Path(site).resolve()
|
|
253
|
+
if dest == root.resolve() or root.resolve().is_relative_to(dest):
|
|
254
|
+
sys.exit(f"--site {site}: choose a new directory, not the project")
|
|
255
|
+
if dest.exists() and not (dest / "audit.json").exists() and any(dest.iterdir()):
|
|
256
|
+
sys.exit(f"--site {site}: not empty and not a previous site; choose another")
|
|
257
|
+
return dest
|
|
258
|
+
|
|
259
|
+
|
|
248
260
|
def cmd_build_simple(a):
|
|
249
261
|
from .bundle import bundle
|
|
250
262
|
root, paper = _simple_target(a)
|
|
@@ -253,12 +265,8 @@ def cmd_build_simple(a):
|
|
|
253
265
|
_print_simple(view["body"])
|
|
254
266
|
if a.site:
|
|
255
267
|
import shutil
|
|
256
|
-
dest =
|
|
257
|
-
if dest == root.resolve() or root.resolve().is_relative_to(dest):
|
|
258
|
-
sys.exit(f"--site {a.site}: choose a new directory, not the project")
|
|
268
|
+
dest = _site_dest(a.site, root)
|
|
259
269
|
if dest.exists():
|
|
260
|
-
if not (dest / "audit.json").exists() and any(dest.iterdir()):
|
|
261
|
-
sys.exit(f"--site {a.site}: not empty and not a previous site; choose another")
|
|
262
270
|
shutil.rmtree(dest)
|
|
263
271
|
shutil.copytree(site, dest)
|
|
264
272
|
print(f"wrote the reader to {dest}: publish this directory as it is "
|
|
@@ -365,6 +373,7 @@ def cmd_build(a):
|
|
|
365
373
|
return cmd_build_simple(a)
|
|
366
374
|
from .pipeline import build
|
|
367
375
|
cfg = cfgmod.load(_config_arg(a))
|
|
376
|
+
dest = _site_dest(a.site, cfg.root) if getattr(a, "site", None) else None
|
|
368
377
|
res = build(cfg, release=a.release, skip_lean=a.skip_lean, skip_tex=a.skip_tex, lake=a.lake,
|
|
369
378
|
web_dist=_web_dist(a.web), lean_build=not a.no_lean_build,
|
|
370
379
|
reuse_lean=a.reuse_lean)
|
|
@@ -381,6 +390,16 @@ def cmd_build(a):
|
|
|
381
390
|
print(f" {f['tier']} {f['subject']}: {f['message']}")
|
|
382
391
|
if idx["findings"]["total"].get("warning"):
|
|
383
392
|
print(" (warnings: see `check --json` or the reader)")
|
|
393
|
+
if dest is not None:
|
|
394
|
+
# The site to publish is the audit's public export: what the configuration publishes,
|
|
395
|
+
# scanned for private material, as `export --out` writes it.
|
|
396
|
+
from .export import ExportError, export
|
|
397
|
+
try:
|
|
398
|
+
out = export(cfg, dest, res["release"], _web_dist(a.web))
|
|
399
|
+
except ExportError as e:
|
|
400
|
+
sys.exit(str(e))
|
|
401
|
+
print(f"wrote the audit to {out['out']}: publish this directory as it is "
|
|
402
|
+
"(audit.json describes it)")
|
|
384
403
|
if a.fail_on_violation and idx["findings"]["total"].get("violation"):
|
|
385
404
|
sys.exit(1)
|
|
386
405
|
|
|
@@ -507,6 +526,22 @@ def _print_inspect(out: dict, dependencies: bool):
|
|
|
507
526
|
print(" (from the cache: no Lean input changed)")
|
|
508
527
|
|
|
509
528
|
|
|
529
|
+
def cmd_symbol(a):
|
|
530
|
+
from . import symbols as sy
|
|
531
|
+
cfg = cfgmod.load(_config_arg(a))
|
|
532
|
+
try:
|
|
533
|
+
if a.action == "add":
|
|
534
|
+
ln = sy.add(cfg, a.claim, a.tex, a.decl, a.reviewer, var=a.var, type_of=a.type_of)
|
|
535
|
+
print(f"linked {a.tex} in {a.claim} to {ln['lean']} (by {ln['by']}); "
|
|
536
|
+
"rebuild the site to show it")
|
|
537
|
+
elif a.action == "remove":
|
|
538
|
+
print(f"removed {sy.remove(cfg, a.claim, a.tex)} link(s)")
|
|
539
|
+
else:
|
|
540
|
+
print(sy.listing(cfg))
|
|
541
|
+
except (sy.SymbolError, OSError) as e:
|
|
542
|
+
sys.exit(f"machinechecked: {e}")
|
|
543
|
+
|
|
544
|
+
|
|
510
545
|
def cmd_serve(a):
|
|
511
546
|
cfg = cfgmod.load(_config_arg(a))
|
|
512
547
|
site = Path(a.dir).resolve() if a.dir else cfg.out_dir / "site"
|
|
@@ -515,6 +550,48 @@ def cmd_serve(a):
|
|
|
515
550
|
http.server.ThreadingHTTPServer(("127.0.0.1", a.port), handler).serve_forever()
|
|
516
551
|
|
|
517
552
|
|
|
553
|
+
def _text_arg(v: str | None) -> str:
|
|
554
|
+
if v is None:
|
|
555
|
+
return ""
|
|
556
|
+
return sys.stdin.read() if v == "-" else Path(v).read_text(encoding="utf-8")
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def cmd_review_step(a):
|
|
560
|
+
from . import review_cli as rc
|
|
561
|
+
cfg = cfgmod.load(_config_arg(a))
|
|
562
|
+
try:
|
|
563
|
+
s = rc.Session(cfg, rc.parse_reviewer(a.reviewer, a.same_family))
|
|
564
|
+
if a.action == "next":
|
|
565
|
+
u = next(iter(s.open_units()), None)
|
|
566
|
+
print(f"{u['id']} ({u['reason']})" if u else "nothing left to review")
|
|
567
|
+
elif a.action == "status":
|
|
568
|
+
print(f"{len(s.work['reports'])} report(s), {len(s.work['drafts'])} in progress, "
|
|
569
|
+
f"{len(s.open_units())} unit(s) left to review (release {s.index['release']})")
|
|
570
|
+
for uid, d in s.work["drafts"].items():
|
|
571
|
+
print(f" {uid}: at step '{d['stage']}'")
|
|
572
|
+
elif a.action == "read":
|
|
573
|
+
print(s.read(a.unit))
|
|
574
|
+
elif a.action == "lock":
|
|
575
|
+
s.lock(a.unit, _text_arg(a.text))
|
|
576
|
+
print(f"reading locked; `review show {a.unit}` shows the Lean")
|
|
577
|
+
elif a.action == "show":
|
|
578
|
+
print(s.show(a.unit))
|
|
579
|
+
elif a.action == "decide":
|
|
580
|
+
s.decide(a.unit, a.verdict, _text_arg(a.comparison), _text_arg(a.detail),
|
|
581
|
+
_text_arg(a.witness))
|
|
582
|
+
print(f"verdict recorded; `review author {a.unit}` shows the author's review")
|
|
583
|
+
elif a.action == "author":
|
|
584
|
+
print(s.author(a.unit))
|
|
585
|
+
elif a.action == "submit":
|
|
586
|
+
r = s.submit(a.unit, _text_arg(a.text).strip())
|
|
587
|
+
print(f"report recorded: {r['unit']['id']}, {r['verdict']['value']}; "
|
|
588
|
+
"`review export --out FILE` writes your reports for the maintainer")
|
|
589
|
+
elif a.action == "export":
|
|
590
|
+
print(f"wrote {s.export(Path(a.out))}")
|
|
591
|
+
except (rc.ReviewError, OSError) as e:
|
|
592
|
+
sys.exit(f"machinechecked: {e}")
|
|
593
|
+
|
|
594
|
+
|
|
518
595
|
def cmd_review(a):
|
|
519
596
|
import shlex
|
|
520
597
|
import subprocess
|
|
@@ -523,7 +600,7 @@ def cmd_review(a):
|
|
|
523
600
|
cfg = cfgmod.load(_config_arg(a))
|
|
524
601
|
try:
|
|
525
602
|
steps = pr.plan(cfg, pr.load_reports([Path(f) for f in a.reports]),
|
|
526
|
-
a.accept_same_family)
|
|
603
|
+
a.accept_same_family, a.allow_revealed)
|
|
527
604
|
except pr.PromoteError as e:
|
|
528
605
|
sys.exit(f"machinechecked: {e}")
|
|
529
606
|
ok = []
|
|
@@ -615,7 +692,9 @@ def main(argv=None):
|
|
|
615
692
|
b.add_argument("--skip-tex", action="store_true", help=argparse.SUPPRESS)
|
|
616
693
|
b.add_argument("--lake", default="lake", help=argparse.SUPPRESS)
|
|
617
694
|
b.add_argument("--no-lean-build", action="store_true", help=argparse.SUPPRESS)
|
|
618
|
-
b.add_argument("--reuse-lean", action="store_true",
|
|
695
|
+
b.add_argument("--reuse-lean", action="store_true",
|
|
696
|
+
help="reuse the last Lean results when no Lean input changed (after an edit to "
|
|
697
|
+
"the claim inventory or the reviews, say)")
|
|
619
698
|
b.add_argument("--web", help=argparse.SUPPRESS)
|
|
620
699
|
b.add_argument("--fail-on-violation", action="store_true", help=argparse.SUPPRESS)
|
|
621
700
|
b.set_defaults(func=cmd_build)
|
|
@@ -711,6 +790,24 @@ def main(argv=None):
|
|
|
711
790
|
ins.add_argument("--refresh", action="store_true", help=argparse.SUPPRESS)
|
|
712
791
|
ins.set_defaults(func=cmd_inspect)
|
|
713
792
|
|
|
793
|
+
sy = sub.add_parser("symbol", help="link a symbol of the paper to a Lean object (an assertion "
|
|
794
|
+
"under your name; display only)")
|
|
795
|
+
sys_ = sy.add_subparsers(dest="action", required=True)
|
|
796
|
+
for name in ("add", "remove", "list"):
|
|
797
|
+
p_ = sys_.add_parser(name)
|
|
798
|
+
if name != "list":
|
|
799
|
+
p_.add_argument("claim", help="the claim id, e.g. P:thm:main")
|
|
800
|
+
p_.add_argument("tex", help="the symbol as the paper's TeX writes it, e.g. '\\nu'")
|
|
801
|
+
if name == "add":
|
|
802
|
+
p_.add_argument("decl", help="the claim's Lean statement")
|
|
803
|
+
p_.add_argument("--var", help="the variable it is (a binder's name or index)")
|
|
804
|
+
p_.add_argument("--type-of", dest="type_of", help="the binder whose type it is")
|
|
805
|
+
p_.add_argument("--as", dest="reviewer",
|
|
806
|
+
default=os.environ.get("MACHINECHECKED_REVIEWER"),
|
|
807
|
+
help="human:NAME or llm:MODEL (default: $MACHINECHECKED_REVIEWER)")
|
|
808
|
+
p_.add_argument("-c", "--config", default=None)
|
|
809
|
+
p_.set_defaults(func=cmd_symbol)
|
|
810
|
+
|
|
714
811
|
s = sub.add_parser("serve")
|
|
715
812
|
s.add_argument("-c", "--config", default=None)
|
|
716
813
|
s.add_argument("--dir")
|
|
@@ -725,7 +822,41 @@ def main(argv=None):
|
|
|
725
822
|
pm.add_argument("--yes", action="store_true", help="write without asking")
|
|
726
823
|
pm.add_argument("--accept-same-family", action="store_true",
|
|
727
824
|
help="accept a model reviewer of the author's family, or of unknown family")
|
|
825
|
+
pm.add_argument("--allow-revealed", action="store_true",
|
|
826
|
+
help="accept a report whose reviewer had seen the unit's Lean or author's "
|
|
827
|
+
"review before writing their reading")
|
|
728
828
|
pm.set_defaults(func=cmd_review)
|
|
829
|
+
# The protocol's steps, for a reviewer without a browser (`review_cli`).
|
|
830
|
+
steps = {
|
|
831
|
+
"next": "the next unit to review",
|
|
832
|
+
"read": "step 1: the paper's statement of a unit",
|
|
833
|
+
"lock": "lock your reading (a file, or - for standard input)",
|
|
834
|
+
"show": "step 2, after lock: the unit's Lean",
|
|
835
|
+
"decide": "record your verdict and comparison",
|
|
836
|
+
"author": "step 3, after decide: the author's review",
|
|
837
|
+
"submit": "record your disagreements with it and finish the report",
|
|
838
|
+
"status": "your progress on this release's queue",
|
|
839
|
+
"export": "write your reports as one file, for the maintainer",
|
|
840
|
+
}
|
|
841
|
+
for name, help_ in steps.items():
|
|
842
|
+
sp = rvs.add_parser(name, help=help_)
|
|
843
|
+
if name not in ("next", "status", "export"):
|
|
844
|
+
sp.add_argument("unit", help="a unit id of the queue, e.g. spec:Foo.thm_bar")
|
|
845
|
+
if name in ("lock", "submit"):
|
|
846
|
+
sp.add_argument("text", help="a file holding your text, or - to read it from standard input")
|
|
847
|
+
if name == "decide":
|
|
848
|
+
sp.add_argument("verdict")
|
|
849
|
+
sp.add_argument("comparison", help="a file holding your comparison, or -")
|
|
850
|
+
sp.add_argument("--detail", help="a file holding what the verdict needs said")
|
|
851
|
+
sp.add_argument("--witness", help="a file holding your note on the witness")
|
|
852
|
+
if name == "export":
|
|
853
|
+
sp.add_argument("--out", required=True)
|
|
854
|
+
sp.add_argument("--as", dest="reviewer", default=os.environ.get("MACHINECHECKED_REVIEWER"),
|
|
855
|
+
help="human:NAME or llm:MODEL (default: $MACHINECHECKED_REVIEWER)")
|
|
856
|
+
sp.add_argument("--same-family", choices=["yes", "no", "unknown"], default="unknown",
|
|
857
|
+
help="for a model: whether it is of the statements' author's family")
|
|
858
|
+
sp.add_argument("-c", "--config", default=None)
|
|
859
|
+
sp.set_defaults(func=cmd_review_step)
|
|
729
860
|
|
|
730
861
|
v = sub.add_parser("validate")
|
|
731
862
|
v.add_argument("file")
|
|
@@ -60,6 +60,7 @@ class Config:
|
|
|
60
60
|
out_dir: Path
|
|
61
61
|
review_check: str | None = None
|
|
62
62
|
display: Path | None = None
|
|
63
|
+
symbols: Path | None = None
|
|
63
64
|
issues: str | None = None # "owner/repo" where the reader's "Raise issue" opens issues
|
|
64
65
|
site_url: str | None = None # the public address of the published site, for permalinks
|
|
65
66
|
author: str | None = None # the name the audit is published under (audit.json)
|
|
@@ -142,6 +143,9 @@ def load(path: str | Path) -> Config:
|
|
|
142
143
|
review_check=raw.get("review", {}).get("check"),
|
|
143
144
|
# Display corrections (TeX descriptions, printed numbers), outside the inventory.
|
|
144
145
|
display=(base / proj["display"]).resolve() if "display" in proj else None,
|
|
146
|
+
# Links from symbols of the paper to Lean objects, each an author's assertion (display
|
|
147
|
+
# only, docs/SYMBOL_LINKS.md).
|
|
148
|
+
symbols=(base / proj.get("symbols", "symbols.json")).resolve(),
|
|
145
149
|
issues=issue_repo(proj.get("issues"), str(path)),
|
|
146
150
|
site_url=proj.get("site_url"),
|
|
147
151
|
author=proj.get("author"),
|
{machinechecked-0.1.7 → machinechecked-0.1.9}/engine/python/prooflens/data/ProofLensProbe.lean
RENAMED
|
@@ -97,8 +97,13 @@ partial def deepHash (e : Expr) : StateM (Std.HashMap Expr UInt64) UInt64 := do
|
|
|
97
97
|
modify (·.insert e h)
|
|
98
98
|
return h
|
|
99
99
|
|
|
100
|
+
/-- The first `n` characters of `s`. (`String.take` returns a slice on some Lean versions and a
|
|
101
|
+
string on others; this is the same on all.) -/
|
|
102
|
+
def prefixOf (s : String) (n : Nat) : String :=
|
|
103
|
+
(s.toList.take n).foldl String.push ""
|
|
104
|
+
|
|
100
105
|
def hex (h : UInt64) : String :=
|
|
101
|
-
let s :=
|
|
106
|
+
let s := (Nat.toDigits 16 h.toNat).foldl String.push ""
|
|
102
107
|
"".pushn '0' (16 - s.length) ++ s
|
|
103
108
|
|
|
104
109
|
/-- State of the canonical serialisation: the index of every node already emitted. -/
|
|
@@ -160,33 +165,55 @@ def constPrint (ci : ConstantInfo) : MetaM (String × String × Array Name) := d
|
|
|
160
165
|
|
|
161
166
|
/-! ## Pretty-printing with navigation -/
|
|
162
167
|
|
|
163
|
-
/-- Flatten tagged code into segments; a segment carries the constant it names
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
/-- Flatten tagged code into segments; a segment carries the constant it names (`ref`), or the
|
|
169
|
+
index of the statement's binder it refers to (`var`, a position in `vars`), when the innermost
|
|
170
|
+
subexpression around it is one. -/
|
|
171
|
+
partial def segments (vars : Array FVarId) (t : Widget.CodeWithInfos) (ref : Option (String × Json))
|
|
172
|
+
(acc : Array Json) : Array Json :=
|
|
166
173
|
match t with
|
|
167
174
|
| Widget.TaggedText.text s =>
|
|
168
175
|
match ref with
|
|
169
|
-
| some
|
|
176
|
+
| some (k, v) => acc.push (Json.mkObj [("t", s), (k, v)])
|
|
170
177
|
| none => acc.push (Json.mkObj [("t", s)])
|
|
171
|
-
| Widget.TaggedText.append xs => xs.foldl (fun a x => segments x ref a) acc
|
|
178
|
+
| Widget.TaggedText.append xs => xs.foldl (fun a x => segments vars x ref a) acc
|
|
172
179
|
| Widget.TaggedText.tag info sub =>
|
|
173
180
|
let r := match info.info.val.info with
|
|
174
|
-
| .ofTermInfo ti =>
|
|
181
|
+
| .ofTermInfo ti => match ti.expr with
|
|
182
|
+
| .const n _ => some ("ref", Json.str n.toString)
|
|
183
|
+
| .fvar id => (vars.findIdx? (· == id)).map fun i => ("var", toJson i)
|
|
184
|
+
| _ => none
|
|
175
185
|
| _ => none
|
|
176
|
-
segments sub
|
|
186
|
+
segments vars sub r acc
|
|
177
187
|
|
|
178
|
-
/-- The pretty-printed expression with navigable constants; plain text
|
|
179
|
-
marker if printing fails, so that one large term cannot stop the probe. -/
|
|
180
|
-
def
|
|
188
|
+
/-- The fields of a pretty-printed expression with navigable constants and binders; plain text
|
|
189
|
+
if tagging fails, and a marker if printing fails, so that one large term cannot stop the probe. -/
|
|
190
|
+
def ppFields (e : Expr) (vars : Array FVarId := #[]) : MetaM (List (String × Json)) := do
|
|
181
191
|
try
|
|
182
|
-
|
|
192
|
+
-- The head of every application is tagged too (`pp.tagAppFns`), so that the function a
|
|
193
|
+
-- term applies is a constant the reader can name; the text is the same.
|
|
194
|
+
let code ← withOptions (fun o => o.setBool `pp.tagAppFns true) (Widget.ppExprTagged e)
|
|
183
195
|
let text := toString (← ppExpr e)
|
|
184
|
-
return
|
|
196
|
+
return [("text", Json.str text), ("segments", Json.arr (segments vars code none #[]))]
|
|
185
197
|
catch _ =>
|
|
186
198
|
try
|
|
187
|
-
return
|
|
199
|
+
return [("text", Json.str (toString (← ppExpr e)))]
|
|
188
200
|
catch err =>
|
|
189
|
-
return
|
|
201
|
+
return [("text", Json.str "(not printable)"),
|
|
202
|
+
("error", Json.str (toString (← err.toMessageData.toString)))]
|
|
203
|
+
|
|
204
|
+
def ppJson (e : Expr) (vars : Array FVarId := #[]) : MetaM Json :=
|
|
205
|
+
return Json.mkObj (← ppFields e vars)
|
|
206
|
+
|
|
207
|
+
/-- The logical shape of a conclusion: a conjunction, disjunction or equivalence as a tree whose
|
|
208
|
+
leaves are pretty-printed propositions. Display only; it changes no record that is assessed. -/
|
|
209
|
+
partial def logicJson (vars : Array FVarId) (e : Expr) : MetaM Json := do
|
|
210
|
+
let op := if e.isAppOfArity ``And 2 then some "and"
|
|
211
|
+
else if e.isAppOfArity ``Or 2 then some "or"
|
|
212
|
+
else if e.isAppOfArity ``Iff 2 then some "iff" else none
|
|
213
|
+
match op with
|
|
214
|
+
| some o => return Json.mkObj [("op", o),
|
|
215
|
+
("args", Json.arr #[← logicJson vars e.appFn!.appArg!, ← logicJson vars e.appArg!])]
|
|
216
|
+
| none => return Json.mkObj [("leaf", ← ppJson e vars)]
|
|
190
217
|
|
|
191
218
|
/-! ## The inspection representation -/
|
|
192
219
|
|
|
@@ -200,29 +227,35 @@ def isExistsApp (e : Expr) : Option (Name × Expr) :=
|
|
|
200
227
|
/-- Split a proposition into its quantifier prefix and its conclusion. Universal binders are
|
|
201
228
|
`forall` (data), `hypothesis` (a proposition) or `instance`; existential binders are `exists`.
|
|
202
229
|
Definitions are not unfolded: the prefix is the one written in the specification. -/
|
|
203
|
-
partial def telescope (e : Expr) (acc : Array Json) :
|
|
230
|
+
partial def telescope (e : Expr) (acc : Array Json) (vars : Array FVarId := #[]) :
|
|
231
|
+
MetaM (Array Json × Json) := do
|
|
204
232
|
match e with
|
|
205
233
|
| .forallE n t body bi =>
|
|
206
234
|
let isHyp ← isProp t
|
|
207
235
|
let role :=
|
|
208
236
|
if bi.isInstImplicit then "instance" else if isHyp then "hypothesis" else "forall"
|
|
209
|
-
let tj ← ppJson t
|
|
237
|
+
let tj ← ppJson t vars
|
|
210
238
|
withLocalDecl n bi t fun x => do
|
|
211
239
|
let hyps := (acc.filter fun j => j.getObjValD "role" == Json.str "hypothesis").size
|
|
212
240
|
let nm := if n.hasMacroScopes || n.isAnonymous then s!"h{hyps + 1}"
|
|
213
241
|
else n.toString
|
|
214
242
|
let j := Json.mkObj [("role", role), ("name", nm),
|
|
215
243
|
("type", tj), ("binder", binderStr bi)]
|
|
216
|
-
telescope (body.instantiate1 x) (acc.push j)
|
|
244
|
+
telescope (body.instantiate1 x) (acc.push j) (vars.push x.fvarId!)
|
|
217
245
|
| _ =>
|
|
218
246
|
match isExistsApp e with
|
|
219
247
|
| some (_, .lam n t body bi) =>
|
|
220
|
-
let tj ← ppJson t
|
|
248
|
+
let tj ← ppJson t vars
|
|
221
249
|
withLocalDecl n bi t fun x => do
|
|
222
250
|
let j := Json.mkObj [("role", "exists"), ("name", n.eraseMacroScopes.toString),
|
|
223
251
|
("type", tj), ("binder", binderStr bi)]
|
|
224
|
-
telescope (body.instantiate1 x) (acc.push j)
|
|
225
|
-
| _ =>
|
|
252
|
+
telescope (body.instantiate1 x) (acc.push j) (vars.push x.fvarId!)
|
|
253
|
+
| _ =>
|
|
254
|
+
-- The conclusion, with its logical shape when it has one (`logic`, display only).
|
|
255
|
+
let fields ← ppFields e vars
|
|
256
|
+
let logic ← logicJson vars e
|
|
257
|
+
let shaped := (logic.getObjVal? "op").toOption.isSome
|
|
258
|
+
return (acc, Json.mkObj (if shaped then fields ++ [("logic", logic)] else fields))
|
|
226
259
|
where
|
|
227
260
|
binderStr : BinderInfo → String
|
|
228
261
|
| .default => "explicit" | .implicit => "implicit"
|
|
@@ -377,7 +410,7 @@ def indexRecords (h : IO.FS.Handle) (roots : Array Name) : MetaM Unit := do
|
|
|
377
410
|
emit h (Json.mkObj [("record", "index"), ("name", n.toString), ("kind", k),
|
|
378
411
|
("module", mod.toString), ("range", ← rangeJson n),
|
|
379
412
|
("doc", match doc with | some d => Json.str d | none => Json.null),
|
|
380
|
-
("type", if ty.length > 4000 then
|
|
413
|
+
("type", if ty.length > 4000 then prefixOf ty 4000 ++ " …" else ty)])
|
|
381
414
|
|
|
382
415
|
/-- A theorem of a link: its statement split like a specification, and its axioms. -/
|
|
383
416
|
def linkRecord (h : IO.FS.Handle) (q : Query) (roots : Array Name) (seen : IO.Ref NameSet)
|
|
@@ -439,7 +472,7 @@ def depNode (roots : Array Name) (n : Name) (ci : ConstantInfo) (depth : Nat) :
|
|
|
439
472
|
("module", (moduleOf env n).toString), ("range", ← rangeJson n),
|
|
440
473
|
("user_facing", toJson (userFacing n)), ("depth", toJson depth),
|
|
441
474
|
("doc", match doc with | some d => Json.str d | none => Json.null),
|
|
442
|
-
("type", if ty.length > 4000 then
|
|
475
|
+
("type", if ty.length > 4000 then prefixOf ty 4000 ++ " …" else ty),
|
|
443
476
|
("statement_uses", inside st), ("value_uses", inside va),
|
|
444
477
|
("statement_external", outside st), ("value_external", outside va)]
|
|
445
478
|
|
|
@@ -130,6 +130,8 @@ def public_claim(chunk: dict, pub) -> dict:
|
|
|
130
130
|
rung["detail"] = "located in the compiled paper"
|
|
131
131
|
clauses.append(c)
|
|
132
132
|
out["clauses"] = clauses
|
|
133
|
+
# A symbol link names paper TeX and a place in the Lean statement: published with both.
|
|
134
|
+
out["symbols"] = list(chunk.get("symbols", [])) if pub.source_text and pub.lean else []
|
|
133
135
|
out["decls"] = dict(chunk.get("decls", {}))
|
|
134
136
|
out["findings"] = [_pick(f, ["id", "tier", "code", "subject", "message", "trigger",
|
|
135
137
|
"signal", "dismissed", "dismissal_stale"])
|
|
@@ -254,7 +256,10 @@ def export(cfg: Config, out: Path, release: str | None = None,
|
|
|
254
256
|
relrec = read_json(cfg.out_dir / "releases" / f"{release}.json") if release \
|
|
255
257
|
else read_json(rels[-1])
|
|
256
258
|
record = ev.load(cfg.out_dir, relrec["evidence"])
|
|
257
|
-
|
|
259
|
+
# With the display layer the site is built with (descriptions, printed numbers, symbol
|
|
260
|
+
# links): what is shown changes, never what is assessed.
|
|
261
|
+
from .pipeline import load_display
|
|
262
|
+
index, chunks, store = mf.build(record, relrec["release"], load_display(cfg))
|
|
258
263
|
pubs = {p.id: p.publish for p in cfg.papers}
|
|
259
264
|
full_index, full_chunks, full_store = index, chunks, store
|
|
260
265
|
if paper is not None:
|
|
@@ -122,6 +122,24 @@ def ladder(cl: dict, anchor: dict | None, mode: str | None, src_ok: bool | None)
|
|
|
122
122
|
return rungs
|
|
123
123
|
|
|
124
124
|
|
|
125
|
+
def symbol_links(display: dict | None, cid: str, tex: str | None, lean: dict) -> list[dict]:
|
|
126
|
+
"""The claim's symbol links, each as its author recorded it and whether it is stale: the
|
|
127
|
+
statement it points into has another fingerprint now, or the claim's printed text changed.
|
|
128
|
+
Display only (docs/SYMBOL_LINKS.md)."""
|
|
129
|
+
out = []
|
|
130
|
+
for ln in (display or {}).get("symbols", []):
|
|
131
|
+
if ln.get("claim") != cid:
|
|
132
|
+
continue
|
|
133
|
+
target = ln.get("lean") or {}
|
|
134
|
+
spec = (lean.get("specs") or {}).get(target.get("decl")) or {}
|
|
135
|
+
pins = ln.get("pins") or {}
|
|
136
|
+
stale = (pins.get("statement") != spec.get("fingerprint")
|
|
137
|
+
or not tex or pins.get("source") != sha256_text(tex))
|
|
138
|
+
out.append({"symbol": ln.get("symbol") or {}, "lean": target, "by": ln.get("by"),
|
|
139
|
+
"stale": bool(stale)})
|
|
140
|
+
return out
|
|
141
|
+
|
|
142
|
+
|
|
125
143
|
def build(evidence: dict, release: str, display: dict | None = None
|
|
126
144
|
) -> tuple[dict, dict[str, dict]]:
|
|
127
145
|
"""The presentation manifest of `evidence`. `display` (the project's display overlay) gives
|
|
@@ -248,7 +266,8 @@ def build(evidence: dict, release: str, display: dict | None = None
|
|
|
248
266
|
"class": status_class(a["status"]), "anchor": anchor, "source_matches": src_ok,
|
|
249
267
|
"statement_tex": (anchor or {}).get("statement"),
|
|
250
268
|
"blockers": [shown_names(b, clause_tex) for b in a.get("blockers", [])],
|
|
251
|
-
"clauses": clauses, "decls": decls, "findings": fs
|
|
269
|
+
"clauses": clauses, "decls": decls, "findings": fs,
|
|
270
|
+
"symbols": symbol_links(display, c["id"], (anchor or {}).get("statement"), lean)}
|
|
252
271
|
|
|
253
272
|
prov = body["provenance"]
|
|
254
273
|
index = {"schema": SCHEMA, "release": release, "evidence": evidence["id"],
|
|
@@ -24,10 +24,13 @@ from .util import (canonical_json, git_dirty, git_head, link_or_copy, norm_ws, p
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def tool_version() -> str:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
"""The installed MachineChecked release (`prooflens` was the package's earlier name)."""
|
|
28
|
+
for dist in ("machinechecked", "prooflens"):
|
|
29
|
+
try:
|
|
30
|
+
return version(dist)
|
|
31
|
+
except PackageNotFoundError:
|
|
32
|
+
pass
|
|
33
|
+
return "0.1.0+src"
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
def project_provenance(cfg: Config) -> dict:
|
|
@@ -240,20 +243,38 @@ def line_hashes(inv: dict, pid: str, src: Path) -> dict:
|
|
|
240
243
|
return out
|
|
241
244
|
|
|
242
245
|
|
|
246
|
+
class StaleEvidence(RuntimeError):
|
|
247
|
+
"""The stored evidence does not cover the project as it now is (or there is none): a build
|
|
248
|
+
is needed first. The message names the command."""
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
NO_RELEASE = "no release: run `machinechecked build` first"
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def inventory_changed(cfg: Config, body: dict) -> str | None:
|
|
255
|
+
"""Why the stored evidence `body` does not cover the current claim inventory, if it does
|
|
256
|
+
not."""
|
|
257
|
+
inv = read_json(cfg.inventory)
|
|
258
|
+
validate(inv, "inventory")
|
|
259
|
+
if canonical_json(inv["claims"]) != canonical_json(body["inventory"]["claims"]):
|
|
260
|
+
return ("the claim inventory changed since the last build: its Lean and LaTeX results "
|
|
261
|
+
"may not cover it; run `machinechecked build --reuse-lean` (or `machinechecked "
|
|
262
|
+
"build` if a Lean input changed too)")
|
|
263
|
+
return None
|
|
264
|
+
|
|
265
|
+
|
|
243
266
|
def reassess(cfg: Config, web_dist: Path | None = None, release: str | None = None,
|
|
244
267
|
log=print) -> dict:
|
|
245
268
|
"""Assess the latest evidence again with the current rules and the current review files,
|
|
246
269
|
without probing or compiling, and store the result as a new evidence record and release."""
|
|
247
270
|
rels = ev.releases(cfg.out_dir)
|
|
248
271
|
if not rels:
|
|
249
|
-
raise
|
|
272
|
+
raise StaleEvidence(NO_RELEASE)
|
|
250
273
|
old = ev.load(cfg.out_dir, read_json(rels[-1])["evidence"])["body"]
|
|
274
|
+
why = inventory_changed(cfg, old)
|
|
275
|
+
if why:
|
|
276
|
+
raise StaleEvidence(why)
|
|
251
277
|
inv = read_json(cfg.inventory)
|
|
252
|
-
validate(inv, "inventory")
|
|
253
|
-
if canonical_json(inv["claims"]) != canonical_json(old["inventory"]["claims"]):
|
|
254
|
-
raise RuntimeError("the claim inventory changed since the stored evidence: its Lean and "
|
|
255
|
-
"LaTeX results may not cover it; run `prooflens build` (with "
|
|
256
|
-
"--reuse-lean if no Lean input changed)")
|
|
257
278
|
reviews, review_hashes = load_reviews(cfg.reviews, cfg.ai_reviewers, cfg.root)
|
|
258
279
|
dismissals = load_dismissals(cfg.dismissals)
|
|
259
280
|
comp = cfg.comparator_log
|
|
@@ -296,7 +317,7 @@ def rebuild_site(cfg: Config, web_dist: Path | None = None, release: str | None
|
|
|
296
317
|
included only if the one on disk is the one the evidence records."""
|
|
297
318
|
rels = ev.releases(cfg.out_dir)
|
|
298
319
|
if not rels:
|
|
299
|
-
raise
|
|
320
|
+
raise StaleEvidence(NO_RELEASE)
|
|
300
321
|
rel = read_json(cfg.out_dir / "releases" / f"{release}.json") if release else \
|
|
301
322
|
read_json(rels[-1])
|
|
302
323
|
record = ev.load(cfg.out_dir, rel["evidence"])
|
|
@@ -310,7 +331,12 @@ def rebuild_site(cfg: Config, web_dist: Path | None = None, release: str | None
|
|
|
310
331
|
|
|
311
332
|
|
|
312
333
|
def load_display(cfg: Config) -> dict | None:
|
|
313
|
-
|
|
334
|
+
"""What changes what is shown and never what is assessed: the display overlay, and the
|
|
335
|
+
symbol links (docs/SYMBOL_LINKS.md)."""
|
|
336
|
+
out = read_json(cfg.display) if cfg.display and cfg.display.exists() else None
|
|
337
|
+
if cfg.symbols and cfg.symbols.exists():
|
|
338
|
+
out = {**(out or {}), "symbols": read_json(cfg.symbols).get("links", [])}
|
|
339
|
+
return out
|
|
314
340
|
|
|
315
341
|
|
|
316
342
|
def write_preview(site: Path, index: dict, chunks: dict, store: dict, pdfs: dict,
|