yang
This project has not described itself yet.
Brought by drakestapleton
yang / scripts / check_dyadic_grid.sh
| 1 | #!/bin/sh |
| 2 | # Runs on Spark after build_and_run_spark.sh has synchronized the checkout. |
| 3 | set -eu |
| 4 | root=$1 |
| 5 | omc=$2 |
| 6 | build=$(mktemp -d) |
| 7 | trap 'rm -rf "$build"' EXIT |
| 8 | pin=$(sed -n 's/^omc_sha256=//p' "$root/PIN") |
| 9 | echo "$pin $omc" | sha256sum -c - |
| 10 | { echo om2; cat "$root/src/ufbi_math.om" "$root/src/ufbi_ivmath.om" "$root/scripts/dyadic_grid_dump.om"; } > "$build/unit.om" |
| 11 | "$omc" < "$build/unit.om" > "$build/dump" |
| 12 | chmod +x "$build/dump" |
| 13 | "$build/dump" > "$build/omega.tsv" |
| 14 | { echo om2; cat "$root/src/ufbi_math.om" "$root/src/ufbi_ivmath.om" "$root/src/ufbi_w2_dyadic.om" "$root/scripts/dyadic_w2_dump.om"; } > "$build/w2.om" |
| 15 | "$omc" < "$build/w2.om" > "$build/w2" |
| 16 | chmod +x "$build/w2" |
| 17 | "$build/w2" > "$build/w2-omega.tsv" |
| 18 | cd "$HOME/workspace/yang-lean-bridge" |
| 19 | export PATH="$HOME/.elan/bin:$PATH" |
| 20 | lake env sh -ec ' |
| 21 | export LEAN_PATH="$1:$LEAN_PATH" |
| 22 | cd "$2" |
| 23 | lean -o "$1/DyadicTrig.olean" proofs/DyadicTrig.lean |
| 24 | lean -o "$1/DyadicExp.olean" proofs/DyadicExp.lean |
| 25 | lean --run scripts/ReplayDyadicTrig.lean > "$1/lean.tsv" |
| 26 | lean --run scripts/ReplayDyadicW2.lean > "$1/w2-lean.tsv" |
| 27 | ' sh "$build" "$root" |
| 28 | cmp "$build/omega.tsv" "$build/lean.tsv" |
| 29 | test "$(wc -l < "$build/lean.tsv")" = 2048 |
| 30 | sha256sum "$build/lean.tsv" |
| 31 | echo 'DYADIC_GRID_REPLAY cells=2048 status=PASS' |
| 32 | cmp "$build/w2-omega.tsv" "$build/w2-lean.tsv" |
| 33 | test "$(wc -l < "$build/w2-lean.tsv")" = 2048 |
| 34 | sha256sum "$build/w2-lean.tsv" |
| 35 | # A one-unit change to the computed polar energy must disagree with the reference. |
| 36 | sed 's/^par = fluxEnergy zLo$/par = add 1 fluxEnergy zLo/' "$build/w2.om" > "$build/w2-mutant.om" |
| 37 | "$omc" < "$build/w2-mutant.om" > "$build/w2-mutant" |
| 38 | chmod +x "$build/w2-mutant" |
| 39 | "$build/w2-mutant" > "$build/mutant.tsv" |
| 40 | test "$(wc -l < "$build/mutant.tsv")" = 2048 |
| 41 | if cmp -s "$build/mutant.tsv" "$build/w2-lean.tsv"; then |
| 42 | echo 'W2_MUTATION undetected' >&2 |
| 43 | exit 1 |
| 44 | fi |
| 45 | echo 'W2_MUTATION polar_energy_plus_one detected' |
| 46 | echo 'DYADIC_W2_REPLAY couplings=16 field_boxes=2048 angle_cells_per_box=2048 status=PASS' |