interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / train / aien-train / tests / omegese45 / core / mutate.om

103 lines · 1749 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Native source fault injector for native/omegese45/core/model.om (aien-train #45).
3note Reads one ASCII mode byte then model.om; writes the mutant to stdout. Exactly one
4note match is required (rc 76 otherwise). Mode 0 flips the sign of the output gradient
5note (the gradient check must fail, rc 86); mode 1 makes the target the id one position
6note later (the mask/target oracle comparison must fail).
7global opmin uchar 65536
8global opmmd ulong 1
9text opm0n "put opgy v mul 2.0f32 d\n"
10text opm0r "put opgy v mul -2.0f32 d\n"
11text opm1n "ret ulong get opseq t\n"
12text opm1r "ret ulong get opseq add t 1\n"
13
14fn opmsize to ulong
15if eq get opmmd 0 0
16ret len opm0n
17end
18ret len opm1n
19end
20
21fn opmpat i ulong to uchar
22if eq get opmmd 0 0
23ret get opm0n i
24end
25ret get opm1n i
26end
27
28fn opmemit to void
29if eq get opmmd 0 0
30n = write 1 opm0r 0 len opm0r
31if ne n long len opm0r
32exit 74
33end
34ret
35end
36n = write 1 opm1r 0 len opm1r
37if ne n long len opm1r
38exit 74
39end
40end
41
42fn opmat pos ulong to bool
43for i ulong opmsize
44if ne get opmin add pos i opmpat i
45ret false
46end
47end
48ret true
49end
50
51fn main to int
52p = ulong 0
53rd = true
54while rd bound 65537
55if eq p 65536
56ret 75
57end
58n = read 0 opmin p sub 65536 p
59if eq n 0
60rd = false
61else
62if lt n 0
63ret 74
64end
65p = add p ulong n
66end
67end
68if lt p 2
69ret 75
70end
71m = get opmin 0
72if or lt m 48 gt m 49
73ret 75
74end
75put opmmd 0 ulong sub m 48
76ln = opmsize
77if le p ln
78ret 75
79end
80found = ulong 0
81where = ulong 0
82for s ulong sub p ln
83pos = add s 1
84if opmat pos
85found = add found 1
86where = pos
87end
88end
89if ne found 1
90ret 76
91end
92n = write 1 opmin 1 sub where 1
93if ne n long sub where 1
94ret 74
95end
96opmemit
97tl = add where ln
98n = write 1 opmin tl sub p tl
99if ne n long sub p tl
100ret 74
101end
102ret 0
103end