mirror of
https://github.com/saymrwulf/dalek-ed25519-verified.git
synced 2026-09-03 20:13:48 +00:00
extract-scalar.sh: function-level roots (add/sub/mul/square/montgomery_*) yield a 28-def Scalar52 limb-arithmetic gen with ZERO iterator/byte/wrapper entanglement — the byte-serialization and high-level Scalar wrapper (which pull untranslatable chunks/zip iterators) are excluded by scoping, not faked. Proofs/ScalarDenote.lean (compiles, axiom-clean): Ell = ℓ = 2^252+..., the Scalar52 denotation ⟦·⟧ : Scalar52 → ZMod ℓ, the ScBnd 52-bit limb invariant, and L_val — the transpiled constants::L denotes EXACTLY the group order ℓ (kernel-checked, no native_decide). add/sub (Range-loop conditional reductions, tractable — field-layer pattern) and the Montgomery mul path (shares pasta's big-coefficient kernel limit) are in progress. check-scalar.sh is green for the foundation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.7 KiB
Bash
Executable file
33 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
# Regenerate the SCALAR-layer Lean model (gen/CurveScalar) from Rust.
|
||
#
|
||
# SCOPE: the Scalar52 limb backend (backend::serial::u64::scalar) — the
|
||
# iterator-free ARITHMETIC core: add/sub/mul/square/montgomery_reduce/
|
||
# from_bytes/to_bytes mod ℓ = 2²⁵² + 27742317777372353535851937790883648493.
|
||
# The high-level crate::scalar wrapper (Sum/Product/NAF/radix/byte-parsing,
|
||
# all iterator-heavy) is brought in only for the signature layer.
|
||
set -euo pipefail
|
||
source ~/aeneas-toolchain/env.sh
|
||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||
CRATE=~/GitClone/FormalVerification/sources/curve25519-dalek-source/curve25519-dalek
|
||
|
||
echo "[1/2] charon: Rust -> LLBC (scalar + Scalar52)"
|
||
cd "$CRATE"
|
||
charon cargo --preset=aeneas \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::add' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::sub' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::mul' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::square' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::montgomery_mul' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::montgomery_square' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::montgomery_reduce' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::montgomery_invert' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::as_montgomery' \
|
||
--start-from 'crate::backend::serial::u64::scalar::_::from_montgomery' \
|
||
--dest-file "$HERE/CurveScalar.llbc" \
|
||
-- --no-default-features
|
||
|
||
echo "[2/2] aeneas: LLBC -> Lean (split files, CurveScalar.* modules)"
|
||
cd "$HERE"
|
||
aeneas -backend lean -split-files -subdir CurveScalar -dest gen CurveScalar.llbc
|
||
echo "Done."
|