Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/bootstrap/formal-oracles/lean/run-kv-formal.sh # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / bootstrap / formal-oracles / lean / run-kv-formal.sh` 56 lines ยท 2428 bytes Raw Blame History 1 #!/bin/sh 2 # FORMAL-6: KV layout bounds formal bootstrap runner (DEVELOPMENT_ORACLE, not permanent lineage). 3 # Builds the real model (must PASS) and each deliberate mutant claim (must FAIL for a proof reason). 4 # Last stdout line: KV_FORMAL_BOOTSTRAP: PASS | FAIL | NOT_RUN 5 # No network needed after the toolchain is installed (core Lean only, no dependencies). 6 set -u 7 here=$(cd "$(dirname "$0")" && pwd) 8 cd "$here" || exit 2 9 PATH="$HOME/.elan/bin:$PATH"; export PATH 10 11 quiet="${AIEN_SPARK_QUIET_FLAG:-$HOME/workspace/.spark-quiet}" 12 if [ -e "$quiet" ]; then 13 echo "quiet flag present ($quiet): not building" 14 echo "KV_FORMAL_BOOTSTRAP: NOT_RUN" 15 exit 3 16 fi 17 command -v lake >/dev/null 2>&1 || { echo "lake not found (install elan)"; echo "KV_FORMAL_BOOTSTRAP: NOT_RUN"; exit 3; } 18 19 log=$(mktemp); trap 'rm -f "$log"' EXIT 20 echo "toolchain: $(cat lean-toolchain) / $(lean --version)" 21 fail=0 22 23 # Forbidden constructs in the receipt sources (comments excluded by matching code-like uses). 24 if grep -nE '^[^-]*\b(sorry|admit|native_decide|unsafe)\b|^axiom |^ *axiom ' AienKv/*.lean AienKv.lean >"$log"; then 25 echo "forbidden_constructs: FAIL"; cat "$log"; fail=1 26 else 27 echo "forbidden_constructs: PASS" 28 fi 29 30 lake build AienKv >"$log" 2>&1; rc=$? 31 if [ $rc -eq 0 ] && ! grep -qi "sorry" "$log"; then 32 echo "real_model: PASS" 33 else 34 echo "real_model: FAIL (rc=$rc)"; tail -20 "$log"; fail=1 35 fi 36 37 lake build MutantKvModels >"$log" 2>&1; rc=$? 38 if [ $rc -eq 0 ] && ! grep -qi "sorry" "$log"; then 39 echo "mutant_models_compile: PASS" 40 else 41 echo "mutant_models_compile: FAIL (rc=$rc)"; tail -20 "$log"; fail=1 42 fi 43 44 # A mutant is killed only by a proof error in its own claim file, not a syntax or import error. 45 for m in MutantKvPlanesClaim MutantKvTotalClaim MutantKvTokenClaim MutantKvValidClaim MutantKvBlockClaim; do 46 lake build "$m" >"$log" 2>&1; rc=$? 47 if [ $rc -ne 0 ] && grep -qE "^error: $m.lean:[0-9]+:[0-9]+: (unsolved goals|simp_all made no progress|Type mismatch|Application type mismatch|.?simp.? made no progress|omega could not prove|Tactic)" "$log" \ 48 && ! grep -q "unexpected token" "$log" && ! grep -qE "^error: (MutantKvModels|AienKv)" "$log"; then 49 echo "$m: FAIL_AS_EXPECTED (mutant killed)" 50 else 51 echo "$m: UNEXPECTED_BUILD_SUCCESS_OR_NO_PROOF_ERROR (rc=$rc), mutant survived"; fail=1 52 fi 53 done 54 55 if [ $fail -eq 0 ]; then echo "KV_FORMAL_BOOTSTRAP: PASS"; else echo "KV_FORMAL_BOOTSTRAP: FAIL"; fi 56 exit $fail