From 60683f1dabdb52b0aaf775ab65b0f76b7638fc89 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 27 Sep 2026 12:05:15 -0500 Subject: [PATCH] feat(crumbline): Omega learner adapter for Crumb v1 Adds build/crumbline-learner, a separate executable that speaks the crumbs learner protocol v1 and links only learner-side code (no physics, gates or sealed code). It decodes Crumb v1 visible bytes, runs level-by-level Omega composition search with equivalence pruning, verifies visible fits through omega_program_verify plus a native-vs-reference differential check, submits CPG1 candidates to the sealed verifier, keeps searching after held-out rejections, and stores admitted operations in the OmegaLibrary with a scope. omega_synthesize is unchanged; the base vocabulary is shared through omega_synth_base_prim_defs(). Verification: - make test-crumbline: 127/127 (122 conformance vectors, 4 malformed, symbol check) - M4 12/12, M5 9/9, M6..M15 10/10 each, unchanged after the refactor - crumbs gates --learner build/crumbline-learner: 9/9 PASS Co-Authored-By: Claude Opus 5.5 --- Makefile | 28 +- spec/crumbline.md | 49 ++++ src/crumbline/cl_common.c | 135 ++++++++++ src/crumbline/cl_common.h | 81 ++++++ src/crumbline/cl_crumb.c | 87 +++++++ src/crumbline/cl_crumb.h | 50 ++++ src/crumbline/cl_program.c | 268 +++++++++++++++++++ src/crumbline/cl_program.h | 118 +++++++++ src/crumbline/cl_search.c | 377 +++++++++++++++++++++++++++ src/crumbline/cl_search.h | 100 +++++++ src/omega_synthesis.c | 47 ++-- src/omega_synthesis.h | 11 + tests/crumbline/run_conformance.sh | 51 ++++ tests/crumbline/vectors/expected.txt | 122 +++++++++ tests/crumbline/vectors/v001.crb | Bin 0 -> 124 bytes tests/crumbline/vectors/v002.crb | Bin 0 -> 140 bytes tests/crumbline/vectors/v003.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v004.crb | Bin 0 -> 116 bytes tests/crumbline/vectors/v005.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v006.crb | Bin 0 -> 148 bytes tests/crumbline/vectors/v007.crb | Bin 0 -> 110 bytes tests/crumbline/vectors/v008.crb | Bin 0 -> 141 bytes tests/crumbline/vectors/v009.crb | Bin 0 -> 159 bytes tests/crumbline/vectors/v010.crb | Bin 0 -> 124 bytes tests/crumbline/vectors/v011.crb | Bin 0 -> 157 bytes tests/crumbline/vectors/v012.crb | Bin 0 -> 159 bytes tests/crumbline/vectors/v013.crb | Bin 0 -> 171 bytes tests/crumbline/vectors/v014.crb | Bin 0 -> 176 bytes tests/crumbline/vectors/v015.crb | Bin 0 -> 177 bytes tests/crumbline/vectors/v016.crb | Bin 0 -> 176 bytes tests/crumbline/vectors/v017.crb | Bin 0 -> 150 bytes tests/crumbline/vectors/v018.crb | Bin 0 -> 176 bytes tests/crumbline/vectors/v019.crb | Bin 0 -> 155 bytes tests/crumbline/vectors/v020.crb | Bin 0 -> 127 bytes tests/crumbline/vectors/v021.crb | Bin 0 -> 142 bytes tests/crumbline/vectors/v022.crb | Bin 0 -> 119 bytes tests/crumbline/vectors/v023.crb | Bin 0 -> 128 bytes tests/crumbline/vectors/v024.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v025.crb | Bin 0 -> 124 bytes tests/crumbline/vectors/v026.crb | Bin 0 -> 125 bytes tests/crumbline/vectors/v027.crb | Bin 0 -> 140 bytes tests/crumbline/vectors/v028.crb | Bin 0 -> 185 bytes tests/crumbline/vectors/v029.crb | Bin 0 -> 220 bytes tests/crumbline/vectors/v030.crb | Bin 0 -> 241 bytes tests/crumbline/vectors/v031.crb | Bin 0 -> 188 bytes tests/crumbline/vectors/v032.crb | Bin 0 -> 178 bytes tests/crumbline/vectors/v033.crb | Bin 0 -> 216 bytes tests/crumbline/vectors/v034.crb | Bin 0 -> 159 bytes tests/crumbline/vectors/v035.crb | Bin 0 -> 153 bytes tests/crumbline/vectors/v036.crb | Bin 0 -> 153 bytes tests/crumbline/vectors/v037.crb | Bin 0 -> 152 bytes tests/crumbline/vectors/v038.crb | Bin 0 -> 117 bytes tests/crumbline/vectors/v039.crb | Bin 0 -> 104 bytes tests/crumbline/vectors/v040.crb | Bin 0 -> 116 bytes tests/crumbline/vectors/v041.crb | Bin 0 -> 119 bytes tests/crumbline/vectors/v042.crb | Bin 0 -> 182 bytes tests/crumbline/vectors/v043.crb | Bin 0 -> 251 bytes tests/crumbline/vectors/v044.crb | Bin 0 -> 144 bytes tests/crumbline/vectors/v045.crb | Bin 0 -> 185 bytes tests/crumbline/vectors/v046.crb | Bin 0 -> 123 bytes tests/crumbline/vectors/v047.crb | Bin 0 -> 144 bytes tests/crumbline/vectors/v048.crb | Bin 0 -> 146 bytes tests/crumbline/vectors/v049.crb | Bin 0 -> 117 bytes tests/crumbline/vectors/v050.crb | Bin 0 -> 118 bytes tests/crumbline/vectors/v051.crb | Bin 0 -> 119 bytes tests/crumbline/vectors/v052.crb | Bin 0 -> 122 bytes tests/crumbline/vectors/v053.crb | Bin 0 -> 124 bytes tests/crumbline/vectors/v054.crb | Bin 0 -> 130 bytes tests/crumbline/vectors/v055.crb | Bin 0 -> 102 bytes tests/crumbline/vectors/v056.crb | Bin 0 -> 112 bytes tests/crumbline/vectors/v057.crb | Bin 0 -> 91 bytes tests/crumbline/vectors/v058.crb | Bin 0 -> 103 bytes tests/crumbline/vectors/v059.crb | Bin 0 -> 121 bytes tests/crumbline/vectors/v060.crb | Bin 0 -> 141 bytes tests/crumbline/vectors/v061.crb | Bin 0 -> 127 bytes tests/crumbline/vectors/v062.crb | Bin 0 -> 152 bytes tests/crumbline/vectors/v063.crb | Bin 0 -> 120 bytes tests/crumbline/vectors/v064.crb | Bin 0 -> 129 bytes tests/crumbline/vectors/v065.crb | Bin 0 -> 122 bytes tests/crumbline/vectors/v066.crb | Bin 0 -> 114 bytes tests/crumbline/vectors/v067.crb | Bin 0 -> 118 bytes tests/crumbline/vectors/v068.crb | Bin 0 -> 121 bytes tests/crumbline/vectors/v069.crb | Bin 0 -> 128 bytes tests/crumbline/vectors/v070.crb | Bin 0 -> 198 bytes tests/crumbline/vectors/v071.crb | Bin 0 -> 190 bytes tests/crumbline/vectors/v072.crb | Bin 0 -> 96 bytes tests/crumbline/vectors/v073.crb | Bin 0 -> 100 bytes tests/crumbline/vectors/v074.crb | Bin 0 -> 204 bytes tests/crumbline/vectors/v075.crb | Bin 0 -> 195 bytes tests/crumbline/vectors/v076.crb | Bin 0 -> 40 bytes tests/crumbline/vectors/v077.crb | Bin 0 -> 51 bytes tests/crumbline/vectors/v078.crb | Bin 0 -> 157 bytes tests/crumbline/vectors/v079.crb | Bin 0 -> 129 bytes tests/crumbline/vectors/v080.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v081.crb | Bin 0 -> 147 bytes tests/crumbline/vectors/v082.crb | Bin 0 -> 129 bytes tests/crumbline/vectors/v083.crb | Bin 0 -> 127 bytes tests/crumbline/vectors/v084.crb | Bin 0 -> 146 bytes tests/crumbline/vectors/v085.crb | Bin 0 -> 138 bytes tests/crumbline/vectors/v086.crb | Bin 0 -> 122 bytes tests/crumbline/vectors/v087.crb | Bin 0 -> 123 bytes tests/crumbline/vectors/v088.crb | Bin 0 -> 143 bytes tests/crumbline/vectors/v089.crb | Bin 0 -> 141 bytes tests/crumbline/vectors/v090.crb | Bin 0 -> 143 bytes tests/crumbline/vectors/v091.crb | Bin 0 -> 131 bytes tests/crumbline/vectors/v092.crb | Bin 0 -> 148 bytes tests/crumbline/vectors/v093.crb | Bin 0 -> 144 bytes tests/crumbline/vectors/v094.crb | Bin 0 -> 126 bytes tests/crumbline/vectors/v095.crb | Bin 0 -> 123 bytes tests/crumbline/vectors/v096.crb | Bin 0 -> 134 bytes tests/crumbline/vectors/v097.crb | Bin 0 -> 117 bytes tests/crumbline/vectors/v098.crb | Bin 0 -> 119 bytes tests/crumbline/vectors/v099.crb | Bin 0 -> 117 bytes tests/crumbline/vectors/v100.crb | Bin 0 -> 146 bytes tests/crumbline/vectors/v101.crb | Bin 0 -> 139 bytes tests/crumbline/vectors/v102.crb | Bin 0 -> 137 bytes tests/crumbline/vectors/v103.crb | Bin 0 -> 151 bytes tests/crumbline/vectors/v104.crb | Bin 0 -> 144 bytes tests/crumbline/vectors/v105.crb | Bin 0 -> 126 bytes tests/crumbline/vectors/v106.crb | Bin 0 -> 143 bytes tests/crumbline/vectors/v107.crb | Bin 0 -> 128 bytes tests/crumbline/vectors/v108.crb | Bin 0 -> 120 bytes tests/crumbline/vectors/v109.crb | Bin 0 -> 121 bytes tests/crumbline/vectors/v110.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v111.crb | Bin 0 -> 128 bytes tests/crumbline/vectors/v112.crb | Bin 0 -> 150 bytes tests/crumbline/vectors/v113.crb | Bin 0 -> 131 bytes tests/crumbline/vectors/v114.crb | Bin 0 -> 146 bytes tests/crumbline/vectors/v115.crb | Bin 0 -> 152 bytes tests/crumbline/vectors/v116.crb | Bin 0 -> 132 bytes tests/crumbline/vectors/v117.crb | Bin 0 -> 115 bytes tests/crumbline/vectors/v118.crb | Bin 0 -> 141 bytes tests/crumbline/vectors/v119.crb | Bin 0 -> 138 bytes tests/crumbline/vectors/v120.crb | Bin 0 -> 119 bytes tests/crumbline/vectors/v121.crb | Bin 0 -> 117 bytes tests/crumbline/vectors/v122.crb | Bin 0 -> 129 bytes tools/crumbline_learner.c | 294 +++++++++++++++++++++ 137 files changed, 1795 insertions(+), 23 deletions(-) create mode 100644 spec/crumbline.md create mode 100644 src/crumbline/cl_common.c create mode 100644 src/crumbline/cl_common.h create mode 100644 src/crumbline/cl_crumb.c create mode 100644 src/crumbline/cl_crumb.h create mode 100644 src/crumbline/cl_program.c create mode 100644 src/crumbline/cl_program.h create mode 100644 src/crumbline/cl_search.c create mode 100644 src/crumbline/cl_search.h create mode 100755 tests/crumbline/run_conformance.sh create mode 100644 tests/crumbline/vectors/expected.txt create mode 100644 tests/crumbline/vectors/v001.crb create mode 100644 tests/crumbline/vectors/v002.crb create mode 100644 tests/crumbline/vectors/v003.crb create mode 100644 tests/crumbline/vectors/v004.crb create mode 100644 tests/crumbline/vectors/v005.crb create mode 100644 tests/crumbline/vectors/v006.crb create mode 100644 tests/crumbline/vectors/v007.crb create mode 100644 tests/crumbline/vectors/v008.crb create mode 100644 tests/crumbline/vectors/v009.crb create mode 100644 tests/crumbline/vectors/v010.crb create mode 100644 tests/crumbline/vectors/v011.crb create mode 100644 tests/crumbline/vectors/v012.crb create mode 100644 tests/crumbline/vectors/v013.crb create mode 100644 tests/crumbline/vectors/v014.crb create mode 100644 tests/crumbline/vectors/v015.crb create mode 100644 tests/crumbline/vectors/v016.crb create mode 100644 tests/crumbline/vectors/v017.crb create mode 100644 tests/crumbline/vectors/v018.crb create mode 100644 tests/crumbline/vectors/v019.crb create mode 100644 tests/crumbline/vectors/v020.crb create mode 100644 tests/crumbline/vectors/v021.crb create mode 100644 tests/crumbline/vectors/v022.crb create mode 100644 tests/crumbline/vectors/v023.crb create mode 100644 tests/crumbline/vectors/v024.crb create mode 100644 tests/crumbline/vectors/v025.crb create mode 100644 tests/crumbline/vectors/v026.crb create mode 100644 tests/crumbline/vectors/v027.crb create mode 100644 tests/crumbline/vectors/v028.crb create mode 100644 tests/crumbline/vectors/v029.crb create mode 100644 tests/crumbline/vectors/v030.crb create mode 100644 tests/crumbline/vectors/v031.crb create mode 100644 tests/crumbline/vectors/v032.crb create mode 100644 tests/crumbline/vectors/v033.crb create mode 100644 tests/crumbline/vectors/v034.crb create mode 100644 tests/crumbline/vectors/v035.crb create mode 100644 tests/crumbline/vectors/v036.crb create mode 100644 tests/crumbline/vectors/v037.crb create mode 100644 tests/crumbline/vectors/v038.crb create mode 100644 tests/crumbline/vectors/v039.crb create mode 100644 tests/crumbline/vectors/v040.crb create mode 100644 tests/crumbline/vectors/v041.crb create mode 100644 tests/crumbline/vectors/v042.crb create mode 100644 tests/crumbline/vectors/v043.crb create mode 100644 tests/crumbline/vectors/v044.crb create mode 100644 tests/crumbline/vectors/v045.crb create mode 100644 tests/crumbline/vectors/v046.crb create mode 100644 tests/crumbline/vectors/v047.crb create mode 100644 tests/crumbline/vectors/v048.crb create mode 100644 tests/crumbline/vectors/v049.crb create mode 100644 tests/crumbline/vectors/v050.crb create mode 100644 tests/crumbline/vectors/v051.crb create mode 100644 tests/crumbline/vectors/v052.crb create mode 100644 tests/crumbline/vectors/v053.crb create mode 100644 tests/crumbline/vectors/v054.crb create mode 100644 tests/crumbline/vectors/v055.crb create mode 100644 tests/crumbline/vectors/v056.crb create mode 100644 tests/crumbline/vectors/v057.crb create mode 100644 tests/crumbline/vectors/v058.crb create mode 100644 tests/crumbline/vectors/v059.crb create mode 100644 tests/crumbline/vectors/v060.crb create mode 100644 tests/crumbline/vectors/v061.crb create mode 100644 tests/crumbline/vectors/v062.crb create mode 100644 tests/crumbline/vectors/v063.crb create mode 100644 tests/crumbline/vectors/v064.crb create mode 100644 tests/crumbline/vectors/v065.crb create mode 100644 tests/crumbline/vectors/v066.crb create mode 100644 tests/crumbline/vectors/v067.crb create mode 100644 tests/crumbline/vectors/v068.crb create mode 100644 tests/crumbline/vectors/v069.crb create mode 100644 tests/crumbline/vectors/v070.crb create mode 100644 tests/crumbline/vectors/v071.crb create mode 100644 tests/crumbline/vectors/v072.crb create mode 100644 tests/crumbline/vectors/v073.crb create mode 100644 tests/crumbline/vectors/v074.crb create mode 100644 tests/crumbline/vectors/v075.crb create mode 100644 tests/crumbline/vectors/v076.crb create mode 100644 tests/crumbline/vectors/v077.crb create mode 100644 tests/crumbline/vectors/v078.crb create mode 100644 tests/crumbline/vectors/v079.crb create mode 100644 tests/crumbline/vectors/v080.crb create mode 100644 tests/crumbline/vectors/v081.crb create mode 100644 tests/crumbline/vectors/v082.crb create mode 100644 tests/crumbline/vectors/v083.crb create mode 100644 tests/crumbline/vectors/v084.crb create mode 100644 tests/crumbline/vectors/v085.crb create mode 100644 tests/crumbline/vectors/v086.crb create mode 100644 tests/crumbline/vectors/v087.crb create mode 100644 tests/crumbline/vectors/v088.crb create mode 100644 tests/crumbline/vectors/v089.crb create mode 100644 tests/crumbline/vectors/v090.crb create mode 100644 tests/crumbline/vectors/v091.crb create mode 100644 tests/crumbline/vectors/v092.crb create mode 100644 tests/crumbline/vectors/v093.crb create mode 100644 tests/crumbline/vectors/v094.crb create mode 100644 tests/crumbline/vectors/v095.crb create mode 100644 tests/crumbline/vectors/v096.crb create mode 100644 tests/crumbline/vectors/v097.crb create mode 100644 tests/crumbline/vectors/v098.crb create mode 100644 tests/crumbline/vectors/v099.crb create mode 100644 tests/crumbline/vectors/v100.crb create mode 100644 tests/crumbline/vectors/v101.crb create mode 100644 tests/crumbline/vectors/v102.crb create mode 100644 tests/crumbline/vectors/v103.crb create mode 100644 tests/crumbline/vectors/v104.crb create mode 100644 tests/crumbline/vectors/v105.crb create mode 100644 tests/crumbline/vectors/v106.crb create mode 100644 tests/crumbline/vectors/v107.crb create mode 100644 tests/crumbline/vectors/v108.crb create mode 100644 tests/crumbline/vectors/v109.crb create mode 100644 tests/crumbline/vectors/v110.crb create mode 100644 tests/crumbline/vectors/v111.crb create mode 100644 tests/crumbline/vectors/v112.crb create mode 100644 tests/crumbline/vectors/v113.crb create mode 100644 tests/crumbline/vectors/v114.crb create mode 100644 tests/crumbline/vectors/v115.crb create mode 100644 tests/crumbline/vectors/v116.crb create mode 100644 tests/crumbline/vectors/v117.crb create mode 100644 tests/crumbline/vectors/v118.crb create mode 100644 tests/crumbline/vectors/v119.crb create mode 100644 tests/crumbline/vectors/v120.crb create mode 100644 tests/crumbline/vectors/v121.crb create mode 100644 tests/crumbline/vectors/v122.crb create mode 100644 tools/crumbline_learner.c diff --git a/Makefile b/Makefile index dbbb665f8..6075d9eab 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,18 @@ SRCS = src/sha256.c src/omega_canonical.c src/omega_validate.c src/omega_core.c OBJS = $(patsubst %.c,$(OUT_DIR)/%.o,$(notdir $(SRCS))) TARGET = $(OUT_DIR)/omegatool -.PHONY: all clean check-physics-lock test-m19 test test-m5 test-m6 test-m7 test-m8 test-m9 test-m10 test-m11 test-m12 test-m13 test-m14 test-m15 test-m17 +# Crumbline learner: a separate executable linked ONLY from learner-side code +# (visible reader, Omega program/realize/verify stack, synthesis vocabulary, +# OmegaLibrary, Crumbline search). It links no physics, no gate suites and no +# sealed-side code; the sealed side lives in the crumbs crate. +CL_SRCS = src/crumbline/cl_common.c src/crumbline/cl_crumb.c src/crumbline/cl_program.c src/crumbline/cl_search.c +LEARNER_CORE = sha256 omega_canonical omega_validate omega_core omega_codec aarch64_encoder aarch64_decoder \ + omega_realize omega_realize_synth omega_machine omega_exec omega_verify omega_program omega_synthesis omega_library +LEARNER_OBJS = $(addprefix $(OUT_DIR)/,$(addsuffix .o,$(LEARNER_CORE))) \ + $(patsubst src/crumbline/%.c,$(OUT_DIR)/crumbline/%.o,$(CL_SRCS)) $(OUT_DIR)/crumbline_learner.o +LEARNER = $(OUT_DIR)/crumbline-learner + +.PHONY: all clean check-physics-lock crumbline-learner test-crumbline test-m19 test test-m5 test-m6 test-m7 test-m8 test-m9 test-m10 test-m11 test-m12 test-m13 test-m14 test-m15 test-m17 all: $(TARGET) @@ -59,6 +70,21 @@ $(OUT_DIR)/m16_native.o: $(PHYSICS_DIR)/m16/m16_native.c | $(OUT_DIR) $(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ +$(OUT_DIR)/crumbline/%.o: src/crumbline/%.c | $(OUT_DIR) + mkdir -p $(OUT_DIR)/crumbline + $(CC) $(CFLAGS) -c $< -o $@ + +$(OUT_DIR)/crumbline_learner.o: tools/crumbline_learner.c | $(OUT_DIR) + $(CC) $(CFLAGS) -c $< -o $@ + +crumbline-learner: $(LEARNER) + +test-crumbline: $(LEARNER) + ./tests/crumbline/run_conformance.sh $(LEARNER) tests/crumbline/vectors + +$(LEARNER): $(LEARNER_OBJS) + $(CC) $(CFLAGS) -o $@ $(LEARNER_OBJS) + $(OUT_DIR)/omegatool.o: tools/omegatool.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ diff --git a/spec/crumbline.md b/spec/crumbline.md new file mode 100644 index 000000000..c158239f3 --- /dev/null +++ b/spec/crumbline.md @@ -0,0 +1,49 @@ +# Crumbline adapter (Omega as a Crumb v1 learner) + +Crumbline is the AIEN training curriculum of unlabeled input/output +observations. Its contracts, generators, sealed verifier, mixer, trace schema, +promotion ladder and ledger live in the `crumbs` crate +(aien-dev/aien-sovereign-core, `crates/crumbs`, see its `SPEC.md`). This +repository implements only the consumer adapter. + +## What Omega receives + +`build/crumbline-learner` is a separate executable. It speaks the crumbs +learner protocol v1 on stdin/stdout and links only learner-side code: + +| Linked | Not linked | +|---|---| +| Crumb v1 visible reader (`src/crumbline/cl_crumb.c`) | any generator, sealed record, held-out set or label | +| program / realize / verify stack, synthesis vocabulary | physics, NVRM, gate suites, evidence tooling | +| OmegaLibrary + Crumbline search (`cl_program.c`, `cl_search.c`) | | + +Everything the learner can know arrives as protocol frames: visible crumb +bytes, a one-byte verdict per submission, and admitted operations (a CPG1 +program, an opaque reference and a scope in bits). + +## Loop + +```text +CRUMB (visible bytes) + -> cl_crumb_decode (strict; one input lane, one output lane supported) + -> bank = omega_synth_base_prim_defs() + OmegaLibrary entries whose scope covers the inputs + -> level-by-level composition search, observational-equivalence pruning + over visible inputs + 32 public probes + -> visible fit -> omega_program_verify (V0 + V2) + native vs reference differential + -> ambiguity scan (keep looking for behaviourally different rival fits) + -> SUBMIT as CPG1 -> sealed verifier -> VERDICT byte + reject: recorded as an event, search continues + -> no exact fit: best partial fit may be submitted as a robust guess +ADMIT -> cl_library_admit: build, verify, omega_library_insert (receipt binds op_ref + program) +``` + +`omega_synthesize` is untouched: the M9 gates pin its enumeration order. The +base vocabulary is shared through `omega_synth_base_prim_defs()`. + +## Tests + +`make test-crumbline` decodes the committed conformance vectors (one per +registered crumbs family, generated by `crumbs vectors`), rejects malformed +inputs, and checks that the learner binary carries no sealed-side symbols. +The protocol, boundary and learning gates run from the crumbs side: +`crumbs gates --learner build/crumbline-learner`. diff --git a/src/crumbline/cl_common.c b/src/crumbline/cl_common.c new file mode 100644 index 000000000..d1e3d10a5 --- /dev/null +++ b/src/crumbline/cl_common.c @@ -0,0 +1,135 @@ +#include "cl_common.h" +#include "sha256.h" + +#include + +void cl_w_init(ClWriter *w, uint8_t *buf, size_t cap) { + w->buf = buf; + w->cap = cap; + w->len = 0; + w->overflow = false; +} + +void cl_w_bytes(ClWriter *w, const void *p, size_t n) { + if (w->overflow || n > w->cap - w->len) { + w->overflow = true; + return; + } + if (n) memcpy(w->buf + w->len, p, n); + w->len += n; +} + +void cl_w_uN(ClWriter *w, uint64_t v, uint8_t nbytes) { + uint8_t b[8]; + for (uint8_t i = 0; i < nbytes && i < 8; ++i) b[i] = (uint8_t)(v >> (8u * i)); + cl_w_bytes(w, b, nbytes); +} + +void cl_w_u8(ClWriter *w, uint8_t v) { cl_w_uN(w, v, 1); } +void cl_w_u16(ClWriter *w, uint16_t v) { cl_w_uN(w, v, 2); } +void cl_w_u32(ClWriter *w, uint32_t v) { cl_w_uN(w, v, 4); } +void cl_w_u64(ClWriter *w, uint64_t v) { cl_w_uN(w, v, 8); } + +void cl_r_init(ClReader *r, const uint8_t *buf, size_t len) { + r->buf = buf; + r->len = len; + r->pos = 0; + r->error = false; +} + +bool cl_r_bytes(ClReader *r, void *out, size_t n) { + if (r->error || n > r->len - r->pos) { + r->error = true; + if (out && n) memset(out, 0, n); + return false; + } + if (n) memcpy(out, r->buf + r->pos, n); + r->pos += n; + return true; +} + +uint64_t cl_r_uN(ClReader *r, uint8_t nbytes) { + uint8_t b[8] = {0}; + if (nbytes > 8 || !cl_r_bytes(r, b, nbytes)) { + r->error = true; + return 0; + } + uint64_t v = 0; + for (uint8_t i = 0; i < nbytes; ++i) v |= (uint64_t)b[i] << (8u * i); + return v; +} + +uint8_t cl_r_u8(ClReader *r) { return (uint8_t)cl_r_uN(r, 1); } +uint16_t cl_r_u16(ClReader *r) { return (uint16_t)cl_r_uN(r, 2); } +uint32_t cl_r_u32(ClReader *r) { return (uint32_t)cl_r_uN(r, 4); } +uint64_t cl_r_u64(ClReader *r) { return cl_r_uN(r, 8); } + +static uint64_t splitmix64(uint64_t *x) { + uint64_t z = (*x += 0x9E3779B97F4A7C15ULL); + z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9ULL; + z = (z ^ (z >> 27)) * 0x94D049BB133111EBULL; + return z ^ (z >> 31); +} + +void cl_rng_seed(ClRng *r, const char *domain, const uint64_t *parts, size_t nparts) { + sha256_ctx c; + sha256_init(&c); + sha256_update(&c, (const uint8_t *)domain, strlen(domain) + 1); + for (size_t i = 0; i < nparts; ++i) { + uint8_t b[8]; + for (int k = 0; k < 8; ++k) b[k] = (uint8_t)(parts[i] >> (8 * k)); + sha256_update(&c, b, 8); + } + uint8_t d[32]; + sha256_final(&c, d); + uint64_t x = 0; + for (int k = 0; k < 8; ++k) x |= (uint64_t)d[k] << (8 * k); + for (int i = 0; i < 4; ++i) r->s[i] = splitmix64(&x); +} + +static inline uint64_t rotl(uint64_t x, int k) { return (x << k) | (x >> (64 - k)); } + +uint64_t cl_rng_next(ClRng *r) { + uint64_t *s = r->s; + uint64_t result = rotl(s[1] * 5, 7) * 9; + uint64_t t = s[1] << 17; + s[2] ^= s[0]; + s[3] ^= s[1]; + s[1] ^= s[2]; + s[0] ^= s[3]; + s[2] ^= t; + s[3] = rotl(s[3], 45); + return result; +} + +uint64_t cl_rng_below(ClRng *r, uint64_t n) { + if (n <= 1) return 0; + uint64_t limit = UINT64_MAX - (UINT64_MAX % n); + uint64_t v; + do { + v = cl_rng_next(r); + } while (v >= limit); + return v % n; +} + +void cl_digest(const char *domain, const uint8_t *data, size_t len, uint8_t out[CL_DIGEST_BYTES]) { + sha256_ctx c; + sha256_init(&c); + sha256_update(&c, (const uint8_t *)domain, strlen(domain) + 1); + if (len) sha256_update(&c, data, len); + sha256_final(&c, out); +} + +void cl_hex(const uint8_t *bytes, size_t n, char *out) { + static const char hx[] = "0123456789abcdef"; + for (size_t i = 0; i < n; ++i) { + out[2 * i] = hx[bytes[i] >> 4]; + out[2 * i + 1] = hx[bytes[i] & 15]; + } + out[2 * n] = 0; +} + +bool cl_contains(const uint8_t *hay, size_t hay_len, const void *needle, size_t needle_len) { + if (needle_len == 0 || needle_len > hay_len) return false; + return memmem(hay, hay_len, needle, needle_len) != NULL; +} diff --git a/src/crumbline/cl_common.h b/src/crumbline/cl_common.h new file mode 100644 index 000000000..77c81d55e --- /dev/null +++ b/src/crumbline/cl_common.h @@ -0,0 +1,81 @@ +/* + * cl_common.h -- Crumbline shared plumbing: canonical byte buffers, the + * deterministic PRNG, width masks and domain-separated digests. + * + * Crumbline is the AIEN training curriculum of unlabeled input/output + * observations. It is unrelated to the RFC-0001 Crumb Protocol (agent + * coordination files in crumb-spec / spark-crumbs). + * + * This header is linked into BOTH the learner binary and the sealed teacher. + * It must never name anything that exists only on the sealed side. + */ +#ifndef CL_COMMON_H +#define CL_COMMON_H + +#include +#include +#include + +#define CL_DIGEST_BYTES 32 + +/* ---- canonical little-endian byte writer / reader -------------------- */ + +typedef struct { + uint8_t *buf; + size_t cap; + size_t len; + bool overflow; +} ClWriter; + +void cl_w_init(ClWriter *w, uint8_t *buf, size_t cap); +void cl_w_bytes(ClWriter *w, const void *p, size_t n); +void cl_w_u8(ClWriter *w, uint8_t v); +void cl_w_u16(ClWriter *w, uint16_t v); +void cl_w_u32(ClWriter *w, uint32_t v); +void cl_w_u64(ClWriter *w, uint64_t v); +/* Little-endian value truncated to `nbytes` (1..8). */ +void cl_w_uN(ClWriter *w, uint64_t v, uint8_t nbytes); + +typedef struct { + const uint8_t *buf; + size_t len; + size_t pos; + bool error; +} ClReader; + +void cl_r_init(ClReader *r, const uint8_t *buf, size_t len); +bool cl_r_bytes(ClReader *r, void *out, size_t n); +uint8_t cl_r_u8(ClReader *r); +uint16_t cl_r_u16(ClReader *r); +uint32_t cl_r_u32(ClReader *r); +uint64_t cl_r_u64(ClReader *r); +uint64_t cl_r_uN(ClReader *r, uint8_t nbytes); +static inline bool cl_r_done(const ClReader *r) { return !r->error && r->pos == r->len; } + +/* ---- width masks ---------------------------------------------------- */ + +static inline uint64_t cl_mask_bytes(uint8_t nbytes) { + return nbytes >= 8 ? 0xFFFFFFFFFFFFFFFFULL : ((1ULL << (8u * nbytes)) - 1ULL); +} + +/* ---- deterministic PRNG: xoshiro256** seeded by splitmix64 ---------- */ + +typedef struct { + uint64_t s[4]; +} ClRng; + +/* Seed from SHA-256(domain || u64 parts...) so every stream is named. */ +void cl_rng_seed(ClRng *r, const char *domain, const uint64_t *parts, size_t nparts); +uint64_t cl_rng_next(ClRng *r); +/* Uniform in [0, n); n > 0. Rejection sampling, no modulo bias. */ +uint64_t cl_rng_below(ClRng *r, uint64_t n); + +/* ---- domain-separated SHA-256 --------------------------------------- */ + +void cl_digest(const char *domain, const uint8_t *data, size_t len, uint8_t out[CL_DIGEST_BYTES]); +void cl_hex(const uint8_t *bytes, size_t n, char *out /* 2n+1 */); + +/* Search `hay` for `needle`; true if present. Used by the leak scanners. */ +bool cl_contains(const uint8_t *hay, size_t hay_len, const void *needle, size_t needle_len); + +#endif /* CL_COMMON_H */ diff --git a/src/crumbline/cl_crumb.c b/src/crumbline/cl_crumb.c new file mode 100644 index 000000000..aee04730a --- /dev/null +++ b/src/crumbline/cl_crumb.c @@ -0,0 +1,87 @@ +#include "cl_crumb.h" + +#include + +static bool lane_bytes_ok(uint8_t enc, uint8_t b) { + if (enc == CL_ENC_DECIMAL) return b == 0; + return b == 1 || b == 2 || b == 4 || b == 8; +} + +static int parse_lanes(uint8_t enc, uint8_t lane_bytes, uint8_t arity, const uint8_t *p, size_t len, uint64_t *out) { + if (enc == CL_ENC_RAW_LE) { + if (len != (size_t)lane_bytes * arity) return CL_CRUMB_ERR_LANE; + for (uint8_t l = 0; l < arity; ++l) { + uint64_t v = 0; + for (uint8_t k = 0; k < lane_bytes; ++k) v |= (uint64_t)p[l * lane_bytes + k] << (8u * k); + out[l] = v; + } + return CL_CRUMB_OK; + } + /* Decimal: arity canonical base-10 u64 values separated by single spaces. */ + size_t pos = 0; + for (uint8_t l = 0; l < arity; ++l) { + if (l > 0) { + if (pos >= len || p[pos] != ' ') return CL_CRUMB_ERR_LANE; + pos++; + } + size_t start = pos; + uint64_t v = 0; + while (pos < len && p[pos] >= '0' && p[pos] <= '9') { + uint64_t d = (uint64_t)(p[pos] - '0'); + if (v > (UINT64_MAX - d) / 10) return CL_CRUMB_ERR_LANE; + v = v * 10 + d; + pos++; + } + size_t digits = pos - start; + if (digits == 0 || (digits > 1 && p[start] == '0')) return CL_CRUMB_ERR_LANE; + out[l] = v; + } + return pos == len ? CL_CRUMB_OK : CL_CRUMB_ERR_LANE; +} + +int cl_crumb_decode(const uint8_t *buf, size_t len, ClCrumb *out) { + memset(out, 0, sizeof(*out)); + ClReader r; + cl_r_init(&r, buf, len); + uint8_t magic[4]; + cl_r_bytes(&r, magic, 4); + if (r.error || memcmp(magic, "CRB1", 4) != 0) return CL_CRUMB_ERR_MAGIC; + if (cl_r_u16(&r) != 1) return CL_CRUMB_ERR_VERSION; + out->encoding = cl_r_u8(&r); + uint8_t flags = cl_r_u8(&r); + out->in_arity = cl_r_u8(&r); + out->out_arity = cl_r_u8(&r); + out->in_lane_bytes = cl_r_u8(&r); + out->out_lane_bytes = cl_r_u8(&r); + if (r.error || (out->encoding != CL_ENC_DECIMAL && out->encoding != CL_ENC_RAW_LE) || (flags & ~1u) || + out->in_arity < 1 || out->in_arity > CL_CRUMB_MAX_LANES || out->out_arity < 1 || + out->out_arity > CL_CRUMB_MAX_LANES || !lane_bytes_ok(out->encoding, out->in_lane_bytes) || + !lane_bytes_ok(out->encoding, out->out_lane_bytes)) + return CL_CRUMB_ERR_SHAPE; + out->n = cl_r_u32(&r); + if (r.error || out->n == 0 || out->n > CL_CRUMB_MAX_EXAMPLES) return CL_CRUMB_ERR_LENGTH; + for (uint32_t i = 0; i < out->n; ++i) { + for (int side = 0; side < 2; ++side) { + uint32_t n = cl_r_u32(&r); + if (r.error || n > r.len - r.pos) return CL_CRUMB_ERR_LENGTH; + const uint8_t *p = r.buf + r.pos; + r.pos += n; + int rc = side == 0 ? parse_lanes(out->encoding, out->in_lane_bytes, out->in_arity, p, n, out->in[i]) + : parse_lanes(out->encoding, out->out_lane_bytes, out->out_arity, p, n, out->out[i]); + if (rc != CL_CRUMB_OK) return rc; + } + } + if (flags & 1u) { + out->has_budget = true; + out->budget_max_candidates = cl_r_u32(&r); + out->budget_max_depth = cl_r_u32(&r); + out->budget_max_oracle_queries = cl_r_u32(&r); + out->budget_max_program_ops = cl_r_u32(&r); + } + if (!cl_r_done(&r)) return CL_CRUMB_ERR_LENGTH; + return CL_CRUMB_OK; +} + +uint64_t cl_crumb_out_mask(const ClCrumb *c) { + return c->encoding == CL_ENC_RAW_LE ? cl_mask_bytes(c->out_lane_bytes) : UINT64_MAX; +} diff --git a/src/crumbline/cl_crumb.h b/src/crumbline/cl_crumb.h new file mode 100644 index 000000000..ddba1464a --- /dev/null +++ b/src/crumbline/cl_crumb.h @@ -0,0 +1,50 @@ +/* + * cl_crumb.h -- Omega's reader for Crumb v1 learner-visible bytes ("CRB1"). + * + * The format is owned by the `crumbs` crate (aien-sovereign-core, + * crates/crumbs/src/visible.rs); this is a conforming consumer. Omega never + * computes crumb identities and never sees anything but these bytes: + * + * "CRB1" | schema u16 (=1) | encoding u8 (1 decimal UTF-8, 2 raw LE) | flags u8 + * | in_arity u8 | out_arity u8 | in_lane_bytes u8 | out_lane_bytes u8 | n u32 + * | n x (u32 len, input bytes, u32 len, output bytes) | [budget 4 x u32] + * + * Decoding is strict (canonical decimal, exact lengths, no trailing bytes). + * Errors are bare codes. + */ +#ifndef CL_CRUMB_H +#define CL_CRUMB_H + +#include "cl_common.h" + +#define CL_CRUMB_MAX_LANES 8 +#define CL_CRUMB_MAX_EXAMPLES 64 +#define CL_ENC_DECIMAL 1 +#define CL_ENC_RAW_LE 2 + +typedef struct { + uint8_t encoding; + uint8_t in_arity, out_arity; + uint8_t in_lane_bytes, out_lane_bytes; + uint32_t n; + uint64_t in[CL_CRUMB_MAX_EXAMPLES][CL_CRUMB_MAX_LANES]; + uint64_t out[CL_CRUMB_MAX_EXAMPLES][CL_CRUMB_MAX_LANES]; + bool has_budget; + uint32_t budget_max_candidates, budget_max_depth, budget_max_oracle_queries, budget_max_program_ops; +} ClCrumb; + +typedef enum { + CL_CRUMB_OK = 0, + CL_CRUMB_ERR_MAGIC = -1, + CL_CRUMB_ERR_VERSION = -2, + CL_CRUMB_ERR_SHAPE = -3, + CL_CRUMB_ERR_LANE = -4, + CL_CRUMB_ERR_LENGTH = -5, +} ClCrumbStatus; + +int cl_crumb_decode(const uint8_t *buf, size_t len, ClCrumb *out); + +/* Output mask implied by the output lane encoding. */ +uint64_t cl_crumb_out_mask(const ClCrumb *c); + +#endif /* CL_CRUMB_H */ diff --git a/src/crumbline/cl_program.c b/src/crumbline/cl_program.c new file mode 100644 index 000000000..8d313f0c3 --- /dev/null +++ b/src/crumbline/cl_program.c @@ -0,0 +1,268 @@ +#include "cl_program.h" +#include "omega_core.h" +#include "omega_synthesis.h" + +#include +#include +#include + +static const uint64_t PROBES[CL_PROBE_COUNT] = { + 0ULL, 1ULL, 2ULL, 3ULL, 5ULL, 7ULL, 13ULL, 42ULL, + 100ULL, 127ULL, 128ULL, 255ULL, 256ULL, 1000ULL, 4095ULL, 65535ULL, + 65536ULL, 1000003ULL, 0x7FFFFFFFULL, 0x80000000ULL, 0xFFFFFFFFULL, 0x100000000ULL, + 0x123456789ABCDEFULL, 0x0F0F0F0F0F0F0F0FULL, 0x5555555555555555ULL, 0xAAAAAAAAAAAAAAAAULL, + 0x7FFFFFFFFFFFFFFFULL, 0x8000000000000000ULL, 0xFFFFFFFFFFFFFFFEULL, 0xFFFFFFFFFFFFFFFFULL, + 0x9E3779B97F4A7C15ULL, 0xD1B54A32D192ED03ULL, +}; + +const uint64_t *cl_probe_inputs(void) { return PROBES; } + +bool cl_step_op_valid(uint8_t op) { + return op == OP_ADD || op == OP_SUB || op == OP_MUL || op == OP_AND || op == OP_OR; +} + +static uint64_t eval_step(const ClStep *s, uint64_t x) { + uint64_t r = 0; + if (omega_eval_pure_binary_uint((OpCode)s->op, OVERFLOW_WRAP, 64, x, s->imm, &r) != 0) return 0; + return r; +} + +uint64_t cl_steps_eval(const ClSteps *p, uint64_t x) { + for (uint8_t i = 0; i < p->n; ++i) x = eval_step(&p->s[i], x); + return x; +} + +uint32_t cl_steps_insns(const ClSteps *p) { + uint32_t n = 1; /* RET */ + for (uint8_t i = 0; i < p->n; ++i) n += 2u + ((p->s[i].imm >> 16) != 0 ? 1u : 0u); + return n; +} + +int cl_steps_concat(const ClSteps *a, const ClSteps *b, ClSteps *out) { + if ((unsigned)a->n + b->n > CL_MAX_STEPS) return -1; + ClSteps t; + memset(&t, 0, sizeof(t)); + t.n = (uint8_t)(a->n + b->n); + memcpy(t.s, a->s, a->n * sizeof(ClStep)); + memcpy(t.s + a->n, b->s, b->n * sizeof(ClStep)); + *out = t; + return 0; +} + +int cl_steps_encode(const ClSteps *p, ClWriter *w) { + if (p->n > CL_MAX_STEPS) return -1; + cl_w_u8(w, p->n); + for (uint8_t i = 0; i < p->n; ++i) { + cl_w_u8(w, p->s[i].op); + cl_w_u64(w, p->s[i].imm); + } + return w->overflow ? -1 : 0; +} + +int cl_steps_decode(ClReader *r, ClSteps *out) { + memset(out, 0, sizeof(*out)); + out->n = cl_r_u8(r); + if (r->error || out->n > CL_MAX_STEPS) { + r->error = true; + return -1; + } + for (uint8_t i = 0; i < out->n; ++i) { + out->s[i].op = cl_r_u8(r); + out->s[i].imm = cl_r_u64(r); + if (!cl_step_op_valid(out->s[i].op)) r->error = true; + } + return r->error ? -1 : 0; +} + +void cl_steps_digest(const ClSteps *p, uint8_t out[CL_DIGEST_BYTES]) { + uint8_t buf[1 + CL_MAX_STEPS * 9]; + ClWriter w; + cl_w_init(&w, buf, sizeof(buf)); + cl_steps_encode(p, &w); + cl_digest("CRUMBLINE-V1-PROGRAM", buf, w.len, out); +} + +void cl_steps_behavior(const ClSteps *p, uint8_t out[CL_DIGEST_BYTES]) { + uint8_t buf[CL_PROBE_COUNT * 8]; + ClWriter w; + cl_w_init(&w, buf, sizeof(buf)); + for (size_t i = 0; i < CL_PROBE_COUNT; ++i) cl_w_u64(&w, cl_steps_eval(p, PROBES[i])); + cl_digest("CRUMBLINE-V1-BEHAVIOR", buf, w.len, out); +} + +int cl_steps_build_program(const ClSteps *p, OmegaProgram *out) { + if (!p || !out || p->n == 0) return -1; + OmegaProgram acc; + if (omega_program_build_unary_op(&acc, "s", (OpCode)p->s[0].op, p->s[0].imm) != 0) return -1; + for (uint8_t i = 1; i < p->n; ++i) { + OmegaProgram step, next; + if (omega_program_build_unary_op(&step, "s", (OpCode)p->s[i].op, p->s[i].imm) != 0) { + omega_program_destroy(&acc); + return -1; + } + char err[160]; + int rc = omega_program_compose(&acc, &step, &next, err, sizeof(err)); + omega_program_destroy(&step); + omega_program_destroy(&acc); + if (rc != 0) return -1; + acc = next; + } + uint8_t d[32]; + char hex[65]; + cl_steps_digest(p, d); + cl_hex(d, 8, hex); + snprintf(acc.name, sizeof(acc.name), "op_%.16s", hex); + omega_program_compute_id(&acc); + *out = acc; + return 0; +} + +int cl_steps_differential(const ClSteps *p, const OmegaProgram *prog, const uint64_t *inputs, size_t n, + uint32_t *exec_count) { + int bad = 0; + for (size_t k = 0; k < n + CL_PROBE_COUNT; ++k) { + uint64_t x = k < n ? inputs[k] : PROBES[k - n]; + uint64_t native = 0; + if (omega_program_exec(prog, x, &native) != 0) return -1; + if (exec_count) (*exec_count)++; + if (native != cl_steps_eval(p, x)) bad++; + } + return bad; +} + +/* ---- bank ----------------------------------------------------------- */ + +int cl_bank_add(ClBank *bank, const ClSteps *steps, ClOpOrigin origin, uint32_t op_ref) { + if (bank->count >= CL_BANK_MAX || steps->n == 0) return -1; + uint8_t d[32]; + cl_steps_digest(steps, d); + for (size_t i = 0; i < bank->count; ++i) + if (memcmp(bank->ops[i].digest, d, 32) == 0) return 1; /* already present */ + ClOp *op = &bank->ops[bank->count++]; + op->steps = *steps; + memcpy(op->digest, d, 32); + op->origin = (uint8_t)origin; + op->op_ref = op_ref; + return 0; +} + +int cl_bank_init_base(ClBank *bank) { + memset(bank, 0, sizeof(*bank)); + const OmegaSynthPrimDef *defs = NULL; + size_t n = omega_synth_base_prim_defs(&defs); + for (size_t i = 0; i < n; ++i) { + ClSteps s; + memset(&s, 0, sizeof(s)); + s.n = 1; + s.s[0].op = (uint8_t)defs[i].op; + s.s[0].imm = defs[i].imm; + if (cl_bank_add(bank, &s, CL_OP_BASE, 0) < 0) return -1; + } + return 0; +} + +void cl_bank_digest(const ClBank *bank, uint8_t out[CL_DIGEST_BYTES]) { + uint8_t buf[CL_BANK_MAX * 33 + 4]; + ClWriter w; + cl_w_init(&w, buf, sizeof(buf)); + cl_w_u32(&w, (uint32_t)bank->count); + for (size_t i = 0; i < bank->count; ++i) { + cl_w_bytes(&w, bank->ops[i].digest, 32); + cl_w_u8(&w, bank->ops[i].origin); + } + cl_digest("CRUMBLINE-V1-BANK", buf, w.len, out); +} + +/* ---- learner library ------------------------------------------------ */ + +int cl_library_init(ClLearnerLibrary *l) { + memset(l, 0, sizeof(*l)); + return omega_library_init(&l->lib); +} + +void cl_library_destroy(ClLearnerLibrary *l) { omega_library_destroy(&l->lib); } + +int cl_library_admit(ClLearnerLibrary *l, const ClSteps *steps, uint8_t scope_bits, uint32_t op_ref) { + if (!l || !steps || steps->n == 0 || l->lib.count >= OMEGA_LIB_MAX_PROGRAMS) return -1; + OmegaProgram prog; + if (cl_steps_build_program(steps, &prog) != 0) return -1; + VerifyReport rep; + int rc = -1; + if (omega_program_verify(&prog, &rep) == 0 && cl_steps_differential(steps, &prog, NULL, 0, NULL) == 0) { + uint8_t pre[4 + CL_DIGEST_BYTES], receipt[CL_DIGEST_BYTES]; + for (int k = 0; k < 4; ++k) pre[k] = (uint8_t)(op_ref >> (8 * k)); + cl_steps_digest(steps, pre + 4); + cl_digest("CRUMBLINE-OMEGA-ADMISSION", pre, sizeof(pre), receipt); + size_t slot = l->lib.count; + if (omega_library_insert(&l->lib, &prog, NULL, 0, receipt) == 0) { + l->steps[slot] = *steps; + l->scope_bits[slot] = scope_bits; + l->op_ref[slot] = op_ref; + rc = 0; + } + } + if (rc != 0) omega_program_destroy(&prog); + return rc; +} + +int cl_library_export(const ClLearnerLibrary *l, uint8_t input_bits, ClBank *bank) { + int added = 0; + for (size_t i = 0; i < l->lib.count; ++i) { + if (l->scope_bits[i] < input_bits) continue; /* scope enforcement */ + if (cl_bank_add(bank, &l->steps[i], CL_OP_LIBRARY, l->op_ref[i]) == 0) added++; + } + return added; +} + +/* ---- CPG1 ----------------------------------------------------------- */ + +uint8_t cl_cpg1_op(uint8_t omega_op) { + switch (omega_op) { + case OP_ADD: return 1; + case OP_SUB: return 2; + case OP_MUL: return 3; + case OP_AND: return 4; + case OP_OR: return 5; + default: return 0; + } +} + +uint8_t cl_omega_op(uint8_t cpg1_op) { + switch (cpg1_op) { + case 1: return OP_ADD; + case 2: return OP_SUB; + case 3: return OP_MUL; + case 4: return OP_AND; + case 5: return OP_OR; + default: return 0; + } +} + +int cl_steps_encode_cpg1(const ClSteps *p, ClWriter *w) { + cl_w_bytes(w, "CPG1", 4); + cl_w_u16(w, 1); + cl_w_u8(w, p->n); + for (uint8_t i = 0; i < p->n; ++i) { + uint8_t op = cl_cpg1_op(p->s[i].op); + if (op == 0) return -1; + cl_w_u8(w, op); + cl_w_u64(w, p->s[i].imm); + } + return w->overflow ? -1 : 0; +} + +int cl_steps_decode_cpg1(ClReader *r, ClSteps *out) { + memset(out, 0, sizeof(*out)); + uint8_t magic[4]; + cl_r_bytes(r, magic, 4); + if (r->error || memcmp(magic, "CPG1", 4) != 0 || cl_r_u16(r) != 1) return -1; + uint8_t n = cl_r_u8(r); + if (r->error || n > CL_MAX_STEPS) return -1; + out->n = n; + for (uint8_t i = 0; i < n; ++i) { + out->s[i].op = cl_omega_op(cl_r_u8(r)); + out->s[i].imm = cl_r_u64(r); + if (out->s[i].op == 0) return -1; + } + return r->error ? -1 : 0; +} diff --git a/src/crumbline/cl_program.h b/src/crumbline/cl_program.h new file mode 100644 index 000000000..c1dd822d4 --- /dev/null +++ b/src/crumbline/cl_program.h @@ -0,0 +1,118 @@ +/* + * cl_program.h -- Crumbline candidate programs as step chains over Omega's + * existing unary operations, plus the operation bank the search draws from. + * + * A step chain is an ordered list of (OpCode, immediate) applied to one u64. + * It is the canonical, content-addressed form of a candidate. It is realized + * into a real OmegaProgram only through omega_program_build_unary_op + + * omega_program_compose, and it is checked with Omega's own verifier + * (omega_program_verify: V0 structural + V2 properties) plus a differential + * check of native execution against the reference semantics + * (omega_eval_pure_binary_uint). + * + * Shared by the learner and the sealed teacher. Contains nothing sealed. + */ +#ifndef CL_PROGRAM_H +#define CL_PROGRAM_H + +#include "cl_common.h" +#include "omega_program.h" +#include "omega_library.h" + +#define CL_MAX_STEPS 24 +#define CL_BANK_MAX 96 +#define CL_PROBE_COUNT 32 + +typedef struct { + uint8_t op; /* OpCode: OP_ADD, OP_SUB, OP_MUL, OP_AND, OP_OR */ + uint64_t imm; +} ClStep; + +typedef struct { + uint8_t n; + ClStep s[CL_MAX_STEPS]; +} ClSteps; + +bool cl_step_op_valid(uint8_t op); + +/* Reference semantics (wrapping u64), independent of machine code. */ +uint64_t cl_steps_eval(const ClSteps *p, uint64_t x); + +/* Instruction count of the realized program (matches omega_program_compose). */ +uint32_t cl_steps_insns(const ClSteps *p); + +/* a then b. Returns -1 if the result would exceed CL_MAX_STEPS. */ +int cl_steps_concat(const ClSteps *a, const ClSteps *b, ClSteps *out); + +/* Canonical encoding: u8 n, n x (u8 op, u64 imm). */ +int cl_steps_encode(const ClSteps *p, ClWriter *w); +int cl_steps_decode(ClReader *r, ClSteps *out); + +/* Program digest: SHA-256("CRUMBLINE-V1-PROGRAM" || encoding). */ +void cl_steps_digest(const ClSteps *p, uint8_t out[CL_DIGEST_BYTES]); + +/* Behaviour signature: outputs on the fixed public probe inputs. Two chains + * with the same signature agree on every probe (not necessarily everywhere). */ +void cl_steps_behavior(const ClSteps *p, uint8_t out[CL_DIGEST_BYTES]); +const uint64_t *cl_probe_inputs(void); + +/* Realize through Omega's builders. The program is named "op_" so + * its SemanticId is determined by the step chain. Caller destroys `out`. */ +int cl_steps_build_program(const ClSteps *p, OmegaProgram *out); + +/* Native execution vs reference semantics on `inputs` plus the probes. + * Returns the number of disagreements (0 = differentially consistent), + * or -1 if the realization could not be executed. */ +int cl_steps_differential(const ClSteps *p, const OmegaProgram *prog, const uint64_t *inputs, size_t n, + uint32_t *exec_count); + +/* ---- operation bank ------------------------------------------------- */ + +typedef enum { CL_OP_BASE = 0, CL_OP_LIBRARY = 1 } ClOpOrigin; + +typedef struct { + ClSteps steps; + uint8_t digest[CL_DIGEST_BYTES]; /* learner-internal program digest */ + uint8_t origin; /* ClOpOrigin */ + uint32_t op_ref; /* ADMIT reference for library ops, 0 for base */ +} ClOp; + +typedef struct { + ClOp ops[CL_BANK_MAX]; + size_t count; +} ClBank; + +/* Base vocabulary: exactly omega_synth_base_prim_defs(). */ +int cl_bank_init_base(ClBank *bank); +int cl_bank_add(ClBank *bank, const ClSteps *steps, ClOpOrigin origin, uint32_t op_ref); +void cl_bank_digest(const ClBank *bank, uint8_t out[CL_DIGEST_BYTES]); + +/* ---- learner library: OmegaLibrary plus each entry's step chain ------- */ + +typedef struct { + OmegaLibrary lib; /* the canonical semantic-object store */ + ClSteps steps[OMEGA_LIB_MAX_PROGRAMS]; /* step chain of lib.entries[i] */ + uint8_t scope_bits[OMEGA_LIB_MAX_PROGRAMS]; /* widest input magnitude (bits) it was verified over */ + uint32_t op_ref[OMEGA_LIB_MAX_PROGRAMS]; /* sealed-side admission reference */ +} ClLearnerLibrary; + +int cl_library_init(ClLearnerLibrary *l); +void cl_library_destroy(ClLearnerLibrary *l); + +/* Build, verify (V0+V2 + differential) and insert via omega_library_insert. + * The library receipt hash binds the admission reference and the program. */ +int cl_library_admit(ClLearnerLibrary *l, const ClSteps *steps, uint8_t scope_bits, uint32_t op_ref); + +/* Add every entry whose verified scope covers inputs of `input_bits` bits. + * Returns how many were added. Entries outside scope are withheld. */ +int cl_library_export(const ClLearnerLibrary *l, uint8_t input_bits, ClBank *bank); + +/* ---- Candidate Program v1 (CPG1, owned by the crumbs crate) ---------- */ + +/* Omega OpCode -> CPG1 op byte (0 if the op has no CPG1 form). */ +uint8_t cl_cpg1_op(uint8_t omega_op); +uint8_t cl_omega_op(uint8_t cpg1_op); +int cl_steps_encode_cpg1(const ClSteps *p, ClWriter *w); +int cl_steps_decode_cpg1(ClReader *r, ClSteps *out); + +#endif /* CL_PROGRAM_H */ diff --git a/src/crumbline/cl_search.c b/src/crumbline/cl_search.c new file mode 100644 index 000000000..aa1b2e683 --- /dev/null +++ b/src/crumbline/cl_search.c @@ -0,0 +1,377 @@ +#include "cl_search.h" + +#include +#include +#include + +#define W_PROBES CL_PROBE_COUNT +#define MAX_PENDING 64 +#define MAX_HYP 64 + +void cl_search_default_config(ClSearchConfig *cfg) { + cfg->max_candidates = 20000; + cfg->max_depth = 6; + cfg->frontier_cap = 4000; + cfg->max_oracle_queries = 4; + cfg->ambiguity_scan = 400; + cfg->robust_min_pct = 75; + cfg->max_program_insns = 80; +} + +uint8_t cl_crumb_input_bits(const ClCrumb *c) { + uint64_t m = 0; + for (uint32_t i = 0; i < c->n; ++i) + if (c->in[i][0] > m) m = c->in[i][0]; + uint8_t b = 0; + while (m) { + b++; + m >>= 1; + } + return b; +} + +typedef struct { + uint32_t id; + uint32_t parent; /* index into nodes, UINT32_MAX for the root */ + uint16_t op; + uint8_t depth; + uint8_t nsteps; + uint32_t insns; /* realized instructions excluding the final RET */ +} Node; + +typedef struct { + uint64_t h1, h2; + uint32_t insns; + uint8_t used; +} Slot; + +typedef struct { + uint32_t node_id; + ClSteps steps; +} Pending; + +typedef struct { + const ClCrumb *crumb; + const ClBank *bank; + const ClSearchConfig *cfg; + const ClOracle *oracle; + const ClEventSink *sink; + ClSearchResult *res; + uint32_t n; /* visible examples */ + uint32_t w; /* values per node: n + probes */ + uint64_t mask; + Node *nodes; + uint64_t *vals; + size_t count, cap; + Slot *table; + size_t tmask; + uint64_t inputs[CL_CRUMB_MAX_EXAMPLES]; + Pending pending[MAX_PENDING]; + size_t npending; + uint32_t pending_since; + uint8_t hyps[MAX_HYP][CL_DIGEST_BYTES]; + size_t nhyp; + uint32_t max_queries; + bool stop, solved, first_submit_done; +} S; + +static void emit(S *s, const ClEvent *ev) { + if (s->sink && s->sink->emit) s->sink->emit(s->sink->ctx, ev); +} + +static void hash_vals(const uint64_t *v, uint32_t w, uint64_t *h1, uint64_t *h2) { + uint64_t a = 0x9E3779B97F4A7C15ULL, b = 0xC2B2AE3D27D4EB4FULL; + for (uint32_t i = 0; i < w; ++i) { + a = (a ^ v[i]) * 0x100000001B3ULL; + a ^= a >> 29; + b = (b + v[i]) * 0xFF51AFD7ED558CCDULL; + b ^= b >> 33; + } + *h1 = a; + *h2 = b; +} + +/* true if an equivalent state with cost <= insns already exists */ +static bool equiv_seen(S *s, uint64_t h1, uint64_t h2, uint32_t insns) { + size_t i = (size_t)h1 & s->tmask; + for (;;) { + Slot *sl = &s->table[i]; + if (!sl->used) { + sl->used = 1; + sl->h1 = h1; + sl->h2 = h2; + sl->insns = insns; + return false; + } + if (sl->h1 == h1 && sl->h2 == h2) { + if (sl->insns <= insns) return true; + sl->insns = insns; + return false; + } + i = (i + 1) & s->tmask; + } +} + +static uint32_t op_insns(const ClOp *op) { return cl_steps_insns(&op->steps) - 1; } + +/* Steps of the chain: ancestors of nodes[parent_idx], then bank op `op`. */ +static int build_steps(S *s, uint32_t parent_idx, uint16_t op, ClSteps *out) { + uint16_t ops[64]; + int k = 0; + for (uint32_t i = parent_idx; i != UINT32_MAX && s->nodes[i].parent != UINT32_MAX; i = s->nodes[i].parent) { + if (k >= 63) return -1; + ops[k++] = s->nodes[i].op; + } + memset(out, 0, sizeof(*out)); + for (int j = k - 1; j >= 0; --j) + if (cl_steps_concat(out, &s->bank->ops[ops[j]].steps, out) != 0) return -1; + return cl_steps_concat(out, &s->bank->ops[op].steps, out); +} + +/* Omega verification of a visible fit: realize, V0+V2, native-vs-reference. */ +static uint8_t verify_fit(S *s, const ClSteps *steps) { + OmegaProgram prog; + if (cl_steps_build_program(steps, &prog) != 0) return CL_VERIFY_FAIL_BUILD; + VerifyReport rep; + uint8_t out = CL_VERIFY_PASS; + if (omega_program_verify(&prog, &rep) != 0) { + out = CL_VERIFY_FAIL_OMEGA; + } else { + uint32_t execs = 0; + int bad = cl_steps_differential(steps, &prog, s->inputs, s->n, &execs); + s->res->exec_count += execs; + if (bad != 0) out = CL_VERIFY_FAIL_DIFFERENTIAL; + } + omega_program_destroy(&prog); + return out; +} + +static void submit_one(S *s, uint32_t node_id, const ClSteps *steps, uint8_t flags) { + if (s->res->oracle_queries >= s->max_queries) { + s->stop = true; + return; + } + s->res->oracle_queries++; + if (!s->first_submit_done) { + s->first_submit_done = true; + s->res->hypotheses_at_first_submit = (uint32_t)s->nhyp; + } + ClEvent ev = {CL_EV_SUBMIT, 0, CL_VERIFY_PASS, (flags & CL_SUBMIT_ROBUST) ? CL_FIT_ROBUST : CL_FIT_EXACT, 0, + node_id, node_id, 0, (uint16_t)s->res->oracle_queries}; + emit(s, &ev); + uint8_t verdict = CL_VERDICT_REJECT; + uint8_t hyp = s->nhyp > 255 ? 255 : (uint8_t)s->nhyp; + if (s->oracle->submit(s->oracle->ctx, node_id, steps, flags, hyp, &verdict) != 0) { + s->stop = true; + return; + } + if (verdict == CL_VERDICT_ACCEPT) { + s->solved = true; + s->stop = true; + s->res->outcome = CL_OUTCOME_SOLVED; + s->res->solution = *steps; + s->res->solution_node = node_id; + s->res->candidates_to_solution = s->res->generated; + } else if (verdict == CL_VERDICT_EXHAUSTED) { + s->stop = true; + } else { + s->res->oracle_rejections++; + } +} + +static void flush_pending(S *s) { + for (size_t i = 0; i < s->npending && !s->stop; ++i) submit_one(s, s->pending[i].node_id, &s->pending[i].steps, 0); + s->npending = 0; +} + +int cl_search_run(const ClCrumb *crumb, const ClBank *bank, const ClSearchConfig *cfg_in, const ClOracle *oracle, + const ClEventSink *sink, ClSearchResult *res) { + if (!crumb || !bank || !cfg_in || !oracle || !res) return -1; + struct timespec t0, t1; + clock_gettime(CLOCK_MONOTONIC, &t0); + memset(res, 0, sizeof(*res)); + res->outcome = CL_OUTCOME_UNSOLVED; + res->solution_node = UINT32_MAX; + + ClSearchConfig cfg = *cfg_in; + if (crumb->has_budget) { + if (crumb->budget_max_candidates && crumb->budget_max_candidates < cfg.max_candidates) + cfg.max_candidates = crumb->budget_max_candidates; + if (crumb->budget_max_depth && crumb->budget_max_depth < cfg.max_depth) cfg.max_depth = crumb->budget_max_depth; + if (crumb->budget_max_oracle_queries && crumb->budget_max_oracle_queries < cfg.max_oracle_queries) + cfg.max_oracle_queries = crumb->budget_max_oracle_queries; + } + /* Omega's unary synthesis handles one input lane and one output lane. */ + if (crumb->in_arity != 1 || crumb->out_arity != 1) { + res->outcome = CL_OUTCOME_UNSUPPORTED; + return 0; + } + + S s; + memset(&s, 0, sizeof(s)); + s.crumb = crumb; + s.bank = bank; + s.cfg = &cfg; + s.oracle = oracle; + s.sink = sink; + s.res = res; + s.n = crumb->n; + s.w = crumb->n + W_PROBES; + s.mask = cl_crumb_out_mask(crumb); + s.max_queries = cfg.max_oracle_queries; + for (uint32_t i = 0; i < s.n; ++i) s.inputs[i] = crumb->in[i][0]; + + s.cap = (size_t)cfg.frontier_cap * cfg.max_depth + 1; + if (s.cap > (size_t)cfg.max_candidates + 1) s.cap = (size_t)cfg.max_candidates + 1; + size_t tsize = 1024; + while (tsize < 2 * ((size_t)cfg.max_candidates + 2)) tsize <<= 1; + s.tmask = tsize - 1; + s.nodes = calloc(s.cap, sizeof(Node)); + s.vals = calloc(s.cap * s.w, sizeof(uint64_t)); + s.table = calloc(tsize, sizeof(Slot)); + uint64_t *scratch = calloc(s.w, sizeof(uint64_t)); + if (!s.nodes || !s.vals || !s.table || !scratch) { + free(s.nodes); + free(s.vals); + free(s.table); + free(scratch); + return -1; + } + + const uint64_t *probes = cl_probe_inputs(); + Node *root = &s.nodes[0]; + root->id = 0; + root->parent = UINT32_MAX; + root->op = UINT16_MAX; + for (uint32_t k = 0; k < s.n; ++k) s.vals[k] = s.inputs[k]; + for (uint32_t k = 0; k < W_PROBES; ++k) s.vals[s.n + k] = probes[k]; + uint64_t h1, h2; + hash_vals(s.vals, s.w, &h1, &h2); + equiv_seen(&s, h1, h2, 0); + s.count = 1; + + uint32_t next_id = 1; + size_t level_start = 0, level_end = 1; + int best_matches = -1; + uint32_t best_node = 0, best_parent = 0; + uint16_t best_op = 0; + uint32_t robust_need = cfg.robust_min_pct ? (s.n * cfg.robust_min_pct + 99) / 100 : UINT32_MAX; + + for (uint32_t depth = 1; depth <= cfg.max_depth && !s.stop; ++depth) { + size_t level_kept = 0; + for (size_t pi = level_start; pi < level_end && !s.stop; ++pi) { + res->expansions++; + for (size_t oi = 0; oi < bank->count && !s.stop; ++oi) { + if (res->generated >= cfg.max_candidates) { + s.stop = true; + break; + } + res->generated++; + const Node *parent = &s.nodes[pi]; + const ClOp *op = &bank->ops[oi]; + ClEvent ev = {CL_EV_EXPAND, CL_PRUNE_NONE, CL_VERIFY_NOT_REACHED, CL_FIT_NONE, (uint16_t)oi, + parent->id, next_id++, 0, 0}; + uint32_t nsteps = parent->nsteps + op->steps.n; + uint32_t insns = parent->insns + op_insns(op); + if (nsteps > CL_MAX_STEPS) { + ev.prune = CL_PRUNE_STEP_CAP; + emit(&s, &ev); + continue; + } + if (insns + 1 > cfg.max_program_insns) { + ev.prune = CL_PRUNE_COST; + res->pruned_cost++; + emit(&s, &ev); + continue; + } + const uint64_t *pv = &s.vals[pi * s.w]; + for (uint32_t k = 0; k < s.w; ++k) scratch[k] = cl_steps_eval(&op->steps, pv[k]); + ev.exec_cost = s.w; + hash_vals(scratch, s.w, &h1, &h2); + if (equiv_seen(&s, h1, h2, insns)) { + ev.prune = CL_PRUNE_EQUIV; + res->pruned_equiv++; + emit(&s, &ev); + continue; + } + res->evaluated++; + uint32_t mismatch = 0; + for (uint32_t k = 0; k < s.n; ++k) + if ((scratch[k] & s.mask) != crumb->out[k][0]) mismatch++; + + if (level_kept < cfg.frontier_cap && s.count < s.cap) { + Node *c = &s.nodes[s.count]; + c->id = ev.child; + c->parent = (uint32_t)pi; + c->op = (uint16_t)oi; + c->depth = (uint8_t)depth; + c->nsteps = (uint8_t)nsteps; + c->insns = insns; + memcpy(&s.vals[s.count * s.w], scratch, s.w * sizeof(uint64_t)); + s.count++; + level_kept++; + } else { + ev.prune = CL_PRUNE_FRONTIER_CAP; + res->pruned_cap++; + } + + if (mismatch == 0) { + ev.fit = CL_FIT_EXACT; + res->visible_fits++; + ClSteps steps; + if (build_steps(&s, (uint32_t)pi, (uint16_t)oi, &steps) != 0) { + ev.verify = CL_VERIFY_FAIL_BUILD; + } else { + ev.verify = verify_fit(&s, &steps); + } + if (ev.verify != CL_VERIFY_PASS) { + res->verify_failures++; + } else { + uint8_t sig[CL_DIGEST_BYTES]; + cl_steps_behavior(&steps, sig); + bool fresh = true; + for (size_t h = 0; h < s.nhyp; ++h) + if (memcmp(s.hyps[h], sig, CL_DIGEST_BYTES) == 0) fresh = false; + if (fresh && s.nhyp < MAX_HYP) memcpy(s.hyps[s.nhyp++], sig, CL_DIGEST_BYTES); + if (fresh && s.npending < MAX_PENDING) { + if (s.npending == 0) s.pending_since = res->generated; + s.pending[s.npending].node_id = ev.child; + s.pending[s.npending].steps = steps; + s.npending++; + } + } + } else if (s.n - mismatch >= robust_need && (int)(s.n - mismatch) > best_matches) { + best_matches = (int)(s.n - mismatch); + best_node = ev.child; + best_parent = (uint32_t)pi; + best_op = (uint16_t)oi; + } + emit(&s, &ev); + + if (s.npending && res->generated >= s.pending_since + cfg.ambiguity_scan) flush_pending(&s); + } + } + level_start = level_end; + level_end = s.count; + if (level_start == level_end) break; + } + if (!s.solved && s.npending) { + s.stop = false; + flush_pending(&s); + } + if (!s.solved && best_matches >= 0 && res->oracle_queries < s.max_queries) { + ClSteps steps; + if (build_steps(&s, best_parent, best_op, &steps) == 0 && verify_fit(&s, &steps) == CL_VERIFY_PASS) { + s.stop = false; + submit_one(&s, best_node, &steps, CL_SUBMIT_ROBUST); + } + } + + free(s.nodes); + free(s.vals); + free(s.table); + free(scratch); + clock_gettime(CLOCK_MONOTONIC, &t1); + res->wall_ns = (uint64_t)(t1.tv_sec - t0.tv_sec) * 1000000000ULL + (uint64_t)(t1.tv_nsec - t0.tv_nsec); + return 0; +} diff --git a/src/crumbline/cl_search.h b/src/crumbline/cl_search.h new file mode 100644 index 000000000..05d7ed398 --- /dev/null +++ b/src/crumbline/cl_search.h @@ -0,0 +1,100 @@ +/* + * cl_search.h -- Omega synthesis over a Crumbline crumb (the Omega-side adapter). + * + * Inputs: the learner-visible crumb, an operation bank (Omega's base + * vocabulary from omega_synth_base_prim_defs, optionally extended from the + * learner's OmegaLibrary) and an oracle handle. The oracle is the ONLY route to + * the sealed verifier: it takes one candidate step chain and returns one + * verdict byte. It cannot return held-out inputs, outputs, counterexamples or + * labels. + * + * The search is a level-by-level enumeration of compositions, like + * omega_synthesize (left untouched: the M9 gates pin its enumeration order), + * extended with: + * - observational-equivalence pruning over visible inputs + public probes; + * - acceptance through omega_program_verify (V0 + V2) plus a native vs + * reference-semantics differential check before anything is submitted; + * - an ambiguity scan: after the first visible fit the search keeps looking + * for behaviourally different rival fits before it commits; + * - rejected candidates are recorded (event stream) and search continues; + * - a robust fallback (best partial fit) for observations no exact + * program explains. + */ +#ifndef CL_SEARCH_H +#define CL_SEARCH_H + +#include "cl_crumb.h" +#include "cl_program.h" + +typedef enum { + CL_VERDICT_NONE = 0, + CL_VERDICT_ACCEPT = 1, + CL_VERDICT_REJECT = 2, + CL_VERDICT_EXHAUSTED = 3, +} ClVerdict; + +#define CL_SUBMIT_ROBUST 0x01u + +typedef struct { + /* Submit one candidate; writes one ClVerdict. */ + int (*submit)(void *ctx, uint32_t node, const ClSteps *cand, uint8_t flags, uint8_t hypotheses, uint8_t *verdict); + void *ctx; +} ClOracle; + +/* Search events (the learner half of the crumbs trace schema). */ +enum { CL_EV_EXPAND = 1, CL_EV_SUBMIT = 2 }; +enum { CL_PRUNE_NONE = 0, CL_PRUNE_EQUIV = 1, CL_PRUNE_COST = 2, CL_PRUNE_FRONTIER_CAP = 3, CL_PRUNE_STEP_CAP = 4 }; +enum { + CL_VERIFY_NOT_REACHED = 0, + CL_VERIFY_PASS = 1, + CL_VERIFY_FAIL_OMEGA = 2, + CL_VERIFY_FAIL_DIFFERENTIAL = 3, + CL_VERIFY_FAIL_BUILD = 4, +}; +enum { CL_FIT_NONE = 0, CL_FIT_EXACT = 1, CL_FIT_ROBUST = 2 }; + +typedef struct { + uint8_t kind, prune, verify, fit; + uint16_t op_index; + uint32_t parent, child; + uint32_t exec_cost; + uint16_t oracle_index; +} ClEvent; + +typedef struct { + void (*emit)(void *ctx, const ClEvent *ev); + void *ctx; +} ClEventSink; + +typedef struct { + uint32_t max_candidates; + uint32_t max_depth; + uint32_t frontier_cap; + uint32_t max_oracle_queries; + uint32_t ambiguity_scan; + uint32_t robust_min_pct; + uint32_t max_program_insns; +} ClSearchConfig; + +void cl_search_default_config(ClSearchConfig *cfg); + +enum { CL_OUTCOME_SOLVED = 1, CL_OUTCOME_UNSOLVED = 2, CL_OUTCOME_UNSUPPORTED = 3 }; + +typedef struct { + uint8_t outcome; + uint32_t solution_node; + ClSteps solution; + uint32_t generated, evaluated, expansions; + uint32_t pruned_equiv, pruned_cost, pruned_cap; + uint32_t visible_fits, verify_failures, oracle_queries, oracle_rejections; + uint32_t candidates_to_solution, hypotheses_at_first_submit; + uint64_t exec_count, wall_ns; +} ClSearchResult; + +int cl_search_run(const ClCrumb *crumb, const ClBank *bank, const ClSearchConfig *cfg, const ClOracle *oracle, + const ClEventSink *sink /* nullable */, ClSearchResult *res); + +/* Widest visible input magnitude in bits (lane 0), used for library scope. */ +uint8_t cl_crumb_input_bits(const ClCrumb *c); + +#endif /* CL_SEARCH_H */ diff --git a/src/omega_synthesis.c b/src/omega_synthesis.c index 9500ff2fe..a1086f066 100644 --- a/src/omega_synthesis.c +++ b/src/omega_synthesis.c @@ -8,32 +8,35 @@ static const uint64_t PROBE_INPUTS[SYNTH_PROBE_COUNT] = { 0, 1, 3, 7, 13, 42 }; +static const OmegaSynthPrimDef BASE_PRIM_DEFS[] = { + { "add_1", OP_ADD, 1 }, + { "add_2", OP_ADD, 2 }, + { "add_3", OP_ADD, 3 }, + { "add_5", OP_ADD, 5 }, + { "sub_1", OP_SUB, 1 }, + { "sub_2", OP_SUB, 2 }, + { "sub_3", OP_SUB, 3 }, + { "sub_5", OP_SUB, 5 }, + { "mul_2", OP_MUL, 2 }, + { "mul_3", OP_MUL, 3 }, + { "mul_4", OP_MUL, 4 }, + { "and_ff", OP_AND, 0xFF }, + { "and_0f", OP_AND, 0x0F }, + { "or_1", OP_OR, 1 }, + { "or_2", OP_OR, 2 } +}; + +size_t omega_synth_base_prim_defs(const OmegaSynthPrimDef **out) { + if (out) *out = BASE_PRIM_DEFS; + return sizeof(BASE_PRIM_DEFS) / sizeof(BASE_PRIM_DEFS[0]); +} + int omega_synth_bank_init(SynthPrimitiveBank *bank) { if (!bank) return -1; memset(bank, 0, sizeof(SynthPrimitiveBank)); - struct { - const char *name; - OpCode op; - uint64_t imm; - } prim_defs[] = { - { "add_1", OP_ADD, 1 }, - { "add_2", OP_ADD, 2 }, - { "add_3", OP_ADD, 3 }, - { "add_5", OP_ADD, 5 }, - { "sub_1", OP_SUB, 1 }, - { "sub_2", OP_SUB, 2 }, - { "sub_3", OP_SUB, 3 }, - { "sub_5", OP_SUB, 5 }, - { "mul_2", OP_MUL, 2 }, - { "mul_3", OP_MUL, 3 }, - { "mul_4", OP_MUL, 4 }, - { "and_ff", OP_AND, 0xFF }, - { "and_0f", OP_AND, 0x0F }, - { "or_1", OP_OR, 1 }, - { "or_2", OP_OR, 2 } - }; - size_t num_defs = sizeof(prim_defs) / sizeof(prim_defs[0]); + const OmegaSynthPrimDef *prim_defs = NULL; + size_t num_defs = omega_synth_base_prim_defs(&prim_defs); for (size_t i = 0; i < num_defs && i < SYNTH_MAX_PRIMITIVES; ++i) { if (omega_program_build_unary_op(&bank->programs[i], prim_defs[i].name, diff --git a/src/omega_synthesis.h b/src/omega_synthesis.h index b0f8ef984..5da16bdb5 100644 --- a/src/omega_synthesis.h +++ b/src/omega_synthesis.h @@ -47,6 +47,17 @@ typedef struct { size_t count; } EquivTable; +/* The default primitive vocabulary as (name, op, imm) rows. omega_synth_bank_init + * builds its bank from exactly these rows; other searches (Crumbline) start from + * the same vocabulary instead of copying it. */ +typedef struct { + const char *name; + OpCode op; + uint64_t imm; +} OmegaSynthPrimDef; + +size_t omega_synth_base_prim_defs(const OmegaSynthPrimDef **out); + /* Initialize default primitive bank (add, sub, mul, and, or with diverse imm) */ int omega_synth_bank_init(SynthPrimitiveBank *bank); diff --git a/tests/crumbline/run_conformance.sh b/tests/crumbline/run_conformance.sh new file mode 100755 index 000000000..fae38f7b6 --- /dev/null +++ b/tests/crumbline/run_conformance.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Crumb v1 conformance: Omega's visible-crumb reader must decode every vector +# produced by the crumbs crate (aien-sovereign-core, crates/crumbs) exactly as +# crumbs itself parses it. Vectors: `crumbs vectors DIR` (one per registered +# family, seed 7) plus expected.txt. +# +# Also checks that malformed bytes are rejected and that the learner binary +# carries no sealed-side symbols. +set -u +LEARNER=${1:-build/crumbline-learner} +DIR=${2:-tests/crumbline/vectors} +pass=0 +fail=0 +while read -r name rest; do + got=$("$LEARNER" --decode "$DIR/$name") + if [ "$got" == "$rest" ]; then + pass=$((pass + 1)) + else + fail=$((fail + 1)) + echo "MISMATCH $name" + echo " want: $rest" + echo " got: $got" + fi +done < "$DIR/expected.txt" + +# Negative vectors: truncated, wrong magic, trailing byte, non-canonical decimal. +tmp=$(mktemp -d) +head -c 20 "$DIR/v001.crb" > "$tmp/trunc.crb" +printf 'XRB1' | cat - <(tail -c +5 "$DIR/v001.crb") > "$tmp/magic.crb" +cat "$DIR/v001.crb" <(printf '\0') > "$tmp/trail.crb" +printf 'CRB1\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x00\x00\x01\x00\x00\x001\x02\x00\x00\x0003' > "$tmp/zero.crb" +for bad in trunc magic trail zero; do + if "$LEARNER" --decode "$tmp/$bad.crb" | grep -q '^decode-error'; then + pass=$((pass + 1)) + else + fail=$((fail + 1)) + echo "ACCEPTED MALFORMED $bad" + fi +done +rm -rf "$tmp" + +# The learner links no generator, sealed record or gate code. +if nm "$LEARNER" | grep -Eiq 'sealed|heldout|generator|nvrm|_gates'; then + fail=$((fail + 1)) + echo "LEARNER LINKS SEALED OR GATE SYMBOLS" +else + pass=$((pass + 1)) +fi + +echo "CRUMBLINE_CONFORMANCE pass=$pass fail=$fail" +[ "$fail" -eq 0 ] diff --git a/tests/crumbline/vectors/expected.txt b/tests/crumbline/vectors/expected.txt new file mode 100644 index 000000000..93142d904 --- /dev/null +++ b/tests/crumbline/vectors/expected.txt @@ -0,0 +1,122 @@ +v001.crb ok enc=1 in=1x0 out=1x0 n=8 | 228 -> 456 | 6 -> 12 | 108 -> 216 | 94 -> 188 | 245 -> 490 | 177 -> 354 | 214 -> 428 | 121 -> 242 +v002.crb ok enc=1 in=1x0 out=1x0 n=8 | 1150 -> 1144 | 772 -> 766 | 30 -> 24 | 26821 -> 26815 | 3404 -> 3398 | 1816 -> 1810 | 1783 -> 1777 | 3324 -> 3318 +v003.crb ok enc=1 in=1x0 out=1x0 n=8 | 30 -> 30 | 17 -> 17 | 3182 -> 3182 | 143 -> 143 | 3593 -> 3593 | 2030 -> 2030 | 3924 -> 3924 | 442 -> 442 +v004.crb ok enc=1 in=1x0 out=1x0 n=8 | 10 -> 17 | 15 -> 22 | 139 -> 146 | 7 -> 14 | 206 -> 213 | 91 -> 98 | 238 -> 245 | 4 -> 11 +v005.crb ok enc=1 in=1x0 out=1x0 n=8 | 1574 -> 1570 | 30 -> 26 | 3222 -> 3218 | 2067 -> 2063 | 1590 -> 1586 | 11934 -> 11930 | 7 -> 3 | 16 -> 14 +v006.crb ok enc=1 in=1x0 out=1x0 n=8 | 3630 -> 3637 | 1343 -> 1350 | 2389 -> 2396 | 3664 -> 3671 | 30 -> 37 | 2693 -> 2700 | 520 -> 527 | 367509420 -> 367509431 +v007.crb ok enc=1 in=1x0 out=1x0 n=8 | 198 -> 7 | 18 -> 3 | 5 -> 6 | 149 -> 6 | 190 -> 15 | 13 -> 14 | 154 -> 11 | 69 -> 6 +v008.crb ok enc=1 in=1x0 out=1x0 n=8 | 839 -> 851 | 2018 -> 2014 | 2388 -> 2386 | 11 -> 23 | 31092 -> 31090 | 23058 -> 23070 | 1187 -> 1183 | 997 -> 1011 +v009.crb ok enc=1 in=1x0 out=1x0 n=8 | 2585 -> 13050 | 695 -> 3600 | 251935157 -> 1259675830 | 1214 -> 6195 | 2081 -> 10530 | 3128 -> 15765 | 2279 -> 11440 | 3990 -> 19995 +v010.crb ok enc=1 in=1x0 out=1x0 n=8 | 144 -> 150 | 232 -> 238 | 67 -> 73 | 115 -> 121 | 190 -> 196 | 132 -> 138 | 11 -> 17 | 244 -> 250 +v011.crb ok enc=1 in=1x0 out=1x0 n=8 | 3122 -> 3115 | 30 -> 31 | 47182 -> 47183 | 4571 -> 4573 | 1274 -> 1275 | 20700 -> 20703 | 1040 -> 1035 | 6 -> 18446744073709551615 +v012.crb ok enc=1 in=1x0 out=1x0 n=8 | 2030 -> 2035 | 3348 -> 3345 | 1 -> 18446744073709551614 | 27 -> 32 | 997 -> 994 | 18 -> 15 | 1088660112 -> 1088660109 | 3951 -> 3948 +v013.crb ok enc=1 in=1x0 out=1x0 n=8 | 1105 -> 2263040 | 4230139349 -> 8663325386752 | 0 -> 0 | 2646 -> 5419008 | 4081 -> 8357888 | 2505 -> 5130240 | 3592 -> 7356416 | 2946 -> 6033408 +v014.crb ok enc=2 in=1x4 out=1x8 n=8 | 315 -> 317 | 2694176146 -> 2694176148 | 3024937241 -> 3024937243 | 311313056 -> 311313058 | 3963847823 -> 3963847825 | 1719237780 -> 1719237782 | 788439969 -> 788439971 | 14 -> 16 +v015.crb ok enc=1 in=1x0 out=1x0 n=8 | 1348 -> 10752 | 81 -> 616 | 11 -> 56 | 979037772 -> 7832302144 | 3286 -> 26256 | 3999 -> 31960 | 3363558290 -> 26908466288 | 1876873678 -> 15014989392 +v016.crb ok enc=2 in=1x4 out=1x8 n=8 | 3744 -> 3743 | 2973 -> 2964 | 1359 -> 1350 | 3732 -> 3731 | 2748 -> 2739 | 2319 -> 2310 | 1193 -> 1184 | 423 -> 422 +v017.crb ok enc=1 in=1x0 out=1x0 n=8 | 343 -> 210 | 2388 -> 82 | 72 -> 195 | 1144 -> 128 | 2131 -> 66 | 3934 -> 50 | 629596406 -> 39349960 | 481153699 -> 30072301 +v018.crb ok enc=2 in=1x4 out=1x8 n=8 | 2441 -> 2530 | 782859392 -> 3097 | 3416 -> 3377 | 1777 -> 1674 | 796 -> 893 | 3245372790 -> 1303 | 1743 -> 1704 | 1726 -> 1759 +v019.crb ok enc=1 in=1x0 out=1x0 n=8 | 61576 -> 1539400 | 40346 -> 1008650 | 1132 -> 28300 | 21 -> 525 | 19 -> 475 | 1288 -> 32200 | 46797 -> 1169925 | 35899 -> 897475 +v020.crb ok enc=1 in=1x0 out=1x0 n=8 | 20 -> 44 | 29 -> 53 | 2443 -> 2467 | 2 -> 26 | 27 -> 51 | 4370 -> 4394 | 440 -> 464 | 43553 -> 43577 +v021.crb ok enc=1 in=1x0 out=1x0 n=8 | 5 -> 9 | 1049 -> 1045 | 3539 -> 3543 | 1239 -> 1235 | 27644 -> 27640 | 2229 -> 2233 | 1753 -> 1749 | 40462 -> 40458 +v022.crb ok enc=1 in=1x0 out=1x0 n=8 | 85 -> 77 | 150 -> 166 | 202 -> 186 | 69 -> 189 | 0 -> 0 | 92 -> 252 | 204 -> 236 | 30 -> 238 +v023.crb ok enc=1 in=1x0 out=1x0 n=8 | 1978 -> 186 | 4 -> 20 | 23 -> 23 | 615 -> 119 | 1999 -> 223 | 32999 -> 247 | 1133 -> 125 | 502 -> 246 +v024.crb ok enc=1 in=1x0 out=1x0 n=8 | 3741 -> 3739 | 2 -> 2 | 2065 -> 2065 | 2249 -> 2249 | 2591 -> 2591 | 100 -> 100 | 30 -> 30 | 2041 -> 2041 +v025.crb ok enc=1 in=1x0 out=1x0 n=8 | 1477 -> 1479 | 222 -> 222 | 4 -> 4 | 3279 -> 3279 | 576 -> 64 | 8 -> 8 | 2769 -> 2771 | 860 -> 92 +v026.crb ok enc=1 in=1x0 out=1x0 n=8 | 24 -> 120 | 1753 -> 1745 | 469 -> 461 | 3782 -> 18910 | 308 -> 1540 | 21 -> 13 | 9 -> 1 | 27 -> 19 +v027.crb ok enc=1 in=1x0 out=1x0 n=8 | 42 -> 126 | 37982 -> 37976 | 3942 -> 11826 | 22614 -> 67842 | 1014 -> 3042 | 1573 -> 1567 | 1093 -> 1087 | 7 -> 1 +v028.crb ok enc=1 in=2x0 out=1x0 n=8 | 2041 2431 -> 30049 | 899 1998 -> 21584 | 1600 2457 -> 28519 | 1574 1137 -> 16535 | 162 29 -> 915 | 1788 3437 -> 38091 | 1349 3284 -> 34958 | 947 2751 -> 28553 +v029.crb ok enc=1 in=3x0 out=1x0 n=8 | 269 3440 996 -> 28785 | 1667 3806 1797 -> 33912 | 1244 1236 493 -> 11625 | 15 17 2959 -> 3110 | 1953 1647 688 -> 15817 | 4018 2044 1415 -> 21785 | 1233 2978 1886 -> 26943 | 1256 17 1211 -> 2603 +v030.crb ok enc=1 in=4x0 out=1x0 n=8 | 30 20 30 2426 -> 7420 | 1946 2004 1454 2011 -> 14907 | 1 1647 2415 1259 -> 11914 | 1 3139 951 3860 -> 19773 | 19 1857 8 3533 -> 14360 | 3606 1587 3440 1472 -> 18088 | 6 302 3199 31 -> 7113 | 8 30 1804 3628 -> 14572 +v031.crb ok enc=1 in=2x0 out=1x0 n=8 | 22179 2960 -> 153752 | 1017 888 -> 1032 | 2667 30805 -> 225104 | 55007 3032 -> 415800 | 29 181 -> 1216 | 2570 20 -> 20400 | 3606 1868 -> 13904 | 19 3796 -> 30216 +v032.crb ok enc=1 in=2x0 out=1x0 n=8 | 15 171 -> 30210 | 30 140 -> 21180 | 112 245 -> 73997 | 107 299 -> 102474 | 113 891 -> 810666 | 386 16 -> 150860 | 429 117 -> 199914 | 837 230 -> 757737 +v033.crb ok enc=1 in=3x0 out=1x0 n=8 | 13 593 690 -> 838286 | 748 706 171 -> 1100181 | 30 679 1023 -> 1522326 | 562 739 524 -> 1151141 | 28 826 864 -> 1443300 | 24 290 10 -> 87368 | 855 798 115 -> 1395198 | 170 226 858 -> 826172 +v034.crb ok enc=1 in=2x0 out=1x0 n=8 | 4 3273 -> 13112 | 11 623 -> 6901 | 7 1459 -> 10245 | 5 9 -> 69 | 3 1224 -> 3688 | 9 2473 -> 22297 | 2 3999 -> 8010 | 5 2139 -> 10719 +v035.crb ok enc=1 in=2x0 out=1x0 n=8 | 30834 35459 -> 1 | 388 3032 -> 4 | 29 12 -> 1 | 2549 56310 -> 1 | 3365 3147 -> 1 | 1548 1575 -> 9 | 1 3614 -> 1 | 2401 25 -> 1 +v036.crb ok enc=1 in=1x0 out=1x0 n=8 | 3 -> 298 | 10 -> 4893354 | 15 -> 5010795178 | 16 -> 20043180714 | 12 -> 78293674 | 2 -> 74 | 7 -> 76458 | 22 -> 82096868207274 +v037.crb ok enc=1 in=1x0 out=1x0 n=8 | 18 -> 21668995017 | 16 -> 1507527531 | 7 -> 9315 | 2 -> 12 | 11 -> 1924560 | 3 -> 45 | 15 -> 397629405 | 24 -> 64351596007521 +v038.crb ok enc=1 in=1x0 out=1x0 n=8 | 7 -> 53 | 31 -> 965 | 17 -> 293 | 21 -> 445 | 36 -> 1300 | 18 -> 328 | 11 -> 125 | 4 -> 20 +v039.crb ok enc=1 in=1x0 out=1x0 n=8 | 27 -> 0 | 183 -> 1 | 5 -> 0 | 165 -> 1 | 2 -> 1 | 25 -> 0 | 22 -> 0 | 33 -> 1 +v040.crb ok enc=1 in=1x0 out=1x0 n=8 | 2441 -> 0 | 2824 -> 0 | 766 -> 0 | 1658 -> 0 | 1107 -> 0 | 3159 -> 0 | 1 -> 0 | 1863 -> 0 +v041.crb ok enc=1 in=1x0 out=1x0 n=8 | 63370 -> 0 | 3836 -> 2 | 1819 -> 3 | 18 -> 2 | 2203 -> 3 | 3038 -> 2 | 3861 -> 2 | 1728 -> 3 +v042.crb ok enc=1 in=3x0 out=1x0 n=8 | 102 11 230 -> 2960 | 13 26 249 -> 829 | 34 99 26 -> 1496 | 67 77 187 -> 2372 | 154 247 57 -> 5267 | 167 49 51 -> 4596 | 8 252 250 -> 1835 | 13 64 50 -> 820 +v043.crb ok enc=1 in=5x0 out=1x0 n=8 | 217 14 162 235 93 -> 65193 | 237 23 36 120 174 -> 68494 | 7 218 9 3 24 -> 21044 | 46 225 107 180 208 -> 33936 | 140 202 229 91 148 -> 58064 | 203 179 172 92 26 -> 71690 | 4 162 212 17 21 -> 19993 | 73 214 63 189 130 -> 39398 +v044.crb ok enc=1 in=1x0 out=1x0 n=8 | 39 -> 9984 | 2448 -> 36873 | 3593 -> 2318 | 11451 -> 47916 | 3458 -> 33293 | 2 -> 512 | 59922 -> 4842 | 3639 -> 14094 +v045.crb ok enc=1 in=1x0 out=1x0 n=8 | 2039 -> 4144431104 | 3704 -> 2014183424 | 1872 -> 1342636032 | 157 -> 2634022912 | 3689 -> 1762525184 | 2559 -> 4278779904 | 23 -> 385875968 | 30 -> 503316480 +v046.crb ok enc=1 in=1x0 out=1x0 n=8 | 152 -> 25 | 182 -> 109 | 197 -> 163 | 49 -> 140 | 154 -> 89 | 33 -> 132 | 65 -> 130 | 163 -> 197 +v047.crb ok enc=1 in=1x0 out=1x0 n=8 | 10 -> 20480 | 2729 -> 38224 | 38507 -> 54889 | 3083 -> 53296 | 2645 -> 43600 | 0 -> 0 | 2599 -> 58448 | 2138 -> 23056 +v048.crb ok enc=1 in=1x0 out=1x0 n=8 | 3801 -> 40656 | 21475 -> 13285 | 3924 -> 20304 | 18 -> 8208 | 3221 -> 23696 | 27 -> 45072 | 958 -> 58288 | 4016 -> 4016 +v049.crb ok enc=1 in=1x0 out=1x0 n=8 | 1023 -> 11 | 3471 -> 9 | 595 -> 6 | 545 -> 4 | 2714 -> 7 | 1321 -> 6 | 2091 -> 6 | 11 -> 4 +v050.crb ok enc=1 in=1x0 out=1x0 n=8 | 1632244236 -> 13 | 1 -> 4 | 2771 -> 10 | 13 -> 6 | 23 -> 7 | 0 -> 3 | 2530 -> 9 | 493 -> 10 +v051.crb ok enc=1 in=1x0 out=1x0 n=8 | 1028 -> 41 | 2152 -> 37 | 16 -> 16 | 8 -> 8 | 1839 -> 6 | 1519 -> 15 | 15 -> 15 | 1109 -> 28 +v052.crb ok enc=1 in=1x0 out=1x0 n=8 | 9 -> 67 | 3427 -> 441 | 4081 -> 411 | 2561 -> 11 | 676 -> 128 | 13 -> 95 | 409 -> 307 | 8 -> 60 +v053.crb ok enc=1 in=1x0 out=1x0 n=8 | 15 -> 15 | 14 -> 14 | 246 -> 31 | 2057 -> 36 | 11629750 -> 13 | 141 -> 12 | 344 -> 0 | 2229 -> 36 +v054.crb ok enc=1 in=1x0 out=1x0 n=8 | 3275 -> 202 | 3 -> 26 | 23 -> 146 | 4079 -> 162 | 1026 -> 20 | 1607 -> 178 | 9595500 -> 144 | 858 -> 36 +v055.crb ok enc=1 in=1x0 out=1x0 n=8 | 7 -> 1 | 38 -> 2 | 49 -> 1 | 19 -> 1 | 5 -> 2 | 62 -> 1 | 10 -> 2 | 23 -> 1 +v056.crb ok enc=1 in=1x0 out=1x0 n=8 | 309 -> 1 | 231 -> 1 | 851 -> 1 | 611 -> 1 | 920 -> 1 | 107 -> 1 | 311 -> 1 | 153 -> 1 +v057.crb ok enc=1 in=1x0 out=1x0 n=6 | 8 -> 2470 | 3 -> 8 | 11 -> 2470 | 0 -> 3495 | 2 -> 36 | 10 -> 3494 +v058.crb ok enc=1 in=1x0 out=1x0 n=6 | 7 -> 65535 | 12 -> 65535 | 13 -> 65535 | 4 -> 65535 | 14 -> 65535 | 8 -> 65535 +v059.crb ok enc=1 in=1x0 out=1x0 n=8 | 1725 -> 15 | 366998 -> 41 | 642 -> 12 | 1945 -> 19 | 8 -> 8 | 1245 -> 12 | 952 -> 16 | 20 -> 2 +v060.crb ok enc=1 in=1x0 out=1x0 n=8 | 1687 -> 6765 | 180 -> 737 | 921 -> 3701 | 31 -> 141 | 191 -> 781 | 3369 -> 13493 | 55458 -> 221849 | 2991 -> 11981 +v061.crb ok enc=1 in=1x0 out=1x0 n=8 | 2012 -> 6049 | 31 -> 106 | 3752 -> 11269 | 843 -> 2542 | 1963 -> 5902 | 20 -> 73 | 5 -> 28 | 9 -> 40 +v062.crb ok enc=1 in=1x0 out=1x0 n=8 | 938 -> 21858 | 1061 -> 21229 | 3956 -> 22972 | 33168 -> 55128 | 3851 -> 22979 | 1133 -> 21157 | 2997 -> 23933 | 1284 -> 21452 +v063.crb ok enc=1 in=1x0 out=1x0 n=8 | 320 -> 0 | 285 -> 11 | 18 -> 14 | 1150 -> 2 | 3756 -> 4 | 3307 -> 13 | 2268 -> 4 | 1492 -> 12 +v064.crb ok enc=1 in=1x0 out=1x0 n=8 | 2967 -> 14 | 1808 -> 2 | 1581 -> 10 | 1365 -> 10 | 960507066 -> 6 | 642614747 -> 6 | 274 -> 6 | 0 -> 2 +v065.crb ok enc=1 in=1x0 out=1x0 n=8 | 26 -> 27 | 3971 -> 3 | 2941 -> 61 | 844 -> 13 | 2582 -> 23 | 1016 -> 57 | 17 -> 17 | 1820 -> 34 +v066.crb ok enc=1 in=1x0 out=1x0 n=8 | 4 -> 25 | 10 -> 55 | 20 -> 105 | 30 -> 155 | 1 -> 10 | 26 -> 135 | 25 -> 130 | 18 -> 95 +v067.crb ok enc=1 in=1x0 out=1x0 n=8 | 3059 -> 3 | 674 -> 2 | 407 -> 7 | 539 -> 11 | 27 -> 11 | 3971 -> 3 | 4003 -> 3 | 1354 -> 10 +v068.crb ok enc=1 in=1x0 out=1x0 n=8 | 30 -> 153 | 295 -> 1478 | 1 -> 8 | 210 -> 1053 | 24 -> 123 | 16 -> 83 | 361 -> 1808 | 12 -> 63 +v069.crb ok enc=1 in=1x0 out=1x0 n=8 | 1566 -> 150 | 59181 -> 225 | 3081 -> 45 | 30 -> 150 | 3074 -> 10 | 526 -> 70 | 2 -> 10 | 61469 -> 145 +v070.crb ok enc=1 in=1x0 out=1x0 n=8 | 811872346 -> 12388 | 2597952207 -> 39641 | 734800834 -> 11212 | 4131255859 -> 63037 | 2895752335 -> 44185 | 1067597720 -> 16290 | 3448556930 -> 52620 | 3164191887 -> 48281 +v071.crb ok enc=1 in=1x0 out=1x0 n=6 | 4 -> 18446744073709551611 | 2 -> 18446744073709551609 | 0 -> 18446744073709551607 | 1 -> 18446744073709551608 | 5 -> 18446744073709551612 | 3 -> 18446744073709551610 +v072.crb ok enc=1 in=1x0 out=1x0 n=8 | 2 -> 6 | 7 -> 7 | 5 -> 5 | 6 -> 6 | 4 -> 4 | 1 -> 5 | 3 -> 7 | 0 -> 4 +v073.crb ok enc=1 in=1x0 out=1x0 n=8 | 1 -> 7 | 5 -> 11 | 4 -> 10 | 0 -> 6 | 6 -> 12 | 3 -> 9 | 7 -> 13 | 2 -> 8 +v074.crb ok enc=1 in=1x0 out=1x0 n=12 | 1660 -> 1661 | 19608 -> 19609 | 2400 -> 2401 | 3468 -> 3469 | 22 -> 23 | 746 -> 747 | 2694 -> 2711 | 37293 -> 37294 | 212 -> 213 | 1322 -> 1323 | 60908 -> 60909 | 547 -> 548 +v075.crb ok enc=1 in=1x0 out=1x0 n=12 | 2951 -> 5944 | 31 -> 72 | 2636 -> 5314 | 26 -> 62 | 11 -> 64 | 2111 -> 4232 | 117 -> 244 | 2359 -> 4728 | 60722 -> 121454 | 1291 -> 2624 | 24 -> 58 | 14208 -> 28459 +v076.crb ok enc=1 in=1x0 out=1x0 n=2 | 17 -> 11 | 21 -> 15 +v077.crb ok enc=1 in=1x0 out=1x0 n=3 | 23 -> 23 | 10 -> 10 | 9 -> 11 +v078.crb ok enc=1 in=1x0 out=1x0 n=8 | 72 -> 565995 | 148 -> 1416021 | 37 -> 16740236 | 185 -> 6082036 | 232 -> 8375426 | 8 -> 10291487 | 109 -> 5043034 | 105 -> 1000834 +v079.crb ok enc=1 in=1x0 out=1x0 n=8 | 18 -> 29 | 2443 -> 2454 | 710 -> 717 | 9 -> 20 | 275 -> 286 | 3517 -> 3524 | 27008 -> 27015 | 25 -> 36 +v080.crb ok enc=1 in=1x0 out=1x0 n=8 | 6 -> 3 | 4018 -> 4015 | 31 -> 28 | 27 -> 24 | 21752 -> 21749 | 38854 -> 38851 | 2417 -> 2414 | 613 -> 610 +v081.crb ok enc=1 in=1x0 out=1x0 n=8 | 6 -> 12 | 1390 -> 8316 | 3834 -> 22980 | 4052 -> 24288 | 7880 -> 47256 | 45367 -> 272178 | 2418 -> 14484 | 3489 -> 20910 +v082.crb ok enc=1 in=1x0 out=1x0 n=8 | 30 -> 120 | 19 -> 76 | 1174 -> 4696 | 169 -> 676 | 1733 -> 6932 | 13 -> 52 | 25 -> 100 | 3851 -> 15404 +v083.crb ok enc=1 in=1x0 out=1x0 n=8 | 1457 -> 175 | 3129 -> 55 | 2323 -> 17 | 12 -> 10 | 11 -> 9 | 432 -> 174 | 2662 -> 100 | 20215 -> 245 +v084.crb ok enc=1 in=1x0 out=1x0 n=8 | 3453 -> 13828 | 960 -> 3856 | 576 -> 2320 | 3351 -> 13420 | 439 -> 1772 | 26966 -> 107880 | 1795 -> 7196 | 2171 -> 8700 +v085.crb ok enc=1 in=1x0 out=1x0 n=8 | 44 -> 88 | 2840 -> 5680 | 2502 -> 5004 | 3325 -> 6650 | 3681 -> 7362 | 28 -> 56 | 25992 -> 2832 | 31946 -> 6548 +v086.crb ok enc=1 in=1x0 out=1x0 n=8 | 3996 -> 26 | 2394 -> 24 | 380 -> 58 | 19 -> 17 | 1771 -> 41 | 325 -> 3 | 21 -> 19 | 54285 -> 11 +v087.crb ok enc=1 in=1x0 out=1x0 n=8 | 2926 -> 12 | 1396 -> 8 | 789 -> 10 | 406 -> 12 | 24436 -> 8 | 1633 -> 2 | 4061 -> 10 | 3652 -> 8 +v088.crb ok enc=1 in=1x0 out=1x0 n=8 | 31 -> 93 | 2936 -> 8808 | 821 -> 2463 | 3603 -> 10809 | 3096 -> 9288 | 44137 -> 9531 | 3511 -> 10533 | 50783 -> 4893 +v089.crb ok enc=1 in=1x0 out=1x0 n=8 | 59899 -> 2564 | 16128 -> 3849 | 738 -> 747 | 3801 -> 3810 | 2067 -> 2076 | 798 -> 807 | 60492 -> 3157 | 952 -> 961 +v090.crb ok enc=1 in=1x0 out=1x0 n=8 | 1306 -> 2630 | 19910 -> 39838 | 5749 -> 11516 | 18 -> 54 | 1866 -> 3750 | 3908 -> 7834 | 3395 -> 6808 | 2910 -> 5838 +v091.crb ok enc=1 in=1x0 out=1x0 n=8 | 16 -> 20 | 1539 -> 1547 | 2916 -> 2924 | 26 -> 34 | 3 -> 11 | 1766 -> 1770 | 3153 -> 3161 | 1109 -> 1113 +v092.crb ok enc=1 in=1x0 out=1x0 n=8 | 49163 -> 294936 | 2978 -> 17826 | 367 -> 2160 | 22349 -> 134052 | 560 -> 3318 | 29 -> 132 | 2393 -> 14316 | 1836 -> 10974 +v093.crb ok enc=1 in=1x0 out=1x0 n=8 | 3918 -> 93936 | 14 -> 240 | 9 -> 120 | 1598 -> 38256 | 826 -> 19728 | 2595 -> 62184 | 1585 -> 37944 | 34513 -> 828216 +v094.crb ok enc=1 in=1x0 out=1x0 n=8 | 428 -> 174 | 60713 -> 162 | 21706 -> 38 | 7 -> 26 | 12 -> 46 | 27 -> 106 | 43865 -> 98 | 3275 -> 42 +v095.crb ok enc=1 in=1x0 out=1x0 n=8 | 3581 -> 1020 | 9 -> 44 | 19 -> 84 | 2792 -> 936 | 3933 -> 380 | 23 -> 100 | 719 -> 836 | 8 -> 40 +v096.crb ok enc=1 in=1x0 out=1x0 n=8 | 2196 -> 1216 | 19 -> 184 | 0 -> 32 | 3676 -> 4864 | 141 -> 1160 | 2375 -> 2648 | 897 -> 7208 | 3000 -> 7648 +v097.crb ok enc=1 in=1x0 out=1x0 n=8 | 29 -> 56 | 22 -> 42 | 41 -> 16 | 1 -> 0 | 3330 -> 2 | 3139 -> 4 | 14970 -> 50 | 3766 -> 42 +v098.crb ok enc=1 in=1x0 out=1x0 n=8 | 5 -> 6 | 1913 -> 14 | 19769 -> 14 | 2026 -> 0 | 361 -> 14 | 205 -> 6 | 3907 -> 2 | 2101 -> 6 +v099.crb ok enc=1 in=1x0 out=1x0 n=8 | 2994 -> 12 | 19 -> 18 | 1379 -> 18 | 31353 -> 6 | 8 -> 0 | 1 -> 6 | 22 -> 36 | 41698 -> 12 +v100.crb ok enc=1 in=1x0 out=1x0 n=8 | 3613 -> 2656 | 43273 -> 2852 | 3687 -> 2878 | 65461 -> 3880 | 2369 -> 3020 | 2492 -> 3389 | 3966 -> 3715 | 3625 -> 2692 +v101.crb ok enc=1 in=1x0 out=1x0 n=8 | 3839 -> 7714 | 1979 -> 3994 | 901 -> 1838 | 55990 -> 5520 | 179 -> 394 | 1240 -> 2516 | 211 -> 458 | 642 -> 1320 +v102.crb ok enc=1 in=1x0 out=1x0 n=8 | 1029 -> 2087 | 23 -> 71 | 3475 -> 6975 | 39 -> 103 | 1902 -> 3829 | 298 -> 621 | 2762 -> 5549 | 13953 -> 27935 +v103.crb ok enc=1 in=1x0 out=1x0 n=8 | 48425 -> 290592 | 3576 -> 21474 | 43529 -> 261216 | 2426 -> 14598 | 2939 -> 17676 | 1508 -> 9090 | 31592 -> 189570 | 8 -> 66 +v104.crb ok enc=1 in=1x0 out=1x0 n=8 | 1500 -> 5988 | 21102 -> 84396 | 20 -> 68 | 966 -> 3852 | 3743 -> 14960 | 2654 -> 10604 | 1041 -> 4152 | 4086 -> 16332 +v105.crb ok enc=1 in=1x0 out=1x0 n=8 | 1 -> 236 | 1462 -> 42 | 578 -> 114 | 652 -> 46 | 17036 -> 46 | 305 -> 12 | 1553 -> 76 | 1901 -> 116 +v106.crb ok enc=1 in=1x0 out=1x0 n=8 | 1201 -> 19232 | 58 -> 944 | 1415 -> 22656 | 20 -> 336 | 46837 -> 749408 | 3474 -> 55600 | 7 -> 128 | 49942 -> 799088 +v107.crb ok enc=1 in=1x0 out=1x0 n=8 | 692 -> 356 | 3309 -> 470 | 36582 -> 456 | 5 -> 6 | 63668 -> 356 | 732 -> 436 | 18 -> 32 | 1164 -> 276 +v108.crb ok enc=1 in=1x0 out=1x0 n=8 | 4041 -> 50 | 887 -> 42 | 8 -> 46 | 3431 -> 42 | 88 -> 46 | 3996 -> 62 | 2592 -> 14 | 18 -> 22 +v109.crb ok enc=1 in=1x0 out=1x0 n=8 | 568 -> 0 | 3864 -> 0 | 3981 -> 4 | 3940 -> 0 | 45006 -> 8 | 2613 -> 4 | 2036 -> 0 | 1951 -> 12 +v110.crb ok enc=1 in=1x0 out=1x0 n=8 | 46448 -> 138 | 2035 -> 147 | 3816 -> 114 | 1273 -> 165 | 30 -> 84 | 3057 -> 141 | 2508 -> 30 | 3401 -> 21 +v111.crb ok enc=1 in=1x0 out=1x0 n=8 | 1886 -> 21 | 18054 -> 21 | 4081 -> 11 | 2155 -> 15 | 23 -> 23 | 37102 -> 21 | 4050 -> 13 | 1483 -> 15 +v112.crb ok enc=1 in=1x0 out=1x0 n=8 | 3659 -> 21972 | 289 -> 1752 | 63772 -> 14010 | 2307 -> 13860 | 16196 -> 23466 | 33371 -> 3636 | 750 -> 4518 | 2868 -> 17226 +v113.crb ok enc=1 in=1x0 out=1x0 n=8 | 24 -> 44 | 66 -> 86 | 31984 -> 3332 | 32226 -> 3574 | 20112 -> 3748 | 19 -> 39 | 883 -> 903 | 190 -> 206 +v114.crb ok enc=1 in=1x0 out=1x0 n=8 | 17469 -> 34953 | 1811 -> 3637 | 14308 -> 28631 | 2219 -> 4453 | 41673 -> 83361 | 3987 -> 7989 | 2 -> 19 | 7715 -> 15445 +v115.crb ok enc=1 in=1x0 out=1x0 n=8 | 231 -> 1386 | 3121 -> 18750 | 3890 -> 23364 | 3461 -> 20766 | 3396 -> 20400 | 373 -> 2238 | 64663 -> 387978 | 24334 -> 146004 +v116.crb ok enc=1 in=1x0 out=1x0 n=8 | 170 -> 680 | 29866 -> 680 | 630 -> 872 | 2975 -> 504 | 3104 -> 520 | 25708 -> 712 | 21 -> 344 | 30 -> 488 +v117.crb ok enc=1 in=1x0 out=1x0 n=8 | 2136 -> 12 | 1266 -> 4 | 3231 -> 8 | 1950 -> 4 | 1 -> 0 | 3363 -> 8 | 3 -> 8 | 1491 -> 8 +v118.crb ok enc=1 in=1x0 out=1x0 n=8 | 923 -> 5574 | 2818 -> 560 | 1697 -> 2026 | 2602 -> 7456 | 4095 -> 8222 | 1694 -> 2008 | 5566 -> 664 | 1364 -> 8220 +v119.crb ok enc=1 in=1x0 out=1x0 n=8 | 2133 -> 736 | 1809 -> 6368 | 1516 -> 4024 | 48549 -> 3424 | 38500 -> 4984 | 31 -> 304 | 5 -> 96 | 29913 -> 1824 +v120.crb ok enc=1 in=1x0 out=1x0 n=8 | 15 -> 8 | 12 -> 5 | 500 -> 45 | 11831 -> 48 | 1006 -> 39 | 1 -> 58 | 3986 -> 11 | 2943 -> 56 +v121.crb ok enc=1 in=1x0 out=1x0 n=8 | 8819 -> 0 | 3054 -> 0 | 1813 -> 0 | 2645 -> 0 | 2223 -> 0 | 2628 -> 0 | 0 -> 0 | 3205 -> 0 +v122.crb ok enc=1 in=1x0 out=1x0 n=8 | 11904 -> 133 | 17271 -> 106 | 3810 -> 171 | 15476 -> 101 | 241 -> 220 | 4 -> 21 | 2323 -> 66 | 8 -> 29 diff --git a/tests/crumbline/vectors/v001.crb b/tests/crumbline/vectors/v001.crb new file mode 100644 index 0000000000000000000000000000000000000000..8b8f9a5066037deb355757de9e99170b68b11834 GIT binary patch literal 124 zcmXAh%MHLV2t!GG={T`Ve%E$`?mtYy5rQW@1Ml~sSX42)%b8ctbXsn9Mdq&gAIP7e1~l%nP38{)q6@qL literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v006.crb b/tests/crumbline/vectors/v006.crb new file mode 100644 index 0000000000000000000000000000000000000000..9796338ef97da61d54a1893178167661d47b2fde GIT binary patch literal 148 zcmYj|%MpMu2t|XvlV_*e i$ZFRTcOX@C4^^W_4S{ahwvM(1!{78u&nz#B0gs4C@aaM&oo9#v}AvjAGF3eVI6naKw&wh?Ur literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v010.crb b/tests/crumbline/vectors/v010.crb new file mode 100644 index 0000000000000000000000000000000000000000..52062a8f8b62048be37532f58f6702c6becf86e3 GIT binary patch literal 124 zcmXAh(Gh?!2t%pIGb}9YuXb?#7jv*`2+X|XC0xIgi{vaKn}~dJ8&&V5uf>>` u-|Q9~`j%FfdGN`})Ue`AFHsS|TW$k}X`p$&mA;og%zBt1THtVJr~d(i%@ElD literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v012.crb b/tests/crumbline/vectors/v012.crb new file mode 100644 index 0000000000000000000000000000000000000000..3662f3184a2a20006ebe4b4455b105374e826e42 GIT binary patch literal 159 zcmYj~K@NmK2m~4Ru<`6e=m7?}x&5pofE literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v013.crb b/tests/crumbline/vectors/v013.crb new file mode 100644 index 0000000000000000000000000000000000000000..1f92b479b8a6d85847525b2da28b5fbf38ebce92 GIT binary patch literal 171 zcmX9%(Fp@l2=k!OQs^$xsOS5=ZqWUQslG!r8j|?^U3y5@A@UNDN4F~C*=Ux88mnH3s#zulnYFu4LGyAL_Lc ziXp0lfoEf7iD#z0nk3y^O!uA=H)2W*7C42f8o{+7lXr(l&`RECu7n#fa!h4{=}3;L JA-ap@Wq)pm6>R_j literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v016.crb b/tests/crumbline/vectors/v016.crb new file mode 100644 index 0000000000000000000000000000000000000000..3d2d4ba4ca766d2e663ee0411dea279120708110 GIT binary patch literal 176 zcmYj~I|_g>5Cz{#6hEM6@d^sIf>$%Gm`bs>^>Dt&S~!qQGHl4W480+PStv^Yfh)Cu w&O0sCw#Hkeh1#5Zn`ogHzqjk}?Nj^QO$*I+mA8TxY8N;Cn{*-4Y2FT6yu$FgKp@bKkLyMnk*se&IO`?;n}@_>SeC@0P4dJmjD0& literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v018.crb b/tests/crumbline/vectors/v018.crb new file mode 100644 index 0000000000000000000000000000000000000000..dcb4510eb63fac88022d781517dcd9b9b38bbb4c GIT binary patch literal 176 zcmZ<`ax!FOU}9ioWZ~doU|?VY;!aKm1`zuZkOl#eSVPT9J&>3r4@d+e7QqWqX9%QW tVjtNcVqHKQCMLrS5vv8#FtM`If`cIQ#90wy=b?I6AnDx)6}t}=0|1K)4I}^n literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v019.crb b/tests/crumbline/vectors/v019.crb new file mode 100644 index 0000000000000000000000000000000000000000..28fee31a4d5b78868742c63fdb9b701ae8e3a3ac GIT binary patch literal 155 zcmXX<*A2r!2*q|>#-SYTH`&1Z4`aAk2=p58yT7zR)dFwnZf5~f$${9~KpB4x wF--B(HVL=KA&6@O+G;9m6UrvTbw)X&qr&{&Gf$sC$TC@{sgZe9D$;B30l&TwrvLx| literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v020.crb b/tests/crumbline/vectors/v020.crb new file mode 100644 index 0000000000000000000000000000000000000000..cb9e2c70eca1f74dfa659ca6280ba4a88db741f2 GIT binary patch literal 127 zcmXYn%MHLV2t%EIq>e*^6O?PaLH8e~KqG{0@O$377Wfq40qZw bM@wL&T4FUYs>$z@d)$1APPy;{X5v literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v022.crb b/tests/crumbline/vectors/v022.crb new file mode 100644 index 0000000000000000000000000000000000000000..cf6429dc4206cb54013a172221926fcd0a30a805 GIT binary patch literal 119 zcmXAh(Gh?!2t!l-aU4o5gu=J5JTs*5B<0yZ>RPb}>K@c;1@|{0eXZI2>eS?x9oti?%s&O_s%x eD)lUpt&Le&W;tDi?e}eDOd{Fl9QDdsZu$Y1SPKUL literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v024.crb b/tests/crumbline/vectors/v024.crb new file mode 100644 index 0000000000000000000000000000000000000000..be54a0e0cfdc110b4730b02099d099029d043f8d GIT binary patch literal 132 zcmZ<`ax!FO076Cv1`Y-W1{NSTHa9VZ(8iWPVFn{G0TMAXFf&D=jZ7@Td>CzN3D#)@ bq?v*04Gj#S6cfl?0|*H*0b+-dfr%ji=1mKx literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v025.crb b/tests/crumbline/vectors/v025.crb new file mode 100644 index 0000000000000000000000000000000000000000..c7ba033e609f432a806a2489f425aebd503f3c34 GIT binary patch literal 124 zcmXxaQ4WAG2m{bg{qQ(aC*6Ma2HyWL!ZJgkA$`w#TR}_#b^u$fRcU5l<0m;I5b8MD bpH%-d!6jcJe2A8;Wli~Dlq^~EBU$GMbbty~ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v026.crb b/tests/crumbline/vectors/v026.crb new file mode 100644 index 0000000000000000000000000000000000000000..e8f1b3c35980a9d3250be5ed86f3ce3c9f78bccf GIT binary patch literal 125 zcmXAh*$Kcf3`3nB&~bdFiGSM-y8ke>9E>IO5PH8y8s#;ji-@*-^*vRT57_9o+&i$} eu}na1Og+(>Aq;LjtKFSzN}yu7P64T`qiFn<018?F literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v027.crb b/tests/crumbline/vectors/v027.crb new file mode 100644 index 0000000000000000000000000000000000000000..e9bc7cfb6556ff5a32df5b1f5abdc45d133fcf80 GIT binary patch literal 140 zcmXYq%MHLV2t!FfQpbr20dj3O=>Ef$kP2b2c@ociqfk^Kx`=3t7T!a_dd6rrod3o2 ln8}a~0AC2RLMEc-!V^J-BwBypt!3WT)_p8r-QqE&-~*Q>22d4GmebRa|2%HD}XGuxZXvz?72t@s*M9L+Llm;ll!(!l?bddgw3FaSI#K2>|zYmUajLR{`ZH#fRkV!mg zXXSONfh*5@0@2- P*23x}*VHI)rr7O25lI%G literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v032.crb b/tests/crumbline/vectors/v032.crb new file mode 100644 index 0000000000000000000000000000000000000000..79e42089be76ed1c65993c69017deec89b4cb786 GIT binary patch literal 178 zcmXAj%MC*@2n2DYe9E8%7Hk98ybfOf#l(;U(rUCj;<~>WH0UviK1B37hsAI_Pcl(R zArr=wLJEYus|979tC(A+Hxp;gY>DXf`7atrqF_Mw-YtyH=!7M)+c-5D@Lp#odL4F@ K)=&6yH~#^)niR7D literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v033.crb b/tests/crumbline/vectors/v033.crb new file mode 100644 index 0000000000000000000000000000000000000000..fe161b83ff1eca3960430ae2b795403448b301aa GIT binary patch literal 216 zcmXAj$qhq62t)abvNu5q7>4bdbddgw$;|u%64t{u-`@uZ9dtQ}9z^t-17mOFXt_;Q zR$B3%TaMzCU?lGA3?e8jV#1Nl5VcKQ)pUD2l+&7B$LVokV6|v*X>i2}#xN6kE-+YI gX4rL#N{d<*<<8l~fbSq{M{j}@)|KS7|J6Y1A5*d%3jhEB literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v034.crb b/tests/crumbline/vectors/v034.crb new file mode 100644 index 0000000000000000000000000000000000000000..82839775f1061dfa80879a374bbefacadab2e7fe GIT binary patch literal 159 zcmXYp%MHUY3`6BKEi#5iFe&+?YqLT2A0}4Xg8<_3iRbl2ks@0WIYi{M&eb^Vy%G#y zB0xKBU#Uk$lA-Vxk5uXHwNTU89wU2Gke(mb=S&hx|ILz&k%(#$k{OE%Ocp~-r-Y8P!QAFM%a!#=hn$pc< zQbBT#p{#5PY@60Xu@a6#cNJx4Xgaf0*eTV!$s6e!h<^RI?DhiD<2r`z%#)zcaxS z6Z+8>IG}-1C8F3$atQj+nfj}|I-6>6Zf~?_m$Yjx7 aM2ol=v2l@G@8vCermISMqQTG3i}oMy=?JO- literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v039.crb b/tests/crumbline/vectors/v039.crb new file mode 100644 index 0000000000000000000000000000000000000000..8bbb1277f375568c52083da0f27a63bbed5e9294 GIT binary patch literal 104 zcmZ<`ax!FO076Cv1`Y-W1|}djG6!-P448q0p@lJs4OGIwV2Thm1GB-RMqqicHi!Z+ N6D(=~Vj4pX002Z=1?m6* literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v040.crb b/tests/crumbline/vectors/v040.crb new file mode 100644 index 0000000000000000000000000000000000000000..f68ef79dd4554d35b78cf0388e6a9d0b4cec6ec1 GIT binary patch literal 116 zcmZ<`ax!FO076Cv1`Y-W1{NSTGBE*)F)$c_ITl7HU=A}-#N5mbE@5b9YJuPw8koa5 U#)hVrU=D~tm}F>SW(*bv0P;!*X#fBK literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v041.crb b/tests/crumbline/vectors/v041.crb new file mode 100644 index 0000000000000000000000000000000000000000..9196a75ba5fd4920cc26e59ab641678a0baee8ce GIT binary patch literal 119 zcmX|)VG4jy2!r>cpyQ|mpZ%>HbpOMoLXY9#+ZaCYtplk6oB)nIC#NJs_A~~)zzQ_< YD&W?zax-D)y%5G~7@iOQ`Lu5M0UkRE82|tP literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v042.crb b/tests/crumbline/vectors/v042.crb new file mode 100644 index 0000000000000000000000000000000000000000..b557d70daee251b916f67af2940bebf63472c2c7 GIT binary patch literal 182 zcmXAi%Mk)G3`3n+4nP$uA$I(Uuh0Sg7lWNW=pfCL^! z>GRd;f;dF;DzhbfcJz8sTj_H5~ zG!5n*s+? ytx(GNjr)|09V*VK;uwlsxy(be_I9|t0qR4o z)Q3{xXmcKlE)K;8X{pBBTv6vW&6Ql>5o8}NDj5v)5isH(#_FoI)UOj_&poZ9D^~U( L(?OwTNN@cC&*T=* literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v046.crb b/tests/crumbline/vectors/v046.crb new file mode 100644 index 0000000000000000000000000000000000000000..0a869c72af82aa7950b9d75f16eb036cb48162a4 GIT binary patch literal 123 zcmXAh$qm3T2n2ERNjWx`&DZH5{TCCn2*HQ}?fdP~=u{(mi0D2&jIRSWEQ^62Kuo|T YKeU{7IMZ}1a*99+g1myH-n>pRe^BBH@&Et; literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v047.crb b/tests/crumbline/vectors/v047.crb new file mode 100644 index 0000000000000000000000000000000000000000..f1d8f4082f12a5b5324891388ffb09e9b6d1d0c5 GIT binary patch literal 144 zcmXAh-3@>+2!yH8#BnHpg;(9c{f7}~2$##paqsuc0XYNU27n`X;+0A$j%S%gQGlID owozPVRNSK?jLr?1!urQV3kVxxR>PJ)X>^^sh&Pz*l_f^CAKe!YT>t<8 literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v048.crb b/tests/crumbline/vectors/v048.crb new file mode 100644 index 0000000000000000000000000000000000000000..3fa683ad35afeee57f209c9f481222b27947832e GIT binary patch literal 146 zcmW+u+YP`#2(quF<0wAP`)xPq{=@V%#sGr6-y<8X*@$i;I@fBlTnmlEqX@)?7ZF8z oM<%QtR<^yItaE}J73c#uI${=-PCf literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v051.crb b/tests/crumbline/vectors/v051.crb new file mode 100644 index 0000000000000000000000000000000000000000..3e3f4934540504031d22fdc22f2cd2e4fb313022 GIT binary patch literal 119 zcmYj|!3}^g3|6v4|D+BSCp2 dbe}~dHFC(B-Ycvbrm;X0)GYp^mngD6@dZ+{3Jm}N literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v054.crb b/tests/crumbline/vectors/v054.crb new file mode 100644 index 0000000000000000000000000000000000000000..b892efbbef22d658fe88488147be4efb8b38d83e GIT binary patch literal 130 zcmXX;+YNv)2*gLC<6NOY`>Pwc|1bg?0>?ezey+Aq)IxL;(H<@Ax&<;gRFXA!t0}3s hZW-(FS=2ab!=FJhgO};!2y^OG1-|Q^Fm&Wcu@|yf3uOQR literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v055.crb b/tests/crumbline/vectors/v055.crb new file mode 100644 index 0000000000000000000000000000000000000000..d7b2be3d25e31d1f584ee4e200991fc23a19e44d GIT binary patch literal 102 zcmZ<`ax!FO076Cv1`Y-WAd7*)97Gs00SRLZ5Yq_6G_iz>8bX*LzA0SZ%m^WG02ehf H28#j!CnyDy literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v056.crb b/tests/crumbline/vectors/v056.crb new file mode 100644 index 0000000000000000000000000000000000000000..61a7aaeb0833b651b940ac88766bbea3a28ae44a GIT binary patch literal 112 zcmZ<`ax!FO076Cv1`Y-W24)~OHn0Tp7z{ydBV(X6lx<;(V4E2t*p@~Ha5aVo=5V$# Lk{Ux(W3V^?t276O literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v057.crb b/tests/crumbline/vectors/v057.crb new file mode 100644 index 0000000000000000000000000000000000000000..88dad986d7a4d3d3af3dcc19398749dcbd75522c GIT binary patch literal 91 zcmZ<`ax!FO076Cv1~vu;Ad7*)f(1wznV1`ZIL2TRCLqhu5Lw&+#4$FpGzG~Uf#i+N Jz^Y&pCIB9C2BH7} literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v058.crb b/tests/crumbline/vectors/v058.crb new file mode 100644 index 0000000000000000000000000000000000000000..7d6a72e301d141c1ccbd1c5ed32765bb61b4e189 GIT binary patch literal 103 zcmZ<`ax!FO076Cv1~vu;Ad7*)oE1oznVK4#G65NeMyOn4I2WYW1kMAiMQ}lq7H~-b DyKf0O literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v059.crb b/tests/crumbline/vectors/v059.crb new file mode 100644 index 0000000000000000000000000000000000000000..a5c266d15a99293795cb7d7ee5a91020662f350e GIT binary patch literal 121 zcmXYoQ4WAG2tzwH#^a2-;rP`Xc>lu)%n;g8`kwce0-pjL05)H_*q89WyPm3MBkm@v ct2XA7S+zE+<~&A9=KOO8VtpbSAZxVv0a}y^mjD0& literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v060.crb b/tests/crumbline/vectors/v060.crb new file mode 100644 index 0000000000000000000000000000000000000000..087224f3814774a71dd0744fb42e034b1da43aec GIT binary patch literal 141 zcmXAh+YP`l2m?u9>NqhZ0e;&Jy8keRLDbsO*iQN!xRw0mt?=+rU7{a-~oUupOLuOQR7G!Iui-KLYc;Q fSz?dMmr9pRyF}sbEs(3sSU4s3!8%wadsy)YzQ78? literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v062.crb b/tests/crumbline/vectors/v062.crb new file mode 100644 index 0000000000000000000000000000000000000000..64802fa5c231fe51cee0d017dec9b08f18fcc4ea GIT binary patch literal 152 zcmXAi(G9~u2t$dQN*$-R!yWvl8+89+!f`?f>&Z61|Bb_H4zrJ$y=qhOu0w>!SpwgI r4ai(T>7xO2atR5eGwxt#6uvWM=?oz468Kyt%$yCBQomtb+i^J`fcp>% literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v063.crb b/tests/crumbline/vectors/v063.crb new file mode 100644 index 0000000000000000000000000000000000000000..c2a285cbc09f5354e0f8e591ada727db8b0dc92f GIT binary patch literal 120 zcmX|&%MpM;2t%{#!E%{TCzT;4lQj3(tF7K~w=w0DH8vhC|Jrt8X#Pq)XZk aUAj_C UtjHLm!xX{+8)9eyQe|lh0JPBu_y7O^ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v067.crb b/tests/crumbline/vectors/v067.crb new file mode 100644 index 0000000000000000000000000000000000000000..16f95ab4cc569fa4932dd513dae5faab07f11859 GIT binary patch literal 118 zcmX|(Q4WAG2tzyd!{fjJ$$sYzy#HY=GcknrHKE+k)CNuiP5=kjBnBgFr(Eg9z1Ss- bvp8&QG}Y3cAFuXEeq_6Xi`XC3!q=U={~!qA literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v068.crb b/tests/crumbline/vectors/v068.crb new file mode 100644 index 0000000000000000000000000000000000000000..e61b144cf8b6554078d78614c30cabd37a238ac7 GIT binary patch literal 121 zcmW+u$q|4+2+OJu%OS9=_|*>VzZijG2$PHVdpM9YfD^!$YqBTOt&ZM)6q{FM1Q`aR b4N4p0RwbQX(k5IbML)2`&V@vY)WT&yE!hcp literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v069.crb b/tests/crumbline/vectors/v069.crb new file mode 100644 index 0000000000000000000000000000000000000000..dcc18181b6bba6bfb9513f9cedaab5a998591905 GIT binary patch literal 128 zcmXX;$qm3T2y=Q!9R~=Iyp{gwvYMvIQ#A1;jiMW}^el8%AM;D?1GKUV<^TWy literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v070.crb b/tests/crumbline/vectors/v070.crb new file mode 100644 index 0000000000000000000000000000000000000000..f1fa699e5e35ac1cdc65d95aada3df3fc8393db1 GIT binary patch literal 198 zcmXAjOAbOo2n6RXOw`lRe4Fj_2HyWL4r2%jR5}Hp?~QBiy4HHGwO+dku+%&sdx0AH z-h)P0hpNvT-G%qc?i6NW-3>@a8qqX(yn)p4++Ld{~ZI~ao@S=(MJN0Qny*xVVB SZ3l;@{xSCH26-NFD)9q!=^3N| literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v071.crb b/tests/crumbline/vectors/v071.crb new file mode 100644 index 0000000000000000000000000000000000000000..3bdd952e150b139147f4f26aa6df7f8a37629869 GIT binary patch literal 190 zcmZ|F!41GL2m?Up(+N5VP9P-Tc7yIeOyM77$+C2QzlRNx23$ZaK<_9n)#<9@!)2Rs YGLAq$qwGW}&=XnUO0+YwCyoN;2V!I!L;wH) literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v072.crb b/tests/crumbline/vectors/v072.crb new file mode 100644 index 0000000000000000000000000000000000000000..dfd26b4a83cee1b34602a60b9d7cb1bc38b337a0 GIT binary patch literal 96 zcmZ<`ax!FO076Cv1`Y-WAd7*)2t=5H2y-}L3Sxl?umqSe0f~VLpb=16W4I0juq*)R C5Cm-i literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v073.crb b/tests/crumbline/vectors/v073.crb new file mode 100644 index 0000000000000000000000000000000000000000..a3b12901e01cb98691081380d985a3e8ac8cb312 GIT binary patch literal 100 zcmW-W!3}^g48$B>j8iCW;Y&B@{=+nPie&kmx&AB23pgPSGQbepq3Qiti>lFO-SL)I L;S+|Vw?FR&4>1KT literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v074.crb b/tests/crumbline/vectors/v074.crb new file mode 100644 index 0000000000000000000000000000000000000000..defd0a91e6b6f98d712710209a1545b948c7c2a7 GIT binary patch literal 204 zcmXwzOA^E&2nER`vzx=nCm`G82D$%X;zOq_?MKm2-p|Dwjk6K`i0BxX-P^2t(=oR&$uz0aCUzH|YHj)8GnWM|w}>fBvx9n$7HMX0NrZKzEe;WA#Ai zq*#s=8xUhQOLjtDx;#KPoP$rX*+swUh-%9xkN4`_C;4fO@Q?zQ4lsFtqzvhB?t1X> Fs0)2M5-ZNm_qGwriKBe+6~`R5b*#2 literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v079.crb b/tests/crumbline/vectors/v079.crb new file mode 100644 index 0000000000000000000000000000000000000000..0c96316d68fd19f2e000362d83bf8698c5a49a04 GIT binary patch literal 129 zcmXX-$qm3T2y=Q!9VZY7$+z90`wvqf6~YD|&wEpWPXR6fn=g$(o=2caTdcDCZ&VkV e7ceuJ3Y&((qer|c*YWb- literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v082.crb b/tests/crumbline/vectors/v082.crb new file mode 100644 index 0000000000000000000000000000000000000000..c20049c63d1f56c4abe2d4dbffb5ec9ea1515949 GIT binary patch literal 129 zcmXYoSq^|e2t#p8JPr)Y$gkeO`yWP1456>2<#}&esAeHLiD<1=-b!UK4oT>Y9bTq^ g78zZM1maJpD$+ck7G|F$gLH8e~K!iB!gz)=4+7Q!#3&0Vp-N&9eJk^wQi}W%Y fElo#}MJYxRF!Qq;S3%DL-uF_GGgYXbXLkPqiwp{< literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v084.crb b/tests/crumbline/vectors/v084.crb new file mode 100644 index 0000000000000000000000000000000000000000..e931299fbfcbe8fd576cceef1b83d02b8de0da18 GIT binary patch literal 146 zcmXAh*$sd|2t?U<#Bw;6>sLFl|6&9;guuKRc;1@^R1JU&0QPE`Do0I{;Mi(O!=Hy* qOLc3>!V8PiiciM&r)2x&&du4<>}-G@@t=^VcEl;yD{^Wbj`#ulDGtp5 literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v085.crb b/tests/crumbline/vectors/v085.crb new file mode 100644 index 0000000000000000000000000000000000000000..25cc32db7c0efbfce2495fb7c8ae6d4dea400a4c GIT binary patch literal 138 zcmW-Z-3@?12!qjR;y4_C_Fi=Z_aDY9A@rk=@_x_QWYs2eiO9Y>f(jf<4WVQfnwDzq jRfBZ5B&)LTUKsSZm+^~%nssu{IXi4{U0KvN(T)o literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v086.crb b/tests/crumbline/vectors/v086.crb new file mode 100644 index 0000000000000000000000000000000000000000..83b558c54f1569c9a1e8c18d5f7de4493e0a02a9 GIT binary patch literal 122 zcmW-Z*$u!j2t!E^spHfHlJMJZ(EW!gMu_7X!}~pGlF>vi5jiq@#MrXyAZZUPvYoqi e6MV5Es!rN4CrE~}spmuKRJ3%&nX{WNuOs|V*$K@6 literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v087.crb b/tests/crumbline/vectors/v087.crb new file mode 100644 index 0000000000000000000000000000000000000000..0f022695a38c7708f08d174cb041e4b75f607d7b GIT binary patch literal 123 zcmXYpT@HXS2!lI+5|1-r;`XXH@cxIfFhhVe?bqkMrGQg_1Hi`Bp}z2oh7uc26Mf~m f`bejSX!Vcn6xy22TtaRZP&P0plM2iH)a?5JTyzQb literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v088.crb b/tests/crumbline/vectors/v088.crb new file mode 100644 index 0000000000000000000000000000000000000000..d7f31f44e0d1bb964103c6a188edaf63cf7b03ed GIT binary patch literal 143 zcmXAh%MHLV2t!FfQpbUqByepv=>EeLs1UZ~hk4#x8pSlCi-@*ZNUGxq?T(pl#2PQ`wt_~5OT=j!uvfmAZq~J0B~im@Q5=9UMeL>iM_;h li6d##8)DlcZ4&kwYI{c0jzy;(t)3}LaK~v`tz&UR=?A>X4eI~^ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v090.crb b/tests/crumbline/vectors/v090.crb new file mode 100644 index 0000000000000000000000000000000000000000..ea7f3629888f8fdb822feb621b406c04d54fe89a GIT binary patch literal 143 zcmX9$+YNv~2;+<Wi1u7Xl(6fWV$)gL8_I)y f+Lj=Z9r8l-gHf!_@UBd&ib~jB*@`2tz}qQ)kD&^n literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v095.crb b/tests/crumbline/vectors/v095.crb new file mode 100644 index 0000000000000000000000000000000000000000..7c53c8d1713c323c2c36bf2d7696172ad362d72c GIT binary patch literal 123 zcmW+u$q|4+2+OJu%i&m8_-Y6CUyOudAS8jj-=hOn12_R3)qaH%RZL1oZZ+oQ)ZSy# dwmWU7?W@1iozz2kX-!mw+O0_lU(AcnlOJJt3IYHC literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v096.crb b/tests/crumbline/vectors/v096.crb new file mode 100644 index 0000000000000000000000000000000000000000..6a9dd43f0d1c16a3c4d9f1c3d373e17c4dbb2307 GIT binary patch literal 134 zcmW-Z$q|4+2n6wX7!H@fel-L04@QRCf-ab5-|vx)`fWrP5uIHsD?m|+9b5-`c{{|| im?F2x@w~#vaG5g+o^LGgVR#{~l^9dGKw};)JN^OuqYOs? literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v097.crb b/tests/crumbline/vectors/v097.crb new file mode 100644 index 0000000000000000000000000000000000000000..6ee37a2886b0866b27fbf4f66d62c60876086ea4 GIT binary patch literal 117 zcmXAh-3h=z2!nH_g^uH2J$$`x(EW$0dPqJJhoMx@`Vl9e;Azhfg(AveB^m=ZQwNE0C)jcL2Lv~^`-W?57r|m bEz!iHoU#%;bSgzm{t8d&<+2e`;Ww6l6CVi_ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v099.crb b/tests/crumbline/vectors/v099.crb new file mode 100644 index 0000000000000000000000000000000000000000..c7d93a024ab6b057d25aa2b029d17c7ca6629d28 GIT binary patch literal 117 zcmXYp(G7q=2t#{D6UPxa@%TMAaQ|T}Xb6uKXzyoA1FHc$fR(Kgec==>Msegt?E2M4 bWn!n%2TzQ|kzgQq>C#Ft&+jfCA3;gN^?mvtzgpiZ_dcTJUts6ua5gqFlteXPExj0q4jWFp# icoo897hn@yLBw5wB1_-WdS(wb+E1WzXDdRAf|MT))(+tS literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v101.crb b/tests/crumbline/vectors/v101.crb new file mode 100644 index 0000000000000000000000000000000000000000..e295a80bb782abd9a187052622c282e7d84e9b36 GIT binary patch literal 139 zcmXAh+YNv~2n4yPiRBzGx&74+?7tWRL&#)j1J8T&pqxQ;649QkOHqtqD>9<90=8ww lEerMhHJ-9^gW`wvr`2nk=vyx*fma*D_$l1xPRT;@2)8*EE#Ml<># fs5Sy(ML6m8>X?^c<~1nPW=Vuo^;LP-`9T#wbU+G+ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v106.crb b/tests/crumbline/vectors/v106.crb new file mode 100644 index 0000000000000000000000000000000000000000..deac6aa1927590045d2f41d33c2895a93f4a8445 GIT binary patch literal 143 zcmW-a+YQ4|2t!GmR2hed;lgjaLH8e~aD~7Y$B6Imk%PJpqML}$Zc&zNwAA#~#`E2? tfK4GjR5d(?Di1Y_*&@=`r_Dlva}Ep(gWQ9;-_V-8XzqL!bmyx$^AE7=4mtn; literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v107.crb b/tests/crumbline/vectors/v107.crb new file mode 100644 index 0000000000000000000000000000000000000000..6d96549dfe85202f37acb8c05ab85c9c5bf2a439 GIT binary patch literal 128 zcmXX;TMmFQ2xC4Hk2A*T*stEe`yWQChR~+zOA5d+2t+6SK#!x*h;Gvx^!|sbanT|Q<9p2gOm4_&zy)B>9p;%pM;>w0KZK_Y dXpvAVa<0!HvXy+HZY-bINs3e*$KWju?k_OP34{Ou literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v110.crb b/tests/crumbline/vectors/v110.crb new file mode 100644 index 0000000000000000000000000000000000000000..bedc960edd44a12d23eba49ea736db0e57e57e7c GIT binary patch literal 132 zcmXAh*$u!j2t!E^spH@P3E$}k-G7(@5#o5V@%t?_ifTj;5#7-`RQ-$t;#aKBVud;r g#W4z@iRe=bhaIVMPA^H==6*!w82h$Vj53lsegRkuw*UYD literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v111.crb b/tests/crumbline/vectors/v111.crb new file mode 100644 index 0000000000000000000000000000000000000000..a4be8367cc44dd94c2000de4c2ee5dfc5ea8613f GIT binary patch literal 128 zcmYj~!3}^w2n0E!iRG|xC~xh+{)-XTk0C%N%!d29Fr;dT>>{#OBlB2l8#a>0{IHKx b6HP#qA%etdPR~2$C)ED2P>RkEGpQn8sCWv~ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v112.crb b/tests/crumbline/vectors/v112.crb new file mode 100644 index 0000000000000000000000000000000000000000..6c77791968f9420971259ad4c02e23f11594f9d8 GIT binary patch literal 150 zcmXAh(G5c}2m^U)D|MV0Cx-mKZqWUQX`n)glP&J^y>Z!@%j|7t&$HCpuX7zc{85m* sa>Vk=#fS#Xfl-ZfL^WV)GzeSm;8X+2z~4@lG*-XPg=|GC`!n4216pGbod5s; literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v113.crb b/tests/crumbline/vectors/v113.crb new file mode 100644 index 0000000000000000000000000000000000000000..34380cbc34b0eb083ef220e7e5de57252946d774 GIT binary patch literal 131 zcmW-Y+YNv~2n0DFiRJK;gJ12y{)_RJ5N4N2c)v#mtrBm42X@ gX$w`27WZ@rWf5&LJ@F_7TJ4LOhA8fkVqD7c1J~UPsQ>@~ literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v114.crb b/tests/crumbline/vectors/v114.crb new file mode 100644 index 0000000000000000000000000000000000000000..0269b5b2d865517f8603a2a250eb339718f9eb50 GIT binary patch literal 146 zcmX9%+YNv~2;+<2U-?9_xFpfz^Nuz{z%tJUGqEnP)P@C=(vU Xfk(-_yOI)}yO_ujQ?fVFWA4`EeLh!8sYWcmHJG>U6P4-sAQOZy!#nsYIjr*FWtm;IeDu!@v!^!$atAOu%Z9J0GJ7)m=0lceLlHpuaVf7BmERkL$MqRcD!(Y+(0dffqA^-pY literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v120.crb b/tests/crumbline/vectors/v120.crb new file mode 100644 index 0000000000000000000000000000000000000000..dc7f11fda19753ac24290173dadd70d803e91c94 GIT binary patch literal 119 zcmW-X%MHLV2t%EIq>ck2MC6)o(EW!gM#z>Q_WNyZ$ZNm@;7F+_AS!l7KWQTT48PM= b!?Z9iqR1rK;=Bs4!d6tF%2{8-IP>`f{Cx=| literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v121.crb b/tests/crumbline/vectors/v121.crb new file mode 100644 index 0000000000000000000000000000000000000000..f7609f321ee025dffdc9efaa75a16be33670dd4b GIT binary patch literal 117 zcmZ<`ax!FO076Cv1`Y-W1{NT;urRa)av2Oj9Ag7h6FA4v!q6DbF)}kTMR1IakY$W4 Oz%mE|Y?P4!L<0Z>-3XHa literal 0 HcmV?d00001 diff --git a/tests/crumbline/vectors/v122.crb b/tests/crumbline/vectors/v122.crb new file mode 100644 index 0000000000000000000000000000000000000000..f33aa9e27d9b26edc7b4a92871cd304019e5f0f4 GIT binary patch literal 129 zcmXAh*%81X2n8|6Ov>Q_LH$iSNdLtIa2$?h!S{R6C|)DFi0F&}CflBkYH^p2V)i4( gI>3b;rElxLbZv>PA{>8`ZIJ|dCn}oco??`kKj0M$4gdfE literal 0 HcmV?d00001 diff --git a/tools/crumbline_learner.c b/tools/crumbline_learner.c new file mode 100644 index 000000000..e4c24e8ba --- /dev/null +++ b/tools/crumbline_learner.c @@ -0,0 +1,294 @@ +/* + * crumbline_learner.c -- Omega as a Crumbline learner. + * + * A standalone process that speaks the crumbs learner protocol v1 on + * stdin/stdout (see crumbs/src/protocol.rs). It links only learner-side code: + * the Crumb v1 visible reader, Omega's program/realization/verification + * stack, the synthesis vocabulary, OmegaLibrary and the Crumbline search. It + * contains no generator, sealed record, held-out set or label of any kind, + * and everything it can know arrives as protocol frames. + * + * Modes: + * crumbline-learner serve the protocol on stdin/stdout + * crumbline-learner --decode FILE decode a visible crumb file and print its shape + */ +#include "crumbline/cl_crumb.h" +#include "crumbline/cl_program.h" +#include "crumbline/cl_search.h" + +#include +#include +#include +#include +#include + +enum { + FT_HELLO = 0x01, + FT_CRUMB = 0x02, + FT_VERDICT = 0x03, + FT_ADMIT = 0x04, + FT_SHUTDOWN = 0x05, + FT_READY = 0x81, + FT_BANK = 0x82, + FT_SUBMIT = 0x83, + FT_EVENTS = 0x84, + FT_DONE = 0x85, +}; + +#define MAX_FRAME (1u << 24) +#define EVENT_BYTES 20 +#define EVENT_BATCH 4096 + +static int read_all(int fd, uint8_t *p, size_t n) { + while (n) { + ssize_t r = read(fd, p, n); + if (r < 0 && errno == EINTR) continue; + if (r <= 0) return -1; + p += r; + n -= (size_t)r; + } + return 0; +} + +static int write_all(int fd, const uint8_t *p, size_t n) { + while (n) { + ssize_t r = write(fd, p, n); + if (r < 0 && errno == EINTR) continue; + if (r <= 0) return -1; + p += r; + n -= (size_t)r; + } + return 0; +} + +static int send_frame(uint8_t type, const uint8_t *payload, size_t len) { + uint8_t hdr[5] = {type, (uint8_t)len, (uint8_t)(len >> 8), (uint8_t)(len >> 16), (uint8_t)(len >> 24)}; + if (write_all(1, hdr, 5) != 0) return -1; + return len ? write_all(1, payload, len) : 0; +} + +/* Returns frame type, or -1. *buf is malloc'd (caller frees). */ +static int recv_frame(uint8_t **buf, size_t *len) { + uint8_t hdr[5]; + if (read_all(0, hdr, 5) != 0) return -1; + uint32_t n = (uint32_t)hdr[1] | (uint32_t)hdr[2] << 8 | (uint32_t)hdr[3] << 16 | (uint32_t)hdr[4] << 24; + if (n > MAX_FRAME) return -1; + *buf = malloc(n ? n : 1); + if (!*buf) return -1; + if (n && read_all(0, *buf, n) != 0) { + free(*buf); + return -1; + } + *len = n; + return hdr[0]; +} + +/* ---- event batching ---------------------------------------------------- */ + +typedef struct { + uint8_t buf[4 + EVENT_BATCH * EVENT_BYTES]; + uint32_t count; + int failed; +} EventBatch; + +static void flush_events(EventBatch *b) { + if (b->count == 0) return; + b->buf[0] = (uint8_t)b->count; + b->buf[1] = (uint8_t)(b->count >> 8); + b->buf[2] = (uint8_t)(b->count >> 16); + b->buf[3] = (uint8_t)(b->count >> 24); + if (send_frame(FT_EVENTS, b->buf, 4 + (size_t)b->count * EVENT_BYTES) != 0) b->failed = 1; + b->count = 0; +} + +static void emit_event(void *ctx, const ClEvent *ev) { + EventBatch *b = ctx; + ClWriter w; + cl_w_init(&w, b->buf + 4 + (size_t)b->count * EVENT_BYTES, EVENT_BYTES); + cl_w_u8(&w, ev->kind); + cl_w_u8(&w, ev->prune); + cl_w_u8(&w, ev->verify); + cl_w_u8(&w, ev->fit); + cl_w_u16(&w, ev->op_index); + cl_w_u32(&w, ev->parent); + cl_w_u32(&w, ev->child); + cl_w_u32(&w, ev->exec_cost); + cl_w_u16(&w, ev->oracle_index); + b->count++; + if (b->count == EVENT_BATCH) flush_events(b); +} + +/* ---- oracle over the protocol ----------------------------------------- */ + +static int oracle_submit(void *ctx, uint32_t node, const ClSteps *cand, uint8_t flags, uint8_t hyp, uint8_t *verdict) { + EventBatch *b = ctx; + flush_events(b); + uint8_t buf[16 + 7 + CL_MAX_STEPS * 9]; + ClWriter w; + cl_w_init(&w, buf, sizeof(buf)); + cl_w_u32(&w, node); + cl_w_u8(&w, flags); + cl_w_u8(&w, hyp); + if (cl_steps_encode_cpg1(cand, &w) != 0) return -1; + if (send_frame(FT_SUBMIT, buf, w.len) != 0) return -1; + uint8_t *p = NULL; + size_t n = 0; + int t = recv_frame(&p, &n); + if (t != FT_VERDICT || n != 1) { + free(p); + return -1; + } + *verdict = p[0]; + free(p); + return 0; +} + +static int send_bank(const ClBank *bank) { + size_t cap = 4 + bank->count * (5 + 7 + CL_MAX_STEPS * 9); + uint8_t *buf = malloc(cap); + if (!buf) return -1; + ClWriter w; + cl_w_init(&w, buf, cap); + cl_w_u32(&w, (uint32_t)bank->count); + for (size_t i = 0; i < bank->count; ++i) { + cl_w_u8(&w, bank->ops[i].origin); + cl_w_u32(&w, bank->ops[i].op_ref); + cl_steps_encode_cpg1(&bank->ops[i].steps, &w); + } + int rc = w.overflow ? -1 : send_frame(FT_BANK, buf, w.len); + free(buf); + return rc; +} + +static int send_done(const ClSearchResult *r) { + uint8_t buf[1 + 4 + 12 * 4 + 16]; + ClWriter w; + cl_w_init(&w, buf, sizeof(buf)); + cl_w_u8(&w, r->outcome); + cl_w_u32(&w, r->solution_node); + uint32_t f[12] = {r->generated, r->evaluated, r->expansions, r->pruned_equiv, + r->pruned_cost, r->pruned_cap, r->visible_fits, r->verify_failures, + r->oracle_queries, r->oracle_rejections, r->candidates_to_solution, r->hypotheses_at_first_submit}; + for (int i = 0; i < 12; ++i) cl_w_u32(&w, f[i]); + cl_w_u64(&w, r->exec_count); + cl_w_u64(&w, r->wall_ns); + return send_frame(FT_DONE, buf, w.len); +} + +static int serve(void) { + ClSearchConfig cfg; + cl_search_default_config(&cfg); + bool library_enabled = false; + ClLearnerLibrary *lib = calloc(1, sizeof(*lib)); + ClCrumb *crumb = calloc(1, sizeof(*crumb)); + ClBank *bank = calloc(1, sizeof(*bank)); + EventBatch *batch = calloc(1, sizeof(*batch)); + if (!lib || !crumb || !bank || !batch || cl_library_init(lib) != 0) return 3; + + for (;;) { + uint8_t *p = NULL; + size_t n = 0; + int t = recv_frame(&p, &n); + if (t < 0) return 2; + ClReader r; + cl_r_init(&r, p, n); + int rc = 0; + switch (t) { + case FT_HELLO: { + if (cl_r_u16(&r) != 1) { + rc = -1; + break; + } + library_enabled = cl_r_u8(&r) != 0; + cfg.max_candidates = cl_r_u32(&r); + cfg.max_depth = cl_r_u32(&r); + cfg.frontier_cap = cl_r_u32(&r); + cfg.max_oracle_queries = cl_r_u32(&r); + cfg.ambiguity_scan = cl_r_u32(&r); + cfg.robust_min_pct = cl_r_u32(&r); + if (!cl_r_done(&r)) { + rc = -1; + break; + } + uint8_t ready[2] = {1, 0}; + rc = send_frame(FT_READY, ready, 2); + break; + } + case FT_ADMIT: { + uint32_t op_ref = cl_r_u32(&r); + uint8_t scope = cl_r_u8(&r); + ClSteps steps; + if (cl_steps_decode_cpg1(&r, &steps) != 0 || !cl_r_done(&r)) { + rc = -1; + break; + } + /* A learner without reuse ignores admissions (control condition). */ + if (library_enabled) cl_library_admit(lib, &steps, scope, op_ref); + break; + } + case FT_CRUMB: { + ClSearchResult res; + memset(&res, 0, sizeof(res)); + if (cl_crumb_decode(p, n, crumb) != CL_CRUMB_OK) { + res.outcome = CL_OUTCOME_UNSUPPORTED; + res.solution_node = UINT32_MAX; + rc = send_bank(bank) != 0 || send_done(&res) != 0 ? -1 : 0; + break; + } + cl_bank_init_base(bank); + if (library_enabled) cl_library_export(lib, cl_crumb_input_bits(crumb), bank); + if (send_bank(bank) != 0) { + rc = -1; + break; + } + ClOracle oracle = {oracle_submit, batch}; + ClEventSink sink = {emit_event, batch}; + batch->count = 0; + if (cl_search_run(crumb, bank, &cfg, &oracle, &sink, &res) != 0) res.outcome = CL_OUTCOME_UNSOLVED; + flush_events(batch); + rc = (batch->failed || send_done(&res) != 0) ? -1 : 0; + break; + } + case FT_SHUTDOWN: + free(p); + cl_library_destroy(lib); + return 0; + default: + rc = -1; + } + free(p); + if (rc != 0) return 2; + } +} + +static int decode_file(const char *path) { + FILE *f = fopen(path, "rb"); + if (!f) return 1; + static uint8_t buf[1 << 20]; + size_t n = fread(buf, 1, sizeof(buf), f); + fclose(f); + ClCrumb *c = calloc(1, sizeof(*c)); + int rc = cl_crumb_decode(buf, n, c); + if (rc != CL_CRUMB_OK) { + printf("decode-error %d\n", rc); + free(c); + return 1; + } + printf("ok enc=%u in=%ux%u out=%ux%u n=%u", c->encoding, c->in_arity, c->in_lane_bytes, c->out_arity, + c->out_lane_bytes, c->n); + for (uint32_t i = 0; i < c->n; ++i) { + printf(" |"); + for (uint8_t l = 0; l < c->in_arity; ++l) printf(" %llu", (unsigned long long)c->in[i][l]); + printf(" ->"); + for (uint8_t l = 0; l < c->out_arity; ++l) printf(" %llu", (unsigned long long)c->out[i][l]); + } + printf("\n"); + free(c); + return 0; +} + +int main(int argc, char **argv) { + if (argc == 3 && strcmp(argv[1], "--decode") == 0) return decode_file(argv[2]); + if (argc != 1) return 64; + return serve(); +}