machinechecked 0.1.3__tar.gz → 0.1.4__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.
Files changed (64) hide show
  1. {machinechecked-0.1.3 → machinechecked-0.1.4}/PKG-INFO +1 -1
  2. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/PKG-INFO +1 -1
  3. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/SOURCES.txt +2 -1
  4. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/schema/manifest-index.schema.json +2 -1
  5. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/manifest.py +12 -0
  6. machinechecked-0.1.4/engine/python/prooflens/paper.py +103 -0
  7. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/simple.py +1 -6
  8. machinechecked-0.1.3/engine/python/prooflens/web/assets/index-CEQVnsCC.js → machinechecked-0.1.4/engine/python/prooflens/web/assets/index-Crg6e6Ow.js +29 -29
  9. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/index.html +1 -1
  10. {machinechecked-0.1.3 → machinechecked-0.1.4}/pyproject.toml +1 -1
  11. {machinechecked-0.1.3 → machinechecked-0.1.4}/LICENSE +0 -0
  12. {machinechecked-0.1.3 → machinechecked-0.1.4}/README.md +0 -0
  13. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/dependency_links.txt +0 -0
  14. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/entry_points.txt +0 -0
  15. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/requires.txt +0 -0
  16. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/machinechecked.egg-info/top_level.txt +0 -0
  17. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/__init__.py +0 -0
  18. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/__main__.py +0 -0
  19. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/assess.py +0 -0
  20. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/audit.py +0 -0
  21. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/bundle.py +0 -0
  22. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/cli.py +0 -0
  23. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/config.py +0 -0
  24. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/ProofLensProbe.lean +0 -0
  25. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/prooflens.sty +0 -0
  26. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/schema/evidence.schema.json +0 -0
  27. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/schema/inventory.schema.json +0 -0
  28. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/data/schema/manifest-claim.schema.json +0 -0
  29. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/evidence.py +0 -0
  30. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/export.py +0 -0
  31. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/formalization.py +0 -0
  32. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/pdfclaims.py +0 -0
  33. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/pipeline.py +0 -0
  34. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/probe.py +0 -0
  35. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/promote.py +0 -0
  36. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/review_queue.py +0 -0
  37. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/reviews.py +0 -0
  38. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/schemas.py +0 -0
  39. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/server.py +0 -0
  40. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/sources.py +0 -0
  41. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/tex.py +0 -0
  42. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/util.py +0 -0
  43. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  44. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  45. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  46. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  47. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  48. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  49. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  50. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  51. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  52. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  53. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  54. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  55. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  56. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  57. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  58. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  59. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  60. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  61. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  62. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/index-T9UdK0vf.css +0 -0
  63. {machinechecked-0.1.3 → machinechecked-0.1.4}/engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs +0 -0
  64. {machinechecked-0.1.3 → machinechecked-0.1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machinechecked
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machinechecked
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -18,6 +18,7 @@ engine/python/prooflens/evidence.py
18
18
  engine/python/prooflens/export.py
19
19
  engine/python/prooflens/formalization.py
20
20
  engine/python/prooflens/manifest.py
21
+ engine/python/prooflens/paper.py
21
22
  engine/python/prooflens/pdfclaims.py
22
23
  engine/python/prooflens/pipeline.py
23
24
  engine/python/prooflens/probe.py
@@ -56,6 +57,6 @@ engine/python/prooflens/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2
56
57
  engine/python/prooflens/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2
57
58
  engine/python/prooflens/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2
58
59
  engine/python/prooflens/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2
59
- engine/python/prooflens/web/assets/index-CEQVnsCC.js
60
+ engine/python/prooflens/web/assets/index-Crg6e6Ow.js
60
61
  engine/python/prooflens/web/assets/index-T9UdK0vf.css
61
62
  engine/python/prooflens/web/assets/pdf.worker.min-yatZIOMy.mjs
@@ -103,7 +103,8 @@
103
103
  "open",
104
104
  "malformed",
105
105
  "out-of-scope",
106
- "unspecified"
106
+ "unspecified",
107
+ "declared"
107
108
  ]
108
109
  },
