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/evidence/SEED-0/ir-trap/wolfram.wl # 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 / evidence / SEED-0 / ir-trap / wolfram.wl` 33 lines ยท 2104 bytes Raw Blame History 1 (* L524 independent oracle. Run in WolframLanguageEvaluator; no filesystem access. *) 2 pack[s_] := FromDigits[Reverse[ToCharacterCode[StringTake[s, UpTo[8]], "ASCII"]], 256]; 3 samples = {0, 1, 10, 11, 255, `4294967295`}; 4 calc = <|"keywordPacking" -> AssociationMap[pack, {"fn", "trap", "break"}], 5 "trapFixture" -> Table[<|"input" -> v, "trap" -> If[v > 10, 3, 0], 6 "return" -> If[v > 10, Null, v]|>, {v, samples}], "u32max" -> 2^32 - 1, 7 "sourceLines" -> 4551, "functions" -> 185, "elfBytes" -> 116560, 8 "headerBytes" -> 176, "instructionWords" -> (116560-176)/4, 9 "fixtureRunCount" -> 17*6+1+2, "fixtureChecks" -> 1+17*3+2*2+11|>; 10 payloads = <| 11 "trap03" -> "T1NDMUlSAAEBAAFmAQQEAAQEAQQDAAAAAAAEAAAABAAAAAIAAAAGAAAAAQAAAAcAAAABAQAKAAAAAAAAAAEDAAAAAAAAAAAABQUCAAAAAQAOAgABAAIADAMPAwAPAAAAAAAA", 12 "void" -> "T1NDMUlSAAEBAAFmAAAAAAEAAAAAAAIAAAACAAAADAMP//8AAAAA"|>; 13 decode[s_String] := Module[{x=Normal[ByteArray[s]], le, pos=11, namelen, name, np, rt, nr, nb, tables, ni, ops={}, op, rec}, 14 le[o_, n_] := FromDigits[Reverse[x[[o+1;;o+n]]],256]; 15 namelen=le[10,1]; name=FromCharacterCode[x[[12;;11+namelen]]]; 16 pos=11+namelen; np=le[pos,1]; rt=le[pos+1,1]; nr=le[pos+2,2]; pos=pos+4+nr; 17 nb=le[pos,2]; pos=pos+2; 18 tables=Table[{le[pos+8*k,4],le[pos+8*k+4,4]},{k,0,nb-1}]; 19 pos=pos+8*nb; ni=le[pos,4]; pos=pos+4; 20 Do[op=le[pos,1]; pos++; 21 rec=Switch[op, 22 1, With[{r=le[pos,2],v=le[pos+2,8]},pos+=10;{"const",r,v}], 23 5, With[{c=le[pos,1],d=le[pos+1,2],a=le[pos+3,2],b=le[pos+5,2]},pos+=7;{"cmp",c,d,a,b}], 24 14, With[{c=le[pos,2],a=le[pos+2,2],b=le[pos+4,2]},pos+=6;{"cbr",c,a,b}], 25 12, With[{c=le[pos,1]},pos++;{"trap",c}], 26 15, With[{r=le[pos,2]},pos+=2;{"ret",r}], 27 _, {"unexpected",op}]; 28 AppendTo[ops,rec],{ni}]; 29 <|"length"->Length[x],"sha256"->Hash[ByteArray[x],"SHA256","HexString"], 30 "name"->name,"params"->np,"returnType"->rt,"registers"->nr, 31 "blocks"->tables,"instructions"->ops,"trailingBytes"->Length[x]-pos, 32 "zeroContractCounts" -> (Length[x]-pos==4 && le[pos,2]==0 && le[pos+2,2]==0)|>]; 33 <|"calculations"->calc,"independentDecode"->Map[decode,payloads]|> // InputForm