-
-
Notifications
You must be signed in to change notification settings - Fork 30
Link file for air
, cont. after squash branch from main
#737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ec68595
minor: update `blake_air::air`
InfiniteEchoes 4af6c9c
minor: update `columns`
InfiniteEchoes 20b8ab3
minor: update `air` and `dense`
InfiniteEchoes 6b22e2b
minor: update `air` comment
InfiniteEchoes b432bb0
minor: update wrt comments
InfiniteEchoes 27c9ed0
minor: more updates to eliminate warnings
InfiniteEchoes ec6f890
minor: fix type paths
InfiniteEchoes 4b36cad
minor: comments
InfiniteEchoes 4a13161
draft: save progress
InfiniteEchoes eb971fa
minor: progress on `columns`
InfiniteEchoes b3fb8ef
minor: progress
InfiniteEchoes e395c05
feat : Add value instances for `columns`
InfiniteEchoes 49e7918
minor: delete test case in `columns`
InfiniteEchoes 6f09a78
minor: delete comment
InfiniteEchoes 31a99d2
feat: Compile `air`
InfiniteEchoes 4fa1b35
minor: update `constants`
InfiniteEchoes 6c4582e
minor: comments
InfiniteEchoes 2a92723
minor: delete link namings wrt comments
InfiniteEchoes 2b0aaa9
minor: redesign `QuarterRound`'s arguments
InfiniteEchoes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,182 @@ | ||
Require Import CoqOfRust.CoqOfRust. | ||
Require Import CoqOfRust.links.M. | ||
Require Import plonky3.blake3_air.air. | ||
Require Import plonky3.field.links.field. | ||
Require Import plonky3.blake3_air.links.columns. | ||
Require Import plonky3.air.links.air. | ||
Require Import plonky3.matrix.links.dense. | ||
|
||
(* | ||
TODO: | ||
- Refer to `gas` to deal with different impls | ||
- Check if AirBuilder needs `AB_types` | ||
*) | ||
|
||
(* pub struct Blake3Air {} *) | ||
Module Blake3Air. | ||
Inductive t : Set := | ||
| Make. | ||
|
||
Global Instance IsLink : Link t := { | ||
Φ := Ty.path "plonky3::blake3-air::Blake3Air"; | ||
Φ := Ty.path "p3_blake3_air::air::Blake3Air"; | ||
φ _ := Value.StructRecord "p3_blake3_air::air::Blake3Air" [] [] []; | ||
}. | ||
|
||
Definition of_ty : OfTy.t (Ty.path "plonky3::blake3-air::Blake3Air"). | ||
Definition of_ty : OfTy.t (Ty.path "p3_blake3_air::air::Blake3Air"). | ||
Proof. eapply OfTy.Make with (A := t); reflexivity. Defined. | ||
Smpl Add apply of_ty : of_ty. | ||
Smpl Add apply of_ty : of_ty. | ||
InfiniteEchoes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
End Blake3Air. | ||
|
||
Module Impl_Blake3Air. | ||
(* TODO: figure out what is this `PrimeField64` *) | ||
(* | ||
impl Blake3Air { | ||
pub fn generate_trace_rows<F: PrimeField64>( | ||
&self, | ||
num_hashes: usize, | ||
extra_capacity_bits: usize, | ||
) -> RowMajorMatrix<F> { | ||
*) | ||
Definition Self := Blake3Air.t. | ||
(* | ||
impl Blake3Air { | ||
pub fn generate_trace_rows<F: PrimeField64>( | ||
&self, | ||
num_hashes: usize, | ||
extra_capacity_bits: usize, | ||
) -> RowMajorMatrix<F> | ||
*) | ||
Instance run_generate_trace_rows | ||
{F : Set} `{Link F} | ||
{run_PrimeField64_for_F : PrimeField64.Run F} | ||
(self : Ref.t Pointer.Kind.Ref Self) (num_hashes : Usize.t) (extra_capacity_bits : Usize.t) : | ||
Run.Trait | ||
blake3_air.air.air.Impl_p3_blake3_air_air_Blake3Air.generate_trace_rows [] [ Φ F ] [ φ num_hashes; φ extra_capacity_bits ] | ||
(RowMajorMatrix.t F). | ||
Proof. | ||
constructor. | ||
run_symbolic. | ||
Admitted. | ||
|
||
(* | ||
Instance run_STOP : | ||
(* | ||
fn quarter_round_function<AB: AirBuilder>( | ||
&self, | ||
builder: &mut AB, | ||
trace: &QuarterRound<<AB as AirBuilder>::Var, <AB as AirBuilder>::Expr>, | ||
) | ||
*) | ||
Instance run_quarter_round_function | ||
{AB : Set} `{Link AB} | ||
{run_AirBuilder_for_AB : AirBuilder.Run AB} | ||
(* TODO: check if AirBuilder needs `AB_types` *) | ||
(self : Ref.t Pointer.Kind.Ref Self) | ||
(builder : Ref.t Pointer.Kind.MutRef AB) | ||
(* TODO: in the future, refer to revm to see if its possible to change ab into airbuilder *) | ||
(* TODO: translate `trace: &QuarterRound<<AB as AirBuilder>::Var, <AB as AirBuilder>::Expr>` *) | ||
(trace : Set) | ||
: | ||
Run.Trait | ||
opcode.Impl_revm_bytecode_opcode_OpCode.value_STOP [] [] [] | ||
(Ref.t Pointer.Kind.Raw OpCode.t). | ||
blake3_air.air.air.Impl_p3_blake3_air_air_Blake3Air.quarter_round_function [] [ Φ AB ] [ φ builder (* ; φ trace *) ] | ||
InfiniteEchoes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unit. | ||
Proof. | ||
constructor. | ||
run_symbolic. | ||
Defined. | ||
*) | ||
Admitted. | ||
|
||
(* | ||
const fn full_round_to_column_quarter_round<'a, T: Copy, U>( | ||
&self, | ||
input: &'a Blake3State<T>, | ||
round_data: &'a FullRound<T>, | ||
m_vector: &'a [[U; 2]; 16], | ||
index: usize, | ||
) -> QuarterRound<'a, T, U> | ||
*) | ||
Instance run_full_round_to_column_quarter_round | ||
(* NOTE: seems like there are some issues with T and U being defined here *) | ||
{T U : Set} `{T_Link : Link T} `{U_Link : Link U} | ||
InfiniteEchoes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(self : Ref.t Pointer.Kind.Ref Self) | ||
(input : Ref.t Pointer.Kind.Ref (Blake3State.t T)) | ||
(round_data : Ref.t Pointer.Kind.Ref (FullRound.t T)) | ||
(m_vector : Ref.t Pointer.Kind.Ref (array.t (array.t U {| Integer.value := 2 |}) {| Integer.value := 16 |})) | ||
(index : Usize.t) | ||
: | ||
Run.Trait | ||
blake3_air.air.air.Impl_p3_blake3_air_air_Blake3Air.full_round_to_column_quarter_round [] [ Φ T; Φ U ] | ||
[ (* φ input; φ round_data; φ m_vector; φ index *) ] | ||
(QuarterRound.t T U T_Link U_Link). | ||
InfiniteEchoes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Proof. | ||
constructor. | ||
run_symbolic. | ||
Admitted. | ||
|
||
(* | ||
const fn full_round_to_diagonal_quarter_round<'a, T: Copy, U>( | ||
&self, | ||
round_data: &'a FullRound<T>, | ||
m_vector: &'a [[U; 2]; 16], | ||
index: usize, | ||
) -> QuarterRound<'a, T, U> | ||
*) | ||
Instance run_full_round_to_diagonal_quarter_round | ||
{T U : Set} `{T_Link : Link T} `{U_Link : Link U} | ||
InfiniteEchoes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(self : Ref.t Pointer.Kind.Ref Self) | ||
(round_data : Ref.t Pointer.Kind.Ref (FullRound.t T)) | ||
(m_vector : Ref.t Pointer.Kind.Ref (array.t (array.t U {| Integer.value := 2 |}) {| Integer.value := 16 |})) | ||
(index : Usize.t) | ||
: | ||
Run.Trait | ||
blake3_air.air.air.Impl_p3_blake3_air_air_Blake3Air.full_round_to_diagonal_quarter_round [] [ Φ T; Φ U ] | ||
[ (* φ input; φ round_data; φ m_vector; φ index *) ] | ||
(QuarterRound.t T U T_Link U_Link). | ||
Proof. | ||
constructor. | ||
run_symbolic. | ||
Admitted. | ||
|
||
(* | ||
fn verify_round<AB: AirBuilder>( | ||
&self, | ||
builder: &mut AB, | ||
input: &Blake3State<AB::Var>, | ||
round_data: &FullRound<AB::Var>, | ||
m_vector: &[[AB::Expr; 2]; 16], | ||
) | ||
*) | ||
Instance run_verify_round | ||
{AB : Set} `{Link AB} | ||
{run_AirBuilder_for_AB : AirBuilder.Run AB} | ||
(self : Ref.t Pointer.Kind.Ref Self) | ||
(builder : Ref.t Pointer.Kind.MutRef AB) | ||
(* TODO: translate correctly the following variables *) | ||
(* (input : Ref.t Pointer.Kind.Ref Blake3State.t (AB.Var)) *) | ||
(* (round_data : Ref.t Pointer.Kind.Ref FullRound (AB.Var)) *) | ||
(* (m_vector : list (list Set)) *) | ||
: | ||
Run.Trait | ||
blake3_air.air.air.Impl_p3_blake3_air_air_Blake3Air.verify_round [] [ Φ AB ] | ||
[ φ builder (* ; φ input; φ round_data; φ m_vector *) ] | ||
unit. | ||
Proof. | ||
constructor. | ||
run_symbolic. | ||
Admitted. | ||
End Impl_Blake3Air. | ||
|
||
(* | ||
impl<F> BaseAir<F> for Blake3Air { | ||
fn width(&self) -> usize { | ||
NUM_BLAKE3_COLS | ||
} | ||
} | ||
*) | ||
Module Impl_BaseAir_for_Blake3Air. | ||
Definition Self : Set := | ||
Blake3Air.t. | ||
|
||
(* Instance run : BaseAir.Run Self. *) | ||
(* Admitted. *) | ||
End Impl_BaseAir_for_Blake3Air. | ||
|
||
(* | ||
impl<AB: AirBuilder> Air<AB> for Blake3Air { | ||
fn eval(&self, builder: &mut AB) | ||
*) | ||
Module Impl_Air_for_Blake3Air. | ||
Definition Self : Set := | ||
Blake3Air.t. | ||
|
||
(* Instance run : Air.Run Self. *) | ||
(* Admitted. *) | ||
End Impl_Air_for_Blake3Air. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.