interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / bootstrap / formal-oracles / lean / run-cap-formal.sh

47 lines · 1745 bytes Raw Blame History
1#!/bin/sh
2# FORMAL-2/3: capability formal bootstrap runner (DEVELOPMENT_ORACLE, not permanent lineage).
3# Builds the real model (must PASS) and each deliberate mutant claim (must FAIL).
4# Last stdout line: CAP_FORMAL_BOOTSTRAP: PASS | FAIL | NOT_RUN
5# No network needed after the toolchain is installed (core Lean only, no dependencies).
6set -u
7here=$(cd "$(dirname "$0")" && pwd)
8cd "$here" || exit 2
9PATH="$HOME/.elan/bin:$PATH"; export PATH
10
11quiet="${AIEN_SPARK_QUIET_FLAG:-$HOME/workspace/.spark-quiet}"
12if [ -e "$quiet" ]; then
13 echo "quiet flag present ($quiet): not building"
14 echo "CAP_FORMAL_BOOTSTRAP: NOT_RUN"
15 exit 3
16fi
17command -v lake >/dev/null 2>&1 || { echo "lake not found (install elan)"; echo "CAP_FORMAL_BOOTSTRAP: NOT_RUN"; exit 3; }
18
19log=$(mktemp); trap 'rm -f "$log"' EXIT
20echo "toolchain: $(cat lean-toolchain) / $(lean --version)"
21fail=0
22
23lake build AienCap >"$log" 2>&1; rc=$?
24if [ $rc -eq 0 ] && ! grep -qi "sorry" "$log"; then
25 echo "real_model: PASS"
26else
27 echo "real_model: FAIL (rc=$rc)"; tail -20 "$log"; fail=1
28fi
29
30lake build MutantModels >"$log" 2>&1; rc=$?
31if [ $rc -eq 0 ] && ! grep -qi "sorry" "$log"; then
32 echo "mutant_models_compile: PASS"
33else
34 echo "mutant_models_compile: FAIL (rc=$rc)"; tail -20 "$log"; fail=1
35fi
36
37for m in MutantScopeClaim MutantExpiryClaim MutantDepthClaim; do
38 lake build "$m" >"$log" 2>&1; rc=$?
39 if [ $rc -ne 0 ] && grep -q "^error: $m.lean:" "$log" && ! grep -q "^error: MutantModels.lean" "$log"; then
40 echo "$m: FAIL_AS_EXPECTED (mutant killed)"
41 else
42 echo "$m: UNEXPECTED_BUILD_SUCCESS_OR_NO_ERROR (rc=$rc), mutant survived"; fail=1
43 fi
44done
45
46if [ $fail -eq 0 ]; then echo "CAP_FORMAL_BOOTSTRAP: PASS"; else echo "CAP_FORMAL_BOOTSTRAP: FAIL"; fi
47exit $fail