add(tests): bounded conformance suite for the reducer against the relational semantics (golden corpus)
This commit is contained in:
1 parent
9f7696eb2f
commit
e60bdfae1a
9 files changed
+1438
-750
No files matched your search
+5
-2
@@ -33,9 +33,11 @@ while IFS= read -r -d '' f; do
|
||||
done < <(find theory -name '*.v' -print0 2>/dev/null)
|
||||
|
||||
echo "== Print Assumptions =="
|
||||
for f in ExecReducer Binding Reduction; do
|
||||
WORK="$(mktemp -d ./.audit-work.XXXXXX)"
|
||||
cp theory/*.v "$WORK"/
|
||||
for f in ExecReducer Binding Reduction Metatheory Tests; do
|
||||
echo "-- $f"
|
||||
out="$(rocq compile -Q theory LambdaSub "theory/$f.v" 2>&1 || true)"
|
||||
out="$(rocq compile -Q "$WORK" LambdaSub "$WORK/$f.v" 2>&1 || true)"
|
||||
echo "$out"
|
||||
if echo "$out" | grep -q "Axioms:"; then
|
||||
echo "unexpected axioms reported in $f" >&2
|
||||
@@ -46,6 +48,7 @@ for f in ExecReducer Binding Reduction; do
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
rm -rf "$WORK"
|
||||
|
||||
if [ "$fail" -ne 0 ]; then
|
||||
echo "AUDIT FAIL"
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
if ! command -v rocq >/dev/null 2>&1; then
|
||||
if command -v opam >/dev/null 2>&1; then
|
||||
eval "$(opam env --switch=rocq-system --set-switch 2>/dev/null || true)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v rocq >/dev/null 2>&1; then
|
||||
echo "rocq not on PATH; run: eval \$(opam env --switch=rocq-system --set-switch)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dune build
|
||||
./scripts/audit.sh
|
||||
echo "CONFORMANCE OK: 7 term corpus checked against the relational semantics by theory/Tests.v"
|
||||
echo "DIFFTEST OK"
|
||||
@@ -85,7 +85,7 @@ def extract(theory_dir):
|
||||
with open(path, "r", encoding="utf-8") as fh:
|
||||
text = fh.read()
|
||||
for decl in split_decls(text):
|
||||
if decl["kind"] not in ("Lemma", "Theorem", "Corollary", "Proposition", "Example"):
|
||||
if decl["kind"] not in ("Lemma", "Theorem", "Corollary", "Proposition"):
|
||||
continue
|
||||
name = decl["name"]
|
||||
nodes.append(
|
||||
|
||||
+45
-34
@@ -42,48 +42,59 @@ def load(path):
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def esc_html(s):
|
||||
return str(s).replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
|
||||
|
||||
def dependency_dot(data):
|
||||
nodes = data["nodes"]
|
||||
by_id = {n["id"]: n for n in nodes}
|
||||
title = data["paper"]["title"] + " - theorem dependency (" + data["current"] + ")"
|
||||
legend = (
|
||||
"<B>" + esc_html(title) + "</B>"
|
||||
"<BR/><FONT POINT-SIZE=\"9\">"
|
||||
"<FONT COLOR=\"#38761d\">proved</FONT> "
|
||||
"<FONT COLOR=\"#b45f06\">stated</FONT> "
|
||||
"<FONT COLOR=\"#777777\">planned</FONT> "
|
||||
"<FONT COLOR=\"#cc0000\">blocked</FONT>"
|
||||
"</FONT>"
|
||||
)
|
||||
lines = [
|
||||
"digraph theorem_deps {",
|
||||
" rankdir=LR;",
|
||||
" bgcolor=\"white\";",
|
||||
" node [fontname=Inter, fontsize=10, fontcolor=\"%s\"];" % INK,
|
||||
" edge [fontname=Inter, fontsize=8, color=\"%s\"];" % INK,
|
||||
" graph [fontname=Inter, fontsize=12, labelloc=t, label=%s];" % q(title),
|
||||
' bgcolor="white";',
|
||||
" splines=spline;",
|
||||
" nodesep=0.22;",
|
||||
" ranksep=0.6;",
|
||||
' node [fontname=Inter, fontsize=9, fontcolor="#222222"];',
|
||||
' edge [fontname=Inter, fontsize=8, color="#9a9a9a", arrowsize=0.6, penwidth=0.8];',
|
||||
" graph [fontname=Inter, fontsize=12, labelloc=t, label=<%s>];" % legend,
|
||||
]
|
||||
for ms in data["milestones"]:
|
||||
members = [n for n in nodes if n["milestone"] == ms]
|
||||
if not members:
|
||||
continue
|
||||
lines.append(" subgraph cluster_%s {" % ms)
|
||||
lines.append(" label=%s;" % q(ms))
|
||||
lines.append(" style=\"rounded\";")
|
||||
lines.append(" color=\"#bbbbbb\";")
|
||||
lines.append(" fontcolor=\"%s\";" % INK)
|
||||
for n in members:
|
||||
fill = STATUS_FILL.get(n["status"], "#f3f3f3")
|
||||
pen = STATUS_PEN.get(n["status"], "#777777")
|
||||
style = STATUS_STYLE.get(n["status"], "dashed")
|
||||
tip = n["id"]
|
||||
if n.get("section"):
|
||||
tip += " (section " + n["section"] + ")"
|
||||
if n.get("file"):
|
||||
tip += " " + n["file"]
|
||||
tip += " " + data["paper"]["html"]
|
||||
attrs = [
|
||||
"label=%s" % q(n["label"]),
|
||||
"color=%s" % q(pen),
|
||||
"fillcolor=%s" % q(fill),
|
||||
"style=%s" % q(style),
|
||||
"fontcolor=%s" % q(INK),
|
||||
"tooltip=%s" % q(tip),
|
||||
"shape=%s" % ("box" if n["kind"] == "paper" else "ellipse"),
|
||||
]
|
||||
lines.append(" %s [%s];" % (n["id"], ", ".join(attrs)))
|
||||
lines.append(" }")
|
||||
for n in nodes:
|
||||
fill = STATUS_FILL.get(n["status"], "#f3f3f3")
|
||||
pen = STATUS_PEN.get(n["status"], "#777777")
|
||||
style = STATUS_STYLE.get(n["status"], "dashed")
|
||||
tip = n["id"]
|
||||
if n.get("section"):
|
||||
tip += " (section " + n["section"] + ")"
|
||||
if n.get("file"):
|
||||
tip += " " + n["file"]
|
||||
tip += " " + data["paper"]["html"]
|
||||
if n["kind"] == "paper":
|
||||
shape = "box"
|
||||
style = "rounded," + style
|
||||
else:
|
||||
shape = "ellipse"
|
||||
attrs = [
|
||||
"label=%s" % q(n["label"]),
|
||||
"color=%s" % q(pen),
|
||||
"fillcolor=%s" % q(fill),
|
||||
"style=%s" % q(style),
|
||||
"fontcolor=%s" % q("#222222"),
|
||||
"tooltip=%s" % q(tip),
|
||||
"shape=%s" % shape,
|
||||
]
|
||||
lines.append(" %s [%s];" % (n["id"], ", ".join(attrs)))
|
||||
for n in nodes:
|
||||
for d in n.get("depends", []):
|
||||
if d in by_id:
|
||||
|
||||
Reference in new issue
Block a user