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