a3358dfc95
Compose the live relational-neighborhood geometry OPERATORS into five reasoning
modes as pure, read-only C (engram_reason.{h,c}); each is proven with closed-form
constructed tests before it ships, not declared.
- ANALOGY (Procrustes R + residual translation, apply to C, rank candidates)
- INDUCTION (combine-pooled rule geometry + point-to-manifold membership)
- ABDUCTION (best-explaining structure by point-to-manifold fit)
- CAUSAL (centroid-cosine correlation vs directed influence: temporal
precedence + association surviving confounder control via subtract;
emits a correlation-vs-causation flag)
- PLANNING (geo-distance edges + Dijkstra → discrete geodesic path)
A shared point-to-manifold fit primitive underlies induction membership and
abduction ranking. engram/test/run_reason_tests.sh: 33/33 checks on both PERF
and ASan/UBSan passes; macOS leaks 0/0.
ANALOGY is surfaced as an el builtin (engram_reason_analogy_json) via the same
pass-through the §5 operators use — demonstrated callable from compiled El with a
container-capped fold (no self-host fold). The other four are C-layer only: their
set/point/timestamp inputs do not map to the flat-CSV el ABI without touching
codegen (deferred). engram_reason.c must join the server link line beside
engram_geometry.c at cutover. See docs/runbooks/2026-08-13-reasoning-operators-*.
24 lines
1.0 KiB
Bash
Executable File
24 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build + RUN the REASONING-layer tests (engram_reason.c): closed-form constructed
|
|
# cases for ANALOGY / INDUCTION / ABDUCTION / CAUSAL / PLANNING, each composing the
|
|
# §5 geometry OPERATORS (engram_geometry.c). Pure C11 (stdlib + libm). Standalone —
|
|
# NOT folded through elc. Two passes:
|
|
# 1. PERF — optimised (-O2, no sanitizer): the functional gate.
|
|
# 2. SAFETY — ASan + UBSan on the same suite (memory-safety is size-independent).
|
|
set -e
|
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
RT="$HERE/../../lang/runtime"
|
|
CC=${CC:-cc}
|
|
SRC="$HERE/test_reason.c $RT/engram_reason.c $RT/engram_geometry.c $RT/engram_store.c $RT/engram_vindex.c"
|
|
WARN="-std=c11 -Wall -Wextra"
|
|
TMP=$(mktemp -d)
|
|
|
|
echo "### PASS 1: PERF (optimised, un-sanitised) — functional gate"
|
|
$CC $WARN -O2 -I"$RT" $SRC -lm -o "$TMP/perf"
|
|
"$TMP/perf"
|
|
|
|
echo
|
|
echo "### PASS 2: SAFETY (ASan/UBSan)"
|
|
$CC $WARN -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -I"$RT" $SRC -lm -o "$TMP/safe"
|
|
ASAN_OPTIONS=${ASAN_OPTIONS:-detect_leaks=0} UBSAN_OPTIONS=halt_on_error=1 "$TMP/safe"
|