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/neuralese/decode.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 / neuralese / decode.om` 134 lines ยท 2442 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note Concatenate before om/tls/sha2.om. No learned producer is implemented. 3 note NLE1: ten metadata bytes, four payload bytes, lowercase hex SHA-256 of those bytes. 4 note Unknown identities and representations have no executable interpretation. 5 om2 debug 6 text magic "NLE1" 7 text hexdigs "`0123456789abcdef`" 8 text prefix "om2 debug\nfn apply x uint to uint\nrequires le x 16\nensures le result 32\n" 9 text incop "ret add x 1\n" 10 text dblop "ret mul x 2\n" 11 text idop "ret x\n" 12 text suffix "end\nfn main to int\nret int apply uint " 13 text tail "\nend\n" 14 fn hashok a view uchar 79 to bool 15 msgbuf = new uchar 14 0 16 digest = new uchar 32 0 17 ctx = new ulong 40 0 18 for i ulong 14 19 put msgbuf i get a i 20 end 21 sha256_init ctx 22 sha256_update ctx msgbuf 23 sha256_final ctx digest 24 for i ulong 32 25 offset = add mul i 2 14 26 value = get digest i 27 if ne get a offset get hexdigs shr value 4 28 ret false 29 end 30 offset = add offset 1 31 if ne get a offset get hexdigs and value 15 32 ret false 33 end 34 end 35 ret true 36 end 37 fn validate a view uchar 79 n ulong to int 38 if gt n 78 39 ret 10 40 end 41 if lt n 78 42 ret 16 43 end 44 for i ulong 4 45 if ne get a i get magic i 46 ret 11 47 end 48 end 49 note This registry pair denotes a hand-authored fixture, not a trained model. 50 if or ne get a 4 1 ne get a 5 1 51 ret 12 52 end 53 if ne get a 6 4 54 ret 13 55 end 56 if ne get a 7 1 57 ret 14 58 end 59 if ne get a 8 1 60 ret 15 61 end 62 if ne get a 9 4 63 ret 20 64 end 65 if not hashok a 66 ret 17 67 end 68 if or ne get a 12 0 ne get a 13 0 69 ret 18 70 end 71 if or lt get a 10 1 gt get a 10 3 72 ret 19 73 end 74 ret 0 75 end 76 fn output b view uchar * to void 77 p = ulong 0 78 while lt p len b bound 256 79 r = write 1 b p sub len b p 80 if le r 0 81 exit 81 82 end 83 p = add p ulong r 84 end 85 end 86 fn number v uchar to void 87 b = new uchar 3 0 88 n = ulong 0 89 if ge v 100 90 put b n add uchar 48 div v 100 91 n = add n 1 92 end 93 if ge v 10 94 put b n add uchar 48 rem div v 10 10 95 n = add n 1 96 end 97 put b n add uchar 48 rem v 10 98 n = add n 1 99 output part b 0 n 100 end 101 fn main to int 102 a = new uchar 79 0 103 n = ulong 0 104 note Every successful read increases n, so at most seventy-nine iterations occur. 105 while lt n 79 bound 79 106 r = read 0 a n sub 79 n 107 if lt r 0 108 ret 80 109 end 110 if eq r 0 111 break 112 end 113 n = add n ulong r 114 end 115 status = validate a n 116 if ne status 0 117 ret status 118 end 119 note Emission happens only after complete validation. No payload is ever execprog input. 120 output prefix 121 if eq get a 10 1 122 output incop 123 end 124 if eq get a 10 2 125 output dblop 126 end 127 if eq get a 10 3 128 output idop 129 end 130 output suffix 131 number get a 11 132 output tail 133 ret 0 134 end