ca13471745
The disposes half of the propose->verify loop. Catches the plausible lie a grammar check never sees: fluent, confident, wrong. GROUNDING (anti-hallucination): fit a claim point against every real evidence neighborhood via engram_reason_point_fit; grounded iff best fit clears an absolute threshold. Off-model orthogonal residual is the hallucination signal. Distinct from abduction: asks 'is there any real support at all' and may say no. CONSISTENCY (contradiction): (a) polarity/negation inversion -- claim lands on the opposite side of a real polarity axis from the grounded truth (the reassurance->accusation catch: 'never fought'->'argued'); (b) geometric -- claim inside a forbidden region or beyond a max-distance constraint. Pure C11, read-only, composes existing primitives only. 29 constructed-case checks, 0 failures across PERF and ASan/UBSan; macOS leaks 0. el-exposure deferred (point/variadic-set inputs -- matches reasoning-agent precedent). Reach checks (formal/causal/predictive) not started; documented.
25 lines
1.2 KiB
Bash
Executable File
25 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build + RUN the VERIFIER-layer tests (engram_verify.c): closed-form constructed
|
|
# cases for GROUNDING (anti-hallucination) and CONSISTENCY (polarity/negation
|
|
# inversion + geometric contradiction), each composing the reasoning point-fit
|
|
# (engram_reason.c) and 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_verify.c $RT/engram_verify.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"
|