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
omega-mv / src / physics0 / controls / pd0_controls.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* PD-0 negative-control toolkit (spec 9.1). Test infrastructure; never linked into a learner. */ |
| 18 | #ifndef PD0_CONTROLS_H |
| 19 | #define PD0_CONTROLS_H |
| 20 | #include "pd0_fmt.h" |
| 21 | #include "pd0_score.h" |
| 22 | /* NC-1: null-world records: every post-step observation is a fresh Irwin-Hall draw, sd 0.5, "null" stream */ |
| 23 | uint32_t pd0_null_world(uint64_t seed, uint8_t n_obs, uint32_t n_episodes, uint32_t steps, int64_t reset_min, int64_t reset_max, int64_t chan_min, int64_t chan_max, pd0_rec *out, uint32_t cap); |
| 24 | /* NC-2: permute vars_after across OK step records (recorded seed), then rebuild the chain */ |
| 25 | void pd0_shuffle_outcomes(pd0_rec *recs, uint32_t n, uint64_t seed); |
| 26 | void pd0_rechain(pd0_rec *recs, uint32_t n); |
| 27 | /* NC-3 mutants */ |
| 28 | void pd0_mut_scale_coef(pd0_rel *r, uint8_t target, const uint8_t *expo, int64_t num, int64_t den); /* M1 */ |
| 29 | void pd0_mut_pad(pd0_rel *r, uint32_t n_extra, int64_t tiny_coef); /* M2 */ |
| 30 | /* M3: nearest-neighbour memoriser over stored transitions */ |
| 31 | typedef struct { const pd0_transition *t; uint32_t n; uint8_t n_obs; } pd0_memoriser; |
| 32 | int pd0_memoriser_rollout(void *ctx, const int64_t *init, const pd0_step *steps, uint32_t n, int64_t *out); |
| 33 | int pd0_memoriser_predict(void *ctx, const int64_t *state, uint8_t chan, int64_t value, int64_t *next); |
| 34 | uint32_t pd0_memoriser_stored_numbers(const pd0_memoriser *m); |
| 35 | #endif |