109
110
  "anchor": {
@@ -45,6 +45,18 @@ def top_of(anchor: dict) -> tuple[int, float]:
45
45
  return anchor["begin"][0], anchor["begin"][2]
46
46
 
47
47
 
48
+ def index_anchor(anchor: dict | None, kind: str) -> dict | None:
49
+ """A located claim's place as the index lists it (for the contents and the margin): its
50
+ page and top, where it ends on that page, and the page it ends on."""
51
+ if not anchor or not anchor.get("begin"):
52
+ return None
53
+ page, y0 = top_of({**anchor, "kind": kind})
54
+ end = anchor.get("end")
55
+ return {"kind": kind, "page": page, "y0": y0,
56
+ "y1": end[2] if end and end[0] == anchor["begin"][0] else None,
57
+ "page_end": end[0] if end else None}
58
+
59
+
48
60
  def ladder(cl: dict, anchor: dict | None, mode: str | None, src_ok: bool | None) -> list[dict]:
49
61
  """The rungs of the evidence ladder of one clause, each with its own state."""
50
62
  ch = cl.get("checks", {})
@@ -0,0 +1,103 @@
1
+ """A paper's page: the paper's PDF, the statements found in it, and for each Lean project that
2
+ states it formalises the paper, the declarations its `formalization.yaml` maps them to.
3
+
4
+ It is written in the reader's standard data format (`data/index.json`, `data/claims/`), so a
5
+ paper page is read by the same code as a view or an audit. Nothing here runs Lean, so a mapped
6
+ statement reads "linked: Lean not checked here (no audit published)": the link says which
7
+ declaration the project names, not what Lean establishes. Each project's links and statuses are
8
+ kept apart (`by_project`); the reader shows one project at a time and never combines them.
9
+
10
+ No statement's text is written: only its number, heading title and place on the page.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import re
16
+ from pathlib import Path
17
+
18
+ from . import formalization as fz
19
+ from . import manifest as mf
20
+ from .util import content_id
21
+
22
+ SCHEMA = "prooflens/manifest@0"
23
+ NOT_CHECKED = "linked: Lean not checked here (no audit published)"
24
+ NOT_LINKED = "not linked"
25
+ NAME = re.compile(r"[\w.'«»]+")
26
+
27
+
28
+ def paper_claims(anchors: list[dict], title: str,
29
+ alignments: list[tuple[dict, dict | None]]) -> list[dict]:
30
+ """The statements found in the paper (anchors from `pdfclaims.claims_from_pdf`), each with
31
+ the links the projects' `formalization.yaml` files declare for it. `alignments` pairs each
32
+ project (`repository`, `commit`) with its parsed `formalization.yaml`, or None when it has
33
+ none or it could not be read."""
34
+ out = []
35
+ for a in anchors:
36
+ number = f"{a['env'].capitalize()} {a['number']}"
37
+ links = []
38
+ for f, fy in alignments:
39
+ for row in fz.links_for(fy, a["env"], number, title) if fy else []:
40
+ links += [{"name": n, "repository": f["repository"], "commit": f["commit"],
41
+ "source": "formalization.yaml"}
42
+ for n in row["lean"] if NAME.fullmatch(n)]
43
+ out.append({"key": f"{a['env']}-{a['number']}", "number": number, "kind": a["env"],
44
+ "title": a.get("title"),
45
+ "anchor": {k: a[k] for k in ("begin", "end", "head") if a.get(k)},
46
+ "links": links})
47
+ return out
48
+
49
+
50
+ def _state(links: list[dict]) -> tuple[str, str]:
51
+ return (NOT_CHECKED, "declared") if links else (NOT_LINKED, "unspecified")
52
+
53
+
54
+ def write_paper_site(site: Path, paper: dict, claims: list[dict],
55
+ page_size: list | tuple | None, pdf_url: str | None,
56
+ web_dist: Path | None = None) -> dict:
57
+ """Write the paper page's data under `site/data/` (and the reader, given its built
58
+ directory). `paper` is the paper's registry entry (its identifier, title, authors, links and
59
+ formalisations), which the reader's panel beside the paper shows; `claims` are from
60
+ `paper_claims`. Replaces whatever is at `site`."""
61
+ from .pipeline import write_preview
62
+ projects = [f["repository"] for f in paper.get("formalisations", [])]
63
+ index_claims, chunks = [], {}
64
+ for c in claims:
65
+ cid = f"P:{c['key']}"
66
+ fname = mf.claim_file(cid)
67
+ anchor = {**c["anchor"], "kind": "approximate"} if c.get("anchor") else None
68
+ by_project = {}
69
+ for r in projects:
70
+ status, cls = _state([l for l in c["links"] if l["repository"] == r])
71
+ by_project[r] = {"status": status, "class": cls}
72
+ status, cls = _state([l for l in c["links"]
73
+ if not projects or l["repository"] == projects[0]])
74
+ common = {"id": cid, "paper": "P", "number": c["number"], "title": c.get("title"),
75
+ "heading": c.get("title") or None, "kind": c["kind"], "scope": "formal",
76
+ "status": status, "class": cls, "by_project": by_project}
77
+ index_claims.append({**common, "anchor": mf.index_anchor(anchor, "approximate"),
78
+ "counts": {}, "file": fname, "linked": len(c["links"]),
79
+ "suggested": 0})
80
+ chunks[fname] = {
81
+ **common, "schema": SCHEMA, "mode": "simple", "release": "paper", "key": c["key"],
82
+ "scope_note": "", "scope_reviewed": True, "anchor": anchor,
83
+ "source_matches": None, "statement_tex": None, "blockers": [],
84
+ "links": [{**l, "status": NOT_CHECKED, "class": "declared", "why": None,
85
+ "statement": None, "path": None} for l in c["links"]],
86
+ "suggestions": [], "clauses": [], "decls": {}, "findings": []}
87
+ summary = {}
88
+ for c in index_claims:
89
+ summary[c["status"]] = summary.get(c["status"], 0) + 1
90
+ # The page has no Lean evidence; its identifier is that of what it shows.
91
+ eid = content_id({"paper": paper, "claims": claims, "pdf": pdf_url})
92
+ index = {"schema": SCHEMA, "mode": "paper", "release": "paper", "evidence": eid,
93
+ "tool": {"name": "machinechecked"}, "project": {}, "projects": projects,
94
+ "paper": paper, "notes": [],
95
+ "papers": [{"id": "P", "title": paper.get("title", ""), "mode": "pdf", "pdf": None,
96
+ "pdf_url": pdf_url, "page_size": list(page_size) if page_size else None,
97
+ "note": ""}],
98
+ "summary": {"P": summary},
99
+ "classes": {c["status"]: c["class"] for c in index_claims},
100
+ "findings": {"total": {}, "general": []}, "gates": {}, "claims": index_claims,
101
+ "search": "data/search.json"}
102
+ write_preview(site, index, chunks, {}, {}, web_dist)
103
+ return index
@@ -679,16 +679,11 @@ def write_view_site(view: dict, site: Path, web_dist: Path | None,
679
679
  if (a.get("label") or f"{a['env']}-{a.get('number')}") == c["key"]), None)
680
680
  fname = mf.claim_file(c["id"])
681
681
  akind = "approximate" if anchor and anchor.get("kind") == "pdf" else "exact"
682
- top = mf.top_of({**anchor, "kind": akind}) if anchor and anchor.get("begin") else None
683
682
  index_claims.append({
684
683
  "id": c["id"], "paper": c["paper"], "number": c["number"], "title": c["title"],
685
684
  "heading": c["title"] or None, "kind": c["kind"], "scope": c["scope"],
686
685
  "status": c["status"], "class": c["class"],
687
- "anchor": {"kind": akind, "page": top[0], "y0": top[1],
688
- "y1": anchor["end"][2] if anchor.get("end") and
689
- anchor["end"][0] == anchor["begin"][0] else None,
690
- "page_end": anchor["end"][0] if anchor.get("end") else None}
691
- if top else None,
686
+ "anchor": mf.index_anchor(anchor, akind),
692
687
  "counts": {}, "file": fname, "linked": len(c["links"]),
693
688
  "suggested": len(c.get("suggestions", []))})
694
689
  names = set()