Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/train/omega-llm/tools/combined/experiment/test_rewrites.py # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / train / omega-llm / tools / combined / experiment / test_rewrites.py` 31 lines ยท 1246 bytes Raw Blame History 1 """Exercise both emitted programs and reject a contradictory inactive tail.""" 2 from pathlib import Path 3 import sys 4 import tempfile 5 6 import fixture 7 from engines import Engines 8 9 10 def main(kit): 11 for family,mask in (("adjacent-add",1),("anchor-add",2)): 12 task=next(t for t in fixture.tasks("dev") if t["family"]==family and t["k"]==3) 13 inputs=[(n,*a) for n in (0,1,4,8) for a in 14 [(7,7,2,2,9,1,3,3),((1<<64)-1,1,0,2,1,7,5,8)]] 15 rows=[(x,fixture.ref(task,x)) for x in inputs] 16 with tempfile.TemporaryDirectory() as d: 17 eng=Engines(kit,d,task["prompt"]) 18 def generate(cases): 19 spec=eng.examples_spec(cases)+f"rewrites {mask}\n".encode() 20 return eng.symbolic("om_sketch",spec) 21 body=generate(rows) 22 assert body and eng.predict(body,inputs)==[y for _,y in rows] 23 invalid=rows.copy() 24 x,y=invalid[0] 25 invalid[0]=(x,(*y[:-1],y[-1]^1)) 26 assert generate(invalid) is None, "an empty active prefix cannot change the tail" 27 print("PASS both emitted rewrites on empty, partial, repeated, wrapping and full vectors; changed tail rejected") 28 29 30 if __name__=="__main__": 31 main(Path(sys.argv[1]))