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 / mk / physics0-planner.mk

62 lines · 4714 bytes Raw Blame History
1# PD-0 experiment planner (Direction 5): contract tests, purity check, passive baseline
2# and the information-efficiency comparison (development evidence, not EXP-003).
3# Pure OM-2 (wave 36b): the planner, its contract tests, the test-only world bridge and both
4# efficiency comparisons are built from .om by the seed omc. The ASan/UBSan run of the C build is
5# gone. What OM-2 checks at run time instead (docs/one_layer/OMEGESE.md 9.3; exit 100 + trap): an
6# out-of-range array get or put traps 3; signed add, sub, mul, neg, div and shl outside the type
7# trap 1; div or rem by 0 traps 2; a shift amount outside 0..width-1 traps 7; an out-of-range
8# conversion traps 5. Unsigned arithmetic wraps by definition, as in C. Sanitizer checks with no
9# OM-2 run-time counterpart (alignment, use after free, leaks) are not replaced and not claimed.
10ifndef PHYSICS0_PLANNER_MK
11PHYSICS0_PLANNER_MK := 1
12.PHONY: test-physics0-planner p0p-purity physics0-planner-eff physics0-planner-eff2
13
14P0P_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo unknown)
15P0P_OMC ?= seed/out/omc
16P0P_DIR = $(OUT_DIR)/tests-physics0-planner
17# planner units: verifier formats only, no generator, no world. pd0_planner_types.om comes first
18# (an OM-2 struct is declared before the program's first fn).
19P0P_OM_LIB = src/physics0/planner/pd0_planner_types.om src/physics0/pd0_types.om src/physics0/pd0_rng.om src/physics0/pd0_wire.om \
20 src/physics0/ladder/pd0_codes.om src/physics0/ladder/pd0_fmt.om src/physics0/planner/pd0_planner.om
21# bridge side: substrate formats, links the generator on purpose (harness side, never a planner unit)
22P0P_OM_WORLD = src/physics0/pd0_chan.om src/physics0/pd0_relation.om src/physics0/pd0_world.om tests/physics0/planner/pd0p_bridge.om
23P0P_OM_TEST = $(P0P_OM_LIB) tests/physics0/planner/test_pd0_planner.om
24P0P_OM_EFF = $(P0P_OM_LIB) $(P0P_OM_WORLD) tests/physics0/planner/pd0p_eff_lib.om tests/physics0/planner/pd0_plan_eff.om
25P0P_OM_EFF2 = $(P0P_OM_LIB) $(P0P_OM_WORLD) tests/physics0/planner/pd0p_eff_lib.om tests/physics0/planner/pd0_plan_eff2.om
26P0P_FORBIDDEN = 'pd0_gen|pd0_world|oracle|truth_|forge_|argus_|mmap|fork|exec|socket'
27# OM host words a planner unit must not use (process, socket, map, device, file open/remove, environment)
28P0P_OM_HOST = 'fork|execprog|execpure|socknew|connect|bind|listen|accept|mapnew|mapbind|fopen|unlink|devctl|devcall|pipefds|killpid|envread|getenv'
29
30$(P0P_DIR)/test_pd0_planner: $(P0P_OM_TEST) $(P0P_OMC)
31 @mkdir -p $(P0P_DIR)
32 { echo "om2"; cat $(P0P_OM_TEST); } | $(P0P_OMC) > $@ && chmod +x $@
33$(P0P_DIR)/pd0_plan_eff: $(P0P_OM_EFF) $(P0P_OMC)
34 @mkdir -p $(P0P_DIR)
35 { echo "om2"; cat $(P0P_OM_EFF); } | $(P0P_OMC) > $@ && chmod +x $@
36$(P0P_DIR)/pd0_plan_eff2: $(P0P_OM_EFF2) $(P0P_OMC)
37 @mkdir -p $(P0P_DIR)
38 { echo "om2"; cat $(P0P_OM_EFF2); } | $(P0P_OMC) > $@ && chmod +x $@
39
40# purity: the planner units (code lines; notes excluded) carry no generator, world or authority name and
41# use no host process/socket/map/file word; both checks are shown to bite on the harness side
42p0p-purity:
43 @if grep -hv '^[[:space:]]*note' $(P0P_OM_LIB) | grep -E $(P0P_FORBIDDEN); then echo "planner OM sources reference generator, world or authority names"; exit 1; fi
44 @if grep -hv '^[[:space:]]*note' $(P0P_OM_LIB) | grep -wE $(P0P_OM_HOST); then echo "planner OM sources use a process, socket, map or file host word"; exit 1; fi
45 @grep -hv '^[[:space:]]*note' tests/physics0/planner/pd0p_bridge.om | grep -qE $(P0P_FORBIDDEN) || { echo "p0p-purity: the name check does not bite (the bridge carries no world name)"; exit 1; }
46 @grep -hv '^[[:space:]]*note' tests/physics0/planner/pd0p_eff_lib.om | grep -qwE $(P0P_OM_HOST) || { echo "p0p-purity: the host-word check does not bite"; exit 1; }
47 @echo "p0p-purity: planner OM units carry no generator, world, authority or host I/O name (both checks bite on the harness side)"
48
49physics0-planner-eff: $(P0P_DIR)/pd0_plan_eff
50 @rm -f $(P0P_DIR)/pd0-planner-eff.json
51 ./$(P0P_DIR)/pd0_plan_eff $(P0P_DIR)/pd0-planner-eff.json $(P0P_COMMIT) | tee $(P0P_DIR)/eff.out | tail -3
52 @grep -q '^PD0_PLANNER_EFF: PASS$$' $(P0P_DIR)/eff.out
53
54physics0-planner-eff2: $(P0P_DIR)/pd0_plan_eff2
55 @rm -f $(P0P_DIR)/pd0-planner-eff2.json
56 ./$(P0P_DIR)/pd0_plan_eff2 $(P0P_DIR)/pd0-planner-eff2.json $(P0P_COMMIT) | tee $(P0P_DIR)/eff2.out | tail -6
57 @grep -q '^PD0_PLANNER_EFF2: PASS' $(P0P_DIR)/eff2.out
58
59test-physics0-planner: p0p-purity $(P0P_DIR)/test_pd0_planner physics0-planner-eff physics0-planner-eff2
60 ./$(P0P_DIR)/test_pd0_planner
61 @echo "test-physics0-planner: PD-0 planner contract (behaviours 1-6), mutants, passive baseline and efficiency comparison pass (pure OM-2); receipt in $(P0P_DIR)/pd0-planner-eff.json"
62endif