mirror of
https://github.com/saymrwulf/anza-ed25519-verified.git
synced 2026-09-03 20:13:46 +00:00
extract.sh now opens crate::backend::serial::scalar_mul::vartime_double_base (the other scalar_mul strategies stay opaque): non_adjacent_form (with its loops), NafLookupTable5 (from/select), the curve-model helpers and vartime_double_base::mul itself land in gen/CurveField - the same namespace as the proven edwards operations, so the coming double-and-add induction can consume EdDouble/EdAddProjNiels/EdConvert directly. Zero sorries, zero external axioms (the pinned sources carry documented compat refactors: single-assignment loop helpers, param-rooted while, always-256-iterations, index-based LE load). Full check.sh pressed fresh over the regenerated model: every existing field and group-law certificate still green and axiom-clean - the scope extension is purely additive.
53 lines
2.4 KiB
Bash
Executable file
53 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Regenerate the Lean model in gen/ from the Rust sources.
|
|
#
|
|
# SCOPE: field arithmetic + Edwards point arithmetic
|
|
# roots: crate::field, crate::backend::serial::u64::field,
|
|
# crate::backend::serial::curve_models, crate::edwards
|
|
# (same widening the reference solution used for its Tier-1 addition-law
|
|
# theorem; scalar-mul backends and decompress internals stay opaque —
|
|
# upstream Aeneas cannot translate them; they are modeled/axiomatized in
|
|
# gen/CurveField/FunsExternal.lean OUTSIDE every certificate's cone).
|
|
#
|
|
# Rust --charon--> CurveField.llbc --aeneas--> gen/CurveField/*.lean
|
|
#
|
|
# The hand-written gen/CurveField/{TypesExternal,FunsExternal}.lean are NOT
|
|
# touched by regeneration (Aeneas only rewrites the *_Template variants).
|
|
# After regenerating, diff the templates against the hand-written files:
|
|
# diff gen/CurveField/FunsExternal_Template.lean gen/CurveField/FunsExternal.lean
|
|
#
|
|
# Usage: ./extract.sh
|
|
set -euo pipefail
|
|
|
|
source ~/aeneas-toolchain/env.sh
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
CRATE=~/GitClone/FormalVerification/sources/anza-cryptography-source/curve25519/solana-ed25519
|
|
|
|
echo "[1/2] charon: Rust -> LLBC (field + curve_models + edwards)"
|
|
cd "$CRATE"
|
|
charon cargo --preset=aeneas \
|
|
--start-from crate::field \
|
|
--start-from crate::backend::serial::u64::field \
|
|
--start-from crate::backend::serial::curve_models \
|
|
--start-from crate::edwards \
|
|
--opaque 'crate::field::_::internal_invert_batch' \
|
|
--opaque 'crate::backend::serial::scalar_mul::variable_base' \
|
|
--opaque 'crate::backend::serial::scalar_mul::vartime_triple_base' \
|
|
--opaque 'crate::scalar::_::non_adjacent_form_128' \
|
|
--opaque 'crate::backend::serial::scalar_mul::straus' \
|
|
--opaque 'crate::backend::serial::scalar_mul::precomputed_straus' \
|
|
--opaque 'crate::backend::serial::scalar_mul::pippenger' \
|
|
--opaque 'crate::backend::vector' \
|
|
--opaque 'crate::backend::get_selected_backend' \
|
|
--opaque 'crate::backend::scalar_fits_in_128_bits' \
|
|
--opaque 'crate::edwards::decompress' \
|
|
--opaque 'crate::edwards::_::sum' \
|
|
--opaque 'crate::edwards::_::from_slice' \
|
|
--dest-file "$HERE/CurveField.llbc" \
|
|
-- --no-default-features
|
|
|
|
echo "[2/2] aeneas: LLBC -> Lean (split files, CurveField.* modules)"
|
|
cd "$HERE"
|
|
aeneas -backend lean -split-files -subdir CurveField -dest gen CurveField.llbc
|
|
|
|
echo "Done. Now run ./check.sh to type-check the regenerated model."
|