LAMM / scripts /evaluate_demo.py
bastasie's picture
Rename evaluate_demo.py to scripts/evaluate_demo.py
e2d0625 verified
Raw History Blame Contribute Delete
781 Bytes
import json
from lamm.verify import ProofAuditor
from lamm.metrics import summarize
tests = [
("algebra_correct", ["STEP 1: 2*x + 3 = 7", "STEP 2: 2*x = 4", "STEP 3: x = 2"], "2"),
("algebra_wrong", ["STEP 1: 2*x + 3 = 7", "STEP 2: 2*x = 5", "STEP 3: x = 2.5"], "2"),
("derivative_correct", ["STEP 1: f(x)=x^2", "STEP 2: f'(x)=2*x"], "2*x"),
("derivative_wrong", ["STEP 1: f(x)=x^2", "STEP 2: f'(x)=x^3"], "2*x"),
("integral", ["STEP 1: integral x^2 dx = x^3/3 + C"], "x^3/3 + C"),
]
auditor = ProofAuditor()
rows=[]
for name, steps, target in tests:
a = auditor.audit(steps,target)
rows.append((name,a))
print(name, a.label, a.score, "ACS=",a.acs_consequence,"terminal=",a.terminal_ok)
print(json.dumps(summarize([a for _,a in rows]), indent=2))