mirror of
https://github.com/saymrwulf/pasta-pallas-verified.git
synced 2026-09-05 20:10:31 +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>
224 lines
11 KiB
Text
224 lines
11 KiB
Text
-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS
|
||
-- [pasta_curves]: external functions.
|
||
-- This is a template file: rename it to "FunsExternal.lean" and fill the holes.
|
||
import Aeneas
|
||
import PallasFp.Types
|
||
open Aeneas Aeneas.Std Result ControlFlow Error
|
||
set_option linter.dupNamespace false
|
||
set_option linter.hashCommand false
|
||
set_option linter.unusedVariables false
|
||
|
||
/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/
|
||
set_option maxHeartbeats 1000000
|
||
|
||
/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/
|
||
set_option maxRecDepth 2048
|
||
open pasta_curves
|
||
|
||
/-- [core::array::{impl core::convert::AsRef<[T]> for [T; N]}::as_ref]:
|
||
Source: '/rustc/library/core/src/array/mod.rs', lines 208:4-208:28
|
||
Name pattern: [core::array::{core::convert::AsRef<[@T; @N], [@T]>}::as_ref]
|
||
Visibility: public -/
|
||
@[rust_fun "core::array::{core::convert::AsRef<[@T; @N], [@T]>}::as_ref"]
|
||
axiom Array.Insts.CoreConvertAsRefSlice.as_ref
|
||
{T : Type} {N : Std.Usize} : Array T N → Result (Slice T)
|
||
|
||
/-- [core::array::{impl core::convert::AsMut<[T]> for [T; N]}::as_mut]:
|
||
Source: '/rustc/library/core/src/array/mod.rs', lines 217:4-217:36
|
||
Name pattern: [core::array::{core::convert::AsMut<[@T; @N], [@T]>}::as_mut]
|
||
Visibility: public -/
|
||
@[rust_fun "core::array::{core::convert::AsMut<[@T; @N], [@T]>}::as_mut"]
|
||
axiom Array.Insts.CoreConvertAsMutSlice.as_mut
|
||
{T : Type} {N : Std.Usize} :
|
||
Array T N → Result ((Slice T) × (Slice T → Array T N))
|
||
|
||
/-- [core::borrow::{impl core::borrow::Borrow<T> for T}::borrow]:
|
||
Source: '/rustc/library/core/src/borrow.rs', lines 214:4-214:26
|
||
Name pattern: [core::borrow::{core::borrow::Borrow<@T, @T>}::borrow]
|
||
Visibility: public -/
|
||
@[rust_fun "core::borrow::{core::borrow::Borrow<@T, @T>}::borrow"]
|
||
axiom core.borrow.Borrow.Blanket.borrow {T : Type} : T → Result T
|
||
|
||
/-- [core::borrow::{impl core::borrow::Borrow<T> for &'_0 T}::borrow]:
|
||
Source: '/rustc/library/core/src/borrow.rs', lines 230:4-230:26
|
||
Name pattern: [core::borrow::{core::borrow::Borrow<&'0 @T, @T>}::borrow]
|
||
Visibility: public -/
|
||
@[rust_fun "core::borrow::{core::borrow::Borrow<&'0 @T, @T>}::borrow"]
|
||
axiom Shared0T.Insts.CoreBorrowBorrow.borrow {T : Type} : T → Result T
|
||
|
||
/-- [core::convert::{impl core::convert::AsRef<U> for &'_0 T}::as_ref]:
|
||
Source: '/rustc/library/core/src/convert/mod.rs', lines 717:4-717:26
|
||
Name pattern: [core::convert::{core::convert::AsRef<&'0 @T, @U>}::as_ref]
|
||
Visibility: public -/
|
||
@[rust_fun "core::convert::{core::convert::AsRef<&'0 @T, @U>}::as_ref"]
|
||
axiom Shared0T.Insts.CoreConvertAsRef.as_ref
|
||
{T : Type} {U : Type} (AsRefInst : core.convert.AsRef T U) : T → Result U
|
||
|
||
/-- [ff::Field::sqrt]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ff-0.13.1/src/lib.rs', lines 144:4-144:36
|
||
Name pattern: [ff::Field::sqrt]
|
||
Visibility: public -/
|
||
@[rust_fun "ff::Field::sqrt"]
|
||
axiom ff.Field.sqrt.default
|
||
{Self : Type} (FieldInst : ff.Field Self) :
|
||
Self → Result (subtle.CtOption Self)
|
||
|
||
/-- [ff::Field::pow_vartime]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ff-0.13.1/src/lib.rs', lines 178:4-178:58
|
||
Name pattern: [ff::Field::pow_vartime]
|
||
Visibility: public -/
|
||
@[rust_fun "ff::Field::pow_vartime"]
|
||
axiom ff.Field.pow_vartime.default
|
||
{Self : Type} {S : Type} (FieldInst : ff.Field Self)
|
||
(coreconvertAsRefSSliceU64Inst : core.convert.AsRef S (Slice Std.U64)) :
|
||
Self → S → Result Self
|
||
|
||
/-- [ff::PrimeField::from_u128]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ff-0.13.1/src/lib.rs', lines 254:4-254:33
|
||
Name pattern: [ff::PrimeField::from_u128]
|
||
Visibility: public -/
|
||
@[rust_fun "ff::PrimeField::from_u128"]
|
||
axiom ff.PrimeField.from_u128.default
|
||
{Self : Type} {Clause0_Repr : Type} (PrimeFieldInst : ff.PrimeField Self
|
||
Clause0_Repr) :
|
||
Std.U128 → Result Self
|
||
|
||
/-- [subtle::{subtle::Choice}::unwrap_u8]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 133:4-133:33
|
||
Name pattern: [subtle::{subtle::Choice}::unwrap_u8]
|
||
Visibility: public -/
|
||
@[rust_fun "subtle::{subtle::Choice}::unwrap_u8"]
|
||
axiom subtle.Choice.unwrap_u8 : subtle.Choice → Result Std.U8
|
||
|
||
/-- [subtle::{impl core::ops::bit::BitAnd<subtle::Choice, subtle::Choice> for subtle::Choice}::bitand]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 162:4-162:42
|
||
Name pattern: [subtle::{core::ops::bit::BitAnd<subtle::Choice, subtle::Choice, subtle::Choice>}::bitand]
|
||
Visibility: public -/
|
||
@[rust_fun
|
||
"subtle::{core::ops::bit::BitAnd<subtle::Choice, subtle::Choice, subtle::Choice>}::bitand"]
|
||
axiom subtle.Choice.Insts.CoreOpsBitBitAndChoiceChoice.bitand
|
||
: subtle.Choice → subtle.Choice → Result subtle.Choice
|
||
|
||
/-- [subtle::{impl core::ops::bit::Not<subtle::Choice> for subtle::Choice}::not]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 207:4-207:26
|
||
Name pattern: [subtle::{core::ops::bit::Not<subtle::Choice, subtle::Choice>}::not]
|
||
Visibility: public -/
|
||
@[rust_fun
|
||
"subtle::{core::ops::bit::Not<subtle::Choice, subtle::Choice>}::not"]
|
||
axiom subtle.Choice.Insts.CoreOpsBitNotChoice.not
|
||
: subtle.Choice → Result subtle.Choice
|
||
|
||
/-- [subtle::{impl core::convert::From<u8> for subtle::Choice}::from]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 238:4-238:32
|
||
Name pattern: [subtle::{core::convert::From<subtle::Choice, u8>}::from]
|
||
Visibility: public -/
|
||
@[rust_fun "subtle::{core::convert::From<subtle::Choice, u8>}::from"]
|
||
axiom subtle.Choice.Insts.CoreConvertFromU8.from
|
||
: Std.U8 → Result subtle.Choice
|
||
|
||
/-- [subtle::{impl subtle::ConstantTimeEq for u64}::ct_eq]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 348:12-348:51
|
||
Name pattern: [subtle::{subtle::ConstantTimeEq<u64>}::ct_eq]
|
||
Visibility: public -/
|
||
@[rust_fun "subtle::{subtle::ConstantTimeEq<u64>}::ct_eq"]
|
||
axiom U64.Insts.SubtleConstantTimeEq.ct_eq
|
||
: Std.U64 → Std.U64 → Result subtle.Choice
|
||
|
||
/-- [subtle::{impl subtle::ConditionallySelectable for u64}::conditional_select]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 513:12-513:77
|
||
Name pattern: [subtle::{subtle::ConditionallySelectable<u64>}::conditional_select]
|
||
Visibility: public -/
|
||
@[rust_fun
|
||
"subtle::{subtle::ConditionallySelectable<u64>}::conditional_select"]
|
||
axiom U64.Insts.SubtleConditionallySelectable.conditional_select
|
||
: Std.U64 → Std.U64 → subtle.Choice → Result Std.U64
|
||
|
||
/-- [subtle::{subtle::CtOption<T>}::new]:
|
||
Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/subtle-2.6.1/src/lib.rs', lines 678:4-678:56
|
||
Name pattern: [subtle::{subtle::CtOption<@T>}::new]
|
||
Visibility: public -/
|
||
@[rust_fun "subtle::{subtle::CtOption<@T>}::new"]
|
||
axiom subtle.CtOption.new
|
||
{T : Type} : T → subtle.Choice → Result (subtle.CtOption T)
|
||
|
||
/-- [pasta_curves::fields::fp::{impl core::fmt::Debug for pasta_curves::fields::fp::Fp}::fmt]:
|
||
Source: 'src/fields/fp.rs', lines 34:4-41:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.CoreFmtDebug.fmt
|
||
:
|
||
fields.fp.Fp → core.fmt.Formatter → Result ((core.result.Result Unit
|
||
core.fmt.Error) × core.fmt.Formatter)
|
||
|
||
/-- [pasta_curves::fields::fp::{impl core::cmp::PartialOrd<pasta_curves::fields::fp::Fp> for pasta_curves::fields::fp::Fp}::partial_cmp]:
|
||
Source: 'src/fields/fp.rs', lines 92:4-94:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.CoreCmpPartialOrdFp.partial_cmp
|
||
: fields.fp.Fp → fields.fp.Fp → Result (Option Ordering)
|
||
|
||
/-- [pasta_curves::fields::fp::{impl core::cmp::Ord for pasta_curves::fields::fp::Fp}::cmp]:
|
||
Source: 'src/fields/fp.rs', lines 77:4-88:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.CoreCmpOrd.cmp
|
||
: fields.fp.Fp → fields.fp.Fp → Result Ordering
|
||
|
||
/-- [pasta_curves::fields::fp::{impl core::iter::traits::accum::Sum<T> for pasta_curves::fields::fp::Fp}::sum]:
|
||
Source: 'src/fields/fp.rs', lines 179:4-181:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.CoreIterTraitsAccumSum.sum
|
||
{T : Type} {I : Type} (coreborrowBorrowTFpInst : core.borrow.Borrow T
|
||
fields.fp.Fp) (coreitertraitsiteratorIteratorInst :
|
||
core.iter.traits.iterator.Iterator I T) :
|
||
I → Result fields.fp.Fp
|
||
|
||
/-- [pasta_curves::fields::fp::{impl core::iter::traits::accum::Product<T> for pasta_curves::fields::fp::Fp}::product]:
|
||
Source: 'src/fields/fp.rs', lines 185:4-187:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.CoreIterTraitsAccumProduct.product
|
||
{T : Type} {I : Type} (coreborrowBorrowTFpInst : core.borrow.Borrow T
|
||
fields.fp.Fp) (coreitertraitsiteratorIteratorInst :
|
||
core.iter.traits.iterator.Iterator I T) :
|
||
I → Result fields.fp.Fp
|
||
|
||
/-- [pasta_curves::fields::fp::{impl ff::Field for pasta_curves::fields::fp::Fp}::sqrt]:
|
||
Source: 'src/fields/fp.rs', lines 566:4-575:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.FfField.sqrt
|
||
: fields.fp.Fp → Result (subtle.CtOption fields.fp.Fp)
|
||
|
||
/-- [pasta_curves::fields::fp::{impl ff::Field for pasta_curves::fields::fp::Fp}::sqrt_ratio]:
|
||
Source: 'src/fields/fp.rs', lines 550:4-558:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.FfField.sqrt_ratio
|
||
: fields.fp.Fp → fields.fp.Fp → Result (subtle.Choice × fields.fp.Fp)
|
||
|
||
/-- [pasta_curves::fields::fp::{impl ff::Field for pasta_curves::fields::fp::Fp}::random]:
|
||
Source: 'src/fields/fp.rs', lines 528:4-539:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.FfField.random
|
||
{T0 : Type} (rand_coreRngCoreInst : rand_core.RngCore T0) :
|
||
T0 → Result fields.fp.Fp
|
||
|
||
/-- [pasta_curves::fields::fp::{impl pasta_curves::arithmetic::fields::SqrtTableHelpers<[u8; 32usize]> for pasta_curves::fields::fp::Fp}::get_lower_32]:
|
||
Source: 'src/fields/fp.rs', lines 780:4-785:5 -/
|
||
axiom
|
||
fields.fp.Fp.Insts.Pasta_curvesArithmeticFieldsSqrtTableHelpersArrayU832.get_lower_32
|
||
: fields.fp.Fp → Result Std.U32
|
||
|
||
/-- [pasta_curves::fields::fp::{impl pasta_curves::arithmetic::fields::SqrtTableHelpers<[u8; 32usize]> for pasta_curves::fields::fp::Fp}::pow_by_t_minus1_over2]:
|
||
Source: 'src/fields/fp.rs', lines 749:4-778:5 -/
|
||
axiom
|
||
fields.fp.Fp.Insts.Pasta_curvesArithmeticFieldsSqrtTableHelpersArrayU832.pow_by_t_minus1_over2
|
||
: fields.fp.Fp → Result fields.fp.Fp
|
||
|
||
/-- [pasta_curves::fields::fp::{impl ff::WithSmallOrderMulGroup<[u8; 32usize], 3u8> for pasta_curves::fields::fp::Fp}::ZETA]
|
||
Source: 'src/fields/fp.rs', lines 789:4-794:7
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.FfWithSmallOrderMulGroupArrayU8323.ZETA
|
||
: Result fields.fp.Fp
|
||
|
||
/-- [pasta_curves::fields::fp::{impl ff::FromUniformBytes<[u8; 32usize], 64usize> for pasta_curves::fields::fp::Fp}::from_uniform_bytes]:
|
||
Source: 'src/fields/fp.rs', lines 800:4-811:5
|
||
Visibility: public -/
|
||
axiom fields.fp.Fp.Insts.FfFromUniformBytesArrayU83264.from_uniform_bytes
|
||
: Array Std.U8 64#usize → Result fields.fp.Fp
|
||
|