mirror of
https://github.com/saymrwulf/pasta-pallas-verified.git
synced 2026-09-04 20:03:39 +00:00
- extract.sh: scoped Charon/Aeneas extraction of fields::fp (pow_vartime patched upstream to index loops — semantics-preserving, crate tests pass; sqrt/cmp/sum/random/... opaque, documented) - gen/: real transpiled model; subtle/CtOption hand-modeled (Choice := U8, CtOption := value × is_some), all other externals are axioms outside certificate cones - Proofs/PPallas: Lucas/Pratt primality certificate (reused — it was the one genuine piece of the previous attempt) - Proofs/Denote: Montgomery denotation ⟪a⟫ = feVal a · R⁻¹, Canon invariant - Proofs/HelperSpecs: adc/sbb/mac exact ℕ specs (step-registered) - Proofs/SubNegSpec: sub_spec (general two-case identity covering the t<2P reduction shape) and neg_spec, proven, no axioms Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.7 KiB
Bash
Executable file
44 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
# Regenerate the Lean model in gen/ from the Rust sources.
|
||
#
|
||
# SCOPE: Pallas base field 𝔽_p (src/fields/fp.rs) + the u64 helper primitives
|
||
# (src/arithmetic/fields.rs: adc/sbb/mac — translated TRANSPARENTLY,
|
||
# they are plain u128 arithmetic; no hand models).
|
||
#
|
||
# Rust --charon--> PallasFp.llbc --aeneas--> gen/PallasFp/*.lean
|
||
#
|
||
# Opaque items (documented in TRUSTED-BASE.md; all outside certificate cones):
|
||
# * trait impls needing RNG / serde / GPU / iterator machinery
|
||
# * sqrt (table-driven; out of scope for the field certificate)
|
||
#
|
||
# Usage: ./extract.sh
|
||
set -euo pipefail
|
||
|
||
source ~/aeneas-toolchain/env.sh
|
||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||
CRATE=~/GitClone/FormalVerification/sources/pasta_curves-source
|
||
|
||
echo "[1/2] charon: Rust -> LLBC (fields::fp + arithmetic helpers)"
|
||
cd "$CRATE"
|
||
charon cargo --preset=aeneas \
|
||
--start-from crate::fields::fp \
|
||
--opaque 'crate::fields::fp::_::fmt' \
|
||
--opaque 'crate::fields::fp::_::pow_by_t_minus1_over2' \
|
||
--opaque 'crate::fields::fp::_::get_lower_32' \
|
||
--opaque 'crate::fields::fp::_::ZETA' \
|
||
--opaque 'crate::fields::fp::_::from_uniform_bytes' \
|
||
--opaque 'crate::fields::fp::_::sqrt' \
|
||
--opaque 'crate::fields::fp::_::sqrt_ratio' \
|
||
--opaque 'crate::fields::fp::_::random' \
|
||
--opaque 'crate::fields::fp::_::sum' \
|
||
--opaque 'crate::fields::fp::_::product' \
|
||
--opaque 'crate::fields::fp::_::cmp' \
|
||
--opaque 'crate::fields::fp::_::partial_cmp' \
|
||
--dest-file "$HERE/PallasFp.llbc" \
|
||
-- --no-default-features
|
||
|
||
echo "[2/2] aeneas: LLBC -> Lean (split files, PallasFp.* modules)"
|
||
cd "$HERE"
|
||
aeneas -backend lean -split-files -subdir PallasFp -dest gen PallasFp.llbc
|
||
|
||
echo "Done. Now run ./check.sh to type-check the regenerated model."
|