Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
The demo runs the whole loop, with the real checker (#241)
Fabio Rovai11eef492594d
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex e39555f2..05ca855d 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -58,9 +58,60 @@ jobs:name: open-ontologies-${{ matrix.target }}path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}+ # The checkers, for the one platform that has to run them without a Lean+ # toolchain: the hosted demo.+ #+ # Until this job existed the release shipped the engine and not the thing that+ # checks the engine. "Hand the reviewer a proof they can check" required that+ # reviewer to install elan and build Lean first, and the demo could not show a+ # certificate at all, so a visitor met a front page whose central claim the+ # page itself could not demonstrate. These binaries are a few MB each.+ checkers:+ timeout-minutes: 30+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ - uses: leanprover/lean-action@v1+ with:+ lake-package-directory: lean+ build: true+ test: false+ lint: false+ use-github-cache: true+ - name: Name them for the platform they were built on+ run: |+ set -euo pipefail+ mkdir -p out+ # oo-cert and oo-horn are required: the demo runs the first and the+ # repository's own front page quotes the second. The rest are taken+ # when present, and the first-order checker is accepted under either+ # of its names so this job survives the rename either way. A missing+ # REQUIRED checker fails the release rather than publishing a release+ # that silently lost half of the argument.+ for b in oo-cert oo-horn; do+ src="lean/.lake/build/bin/$b"+ [ -x "$src" ] || { echo "::error::$b was not built"; exit 1; }+ cp "$src" "out/${b}-x86_64-unknown-linux-gnu"+ done+ fo=0+ for b in oo-lrat oo-resolution oo-fores oo-shacl; do+ src="lean/.lake/build/bin/$b"+ if [ -x "$src" ]; then+ cp "$src" "out/${b}-x86_64-unknown-linux-gnu"+ case "$b" in oo-resolution|oo-fores) fo=1 ;; esac+ fi+ done+ [ "$fo" = 1 ] || { echo "::error::no first-order resolution checker under either name"; exit 1; }+ ls -la out++ - uses: actions/upload-artifact@v4+ with:+ name: checkers-x86_64-unknown-linux-gnu+ path: out/*+release:timeout-minutes: 20- needs: build+ needs: [build, checkers]runs-on: ubuntu-latestpermissions:contents: write@@ -88,14 +139,17 @@ jobs:# Strip the artifact directory so the listed names match the asset# names as downloaded, and keep sha256sum's two-space separator so# `sha256sum -c SHASUMS.txt` works as-is next to the binaries.- sha256sum open-ontologies-*/open-ontologies-* | sed 's| .*/| |' > SHASUMS.txt+ sha256sum open-ontologies-*/open-ontologies-* checkers-*/oo-* \+ | sed 's| .*/| |' > SHASUMS.txtcat SHASUMS.txt- name: Attest build provenanceuses: actions/attest-build-provenance@v4with:# Runs after the rename so each attested subject name is the name the# asset is published under.- subject-path: 'open-ontologies-*/open-ontologies-*'+ subject-path: |+ open-ontologies-*/open-ontologies-*+ checkers-*/oo-*- name: Extract release notes from CHANGELOGrun: |version="${GITHUB_REF_NAME#v}"@@ -109,4 +163,5 @@ jobs:body_path: release-notes.mdfiles: |open-ontologies-*/open-ontologies-*+ checkers-*/oo-*SHASUMS.txtdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2a711c72..525f1e5f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,21 @@ All notable changes to Open Ontologies are documented here.## [Unreleased]+## [1.6.0] - 2026-09-21++### Added+- **The release ships the checkers.** `oo-cert`, `oo-horn`, the first-order resolution checker and+ `oo-lrat` are built for `x86_64-unknown-linux-gnu` and published as release assets, with their+ digests in `SHASUMS.txt` and build provenance attested alongside the engine. Until now the+ release carried the engine and not the thing that checks it, so "hand the reviewer a proof they+ can check" required that reviewer to install elan and build Lean first.+- **The hosted demo runs the whole loop.** `web/try` induces an ontology from a sheet, then lets a+ visitor add one line to it, reasons, writes a certificate, has `oo-cert` accept it, and then+ forges one conclusion and hands the same checker the same premises. Measured on the bundled+ `staff.csv`: one `rdfs:subClassOf` gives 14 derivations, `oo-cert` exits 0 with+ `OOCert.certificate_sound`, and the forged copy exits 1 naming `rdfs9`.++## [1.5.0] - 2026-09-201.4.0 and 1.4.1 were tagged without a section of their own; their entries are among the onesdiff --git a/web/try/api/index.py b/web/try/api/index.pyindex 766bd1ed..e1d2dca7 100644--- a/web/try/api/index.py+++ b/web/try/api/index.py@@ -48,6 +48,46 @@ def engine() -> Path:return dst+def checker() -> Path | None:+ """The Lean certificate checker, executable, or None when the release did+ not carry one. The page says which; it never implies a check that did not+ happen."""+ override = os.environ.get("OO_CERT")+ src = Path(override) if override else (HERE / "_bin" / "oo-cert")+ if not src.exists():+ return None+ dst = Path(tempfile.gettempdir()) / "oo-engine" / "oo-cert"+ if not dst.exists() or dst.stat().st_size != src.stat().st_size:+ dst.parent.mkdir(parents=True, exist_ok=True)+ shutil.copyfile(src, dst)+ dst.chmod(dst.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)+ return dst+++def run_checker(cert_dir: Path) -> dict:+ """Run the Lean checker over a certificate directory and return what it said.++ The exit code is part of the answer, not an error: exit 1 with a named rule+ is the whole point of the third panel.+ """+ c = checker()+ if c is None:+ return {"absent": True, "means": "this release carries no oo-cert, so nothing was checked here"}+ proc = subprocess.run(+ [str(c), str(cert_dir / "asserted.tsv"), str(cert_dir / "derivations.tsv")],+ capture_output=True, text=True, timeout=TIMEOUT_S,+ )+ line = next((l for l in proc.stdout.splitlines() if l.startswith("{")), "")+ try:+ out = json.loads(line) if line else {}+ except json.JSONDecodeError:+ out = {}+ out["exit"] = proc.returncode+ if not line:+ out["stderr_tail"] = proc.stderr[-300:]+ return out++def engine_info() -> dict:tag_file = HERE / "_bin" / "TAG"tag = tag_file.read_text().strip() if tag_file.exists() else os.environ.get("OO_ENGINE_TAG", "local build")@@ -55,7 +95,20 @@ def engine_info() -> dict:h = hashlib.sha256(engine().read_bytes()).hexdigest()except Exception as e: # noqa: BLE001h = f"unavailable: {e}"- return {"tag": tag, "sha256": h, "means": "every answer on this page is the output of this binary in batch mode; the page draws, it does not decide"}+ c = checker()+ ch = None+ if c is not None:+ try:+ ch = hashlib.sha256(c.read_bytes()).hexdigest()+ except Exception as e: # noqa: BLE001+ ch = f"unavailable: {e}"+ return {+ "tag": tag,+ "sha256": h,+ "checker_sha256": ch,+ "checker": "oo-cert" if ch else None,+ "means": "every answer on this page is the output of these binaries; the page draws, it does not decide",+ }def run_batch(workdir: Path, script: str) -> list[dict]:@@ -150,6 +203,80 @@ def do_check(body: dict) -> dict:return {"ingest": by.get("ingest"), "shacl": by.get("shacl"), "meta": by.get("_meta")}+def do_plan(body: dict) -> dict:+ """The whole loop, on the sheet the visitor brought.++ An induced ontology is flat, so a reasoner derives nothing from it: measured,+ 0 derivations under both rdfs and owl-rl, because the mapping already asserts+ the class of every row and `rdfs:domain` can then only re-derive it. That is+ a true fact about a flat sheet, and manufacturing consequences to hide it+ would make the demo a lie.++ So the visitor adds one line, which is the front page's own argument: plan a+ change to an ontology and see what follows. One `rdfs:subClassOf` over the+ induced class gives one derived type for each row, and the certificate over+ those derivations is the thing the checker then accepts, and refuses when a+ conclusion in it is forged.+ """+ csv = body.get("csv") or ""+ extra = (body.get("axiom") or "").strip()+ for k in ("ontology_ttl", "mapping"):+ if not body.get(k):+ return {"error": f"missing {k}; induce first"}+ if len(csv.encode()) > MAX_BYTES:+ return {"error": "too large"}+ if len(extra) > 2000:+ return {"error": "the added axioms are longer than 2000 characters"}+ name = safe_name(body.get("name", "sheet.csv"))+ with tempfile.TemporaryDirectory(prefix="oo-try-") as td:+ wd = Path(td)+ (wd / name).write_text(csv)+ (wd / "plan.ttl").write_text(body["ontology_ttl"] + "\n" + extra + "\n")+ mapping = body["mapping"]+ (wd / "mapping.json").write_text(mapping if isinstance(mapping, str) else json.dumps(mapping))+ cert = wd / "cert"+ base = "http://example.org/try/"+ script = (+ f"load {wd / 'plan.ttl'}\n"+ f"ingest {wd / name} --mapping {wd / 'mapping.json'} --base-iri {base}\n"+ f"reason --profile owl-rl --certificate {cert}\n"+ )+ lines = run_batch(wd, script)+ by = {l.get("command"): l.get("result") for l in lines}+ reason = by.get("reason") or {}+ if "error" in reason:+ return {"error": reason["error"], "engine": lines}+ c = (reason.get("certificate") or {})++ accepted = run_checker(cert)++ # Now forge one conclusion and hand the SAME checker the SAME premises.+ forged = None+ derivations = (cert / "derivations.tsv").read_text() if (cert / "derivations.tsv").exists() else ""+ rows = [r for r in derivations.splitlines() if r.strip()]+ if rows and not accepted.get("absent"):+ f = wd / "forged"+ f.mkdir(exist_ok=True)+ (f / "asserted.tsv").write_text((cert / "asserted.tsv").read_text())+ fields = rows[0].split("\t")+ original = "\t".join(fields[:4])+ if len(fields) >= 4:+ fields[3] = "<http://example.org/try/ont#NotDerivable>"+ rows_forged = ["\t".join(fields)] + rows[1:]+ (f / "derivations.tsv").write_text("\n".join(rows_forged) + "\n")+ forged = run_checker(f)+ forged["line_before"] = original+ forged["line_after"] = "\t".join(fields[:4])+ return {+ "reason": reason,+ "certificate": c,+ "accepted": accepted,+ "forged": forged,+ "derivations_sample": rows[:6],+ "meta": by.get("_meta"),+ }++def do_samples() -> dict:items = []for p in sorted(SAMPLES.glob("*.csv")):@@ -197,6 +324,8 @@ class handler(BaseHTTPRequestHandler): # noqa: N801 (Vercel's expected name)res = do_induce(body)elif r == "check":res = do_check(body)+ elif r == "plan":+ res = do_plan(body)else:return self._send(404, {"error": f"no such route: {r}"})return self._send(400 if "error" in res else 200, res)diff --git a/web/try/build.sh b/web/try/build.shindex e618bb0a..5cd44279 100644--- a/web/try/build.sh+++ b/web/try/build.sh@@ -8,9 +8,33 @@ URL="https://github.com/fabio-rovai/open-ontologies/releases/download/${TAG}/opeecho "engine: ${URL}"curl -fsSL -o api/_bin/open-ontologies "${URL}"curl -fsSL -o api/_bin/SHASUMS.txt "https://github.com/fabio-rovai/open-ontologies/releases/download/${TAG}/SHASUMS.txt"-WANT=$(grep 'x86_64-unknown-linux-gnu' api/_bin/SHASUMS.txt | awk '{print $1}')-GOT=$(sha256sum api/_bin/open-ontologies | awk '{print $1}')-[ "$WANT" = "$GOT" ] || { echo "checksum mismatch: want $WANT got $GOT"; exit 1; }++# Every file is checked against the release's own SHASUMS.txt before it is used.+# A demo that runs an unverified binary is a demo about trust.+verify() {+ want=$(grep " $1\$" api/_bin/SHASUMS.txt | awk '{print $1}')+ got=$(sha256sum "api/_bin/$2" | awk '{print $1}')+ [ -n "$want" ] || { echo "no checksum for $1 in SHASUMS.txt"; exit 1; }+ [ "$want" = "$got" ] || { echo "checksum mismatch for $1: want $want got $got"; exit 1; }+ echo " $2 $got"+}+verify "open-ontologies-x86_64-unknown-linux-gnu" "open-ontologies"chmod +x api/_bin/open-ontologies++# The Lean certificate checker. The page runs it on the certificate the engine+# wrote, and on a forged copy of it, so the visitor sees both answers. Released+# from v1.6.0; before that tag the release carried the engine alone and the+# page says the checker is absent rather than pretending it ran.+CERT_ASSET="oo-cert-x86_64-unknown-linux-gnu"+if curl -fsSL -o api/_bin/oo-cert \+ "https://github.com/fabio-rovai/open-ontologies/releases/download/${TAG}/${CERT_ASSET}"; then+ verify "${CERT_ASSET}" "oo-cert"+ chmod +x api/_bin/oo-cert+ echo "checker ${TAG} pinned"+else+ rm -f api/_bin/oo-cert+ echo "::warning::${TAG} publishes no ${CERT_ASSET}; the page will report the checker as absent"+fi+echo "${TAG}" > api/_bin/TAG-echo "engine ${TAG} pinned, sha256 ${GOT}"+echo "engine ${TAG} pinned"diff --git a/web/try/public/index.html b/web/try/public/index.htmlindex a4786365..fe7b2b55 100644--- a/web/try/public/index.html+++ b/web/try/public/index.html@@ -106,6 +106,17 @@ footer{border-top:1px solid var(--line);color:var(--muted);font-size:13px;paddin<div id="viols"></div></section>+ <section class="card" id="plan" hidden style="margin-top:18px">+ <h2 id="i-step4">4 · Add one line, and get a proof</h2>+ <p class="sub" style="margin-bottom:8px" id="i-step4p"></p>+ <div class="row" style="align-items:flex-start">+ <textarea class="code" id="axiom" spellcheck="false" style="flex:1;min-height:56px"></textarea>+ <button class="primary" id="goplan"></button>+ </div>+ <div class="row"><span class="status" id="st3"></span></div>+ <div id="planout"></div>+ </section>+<section id="what" style="margin-top:26px"><h2 id="i-what">What this is, and is not</h2><p class="sub" style="margin-bottom:8px" id="i-what1"></p>@@ -149,6 +160,14 @@ const STR = {p_object: 'object →', p_in: 'in', p_group: 'group of', p_min: 'minCount 1', p_max: 'maxCount',observed: '; observed', notconstrained: '(reported, and not constrained)',engine_says: 'The engine says: ',+ step4: '4 · Add one line, and get a proof',+ step4p: 'An induced ontology is flat, so a reasoner derives nothing from it. That is measured, not assumed: 0 derivations under rdfs and under owl-rl, because the mapping already gives each row its class. So add one line. This is the front page\u2019s own argument: plan a change to an ontology, and see every consequence before you apply it. The engine writes a certificate for what follows, the Lean checker accepts it, and then the page forges one conclusion and hands the same checker the same premises.',+ goplan: 'Add the line and reason',+ p_new: 'consequences that were not there before',+ p_cert: 'The certificate', p_acc: 'The checker accepted it', p_ref: 'The checker refused the forged one',+ p_theorem: 'theorem', p_exit: 'exit', p_rule: 'rule', p_absent: 'This release carries no checker, so nothing was checked here.',+ p_nothing: 'That line derives nothing. Try a subClassOf over the induced class.',+ p_forgedline: 'One conclusion was changed, and both premises were left exactly as they were:',summary: '{c}: {r} rows → 1 class, {p} {pw}{obj}{grp}{enu}.',prop1: 'property', propn: 'properties', obj: ' object', grp: ' numbered group merged', grpn: ' numbered groups merged', enu: ' enumeration', enun: ' enumerations',verbatim: '',@@ -190,6 +209,14 @@ const STR = {p_object: '对象属性 →', p_in: '取值集合', p_group: '合并了', p_min: 'minCount 1', p_max: 'maxCount',observed: ';观察到', notconstrained: '(只报告,不作为约束)',engine_says: '引擎说:',+ step4: '4 · 加一行,然后得到一份证明',+ step4p: '归纳出的本体是扁平的,推理机从它推不出东西。这是测得的,不是假设的:在 rdfs 和 owl-rl 下都是 0 条推论,因为映射已经给每一行赋予了类。所以请加一行。这正是首页自己的论点:为本体规划一次变更,在应用之前看清每一项后果。引擎为随之而来的结论写一份证书,Lean 检查器接受它;随后页面伪造一条结论,把同样的前提交给同一个检查器。',+ goplan: '加上这一行并推理',+ p_new: '条此前不存在的后果',+ p_cert: '证书', p_acc: '检查器接受了它', p_ref: '检查器拒绝了伪造的那一份',+ p_theorem: '定理', p_exit: '退出码', p_rule: '规则', p_absent: '本次发布不含检查器,因此这里没有检查任何东西。',+ p_nothing: '这一行推不出任何东西。试试在归纳出的类上写一条 subClassOf。',+ p_forgedline: '一条结论被改动,两条前提原样保留:',summary: '{c}:{r} 行 → 1 个类,{p} 个{pw}{obj}{grp}{enu}。',prop1: '属性', propn: '属性', obj: '(其中 1 个是对象属性)', grp: '(合并了 1 组编号列)', grpn: '(合并了多组编号列)', enu: '(含取值集合)', enun: '(含取值集合)',verbatim: '下表“证据”列与上面“引擎说”的句子,是引擎自己的输出,原样显示,未经翻译。本页面不改写引擎的措辞。',@@ -224,6 +251,8 @@ function paint(){const sub=document.getElementById('i-sub'); if(sub) sub.innerHTML = L.sub;set('i-step1', L.step1); set('i-drop', L.drop); set('i-cls', L.cls);set('i-step2', L.step2); set('i-step3', L.step3); set('i-step3p', L.step3p, true);+ set('i-step4', L.step4); set('i-step4p', L.step4p);+ const gp=document.getElementById('goplan'); if(gp) gp.textContent=L.goplan;set('i-what', L.what); set('i-what1', L.what1, true); set('i-what2', L.what2, true);set('i-foot', L.foot);const ta=document.getElementById('csv-ta'); if(ta) ta.placeholder=L.paste;@@ -242,7 +271,11 @@ let current={name:'sheet.csv',csv:'',induced:null,mapping:null,rows:[],headers:[api('engine').then(j=>{$('#engine').textContent=j.tag?`${j.tag}, sha256 ${String(j.sha256).slice(0,12)}…`:'unavailable'}).catch(()=>{$('#engine').textContent='unavailable'});api('samples').then(j=>{const box=$('#samples');box.innerHTML='<span class="status">'+L.samples+'</span>';(j.samples||[]).forEach(s=>{const b=document.createElement('button');b.textContent=`${s.name} (${s.rows} rows)`;b.onclick=()=>{$('#csv').value=s.csv;current.name=s.name;$('#cls').value='';$('#st1').textContent=`${L.loaded_s} ${s.name}`};box.appendChild(b)});// ?sample=epc-sample.csv&auto=1 loads a bundled sheet and runs it, so a link can carry a worked example.- const q=new URLSearchParams(location.search),want=q.get('sample');const hit=(j.samples||[]).find(s=>s.name===want);if(hit){$('#csv').value=hit.csv;current.name=hit.name;$('#st1').textContent=`${L.loaded_s} ${hit.name}`;if(q.get('auto')==='1')$('#go').click()}});+ const q=new URLSearchParams(location.search),want=q.get('sample');const hit=(j.samples||[]).find(s=>s.name===want);if(hit){$('#csv').value=hit.csv;current.name=hit.name;$('#st1').textContent=`${L.loaded_s} ${hit.name}`;+ // `&plan=1` carries the whole loop in a link: induce, then add the line and+ // reason, so a reader who follows the link from the README sees the+ // certificate and the refusal without touching anything.+ if(q.get('auto')==='1'){ current.autoplan = q.get('plan')==='1'; $('#go').click(); }}});const drop=$('#drop'),file=$('#file');drop.onclick=()=>file.click();drop.onkeydown=e=>{if(e.key==='Enter'||e.key===' ')file.click()};@@ -297,7 +330,12 @@ function render(j){const ind=j.induced;current.induced=ind;current.mapping=j.map$('#t-ontology').textContent=ind.ontology_ttl;$('#t-shapes').textContent=ind.shapes_ttl;$('#t-mapping').textContent=pretty(current.mapping);$('#t-engine').textContent=JSON.stringify({induce:{...ind,ontology_ttl:'(see tab)',shapes_ttl:'(see tab)',mapping:'(see tab)'},shacl:j.shacl,reason:j.reason,stats:j.stats,meta:j.meta},null,1);$('#means').textContent=L.engine_says+ind.means;- const rows=parseCsv(current.csv);current.headers=rows[0]||[];current.rows=rows.slice(1);grid()}+ const rows=parseCsv(current.csv);current.headers=rows[0]||[];current.rows=rows.slice(1);grid();+ // The one line, prefilled with the class the engine just induced.+ $('#plan').hidden=false;+ $('#axiom').value=`:${ind.class} rdfs:subClassOf :Thing${'\n'}:Thing a owl:Class .`.replace(':Thing\n', ':Thing .\n');+ $('#planout').innerHTML='';$('#st3').textContent='';+ if(current.autoplan){current.autoplan=false;setTimeout(()=>$('#goplan').click(),60)}}function grid(){const h=current.headers,rows=current.rows.slice(0,40);let t='<table><thead><tr><th>#</th>'+h.map(x=>`<th>${esc(x)}</th>`).join('')+'</tr></thead><tbody>';rows.forEach((r,i)=>{t+=`<tr><td style="color:var(--dim)">${i+1}</td>`+h.map((_,k)=>`<td contenteditable data-r="${i}" data-c="${k}">${esc(r[k]??'')}</td>`).join('')+'</tr>'});@@ -313,6 +351,31 @@ $('#recheck').onclick=async()=>{if(!current.induced)return;$('#recheck').disablev.slice(0,50).forEach(x=>{html+=`<div class="viol"><code>${esc(short(x.focus_node))}</code> · <code>${esc(short(x.result_path||x.path||''))}</code> · ${esc(short(x.source_constraint_component||x.constraint||''))}<br>${esc(x.message||'')}</div>`});if(v.length>50)html+=`<p class="status">${L.andmore} ${v.length-50} ${L.more}</p>`;$('#viols').innerHTML=html};+$('#goplan').onclick=async()=>{+ if(!current.induced)return;+ $('#goplan').disabled=true;$('#st3').className='status';$('#st3').textContent=L.running;+ const j=await api('plan',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({+ name:current.name,csv:current.csv,ontology_ttl:current.induced.ontology_ttl,mapping:current.mapping,axiom:$('#axiom').value})});+ $('#goplan').disabled=false;+ if(j.error){$('#st3').className='status err';$('#st3').textContent=j.error;return}+ $('#st3').textContent=`${L.done} ${j.meta?.seconds??'?'} s`;+ const c=j.certificate||{},a=j.accepted||{},f=j.forged;+ const n=c.derivations??0;+ let h=`<p class="summary" style="margin-top:10px"><b>${n}</b> ${L.p_new}.</p>`;+ if(!n){h+=`<p class="status">${L.p_nothing}</p>`;}+ else{+ h+=`<dl class="kv"><dt>${L.p_cert}</dt><dd><code>${esc(c.asserted)} asserted, ${esc(c.derivations)} derivations</code> · ${esc(JSON.stringify(c.by_rule||{}))}</dd>`;+ if(a.absent){h+=`<dt>${L.p_acc}</dt><dd><span class="pill warn">${L.p_absent}</span></dd>`;}+ else{+ h+=`<dt>${L.p_acc}</dt><dd><span class="pill ${a.ok?'ok':'bad'}">${L.p_exit} ${esc(a.exit)}</span> ${a.theorem?`${L.p_theorem} <code>${esc(a.theorem)}</code>`:''}</dd>`;+ if(f)h+=`<dt>${L.p_ref}</dt><dd><span class="pill ${f.ok?'bad':'ok'}">${L.p_exit} ${esc(f.exit)}</span> ${f.rule?`${L.p_rule} <code>${esc(f.rule)}</code>`:''}</dd>`;+ }+ h+='</dl>';+ if(f&&f.line_before)h+=`<p class="status">${L.p_forgedline}</p><pre>${esc(f.line_before)}\n${esc(f.line_after)}</pre>`;+ }+ $('#planout').innerHTML=h;+};+function esc(s){return String(s??'').replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c]))}function short(s){s=String(s||'');const i=Math.max(s.lastIndexOf('#'),s.lastIndexOf('/'));return i>=0&&i<s.length-1?s.slice(i+1):s}function pretty(s){try{return JSON.stringify(typeof s==='string'?JSON.parse(s):s,null,1)}catch{return String(s)}}