Spaces:
Building
Building
chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)
Browse filesAutomated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): szl_puriq_formulas.py
Deleted (gone from the repo + Dockerfile COPY set): (none)
Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.
- szl_puriq_formulas.py +139 -30
szl_puriq_formulas.py
CHANGED
|
@@ -611,13 +611,17 @@ def _render_html():
|
|
| 611 |
for fid in sorted(snap, key=lambda x: int(x[1:])):
|
| 612 |
m = snap[fid]
|
| 613 |
ps = m["proof_status"]
|
| 614 |
-
color = {"PROVED": "#
|
| 615 |
-
"CONJ": "#
|
| 616 |
-
sprint = (f' <span style="color:#
|
| 617 |
if ps == "PROVED" and m.get("proved_tactic") else "")
|
| 618 |
h = m.get("harness") or {}
|
|
|
|
| 619 |
rows.append(
|
| 620 |
-
f'<tr
|
|
|
|
|
|
|
|
|
|
| 621 |
f'<td><code>{m["current_value"]}</code></td>'
|
| 622 |
f'<td>{"OK" if m["identity_holds"] else "X"}</td>'
|
| 623 |
f'<td style="color:{color}">{m["lean_status"]}</td>'
|
|
@@ -625,6 +629,8 @@ def _render_html():
|
|
| 625 |
f'<td>{h.get("passed","-")}/{h.get("total","-")}</td>'
|
| 626 |
f'<td>{"yes" if m["chain_verified"] else "no"}</td>'
|
| 627 |
f'<td>{", ".join(m.get("invoked_by", []))}</td></tr>'
|
|
|
|
|
|
|
| 628 |
)
|
| 629 |
table = "\n".join(rows)
|
| 630 |
proved = ", ".join(stats["sprint_proved"])
|
|
@@ -632,47 +638,100 @@ def _render_html():
|
|
| 632 |
ew_total = ew["total_new_experimental_theorems"]
|
| 633 |
ew_rows = "<br>".join(
|
| 634 |
f'• <b>{w["id"]}</b> (+{w["new_theorems"]} thm, PR#{w["pr"]}) '
|
| 635 |
-
f'<span style="color:#
|
| 636 |
for w in ew["waves"]
|
| 637 |
)
|
| 638 |
-
return f"""<!doctype html><html><head><meta charset="utf-8">
|
|
|
|
| 639 |
<title>PURIQ /formulas — 23 FormulaAgents</title>
|
|
|
|
|
|
|
| 640 |
<style>
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
</style></head><body>
|
| 655 |
-
<
|
| 656 |
-
<
|
| 657 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 658 |
</header>
|
| 659 |
<div class="kpis">
|
| 660 |
-
<div class="kpi"><b>{stats['n_agents']}</b>FormulaAgents</div>
|
| 661 |
-
<div class="kpi"><b>{stats['proved_count']}</b>Lean PROVED</div>
|
| 662 |
-
<div class="kpi"><b>{stats['harness_baseline']}</b>numeric harness</div>
|
| 663 |
-
<div class="kpi"><b>749 / 14 / 163</b>Doctrine v11 LOCKED (decl/axioms/sorries)</div>
|
| 664 |
-
<div class="kpi"><b>+{ew_total}</b>experimental kernel-verified (separate from locked)</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 665 |
</div>
|
| 666 |
-
<div class="note" style="margin-top:
|
| 667 |
<b>Experimental kernel-verified waves</b> (NOT in the locked count of 8; honest maturity labels):<br>
|
| 668 |
{ew_rows}
|
| 669 |
<br><b>Trust Score interval:</b> sourced from <b>CONFORMAL</b> (W5-3 + W7-4) \u2014 distribution-free, with an anti-overconfidence floor (we never report 100%). NOT Hoeffding/PAC-Bayes (those are NOT proven at the pinned Mathlib v4.13.0).<br>
|
| 670 |
<b>Deferred (not proven at pin):</b> C3 Hoeffding, C4 Azuma, C5 KL\u22650, C15, C16, C18, C19.
|
| 671 |
</div>
|
| 672 |
<table>
|
| 673 |
-
<tr><th>ID</th><th>Formula</th><th>Organ</th><th>Live value</th><th>Identity</th>
|
| 674 |
-
<th>Lean class</th><th>Proof status</th><th>Harness</th><th>Chain</th><th>Invoked by</th></tr>
|
|
|
|
| 675 |
{table}
|
|
|
|
| 676 |
</table>
|
| 677 |
<div class="note">
|
| 678 |
Self-prove sprint (real local Lean v4.13.0, Mathlib-free): <b>{proved}</b> PROVED.
|
|
@@ -680,6 +739,56 @@ Axioms: F11/F12 use <code>propext</code> (Lean core); F1/F18/F19 use none. No <c
|
|
| 680 |
Lambda-uniqueness is <b>Conjecture 1</b>, NOT a theorem. Values recompute live per request.
|
| 681 |
ADDITIVE only; IP-HOLD a11oy#57 untouched.
|
| 682 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
</body></html>"""
|
| 684 |
|
| 685 |
|
|
|
|
| 611 |
for fid in sorted(snap, key=lambda x: int(x[1:])):
|
| 612 |
m = snap[fid]
|
| 613 |
ps = m["proof_status"]
|
| 614 |
+
color = {"PROVED": "#39d98a", "SKELETON": "#f5c451",
|
| 615 |
+
"CONJ": "#c9a0ff"}.get(m["lean_status"], "#9a9a9a")
|
| 616 |
+
sprint = (f' <span style="color:#39d98a">[lean: {m["proved_tactic"]}]</span>'
|
| 617 |
if ps == "PROVED" and m.get("proved_tactic") else "")
|
| 618 |
h = m.get("harness") or {}
|
| 619 |
+
hay = f'{fid} {m["name"]} {m["organ"]} {m["lean_status"]} {ps}'.lower()
|
| 620 |
rows.append(
|
| 621 |
+
f'<tr id="{fid}" class="frow" data-fid="{fid}" data-hay="{hay}" tabindex="0" '
|
| 622 |
+
f'title="click to reveal the live proof-state / receipt chain">'
|
| 623 |
+
f'<td><b>{fid}</b> <a class="anchor" href="#{fid}" title="permalink to {fid}">¶</a></td>'
|
| 624 |
+
f'<td>{m["name"]}</td><td>{m["organ"]}</td>'
|
| 625 |
f'<td><code>{m["current_value"]}</code></td>'
|
| 626 |
f'<td>{"OK" if m["identity_holds"] else "X"}</td>'
|
| 627 |
f'<td style="color:{color}">{m["lean_status"]}</td>'
|
|
|
|
| 629 |
f'<td>{h.get("passed","-")}/{h.get("total","-")}</td>'
|
| 630 |
f'<td>{"yes" if m["chain_verified"] else "no"}</td>'
|
| 631 |
f'<td>{", ".join(m.get("invoked_by", []))}</td></tr>'
|
| 632 |
+
f'<tr class="drow" id="d-{fid}"><td colspan="10"><div class="dbox mono" id="db-{fid}">'
|
| 633 |
+
f'click loads the LIVE per-formula endpoint — raw output, no cache</div></td></tr>'
|
| 634 |
)
|
| 635 |
table = "\n".join(rows)
|
| 636 |
proved = ", ".join(stats["sprint_proved"])
|
|
|
|
| 638 |
ew_total = ew["total_new_experimental_theorems"]
|
| 639 |
ew_rows = "<br>".join(
|
| 640 |
f'• <b>{w["id"]}</b> (+{w["new_theorems"]} thm, PR#{w["pr"]}) '
|
| 641 |
+
f'<span style="color:#39d98a">[{w["label"]}]</span>: {w["summary"]}'
|
| 642 |
for w in ew["waves"]
|
| 643 |
)
|
| 644 |
+
return f"""<!doctype html><html lang="en"><head><meta charset="utf-8">
|
| 645 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 646 |
<title>PURIQ /formulas — 23 FormulaAgents</title>
|
| 647 |
+
<meta name="description" content="Named-theorem registry: 23 FormulaAgents, live recomputed values, Khipu receipt chains, honest Lean proof status. Every row is addressable; every check reveals its raw machine output."/>
|
| 648 |
+
<!-- SOVEREIGN: 0 runtime CDN. Fonts self-hosted, served same-origin at /vendor/fonts/*.woff2. -->
|
| 649 |
<style>
|
| 650 |
+
@font-face{{font-family:'Space Grotesk';font-style:normal;font-weight:300 700;font-display:swap;src:url('/vendor/fonts/SpaceGrotesk.woff2') format('woff2');}}
|
| 651 |
+
@font-face{{font-family:'JetBrains Mono';font-style:normal;font-weight:400 500;font-display:swap;src:url('/vendor/fonts/JetBrainsMono.woff2') format('woff2');}}
|
| 652 |
+
:root{{--ground:#0a0a0a;--panel:#0c0c0c;--gold:#c9b787;--teal:#5fb3a3;--cream:#f5f5f5;
|
| 653 |
+
--paragraph:#9a9a9a;--muted:#888;--dim:#555;--gold-line:rgba(201,183,135,0.15);
|
| 654 |
+
--gold-soft:rgba(201,183,135,0.04);--teal-line:rgba(95,179,163,0.22);--teal-soft:rgba(95,179,163,0.10);
|
| 655 |
+
--mono:'JetBrains Mono',ui-monospace,SFMono-Regular,monospace;--display:'Space Grotesk',Georgia,serif;}}
|
| 656 |
+
*{{box-sizing:border-box;}}
|
| 657 |
+
html,body{{margin:0;padding:0;background:var(--ground);color:var(--cream);font-family:var(--display);-webkit-font-smoothing:antialiased;}}
|
| 658 |
+
.mono{{font-family:var(--mono);}}
|
| 659 |
+
:focus-visible{{outline:2px solid var(--gold);outline-offset:3px;border-radius:3px;}}
|
| 660 |
+
.ribbon{{position:sticky;top:0;z-index:50;display:flex;align-items:center;gap:1.25rem;flex-wrap:wrap;
|
| 661 |
+
padding:0.5rem 1.25rem;font-family:var(--mono);font-size:10px;letter-spacing:0.12em;text-transform:uppercase;
|
| 662 |
+
color:var(--gold);background:rgba(10,10,10,0.85);backdrop-filter:blur(10px);border-bottom:1px solid var(--gold-line);}}
|
| 663 |
+
.ribbon .sep{{color:var(--dim);}} .ribbon .teal{{color:var(--teal);}}
|
| 664 |
+
.ribbon a{{margin-left:auto;color:var(--teal);text-decoration:none;}}
|
| 665 |
+
header.hero{{padding:2.2rem 2rem 1.2rem;}}
|
| 666 |
+
h1{{margin:0 0 6px;font-size:clamp(1.5rem,3.2vw,2.2rem);font-weight:300;letter-spacing:-.02em;}}
|
| 667 |
+
h1 .accent{{background:linear-gradient(120deg,var(--cream) 20%,var(--gold) 90%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent;}}
|
| 668 |
+
.sub{{color:var(--paragraph);font-size:13px;font-family:var(--mono);}}
|
| 669 |
+
.kpis{{display:flex;gap:14px;margin:14px 2rem;flex-wrap:wrap;}}
|
| 670 |
+
.kpi{{background:var(--panel);border:1px solid var(--gold-line);border-radius:8px;padding:12px 16px;}}
|
| 671 |
+
.kpi b{{font-size:20px;display:block;color:var(--gold);font-weight:500;}}
|
| 672 |
+
.kpi span{{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);}}
|
| 673 |
+
.searchbar{{margin:6px 2rem 2px;display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;}}
|
| 674 |
+
.searchbar input{{flex:1 1 260px;max-width:30rem;background:var(--panel);border:1px solid var(--gold-line);
|
| 675 |
+
border-radius:8px;color:var(--cream);font-family:var(--mono);font-size:13px;padding:.6rem .9rem;}}
|
| 676 |
+
.searchbar input::placeholder{{color:var(--dim);}}
|
| 677 |
+
.searchbar .cnt{{font-family:var(--mono);font-size:11px;color:var(--muted);}}
|
| 678 |
+
table{{border-collapse:collapse;width:calc(100% - 4rem);margin:8px 2rem 24px;font-size:13px;}}
|
| 679 |
+
th,td{{text-align:left;padding:7px 9px;border-bottom:1px solid rgba(201,183,135,0.08);}}
|
| 680 |
+
th{{color:var(--muted);font-weight:600;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;border-bottom:1px solid var(--gold-line);}}
|
| 681 |
+
tr.frow{{cursor:pointer;}}
|
| 682 |
+
tr.frow:hover{{background:var(--panel);}}
|
| 683 |
+
tr.frow:target{{background:var(--teal-soft);}}
|
| 684 |
+
td code{{color:var(--teal);font-family:var(--mono);}}
|
| 685 |
+
a.anchor{{color:var(--dim);text-decoration:none;font-size:11px;visibility:hidden;}}
|
| 686 |
+
tr.frow:hover a.anchor,tr.frow:target a.anchor{{visibility:visible;}}
|
| 687 |
+
tr.drow{{display:none;}}
|
| 688 |
+
tr.drow.open{{display:table-row;}}
|
| 689 |
+
.dbox{{background:var(--panel);border:1px solid var(--teal-line);border-radius:8px;margin:.3rem 0 .6rem;
|
| 690 |
+
padding:.8rem 1rem;font-size:11px;line-height:1.55;color:var(--paragraph);white-space:pre-wrap;
|
| 691 |
+
word-break:break-word;max-height:22rem;overflow:auto;}}
|
| 692 |
+
.note{{margin:0 2rem 24px;color:var(--paragraph);font-size:12px;line-height:1.7;border:1px solid var(--gold-line);
|
| 693 |
+
border-radius:10px;background:var(--gold-soft);padding:1rem 1.2rem;}}
|
| 694 |
+
.note b{{color:var(--gold);}}
|
| 695 |
+
.footer{{padding:1.4rem 2rem 2.6rem;font-family:var(--mono);font-size:10px;letter-spacing:.1em;
|
| 696 |
+
text-transform:uppercase;color:var(--dim);line-height:2;}}
|
| 697 |
+
.footer a{{color:var(--teal);text-decoration:none;text-transform:none;letter-spacing:0;}}
|
| 698 |
+
@media (max-width:720px){{.kpis,.searchbar,.note{{margin-left:1rem;margin-right:1rem;}}table{{width:calc(100% - 2rem);margin-left:1rem;margin-right:1rem;display:block;overflow-x:auto;}}}}
|
| 699 |
</style></head><body>
|
| 700 |
+
<div class="ribbon">
|
| 701 |
+
<span>SZL HOLDINGS</span><span class="sep">/</span>
|
| 702 |
+
<span class="teal">A11OY</span><span class="sep">/</span>
|
| 703 |
+
<span>FORMULAS · PURIQ REGISTRY</span><span class="sep">/</span>
|
| 704 |
+
<span>DOCTRINE V11 · LOCKED</span>
|
| 705 |
+
<a href="/wires">wires · the constitution →</a>
|
| 706 |
+
</div>
|
| 707 |
+
<header class="hero">
|
| 708 |
+
<h1>PURIQ — <span class="accent">named-formula registry</span> · 23 FormulaAgents</h1>
|
| 709 |
+
<div class="sub">live self-evaluation + Khipu receipts + honest Lean self-prove · signed Yachay (CTO) ·
|
| 710 |
+
every row is addressable (#F1…#F23) · click a row to reveal the raw machine check</div>
|
| 711 |
</header>
|
| 712 |
<div class="kpis">
|
| 713 |
+
<div class="kpi"><b>{stats['n_agents']}</b><span>FormulaAgents</span></div>
|
| 714 |
+
<div class="kpi"><b>{stats['proved_count']}</b><span>Lean PROVED</span></div>
|
| 715 |
+
<div class="kpi"><b>{stats['harness_baseline']}</b><span>numeric harness</span></div>
|
| 716 |
+
<div class="kpi"><b>749 / 14 / 163</b><span>Doctrine v11 LOCKED (decl/axioms/sorries)</span></div>
|
| 717 |
+
<div class="kpi"><b>+{ew_total}</b><span>experimental kernel-verified (separate from locked)</span></div>
|
| 718 |
+
</div>
|
| 719 |
+
<div class="searchbar">
|
| 720 |
+
<input id="q" type="search" placeholder="premise search — filter by id / name / organ / status (e.g. kalman, PROVED, heart)" aria-label="search formulas"/>
|
| 721 |
+
<span class="cnt" id="cnt"></span>
|
| 722 |
</div>
|
| 723 |
+
<div class="note" style="margin-top:12px">
|
| 724 |
<b>Experimental kernel-verified waves</b> (NOT in the locked count of 8; honest maturity labels):<br>
|
| 725 |
{ew_rows}
|
| 726 |
<br><b>Trust Score interval:</b> sourced from <b>CONFORMAL</b> (W5-3 + W7-4) \u2014 distribution-free, with an anti-overconfidence floor (we never report 100%). NOT Hoeffding/PAC-Bayes (those are NOT proven at the pinned Mathlib v4.13.0).<br>
|
| 727 |
<b>Deferred (not proven at pin):</b> C3 Hoeffding, C4 Azuma, C5 KL\u22650, C15, C16, C18, C19.
|
| 728 |
</div>
|
| 729 |
<table>
|
| 730 |
+
<thead><tr><th>ID</th><th>Formula</th><th>Organ</th><th>Live value</th><th>Identity</th>
|
| 731 |
+
<th>Lean class</th><th>Proof status</th><th>Harness</th><th>Chain</th><th>Invoked by</th></tr></thead>
|
| 732 |
+
<tbody id="tb">
|
| 733 |
{table}
|
| 734 |
+
</tbody>
|
| 735 |
</table>
|
| 736 |
<div class="note">
|
| 737 |
Self-prove sprint (real local Lean v4.13.0, Mathlib-free): <b>{proved}</b> PROVED.
|
|
|
|
| 739 |
Lambda-uniqueness is <b>Conjecture 1</b>, NOT a theorem. Values recompute live per request.
|
| 740 |
ADDITIVE only; IP-HOLD a11oy#57 untouched.
|
| 741 |
</div>
|
| 742 |
+
<div class="footer">
|
| 743 |
+
registry pattern after mathlib — every result named + addressable (<a href="https://arxiv.org/abs/1910.09336" rel="noopener">arXiv:1910.09336</a>, cited) ·
|
| 744 |
+
proof-state reveal after Alectryon (MIT, pattern) · premise-search after LeanDojo/ReProver (MIT, pattern) ·
|
| 745 |
+
0 runtime CDN · fonts self-hosted · JSON: <a href="/api/a11oy/v1/puriq/formulas">/api/a11oy/v1/puriq/formulas</a>
|
| 746 |
+
</div>
|
| 747 |
+
<script>
|
| 748 |
+
(function(){{
|
| 749 |
+
var tb=document.getElementById('tb'),q=document.getElementById('q'),cnt=document.getElementById('cnt');
|
| 750 |
+
var frows=[].slice.call(tb.querySelectorAll('tr.frow'));
|
| 751 |
+
function applyFilter(){{
|
| 752 |
+
var s=(q.value||'').trim().toLowerCase(),n=0;
|
| 753 |
+
frows.forEach(function(r){{
|
| 754 |
+
var hit=!s||r.getAttribute('data-hay').indexOf(s)>=0;
|
| 755 |
+
r.style.display=hit?'':'none';n+=hit?1:0;
|
| 756 |
+
var d=document.getElementById('d-'+r.getAttribute('data-fid'));
|
| 757 |
+
if(d&&!hit)d.classList.remove('open');
|
| 758 |
+
}});
|
| 759 |
+
cnt.textContent=s?(n+' / '+frows.length+' match'):(frows.length+' formulas');
|
| 760 |
+
}}
|
| 761 |
+
q.addEventListener('input',applyFilter);applyFilter();
|
| 762 |
+
var loaded={{}};
|
| 763 |
+
function reveal(fid){{
|
| 764 |
+
var d=document.getElementById('d-'+fid);if(!d)return;
|
| 765 |
+
d.classList.toggle('open');
|
| 766 |
+
if(!d.classList.contains('open')||loaded[fid])return;
|
| 767 |
+
var box=document.getElementById('db-'+fid);
|
| 768 |
+
box.textContent='fetching LIVE /api/a11oy/v1/puriq/formulas/'+fid+' \\u2026';
|
| 769 |
+
fetch('/api/a11oy/v1/puriq/formulas/'+fid).then(function(r){{
|
| 770 |
+
if(!r.ok)throw new Error('HTTP '+r.status);return r.json();
|
| 771 |
+
}}).then(function(j){{
|
| 772 |
+
loaded[fid]=true;
|
| 773 |
+
box.textContent='LIVE proof-state / receipt chain (raw endpoint output, recomputed per request):\\n\\n'+JSON.stringify(j,null,2);
|
| 774 |
+
}}).catch(function(e){{
|
| 775 |
+
box.textContent='endpoint unreachable: '+e.message+' \\u2014 shown honestly, nothing cached or invented.';
|
| 776 |
+
}});
|
| 777 |
+
}}
|
| 778 |
+
tb.addEventListener('click',function(ev){{
|
| 779 |
+
if(ev.target.closest('a'))return;
|
| 780 |
+
var r=ev.target.closest('tr.frow');if(r)reveal(r.getAttribute('data-fid'));
|
| 781 |
+
}});
|
| 782 |
+
tb.addEventListener('keydown',function(ev){{
|
| 783 |
+
if(ev.key!=='Enter'&&ev.key!==' ')return;
|
| 784 |
+
var r=ev.target.closest('tr.frow');if(r){{ev.preventDefault();reveal(r.getAttribute('data-fid'));}}
|
| 785 |
+
}});
|
| 786 |
+
if(location.hash){{
|
| 787 |
+
var t=document.getElementById(location.hash.slice(1));
|
| 788 |
+
if(t&&t.classList.contains('frow'))reveal(t.getAttribute('data-fid'));
|
| 789 |
+
}}
|
| 790 |
+
}})();
|
| 791 |
+
</script>
|
| 792 |
</body></html>"""
|
| 793 |
|
| 794 |
|