interplane.Get Omega
Read in your language

spark-rsi-mv

Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger

Brought by drakestapleton

branch main Branches Tags History

spark-rsi-mv / tests / reuse-eval / turing-tps.om

479 lines · 7236 bytes Raw Blame History
1note units: sha256 stats turing
2note SPDX-License-Identifier: Apache-2.0
3note turing-tps: CODER_SPEC section 8 ub values; SHA-256 "abc"; then a tiny FINAL-shaped split (one
4note group, one session: BEGIN, QUERY r0 3, SET, QUERY r0 31, QUERY r0 16, so D = 3 15 0), a
5note profile file, two libraries (TRAIN: G 7, K 2, calibration named; TRAINP: G 3, K 1, none) and
6note base.om, run through turun2. Checked: n, every TPS1 header and record byte of B.tps (written
7note out by hand below from CODER_SPEC sections 2 and 3), the TSY1 bytes, both trailers against
8note an independent SHA-256 (Python hashlib, development only) of the same bytes, the P1 and P2
9note charges, and T_real NOT_RUN without a coder. With argv[2] = a turing-coder binary, the run
10note is repeated with the coder: every encode and verify must exit 0, H1 must pass, and B, M1, M2
11note must code to the same length (so T_real = T_ideal = -charge).
12note argv[1] = temporary directory (default /tmp/reuse-test-evalstats-tu-<pid>).
13note Exit 0 = pass; otherwise the failing check's code.
14
15text TTK "/tmp/reuse-test-evalstats-tu-\nsplit\nlib1\nlib2\nout\nprofile.toml\nbase.om\n-\nindex\nsessions\ng00.exp\nCURRENT\ngen-7.man\ngen-7.om\ngen-3.man\ngen-3.om\nB.tps\nD.tsy\nM1.tps\n"
16text TTPROF "profile_id = \"test\"\n"
17text TTABC "abc"
18
19global TTRB uchar 4096
20global TTRL ulong 1
21
22fn ttoff k ulong to ulong
23i = ulong 0
24c = ulong 0
25while lt c k bound 100000
26if eq get TTK i 10
27c = add c 1
28end
29i = add i 1
30end
31ret i
32end
33
34fn ttkp k ulong to void
35i = ttoff k
36while ne get TTK i 10 bound 4096
37stpc get TTK i
38i = add i 1
39end
40end
41
42fn ttroot to void
43put STPL 0 0
44for i ulong get TTRL 0
45stpc get TTRB i
46end
47end
48
49note root/k (k = 1..7), or root/k/f when f > 0
50fn ttpath k ulong f ulong to void
51ttroot
52stpc 47
53ttkp k
54if gt f 0
55stpc 47
56ttkp f
57end
58end
59
60fn ttinit to int
61put TTRL 0 0
62if ge argcnt 2
63n = argread 1 TTRB 0 4000
64if gt n 0
65put TTRL 0 ulong n
66end
67end
68if eq get TTRL 0 0
69put STPL 0 0
70ttkp 0
71stpu ulong getpid
72for i ulong get STPL 0
73put TTRB i get STPB i
74end
75put TTRL 0 get STPL 0
76end
77ttroot
78r = makedir STPB 0 get STPL 0 448
79if and ne r 0 ne r -17
80ret 1
81end
82for k ulong 4
83ttpath add k 1 0
84r = makedir STPB 0 get STPL 0 448
85if and ne r 0 ne r -17
86ret 2
87end
88end
89ret 0
90end
91
92fn ttub to int
93if ne tuub 1 16000000
94ret 3
95end
96if ne tuub 32768 1000000
97ret 4
98end
99if ne tuub 65536 0
100ret 5
101end
102if ne tuub 43481 591903
103ret 6
104end
105if ne tuub 46819 485194
106ret 7
107end
108if ne tuub 65521 330
109ret 8
110end
111for i ulong 3
112put STFB i get TTABC i
113end
114tusha 1000 1 0 3
115if ne get TUD 0 16919744041952114874
116ret 9
117end
118ret 0
119end
120
121note STOB of n zero-filled bytes after a header word list
122fn ttzero n ulong to void
123for i ulong n
124stoc 0
125end
126end
127
128note writes the split, the profile, the libraries and base.om
129fn ttfiles to int
130put STOP 0 0
131stow 3544386032354079058
132stow 1
133stow 4
134stow 1
135stow 1
136stow 5
137stow 3
138stow 72623859790382856
139stow 651345242494996240
140stow 1229782938247303441
141stow 1808220633999610642
142for k ulong 5
143stow 0
144end
145stow 5
146ttpath 1 8
147if ne stwfile 0
148ret 20
149end
150put STOP 0 0
151stow 0
152stow 0
153stow 1
154stow 2
155stow 2
156stow 0
157stow 64
158for k ulong 5
159stow 0
160end
161stow 5
162stow 3
163stow 0
164stow 0
165ttpath 1 9
166if ne stwfile 0
167ret 21
168end
169put STOP 0 0
170ttexp 1 0 0
171ttexp 2 3 1
172ttexp 3 0 0
173ttexp 2 31 0
174ttexp 2 16 0
175ttpath 1 10
176if ne stwfile 0
177ret 22
178end
179put STOP 0 0
180for i ulong len TTPROF
181stoc get TTPROF i
182end
183ttpath 5 0
184if ne stwfile 0
185ret 23
186end
187put STOP 0 0
188ttzero 4000
189ttpath 6 0
190if ne stwfile 0
191ret 24
192end
193r = ttlib 2 7 2 1 5000
194if ne r 0
195ret r
196end
197ret ttlib 3 3 1 0 4500
198end
199
200fn ttexp op ulong r0 ulong cold ulong to void
201stow 0
202if eq op 2
203stow 3
204else
205stow 0
206end
207stow r0
208stow 0
209stow op
210stow 0
211stow cold
212stow 0
213end
214
215note library directory k: gen-G.man (magic, K, calibration word 52), gen-G.om of ob bytes, CURRENT
216fn ttlib k ulong g ulong kt ulong cal ulong ob ulong to int
217put STOP 0 0
218stow 3544386019401740626
219stow 1
220stow g
221stow 0
222stow kt
223for i ulong 47
224stow 0
225end
226stow cal
227for i ulong 203
228stow 0
229end
230mf = ulong 12
231om = ulong 13
232if eq g 3
233mf = 14
234om = 15
235end
236ttpath k mf
237if ne stwfile 0
238ret 25
239end
240for i ulong 2048
241put STFB i get STOB i
242end
243tusha 1000 1 0 2048
244put STOP 0 0
245stow g
246for j ulong 4
247stow get TUD j
248end
249ttpath k 11
250if ne stwfile 0
251ret 26
252end
253put STOP 0 0
254ttzero ob
255ttpath k om
256if ne stwfile 0
257ret 27
258end
259ret 0
260end
261
262note slots: 0 split, 1 profile, 2 lib1, 3 lib2, 4 base.om, 5 coder, 6 out
263fn ttslots to void
264ttpath 1 0
265stbfromp 0
266ttpath 5 0
267stbfromp 1
268ttpath 2 0
269stbfromp 2
270ttpath 3 0
271stbfromp 3
272ttpath 6 0
273stbfromp 4
274ttpath 4 0
275stbfromp 6
276end
277
278note STFB byte i equals v
279fn ttbe i ulong v ulong to bool
280ret eq ulong get STFB i v
281end
282
283note little-endian value of nb bytes at i
284fn ttle i ulong nb ulong to ulong
285v = ulong 0
286for k ulong nb
287v = or v shl ulong get STFB add i k mul k 8
288end
289ret v
290end
291
292note record t at byte o: index, key, crumb, norm, q row for symbol s
293fn ttrec o ulong t ulong s ulong to bool
294if or ne ttle o 8 t ne ttle add o 8 8 0
295ret false
296end
297if or ne ttle add o 16 4 t ne ttle add o 20 4 65536
298ret false
299end
300for x ulong 16
301q = ttle add o add 24 mul x 2 2
302if eq x s
303if ne q 65521
304ret false
305end
306else
307if ne q 1
308ret false
309end
310end
311end
312ret true
313end
314
315fn tttps to int
316ttpath 4 16
317n = stload
318if ne n 328
319ret 40
320end
321if or or not ttbe 0 84 not ttbe 1 80 or not ttbe 2 83 not ttbe 3 49
322ret 41
323end
324if or or ne ttle 4 2 1 not ttbe 6 16 or not ttbe 7 16 ne ttle 8 4 0
325ret 42
326end
327if or or ne ttle 12 8 3 ne ttle 20 4 56 ne ttle 24 4 0
328ret 43
329end
330if or ne ttle 92 8 578437695752307201 ne ttle 124 4 0
331ret 44
332end
333if ne ttle 60 8 7868888298173157867
334ret 45
335end
336if ne ttle 28 8 9653805820826529274
337ret 46
338end
339if not ttrec 128 0 3
340ret 47
341end
342if not ttrec 184 1 15
343ret 48
344end
345if not ttrec 240 2 0
346ret 49
347end
348if ne ttle 296 8 654459385414177191
349ret 50
350end
351ret 0
352end
353
354fn tttsy to int
355ttpath 4 17
356n = stload
357if ne n 91
358ret 51
359end
360if or or not ttbe 0 84 not ttbe 1 83 or not ttbe 2 89 not ttbe 3 49
361ret 52
362end
363if or or ne ttle 4 2 1 not ttbe 6 16 or not ttbe 7 0 ne ttle 8 8 3
364ret 53
365end
366if or ne ttle 16 8 0 ne ttle 24 8 578437695752307201
367ret 54
368end
369if or or not ttbe 56 3 not ttbe 57 15 not ttbe 58 0
370ret 55
371end
372if ne ttle 59 8 7538279629438521139
373ret 56
374end
375ret 0
376end
377
378fn ttcharges to int
379if or ne tup1 3 1024 ne tup1 4 1024
380ret 60
381end
382if or ne tup1 7 13376 ne tup1 6 512
383ret 61
384end
385if or ne tup1 5 0 ne tup1 2 0
386ret 62
387end
388if or ne tup2 3 24384 ne tup2 6 20384
389ret 63
390end
391if ne tup2 5 0
392ret 64
393end
394ret 0
395end
396
397note coded sizes x and y differ
398fn ttcsne x ulong y ulong to bool
399ret ne get TUCS x get TUCS y
400end
401
402note the run with the coder from argv[2]
403fn ttcoder to int
404n = argread 2 STPB 0 4000
405put STPL 0 ulong n
406stbfromp 5
407r = turun2
408if ne r 0
409ret 70
410end
411for x ulong 6
412if ne get TUCX x 0
413ret 71
414end
415if ne tuh1 x 1
416ret 72
417end
418end
419if or ttcsne 0 2 ttcsne 0 4
420ret 73
421end
422if or ttcsne 1 3 ttcsne 1 5
423ret 74
424end
425if ne tureal 13376 1 0 -13376
426ret 75
427end
428if ne tureal 13376 1 1 -13376
429ret 76
430end
431ret 0
432end
433
434fn main to int
435r = ttinit
436if ne r 0
437ret r
438end
439r = ttub
440if ne r 0
441ret r
442end
443r = ttfiles
444if ne r 0
445ret r
446end
447ttslots
448put STPL 0 0
449ttkp 7
450stbfromp 5
451put STQT 0 1
452r = turun2
453if ne r 0
454ret 30
455end
456if ne get TUN 0 3
457ret 31
458end
459r = tttps
460if ne r 0
461ret r
462end
463r = tttsy
464if ne r 0
465ret r
466end
467r = ttcharges
468if ne r 0
469ret r
470end
471v = tureal 1024 1 0
472if ne get TURF 0 1
473ret 65
474end
475if lt argcnt 3
476ret 0
477end
478ret ttcoder
479end