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 / turing_exp001_b.mk

67 lines · 4094 bytes Raw Blame History
1# Turing calibration EXP-001, lane B: probability stream (TPS1/TSY1) + two
2# reference coders (range, rANS) in pure seeded OM-2. Spec: calibration/docs/CODER_SPEC.md.
3# Picked up by `-include mk/*.mk`. All variables are TC_-prefixed.
4#
5# test-turing-exp001-coders: coder suite (built WITHOUT tc_produce.om, so the
6# coders cannot reach the model), producer suite on the committed fixtures, CLI
7# accept/refuse checks.
8# turing-exp001-envelope TC_DATA=<dir with seed-N/control/trace.ctr>: overhead
9# measurement on dev seeds 1-7 (not part of the test target).
10.PHONY: test-turing-exp001-coders turing-exp001-envelope turing-coder
11TC_OM_SHA = seed/ng/sha256.om
12TC_CODER_OM = $(TC_OM_SHA) src/turing/tc_pstream.om src/turing/tc_range_lib.om src/turing/tc_rans.om
13TC_PROD_OM = $(TC_CODER_OM) src/turing/tc_produce.om
14TC_DIR = $(OUT_DIR)/tests-turing-exp001-b
15TC_TOOL = $(TC_DIR)/turing-coder
16TC_FIX = tests/turing/fixtures/ctr1_seed1_crumbs05-07.ctr
17TC_CAND = evidence/TURING_YIELD/ty2_candidate.tym
18TC_ZERO = 0000000000000000000000000000000000000000000000000000000000000000
19TC_DATA ?= $(HOME)/aien-data/crumbline/exp-20260927-rep10
20
21$(TC_DIR)/test_tc: tests/turing/test_tc.om $(TC_CODER_OM) seed/out/omc
22 @mkdir -p $(TC_DIR)
23 (printf 'om2\n'; cat $(TC_CODER_OM) tests/turing/test_tc.om) | seed/out/omc > $@ && chmod +x $@
24
25$(TC_DIR)/test_tc_produce: tests/turing/test_tc_produce.om $(TC_PROD_OM) seed/out/omc
26 @mkdir -p $(TC_DIR)
27 (printf 'om2\n'; cat $(TC_PROD_OM) tests/turing/test_tc_produce.om) | seed/out/omc > $@ && chmod +x $@
28
29$(TC_TOOL): src/turing/tc_tool.om $(TC_PROD_OM) seed/out/omc
30 @mkdir -p $(TC_DIR)
31 (printf 'om2\n'; cat $(TC_PROD_OM) src/turing/tc_tool.om) | seed/out/omc > $@ && chmod +x $@
32
33turing-coder: $(TC_TOOL)
34
35test-turing-exp001-coders: $(TC_DIR)/test_tc $(TC_DIR)/test_tc_produce $(TC_TOOL)
36 @if grep -n 'ty_model\|tc_produce\|tp_model' src/turing/tc_pstream.om src/turing/tc_range_lib.om src/turing/tc_rans.om; then \
37 echo "coder sources reference the model"; exit 1; fi
38 ./$(TC_DIR)/test_tc $(TC_DIR)/coders
39 ./$(TC_DIR)/test_tc_produce $(TC_DIR)/produce
40 @set -e; D=$(TC_DIR)/cli_turing-coder; mkdir -p $$D; \
41 ./$(TC_TOOL) pstream $(TC_CAND) $(TC_ZERO) $(TC_FIX) $$D/f.tps $$D/f.tsy > $$D/pstream.txt; \
42 M=$$(sed -n 's/^model_digest=//p' $$D/pstream.txt); \
43 for C in range rans; do \
44 ./$(TC_TOOL) encode $$C $$D/f.tps $$D/f.tsy $$D/f.$$C > /dev/null; \
45 ./$(TC_TOOL) verify $$C $$D/f.tps $$D/f.tsy $$D/f.$$C --profile $(TC_ZERO) --model $$M > $$D/verify_$$C.txt; \
46 ./$(TC_TOOL) decode $$C $$D/f.tps $$D/f.$$C $$D/dec_$$C.tsy; cmp $$D/f.tsy $$D/dec_$$C.tsy; \
47 if ./$(TC_TOOL) verify $$C $$D/f.tps $$D/f.tsy $$D/f.$$C --model $(TC_ZERO) 2>/dev/null; then \
48 echo "CLI accepted a wrong model digest"; exit 1; fi; \
49 head -c -1 $$D/f.$$C > $$D/trunc.$$C; \
50 if ./$(TC_TOOL) decode $$C $$D/f.tps $$D/trunc.$$C $$D/x.tsy 2>/dev/null; then \
51 echo "CLI accepted a truncated bitstream"; exit 1; fi; \
52 done
53 @echo "test-turing-exp001-coders: pure OM-2 TPS1/TSY1, range + rANS round trips and refusals pass"
54
55# All seven EXP-001 candidates (profile section "envelope"), per file and per crumb, both coders.
56TC_ENV_CANDS = B0_uniform B1_order0 B2_order1 B3_heuristic M_candidate M_mem M_mem_seed1
57TC_ENV_CDIRS ?= calibration/experiments/EXP-001/candidates $(HOME)/aien-data/turing-cal/candidates
58turing-exp001-envelope: $(TC_TOOL)
59 @mkdir -p $(TC_DIR)/envelope
60 @for S in 1 2 3 4 5 6 7; do for C in $(TC_ENV_CANDS); do \
61 F=""; for D in $(TC_ENV_CDIRS); do [ -f "$$D/$$C.tym" ] && { F="$$D/$$C.tym"; break; }; done; \
62 [ -n "$$F" ] || { echo "envelope: $$C.tym not found"; exit 1; }; \
63 ./$(TC_TOOL) envelope $(TC_ZERO) $(TC_DIR)/envelope/seed-$$S.$$C.csv $(TC_DATA)/seed-$$S/control/trace.ctr \
64 "$$F" > $(TC_DIR)/envelope/seed-$$S.$$C.txt || { echo "envelope: seed $$S $$C refused"; exit 1; }; \
65 test $$(grep -c "^file " $(TC_DIR)/envelope/seed-$$S.$$C.txt) -eq 1 || { echo "envelope: seed $$S $$C incomplete"; exit 1; }; \
66 done; done
67 sh calibration/scripts/envelope_summary.sh $(TC_DIR)/envelope | tee $(TC_DIR)/envelope/summary.txt