interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / evidence / COLLECTIVE-P0-ADMIT / oracle-query.wl

120 lines · 6200 bytes Raw Blame History
1(* DRA-15 / aien-train#26 P0 admission oracle (Spark hive card t_8cf72aaf).
2 Submitted to the hosted WolframLanguageEvaluator (agenttools.wolfram.com MCP).
3 It implements native/collective/fixtures/admission_v0.json from its text
4 (check order, codes, response formula, persistence rule), not from the .om:
5 it recomputes the three base identities (FNV-1a 64), every case's status,
6 response and counters, the rendered stdout of the observation build
7 (expected-a1.out) and of the one-case-per-process build (expected-cli.out),
8 their SHA-256, agreement with the fixture's expect_status, and the
9 overflow bound behind the value range check. *)
10m64 = 2^64;
11fnv[ints_List] := Module[{h = 14695981039346656037},
12 Do[h = Mod[BitXor[h, byte]*1099511628211, m64],
13 {byte, Flatten[Reverse[IntegerDigits[Mod[#, m64], 256, 8]] & /@ ints]}]; h];
14b0 = {2, -1, 3, 1, 0, -2};
15bAlt = ReplacePart[b0, 5 -> 1];
16bOvr = ReplacePart[b0, 1 -> 65537];
17u0 = Flatten[Table[{i - 3, i + 1}, {i, 0, 7}]];
18v0 = Flatten[Table[{1, 3 - i, -1}, {i, 0, 7}]];
19base = <|"B" -> b0, "U" -> u0, "V" -> v0, "X" -> {2, 3, 5},
20 "perm" -> ConstantArray[1, 8], "score" -> {4, 11, 7, 9, 8, 0, 3, 2},
21 "cgen" -> ConstantArray[7, 8], "drank" -> 1, "drows" -> 2, "dcols" -> 3,
22 "dbase" -> fnv[b0], "dgen" -> 7, "rrank" -> 1, "rrows" -> 2, "rcols" -> 3,
23 "rbase" -> fnv[b0], "rgen" -> 7, "k" -> 2, "mode" -> 0,
24 "idx" -> {1, 3, 0, 0}, "ph" -> {1, -1, 1, 1}|>;
25(* at[a, key, i, v]: element i (0-based) of list field key set to v *)
26at[a_, key_, i_, v_] := Append[a, key -> ReplacePart[a[key], i + 1 -> v]];
27st[a_, rules___] := Append[a, {rules}];
28cases = {
29 base,
30 st[base, "drank" -> 2, "rrank" -> 2],
31 st[base, "rrank" -> 2],
32 st[base, "drows" -> 3, "rrows" -> 3],
33 st[base, "dcols" -> 2, "rcols" -> 2],
34 st[base, "rrows" -> 1],
35 st[base, "rcols" -> 4],
36 st[base, "dbase" -> 0, "rbase" -> 0],
37 st[base, "rbase" -> 0],
38 st[base, "rbase" -> BitXor[fnv[b0], 1]],
39 st[base, "B" -> bAlt],
40 st[base, "B" -> bAlt, "dbase" -> fnv[bAlt], "rbase" -> fnv[bAlt]],
41 st[base, "rgen" -> 6],
42 at[base, "cgen", 3, 6],
43 at[base, "cgen", 1, 8],
44 at[base, "cgen", 5, 6],
45 st[base, "dgen" -> 9, "rgen" -> 9, "cgen" -> ConstantArray[9, 8]],
46 st[base, "k" -> 0],
47 st[base, "k" -> 4, "idx" -> {0, 2, 4, 6}, "ph" -> {1, 1, 1, 1}],
48 at[at[st[base, "k" -> 1], "idx", 0, 6], "ph", 0, -1],
49 st[base, "k" -> 3, "idx" -> {0, 4, 7, 0}, "ph" -> {1, -1, 1, 1}],
50 at[base, "idx", 1, 8],
51 at[base, "idx", 1, m64 - 1],
52 at[base, "idx", 0, 7],
53 at[base, "perm", 3, 0],
54 at[base, "perm", 2, 0],
55 at[base, "ph", 0, 0],
56 at[base, "ph", 1, 2],
57 at[base, "ph", 0, -1],
58 at[base, "idx", 0, 3],
59 st[base, "k" -> 3, "idx" -> {1, 3, 1, 0}, "ph" -> {1, 1, 1, 1}],
60 st[base, "perm" -> base["score"], "score" -> ConstantArray[1, 8]],
61 at[base, "perm", 5, 2],
62 st[base, "mode" -> 1, "ph" -> {1, 1, 1, 1}],
63 at[at[st[base, "mode" -> 1, "k" -> 1], "perm", 1, 0], "ph", 0, 1],
64 st[base, "mode" -> 1, "k" -> 3, "ph" -> {1, -1, 1, 1}],
65 st[base, "mode" -> 1, "k" -> 1, "perm" -> ConstantArray[0, 8]],
66 st[base, "mode" -> 1, "k" -> 3, "perm" -> {1, 0, 0, 0, 0, 1, 0, 0}],
67 st[base, "mode" -> 2],
68 st[base, "X" -> {65536, -65536, 65536}],
69 at[base, "X", 0, 65537],
70 at[base, "X", 2, 2^62],
71 at[base, "U", 6, -65537],
72 st[base, "B" -> bOvr, "dbase" -> fnv[bOvr], "rbase" -> fnv[bOvr]],
73 at[base, "U", 10, 70000],
74 at[st[base, "mode" -> 1], "cgen", 3, 6]};
75fixtureExpect = {0, -4, -4, -5, -5, -5, -5, -6, -6, -7, -7, 0, -8, -9, -9, 0, 0,
76 -10, -11, 0, 0, -1, -1, 0, -2, 0, -3, -3, 0, -12, -12, -13, -13, 0, 0, 0,
77 -14, -14, -16, 0, -15, -15, -15, -15, 0, -9};
78uOf[c_, i_] := c["U"][[2 i + 1 ;; 2 i + 2]];
79vOf[c_, i_] := c["V"][[3 i + 1 ;; 3 i + 3]];
80admit[c_] := Catch[Module[{k, plan = {}, free, id, ph},
81 If[c["drank"] != 1 || c["rrank"] != c["drank"], Throw[{-4, {}}]];
82 If[c["drows"] != 2 || c["dcols"] != 3 || c["rrows"] != c["drows"] || c["rcols"] != c["dcols"], Throw[{-5, {}}]];
83 If[c["dbase"] == 0 || c["rbase"] == 0, Throw[{-6, {}}]];
84 If[c["rbase"] != c["dbase"], Throw[{-7, {}}]];
85 If[fnv[c["B"]] != c["dbase"], Throw[{-7, {}}]];
86 If[c["rgen"] != c["dgen"], Throw[{-8, {}}]];
87 If[AnyTrue[c["perm"], ! MemberQ[{0, 1}, #] &], Throw[{-13, {}}]];
88 If[! MemberQ[{0, 1}, c["mode"]], Throw[{-16, {}}]];
89 k = c["k"];
90 If[k == 0, Throw[{-10, {}}]];
91 If[k > 3, Throw[{-11, {}}]];
92 If[c["mode"] == 0, plan = Take[c["idx"], k],
93 Do[free = Select[Range[0, 7], c["perm"][[# + 1]] == 1 && ! MemberQ[plan, #] &];
94 If[free === {}, Throw[{-14, {}}]];
95 AppendTo[plan, First[MaximalBy[free, c["score"][[# + 1]] &]]], {k}]];
96 Do[id = plan[[j]]; ph = c["ph"][[j]];
97 If[id >= 8, Throw[{-1, {}}]];
98 If[c["perm"][[id + 1]] != 1, Throw[{-2, {}}]];
99 If[c["cgen"][[id + 1]] != c["dgen"], Throw[{-9, {}}]];
100 If[! MemberQ[{1, -1}, ph], Throw[{-3, {}}]];
101 If[MemberQ[Take[plan, j - 1], id], Throw[{-12, {}}]], {j, k}];
102 If[AnyTrue[Join[c["X"], c["B"], Flatten[{uOf[c, #], vOf[c, #]} & /@ plan]], Abs[#] > 65536 &], Throw[{-15, {}}]];
103 {0, plan}]];
104resp[c_, plan_] := Partition[c["B"], 3] . c["X"] +
105 Total[Table[c["ph"][[j]] uOf[c, plan[[j]]] (vOf[c, plan[[j]]] . c["X"]), {j, Length[plan]}], 1];
106s2 = Function[l, StringRiffle[ToString /@ l, " "]];
107y = {0, 0}; cnt = {0, 0}; a1 = {}; cli = {}; statuses = {};
108Do[{sts, plan} = admit[cases[[n + 1]]]; AppendTo[statuses, sts];
109 If[sts == 0, y = resp[cases[[n + 1]], plan]; cnt = cnt + {1, Length[plan]}];
110 AppendTo[a1, "A1 " <> s2[Join[{n, sts}, y, cnt]]];
111 AppendTo[cli, s2[{n, -sts}] <> " " <> If[sts == 0, "Y " <> s2[y], "-"]], {n, 0, Length[cases] - 1}];
112a1s = StringJoin[# <> "\n" & /@ Append[a1, "END"]];
113clis = StringJoin[# <> "\n" & /@ cli];
114mM = 65536;
115<|"ids" -> {fnv[b0], fnv[bAlt], fnv[bOvr], BitXor[fnv[b0], 1]},
116 "ncase" -> Length[cases], "statuses_match_fixture" -> (statuses === fixtureExpect),
117 "a1" -> a1s, "a1_sha256" -> Hash[a1s, "SHA256", "HexString"],
118 "cli" -> clis, "cli_sha256" -> Hash[clis, "SHA256", "HexString"],
119 "bound" -> {3 mM^2 + 9 mM^3, 2^63 - 1, 3 mM^2 + 9 mM^3 < 2^63 - 1},
120 "huge_row0" -> 2*2 + (-1)*3 + 3*2^62 > 2^63 - 1|>