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
| 1 | # Belief / estimation layer, EST-0 and EST-1 (ARCH-0020). Standalone: new |
| 2 | # files only under src/estimation/ and tests/estimation/. Picked up by |
| 3 | # `-include mk/*.mk`; not part of `all` or `test`. Nothing in src/runtime/ |
| 4 | # includes or links it. |
| 5 | # |
| 6 | # test-est-types EST-0 contract: validation, digests, encoding, property tests |
| 7 | # test-est-kf EST-1 filter: analytic cases and invariants |
| 8 | # test-est-ref EST-1 independent reference (information form, written |
| 9 | # without reading est_kf.c) cross-checked against est_kf |
| 10 | # test-estimation all three, plain + ASan/UBSan, plus the purity check |
| 11 | ifndef ESTIMATION_MK |
| 12 | ESTIMATION_MK := 1 |
| 13 | .PHONY: test-est-types test-est-kf test-est-ref test-estimation est-purity |
| 14 | # -Wno-pedantic: the generated binding src/omega_om_units.c carries the runtime entry table as |
| 15 | # GNU range designators, which ISO C forbids (-Werror=pedantic), and every test binary here links |
| 16 | # that file. The generator fix is omega-bridge #17 (ABI-v2 line); until it lands this silences only |
| 17 | # that one diagnostic and keeps the strict flags for the handwritten sources in the same commands. |
| 18 | EST_CFLAGS = -std=c11 -Wall -Wextra -Werror -pedantic -O2 -D_POSIX_C_SOURCE=200809L -Isrc -Isrc/estimation -Itests/estimation -ffp-contract=off -fno-fast-math -Wno-pedantic |
| 19 | EST_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all |
| 20 | EST_TYPES_SRCS = src/estimation/est_types.c src/omega_om_units.c |
| 21 | EST_KF_SRCS = src/estimation/est_kf.c $(EST_TYPES_SRCS) |
| 22 | EST_HDRS = src/estimation/est_types.h src/estimation/est_kf.h src/estimation/est_mix.h |
| 23 | EST_DIR = $(OUT_DIR)/tests-estimation |
| 24 | # An estimator is a calculator: it must not reference authority, World, |
| 25 | # generation, capability, memory-mapping or process operations. |
| 26 | EST_FORBIDDEN = 'rx_|aienos_|argus_|forge_|aegis|mmap|mprotect|fork|exec|dlopen|system|socket|fopen|open$$' |
| 27 | |
| 28 | $(EST_DIR)/%.o: src/estimation/%.c $(EST_HDRS) |
| 29 | @mkdir -p $(EST_DIR) |
| 30 | $(CC) $(EST_CFLAGS) -c -o $@ $< |
| 31 | |
| 32 | est-purity: $(EST_DIR)/est_types.o $(EST_DIR)/est_kf.o $(EST_DIR)/est_mix.o |
| 33 | @if nm -u $^ | grep -E $(EST_FORBIDDEN) ; then \ |
| 34 | echo "estimation object references an operation an estimator must not have"; exit 1; fi |
| 35 | @echo "est-purity: est_types.o, est_kf.o and est_mix.o reference no forbidden symbol" |
| 36 | |
| 37 | EST_OMC ?= seed/out/omc |
| 38 | EST_OM_TYPES = src/estimation/est_defs.om src/estimation/est_math.om src/estimation/est_types.om |
| 39 | EST_OM_KF = $(EST_OM_TYPES) src/estimation/est_kf.om |
| 40 | |
| 41 | $(EST_DIR)/test_est_types: $(EST_OM_TYPES) tests/estimation/test_est_types.om |
| 42 | @mkdir -p $(EST_DIR) |
| 43 | cat $^ | $(EST_OMC) > $@ && chmod +x $@ |
| 44 | |
| 45 | $(EST_DIR)/test_est_kf: $(EST_OM_KF) tests/estimation/test_est_kf.om |
| 46 | @mkdir -p $(EST_DIR) |
| 47 | cat $^ | $(EST_OMC) > $@ && chmod +x $@ |
| 48 | |
| 49 | $(EST_DIR)/test_est_ref: $(EST_OM_KF) tests/estimation/est_ref_info.om tests/estimation/test_est_ref.om |
| 50 | @mkdir -p $(EST_DIR) |
| 51 | cat $^ | $(EST_OMC) > $@ && chmod +x $@ |
| 52 | |
| 53 | test-est-types: $(EST_DIR)/test_est_types |
| 54 | ./$(EST_DIR)/test_est_types |
| 55 | @echo "test-est-types: EST-0 contract checks pass (pure OM-2)" |
| 56 | |
| 57 | test-est-kf: $(EST_DIR)/test_est_kf |
| 58 | ./$(EST_DIR)/test_est_kf |
| 59 | @echo "test-est-kf: EST-1 filter checks pass (pure OM-2)" |
| 60 | |
| 61 | test-est-ref: $(EST_DIR)/test_est_ref |
| 62 | ./$(EST_DIR)/test_est_ref |
| 63 | @echo "test-est-ref: est_kf agrees with the independent information-form reference (pure OM-2)" |
| 64 | |
| 65 | test-estimation: est-purity test-est-types test-est-kf test-est-ref |
| 66 | @echo "test-estimation: EST-0 and EST-1 pass" |
| 67 | endif |