mirror of
https://github.com/saymrwulf/dalek-ed25519-verified.git
synced 2026-09-05 20:30:58 +00:00
sub_val_spec closes the top-level two-clause value spec: denote(Scalar52.sub a b) = denote(a) - denote(b) in ZMod l for limb-bounded inputs with canonical subtrahend (scVal b < l). Axiom-clean [propext, Classical.choice, Quot.sound]; no sorry. The assembly documented-as-remaining last session is now done. Key resolutions: - Applied the WP "spec_bind" rule manually instead of "step", and reduced the resulting "let (difference,borrow) := (dw,w)" Prod-let with an explicit "show" — this was the destructuring friction that blocked the earlier attempt (step's arity heuristics mis-typed the pair result). - Inlined the subtle "Choice::from" identity (no step-spec, like csel_step). - PERFORMANCE: kept "scLimbs" as opaque atoms in the gamma5=1 derivation instead of "unfold ... at *" — the unfold exploded omega with 2^52..2^260 coefficients and blew past 600s; atomic form proves in ~1 min (METHOD 4, same kernel-cost discipline as the field layer). - The 2^260 borrow-wrap and the +l conditional-add cancel in ZMod l: beta5=0 direct; beta5=1 forces top carry gamma5=1 from scVal b < l, closed by linear_combination over the two telescopes (sub_telescope, add_telescope). check-scalar.sh: sub_val_spec in the manifest + Phase-3 audit (4/4 clean); proof-phase caps raised to 600s/8192MB for the assembly; full button green. exponentiation.threshold raised to 300 for the 2^260 literal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
2.1 KiB
Bash
Executable file
43 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
# Scalar-layer check (Scalar52 arithmetic mod ℓ). Compiles the gen model + the
|
||
# proven foundation. add/sub (Range-loop reductions) and the Montgomery mul
|
||
# path are in progress — see README. Guarded compiles throughout.
|
||
set -uo pipefail
|
||
source ~/aeneas-toolchain/env.sh
|
||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||
AENEAS_LEAN="$AENEAS_HOME/backends/lean"
|
||
GEN=(CurveScalar/TypesExternal CurveScalar/Types CurveScalar/FunsExternal CurveScalar/Funs)
|
||
PROOFS=(ScalarDenote ScalarLoop ScalarSubSpec)
|
||
|
||
echo "=== stub/axiom audit ==="
|
||
grep -rnE '^(private |protected |noncomputable )*axiom ' "$HERE"/Proofs/Scalar*.lean 2>/dev/null && { echo "axiom under Proofs/"; exit 1; }
|
||
echo " clean"
|
||
echo "=== compile (guarded) ==="
|
||
cd "$AENEAS_LEAN"
|
||
lake env bash -c "
|
||
set -uo pipefail
|
||
cd '$HERE/gen' && export LEAN_PATH=\"\$LEAN_PATH:\$PWD:$HERE\"
|
||
for m in ${GEN[*]}; do echo \" · gen \$m\"; LEAN_TIMEOUT=300 LEAN_MEM_MB=6144 '$HERE/lean-guard' \"\$m.lean\" || exit 1; done
|
||
cd '$HERE'
|
||
for m in ${PROOFS[*]}; do echo \" · proof \$m\"; LEAN_TIMEOUT=600 LEAN_MEM_MB=8192 '$HERE/lean-guard' \"Proofs/\$m.lean\" || exit 1; done
|
||
" || { echo FAIL; exit 1; }
|
||
echo "=== Phase 3: axiom audit (kernel-level) ==="
|
||
cd "$AENEAS_LEAN"
|
||
lake env bash -c "
|
||
set -uo pipefail
|
||
export LEAN_PATH=\"\$LEAN_PATH:$HERE/gen:$HERE\"
|
||
cd '$HERE'
|
||
AUD=\$(mktemp '$HERE/.audit-scalar-XXXX.lean')
|
||
{ echo 'import Proofs.ScalarDenote'; echo 'import Proofs.ScalarSubSpec'; echo '#print axioms ScalarProofs.L_val'
|
||
echo '#print axioms ScalarProofs.sub_loop_spec'
|
||
echo '#print axioms ScalarProofs.cond_add_l_one_spec'; echo '#print axioms ScalarProofs.sub_val_spec'; } > \"\$AUD\"
|
||
OUT=\$(LEAN_TIMEOUT=120 LEAN_MEM_MB=4096 '$HERE/lean-guard' \"\$AUD\" 2>&1)
|
||
echo \"\$OUT\"
|
||
rm -f \"\$AUD\" \"\${AUD%.lean}.olean\"
|
||
N=\$(echo \"\$OUT\" | grep -cF \"depends on axioms: [propext, Classical.choice, Quot.sound]\" || true)
|
||
[ \"\$N\" -eq 4 ] || { echo \"AXIOM AUDIT FAILED: \$N/4 clean\"; exit 1; }
|
||
" || { echo FAIL; exit 1; }
|
||
echo " L_val axiom-clean"
|
||
|
||
echo ""
|
||
echo "SCALAR FOUNDATION: gen compiles; denotation + group-order constant (L = ℓ) proven."
|